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 const TAxis* axis = 0;
972 if (
m_variables[0] == vartype) axis = hobj->GetXaxis();
973 else if (
m_variables[1] == vartype) axis = hobj->GetYaxis();
974 else axis = hobj->GetZaxis();
977 const TArrayD*
bins = axis->GetXbins();
int nb =
bins->GetSize();
978 for (
int b = 0; b < nb; ++b) boundaries.push_back(
bins->At(b));
988 TObject* obj = GetValue(
"ReducedSets");
989 if (! obj)
return -1;
990 TVectorT<double>* v =
dynamic_cast<TVectorT<double>*
>(obj);
991 if (! (v && v->GetNoElements() >
int(choice)) )
return -1;
992 return int((*v)[choice]);
1042 const TH1* hobj =
dynamic_cast<const TH1*
>(
m_objResult);
1044 std::cerr <<
"in CalibrationDataMappedHistogramContainer::computeVariableTypes(): dynamic cast failed\n";
1048 int dims = hobj->GetDimension();
1049 for (
int dim = 0; dim < dims; ++dim) {
1050 const TAxis* axis = 0;
1052 case 0: axis = hobj->GetXaxis();
break;
1053 case 1: axis = hobj->GetYaxis();
break;
1054 default: axis = hobj->GetZaxis();
1056 std::string var(axis->GetTitle());
1057 if (var ==
"mapped") {
1060 for (
unsigned int m = 0; m <
m_mapped.size(); ++m) {
1063 assert (! (vartype < 0));
1072 std::cerr <<
"in CalibrationDataMappedHistogramContainer::computeVariableTypes(): cannot construct variable type from name "
1073 << var << std::endl;
1098 const TH1* hist =
dynamic_cast<const TH1*
>(
m_objResult);
1100 std::cerr <<
"in CalibrationDataHistogramContainer::checkBounds(): object type does not derive from TH1" << std::endl;
1103 std::cerr <<
"in CalibrationDataMappedHistogramContainer::checkBounds(): given number of variable types ("
1104 <<
m_variables.size() <<
") doesn't match (mapped) histogram dimension ("
1105 << hist->GetDimension() +
m_mapped.size() - 1 <<
")!" << std::endl;
1114 for (
unsigned int t = 0, t2 = 0; int(t) < hist->GetDimension(); ++t) {
1115 const TAxis* axis = 0;
1117 case 0: axis = hist->GetXaxis();
break;
1118 case 1: axis = hist->GetYaxis();
break;
1119 default: axis = hist->GetZaxis();
1142 double amax = axis->GetXmax(), amin = axis->GetXmin();
1153 double&
result, TObject* obj,
bool )
1172 TH1* hist =
dynamic_cast<TH1*
>(obj);
1224 if (unc ==
"statistics") {
1233 if (!obj) obj = GetValue(unc.c_str());
1234 TH1* hist =
dynamic_cast<TH1*
>(obj);
1258 int hist_type = int(
type);
1274const std::vector<std::string>&
1317 std::cerr <<
"CalibrationDataMappedHistogramContainer::findMappedBin(): unable to find bin for mapping variables:";
1318 for (
unsigned int d = 0; d <
m_mapped.size(); ++d) std::cerr <<
"\t" <<
x[d];
1319 std::cerr << std::endl;
1332 const TH1* hist =
dynamic_cast<const TH1*
>(
m_objResult);
1334 std::cerr <<
"CalibrationDataMappedHistogramContainer::findBin(): dynamic cast failed\n";
1337 Int_t ndim = hist->GetDimension();
1340 for (
unsigned int dim = 0; dim < (
unsigned int) ndim; ++dim) {
1344 const TAxis* axis = 0;
1346 case 0: axis = hist->GetXaxis();
break;
1347 case 1: axis = hist->GetYaxis();
break;
1348 default: axis = hist->GetZaxis();
1371 std::vector<double> boundaries;
1373 for (
unsigned int v = 0; v <
m_variables.size(); ++v)
1375 if (var == -1)
return boundaries;
1379 const TH1* hobj =
dynamic_cast<const TH1*
>(
m_objResult);
1385 double binBoundaries[2];
1390 if (boundaries.size() == 0) {
1391 boundaries.push_back(binBoundaries[0]); boundaries.push_back(binBoundaries[1]);
1393 for (
unsigned int ib = 0; ib < 2; ++ib) {
1394 double newvalue = binBoundaries[ib];
1396 for (std::vector<double>::iterator it = boundaries.begin(); it != boundaries.end(); ++it) {
1400 }
else if (newvalue < *it) {
1402 boundaries.insert(it, newvalue);
1407 if (! done) boundaries.push_back(newvalue);
1414 const TAxis* axis = 0;
1416 case 0: axis = hobj->GetXaxis();
break;
1417 case 1: axis = hobj->GetYaxis();
break;
1418 default: axis = hobj->GetZaxis();
1421 const TArrayD*
bins = axis->GetXbins();
int nb =
bins->GetSize();
1422 for (
int b = 0; b < nb; ++b) boundaries.push_back(
bins->At(b));
1447 m_dimension(0), m_low(0), m_up(0)
1458 m_up =
new double[dimension];
1459 m_low =
new double[dimension];
1460 for (
unsigned int dim = 0; dim < dimension; ++dim) {
1461 m_up[dim] = up[dim];
1462 m_low[dim] = low[dim];
1468 m_dimension(other.m_dimension)
1472 for (
unsigned int dim = 0; dim <
m_dimension; ++dim) {
1473 m_up[dim] = other.m_up[dim];
1474 m_low[dim] = other.m_low[dim];
1482 if (
this != &other) {
1488 for (
unsigned int dim = 0; dim <
m_dimension; ++dim) {
1489 m_up[dim] = other.m_up[dim];
1490 m_low[dim] = other.m_low[dim];
1509 for (
unsigned int dim = 0; dim <
m_dimension; ++dim)
1510 if (
x[dim] <
m_low[dim] ||
x[dim] >
m_up[dim])
return false;
1551 m_lowerBounds.clear();
1552 m_lowerBounds.resize(maxParameters, -std::numeric_limits<double>::max());
1553 m_lowerBounds[kPt] = m_lowerBounds[kAbsEta] = 0;
1554 m_upperBounds.clear();
1555 m_upperBounds.resize(maxParameters, std::numeric_limits<double>::max());
1558 m_lowerBoundsExtrapolated.clear();
1559 m_lowerBoundsExtrapolated.resize(maxParameters, -std::numeric_limits<double>::max());
1560 m_lowerBoundsExtrapolated[kPt] = m_lowerBoundsExtrapolated[kAbsEta] = 0;
1561 m_upperBoundsExtrapolated.clear();
1562 m_upperBoundsExtrapolated.resize(maxParameters, std::numeric_limits<double>::max());
1582 std::string::size_type pos = title.find(
";");
1583 while (pos != std::string::npos && pos != title.size()) {
1584 title = title.substr(pos+1);
1585 pos = title.find(
";");
1586 std::string var = title.substr(0, pos);
1590 std::cerr <<
"in CalibrationDataFunctionContainer::computeVariableTypes(): cannot construct variable type from name "
1591 << var << std::endl;
1606 double&
result, TObject* obj,
bool )
1619 TF1* func =
dynamic_cast<TF1*
>(obj);
1647 if (unc ==
"statistics") {
1657 if (!obj) obj = GetValue(unc.c_str());
1658 TF1* func =
dynamic_cast<TF1*
>(obj);
1697 TMatrixTSym<double>* cov =
dynamic_cast<TMatrixTSym<double>*
>(
m_objStatistics);
1712 const Double_t eps = 0.5;
1714 int npar = func->GetNpar();
1720 TMatrixT<double> gradients(npar,1);
1721 for (
int ipar = 0; ipar < npar; ++ipar) {
1722 gradients(ipar,0) = func->GradientPar(ipar,
m_vars, eps);
1726 TMatrixT<double> gradientsTransposed(TMatrixT<double>::kTransposed, gradients);
1731 TMatrixT<double> tmp1(*cov, TMatrixT<double>::kMult, gradients);
1735 TMatrixT<double> tmp2(gradientsTransposed, TMatrixT<double>::kMult, tmp1);
1737 result = TMath::Sqrt(tmp2(0,0));
1750 double diff =
a - b;
1751 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.