ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Analysis::CalibrationDataHistogramContainer Class Reference

#include <CalibrationDataContainer.h>

Inheritance diagram for Analysis::CalibrationDataHistogramContainer:
Collaboration diagram for Analysis::CalibrationDataHistogramContainer:

Public Types

enum  CalibrationParametrization { kPt = 0, kEta = 1, kAbsEta = 2, kTagWeight = 3 }
 

Public Member Functions

 CalibrationDataHistogramContainer (const char *name="default")
 
virtual ~CalibrationDataHistogramContainer ()
 
virtual CalibrationStatus getResult (const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)
 retrieve the calibration result. More...
 
virtual CalibrationStatus getStatUncertainty (const CalibrationDataVariables &x, double &result)
 retrieve the calibration statistical uncertainty. More...
 
virtual CalibrationStatus getUncertainty (const std::string &unc, const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
 retrieve the calibration uncertainty due to the given source. More...
 
bool isBinCorrelated (const std::string &unc) const
 Indicate whether the given uncertainty is correlated from bin to bin or not (note that this function is to be used only for systematic uncertainties) More...
 
void setUncorrelated (const std::string &unc)
 Indicate that the given uncertainty is to be treated uncorrelated from bin to bin (note that the default is for all systematic uncertainties to be treated as correlated) More...
 
void setInterpolated (bool doInterpolate)
 Indicate whether results are to be interpolated between bins or not (this feature is thought to be useful mostly for MC efficiencies) More...
 
virtual bool isInterpolated () const
 Indicate whether histogram interpolation is used or not. More...
 
virtual int getTagWeightAxis ()
 Test whether this calibration object is one for "continuous" calibration (this has some subtle consequences for the treatment of bin-to-bin correlations). More...
 
virtual std::vector< double > getBinBoundaries (unsigned int vartype)
 Retrieve the bin boundaries for the specified variable type (which should be a CalibrationParametrization enum). More...
 
virtual int getEigenvectorReduction (unsigned int choice) const
 Retrieve the number of eigenvectors to be retained for the purpose of eigenvector variation reduction strategies. More...
 
std::vector< std::string > listUncertainties () const
 retrieve the list of "uncertainties" accessible to this object. More...
 
CalibrationStatus getUncertainties (const CalibrationDataVariables &x, std::map< std::string, Analysis::UncertaintyResult > &all)
 retrieve the list of "uncertainties" accessible to this object. More...
 
std::string getComment () const
 retrieve the comments entered for this calibration, if any More...
 
std::string getHadronisation () const
 retrieve the 'hadronisation reference' entered for this calibration, if any More...
 
std::string getExcludedUncertainties () const
 retrieve the (semicolon-separated) set of uncertainties that are recommended for removal from the eigenvector decomposition More...
 
CalibrationStatus getSystUncertainty (const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
 retrieve the calibration total systematic uncertainty More...
 
void setResult (TObject *obj)
 insert the main object for this calibration More...
 
void setComment (const std::string &text)
 insert the given text as comment for this calibration More...
 
void setHadronisation (const std::string &text)
 insert the given text as the 'hadronisation reference' for this calibration More...
 
void setExcludedUncertainties (const std::string &text)
 insert the set of uncertainties that are recommended for removal from the eigenvector decomposition. More...
 
void setUncertainty (const std::string &unc, TObject *obj)
 insert the relevant object for the requested source of 'uncertainty' More...
 
void restrictToRange (bool restrict)
 If true, this will restrict the variables used to be within the (specified) range of validity. More...
 
bool isRangeRestricted () const
 allow the user to inspect the above information More...
 
double getLowerBound (unsigned int vartype, bool extrapolate=false) const
 retrieve the lower bound of validity for the requested variable type More...
 
double getUpperBound (unsigned int vartype, bool extrapolate=false) const
 retrieve the upper bound of validity for the requested variable type More...
 
std::vector< std::pair< double, double > > getBounds ()
 allow the user to inspect the bounds of validity More...
 
std::vector< unsigned int > getVariableTypes ()
 utility to retrieve variable types
More...
 

Static Public Member Functions

static bool isNearlyEqual (double a, double b)
 utility for comparison of doubles More...
 

Protected Member Functions

int typeFromString (const std::string &key) const
 Connection between variable names (on histogram axes etc.) and variable 'types' as used in actual evaluations. More...
 
CalibrationStatus computeVariables (const CalibrationDataVariables &x, bool extrapolate=false)
 Compute the variables to be used. More...
 

Protected Attributes

std::map< unsigned int, std::vector< double > > m_binBoundaries
 Cache for bin boundary information. More...
 
std::vector< double > m_lowerBounds
 
std::vector< double > m_upperBounds
 
std::vector< double > m_lowerBoundsExtrapolated
 
std::vector< double > m_upperBoundsExtrapolated
 (possibly looser) lower validity bounds for extrapolation More...
 
TObject * m_objResult
 (possibly looser) upper validity bounds for extrapolation More...
 
TObject * m_objSystematics
 don't persistify More...
 
double m_vars [MaxCalibrationVars]
 don't persistify More...
 
std::vector< unsigned int > m_variables
 don't persistify More...
 

Private Member Functions

double getInterpolatedResult (TH1 *hist) const
 Retrieve interpolated result (utility function) More...
 
double getInterpolatedUncertainty (TH1 *hist) const
 Retrieve interpolated result (utility function) More...
 
void checkBounds ()
 check the bounds of validity for this calibration object More...
 
virtual void computeVariableTypes ()
 decode the 'uncertainty' objects' names to determine the relevant variable types More...
 
 ClassDef (CalibrationDataHistogramContainer, 2)
 

Private Attributes

THashList m_uncorrelatedSyst
 no need to persistify More...
 
bool m_interpolate
 If true, interpolate between bins rather than doing a straight bin-wise evaluation. More...
 
bool m_restrict
 persistency not needed for this variable More...
 

Detailed Description

This is the class holding information for histogram-based calibration results.

Definition at line 247 of file CalibrationDataContainer.h.

Member Enumeration Documentation

◆ CalibrationParametrization

The following enums are intended to contain the list of (kinematic or other) variables in terms of which results (and the corresponding uncertainties) are given. They are useful mainly for internal purposes, but the user may access them nevertheless.

Enumerator
kPt 
kEta 
kAbsEta 
kTagWeight 

Definition at line 63 of file CalibrationDataContainer.h.

63  {
64  kPt = 0, // calibrated jet pt
65  kEta = 1, // jet eta
66  kAbsEta = 2, // jet |eta|
67  kTagWeight = 3 // tagging output (relevant for "continuous" calibration)
68  };

Constructor & Destructor Documentation

◆ CalibrationDataHistogramContainer()

Analysis::CalibrationDataHistogramContainer::CalibrationDataHistogramContainer ( const char *  name = "default")

◆ ~CalibrationDataHistogramContainer()

CalibrationDataHistogramContainer::~CalibrationDataHistogramContainer ( )
virtual

Definition at line 483 of file CalibrationDataContainer.cxx.

484 {
485 }

Member Function Documentation

◆ checkBounds()

void CalibrationDataHistogramContainer::checkBounds ( )
private

check the bounds of validity for this calibration object

Definition at line 673 of file CalibrationDataContainer.cxx.

674 {
675  // Determine the bounds of validity for this calibration object. If an "extrapolation"
676  // uncertainty histogram exists, it is used to determine the (typically) looser bounds
677  // of validity appropriate for extrapolation uncertainties.
678 
679  const TH1* hist = dynamic_cast<const TH1*>(m_objResult);
680  if (!hist) {
681  std::cerr << "in CalibrationDataHistogramContainer::checkBounds(): object type does not derive from TH1" << std::endl;
682  return;
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;
687  return;
688  }
689  // if an extrapolation uncertainty histogram was provided, use this to determine a second set of validity bounds
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;
693  switch (t) {
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();
697  }
698 
699  // for (unsigned int t = 0; t < m_variables.size(); ++t) {
700  // if (m_variables[t] > m_upperBounds.size()) {
701  // std::cerr << "in CalibrationDataHistogramContainer::checkBounds(): variable " << t << "type ("
702  // << m_variables[t] << "exceeds maximum type number (" << m_upperBounds.size() << ")!"
703  // << std::endl;
704  // return;
705  // }
706  // }
707  m_upperBounds[m_variables[t]] = axis->GetXmax();
708  m_lowerBounds[m_variables[t]] = axis->GetXmin();
709  m_upperBoundsExtrapolated[m_variables[t]] = (axis2) ? axis2->GetXmax() : m_upperBounds[m_variables[t]];
710  m_lowerBoundsExtrapolated[m_variables[t]] = (axis2) ? axis2->GetXmin() : m_lowerBounds[m_variables[t]];
711  // std::cout << "debug: min = " << m_lowerBounds[m_variables[t]] << ", max = " << m_upperBounds[m_variables[t]]
712  // << ", extrap min = " << m_lowerBoundsExtrapolated[m_variables[t]] << ", extrap max = "
713  // << m_upperBoundsExtrapolated[m_variables[t]] << std::endl;
714  }
715 }

◆ ClassDef()

Analysis::CalibrationDataHistogramContainer::ClassDef ( CalibrationDataHistogramContainer  ,
 
)
private

◆ computeVariables()

CalibrationStatus CalibrationDataContainer::computeVariables ( const CalibrationDataVariables x,
bool  extrapolate = false 
)
protectedinherited

Compute the variables to be used.

Parameters
xuser-supplied (kinematic or other) variables
extrapolateset to "true" for the evaluation of extrapolation uncertainties
Returns
kSuccess, kRange, or kExtrapolatedRange, depending on the kinematic variables

Definition at line 307 of file CalibrationDataContainer.cxx.

308 {
309  // Determine which variables are to be used, and insert them in a separate array (which is only used internally).
310  // The return value is used to indicate whether any input co-ordinate was out of bounds; where a distinction
311  // is made between being outside the extrapolation region (kExtrapolatedRange) or merely the calibration region
312  // (kRange).
313  // The "extrapolate" variable is used to flag whether an extrapolation uncertainty applies
314  // (this should anyway occur only for histogram containers).
315  // This is also the place where any computations are being done (e.g. jet pt values are divided by 1000
316  // to convert them from MeV to GeV).
317 
318  // ensure that the variable types have been computed properly
319  if (m_variables.size() == 0) computeVariableTypes();
320 
321  // also keep track of whether the variables are within bounds
323 
324  // std::cout << "computeVariables(): input jet pt: " << x.jetPt << ", eta " << x.jetEta << ", tag weight " << x.jetTagWeight << std::endl;
325 
326  for (unsigned int var = 0; var < m_variables.size(); ++var) {
327  switch (m_variables[var]) {
328  case kPt:
329  // assume that the input values are given in MeV but the performance calibration in GeV!
330  m_vars[var] = x.jetPt * 0.001;
331  break;
332  case kEta:
333  m_vars[var] = x.jetEta;
334  break;
335  case kAbsEta:
336  m_vars[var] = x.jetEta;
337  if (m_vars[var] < 0) m_vars[var] *= -1.0;
338  break;
339  case kTagWeight:
340  m_vars[var] = x.jetTagWeight;
341  }
343  if (status != kExtrapolatedRange) {
345  // std::cout << "computeVariables(): variable " << var << ", value: " << m_vars[var] << ", setting status to " << status << std::endl;
346  }
347  if (m_restrict) m_vars[var] = getLowerBound(m_variables[var], extrapolate) + rangeEpsilon;
348  } else if (m_vars[var] >= getUpperBound(m_variables[var], extrapolate)) {
349  if (status != kExtrapolatedRange) {
351  // std::cout << "computeVariables(): variable " << var << ", value: " << m_vars[var] << ", extrapolate? " << extrapolate
352  // << ", upper bound: " << getUpperBound(m_variables[var],extrapolate)
353  // << " (extrapolation bound: " << getUpperBound(m_variables[var],true) << "), setting status to " << status << std::endl;
354  }
355  if (m_restrict) m_vars[var] = getUpperBound(m_variables[var], extrapolate) - rangeEpsilon;
356  }
357  }
358 
359  // std::cout << "computeVariables(): output variables: " << m_vars[0] << ", " << m_vars[1] << ", " << m_vars[2] << std::endl;
360 
361  return status;
362 }

◆ computeVariableTypes()

void CalibrationDataHistogramContainer::computeVariableTypes ( )
privatevirtual

decode the 'uncertainty' objects' names to determine the relevant variable types

Implements Analysis::CalibrationDataContainer.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 490 of file CalibrationDataContainer.cxx.

491 {
492  // Compute the variable types for this container object, using the histogram axis labels.
493  // Valid axis labels can be found in the CalibrationDataContainer::typeFromString() method.
494  // Note that only the "result" histogram is inspected; it is assumed that all
495  // histograms provided use the same binning (a small exception is the "extrapolation"
496  // uncertainty histogram, which may have additional bins beyond the usual validity bounds).
497  //
498  // This function will be called upon first usage, and its results cached internally.
499  // It also calls checkBounds() to determine the validity bounds.
500 
501  // cache pointer to central values histogram
502  if (! m_objResult) m_objResult = GetValue("result");
503 
504  // histograms need a special treatment, as the coordinate titles are not actually stored
505  // with the title itself, but instead moved off to the axis titles...
506  const TH1* hobj = dynamic_cast<const TH1*>(m_objResult);
507  if (not hobj){
508  std::cerr << "in CalibrationDataHistogramContainer::computeVariableTypes(): dynamic_cast failed\n";
509  return;
510  }
511 
512  int dims = hobj->GetDimension();
513  for (int dim = 0; dim < dims; ++dim) {
514  const TAxis* axis = 0;
515  switch (dim) {
516  case 0: axis = hobj->GetXaxis(); break;
517  case 1: axis = hobj->GetYaxis(); break;
518  default: axis = hobj->GetZaxis();
519  }
520  int vartype = typeFromString(axis->GetTitle());
521  if (vartype < 0) {
522  // Only flag the issue but otherwise take no action (assume non-argument use of a semicolon)
523  std::cerr << "in CalibrationDataHistogramContainer::computeVariableTypes(): cannot construct variable type from name "
524  << axis->GetTitle() << std::endl;
525  } else {
526  m_variables.push_back((unsigned int) vartype);
527  }
528  }
529 
530  // After doing this, we should always have a non-null vector!
531  assert(m_variables.size() > 0);
532 
533  // also compute the validity bounds for this calibration object
534  const_cast<CalibrationDataHistogramContainer*>(this)->checkBounds();
535 }

◆ getBinBoundaries()

std::vector< double > CalibrationDataHistogramContainer::getBinBoundaries ( unsigned int  vartype)
virtual

Retrieve the bin boundaries for the specified variable type (which should be a CalibrationParametrization enum).

An empty vector will be returned if the specified variable is not actually used.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 952 of file CalibrationDataContainer.cxx.

953 {
954  // Retrieve the bin boundaries for the specified variable type (which should be a CalibrationParametrization enum).
955  // An empty vector will be returned if the specified variable is not actually used.
956 
957  // Ensure that the variable types have been computed at this point
958  if (m_variables.size() == 0) computeVariableTypes();
959 
960  // Check whether the variable type is actually being used
961  std::vector<double> boundaries;
962  if (std::find(m_variables.begin(), m_variables.end(), vartype) == m_variables.end()) return boundaries;
963 
964  // use cached information if available
965  std::map<unsigned int, std::vector<double> >::iterator it = m_binBoundaries.find(vartype);
966  if (it != m_binBoundaries.end()) return it->second;
967 
968  // Retrieve the appropriate histogram axis
969  if (! m_objResult) m_objResult = GetValue("result");
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();
975 
976  // Retrieve the actual bin boundaries
977  const TArrayD* bins = axis->GetXbins(); int nb = bins->GetSize();
978  for (int b = 0; b < nb; ++b) boundaries.push_back(bins->At(b));
979 
980  m_binBoundaries[vartype] = boundaries;
981  return boundaries;
982 }

◆ getBounds()

std::vector< std::pair< double, double > > CalibrationDataContainer::getBounds ( )
inherited

allow the user to inspect the bounds of validity

Definition at line 391 of file CalibrationDataContainer.cxx.

392 {
393  // List the validity bounds relevant to this container.
394 
395  // ensure that the variable types have been computed properly
396  if (m_variables.size() == 0) computeVariableTypes();
397 
398  std::vector<std::pair<double, double> > bounds;
399  for (unsigned int t = 0; t < m_lowerBounds.size() && t <= kAbsEta; ++t) {
400  bounds.push_back(std::make_pair(m_lowerBounds[t], m_upperBounds[t]));
401  }
402  return bounds;
403 }

◆ getComment()

std::string CalibrationDataContainer::getComment ( ) const
inherited

retrieve the comments entered for this calibration, if any

Definition at line 190 of file CalibrationDataContainer.cxx.

191 {
192  // Retrieve the comments for this calibration (if any)
193 
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());
199 }

◆ getEigenvectorReduction()

int CalibrationDataHistogramContainer::getEigenvectorReduction ( unsigned int  choice) const
virtual

Retrieve the number of eigenvectors to be retained for the purpose of eigenvector variation reduction strategies.

Parameters
choicespecification of the reduction option (integer corresponding to the CalibrationDataInterfaceROOT::EVReductionStrategy enum)
Returns
number of eigenvector variations to be retained; -1 if the required information is lacking

Definition at line 986 of file CalibrationDataContainer.cxx.

987 {
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]);
993 }

◆ getExcludedUncertainties()

std::string CalibrationDataContainer::getExcludedUncertainties ( ) const
inherited

retrieve the (semicolon-separated) set of uncertainties that are recommended for removal from the eigenvector decomposition

Definition at line 217 of file CalibrationDataContainer.cxx.

218 {
219  // Retrieve the (semicolon-separated) set of uncertainties that are recommended for removal from the eigenvector decomposition (if any)
220  const static std::string null("");
221 
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());
227 }

◆ getHadronisation()

std::string CalibrationDataContainer::getHadronisation ( ) const
inherited

retrieve the 'hadronisation reference' entered for this calibration, if any

Definition at line 203 of file CalibrationDataContainer.cxx.

204 {
205  // Retrieve the hadronisation reference for this calibration (if any)
206  const static std::string null("");
207 
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());
213 }

◆ getInterpolatedResult()

double CalibrationDataHistogramContainer::getInterpolatedResult ( TH1 hist) const
private

Retrieve interpolated result (utility function)

Definition at line 760 of file CalibrationDataContainer.cxx.

761 {
762  // Small utility function (intended for internal use only) for the retrieval of interpolated results
763 
764  switch (hist->GetDimension()) {
765  case 3:
766  return hist->Interpolate(m_vars[0], m_vars[1], m_vars[2]);
767  case 2:
768  return hist->Interpolate(m_vars[0], m_vars[1]);
769  case 1:
770  default:
771  return hist->Interpolate(m_vars[0]);
772  }
773 }

◆ getInterpolatedUncertainty()

double CalibrationDataHistogramContainer::getInterpolatedUncertainty ( TH1 hist) const
private

Retrieve interpolated result (utility function)

Definition at line 777 of file CalibrationDataContainer.cxx.

778 {
779  TAxis* xAxis = hist->GetXaxis();
780  TAxis* yAxis = 0; TAxis* zAxis = 0;
781  Double_t x0,x1,y0,y1;
782 
783  Int_t ndim = hist->GetDimension();
784  if (ndim == 1) {
785  // Code copied from TH1::Interpolate()
786 
787  Int_t xbin = hist->FindBin(m_vars[0]);
788 
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());
793  }
794 
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);
800  } else {
801  y0 = hist->GetBinError(xbin);
802  x0 = hist->GetBinCenter(xbin);
803  y1 = hist->GetBinError(xbin+1);
804  x1 = hist->GetBinCenter(xbin+1);
805  }
806  return y0 + (m_vars[0]-x0)*((y1-y0)/(x1-x0));
807 
808  } else if (ndim == 2) {
809 
810  // Code copied from TH2::Interpolate()
811 
812  Double_t f=0;
813  x1 = y1 = 0;
814  Double_t x2=0,y2=0;
815  Double_t dx,dy;
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.");
821  return 0;
822  }
823  // Int_t quadrant = 0; // CCW from UR 1,2,3,4
824  // which quadrant of the bin (bin_P) are we in?
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) {
828  // quadrant = 1; // upper right
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) {
834  // quadrant = 2; // upper left
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) {
840  // quadrant = 3; // lower left
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);
845  } else {
846  // quadrant = 4; // lower right
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);
851  }
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);
869  f = 1.0*q11/d*(x2-m_vars[0])*(y2-m_vars[1])
870  + 1.0*q21/d*(m_vars[0]-x1)*(y2-m_vars[1])
871  + 1.0*q12/d*(x2-m_vars[0])*(m_vars[1]-y1)
872  + 1.0*q22/d*(m_vars[0]-x1)*(m_vars[1]-y1);
873  return f;
874 
875  } else {
876 
877  // Copied from TH3::Interpolate()
878 
879  yAxis = hist->GetYaxis();
880  zAxis = hist->GetZaxis();
881 
882  Int_t ubx = xAxis->FindBin(m_vars[0]);
883  if ( m_vars[0] < xAxis->GetBinCenter(ubx) ) ubx -= 1;
884  Int_t obx = ubx + 1;
885 
886  Int_t uby = yAxis->FindBin(m_vars[1]);
887  if ( m_vars[1] < yAxis->GetBinCenter(uby) ) uby -= 1;
888  Int_t oby = uby + 1;
889 
890  Int_t ubz = zAxis->FindBin(m_vars[2]);
891  if ( m_vars[2] < zAxis->GetBinCenter(ubz) ) ubz -= 1;
892  Int_t obz = ubz + 1;
893 
894 
895  // if ( IsBinUnderflow(GetBin(ubx, uby, ubz)) ||
896  // IsBinOverflow (GetBin(obx, oby, obz)) ) {
897  if (ubx <=0 || uby <=0 || ubz <= 0 ||
898  obx > xAxis->GetNbins() || oby > yAxis->GetNbins() || obz > zAxis->GetNbins() ) {
899  }
900 
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);
904 
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;
908 
909 
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 ) };
914 
915 
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;
920 
921 
922  Double_t w1 = i1 * (1 - yd) + i2 * yd;
923  Double_t w2 = j1 * (1 - yd) + j2 * yd;
924 
925 
926  Double_t result = w1 * (1 - xd) + w2 * xd;
927 
928  return result;
929  };
930 }

◆ getLowerBound()

double CalibrationDataContainer::getLowerBound ( unsigned int  vartype,
bool  extrapolate = false 
) const
inherited

retrieve the lower bound of validity for the requested variable type

Parameters
vartypevariable type
extrapolatetrue only if an extrapolation uncertainty is requested

Definition at line 366 of file CalibrationDataContainer.cxx.

367 {
368  // Utility function returning the lower validity bound for the given variable type.
369  // The "extrapolate" variable flags whether normal validity bounds are to be used,
370  // or instead those relevant for the extrapolation uncertainty.
371 
372  double minDefault = (vartype == kAbsEta || vartype == kPt) ? 0 : -std::numeric_limits<double>::max();
373  if (! (vartype < m_lowerBounds.size())) return minDefault;
374  return extrapolate ? m_lowerBoundsExtrapolated[vartype] : m_lowerBounds[vartype];
375 }

◆ getResult()

CalibrationStatus CalibrationDataHistogramContainer::getResult ( const CalibrationDataVariables x,
double &  result,
TObject *  obj = 0,
bool  extrapolate = false 
)
virtual

retrieve the calibration result.

Parameters
xuser-supplied (kinematic or other) variables
resultrequested result
objobject holding the requested result (it will be computed if not provided)
extrapolateflag that extrapolation applies (should only be relevant when using eigenvector variations)
Returns
status code (see above)

Implements Analysis::CalibrationDataContainer.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 539 of file CalibrationDataContainer.cxx.

541 {
542  // Retrieve the central value for the given input variables. There are cases where
543  // it may be useful to provide an alternative histogram rather than the original
544  // one; in such cases (notably used with eigenvector variations) it is possible to
545  // provide a pointer to this alternative histogram.
546  //
547  // x: input variables
548  // result: result
549  // obj: pointer to alternative results histogram
550  // extrapolate: set to true if bounds checking is to be carried out to looser
551  // validity bounds as relevant for extrapolation uncertainties
552  if (!obj) {
553  if (! m_objResult) {
554  m_objResult = GetValue("result");
555  }
556  obj = m_objResult;
557  }
558  TH1* hist = dynamic_cast<TH1*>(obj);
559  if (! hist) return Analysis::kError;
560 
561  // select the relevant kinematic variables
563  // find the relevant "global" bin.
564  // Note the limitation: at most three dimensions are supported.
565  // TH1::FindFixBin() will ignore the variables not needed.
566  // Note: FindFixBin() is only available in "recent" ROOT versions (FindBin() is appropriate for older versions)
567  // (otherwise we need to rely on the ResetBit(TH1::kCanRebin) method having been used)
568  if (m_interpolate) {
570  } else {
571  Int_t bin = hist->FindFixBin(m_vars[0], m_vars[1], m_vars[2]);
572  result = hist->GetBinContent(bin);
573  }
574 
575  return status;
576 }

◆ getStatUncertainty()

CalibrationStatus CalibrationDataHistogramContainer::getStatUncertainty ( const CalibrationDataVariables x,
double &  result 
)
virtual

retrieve the calibration statistical uncertainty.

Parameters
xuser-supplied (kinematic or other) variables
resultrequested statistical uncertainty
Returns
status code (see above) Note the changed signature compared to getUncertainty(), getResult() etc.: this is because the statistical uncertainty computation always needs the result object, and only in case of the function interface also the covariance matrix

Implements Analysis::CalibrationDataContainer.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 582 of file CalibrationDataContainer.cxx.

584 {
585  // Retrieve the statistical uncertainty for the given input variables.
586  //
587  // x: input variables
588  // result: result
589 
590  if (! m_objResult) {
591  m_objResult = GetValue("result");
592  }
593  TH1* hist = dynamic_cast<TH1*>(m_objResult);
594  if (! hist) {
595  std::cout << " getStatUncertainty error: no (valid) central values object!" << std::endl;
596  return Analysis::kError;
597  }
598 
599  // select the relevant kinematic variables
601  // find the relevant "global" bin.
602  // Note the limitation: at most three dimensions are supported.
603  // TH1::FindFixBin() will ignore the variables not needed.
604  // Note: FindFixBin() is only available in "recent" ROOT versions (FindBin() is appropriate for older versions)
605  // (otherwise we need to rely on the ResetBit(TH1::kCanRebin) method having been used)
606  if (m_interpolate) {
607  // interpolating the uncertainties doesn't seem very sensible..
609  } else {
610  Int_t bin = hist->FindFixBin(m_vars[0], m_vars[1], m_vars[2]);
611  // Int_t bin = findBin(hist, false);
612  result = hist->GetBinError(bin);
613  }
614 
615  return status;
616 }

◆ getSystUncertainty()

CalibrationStatus CalibrationDataContainer::getSystUncertainty ( const CalibrationDataVariables x,
UncertaintyResult result,
TObject *  obj = 0 
)
inherited

retrieve the calibration total systematic uncertainty

See also
getUncertainty()

Definition at line 101 of file CalibrationDataContainer.cxx.

103 {
104  // short-hand for the total systematic uncertainty retrieval.
105  // For "normal" usage (retrieval of central values and total uncertainties), the total systematic
106  // uncertainty object needs to be accessed frequently. In order to avoid nee
107 
108  // cache the pointer to the "systematics" object (to avoid string comparisons)
109  if (!obj) {
110  if (! m_objSystematics) {
111  m_objSystematics = GetValue("systematics");
112  }
114  }
115  return getUncertainty("systematics", x, result, obj);
116 }

◆ getTagWeightAxis()

int CalibrationDataHistogramContainer::getTagWeightAxis ( )
virtual

Test whether this calibration object is one for "continuous" calibration (this has some subtle consequences for the treatment of bin-to-bin correlations).

The return value will be -1 in case this is not a "continuous" calibration object, and the axis number (0 for X, 1 for Y, 2 for Z) otherwise.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 935 of file CalibrationDataContainer.cxx.

936 {
937  // Test whether this calibration object is one for "continuous" calibration
938  // (this has some subtle consequences for the treatment of bin-to-bin correlations).
939  // The return value will be -1 in case this is not a "continuous" calibration object,
940  // and the axis number (0 for X, 1 for Y, 2 for Z) otherwise.
941 
942  // Ensure that the variable types have been computed at this point
943  if (m_variables.size() == 0) computeVariableTypes();
944 
945  for (unsigned int type = 0; type < m_variables.size(); ++type)
946  if (m_variables[type] == kTagWeight) return int(type);
947  return -1;
948 }

◆ getUncertainties()

CalibrationStatus CalibrationDataContainer::getUncertainties ( const CalibrationDataVariables x,
std::map< std::string, Analysis::UncertaintyResult > &  all 
)
inherited

retrieve the list of "uncertainties" accessible to this object.

A few uncertainty names are predetermined: "result", "comment", "statistics", "systematics". Individual sources of systematic uncertainty can be added by the user.

Definition at line 137 of file CalibrationDataContainer.cxx.

139 {
140  // Retrieve all uncertainties for this calibration.
141 
144 
145  // first treat the "result" entry separately
146  double single_result;
147  CalibrationStatus code = getResult(x, single_result);
148  if (code == Analysis::kError) {
149  std::cerr << "in CalibrationDataContainer::getUncertainties(): error retrieving result!" << std::endl;
150  return code;
151  }
152  else if (code != Analysis::kSuccess) mycode = code;
153  result.first = single_result;
154  result.second = 0;
155  all[std::string("result")] = result;
156 
157  // similar for the "statistics" entry
158  code = getStatUncertainty(x, single_result);
159  if (code == Analysis::kError) {
160  std::cerr << "in CalibrationDataContainer::getUncertainties(): error retrieving stat. uncertainty!" << std::endl;
161  return code;
162  }
163  else if (code != Analysis::kSuccess) mycode = code;
164  result.first = single_result;
165  result.second = -single_result;
166  all[std::string("statistics")] = result;
167 
168  // then cycle through the other (systematic) uncertainties
169  TIter it(GetTable());
170  while (TPair* pair = (TPair*) it()) {
171  std::string spec(pair->Key()->GetName());
172  // ignore these specific entries
173  if (spec == "comment" || spec == "result" || spec == "statistics" || spec == "MChadronisation" || spec == "excluded_set") continue;
174  code = getUncertainty(spec, x, result, pair->Value());
175  // we should never be finding any errors
176  if (code == Analysis::kError) {
177  std::cerr << "in CalibrationDataContainer::getUncertainties(): error retrieving named uncertainty "
178  << spec << "!" << std::endl;
179  return code;
180  }
181  // this assumes that non-success codes are likely to be correlated between uncertainty sources
182  else if (code != Analysis::kSuccess) mycode = code;
183  all[spec] = result;
184  }
185  return mycode;
186 }

◆ getUncertainty()

CalibrationStatus CalibrationDataHistogramContainer::getUncertainty ( const std::string &  unc,
const CalibrationDataVariables x,
UncertaintyResult result,
TObject *  obj = 0 
)
virtual

retrieve the calibration uncertainty due to the given source.

Parameters
xuser-supplied (kinematic or other) variables
uncuncertainty specification
resultrequested uncertainty (for both positive and negative variation, if available)
objobject holding the requested uncertainty information (it will be computed if not provided)
Returns
status code (see above)

Implements Analysis::CalibrationDataContainer.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 622 of file CalibrationDataContainer.cxx.

625 {
626  // Retrieve the uncertainty for the given input variables.
627  //
628  // unc: keyword indicating requested source of uncertainty. This should
629  // correspond to one of the histograms added explicitly as a systematic
630  // uncertainty or the keyword "statistics" (statistical uncertainties are
631  // accessed differently, see method getStatUncertainty()).
632  // x: input variables
633  // result: result
634  // obj: pointer to alternative or cached histogram
635 
636  if (unc == "statistics") {
637  // treat statistical uncertainties separately (they are stored with the actual result)
638  double res;
640  if (code == Analysis::kError) return code;
641  result.first = res;
642  result.second = -res;
643  return code;
644  }
645 
646  if (!obj) obj = GetValue(unc.c_str());
647  TH1* hist = dynamic_cast<TH1*>(obj);
648  if (! hist) return Analysis::kError;
649 
650  // select the relevant kinematic variables
651  CalibrationStatus status = computeVariables(x, (unc == "extrapolation") );
652 
653  if (m_interpolate) {
655  // symmetrise the uncertainty (as there is no code to interpolate the bin errors)
656  result.second = -result.first;
657  } else {
658  // TH1::FindFixBin() will ignore the variables not needed.
659  // Note: FindFixBin() is only available in "recent" ROOT versions (FindBin() is appropriate for older versions)
660  // (otherwise we need to rely on the ResetBit(TH1::kCanRebin) method having been used)
661  Int_t bin = hist->FindFixBin(m_vars[0], m_vars[1], m_vars[2]);
662  // the "first" and "second" entries are filled with the
663  // "positive" and "negative" uncertainties, respectively.
664  result.first = hist->GetBinContent(bin);
665  result.second = hist->GetBinError(bin);
666  }
667 
668  return status;
669 }

◆ getUpperBound()

double CalibrationDataContainer::getUpperBound ( unsigned int  vartype,
bool  extrapolate = false 
) const
inherited

retrieve the upper bound of validity for the requested variable type

Parameters
vartypevariable type
extrapolatetrue only if an extrapolation uncertainty is requested

Definition at line 379 of file CalibrationDataContainer.cxx.

380 {
381  // Utility function returning the upper validity bound for the given variable type.
382  // The "extrapolate" variable flags whether normal validity bounds are to be used,
383  // or instead those relevant for the extrapolation uncertainty.
384 
385  if (! (vartype < m_lowerBounds.size())) return std::numeric_limits<double>::max();
386  return extrapolate ? m_upperBoundsExtrapolated[vartype] : m_upperBounds[vartype];
387 }

◆ getVariableTypes()

std::vector< unsigned int > CalibrationDataContainer::getVariableTypes ( )
inherited

utility to retrieve variable types

Definition at line 408 of file CalibrationDataContainer.cxx.

409 {
410  // List the variable types used for this calibration object.
411  // The meaning of the types is encapsulated by the CalibrationParametrization enum.
412 
413  // ensure that the variable types have been computed properly
414  if (m_variables.size() == 0) computeVariableTypes();
415 
416  return m_variables;
417 }

◆ isBinCorrelated()

bool CalibrationDataHistogramContainer::isBinCorrelated ( const std::string &  unc) const

Indicate whether the given uncertainty is correlated from bin to bin or not (note that this function is to be used only for systematic uncertainties)

Definition at line 719 of file CalibrationDataContainer.cxx.

720 {
721  // Indicate whether the given uncertainty is correlated from bin to bin or not
722  // (note that this function is to be used only for _systematic_ uncertainties)
723  return (m_uncorrelatedSyst.FindObject(unc.c_str()) == 0);
724 }

◆ isInterpolated()

bool CalibrationDataHistogramContainer::isInterpolated ( ) const
virtual

Indicate whether histogram interpolation is used or not.

Reimplemented in Analysis::CalibrationDataMappedHistogramContainer.

Definition at line 751 of file CalibrationDataContainer.cxx.

752 {
753  // Indicate whether histogram interpolation is used or not.
754 
755  return m_interpolate;
756 }

◆ isNearlyEqual()

bool CalibrationDataContainer::isNearlyEqual ( double  a,
double  b 
)
staticinherited

utility for comparison of doubles

Definition at line 1744 of file CalibrationDataContainer.cxx.

1744  {
1745  // Simple utility function testing whether two double values are sufficiently similar.
1746  // The test carried out is on their relative difference, which should be within a given tolerance.
1747 
1748  static const double tolerance = 1.e-8;
1749 
1750  double diff = a - b;
1751  double ref = std::fabs(a) + std::fabs(b);
1752  return (ref == 0 || std::fabs(diff) < tolerance*ref);
1753 }

◆ isRangeRestricted()

bool Analysis::CalibrationDataContainer::isRangeRestricted ( ) const
inlineinherited

allow the user to inspect the above information

Definition at line 162 of file CalibrationDataContainer.h.

162 { return m_restrict; }

◆ listUncertainties()

std::vector< std::string > CalibrationDataContainer::listUncertainties ( ) const
inherited

retrieve the list of "uncertainties" accessible to this object.

A few uncertainty names are predetermined: "result", "comment", "statistics", "systematics". Individual sources of systematic uncertainty can be added by the user.

Definition at line 120 of file CalibrationDataContainer.cxx.

121 {
122  // Retrieve the list of uncertainties for this calibration.
123  // Note that this is an un-pruned list: it contains also entries that
124  // are not proper uncertainties (e.g. "result", "comment")
125 
126  std::vector<std::string> uncertainties;
127  TIter it(GetTable());
128  while (TPair* pair = (TPair*) it()) {
129  std::string spec(pair->Key()->GetName());
130  uncertainties.push_back(spec);
131  }
132  return uncertainties;
133 }

◆ restrictToRange()

void Analysis::CalibrationDataContainer::restrictToRange ( bool  restrict)
inlineinherited

If true, this will restrict the variables used to be within the (specified) range of validity.

Note that this is a policy decision and as such not intrinsic to the data; but it is cumbersome to carry this information around everywhere.

Definition at line 159 of file CalibrationDataContainer.h.

159 { m_restrict = restrict; }

◆ setComment()

void CalibrationDataContainer::setComment ( const std::string &  text)
inherited

insert the given text as comment for this calibration

Definition at line 255 of file CalibrationDataContainer.cxx.

256 {
257  // Insert (or replace) the comment field. This needs to be handled somewhat
258  // specially as TString itself doesn't inherit from TObject.
259  //
260  // text: comment field (will be converted to TObjString)
261 
262  if (TPair* p = (TPair*) FindObject("comment")) DeleteEntry(p->Key());
263  Add(new TObjString("comment"), new TObjString(text.c_str()));
264 }

◆ setExcludedUncertainties()

void CalibrationDataContainer::setExcludedUncertainties ( const std::string &  text)
inherited

insert the set of uncertainties that are recommended for removal from the eigenvector decomposition.

Parameters
textsemicolon-separated list of uncertainties

Definition at line 280 of file CalibrationDataContainer.cxx.

281 {
282  // Insert (or replace) the (semicolon-separated) list of uncertainties that are recommended to be excluded from the eigenvector decomposition
283  //
284  // text: the (semicolon-separated) list of uncertainties in string form (will be converted to TObjString)
285 
286  if (TPair* p = (TPair*) FindObject("excluded_set")) DeleteEntry(p->Key());
287  Add(new TObjString("excluded_set"), new TObjString(text.c_str()));
288 }

◆ setHadronisation()

void CalibrationDataContainer::setHadronisation ( const std::string &  text)
inherited

insert the given text as the 'hadronisation reference' for this calibration

Definition at line 268 of file CalibrationDataContainer.cxx.

269 {
270  // Insert (or replace) the hadronisation reference.
271  //
272  // text: hadronisation reference in string form (will be converted to TObjString)
273 
274  if (TPair* p = (TPair*) FindObject("MChadronisation")) DeleteEntry(p->Key());
275  Add(new TObjString("MChadronisation"), new TObjString(text.c_str()));
276 }

◆ setInterpolated()

void CalibrationDataHistogramContainer::setInterpolated ( bool  doInterpolate)

Indicate whether results are to be interpolated between bins or not (this feature is thought to be useful mostly for MC efficiencies)

Definition at line 740 of file CalibrationDataContainer.cxx.

741 {
742  // Indicate whether results are to be interpolated between bins or not
743  // (this feature is thought to be useful mostly for MC efficiencies).
744  // The default is not to use any interpolation.
745 
746  m_interpolate = doInterpolate;
747 }

◆ setResult()

void CalibrationDataContainer::setResult ( TObject *  obj)
inherited

insert the main object for this calibration

Definition at line 244 of file CalibrationDataContainer.cxx.

245 {
246  // Specialization of the setUncertainty() method: insert the calibration result
247  //
248  // obj: object to be entered (needs to inherit from TObject)
249 
250  setUncertainty(std::string("result"), obj);
251 }

◆ setUncertainty()

void CalibrationDataContainer::setUncertainty ( const std::string &  unc,
TObject *  obj 
)
inherited

insert the relevant object for the requested source of 'uncertainty'

Definition at line 231 of file CalibrationDataContainer.cxx.

232 {
233  // Insert (or replace) the given object at the position indicated by the given index.
234  //
235  // unc: uncertainty index
236  // obj: object to be entered (needs to inherit from TObject)
237 
238  if (TPair* p = (TPair*) FindObject(unc.c_str())) DeleteEntry(p->Key());
239  Add(new TObjString(unc.c_str()), obj);
240 }

◆ setUncorrelated()

void CalibrationDataHistogramContainer::setUncorrelated ( const std::string &  unc)

Indicate that the given uncertainty is to be treated uncorrelated from bin to bin (note that the default is for all systematic uncertainties to be treated as correlated)

Definition at line 728 of file CalibrationDataContainer.cxx.

729 {
730  // Indicate that the given uncertainty is to be treated uncorrelated from bin to bin
731  // (the default is for all systematic uncertainties to be treated as correlated).
732  // This method is not normall intended to be used during physics analysis; this
733  // information is written to and read back from the calibration file.
734 
735  m_uncorrelatedSyst.Add(new TObjString(unc.c_str()));
736 }

◆ typeFromString()

int CalibrationDataContainer::typeFromString ( const std::string &  key) const
protectedinherited

Connection between variable names (on histogram axes etc.) and variable 'types' as used in actual evaluations.

Normal result values are positive (or 0); a negative return value indicates that the string is not known)

Definition at line 292 of file CalibrationDataContainer.cxx.

293 {
294  // Small utility function collecting the correspondence between axis labels and (integer) variable indices.
295  // In case of an unknown label, a negative number will be returned to flag the issue.
296 
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;
301  // return value for unknown keywords
302  else return -1;
303 }

Member Data Documentation

◆ m_binBoundaries

std::map<unsigned int, std::vector<double> > Analysis::CalibrationDataHistogramContainer::m_binBoundaries
protected

Cache for bin boundary information.

Definition at line 291 of file CalibrationDataContainer.h.

◆ m_interpolate

bool Analysis::CalibrationDataHistogramContainer::m_interpolate
private

If true, interpolate between bins rather than doing a straight bin-wise evaluation.

Definition at line 299 of file CalibrationDataContainer.h.

◆ m_lowerBounds

std::vector<double> Analysis::CalibrationDataContainer::m_lowerBounds
protectedinherited

Definition at line 210 of file CalibrationDataContainer.h.

◆ m_lowerBoundsExtrapolated

std::vector<double> Analysis::CalibrationDataContainer::m_lowerBoundsExtrapolated
protectedinherited

Definition at line 213 of file CalibrationDataContainer.h.

◆ m_objResult

TObject* Analysis::CalibrationDataContainer::m_objResult
protectedinherited

(possibly looser) upper validity bounds for extrapolation

cached variables for code speed-up

Definition at line 217 of file CalibrationDataContainer.h.

◆ m_objSystematics

TObject* Analysis::CalibrationDataContainer::m_objSystematics
protectedinherited

don't persistify

Definition at line 218 of file CalibrationDataContainer.h.

◆ m_restrict

bool Analysis::CalibrationDataContainer::m_restrict
privateinherited

persistency not needed for this variable

specifies whether the performance evaluation is to be done strictly within the range of validity

Definition at line 230 of file CalibrationDataContainer.h.

◆ m_uncorrelatedSyst

THashList Analysis::CalibrationDataHistogramContainer::m_uncorrelatedSyst
private

no need to persistify

list here the systematic uncertainties that are not correlated from bin to bin

Definition at line 296 of file CalibrationDataContainer.h.

◆ m_upperBounds

std::vector<double> Analysis::CalibrationDataContainer::m_upperBounds
protectedinherited

Definition at line 211 of file CalibrationDataContainer.h.

◆ m_upperBoundsExtrapolated

std::vector<double> Analysis::CalibrationDataContainer::m_upperBoundsExtrapolated
protectedinherited

(possibly looser) lower validity bounds for extrapolation

Definition at line 214 of file CalibrationDataContainer.h.

◆ m_variables

std::vector<unsigned int> Analysis::CalibrationDataContainer::m_variables
protectedinherited

don't persistify

specification of variable type per object (result / uncertainty)

Definition at line 223 of file CalibrationDataContainer.h.

◆ m_vars

double Analysis::CalibrationDataContainer::m_vars[MaxCalibrationVars]
protectedinherited

don't persistify

Definition at line 220 of file CalibrationDataContainer.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Analysis::CalibrationDataContainer::getUncertainty
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.
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
get_generator_info.result
result
Definition: get_generator_info.py:21
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
max
#define max(a, b)
Definition: cfImp.cxx:41
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
PlotCalibFromCool.zAxis
zAxis
Definition: PlotCalibFromCool.py:76
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Analysis::CalibrationDataHistogramContainer::getInterpolatedUncertainty
double getInterpolatedUncertainty(TH1 *hist) const
Retrieve interpolated result (utility function)
Definition: CalibrationDataContainer.cxx:777
python.App.bins
bins
Definition: App.py:410
CaloCondBlobAlgs_fillNoiseFromASCII.spec
spec
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:47
Analysis::CalibrationDataContainer::m_restrict
bool m_restrict
persistency not needed for this variable
Definition: CalibrationDataContainer.h:230
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Analysis::CalibrationDataContainer::m_upperBounds
std::vector< double > m_upperBounds
Definition: CalibrationDataContainer.h:211
plotmaker.hist
hist
Definition: plotmaker.py:148
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
Analysis::CalibrationDataHistogramContainer::m_interpolate
bool m_interpolate
If true, interpolate between bins rather than doing a straight bin-wise evaluation.
Definition: CalibrationDataContainer.h:299
yodamerge_tmp.axis
list axis
Definition: yodamerge_tmp.py:241
Analysis::CalibrationDataContainer::computeVariableTypes
virtual void computeVariableTypes()=0
decode the 'uncertainty' objects' names to determine the relevant variable types
Analysis::CalibrationDataContainer::m_objSystematics
TObject * m_objSystematics
don't persistify
Definition: CalibrationDataContainer.h:218
skel.it
it
Definition: skel.GENtoEVGEN.py:423
bin
Definition: BinsDiffFromStripMedian.h:43
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
Analysis::CalibrationDataHistogramContainer::getStatUncertainty
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)
retrieve the calibration statistical uncertainty.
Definition: CalibrationDataContainer.cxx:582
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
x
#define x
Analysis::CalibrationDataContainer::getResult
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)=0
retrieve the calibration result.
Analysis::CalibrationDataContainer::getLowerBound
double getLowerBound(unsigned int vartype, bool extrapolate=false) const
retrieve the lower bound of validity for the requested variable type
Definition: CalibrationDataContainer.cxx:366
Analysis::CalibrationDataContainer::kAbsEta
@ kAbsEta
Definition: CalibrationDataContainer.h:66
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
Analysis::kSuccess
@ kSuccess
Definition: CalibrationDataVariables.h:57
Analysis::CalibrationDataContainer::m_variables
std::vector< unsigned int > m_variables
don't persistify
Definition: CalibrationDataContainer.h:223
Analysis::CalibrationDataContainer::m_vars
double m_vars[MaxCalibrationVars]
don't persistify
Definition: CalibrationDataContainer.h:220
Analysis::CalibrationDataContainer::computeVariables
CalibrationStatus computeVariables(const CalibrationDataVariables &x, bool extrapolate=false)
Compute the variables to be used.
Definition: CalibrationDataContainer.cxx:307
doubleTestComp.j1
j1
Definition: doubleTestComp.py:21
Analysis::kExtrapolatedRange
@ kExtrapolatedRange
Definition: CalibrationDataVariables.h:59
Analysis::CalibrationDataContainer::kEta
@ kEta
Definition: CalibrationDataContainer.h:65
Analysis::kError
@ kError
Definition: CalibrationDataVariables.h:60
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
Analysis::CalibrationDataHistogramContainer::m_uncorrelatedSyst
THashList m_uncorrelatedSyst
no need to persistify
Definition: CalibrationDataContainer.h:296
Analysis::CalibrationDataHistogramContainer::m_binBoundaries
std::map< unsigned int, std::vector< double > > m_binBoundaries
Cache for bin boundary information.
Definition: CalibrationDataContainer.h:291
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
Analysis::kRange
@ kRange
Definition: CalibrationDataVariables.h:58
Analysis::UncertaintyResult
std::pair< double, double > UncertaintyResult
The following typedef is for convenience: most uncertainties can be asymmetric.
Definition: CalibrationDataContainer.h:33
Analysis::CalibrationDataHistogramContainer::getInterpolatedResult
double getInterpolatedResult(TH1 *hist) const
Retrieve interpolated result (utility function)
Definition: CalibrationDataContainer.cxx:760
Analysis::CalibrationDataHistogramContainer::computeVariableTypes
virtual void computeVariableTypes()
decode the 'uncertainty' objects' names to determine the relevant variable types
Definition: CalibrationDataContainer.cxx:490
plotBeamSpotCompare.xd
xd
Definition: plotBeamSpotCompare.py:220
Analysis::CalibrationDataContainer::m_objResult
TObject * m_objResult
(possibly looser) upper validity bounds for extrapolation
Definition: CalibrationDataContainer.h:217
Analysis::CalibrationDataContainer::m_lowerBoundsExtrapolated
std::vector< double > m_lowerBoundsExtrapolated
Definition: CalibrationDataContainer.h:213
tolerance
Definition: suep_shower.h:17
python.grid.Add
def Add(name)
Definition: grid.py:41
Analysis::CalibrationStatus
CalibrationStatus
Definition: CalibrationDataVariables.h:56
pmontree.code
code
Definition: pmontree.py:443
Analysis::CalibrationDataContainer::m_lowerBounds
std::vector< double > m_lowerBounds
Definition: CalibrationDataContainer.h:210
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Analysis::CalibrationDataHistogramContainer
Definition: CalibrationDataContainer.h:247
Analysis::CalibrationDataContainer::typeFromString
int typeFromString(const std::string &key) const
Connection between variable names (on histogram axes etc.) and variable 'types' as used in actual eva...
Definition: CalibrationDataContainer.cxx:292
Analysis::CalibrationDataContainer::kTagWeight
@ kTagWeight
Definition: CalibrationDataContainer.h:67
Analysis::CalibrationDataContainer::setUncertainty
void setUncertainty(const std::string &unc, TObject *obj)
insert the relevant object for the requested source of 'uncertainty'
Definition: CalibrationDataContainer.cxx:231
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64
python.PyAthena.v
v
Definition: PyAthena.py:157
Analysis::CalibrationDataHistogramContainer::checkBounds
void checkBounds()
check the bounds of validity for this calibration object
Definition: CalibrationDataContainer.cxx:673
makeTRTBarrelCans.dy
tuple dy
Definition: makeTRTBarrelCans.py:21
a
TList * a
Definition: liststreamerinfos.cxx:10
ref
const boost::regex ref(r_ef)
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TH1
Definition: rootspy.cxx:268
Analysis::CalibrationDataContainer::getUpperBound
double getUpperBound(unsigned int vartype, bool extrapolate=false) const
retrieve the upper bound of validity for the requested variable type
Definition: CalibrationDataContainer.cxx:379
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
python.AtlRunQueryAMI.choice
int choice
Definition: AtlRunQueryAMI.py:210
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
MuonHough::extrapolate
float extrapolate(const MuonLayerHough::Maximum &ref, const MuonLayerHough::Maximum &ex, bool doparabolic=false)
Definition: MuonLayerHough.cxx:519
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
Analysis::CalibrationDataContainer::kPt
@ kPt
Definition: CalibrationDataContainer.h:64
merge.status
status
Definition: merge.py:17
hotSpotInTAG.nb
nb
Definition: hotSpotInTAG.py:164
python.PyAthena.obj
obj
Definition: PyAthena.py:135
Analysis::CalibrationDataContainer::getStatUncertainty
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)=0
retrieve the calibration statistical uncertainty.
doubleTestComp.j2
j2
Definition: doubleTestComp.py:22
Analysis::CalibrationDataContainer::m_upperBoundsExtrapolated
std::vector< double > m_upperBoundsExtrapolated
(possibly looser) lower validity bounds for extrapolation
Definition: CalibrationDataContainer.h:214
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37