19#include "TMatrixDSym.h"
22#include "TObjString.h"
36 const double rangeEpsilon = 1.e-5;
39 const int maxParameters = 10;
88 TMap(), m_objResult(0), m_objSystematics(0), m_vars(), m_restrict(false)
119std::vector<std::string>
126 std::vector<std::string> uncertainties;
127 TIter it(GetTable());
128 while (TPair*
pair = (TPair*) it()) {
130 uncertainties.emplace_back(
pair->Key()->GetName());
132 return uncertainties;
138 std::map<std::string, UncertaintyResult>& all)
146 double single_result;
149 std::cerr <<
"in CalibrationDataContainer::getUncertainties(): error retrieving result!" << std::endl;
153 result.first = single_result;
155 all[std::string(
"result")] =
result;
160 std::cerr <<
"in CalibrationDataContainer::getUncertainties(): error retrieving stat. uncertainty!" << std::endl;
164 result.first = single_result;
165 result.second = -single_result;
166 all[std::string(
"statistics")] =
result;
169 TIter it(GetTable());
170 while (TPair*
pair = (TPair*) it()) {
171 std::string spec(
pair->Key()->GetName());
173 if (spec ==
"comment" || spec ==
"result" || spec ==
"statistics" || spec ==
"MChadronisation" || spec ==
"excluded_set")
continue;
177 std::cerr <<
"in CalibrationDataContainer::getUncertainties(): error retrieving named uncertainty "
178 << spec <<
"!" << std::endl;
194 TObject* obj = GetValue(
"comment");
195 if (! obj)
return std::string(
"");
196 TObjString* s =
dynamic_cast<TObjString*
>(obj);
197 if (! s )
return std::string(
"");
198 return std::string(s->GetName());
206 const static std::string null(
"");
208 TObject* obj = GetValue(
"MChadronisation");
209 if (! obj)
return null;
210 TObjString* s =
dynamic_cast<TObjString*
>(obj);
211 if (! s )
return null;
212 return std::string(s->GetName());
220 const static std::string null(
"");
222 TObject* obj = GetValue(
"excluded_set");
223 if (! obj)
return null;
224 TObjString* s =
dynamic_cast<TObjString*
>(obj);
225 if (! s )
return null;
226 return std::string(s->GetName());
238 if (TPair* p = (TPair*) FindObject(unc.c_str())) DeleteEntry(p->Key());
239 Add(
new TObjString(unc.c_str()), obj);
262 if (TPair* p = (TPair*) FindObject(
"comment")) DeleteEntry(p->Key());
263 Add(
new TObjString(
"comment"),
new TObjString(text.c_str()));
274 if (TPair* p = (TPair*) FindObject(
"MChadronisation")) DeleteEntry(p->Key());
275 Add(
new TObjString(
"MChadronisation"),
new TObjString(text.c_str()));
286 if (TPair* p = (TPair*) FindObject(
"excluded_set")) DeleteEntry(p->Key());
287 Add(
new TObjString(
"excluded_set"),
new TObjString(text.c_str()));
297 if (key ==
"eta")
return kEta;
298 else if (key ==
"abseta")
return kAbsEta;
299 else if (key ==
"pt")
return kPt;
300 else if (key ==
"tagweight")
return kTagWeight;
326 for (
unsigned int var = 0; var <
m_variables.size(); ++var) {
372 double minDefault = (vartype ==
kAbsEta || vartype ==
kPt) ? 0 : -std::numeric_limits<double>::max();
385 if (! (vartype <
m_lowerBounds.size()))
return std::numeric_limits<double>::max();
390std::vector<std::pair<double, double> >
398 std::vector<std::pair<double, double> > bounds;
407std::vector<unsigned int>
466 m_lowerBounds.clear();
467 m_lowerBounds.resize(maxParameters, -std::numeric_limits<double>::max());
468 m_lowerBounds[kPt] = m_lowerBounds[kAbsEta] = 0;
469 m_upperBounds.clear();
470 m_upperBounds.resize(maxParameters, std::numeric_limits<double>::max());
472 m_lowerBoundsExtrapolated.clear();
473 m_lowerBoundsExtrapolated.resize(maxParameters, -std::numeric_limits<double>::max());
474 m_lowerBoundsExtrapolated[kPt] = m_lowerBounds[kAbsEta] = 0;
475 m_upperBoundsExtrapolated.clear();
476 m_upperBoundsExtrapolated.resize(maxParameters, std::numeric_limits<double>::max());
479 restrictToRange(
true);
506 const TH1* hobj =
dynamic_cast<const TH1*
>(
m_objResult);
508 std::cerr <<
"in CalibrationDataHistogramContainer::computeVariableTypes(): dynamic_cast failed\n";
512 int dims = hobj->GetDimension();
513 for (
int dim = 0; dim < dims; ++dim) {
514 const TAxis* axis = 0;
516 case 0: axis = hobj->GetXaxis();
break;
517 case 1: axis = hobj->GetYaxis();
break;
518 default: axis = hobj->GetZaxis();
523 std::cerr <<
"in CalibrationDataHistogramContainer::computeVariableTypes(): cannot construct variable type from name "
524 << axis->GetTitle() << std::endl;
540 double&
result, TObject* obj,
bool extrapolate)
558 TH1* hist =
dynamic_cast<TH1*
>(obj);
595 std::cout <<
" getStatUncertainty error: no (valid) central values object!" << std::endl;
636 if (unc ==
"statistics") {
646 if (!obj) obj = GetValue(unc.c_str());
647 TH1* hist =
dynamic_cast<TH1*
>(obj);
679 const TH1* hist =
dynamic_cast<const TH1*
>(
m_objResult);
681 std::cerr <<
"in CalibrationDataHistogramContainer::checkBounds(): object type does not derive from TH1" << std::endl;
683 }
else if (hist->GetDimension() !=
int(
m_variables.size())) {
684 std::cerr <<
"in CalibrationDataHistogramContainer::checkBounds(): given number of variable types ("
685 <<
m_variables.size() <<
") doesn't match histogram dimension ("
686 << hist->GetDimension() <<
")!" << std::endl;
690 const TH1* hExtrapolate =
dynamic_cast<const TH1*
>(GetValue(
"extrapolation"));
691 for (
unsigned int t = 0; int(t) < hist->GetDimension(); ++t) {
692 const TAxis* axis;
const TAxis* axis2 = 0;
694 case 0: axis = hist->GetXaxis();
if (hExtrapolate) axis2 = hExtrapolate->GetXaxis();
break;
695 case 1: axis = hist->GetYaxis();
if (hExtrapolate) axis2 = hExtrapolate->GetYaxis();
break;
696 default: axis = hist->GetZaxis();
if (hExtrapolate) axis2 = hExtrapolate->GetZaxis();
764 switch (hist->GetDimension()) {
771 return hist->Interpolate(
m_vars[0]);
779 TAxis* xAxis = hist->GetXaxis();
780 TAxis* yAxis = 0; TAxis* zAxis = 0;
781 Double_t x0,x1,y0,y1;
783 Int_t ndim = hist->GetDimension();
787 Int_t xbin = hist->FindBin(
m_vars[0]);
789 if(
m_vars[0] <= hist->GetBinCenter(1)) {
790 return hist->GetBinError(1);
791 }
else if(
m_vars[0] >= hist->GetBinCenter(hist->GetNbinsX())) {
792 return hist->GetBinError(hist->GetNbinsX());
795 if(
m_vars[0] <= hist->GetBinCenter(xbin)) {
796 y0 = hist->GetBinError(xbin-1);
797 x0 = hist->GetBinCenter(xbin-1);
798 y1 = hist->GetBinError(xbin);
799 x1 = hist->GetBinCenter(xbin);
801 y0 = hist->GetBinError(xbin);
802 x0 = hist->GetBinCenter(xbin);
803 y1 = hist->GetBinError(xbin+1);
804 x1 = hist->GetBinCenter(xbin+1);
806 return y0 + (
m_vars[0]-x0)*((y1-y0)/(x1-x0));
808 }
else if (ndim == 2) {
816 yAxis = hist->GetYaxis();
817 Int_t bin_x = xAxis->FindBin(
m_vars[0]);
818 Int_t bin_y = yAxis->FindBin(
m_vars[1]);
819 if (bin_x<1 || bin_x>hist->GetNbinsX() || bin_y<1 || bin_y>hist->GetNbinsY()) {
820 Error(
"Interpolate",
"Cannot interpolate outside histogram domain.");
825 dx = xAxis->GetBinUpEdge(bin_x)-
m_vars[0];
826 dy = yAxis->GetBinUpEdge(bin_y)-
m_vars[1];
827 if (dx<=xAxis->GetBinWidth(bin_x)/2 && dy<=yAxis->GetBinWidth(bin_y)/2) {
829 x1 = xAxis->GetBinCenter(bin_x);
830 y1 = yAxis->GetBinCenter(bin_y);
831 x2 = xAxis->GetBinCenter(bin_x+1);
832 y2 = yAxis->GetBinCenter(bin_y+1);
833 }
else if (dx>xAxis->GetBinWidth(bin_x)/2 && dy<=yAxis->GetBinWidth(bin_y)/2) {
835 x1 = xAxis->GetBinCenter(bin_x-1);
836 y1 = yAxis->GetBinCenter(bin_y);
837 x2 = xAxis->GetBinCenter(bin_x);
838 y2 = yAxis->GetBinCenter(bin_y+1);
839 }
else if (dx>xAxis->GetBinWidth(bin_x)/2 && dy>yAxis->GetBinWidth(bin_y)/2) {
841 x1 = xAxis->GetBinCenter(bin_x-1);
842 y1 = yAxis->GetBinCenter(bin_y-1);
843 x2 = xAxis->GetBinCenter(bin_x);
844 y2 = yAxis->GetBinCenter(bin_y);
847 x1 = xAxis->GetBinCenter(bin_x);
848 y1 = yAxis->GetBinCenter(bin_y-1);
849 x2 = xAxis->GetBinCenter(bin_x+1);
850 y2 = yAxis->GetBinCenter(bin_y);
852 Int_t bin_x1 = xAxis->FindBin(x1);
853 if(bin_x1<1) bin_x1=1;
854 Int_t bin_x2 = xAxis->FindBin(x2);
855 if(bin_x2>hist->GetNbinsX()) bin_x2=hist->GetNbinsX();
856 Int_t bin_y1 = yAxis->FindBin(y1);
857 if(bin_y1<1) bin_y1=1;
858 Int_t bin_y2 = yAxis->FindBin(y2);
859 if(bin_y2>hist->GetNbinsY()) bin_y2=hist->GetNbinsY();
860 Int_t bin_q22 = hist->GetBin(bin_x2,bin_y2);
861 Int_t bin_q12 = hist->GetBin(bin_x1,bin_y2);
862 Int_t bin_q11 = hist->GetBin(bin_x1,bin_y1);
863 Int_t bin_q21 = hist->GetBin(bin_x2,bin_y1);
864 Double_t q11 = hist->GetBinError(bin_q11);
865 Double_t q12 = hist->GetBinError(bin_q12);
866 Double_t q21 = hist->GetBinError(bin_q21);
867 Double_t q22 = hist->GetBinError(bin_q22);
868 Double_t d = 1.0*(x2-x1)*(y2-y1);
879 yAxis = hist->GetYaxis();
880 zAxis = hist->GetZaxis();
882 Int_t ubx = xAxis->FindBin(
m_vars[0]);
883 if (
m_vars[0] < xAxis->GetBinCenter(ubx) ) ubx -= 1;
886 Int_t uby = yAxis->FindBin(
m_vars[1]);
887 if (
m_vars[1] < yAxis->GetBinCenter(uby) ) uby -= 1;
890 Int_t ubz = zAxis->FindBin(
m_vars[2]);
891 if (
m_vars[2] < zAxis->GetBinCenter(ubz) ) ubz -= 1;
897 if (ubx <=0 || uby <=0 || ubz <= 0 ||
898 obx > xAxis->GetNbins() || oby > yAxis->GetNbins() || obz > zAxis->GetNbins() ) {
901 Double_t xw = xAxis->GetBinCenter(obx) - xAxis->GetBinCenter(ubx);
902 Double_t yw = yAxis->GetBinCenter(oby) - yAxis->GetBinCenter(uby);
903 Double_t zw = zAxis->GetBinCenter(obz) - zAxis->GetBinCenter(ubz);
905 Double_t xd = (
m_vars[0] - xAxis->GetBinCenter(ubx)) / xw;
906 Double_t yd = (
m_vars[1] - yAxis->GetBinCenter(uby)) / yw;
907 Double_t zd = (
m_vars[2] - zAxis->GetBinCenter(ubz)) / zw;
910 Double_t v[] = { hist->GetBinError( ubx, uby, ubz ), hist->GetBinError( ubx, uby, obz ),
911 hist->GetBinError( ubx, oby, ubz ), hist->GetBinError( ubx, oby, obz ),
912 hist->GetBinError( obx, uby, ubz ), hist->GetBinError( obx, uby, obz ),
913 hist->GetBinError( obx, oby, ubz ), hist->GetBinError( obx, oby, obz ) };
916 Double_t i1 = v[0] * (1 - zd) + v[1] * zd;
917 Double_t i2 = v[2] * (1 - zd) + v[3] * zd;
918 Double_t j1 = v[4] * (1 - zd) + v[5] * zd;
919 Double_t j2 = v[6] * (1 - zd) + v[7] * zd;
922 Double_t w1 = i1 * (1 - yd) + i2 * yd;
923 Double_t w2 = j1 * (1 - yd) + j2 * yd;
926 Double_t
result = w1 * (1 - xd) + w2 * xd;
961 std::vector<double> boundaries;
970 const TH1* hobj =
dynamic_cast<const TH1*
>(
m_objResult);
971 if (!hobj)
return boundaries;
972 const TAxis* axis = 0;
973 if (
m_variables[0] == vartype) axis = hobj->GetXaxis();
974 else if (
m_variables[1] == vartype) axis = hobj->GetYaxis();
975 else axis = hobj->GetZaxis();
978 const TArrayD*
bins = axis->GetXbins();
int nb =
bins->GetSize();
979 for (
int b = 0; b < nb; ++b) boundaries.push_back(
bins->At(b));
989 TObject* obj = GetValue(
"ReducedSets");
990 if (! obj)
return -1;
991 TVectorT<double>* v =
dynamic_cast<TVectorT<double>*
>(obj);
992 if (! (v && v->GetNoElements() >
int(choice)) )
return -1;
993 return int((*v)[choice]);
1043 const TH1* hobj =
dynamic_cast<const TH1*
>(
m_objResult);
1045 std::cerr <<
"in CalibrationDataMappedHistogramContainer::computeVariableTypes(): dynamic cast failed\n";
1049 int dims = hobj->GetDimension();
1050 for (
int dim = 0; dim < dims; ++dim) {
1051 const TAxis* axis = 0;
1053 case 0: axis = hobj->GetXaxis();
break;
1054 case 1: axis = hobj->GetYaxis();
break;
1055 default: axis = hobj->GetZaxis();
1057 std::string var(axis->GetTitle());
1058 if (var ==
"mapped") {
1061 for (
unsigned int m = 0; m <
m_mapped.size(); ++m) {
1064 assert (! (vartype < 0));
1073 std::cerr <<
"in CalibrationDataMappedHistogramContainer::computeVariableTypes(): cannot construct variable type from name "
1074 << var << std::endl;
1099 const TH1* hist =
dynamic_cast<const TH1*
>(
m_objResult);
1101 std::cerr <<
"in CalibrationDataHistogramContainer::checkBounds(): object type does not derive from TH1" << std::endl;
1104 std::cerr <<
"in CalibrationDataMappedHistogramContainer::checkBounds(): given number of variable types ("
1105 <<
m_variables.size() <<
") doesn't match (mapped) histogram dimension ("
1106 << hist->GetDimension() +
m_mapped.size() - 1 <<
")!" << std::endl;
1115 for (
unsigned int t = 0, t2 = 0; int(t) < hist->GetDimension(); ++t) {
1116 const TAxis* axis = 0;
1118 case 0: axis = hist->GetXaxis();
break;
1119 case 1: axis = hist->GetYaxis();
break;
1120 default: axis = hist->GetZaxis();
1143 double amax = axis->GetXmax(), amin = axis->GetXmin();
1154 double&
result, TObject* obj,
bool )
1173 TH1* hist =
dynamic_cast<TH1*
>(obj);
1225 if (unc ==
"statistics") {
1234 if (!obj) obj = GetValue(unc.c_str());
1235 TH1* hist =
dynamic_cast<TH1*
>(obj);
1259 int hist_type = int(
type);
1275const std::vector<std::string>&
1318 std::cerr <<
"CalibrationDataMappedHistogramContainer::findMappedBin(): unable to find bin for mapping variables:";
1319 for (
unsigned int d = 0; d <
m_mapped.size(); ++d) std::cerr <<
"\t" <<
x[d];
1320 std::cerr << std::endl;
1333 const TH1* hist =
dynamic_cast<const TH1*
>(
m_objResult);
1335 std::cerr <<
"CalibrationDataMappedHistogramContainer::findBin(): dynamic cast failed\n";
1338 Int_t ndim = hist->GetDimension();
1341 for (
unsigned int dim = 0; dim < (
unsigned int) ndim; ++dim) {
1345 const TAxis* axis = 0;
1347 case 0: axis = hist->GetXaxis();
break;
1348 case 1: axis = hist->GetYaxis();
break;
1349 default: axis = hist->GetZaxis();
1372 std::vector<double> boundaries;
1374 for (
unsigned int v = 0; v <
m_variables.size(); ++v)
1376 if (var == -1)
return boundaries;
1380 const TH1* hobj =
dynamic_cast<const TH1*
>(
m_objResult);
1386 double binBoundaries[2];
1391 if (boundaries.size() == 0) {
1392 boundaries.push_back(binBoundaries[0]); boundaries.push_back(binBoundaries[1]);
1394 for (
unsigned int ib = 0; ib < 2; ++ib) {
1395 double newvalue = binBoundaries[ib];
1397 for (std::vector<double>::iterator it = boundaries.begin(); it != boundaries.end(); ++it) {
1401 }
else if (newvalue < *it) {
1403 boundaries.insert(it, newvalue);
1408 if (! done) boundaries.push_back(newvalue);
1415 const TAxis* axis = 0;
1417 case 0: axis = hobj->GetXaxis();
break;
1418 case 1: axis = hobj->GetYaxis();
break;
1419 default: axis = hobj->GetZaxis();
1422 const TArrayD*
bins = axis->GetXbins();
1426 int nb =
bins->GetSize();
1427 for (
int b = 0; b < nb; ++b) boundaries.push_back(
bins->At(b));
1452 m_dimension(0), m_low(0), m_up(0)
1463 m_up =
new double[dimension];
1464 m_low =
new double[dimension];
1465 for (
unsigned int dim = 0; dim < dimension; ++dim) {
1466 m_up[dim] = up[dim];
1467 m_low[dim] = low[dim];
1473 m_dimension(other.m_dimension)
1477 for (
unsigned int dim = 0; dim <
m_dimension; ++dim) {
1478 m_up[dim] = other.m_up[dim];
1479 m_low[dim] = other.m_low[dim];
1487 if (
this != &other) {
1493 for (
unsigned int dim = 0; dim <
m_dimension; ++dim) {
1494 m_up[dim] = other.m_up[dim];
1495 m_low[dim] = other.m_low[dim];
1514 for (
unsigned int dim = 0; dim <
m_dimension; ++dim)
1515 if (
x[dim] <
m_low[dim] ||
x[dim] >
m_up[dim])
return false;
1556 m_lowerBounds.clear();
1557 m_lowerBounds.resize(maxParameters, -std::numeric_limits<double>::max());
1558 m_lowerBounds[kPt] = m_lowerBounds[kAbsEta] = 0;
1559 m_upperBounds.clear();
1560 m_upperBounds.resize(maxParameters, std::numeric_limits<double>::max());
1563 m_lowerBoundsExtrapolated.clear();
1564 m_lowerBoundsExtrapolated.resize(maxParameters, -std::numeric_limits<double>::max());
1565 m_lowerBoundsExtrapolated[kPt] = m_lowerBoundsExtrapolated[kAbsEta] = 0;
1566 m_upperBoundsExtrapolated.clear();
1567 m_upperBoundsExtrapolated.resize(maxParameters, std::numeric_limits<double>::max());
1587 std::string::size_type pos = title.find(
";");
1588 while (pos != std::string::npos && pos != title.size()) {
1589 title = title.substr(pos+1);
1590 pos = title.find(
";");
1591 std::string var = title.substr(0, pos);
1595 std::cerr <<
"in CalibrationDataFunctionContainer::computeVariableTypes(): cannot construct variable type from name "
1596 << var << std::endl;
1611 double&
result, TObject* obj,
bool )
1624 TF1* func =
dynamic_cast<TF1*
>(obj);
1652 if (unc ==
"statistics") {
1662 if (!obj) obj = GetValue(unc.c_str());
1663 TF1* func =
dynamic_cast<TF1*
>(obj);
1702 TMatrixTSym<double>* cov =
dynamic_cast<TMatrixTSym<double>*
>(
m_objStatistics);
1717 const Double_t eps = 0.5;
1719 int npar = func->GetNpar();
1725 TMatrixT<double> gradients(npar,1);
1726 for (
int ipar = 0; ipar < npar; ++ipar) {
1727 gradients(ipar,0) = func->GradientPar(ipar,
m_vars, eps);
1731 TMatrixT<double> gradientsTransposed(TMatrixT<double>::kTransposed, gradients);
1736 TMatrixT<double> tmp1(*cov, TMatrixT<double>::kMult, gradients);
1740 TMatrixT<double> tmp2(gradientsTransposed, TMatrixT<double>::kMult, tmp1);
1742 result = TMath::Sqrt(tmp2(0,0));
1755 double diff =
a - b;
1756 double ref = std::fabs(
a) + std::fabs(b);
const boost::regex ref(r_ef)
ClassImp(CalibrationDataContainer) CalibrationDataContainer
std::pair< std::vector< unsigned int >, bool > res
static const std::vector< std::string > bins
ClassImp(xAOD::Experimental::RFileChecker) namespace xAOD
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
This is the interface for the objects to be stored in the calibration ROOT file.
void setResult(TObject *obj)
insert the main object for this calibration
double getLowerBound(unsigned int vartype, bool extrapolate=false) const
retrieve the lower bound of validity for the requested variable type
std::vector< double > m_upperBoundsExtrapolated
(possibly looser) lower validity bounds for extrapolation
virtual CalibrationStatus getUncertainty(const std::string &unc, const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)=0
retrieve the calibration uncertainty due to the given source.
void setExcludedUncertainties(const std::string &text)
insert the set of uncertainties that are recommended for removal from the eigenvector decomposition.
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)=0
retrieve the calibration statistical uncertainty.
std::vector< double > m_lowerBoundsExtrapolated
double getUpperBound(unsigned int vartype, bool extrapolate=false) const
retrieve the upper bound of validity for the requested variable type
int typeFromString(const std::string &key) const
Connection between variable names (on histogram axes etc.) and variable 'types' as used in actual eva...
CalibrationStatus getUncertainties(const CalibrationDataVariables &x, std::map< std::string, Analysis::UncertaintyResult > &all)
retrieve the list of "uncertainties" accessible to this object.
void setUncertainty(const std::string &unc, TObject *obj)
insert the relevant object for the requested source of 'uncertainty'
virtual void computeVariableTypes()=0
decode the 'uncertainty' objects' names to determine the relevant variable types
std::vector< std::pair< double, double > > getBounds()
allow the user to inspect the bounds of validity
CalibrationStatus getSystUncertainty(const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
retrieve the calibration total systematic uncertainty
CalibrationStatus computeVariables(const CalibrationDataVariables &x, bool extrapolate=false)
compute the variables to be used for the given 'uncertainty'
void setHadronisation(const std::string &text)
insert the given text as the 'hadronisation reference' for this calibration
std::string getHadronisation() const
retrieve the 'hadronisation reference' entered for this calibration, if any
TObject * m_objSystematics
don't persistify
std::string getExcludedUncertainties() const
retrieve the (semicolon-separated) set of uncertainties that are recommended for removal from the eig...
std::vector< double > m_lowerBounds
static bool isNearlyEqual(double a, double b)
utility for comparison of doubles
void setComment(const std::string &text)
insert the given text as comment for this calibration
std::vector< double > m_upperBounds
double m_vars[MaxCalibrationVars]
don't persistify
bool m_restrict
persistency not needed for this variable
std::vector< unsigned int > getVariableTypes()
utility to retrieve variable types
std::vector< std::string > listUncertainties() const
retrieve the list of "uncertainties" accessible to this object.
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)=0
retrieve the calibration result.
TObject * m_objResult
(possibly looser) upper validity bounds for extrapolation
std::string getComment() const
retrieve the comments entered for this calibration, if any
std::vector< unsigned int > m_variables
don't persistify
This is the class holding information for function-based calibration results.
virtual CalibrationStatus getUncertainty(const std::string &unc, const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
retrieve the calibration uncertainty due to the given source.
CalibrationDataFunctionContainer(const char *name="default")
TObject * m_objStatistics
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)
retrieve the calibration statistical uncertainty.
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool=false)
retrieve the calibration result.
virtual void computeVariableTypes()
cached
This is the class holding information for histogram-based calibration results.
virtual int getEigenvectorReduction(unsigned int choice) const
Retrieve the number of eigenvectors to be retained for the purpose of eigenvector variation reduction...
std::map< unsigned int, std::vector< double > > m_binBoundaries
Cache for bin boundary information.
double getInterpolatedUncertainty(TH1 *hist) const
Retrieve interpolated result (utility function)
virtual CalibrationStatus getUncertainty(const std::string &unc, const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
retrieve the calibration uncertainty due to the given source.
void setUncorrelated(const std::string &unc)
Indicate that the given uncertainty is to be treated uncorrelated from bin to bin (note that the defa...
void setInterpolated(bool doInterpolate)
Indicate whether results are to be interpolated between bins or not (this feature is thought to be us...
virtual std::vector< double > getBinBoundaries(unsigned int vartype)
Retrieve the bin boundaries for the specified variable type (which should be a CalibrationParametriza...
virtual int getTagWeightAxis()
Test whether this calibration object is one for "continuous" calibration (this has some subtle conseq...
bool m_interpolate
If true, interpolate between bins rather than doing a straight bin-wise evaluation.
void checkBounds()
check the bounds of validity for this calibration object
double getInterpolatedResult(TH1 *hist) const
Retrieve interpolated result (utility function)
THashList m_uncorrelatedSyst
no need to persistify
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)
retrieve the calibration statistical uncertainty.
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)
retrieve the calibration result.
virtual void computeVariableTypes()
utility for determining global bin number, subject to extrapolation constraints.
CalibrationDataHistogramContainer(const char *name="default")
bool isBinCorrelated(const std::string &unc) const
Indicate whether the given uncertainty is correlated from bin to bin or not (note that this function ...
virtual bool isInterpolated() const
Indicate whether histogram interpolation is used or not.
Helper class for the specification of custom binning.
double getUpperBound(unsigned int dim) const
Bin & operator=(const Bin &other)
double getLowerBound(unsigned int dim) const
bool contains(const double *x) const
This is the class holding information for histogram-based calibration results, in cases where 'irregu...
virtual int getTagWeightAxis()
Test whether this calibration object is one for "continuous" calibration (this has some subtle conseq...
unsigned int getNMappedBins() const
return the number of mapped bins
virtual void computeVariableTypes()
decode the 'uncertainty' objects' names to determine the relevant variable types
unsigned int m_beginMapped
starting position of mapped variables
std::vector< std::string > m_mapped
mapped variables.
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)
retrieve the calibration result.
void setMappedVariables(const std::vector< std::string > &variables)
Set (by hand) the variables that will be mapped onto a single histogram axis.
virtual CalibrationStatus getUncertainty(const std::string &unc, const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
retrieve the calibration uncertainty due to the given source.
Int_t findBin()
don't persistify
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)
retrieve the calibration statistical uncertainty.
CalibrationDataMappedHistogramContainer(const char *name="default")
const std::vector< std::string > & getMappedVariables() const
List which variables get mapped onto a single histogram axis.
Int_t findMappedBin(const double *x)
virtual std::vector< double > getBinBoundaries(unsigned int vartype)
Retrieve the bin boundaries for the specified variable type (which should be a CalibrationParametriza...
std::vector< Bin > m_bins
don't persistify
unsigned int addBin(const Bin &bin)
Add mapping bin.
void checkBounds()
check the bounds of validity for this calibration object
This class (struct, actually) is nothing but a light-weight container of (kinematic or other) variabl...
CalibrationDataContainer(const char *name="default")
virtual ~CalibrationDataContainer()
virtual ~CalibrationDataFunctionContainer()
virtual ~CalibrationDataHistogramContainer()
Helper class for the specification of custom binning.
virtual ~CalibrationDataMappedHistogramContainer()
std::vector< std::string > mapped
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
std::pair< double, double > UncertaintyResult
The following typedef is for convenience: most uncertainties can be asymmetric.