ATLAS Offline Software
Loading...
Searching...
No Matches
Analysis::CalibrationDataFunctionContainer Class Reference

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

#include <CalibrationDataContainer.h>

Inheritance diagram for Analysis::CalibrationDataFunctionContainer:
Collaboration diagram for Analysis::CalibrationDataFunctionContainer:

Public Types

enum  CalibrationParametrization { kPt = 0 , kEta = 1 , kAbsEta = 2 , kTagWeight = 3 }
 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. More...

Public Member Functions

 CalibrationDataFunctionContainer (const char *name="default")
virtual ~CalibrationDataFunctionContainer ()
virtual CalibrationStatus getResult (const CalibrationDataVariables &x, double &result, TObject *obj=0, bool=false)
 retrieve the calibration result.
virtual CalibrationStatus getStatUncertainty (const CalibrationDataVariables &x, double &result)
 retrieve the calibration statistical uncertainty.
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 setLowerBound (int vartype, double bound)
 Set the lower bound of validity for the given variable.
void setUpperBound (int vartype, double bound)
 Set the lower bound of validity for the given variable.
std::vector< std::string > listUncertainties () const
 retrieve the list of "uncertainties" accessible to this object.
CalibrationStatus getUncertainties (const CalibrationDataVariables &x, std::map< std::string, Analysis::UncertaintyResult > &all)
 retrieve the list of "uncertainties" accessible to this object.
std::string getComment () const
 retrieve the comments entered for this calibration, if any
std::string getHadronisation () const
 retrieve the 'hadronisation reference' entered for this calibration, if any
std::string getExcludedUncertainties () const
 retrieve the (semicolon-separated) set of uncertainties that are recommended for removal from the eigenvector decomposition
CalibrationStatus getSystUncertainty (const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
 retrieve the calibration total systematic uncertainty
void setResult (TObject *obj)
 insert the main object for this calibration
void setComment (const std::string &text)
 insert the given text as comment for this calibration
void setHadronisation (const std::string &text)
 insert the given text as the 'hadronisation reference' for this calibration
void setExcludedUncertainties (const std::string &text)
 insert the set of uncertainties that are recommended for removal from the eigenvector decomposition.
void setUncertainty (const std::string &unc, TObject *obj)
 insert the relevant object for the requested source of 'uncertainty'
void restrictToRange (bool restrict)
 If true, this will restrict the variables used to be within the (specified) range of validity.
bool isRangeRestricted () const
 allow the user to inspect the above information
double getLowerBound (unsigned int vartype, bool extrapolate=false) const
 retrieve the lower bound of validity for the requested variable type
double getUpperBound (unsigned int vartype, bool extrapolate=false) const
 retrieve the upper bound of validity for the requested variable type
std::vector< std::pair< double, double > > getBounds ()
 allow the user to inspect the bounds of validity
std::vector< unsigned int > getVariableTypes ()
 utility to retrieve variable types

Static Public Member Functions

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

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.
CalibrationStatus computeVariables (const CalibrationDataVariables &x, bool extrapolate=false)
 compute the variables to be used for the given 'uncertainty'

Protected Attributes

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
TObject * m_objResult
 (possibly looser) upper validity bounds for extrapolation
TObject * m_objSystematics
 don't persistify
double m_vars [MaxCalibrationVars]
 don't persistify
std::vector< unsigned int > m_variables
 don't persistify

Private Member Functions

virtual void computeVariableTypes ()
 cached
 ClassDef (CalibrationDataFunctionContainer, 1)

Private Attributes

TObject * m_objStatistics
bool m_restrict
 persistency not needed for this variable

Detailed Description

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

Definition at line 427 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

◆ CalibrationDataFunctionContainer()

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

◆ ~CalibrationDataFunctionContainer()

CalibrationDataFunctionContainer::~CalibrationDataFunctionContainer ( )
virtual

Definition at line 1566 of file CalibrationDataContainer.cxx.

1567{
1568}

Member Function Documentation

◆ ClassDef()

Analysis::CalibrationDataFunctionContainer::ClassDef ( CalibrationDataFunctionContainer ,
1  )
private

◆ computeVariables()

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

compute the variables to be used for the given 'uncertainty'

Parameters
xuser-supplied (kinematic or other) variables
uncgiven source of uncertainty (can also be the central value)
Returns
false if the given variables are outside the parametrisation's validity range 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 }
342 if (m_vars[var] < getLowerBound(m_variables[var], extrapolate)) {
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}
#define x
double getLowerBound(unsigned int vartype, bool extrapolate=false) const
retrieve the lower bound of validity for the requested variable type
double getUpperBound(unsigned int vartype, bool extrapolate=false) const
retrieve the upper bound of validity for the requested variable type
virtual void computeVariableTypes()=0
decode the 'uncertainty' objects' names to determine the relevant variable types
double m_vars[MaxCalibrationVars]
don't persistify
bool m_restrict
persistency not needed for this variable
std::vector< unsigned int > m_variables
don't persistify
float extrapolate(const MuonLayerHough::Maximum &ref, const MuonLayerHough::Maximum &ex, bool doparabolic=false)
status
Definition merge.py:16

◆ computeVariableTypes()

void CalibrationDataFunctionContainer::computeVariableTypes ( )
privatevirtual

cached

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

Implements Analysis::CalibrationDataContainer.

Definition at line 1572 of file CalibrationDataContainer.cxx.

1573{
1574 // Determine which variable types are to be used.
1575 // This needs to be done only once per calibration object, as the results will be
1576 // cached (even if not persistified).
1577 // This method should normally only be used internally.
1578
1579 if (! m_objResult) m_objResult = GetValue("result");
1580
1581 std::string title(m_objResult->GetTitle());
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);
1587 int vartype = typeFromString(var);
1588 if (vartype < 0) {
1589 // Only flag the issue but otherwise take no action (assume non-argument use of a semicolon)
1590 std::cerr << "in CalibrationDataFunctionContainer::computeVariableTypes(): cannot construct variable type from name "
1591 << var << std::endl;
1592 } else {
1593 m_variables.push_back((unsigned int)vartype);
1594 }
1595 }
1596
1597 // After doing this, we should always have a non-null vector!
1598 assert(m_variables.size() > 0);
1599}
int typeFromString(const std::string &key) const
Connection between variable names (on histogram axes etc.) and variable 'types' as used in actual eva...
TObject * m_objResult
(possibly looser) upper validity bounds for extrapolation

◆ 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}

◆ 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}

◆ 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}
#define max(a, b)
Definition cfImp.cxx:41

◆ getResult()

CalibrationStatus CalibrationDataFunctionContainer::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.

Definition at line 1605 of file CalibrationDataContainer.cxx.

1607{
1608 // Retrieve the central value for the given input variables. There are cases where
1609 // it may be useful to provide an alternative parametrisation rather than the original
1610 // one; in such cases it is possible to provide a pointer to this alternative parametrisation.
1611 //
1612 // x: input variables
1613 // result: result
1614 // obj: pointer to alternative results histogram
1615 if (!obj) {
1616 if (! m_objResult) m_objResult = GetValue("result");
1617 obj = m_objResult;
1618 }
1619 TF1* func = dynamic_cast<TF1*>(obj);
1620 if (! func) return Analysis::kError;
1621
1622 // select the relevant kinematic variables
1624 result = func->EvalPar(m_vars);
1625
1626 return status;
1627}
CalibrationStatus computeVariables(const CalibrationDataVariables &x, bool extrapolate=false)
compute the variables to be used for the given 'uncertainty'

◆ getStatUncertainty()

CalibrationStatus CalibrationDataFunctionContainer::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.

Definition at line 1675 of file CalibrationDataContainer.cxx.

1677{
1678 // Retrieve the statistical uncertainty for the given input variables.
1679 // The model that is assumed here is that statistical uncertainties follow from
1680 // a fit of the function to other information, and that the parameter covariance matrix
1681 // resulting from the fit are stored in a TMatrixDSym object identified by the
1682 // keyword "statistics". The effect of a change of fit parameters is then used to
1683 // evaluate the change in function value at the given co-ordinates.
1684 //
1685 // x: input variables
1686 // result: result
1687
1688 if (! m_objResult) m_objResult = GetValue("result"); // ensure that the requested objects exist
1689 TF1* func = dynamic_cast<TF1*>(m_objResult);
1690 if (! func) {
1691 // std::cerr << "... unable to retrieve the result" << std::endl;
1692 return Analysis::kError;
1693 }
1694
1695 if (! m_objStatistics) m_objStatistics = GetValue("statistics");
1696 // m_objStatistics->Dump();
1697 TMatrixTSym<double>* cov = dynamic_cast<TMatrixTSym<double>*>(m_objStatistics);
1698 if (! cov) {
1699 // std::cerr << "... unable to retrieve the covariance matrix" << std::endl;
1700 return Analysis::kError;
1701 }
1702
1703 // select the relevant kinematic variables
1705
1706 // use a large value for "eps": this multiplies the uncertainties that
1707 // are expected to be associated with the parameters. Choosing a large
1708 // value expresses the fact that we are not primarily interested in the
1709 // parabolic behaviour at the minimum
1710 // const Double_t eps = 1.0;
1711 // test: set to 0.5
1712 const Double_t eps = 0.5;
1713
1714 int npar = func->GetNpar();
1715 if (npar == 0) {
1716 result = 0.;
1717 return status;
1718 }
1719
1720 TMatrixT<double> gradients(npar,1);
1721 for (int ipar = 0; ipar < npar; ++ipar) {
1722 gradients(ipar,0) = func->GradientPar(ipar, m_vars, eps);
1723 }
1724
1725 // carry out the matrix multiplication
1726 TMatrixT<double> gradientsTransposed(TMatrixT<double>::kTransposed, gradients);
1727 // std::cout << "parametricVariance: transposed gradients:";
1728 // for (int ipar = 0; ipar < npar; ++ipar)
1729 // std::cout << " " << gradients(0,ipar);
1730 // std::cout << std::endl;
1731 TMatrixT<double> tmp1(*cov, TMatrixT<double>::kMult, gradients);
1732 // std::cout << "parametricVariance: cov * gradients:";
1733 // for (int ipar = 0; ipar < npar; ++ipar)
1734 // std::cout << " " << tmp1(ipar,0);
1735 TMatrixT<double> tmp2(gradientsTransposed, TMatrixT<double>::kMult, tmp1);
1736
1737 result = TMath::Sqrt(tmp2(0,0));
1738
1739 return status;
1740}

◆ 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}
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.

◆ 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}
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)=0
retrieve the calibration statistical uncertainty.
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)=0
retrieve the calibration result.
std::pair< double, double > UncertaintyResult
The following typedef is for convenience: most uncertainties can be asymmetric.

◆ getUncertainty()

CalibrationStatus CalibrationDataFunctionContainer::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.

Definition at line 1633 of file CalibrationDataContainer.cxx.

1636{
1637 // Retrieve the uncertainty for the given input variables.
1638 // Note that the uncertainties returned will be symmetrised.
1639 //
1640 // unc: keyword indicating requested source of uncertainty. This should
1641 // correspond to one of the parametrisations added explicitly as a systematic
1642 // uncertainty or the keyword "statistics" (statistical uncertainties are
1643 // accessed differently, see method getStatUncertainty()).
1644 // x: input variables
1645 // result: result
1646 // obj: pointer to alternative or cached parametrisation
1647 if (unc == "statistics") {
1648 // treat statistical uncertainties separately (they are stored with the actual result)
1649 double res;
1651 if (code == Analysis::kError) return code;
1652 result.first = res;
1653 result.second = -res;
1654 return code;
1655 }
1656
1657 if (!obj) obj = GetValue(unc.c_str());
1658 TF1* func = dynamic_cast<TF1*>(obj);
1659 if (! func) return Analysis::kError;
1660
1661 // select the relevant kinematic variables
1663
1664 // the "first" and "second" entries are filled with the
1665 // "positive" and "negative" uncertainties, respectively.
1666 // Note: no "negative" uncertainties implemented as yet!
1667 result.first = func->EvalPar(m_vars);
1668 result.second = -result.first;
1669
1670 return status;
1671}
std::pair< std::vector< unsigned int >, bool > res
virtual CalibrationStatus getStatUncertainty(const CalibrationDataVariables &x, double &result)
retrieve the calibration statistical uncertainty.

◆ 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}
std::vector< double > m_upperBoundsExtrapolated
(possibly looser) lower validity bounds for extrapolation

◆ 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}

◆ 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}
const boost::regex ref(r_ef)
static Double_t a
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631
constexpr double tolerance

◆ 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
130 uncertainties.emplace_back(pair->Key()->GetName());
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}

◆ setLowerBound()

void Analysis::CalibrationDataFunctionContainer::setLowerBound ( int vartype,
double bound )
inline

Set the lower bound of validity for the given variable.

Definition at line 438 of file CalibrationDataContainer.h.

438{m_lowerBounds[vartype] = bound; }

◆ 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}
void setUncertainty(const std::string &unc, TObject *obj)
insert the relevant object for the requested source of 'uncertainty'

◆ 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}

◆ setUpperBound()

void Analysis::CalibrationDataFunctionContainer::setUpperBound ( int vartype,
double bound )
inline

Set the lower bound of validity for the given variable.

Definition at line 441 of file CalibrationDataContainer.h.

441{m_upperBounds[vartype] = bound; }

◆ 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_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_objStatistics

TObject* Analysis::CalibrationDataFunctionContainer::m_objStatistics
private

Definition at line 445 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_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: