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

This tool provides an interface to flavour tagging performance estimates. More...

#include <CalibrationDataInterfaceROOT.h>

Inheritance diagram for Analysis::CalibrationDataInterfaceROOT:

Classes

class  HadronisationReferenceHelper

Public Types

enum  variableType { kEta , kAbsEta , kPt }
 known variable types that can be used as function arguments More...

Public Member Functions

 CalibrationDataInterfaceROOT (const std::string &taggerName, const std::string &configname="BTagCalibration.env", const std::string &pathname="")
 main constructor for "stand-alone" use (with information fed in from a .env configuration file read by TEnv)
 CalibrationDataInterfaceROOT (const std::string &taggerName, const char *fileSF, const char *fileEff, const std::vector< std::string > &jetAliases, const std::map< std::string, std::string > &SFNames, const std::map< std::string, std::vector< std::string > > &EffNames, const std::map< std::string, std::vector< std::string > > &excludeFromEV, const std::map< std::string, Analysis::EVReductionStrategy > &EVReductions, bool useEV=true, Uncertainty strat=SFEigen, bool useMCMCSF=true, bool useTopologyRescaling=false, bool useRecommendedEVExclusions=false, bool verbose=true, std::vector< std::string > flavours={"B", "C", "Light", "T"})
 alternative constructor passing configuration information explicitly (so that no .env file is needed)
 CalibrationDataInterfaceROOT ()
 default constructor for PROOF object retrieval
 CalibrationDataInterfaceROOT (const CalibrationDataInterfaceROOT &other)
 copy constructor
virtual ~CalibrationDataInterfaceROOT ()
 default destructor
CalibResult getScaleFactor (const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
 efficiency scale factor retrieval by name.
CalibResult getEfficiency (const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, const std::string &flavour, unsigned int numVariation=0, unsigned int mapIndex=0)
 efficiency retrieval by name
CalibResult getInefficiencyScaleFactor (const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
 "MC" inefficiency scale factor retrieval by name
CalibResult getInefficiency (const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
 inefficiency retrieval by name
CalibResult getMCEfficiency (const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc=None, unsigned int mapIndex=0)
 "MC" efficiency retrieval by name
CalibResult getMCInefficiency (const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc=None, unsigned int mapIndex=0)
 "MC" inefficiency retrieval by name
std::vector< std::string > listScaleFactorUncertainties (const std::string &author, const std::string &label, const std::string &OP, bool named=false)
 retrieve the list of "uncertainties" relevant to the calibration object.
unsigned int getNumVariations (const std::string &author, const std::string &label, const std::string &OP, Uncertainty unc)
 retrieve the number of variations relevant to the calibration object.
bool retrieveCalibrationIndex (const std::string &label, const std::string &OP, const std::string &author, bool isSF, unsigned int &index, unsigned int mapIndex=0)
 Retrieve the index of the calibration object (container) starting from the label and operating point.
std::string nameFromIndex (unsigned int index) const
 Retrieve the name of the calibration object (container) given its index.
CalibResult getScaleFactor (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, const std::string &flavour, unsigned int numVariation=0)
 efficiency scale factor retrieval by index #2
CalibResult getEfficiency (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, const std::string &flavour, unsigned int numVariation=0)
 efficiency retrieval by index
CalibResult getInefficiencyScaleFactor (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, const std::string &flavour, unsigned int numVariation=0)
 "MC" inefficiency scale factor retrieval by index
CalibResult getInefficiency (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, const std::string &flavour, unsigned int numVariation=0)
 inefficiency retrieval by index
CalibResult getMCEfficiency (const CalibrationDataVariables &variables, unsigned int index, Uncertainty unc=None)
 "MC" efficiency retrieval by index
CalibResult getMCInefficiency (const CalibrationDataVariables &variables, unsigned int index, Uncertainty unc=None)
 "MC" inefficiency retrieval by index
double getMCMCScaleFactor (const CalibrationDataVariables &variables, unsigned indexSF, unsigned int indexEff) const
 MC/MC scale factor retrieval.
std::vector< std::string > listScaleFactorUncertainties (unsigned int index, const std::string &flavour, bool named=false)
 retrieve the list of "uncertainties" relevant to the calibration object.
unsigned int getNumVariations (unsigned int index, Uncertainty unc, const std::string &flavour)
 retrieve the number of variations relevant to the calibration object.
std::string fullName (const std::string &author, const std::string &OP, const std::string &label, bool isSF, unsigned mapIndex=0) const
 @ brief construct the full object pathname from its individual components
CalibrationStatus getScaleFactor (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, unsigned int numVariation, CalibResult &result, const std::string &flavour)
 efficiency scale factor retrieval by index #3
CalibrationStatus getEfficiency (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, unsigned int numVariation, CalibResult &result, const std::string &flavour)
 efficiency retrieval by index
CalibrationStatus getInefficiencyScaleFactor (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, unsigned int numVariation, CalibResult &result, const std::string &flavour)
 "MC" inefficiency scale factor retrieval by index
CalibrationStatus getInefficiency (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, unsigned int numVariation, CalibResult &result, const std::string &flavour)
 inefficiency retrieval by index
CalibrationStatus getMCEfficiency (const CalibrationDataVariables &variables, unsigned int index, Uncertainty unc, CalibResult &result)
 "MC" efficiency retrieval by index
CalibResult getWeightScaleFactor (const CalibrationDataVariables &variables, const std::string &label, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
 efficiency scale factor retrieval by name
CalibResult getWeightScaleFactor (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, unsigned int numVariation=0)
 efficiency scale factor retrieval by index
CalibrationStatus getWeightScaleFactor (const CalibrationDataVariables &variables, unsigned int indexSF, unsigned int indexEff, Uncertainty unc, unsigned int numVariation, CalibResult &result)
 efficiency scale factor retrieval by index, with different signature
CalibrationStatus runEigenVectorRecomposition (const std::string &author, const std::string &label, const std::string &OP, unsigned int mapindex=0)
 run EigenVector Recomposition method
CalibrationStatus runEigenVectorRecomposition (const std::string &label, unsigned int mapindex=0)
std::map< std::string, std::map< std::string, float > > getEigenVectorRecompositionCoefficientMap ()
 Get Eigenvector recomposition map after running runEigenVectorRecomposition()
const TObject * getMCEfficiencyObject (const std::string &author, const std::string &label, const std::string &OP, unsigned int mapIndex=0)
 retrieve the MC efficiency (central values) object for the given flavour label and operating point.
const TH1 * getBinnedScaleFactors (const std::string &author, const std::string &label, const std::string &OP)
 retrieve the binned calibration object for the given flavour label and operating point.
const TH1 * getShiftedScaleFactors (const std::string &author, const std::string &label, const std::string &OP, const std::string &unc, double sigmas)
 retrieve the binned calibration object for the given flavour label and operating point, with the result shifted by the given number of standard deviations for the given systematic uncertainty.
TMatrixDSym getScaleFactorCovarianceMatrix (const std::string &author, const std::string &label, const std::string &OP, const std::string &unc="all")
 retrieve the named covariance matrix element corresponding to the binned calibration object.
void initialize (const std::string &jetauthor, const std::string &OP, Uncertainty unc)
 initialization for PROOF usage
CalibrationDataContainerretrieveContainer (const std::string &label, const std::string &OP, const std::string &author, const std::string &cntname, bool isSF, bool doPrint=true)
 utility function taking care of object retrieval
const std::string & EffCalibrationName (const std::string &flavour, unsigned int mapIndex=0) const
 Main interface methods accessing the flavour tagging performance information.
void setEffCalibrationNames (const std::map< std::string, std::vector< std::string > > &names)
const std::string & SFCalibrationName (const std::string &flavour) const
void setSFCalibrationNames (const std::map< std::string, std::string > &names)

Protected Member Functions

std::string getContainername (const std::string &flavour, bool SF, unsigned int mapIndex=0) const
 auxiliary function for string concatenation
std::string getBasename (const std::string &name) const
 auxiliary function for retrieval of name within the directory
double combinedUncertainty (double stat, const std::pair< double, double > &syst) const
 utility function for combination of statistical and (a priori asymmetric) systematic uncertainty.

Protected Attributes

std::string m_taggerName
 tagging algorithm name

Private Member Functions

std::string getAlias (const std::string &author) const
 associated alias retrieval method
bool checkAbsEta (const CalibrationDataVariables &variables, unsigned int index)
void increaseCounter (unsigned int index, OutOfBoundsType oob=Main)
void checkWeightScaleFactors (unsigned int indexSF, unsigned int indexEff)

Private Attributes

TFile * m_fileEff {}
 pointer to the TFile object providing access to the calibrations
TFile * m_fileSF {}
 Do not attempt to persistify (PROOF)
std::map< std::string, std::string > m_aliases
 Do not attempt to persistify (PROOF)
std::vector< CalibrationDataContainer * > m_objects
 cache the objects themselves (so that the user will not have to delete them after each call etc.).
std::map< std::string, unsigned int > m_objectIndices
std::string m_filenameSF
 in addition, store also the filenames themselves (needed for the copy constructor)
std::string m_filenameEff
std::vector< std::string > m_flavours
std::map< const CalibrationDataContainer *, std::shared_ptr< CalibrationDataEigenVariations > > m_eigenVariationsMap
 store the eigenvector class and associate to its CalibrationDataContainer
bool m_runEigenVectorMethod {}
 decide whether to run the eigenvector method or not
Uncertainty m_EVStrategy {}
std::map< std::string, Analysis::EVReductionStrategym_EVReductions
 Eigenvector reduction strategy (per flavour)
std::map< std::string, std::vector< std::string > > m_excludeFromCovMatrix
 store the uncertainties which should be excluded from building the full covariance matrix
bool m_useRecommendedEVExclusions {}
 if true, exclude pre-recommended lists of uncertainties from the covariance matrix building, in addition to the above user specified lists
bool m_verbose {}
 if true, allow also for some informational (and not only error/warning) messages
bool m_useMCMCSF {}
 specify whether or not to use MC/MC (hadronisation) scale factors (the fact that this is steerable is intended to be temporary only)
bool m_useTopologyRescaling {}
 specify whether or not to use MC/MC (topology) scale factors (also this steering option may be removed)
std::map< std::string, HadronisationReferenceHelper * > m_refMap
 the following maps (one for each directory) specify the name of the container serving as the 'hadronisation' reference for each object
std::vector< int > m_hadronisationReference
 store the 'hadronisation' reference for each object (-1 means no reference found)
std::map< std::string, std::map< std::string, float > > m_coefficientMap
double m_maxAbsEta {}
 |eta| bounds and strategy for dealing with out-of-bounds conditions
OutOfBoundsStrategy m_absEtaStrategy {}
OutOfBoundsStrategy m_otherStrategy {}
std::vector< unsigned int > m_etaCounters
 counters for flagging out-of-bound cases
std::vector< unsigned int > m_mainCounters
std::vector< unsigned int > m_extrapolatedCounters
std::vector< std::pair< unsigned int, unsigned int > > m_checkedWeightScaleFactors
double m_maxTagWeight {}
std::map< std::string, std::vector< std::string > > m_calibrationEffNames
 this simply collects the per-flavour properties.
std::map< std::string, std::string > m_calibrationSFNames

Detailed Description

This tool provides an interface to flavour tagging performance estimates.

A separate instance should be used for each different tagging algorithm. For each instance, all appropriate jet collections and tagger operating points need to be specified.

The model:

  • b-jets: data-MC scale factor (factorised 2D function of eta, pt) MC reference the product is the data efficiency; alternatively, the scale factor may be used
  • c-jets: as for b-jets, but with a different MC reference
  • light-flavour jets: data-MC scale factor (factorised 2D function of eta, pt) MC reference Besides the results, it is also possible to retrieve associated uncertainties. This need not be configured, and a choice as to the uncertainty component can be made on a case-by-case basis.

The idea is to use the same physical ROOT file that is also accessed through COOL, but to do so in a stand-alone fashion, so that there is no COOL or Athena dependence. Apart from this, the same infrastructure and limitations as with COOL access (

Definition at line 87 of file CalibrationDataInterfaceROOT.h.

Member Enumeration Documentation

◆ variableType

Constructor & Destructor Documentation

◆ CalibrationDataInterfaceROOT() [1/4]

Analysis::CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT ( const std::string & taggerName,
const std::string & configname = "BTagCalibration.env",
const std::string & pathname = "" )

main constructor for "stand-alone" use (with information fed in from a .env configuration file read by TEnv)

◆ CalibrationDataInterfaceROOT() [2/4]

Analysis::CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT ( const std::string & taggerName,
const char * fileSF,
const char * fileEff,
const std::vector< std::string > & jetAliases,
const std::map< std::string, std::string > & SFNames,
const std::map< std::string, std::vector< std::string > > & EffNames,
const std::map< std::string, std::vector< std::string > > & excludeFromEV,
const std::map< std::string, Analysis::EVReductionStrategy > & EVReductions,
bool useEV = true,
Uncertainty strat = SFEigen,
bool useMCMCSF = true,
bool useTopologyRescaling = false,
bool useRecommendedEVExclusions = false,
bool verbose = true,
std::vector< std::string > flavours = {"B", "C", "Light", "T"} )

alternative constructor passing configuration information explicitly (so that no .env file is needed)

Definition at line 481 of file CalibrationDataInterfaceROOT.cxx.

490 :
491 m_filenameSF(fileSF), m_filenameEff(""), m_flavours(std::move(flavours)),
492 m_runEigenVectorMethod(useEV), m_EVStrategy(strat), m_EVReductions(EVReductions),
493 m_useRecommendedEVExclusions(useRecommendedEEVExclusions), m_verbose(verbose),
494 m_useMCMCSF(useMCMCSF), m_useTopologyRescaling(useTopologyRescaling),
497{
498 // Normal constructor avoiding the need for a .env file.
499 //
500 // taggerName: this should correspond to the tagger name as used in the calibration ROOT file
501 // fileSF: full path of the calibration ROOT file containing the calibration scale factors
502 // fileEff: optional full path name of a ROOT file containing additional MC efficiency maps
503 // (use a null pointer to disable the use of such additional file)
504 // flavours; This should correspond to the list of flavour labels that's used by a tagger, and
505 // which corresponds to the labels used in internal maps
506 // jetAliases: this can be used to convert jet collection names to the corresponding names in the
507 // calibration ROOT file (this may be useful as e.g. the collection names in the
508 // calibration ROOT file have the JVF criterion attached as a suffix).
509 // Each alias is specified as
510 // nameOrig->nameTarget,
511 // where nameOrig and nameTarget are the names of the input jet collection and the
512 // jet collection name as used in the calibration ROOT file, respectively.
513 // SFNames: map specifying for each of the calibration flavours ("B", "C", "T", "Light") the
514 // name of the scale factor calibration object
515 // EffNames: map specifying for each of the calibration flavours ("B", "C", "T", "Light") the
516 // names of the possibly relevant efficiency calibration objects
517 // excludeFromEV: map specifying for each of the calibration flavours ("B", "C", "T", "Light") the
518 // systematic uncertainties to be excluded from the Eigenvector variation treatment
519 // (this is used only if Eigenvector variations are used to begin with)
520 // EVReductions: Eigenvector variation reduction strategies for "B", "C", "Light" jets (again,
521 // this is only relevant if Eigenvector variations are used to begin with)
522 // useEV: switch specifying if Eigenvector variations will be used or not
523 // useMCMCSF: switch specifying if generator-dependent scale factors are to be applied or not
524
525 // Note: at present, the means to change the strategies and maximum values initialized above do not exist
526 // when using this constructor
527
528 if (m_verbose) {
529 cout << "=== CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT ===" << endl;
530 cout << " taggerName : " << taggerName << endl;
531 cout << " Systematic strategy : ";
532 if (m_EVStrategy == Analysis::Uncertainty::SFEigen){
533 cout << "SFEigen" << endl;
534 } else if (m_EVStrategy == Analysis::Uncertainty::SFGlobalEigen){
535 cout << "SFGlobalEigen" << endl;
536 } else {
537 cout << " Other" << endl;
538 }
539 if (fileEff) cout << " Efficiency file name : " << fileEff << endl;
540 cout << " SF file name : " << fileSF << endl
541 << endl;
542 }
543
544 m_taggerName = taggerName;
545
546 m_fileSF = TFile::Open(fileSF, "READ");
547 if (fileEff && strcmp(fileSF, fileEff) != 0) {
548 m_filenameEff = string(fileEff);
549 m_fileEff = TFile::Open(fileEff, "READ");
550 } else
552
553 if (m_verbose) {
554 TObjString* s;
555 m_fileSF->GetObject("VersionInfo/BuildNumber", s);
556 if (s) cout << " CDI file build number: " << s->GetName() << endl;
557 cout << endl;
558 }
559
560 for (unsigned int i = 0; i < jetAliases.size(); ++i) {
561 // Each alias specification uses an arrow ("->"). Forget about entries
562 // not properly following this specification.
563 string::size_type arrow = jetAliases[i].find("->");
564 if (arrow == string::npos) continue;
565 m_aliases[jetAliases[i].substr(0,arrow)] = jetAliases[i].substr(arrow+2);
566 }
567
568 setEffCalibrationNames(EffNames);
569 setSFCalibrationNames(SFNames);
570
572 // if we want to run EV, then decide which one
573 // The following should hold for both eigenvector decomposition methods (SFEigen and SFGlobalEigen)
574 // The global one simply adapts itself to using the m_excludeFromCovMatrix to perform the same task
575
576 m_excludeFromCovMatrix = excludeFromEV;
577 unsigned int n_excluded = 0;
578 for (auto const& flavour : m_flavours) {
579 n_excluded += m_excludeFromCovMatrix[flavour].size();
580 }
581 if (m_verbose) {
582 cout << " List of uncertainties to exclude:";
583 if (n_excluded == 0) cout << " none";
584 for (auto const& flavour : m_flavours) {
585 if (m_excludeFromCovMatrix[flavour].size() > 0) {
586 cout << "\n\t" << flavour << ":\t";
587 for (unsigned int i = 0; i < m_excludeFromCovMatrix[flavour].size(); ++i) {
588 cout << m_excludeFromCovMatrix[flavour].at(i);
589 if (i+1 == m_excludeFromCovMatrix[flavour].size()) cout << "; ";
590 }
591 cout << endl;
592 }
593 }
594 cout << endl;
595 }
596
597 }
598
599 if (m_verbose) cout << "======= end of CalibrationDataInterfaceROOT instantiation ========" << endl;
600}
std::string m_taggerName
tagging algorithm name
void setEffCalibrationNames(const std::map< std::string, std::vector< std::string > > &names)
void setSFCalibrationNames(const std::map< std::string, std::string > &names)
bool m_verbose
if true, allow also for some informational (and not only error/warning) messages
bool m_useTopologyRescaling
specify whether or not to use MC/MC (topology) scale factors (also this steering option may be remove...
std::map< std::string, std::string > m_aliases
Do not attempt to persistify (PROOF)
TFile * m_fileSF
Do not attempt to persistify (PROOF)
bool m_useRecommendedEVExclusions
if true, exclude pre-recommended lists of uncertainties from the covariance matrix building,...
TFile * m_fileEff
pointer to the TFile object providing access to the calibrations
bool m_runEigenVectorMethod
decide whether to run the eigenvector method or not
std::map< std::string, Analysis::EVReductionStrategy > m_EVReductions
Eigenvector reduction strategy (per flavour)
bool m_useMCMCSF
specify whether or not to use MC/MC (hadronisation) scale factors (the fact that this is steerable is...
std::map< std::string, std::vector< std::string > > m_excludeFromCovMatrix
store the uncertainties which should be excluded from building the full covariance matrix
double m_maxAbsEta
|eta| bounds and strategy for dealing with out-of-bounds conditions
std::string m_filenameSF
in addition, store also the filenames themselves (needed for the copy constructor)
bool verbose
Definition hcg.cxx:73

◆ CalibrationDataInterfaceROOT() [3/4]

Analysis::CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT ( )

default constructor for PROOF object retrieval

Definition at line 603 of file CalibrationDataInterfaceROOT.cxx.

604{
605 // Default constructor for PROOF purposes
606
607 m_fileEff=0;
608 m_fileSF=0;
609}

◆ CalibrationDataInterfaceROOT() [4/4]

Analysis::CalibrationDataInterfaceROOT::CalibrationDataInterfaceROOT ( const CalibrationDataInterfaceROOT & other)

copy constructor

Definition at line 612 of file CalibrationDataInterfaceROOT.cxx.

612 :
613 Analysis::CalibrationDataInterfaceBase(other), m_aliases(other.m_aliases), m_objects(), m_objectIndices(),
614 m_filenameSF(other.m_filenameSF), m_filenameEff(other.m_filenameEff),
615 m_eigenVariationsMap(), m_runEigenVectorMethod(other.m_runEigenVectorMethod), m_EVStrategy(other.m_EVStrategy),
616 m_excludeFromCovMatrix(other.m_excludeFromCovMatrix), m_useMCMCSF(other.m_useMCMCSF), m_useTopologyRescaling(other.m_useTopologyRescaling),
618 m_maxAbsEta(other.m_maxAbsEta), m_absEtaStrategy(other.m_absEtaStrategy), m_otherStrategy(other.m_otherStrategy),
619 m_etaCounters(other.m_etaCounters), m_mainCounters(other.m_mainCounters), m_extrapolatedCounters(other.m_extrapolatedCounters),
620 m_checkedWeightScaleFactors(other.m_checkedWeightScaleFactors), m_maxTagWeight(other.m_maxTagWeight)
621{
622 // Copy constructor. Note that the "cacheable" items aren't copied (they will be re-created if needed)
623
624 // The TFile objects cannot be copied. Therefore, create duplicate objects starting from the filenames
625 m_fileSF = TFile::Open(m_filenameSF.c_str(), "READ");
628 else
629 m_fileEff = TFile::Open(m_filenameEff.c_str(), "READ");
630}
std::vector< std::pair< unsigned int, unsigned int > > m_checkedWeightScaleFactors
std::map< std::string, unsigned int > m_objectIndices
std::map< std::string, HadronisationReferenceHelper * > m_refMap
the following maps (one for each directory) specify the name of the container serving as the 'hadroni...
std::vector< int > m_hadronisationReference
store the 'hadronisation' reference for each object (-1 means no reference found)
std::vector< CalibrationDataContainer * > m_objects
cache the objects themselves (so that the user will not have to delete them after each call etc....
std::vector< unsigned int > m_etaCounters
counters for flagging out-of-bound cases
std::map< const CalibrationDataContainer *, std::shared_ptr< CalibrationDataEigenVariations > > m_eigenVariationsMap
store the eigenvector class and associate to its CalibrationDataContainer

◆ ~CalibrationDataInterfaceROOT()

Analysis::CalibrationDataInterfaceROOT::~CalibrationDataInterfaceROOT ( )
virtual

default destructor

Definition at line 633 of file CalibrationDataInterfaceROOT.cxx.

634{
635 // Destructor
636 if ((m_fileEff!=0) && (m_fileSF!=0)) {
637 if (m_fileEff == m_fileSF) {
638 m_fileEff->Close();
639 delete m_fileEff; m_fileEff = 0;
640 } else {
641 m_fileEff->Close();
642 m_fileSF->Close();
643 delete m_fileEff; m_fileEff = 0;
644 delete m_fileSF; m_fileSF = 0;
645 }
646 }
647 // delete also the stored objects (these are owned by us)
648 for (std::vector<CalibrationDataContainer*>::iterator it = m_objects.begin(); it != m_objects.end(); ++it) {
649 if (*it) {
650 delete *it; *it = 0;
651 }
652 }
653
654 for (std::map<std::string, HadronisationReferenceHelper*>::iterator it = m_refMap.begin();
655 it != m_refMap.end(); ++it) {
656 if(it->second)
657 { delete it->second; it->second=nullptr; }
658 }
659
660 // Print summary output on out-of-bounds issues
661 if (m_absEtaStrategy == Flag && m_verbose) {
662 bool found = false;
663 cout << "\t\tCalibrationDataInterfaceROOT |eta| out-of-bounds summary:" << endl;
664 for (unsigned int index = 0; index < m_mainCounters.size(); ++index)
665 if (m_etaCounters[index] > 0) {
666 found = true;
667 cout << "\t\t\t" << nameFromIndex(index) << ": " << m_etaCounters[index] << endl;
668 }
669 if (!found) cout << "\t\t\tNo issues found" << endl;
670 }
671 if (m_otherStrategy == Flag && m_verbose) {
672 bool found = false;
673 cout << "\t\tCalibrationDataInterfaceROOT object out-of-bounds summary:" << endl;
674 for (unsigned int index = 0; index < m_mainCounters.size(); ++index)
675 if (m_mainCounters[index] + m_extrapolatedCounters[index] > 0) {
676 found = true;
677 cout << "\t\t\t" << nameFromIndex(index)
678 << " general: " << m_mainCounters[index]
679 << ", extrapolated: " << m_extrapolatedCounters[index]
680 << endl;
681 }
682 if (!found) cout << "\t\t\tNo issues found" << endl;
683 }
684}
std::string nameFromIndex(unsigned int index) const
Retrieve the name of the calibration object (container) given its index.
str index
Definition DeMoScan.py:362

Member Function Documentation

◆ checkAbsEta()

bool Analysis::CalibrationDataInterfaceROOT::checkAbsEta ( const CalibrationDataVariables & variables,
unsigned int index )
nodiscardprivate

Definition at line 1920 of file CalibrationDataInterfaceROOT.cxx.

1922{
1923 // Check whether the jet eta value is outside the range of validity, subject to the strategy
1924 // specified in the configuration file.
1925 bool pass = true;
1926 if (m_absEtaStrategy == Ignore) return pass;
1927
1928 switch (m_absEtaStrategy) {
1929 case GiveUp:
1930 if (std::fabs(variables.jetEta) > m_maxAbsEta) {
1931 pass = false;
1932 }
1933 break;
1934 case Flag:
1935 default:
1936 if (std::fabs(variables.jetEta) > m_maxAbsEta) {
1937 increaseCounter(index, Eta);
1938 }
1939
1940 }
1941 return pass;
1942}
void increaseCounter(unsigned int index, OutOfBoundsType oob=Main)

◆ checkWeightScaleFactors()

void Analysis::CalibrationDataInterfaceROOT::checkWeightScaleFactors ( unsigned int indexSF,
unsigned int indexEff )
private

Definition at line 1767 of file CalibrationDataInterfaceROOT.cxx.

1769{
1770 // Check the tag weight scale factors that would result from the combination of
1771 // the provided scale factor and MC tag weight objects.
1772 // The way this is done is by determining the binning that would apply to the
1773 // combination of the two individual inputs, and then by explicitly computing
1774 // the scale factors in each of these resulting bins.
1775
1776 std::vector<std::pair<unsigned int, unsigned int> >::const_iterator it = std::find(m_checkedWeightScaleFactors.begin(), m_checkedWeightScaleFactors.end(), std::make_pair(indexSF, indexEff));
1777 if (it != m_checkedWeightScaleFactors.end()) return;
1778
1779
1780 // Assume that only histogram containers are involved here (this should be the case
1781 // as at least a strict tag weight binning should be applied).
1782 CalibrationDataHistogramContainer* container = dynamic_cast<CalibrationDataHistogramContainer*>(m_objects[indexSF]);
1783 if (! container) {
1784 cerr << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: error: container for object " << nameFromIndex(indexSF) << " not found!" << endl;
1785 return;
1786 } else if (! container->GetValue("MCreference")) {
1787 cerr << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: error: no MCreference histogram for object " << nameFromIndex(indexSF) << "!" << endl;
1788 return;
1789 }
1790 CalibrationDataHistogramContainer* effContainer = dynamic_cast<CalibrationDataHistogramContainer*>(m_objects[indexEff]);
1791 if (! effContainer) {
1792 cerr << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: error: container for object " << nameFromIndex(indexEff) << " not found!" << endl;
1793 return;
1794 }
1795
1796 // Retrieve the variable types and corresponding bin boundaries
1797 std::vector<unsigned int> vars = container->getVariableTypes();
1798 std::vector<unsigned int> effVars = effContainer->getVariableTypes();
1799 // Retrieve the corresponding bin boundaries
1800 std::map<unsigned int, std::vector<double> > boundaries, effBoundaries, mergedBoundaries;
1801 for (unsigned int t = 0; t < vars.size(); ++t)
1802 boundaries[vars[t]] = container->getBinBoundaries(vars[t]);
1803 for (unsigned int t = 0; t < effVars.size(); ++t)
1804 effBoundaries[effVars[t]] = effContainer->getBinBoundaries(effVars[t]);
1805
1806 // Special case: handle |eta| versus eta differences, by transforming to the latter
1807 if (boundaries.find(CalibrationDataContainer::kEta) == boundaries.end() && boundaries.find(CalibrationDataContainer::kAbsEta) != boundaries.end()) {
1809 boundaries.erase(CalibrationDataContainer::kAbsEta);
1810 }
1811 if (effBoundaries.find(CalibrationDataContainer::kEta) == effBoundaries.end() && effBoundaries.find(CalibrationDataContainer::kAbsEta) != effBoundaries.end()) {
1813 effBoundaries.erase(CalibrationDataContainer::kAbsEta);
1814 }
1815 if (boundaries.find(CalibrationDataContainer::kEta) != boundaries.end() && effBoundaries.find(CalibrationDataContainer::kEta) != effBoundaries.end()) {
1816 std::vector<double>& v = boundaries[CalibrationDataContainer::kEta];
1817 std::vector<double>& vEff = effBoundaries[CalibrationDataContainer::kEta];
1818 if (v[0] < 0 && vEff[0] >= 0) {
1819 // in this case, supplement the positive entries in vEff with their negative analogues
1820 std::vector<double> vtmp(vEff);
1821 for (std::vector<double>::iterator it = vtmp.begin(); it != vtmp.end(); ++it)
1822 if (*it > 0) vEff.insert(vEff.begin(), -(*it));
1823 } else if (v[0] >= 0 && vEff[0] < 0) {
1824 // in this case, supplement the positive entries in v with their negative analogues
1825 std::vector<double> vtmp(v);
1826 for (std::vector<double>::iterator it = vtmp.begin(); it != vtmp.end(); ++it)
1827 if (*it > 0) v.insert(v.begin(), -(*it));
1828 }
1829 }
1830
1831 // Now that the individual sets of boundaries have been determined, merge these
1832 for (unsigned int t = 0; t < vars.size(); ++t) {
1833 if (effBoundaries.find(vars[t]) == effBoundaries.end())
1834 // Variables not present in the efficiency object can go in unmodified
1835 mergedBoundaries[vars[t]] = boundaries[vars[t]];
1836 else {
1837 // Merge the boundaries for variables existing in both objects.
1838 // Take the MC array as a starting point, as it's likely to be the longest.
1839 mergedBoundaries[vars[t]] = effBoundaries[vars[t]];
1840
1841 for (std::vector<double>::iterator it = boundaries[vars[t]].begin(); it != boundaries[vars[t]].end(); ++it) {
1842 std::vector<double>::iterator itcmp = mergedBoundaries[vars[t]].begin();
1843 // Iterate until we've found a value in the target array equal to
1844 // or larger than the given element
1845 while (itcmp != mergedBoundaries[vars[t]].end() &&
1846 (! CalibrationDataContainer::isNearlyEqual(*itcmp, *it)) &&
1847 *itcmp < *it) ++itcmp;
1848 // Nothing needs to be done if the values are "nearly identical"
1849 // (or if we don't find such an element).
1850 if (itcmp == mergedBoundaries[vars[t]].end() || CalibrationDataContainer::isNearlyEqual(*itcmp, *it)) continue;
1851 // Otherwise insert the given element (this can mean adding to the end)
1852 mergedBoundaries[vars[t]].insert(itcmp, *it);
1853 }
1854 }
1855 }
1856 // Variables not present in the scale factor object still need to go in
1857 for (unsigned int t = 0; t < effVars.size(); ++t)
1858 if (boundaries.find(effVars[t]) == boundaries.end())
1859 mergedBoundaries[effVars[t]] = effBoundaries[effVars[t]];
1860
1861 // Carry out a rudimentary cross-check of the tag weight bin
1862 // (the binning used for the scale factor and MC objects should be identical).
1863 if (boundaries.find(CalibrationDataContainer::kTagWeight) == boundaries.end()) {
1864 cerr << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: " << "no tag weight axis found for object " << nameFromIndex(indexSF) << endl;
1865 } else if (effBoundaries.find(CalibrationDataContainer::kTagWeight) == effBoundaries.end()) {
1866 cerr << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: " << "no tag weight axis found for object " << nameFromIndex(indexEff) << endl;
1867 } else if (boundaries[CalibrationDataContainer::kTagWeight].size() != effBoundaries[CalibrationDataContainer::kTagWeight].size()) {
1868 cerr << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: " << "different tag weight binning for objects " << nameFromIndex(indexSF) << " (";
1869 std::vector<double>& v = boundaries[CalibrationDataContainer::kTagWeight];
1870 for (unsigned int ib = 0; ib < v.size()-1; ++ib) cerr << v[ib] << ",";
1871 cerr << v[v.size()-1] << ") and " << nameFromIndex(indexEff) << " (";
1872 v = effBoundaries[CalibrationDataContainer::kTagWeight];
1873 for (unsigned int ib = 0; ib < v.size()-1; ++ib) cerr << v[ib] << ",";
1874 cerr << v[v.size()-1] << ") do not match!" << endl;
1875 } else {
1876 // Make sure that (possibly) dummy vectors exist for _all_ known variables
1877 // (this is a mere technicality allowing to loop over all variables explicitly).
1878 mergedBoundaries.try_emplace(CalibrationDataContainer::kPt, std::vector<double>{20.,300.});
1879 mergedBoundaries.try_emplace(CalibrationDataContainer::kEta, std::vector<double>{-2.5, 2.5});
1880
1881 // Finally, carry out the cross-check that all this is about: recompute the scale factor
1882 // in each pseudo-bin
1883 if (m_verbose){
1884 cout << "CalibrationDataInterfaceROOT::checkWeightScaleFactors: cross-checking scale factors for objects " << nameFromIndex(indexSF) << " and " << nameFromIndex(indexEff) << "\n" << std::setfill('-') << std::setw(100) << "-" << endl;
1885 cout << std::setfill(' ');
1886 }
1887 CalibrationDataVariables x;
1888 std::vector<double>& vPt = mergedBoundaries[CalibrationDataContainer::kPt], vEta = mergedBoundaries[CalibrationDataContainer::kEta], vTagWeight = mergedBoundaries[CalibrationDataContainer::kTagWeight];
1889 for (unsigned int ipt = 0; ipt < vPt.size()-1; ++ipt) {
1890 x.jetPt = (vPt[ipt] + vPt[ipt+1]) * 500.; // account for MeV -> GeV conversion
1891 for (unsigned int ieta = 0; ieta < vEta.size()-1; ++ieta) {
1892 x.jetEta = (vEta[ieta] + vEta[ieta+1]) / 2.;
1893 for (unsigned int iwt = 0; iwt < vTagWeight.size()-1; ++iwt) {
1894 x.jetTagWeight = (vTagWeight[iwt] + vTagWeight[iwt+1]) / 2.;
1895 // Retrieve the central scale factor value and the old and new MC tag weight fractions
1896 double value;
1897 container->getResult(x, value);
1898 Analysis::UncertaintyResult uncertaintyResult(0,0);
1899 container->getUncertainty("MCreference", x, uncertaintyResult);
1900 double fracMCref = uncertaintyResult.first;
1901 double fracMCnew;
1902 effContainer->getResult(x, fracMCnew);
1903 // Compute the new scale factor value
1904 if (!(fracMCnew > 0.)) {
1905 cout << "\tfor (pt=" << x.jetPt << ",eta=" << x.jetEta << ",tagweight=" << x.jetTagWeight << "): invalid new MC fraction: " << fracMCnew << endl;
1906 } else {
1907 double newvalue = 1.0 + (value - 1.0) * fracMCref/fracMCnew;
1908 if (newvalue <= 0 || newvalue > m_maxTagWeight) cout << "\tfor (pt=" << x.jetPt << ",eta=" << x.jetEta << ",tagweight=" << x.jetTagWeight << "): old (value=" << value << ",MC=" << fracMCref << "), new (value=" << newvalue << ",MC=" << fracMCnew << ")" << endl;
1909 }
1910 }
1911 }
1912 }
1913 }
1914
1915 m_checkedWeightScaleFactors.push_back(std::make_pair(indexSF, indexEff));
1916}
#define x
static bool isNearlyEqual(double a, double b)
utility for comparison of doubles
virtual CalibrationStatus getUncertainty(const std::string &unc, const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
retrieve the calibration uncertainty due to the given source.
virtual std::vector< double > getBinBoundaries(unsigned int vartype)
Retrieve the bin boundaries for the specified variable type (which should be a CalibrationParametriza...
virtual CalibrationStatus getResult(const CalibrationDataVariables &x, double &result, TObject *obj=0, bool extrapolate=false)
retrieve the calibration result.
std::pair< double, double > UncertaintyResult
The following typedef is for convenience: most uncertainties can be asymmetric.

◆ combinedUncertainty()

double Analysis::CalibrationDataInterfaceBase::combinedUncertainty ( double stat,
const std::pair< double, double > & syst ) const
protectedinherited

utility function for combination of statistical and (a priori asymmetric) systematic uncertainty.

NB perhaps this should be in its own

Definition at line 147 of file CalibrationDataInterfaceBase.cxx.

149{
150 // Return the total (combined statistical and systematic) uncertainty started from
151 // its individual components. The result is symmetrised by using only the larger of
152 // the (a priori asymmetric) up- and downward systematic uncertainties.
153
154 // The systematic uncertainty is (a priori) asymmetric, but this interface doesn't
155 // at present allow for asymmetric uncertainties.
156 // Address this by taking the larger (absolute) value of the two.
157 double largest = syst.first;
158 if (TMath::Abs(syst.second) > TMath::Abs(largest)) largest = syst.second;
159
160 return TMath::Sqrt(stat*stat + largest*largest);
161}

◆ EffCalibrationName()

const std::string & Analysis::CalibrationDataInterfaceBase::EffCalibrationName ( const std::string & flavour,
unsigned int mapIndex = 0 ) const
inherited

Main interface methods accessing the flavour tagging performance information.

Note that for both of the following, the label is assumed to adhere to the TruthInfo conventions (see package PhysicsAnalysis/JetTagging/JetTagInfo).

Definition at line 47 of file CalibrationDataInterfaceBase.cxx.

49{
50 // Return the MC efficiency name for the given flavour.
51 // Note that no check is performed on the validity of the flavour.
52
53 try {
54 return m_calibrationEffNames.at(flavour)[mapIndex];
55 }
56 catch (const std::out_of_range& e) {
57 std::cerr << "EffCalibrationName: flavour '" << flavour << "' is not known." << std::endl;
58 throw e;
59 }
60}
std::map< std::string, std::vector< std::string > > m_calibrationEffNames
this simply collects the per-flavour properties.

◆ fullName()

string Analysis::CalibrationDataInterfaceROOT::fullName ( const std::string & author,
const std::string & OP,
const std::string & label,
bool isSF,
unsigned mapIndex = 0 ) const

@ brief construct the full object pathname from its individual components

Definition at line 2725 of file CalibrationDataInterfaceROOT.cxx.

2728{
2729 // Construct the full calibration object's pathname within the calibration ROOT file.
2730 //
2731 // author: jet collection name
2732 // OP: tagger working point
2733 // label: jet flavour label
2734 // isSF: set to true (false) for scale factors (MC efficiencies)
2735 // mapIndex: index in the list of MC efficiency calibration objects
2736
2737 string flavour = (label == "N/A") ? "Light" : label;
2738 string full(m_taggerName + "/" + getAlias(author) + "/" + OP + "/" + flavour + "/");
2739 full += getContainername(flavour, isSF, mapIndex);
2740 // full += getAlias(author); full += "/";
2741 // string name = (isSF) ?
2742 // getBasename(OP, label, "_SF", true) :
2743 // getBasename(OP, label, "_Eff", false, mapIndex);
2744 // full += name;
2745 return full;
2746}
std::string getContainername(const std::string &flavour, bool SF, unsigned int mapIndex=0) const
auxiliary function for string concatenation
std::string getAlias(const std::string &author) const
associated alias retrieval method
std::string label(const std::string &format, int i)
Definition label.h:19

◆ getAlias()

string Analysis::CalibrationDataInterfaceROOT::getAlias ( const std::string & author) const
private

associated alias retrieval method

Definition at line 2714 of file CalibrationDataInterfaceROOT.cxx.

2715{
2716 // Return the alias for the given jet collection name, if an alias exists.
2717 // If this is not the case, the return value will simply equal the input jet collection name.
2718
2719 std::map<string,string>::const_iterator it = m_aliases.find(author);
2720 return (it == m_aliases.end()) ? author : it->second;
2721}

◆ getBasename()

std::string Analysis::CalibrationDataInterfaceBase::getBasename ( const std::string & name) const
protectedinherited

auxiliary function for retrieval of name within the directory

Definition at line 138 of file CalibrationDataInterfaceBase.cxx.

139{
140 // Retrieve the name within the directory starting from the full name
141
142 return name.substr(name.find_last_of('/')+1, std::string::npos);
143}

◆ getBinnedScaleFactors()

const TH1 * Analysis::CalibrationDataInterfaceROOT::getBinnedScaleFactors ( const std::string & author,
const std::string & label,
const std::string & OP )

retrieve the binned calibration object for the given flavour label and operating point.

A null result will be returned in case of error (e.g. if the calibration object isn't binned to begin with).

Definition at line 2109 of file CalibrationDataInterfaceROOT.cxx.

2112{
2113 // Retrieve the actual histogrammed calibration scale factors, identifying the object by name.
2114 //
2115 // author: jet collection name
2116 // label: jet flavour label
2117 // OP: tagger working point
2118
2119 unsigned int index;
2120 if (! retrieveCalibrationIndex (label, OP, author, true, index)) {
2121 // Return a dummy result if the object is not found
2122 cerr << "getBinnedScaleFactors: unable to find SF calibration for object " << fullName(author, OP, label, true) << endl;
2123 return 0;
2124 }
2125 CalibrationDataHistogramContainer* container = dynamic_cast<CalibrationDataHistogramContainer*>(m_objects[index]);
2126 return (container) ? dynamic_cast<TH1*>(container->GetValue("result")) : 0;
2127}
bool retrieveCalibrationIndex(const std::string &label, const std::string &OP, const std::string &author, bool isSF, unsigned int &index, unsigned int mapIndex=0)
Retrieve the index of the calibration object (container) starting from the label and operating point.
std::string fullName(const std::string &author, const std::string &OP, const std::string &label, bool isSF, unsigned mapIndex=0) const
@ brief construct the full object pathname from its individual components

◆ getContainername()

std::string Analysis::CalibrationDataInterfaceBase::getContainername ( const std::string & flavour,
bool SF,
unsigned int mapIndex = 0 ) const
protectedinherited

auxiliary function for string concatenation

auxiliary function for retrieval of container name

Definition at line 118 of file CalibrationDataInterfaceBase.cxx.

120{
121 // Construct the full pathname corresponding to the container indicated by the combination
122 // of tagging operating point, jet flavour, and a possible extra extension. The calibration
123 // container name (stored internally) is also attached.
124
125 const std::vector<std::string>& effNames = m_calibrationEffNames.at(flavour);
126 if (!SF && mapIndex >= effNames.size()) {
127 std::cerr << "getContainername: given mapIndex=" << mapIndex << " incompatible with array size "
128 << effNames.size() << "; resetting to 0" << std::endl;
129 mapIndex = 0;
130 }
131 std::string name = SF ? m_calibrationSFNames.at(flavour) : effNames[mapIndex];
132 name += SF ? "_SF" : "_Eff";
133
134 return name;
135}
std::map< std::string, std::string > m_calibrationSFNames
const float SF[NF]
Cross sections for Fluor.

◆ getEfficiency() [1/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getEfficiency ( const CalibrationDataVariables & variables,
const std::string & label,
const std::string & OP,
Uncertainty unc,
const std::string & flavour,
unsigned int numVariation = 0,
unsigned int mapIndex = 0 )

efficiency retrieval by name

Definition at line 1075 of file CalibrationDataInterfaceROOT.cxx.

1079{
1080 // Data efficiency retrieval identifying the requested calibration objects by name.
1081 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor.
1082 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
1083 // above, and will be a dummy value in case an error occurs.
1084 //
1085 // variables: object holding kinematic (and other) information needed to compute the result
1086 // label: jet flavour label
1087 // OP: tagger operating point
1088 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1089 // named variations are to be computed)
1090 // numVariation: variation index (in case of eigenvector or named variations)
1091 // mapIndex: index to the efficiency map to be used
1092
1093 unsigned int indexSF, indexEff;
1094 if (! (retrieveCalibrationIndex (label, OP, variables.jetAuthor, false, indexEff, mapIndex) &&
1095 retrieveCalibrationIndex (label, OP, variables.jetAuthor, true, indexSF))) {
1096 cerr << "getEfficiency: unable to find Eff calibration for object " << fullName(variables.jetAuthor, OP, label, false, mapIndex) << " or SF calibration for object " << fullName(variables.jetAuthor, OP, label, true) << endl;
1097 // Return a dummy result if the object is not found
1098 return Analysis::dummyResult;
1099 }
1100
1102 return (getEfficiency(variables, indexSF, indexEff, unc, numVariation, result, flavour) == Analysis::kError) ? Analysis::dummyResult : result;
1103}
CalibResult getEfficiency(const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, const std::string &flavour, unsigned int numVariation=0, unsigned int mapIndex=0)
efficiency retrieval by name
const CalibResult dummyResult(dummyValue, dummyValue)
std::pair< double, double > CalibResult

◆ getEfficiency() [2/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getEfficiency ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
const std::string & flavour,
unsigned int numVariation = 0 )

efficiency retrieval by index

Definition at line 1107 of file CalibrationDataInterfaceROOT.cxx.

1110{
1111 // Data efficiency retrieval identifying the requested calibration objects by index.
1112 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor.
1113 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
1114 // above, and will be a dummy value in case an error occurs.
1115 //
1116 // variables: object holding kinematic (and other) information needed to compute the result
1117 // indexSF: index to scale factor calibration object
1118 // indexEff: index to MC efficiency object
1119 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1120 // named variations are to be computed)
1121 // numVariation: variation index (in case of eigenvector or named variations)
1122
1124 return (getEfficiency(variables, indexSF, indexEff, unc, numVariation, result, flavour) == Analysis::kError) ?
1126}

◆ getEfficiency() [3/3]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::getEfficiency ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
unsigned int numVariation,
Analysis::CalibResult & result,
const std::string & flavour )

efficiency retrieval by index

Definition at line 1130 of file CalibrationDataInterfaceROOT.cxx.

1134{
1135 // Data efficiency retrieval identifying the requested calibration objects by index.
1136 //
1137 // variables: object holding kinematic (and other) information needed to compute the result
1138 // indexSF: index to scale factor calibration object
1139 // indexEff: index to MC efficiency object
1140 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1141 // named variations are to be computed)
1142 // numVariation: variation index (in case of eigenvector or named variations)
1143 // result: (value, uncertainty) or (up, down) variation pair, depending on the unc value.
1144 // A dummy value will be returned in case of an error.
1145
1146 Analysis::CalibResult sfResult;
1147 Analysis::CalibrationStatus sfStatus = getScaleFactor(variables, indexSF, indexEff, unc, numVariation, sfResult, flavour);
1148 if (sfStatus == Analysis::kError) return sfStatus;
1149 Analysis::CalibResult effResult;
1150 Analysis::CalibrationStatus effStatus= getMCEfficiency(variables, indexEff, unc, effResult);
1151 if (effStatus == Analysis::kError) return effStatus;
1152
1153 double relative = 0;
1154 double value = effResult.first;
1155 if (TMath::Abs(sfResult.first) > Analysis::CalibZERO) {
1156 value = std::min(effResult.first*sfResult.first, 1.);
1157
1158 // Treat the scale factor variation cases separately since the contents of the CalibResult are different
1159 // (e.g. 'value' above contains the upward variation)
1160 if (unc == SFEigen || unc == SFNamed) {
1161 double valueDown = effResult.first*sfResult.second;
1162 result.first = value; // up/down variataions of data-efficiency
1163 result.second = valueDown;
1164 return sfStatus;
1165 }
1166 if (value > 0.) {
1167 relative = effResult.second/effResult.first;
1168 double sfRelative = sfResult.second/sfResult.first;
1169 /*
1170 cout << "sferr=" << sfResult.second
1171 << "btag Calib relative=" << relative << " sfRelative=" << sfRelative << endl;
1172 */
1173 relative = TMath::Sqrt(sfRelative*sfRelative + relative*relative);
1174 }
1175 } else {
1176 // now never happens due to protection of SF return value:
1177 cerr << "ERROR: CalibrationDataInterfaceROOT::getEfficiency: SF null result, SF=" << sfResult.first << " MC eff=" << effResult.first << "; setting SF=1." << endl;
1178 relative = Analysis::dummyValue;
1179 }
1180
1181 result.first = value;
1182 result.second = value*relative;
1183 // "Select" the status code for the actual calibration (it is subject to more constraints)
1184 return sfStatus;
1185}
CalibResult getScaleFactor(const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
efficiency scale factor retrieval by name.
CalibResult getMCEfficiency(const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc=None, unsigned int mapIndex=0)
"MC" efficiency retrieval by name

◆ getEigenVectorRecompositionCoefficientMap()

std::map< std::string, std::map< std::string, float > > Analysis::CalibrationDataInterfaceROOT::getEigenVectorRecompositionCoefficientMap ( )

Get Eigenvector recomposition map after running runEigenVectorRecomposition()

Definition at line 2268 of file CalibrationDataInterfaceROOT.cxx.

2268 {
2269 if(m_coefficientMap.empty())
2270 cerr << "getCoefficientMap: Call runEigenVectorRecomposition() before retrieving coefficient map! " <<endl;
2271 return m_coefficientMap;
2272}
std::map< std::string, std::map< std::string, float > > m_coefficientMap

◆ getInefficiency() [1/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getInefficiency ( const CalibrationDataVariables & variables,
const std::string & label,
const std::string & OP,
Uncertainty unc,
unsigned int numVariation = 0,
unsigned int mapIndex = 0 )

inefficiency retrieval by name

Definition at line 1311 of file CalibrationDataInterfaceROOT.cxx.

1315{
1316 // Data inefficiency retrieval identifying the requested calibration objects by name.
1317 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor;
1318 // the inefficiency is then computed as the 1 minus the efficiency.
1319 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
1320 // above, and will be a dummy value in case an error occurs.
1321 //
1322 // variables: object holding kinematic (and other) information needed to compute the result
1323 // label: jet flavour label
1324 // OP: tagger operating point
1325 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1326 // named variations are to be computed)
1327 // numVariation: variation index (in case of eigenvector or named variations)
1328 // mapIndex: index to the efficiency map to be used
1329
1330 unsigned int indexSF, indexEff;
1331 if (! (retrieveCalibrationIndex (label, OP, variables.jetAuthor, false, indexEff, mapIndex) &&
1332 retrieveCalibrationIndex (label, OP, variables.jetAuthor, true, indexSF))) {
1333 cerr << "getInefficiency: unable to find Eff calibration for object "
1334 << fullName(variables.jetAuthor, OP, label, false, mapIndex)
1335 << " or SF calibration for object "
1336 << fullName(variables.jetAuthor, OP, label, true) << endl;
1337 // Return a dummy result if the object is not found
1338 return Analysis::dummyResult;
1339 }
1340
1342 return (getInefficiency(variables, indexSF, indexEff, unc, numVariation, result, label) == Analysis::kError) ?
1344}
CalibResult getInefficiency(const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
inefficiency retrieval by name

◆ getInefficiency() [2/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getInefficiency ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
const std::string & flavour,
unsigned int numVariation = 0 )

inefficiency retrieval by index

Definition at line 1348 of file CalibrationDataInterfaceROOT.cxx.

1351{
1352 // Data inefficiency retrieval identifying the requested calibration objects by index.
1353 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor;
1354 // the inefficiency is then computed as the 1 minus the efficiency.
1355 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
1356 // above, and will be a dummy value in case an error occurs.
1357 //
1358 // variables: object holding kinematic (and other) information needed to compute the result
1359 // indexSF: index to scale factor calibration object
1360 // indexEff: index to MC efficiency object
1361 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1362 // named variations are to be computed)
1363 // numVariation: variation index (in case of eigenvector or named variations)
1364
1366 return (getInefficiency(variables, indexSF, indexEff, unc, numVariation, result, flavour) == Analysis::kError) ?
1368}

◆ getInefficiency() [3/3]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::getInefficiency ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
unsigned int numVariation,
Analysis::CalibResult & result,
const std::string & flavour )

inefficiency retrieval by index

Definition at line 1372 of file CalibrationDataInterfaceROOT.cxx.

1376{
1377 // Data inefficiency retrieval identifying the requested calibration objects by index.
1378 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor;
1379 // the inefficiency is then computed as the 1 minus the efficiency.
1380 //
1381 // variables: object holding kinematic (and other) information needed to compute the result
1382 // indexSF: index to scale factor calibration object
1383 // indexEff: index to MC efficiency object
1384 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1385 // named variations are to be computed)
1386 // numVariation: variation index (in case of eigenvector or named variations)
1387 // result: (value, uncertainty) or (up, down) variation pair, depending on the unc value.
1388 // A dummy value will be returned in case of an error.
1389
1390 Analysis::CalibResult sfResult;
1391 Analysis::CalibrationStatus sfStatus = getScaleFactor(variables, indexSF, indexEff, unc, numVariation, sfResult, flavour);
1392 if (sfStatus == Analysis::kError) return sfStatus;
1393 Analysis::CalibResult effResult;
1394 Analysis::CalibrationStatus effStatus= getMCEfficiency(variables, indexEff, unc, effResult);
1395 if (effStatus == Analysis::kError) return effStatus;
1396
1397 double val = std::max(0., 1. - effResult.first * sfResult.first);
1398 double err = 0.; // Analysis::dummyValue;
1399
1400 // Bail out here if not both results are strictly positive
1401 if (effResult.first <= 0. || sfResult.first <= 0.) return Analysis::kError;
1402
1403 // Treat the scale factor variation cases separately since the contents of the CalibResult are different
1404 // (e.g. 'val' above contains the upward variation)
1405 if (unc == SFEigen || unc == SFNamed) {
1406 double valDown = std::max(0., 1. - effResult.first*sfResult.second);
1407
1408 result.first = val;
1409 result.second = valDown;
1410 } else {
1411 // safer than pow(x, 2):
1412 err = effResult.second/effResult.first*effResult.second/effResult.first
1413 + sfResult.second/sfResult.first*sfResult.second/sfResult.first;
1414 err = val*TMath::Sqrt(err);
1415
1416 result.first = std::max(0., std::min(1., val));
1417 result.second = err;
1418 }
1419
1420 // "Select" the status code for the actual calibration (it is subject to more constraints)
1421 return sfStatus;
1422}

◆ getInefficiencyScaleFactor() [1/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getInefficiencyScaleFactor ( const CalibrationDataVariables & variables,
const std::string & label,
const std::string & OP,
Uncertainty unc,
unsigned int numVariation = 0,
unsigned int mapIndex = 0 )

"MC" inefficiency scale factor retrieval by name

Definition at line 1190 of file CalibrationDataInterfaceROOT.cxx.

1194{
1195 // Inefficiency scale factor retrieval identifying the requested calibration objects by name.
1196 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor;
1197 // the inefficiency scale factor is then computed as the ratio of data to MC inefficiencies.
1198 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
1199 // above, and will be a dummy value in case an error occurs.
1200 //
1201 // variables: object holding kinematic (and other) information needed to compute the result
1202 // label: jet flavour label
1203 // OP: tagger operating point
1204 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1205 // named variations are to be computed)
1206 // numVariation: variation index (in case of eigenvector or named variations)
1207 // mapIndex: index to the efficiency map to be used
1208
1209 unsigned int indexSF, indexEff;
1210 if (! (retrieveCalibrationIndex (label, OP, variables.jetAuthor, false, indexEff, mapIndex) &&
1211 retrieveCalibrationIndex (label, OP, variables.jetAuthor, true, indexSF))) {
1212 cerr << "getInefficiencyScaleFactor: unable to find Eff calibration for object "
1213 << fullName(variables.jetAuthor, OP, label, false, mapIndex)
1214 << " or SF calibration for object "
1215 << fullName(variables.jetAuthor, OP, label, true) << endl;
1216 // Return a dummy result if the object is not found
1217 return Analysis::dummyResult;
1218 }
1219
1221 return (getInefficiencyScaleFactor(variables, indexSF, indexEff, unc, numVariation, result, label) == Analysis::kError) ?
1223}
CalibResult getInefficiencyScaleFactor(const CalibrationDataVariables &variables, const std::string &label, const std::string &OP, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
"MC" inefficiency scale factor retrieval by name

◆ getInefficiencyScaleFactor() [2/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getInefficiencyScaleFactor ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
const std::string & flavour,
unsigned int numVariation = 0 )

"MC" inefficiency scale factor retrieval by index

Definition at line 1227 of file CalibrationDataInterfaceROOT.cxx.

1230{
1231 // Inefficiency scale factor retrieval identifying the requested calibration objects by index.
1232 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor;
1233 // the inefficiency scale factor is then computed as the ratio of data to MC inefficiencies.
1234 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
1235 // above, and will be a dummy value in case an error occurs.
1236 //
1237 // variables: object holding kinematic (and other) information needed to compute the result
1238 // indexSF: index to scale factor calibration object
1239 // indexEff: index to MC efficiency object
1240 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1241 // named variations are to be computed)
1242 // numVariation: variation index (in case of eigenvector or named variations)
1243
1245 return (getInefficiencyScaleFactor(variables, indexSF, indexEff, unc, numVariation, result, flavour) == Analysis::kError) ?
1247}

◆ getInefficiencyScaleFactor() [3/3]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::getInefficiencyScaleFactor ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
unsigned int numVariation,
Analysis::CalibResult & result,
const std::string & flavour )

"MC" inefficiency scale factor retrieval by index

Definition at line 1251 of file CalibrationDataInterfaceROOT.cxx.

1255{
1256 // Inefficiency scale factor retrieval identifying the requested calibration objects by index.
1257 // The data efficiency is computed as the product of MC efficiency and data/MC efficiency scale factor;
1258 // the inefficiency scale factor is then computed as the ratio of data to MC inefficiencies.
1259 //
1260 // variables: object holding kinematic (and other) information needed to compute the result
1261 // indexSF: index to scale factor calibration object
1262 // indexEff: index to MC efficiency object
1263 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1264 // named variations are to be computed)
1265 // numVariation: variation index (in case of eigenvector or named variations)
1266 // result: (value, uncertainty) or (up, down) variation pair, depending on the unc value.
1267 // A dummy value will be returned in case of an error.
1268
1269 Analysis::CalibResult sfResult;
1270 Analysis::CalibrationStatus sfStatus = getScaleFactor(variables, indexSF, indexEff, unc, numVariation, sfResult, flavour);
1271 if (sfStatus == Analysis::kError) return sfStatus;
1272 Analysis::CalibResult effResult;
1273 Analysis::CalibrationStatus effStatus= getMCEfficiency(variables, indexEff, unc, effResult);
1274 if (effStatus == Analysis::kError) return effStatus;
1275
1276 double eff = std::min(effResult.first, 1.);
1277 // double efferr = effResult.second; // not needed as (per the code change indicated below) we are not doing anything with MC statistical uncertainties
1278 double sf = sfResult.first;
1279 double sferr = sfResult.second;
1280
1281 double val = 0.; // Analysis::dummyValue;
1282 double err = 0.; // Analysis::dummyValue;
1283 if (1. - eff > CalibZERO) {
1284 // Protect against negative scale factors
1285 val = std::max((1. - eff*sf), CalibZERO) / (1. - eff);
1286 // Treat the scale factor variation cases separately since the contents of the CalibResult are different
1287 // ('sf' and 'sferr' above contain the upward and downward variations, respectively).
1288 if (unc == SFEigen || unc == SFNamed) {
1289 double valDown = std::max((1. - eff*sferr), CalibZERO) / (1. - eff);
1290 result.first = val;
1291 result.second = valDown;
1292 return sfStatus;
1293 }
1294 // When using eigenvector (or named) variations (as above), only scale factor variations are considered.
1295 // For the sake of consistency, it has been decided (see https://its.cern.ch/jira/browse/AFT-350) to remove them also when EV variations aren't used
1296 //err = pow((1. - sf) / (1. - eff) * efferr, 2) + pow(eff*sferr, 2);
1297 err = pow(eff*sferr, 2);
1298 if (err > 0.)
1299 err = 1./(1. - eff) * TMath::Sqrt(err);
1300 // cout << "btag Calib Ineff err=" << err << endl;
1301 }
1302
1303 result.first = std::max(CalibZERO, val);
1304 result.second = err;
1305 // "Select" the status code for the actual calibration (it is subject to more constraints)
1306 return sfStatus;
1307}
constexpr int pow(int x)
Definition conifer.h:27

◆ getMCEfficiency() [1/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getMCEfficiency ( const CalibrationDataVariables & variables,
const std::string & label,
const std::string & OP,
Uncertainty unc = None,
unsigned int mapIndex = 0 )

"MC" efficiency retrieval by name

Definition at line 967 of file CalibrationDataInterfaceROOT.cxx.

970{
971 // MC efficiency retrieval identifying the requested calibration object by name.
972 // The return value is a (value, uncertainty) pair, as documented above, and will
973 // be a dummy value in case an error occurs.
974 //
975 // variables: object holding kinematic (and other) information needed to compute the result
976 // label: jet flavour label
977 // OP: tagger operating point
978 // unc: keyword indicating what uncertainties to evaluate
979 // mapIndex: index to the efficiency map to be used
980
981 unsigned int index;
982 if (! retrieveCalibrationIndex (label, OP, variables.jetAuthor, false, index, mapIndex)) {
983 cerr << "getMCEfficiency: unable to find Eff calibration for object " << fullName(variables.jetAuthor, OP, label, false, mapIndex) << endl;
984 // Return a dummy result if the object is not found
986 }
987
989 return (getMCEfficiency(variables, index, unc, result) == Analysis::kError) ?
991}

◆ getMCEfficiency() [2/3]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::getMCEfficiency ( const CalibrationDataVariables & variables,
unsigned int index,
Uncertainty unc,
Analysis::CalibResult & result )

"MC" efficiency retrieval by index

Definition at line 1013 of file CalibrationDataInterfaceROOT.cxx.

1016{
1017 // MC efficiency retrieval identifying the requested calibration object by index.
1018 //
1019 // variables: object holding kinematic (and other) information needed to compute the result
1020 // index: index to calibration object
1021 // unc: keyword indicating what uncertainties to evaluate
1022 // result: (value, uncertainty) variation pair.
1023 // A dummy value will be returned in case of an error.
1024
1025 CalibrationDataContainer* container = m_objects[index];
1026 if (! container) return Analysis::kError;
1027
1028 // perform out-of-bound check of jet eta
1029 if (!checkAbsEta(variables, index)) {
1030 if (m_verbose)
1031 cerr << "Jet |eta| is outside of the boundary!" << endl;
1032 return Analysis::kRange;
1033 }
1034
1035
1036 // always retrieve the result itself
1037 double value;
1038 Analysis::CalibrationStatus status = container->getResult(variables, value);
1039 if (status == Analysis::kError) return status;
1040 if (m_otherStrategy == GiveUp)
1041 assert (status != Analysis::kRange); // no need to test also statDown
1042 else if (m_otherStrategy == Flag)
1043 if (status == Analysis::kRange)
1044 this->increaseCounter(index);
1045
1046 // retrieve the statistical uncertainty if desired
1047 double stat(0);
1048 if (unc == Total || unc == Statistical) {
1049 if (container->getStatUncertainty(variables, stat) == Analysis::kError) {
1050 cerr << "getMCEfficiency: error retrieving MC efficiency parameter covariance matrix!" << endl;
1051 return Analysis::kError;
1052 }
1053 }
1054
1055 // Temporary(?) hack: comment this out since the present MC results don't have "systematics" contributions
1056 // Analysis::UncertaintyResult resSyst(0,0);
1057 // if (unc == Total || unc == Systematic) {
1058 // if (container->getSystUncertainty(variables, resSyst) == Analysis::kError)
1059 // cerr << "getScaleFactor: error retrieving Scale factor parameter covariance matrix!"
1060 // << endl;
1061 // }
1062
1063 // since there is no combination of stat/syst uncertainties to be made, comment this out too
1064 double uncertainty = stat; // combinedUncertainty(stat, resSyst);
1065 result.first = std::max(0., std::min(1., value));
1066 result.second = uncertainty;
1067
1068 return status;
1069}
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.
bool checkAbsEta(const CalibrationDataVariables &variables, unsigned int index)
status
Definition merge.py:16

◆ getMCEfficiency() [3/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getMCEfficiency ( const CalibrationDataVariables & variables,
unsigned int index,
Uncertainty unc = None )

"MC" efficiency retrieval by index

Definition at line 995 of file CalibrationDataInterfaceROOT.cxx.

997{
998 // MC efficiency retrieval identifying the requested calibration object by index.
999 // The return value is a (value, uncertainty) pair, as documented above, and will
1000 // be a dummy value in case an error occurs.
1001 //
1002 // variables: object holding kinematic (and other) information needed to compute the result
1003 // index: index to calibration object
1004 // unc: keyword indicating what uncertainties to evaluate
1005
1007 return (getMCEfficiency(variables, index, unc, result) == Analysis::kError) ?
1009}

◆ getMCEfficiencyObject()

const TObject * Analysis::CalibrationDataInterfaceROOT::getMCEfficiencyObject ( const std::string & author,
const std::string & label,
const std::string & OP,
unsigned int mapIndex = 0 )

retrieve the MC efficiency (central values) object for the given flavour label and operating point.

A null result will be returned in case of error (e.g. if the calibration object isn't binned to begin with). It is the user's responsibility to verify whether the object derives from a TH1 or a TF1.

Definition at line 2131 of file CalibrationDataInterfaceROOT.cxx.

2135{
2136 // Retrieve the actual central values object for the MC efficiences, identifying the object by name.
2137 // The object returned can be either a TH1 or a TF1; it is up to the user to determine which.
2138 //
2139 // author: jet collection name
2140 // label: jet flavour label
2141 // OP: tagger working point
2142 // mapIndex: index to the efficiency map to be used
2143
2144 unsigned int index;
2145 if (! retrieveCalibrationIndex (label, OP, author, false, index, mapIndex)) {
2146 // Return a dummy result if the object is not found
2147 cerr << "getMCEfficiencyObject: unable to find efficiency calibration for object "
2148 << fullName(author, OP, label, false, mapIndex) << endl;
2149 return 0;
2150 }
2151 CalibrationDataContainer* container = m_objects[index];
2152 return (container) ? container->GetValue("result") : 0;
2153}

◆ getMCInefficiency() [1/2]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getMCInefficiency ( const CalibrationDataVariables & variables,
const std::string & label,
const std::string & OP,
Uncertainty unc = None,
unsigned int mapIndex = 0 )

"MC" inefficiency retrieval by name

Definition at line 1426 of file CalibrationDataInterfaceROOT.cxx.

1429{
1430 // Data inefficiency retrieval identifying the requested calibration objects by name.
1431 // The inefficiency is computed as the 1 minus the efficiency.
1432 // The return value is a (value, uncertainty), as documented above, and will be a dummy value
1433 // in case an error occurs.
1434 //
1435 // variables: object holding kinematic (and other) information needed to compute the result
1436 // label: jet flavour label
1437 // OP: tagger operating point
1438 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1439 // named variations are to be computed)
1440 // numVariation: variation index (in case of eigenvector or named variations)
1441 // mapIndex: index to the efficiency map to be used
1442
1443 Analysis::CalibResult effResult = getMCEfficiency(variables, label, OP, unc, mapIndex);
1444 return std::make_pair(std::max(0., 1. - effResult.first), effResult.second);
1445}

◆ getMCInefficiency() [2/2]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getMCInefficiency ( const CalibrationDataVariables & variables,
unsigned int index,
Uncertainty unc = None )

"MC" inefficiency retrieval by index

Definition at line 1449 of file CalibrationDataInterfaceROOT.cxx.

1451{
1452 // MC inefficiency retrieval identifying the requested calibration object by index.
1453 // The inefficiency is computed as the 1 minus the efficiency.
1454 // The return value is a (value, uncertainty), as documented above, and will be a dummy value
1455 // in case an error occurs.
1456 //
1457 // variables: object holding kinematic (and other) information needed to compute the result
1458 // index: index to MC efficiency object
1459 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1460 // named variations are to be computed)
1461 // numVariation: variation index (in case of eigenvector or named variations)
1462
1463 Analysis::CalibResult effResult = getMCEfficiency(variables, index, unc);
1464 return std::make_pair(std::max(0., 1. - effResult.first), effResult.second);
1465}

◆ getMCMCScaleFactor()

double Analysis::CalibrationDataInterfaceROOT::getMCMCScaleFactor ( const CalibrationDataVariables & variables,
unsigned indexSF,
unsigned int indexEff ) const

MC/MC scale factor retrieval.

Normally this is to be used only internally; however, since this information may be of interest it is made public anyway.

Definition at line 1469 of file CalibrationDataInterfaceROOT.cxx.

1471{
1472 // Retrieve the MC/MC scale factor given the set of scale factor and efficiency indices.
1473 // variables: object holding kinematic (and other) information needed to compute the result
1474 // indexSF: index to scale factor calibration object
1475 // indexEff: index to MC efficiency object
1476
1477 // If either reference doesn't exist, or if they are the same, nothing can / needs to be done.
1478 int indexSFRef = m_hadronisationReference[indexSF], indexEffRef = m_hadronisationReference[indexEff];
1479 if (indexSFRef < 0 || indexEffRef < 0 || indexSFRef == indexEffRef) return 1;
1480
1481 // Verify also that the individual efficiencies are physically meaningful.
1482 double effSFRef; m_objects[indexSFRef]->getResult(variables, effSFRef);
1483 double effEffRef; m_objects[indexEffRef]->getResult(variables, effEffRef);
1484 return (effSFRef > 0 && effEffRef > 0) ? effSFRef/effEffRef : 1;
1485}

◆ getNumVariations() [1/2]

unsigned int Analysis::CalibrationDataInterfaceROOT::getNumVariations ( const std::string & author,
const std::string & label,
const std::string & OP,
Uncertainty unc )

retrieve the number of variations relevant to the calibration object.

The Uncertainty enum is used to specify the category.

Definition at line 2064 of file CalibrationDataInterfaceROOT.cxx.

2068{
2069 // Retrieve the number of eigenvector variations or named variations relevant for
2070 // the given scale factor calibration object, identifying the object by name.
2071 //
2072 // author: jet collection name
2073 // label: jet flavour label
2074 // OP: tagger working point
2075 // unc: should be set to SFEigen or SFNamed for the cases of
2076 // eigenvector variations or named variations, respectively
2077
2078 unsigned int index;
2079
2080 if (! retrieveCalibrationIndex (label, OP, author, true, index)) return 0;
2081 return getNumVariations(index, unc, label);
2082}
unsigned int getNumVariations(const std::string &author, const std::string &label, const std::string &OP, Uncertainty unc)
retrieve the number of variations relevant to the calibration object.

◆ getNumVariations() [2/2]

unsigned int Analysis::CalibrationDataInterfaceROOT::getNumVariations ( unsigned int index,
Uncertainty unc,
const std::string & flavour )

retrieve the number of variations relevant to the calibration object.

The Uncertainty enum is used to specify the category.

Definition at line 2086 of file CalibrationDataInterfaceROOT.cxx.

2088{
2089 // Retrieve the number of eigenvector variations or named variations relevant for
2090 // the given scale factor calibration object, identifying the object by index.
2091 //
2092 // index: index to calibration scale factor object
2093 // unc: should be set to SFEigen or SFNamed for the cases of
2094 // eigenvector variations or named variations, respectively
2095
2096 if (! (unc == SFEigen || unc == SFNamed || unc == SFGlobalEigen)) return 0;
2097 CalibrationDataContainer* container = m_objects[index];
2098 if (! container) return 0;
2099 std::shared_ptr<CalibrationDataEigenVariations> eigenVariation=m_eigenVariationsMap.at(container);
2100 if (unc == SFGlobalEigen){
2101 std::shared_ptr<CalibrationDataGlobalEigenVariations> GEV = std::dynamic_pointer_cast<CalibrationDataGlobalEigenVariations>(eigenVariation);
2102 return GEV->getNumberOfEigenVariations(flavour);
2103 }
2104 return (unc == SFEigen) ? eigenVariation->getNumberOfEigenVariations() : eigenVariation->getNumberOfNamedVariations();
2105}
#define GEV

◆ getScaleFactor() [1/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getScaleFactor ( const CalibrationDataVariables & variables,
const std::string & label,
const std::string & OP,
Uncertainty unc,
unsigned int numVariation = 0,
unsigned int mapIndex = 0 )

efficiency scale factor retrieval by name.

#1

Definition at line 736 of file CalibrationDataInterfaceROOT.cxx.

740{
741 // Scale factor retrieval identifying the requested calibration object by name.
742 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
743 // above, and will be a dummy value in case an error occurs.
744 //
745 // variables: object holding kinematic (and other) information needed to compute the result
746 // label: jet flavour label
747 // OP: tagger operating point
748 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
749 // named variations are to be computed)
750 // numVariation: variation index (in case of eigenvector or named variations)
751 // mapIndex: index to the efficiency map to be used (this is needed for MC/MC scale factor
752 // application)
753 unsigned int indexEff, indexSF;
754 if (! (retrieveCalibrationIndex (label, OP, variables.jetAuthor, false, indexEff, mapIndex) && retrieveCalibrationIndex (label, OP, variables.jetAuthor, true, indexSF))) {
755 cerr << "getScaleFactor: unable to find SF calibration for object " << fullName(variables.jetAuthor, OP, label, false, mapIndex) << " or SF calibration for object " << fullName(variables.jetAuthor, OP, label, true) << endl;
756 // Return a dummy result if the object is not found
758 }
759
760 Analysis::CalibResult result; // the following is SF #3
761 return (getScaleFactor(variables, indexSF, indexEff, unc, numVariation, result, label) == Analysis::kError) ?
763}

◆ getScaleFactor() [2/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getScaleFactor ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
const std::string & flavour,
unsigned int numVariation = 0 )

efficiency scale factor retrieval by index #2

Definition at line 767 of file CalibrationDataInterfaceROOT.cxx.

770{
771 // Scale factor retrieval identifying the requested calibration object by index.
772 // The return value is either a (value, uncertainty) or an (up, down) variation pair, as documented
773 // above, and will be a dummy value in case an error occurs.
774 //
775 // variables: object holding kinematic (and other) information needed to compute the result
776 // indexSF: index to scale factor calibration object
777 // indexEff: index to MC efficiency object
778 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
779 // named variations are to be computed)
780 // numVariation: variation index (in case of eigenvector or named variations)
781 Analysis::CalibResult result; // the following is SF #3
782 return (getScaleFactor(variables, indexSF, indexEff, unc, numVariation, result, flavour) == Analysis::kError) ?
784}

◆ getScaleFactor() [3/3]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::getScaleFactor ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
unsigned int numVariation,
Analysis::CalibResult & result,
const std::string & flavour )

efficiency scale factor retrieval by index #3

Definition at line 788 of file CalibrationDataInterfaceROOT.cxx.

792{
793 // Scale factor retrieval identifying the requested calibration object by index.
794 //
795 // variables: object holding kinematic (and other) information needed to compute the result
796 // indexSF: index to scale factor calibration object
797 // indexEff: index to MC efficiency object
798 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
799 // named variations are to be computed)
800 // numVariation: variation index (in case of eigenvector or named variations)
801 // result: (value, uncertainty) or (up, down) variation pair, depending on the unc value.
802 // A dummy value will be returned in case of an error.
803
804 CalibrationDataContainer* container = m_objects[indexSF];
805 if (! container) {
806 cerr << "getScaleFactor: error retrieving container!" << endl;
807 return Analysis::kError;
808 }
809
810 // perform out-of-bound check of jet eta
811 if (!checkAbsEta(variables, indexSF)) {
812 if (m_verbose)
813 cerr << "Jet |eta| is outside of the boundary!" << endl;
814 return Analysis::kRange;
815 }
816
817 // retrieve the MC/MC scale factor
818 double MCMCSF = m_useMCMCSF ? getMCMCScaleFactor(variables, indexSF, indexEff) : 1; // if we don't want to switch generator, MCMCSF = 1, as it should be
819
820 if (!m_runEigenVectorMethod && (unc == SFEigen || unc == SFNamed || unc == SFGlobalEigen))
821 {
822 cerr << " ERROR. Trying to call eigenvector method but initialization not switched on in b-tagging configuration." << endl;
823 cerr << " Please correct your configuration first. Nominal uncertainties used. " << endl;
824 }
825
826 // Procede with eigenvariations methods i.e. return the SF variations
827 if (unc == SFEigen || unc == SFNamed || unc==SFGlobalEigen) {
828 std::shared_ptr<CalibrationDataEigenVariations> eigenVariation;
829 try {
830 eigenVariation=m_eigenVariationsMap.at(container);
831 } catch (const std::out_of_range&) {
832 cerr << " Could not retrieve eigenvector variation, while it should have been there." << endl;
833 return Analysis::kError;
834 }
835 TH1* up=0;
836 TH1* down=0;
837 bool extrapolate = false; // store if the numVariation is the extrapolation named uncertainty index
838 if (unc == SFEigen || unc==SFNamed){
839 unsigned int maxVariations = (unc == SFEigen) ? eigenVariation->getNumberOfEigenVariations() : eigenVariation->getNumberOfNamedVariations();
840 if (numVariation > maxVariations-1) {
841 cerr << "Asked for " << ((unc == SFEigen) ? "eigenvariation" : "named variation") << " number: " << numVariation << " but overall number of available variations is: " << maxVariations << endl;
842 return Analysis::kError;
843 }
844 bool isOK = eigenVariation->getEigenvectorVariation(numVariation,up,down);
845 if (!isOK) {
846 cerr << "Eigenvector object is there but cannot retrieve up and down uncertainty histograms." << endl;
847 return Analysis::kError;
848 }
849 // the 'extrapolation' uncertainty (always a named one) needs a somewhat special treatment
850 extrapolate = (unc == SFNamed) ? eigenVariation->isExtrapolationVariation(numVariation) : false;
851
852 } else if (unc == SFGlobalEigen) {
853 std::shared_ptr<CalibrationDataGlobalEigenVariations> GEV = std::dynamic_pointer_cast<CalibrationDataGlobalEigenVariations>(eigenVariation); //dynamic_cast<std::shared_ptr<CalibrationDataGlobalEigenVariations> >(eigenVariation);
854 if (not GEV){
855 cerr << "Analysis::CalibrationDataInterfaceROOT::getScaleFactor: dynamic cast failed\n";
856 return Analysis::kError;
857 }
858 unsigned int maxVariations = GEV->getNumberOfEigenVariations(flavour); // <----- This gets the number of variations of the flavour
859 if (maxVariations == 0){
860 cerr << "Overall number of available variations is 0!" << endl;
861 return Analysis::kError;
862 }
863 if (numVariation > maxVariations-1) {
864 cerr << "Asked for global eigenvariation number: " << numVariation << " but overall number of available variations is: " << maxVariations << endl;
865 return Analysis::kError;
866 }
867 bool isOK = GEV->getEigenvectorVariation(flavour, numVariation,up,down);
868 if (!isOK) {
869 cerr << "Eigenvector object is there but cannot retrieve up and down uncertainty histograms." << endl;
870 return Analysis::kError;
871 }
872 // the 'extrapolation' uncertainty (always a named one) needs a somewhat special treatment
873 extrapolate = GEV->isExtrapolationVariation(numVariation, flavour);
874 } else {
875 std::cerr << "ERROR: you requested " << unc << " but that isn't in the set of (SFEigen, SFGlobalEigen, SFNamed) for eigenvariations. " << std::endl;
876 return Analysis::kError;
877 }
878
879 double valueUp;
880 double valueDown;
881 Analysis::CalibrationStatus statUp = container->getResult(variables, valueUp, up, extrapolate); // This is what actually retrieves results from the container
882 Analysis::CalibrationStatus statDown = container->getResult(variables, valueDown,down, extrapolate);
883
884 if (statUp == Analysis::kError || statDown == Analysis::kError)
885 return Analysis::kError;
886 if (m_otherStrategy == GiveUp)
887 assert (statUp != Analysis::kRange); // no need to test also statDown
889 assert (statUp != Analysis::kExtrapolatedRange); // no need to test also statDown
890 else if (m_otherStrategy == Flag) {
891 if (statUp == Analysis::kRange)
892 increaseCounter(indexSF);
893 else if (statUp == Analysis::kExtrapolatedRange)
895 }
896
897 result.first = MCMCSF*valueUp;
898 result.second = MCMCSF*valueDown;
899
900 // Prevent negative return values. Should the comparison be against a strict 0?
901 result.first = std::max(Analysis::CalibZERO, result.first);
902 result.second = std::max(Analysis::CalibZERO, result.second);
903
904 return statUp; // end of getScaleFactor if SFEigen, SFGlobalEigen, or SFNamed is set
905
906
907 } // The above returns the up/down varied scale factor
908 //Proceed with no-eigenvector result
909
910 // always retrieve the result itself
911 double value;
912 Analysis::CalibrationStatus status = container->getResult(variables, value);
913 if (status == Analysis::kError) {
914 cerr << "getScaleFactor: error retrieving result in non-EV context!" << endl;
915 return status;
916 }
917 if (m_otherStrategy == GiveUp){
918 assert (status != Analysis::kRange);
919 } else if (m_otherStrategy == GiveUpExtrapolated) {
920 assert (status != Analysis::kExtrapolatedRange);
921 } else if (m_otherStrategy == Flag) {
922 if (status == Analysis::kRange){
923 increaseCounter(indexSF);
924 } else if (status == Analysis::kExtrapolatedRange) {
926 }
927 }
928
929 // retrieve the statistical uncertainty if desired
930 double stat(0);
931 if (unc == Total || unc == Statistical) {
932 if (container->getStatUncertainty(variables, stat) == Analysis::kError) {
933 cerr << "getScaleFactor: error retrieving Scale factor parameter covariance matrix!" << endl;
934 return Analysis::kError;
935 }
936 }
937
938 Analysis::UncertaintyResult resSyst(0,0);
939 if (unc == Total || unc == Systematic) {
940 if (container->getSystUncertainty(variables, resSyst) == Analysis::kError) {
941 cerr << "getScaleFactor: error retrieving Scale factor parameter systematic uncertainty!" << endl;
942 return Analysis::kError;
943 }
944 } else if (unc == Extrapolation) {
945 // this uncertainty is special, since it is not normally to be combined into the overall systematic uncertainty
946 if (container->getUncertainty("extrapolation", variables, resSyst) == Analysis::kError)
947 cerr << "getScaleFactor: error retrieving Scale factor parameter extrapolation uncertainty!" << endl;
948 } else if (unc == TauExtrapolation) {
949 // also this uncertainty is special, since it it singles out an uncertainty relevant only for tau "jets",
950 // and some care has to be taken not to duplicate or omit uncertainties
951 if (container->getUncertainty("extrapolation from charm", variables, resSyst) == Analysis::kError)
952 cerr << "getScaleFactor: error retrieving Scale factor parameter extrapolation uncertainty!" << endl;
953 }
954
955 double uncertainty = combinedUncertainty(stat, resSyst);
956 result.first = MCMCSF*value;
957 result.second = MCMCSF*uncertainty;
958
959 // Prevent negative return values. Should the comparison be against a strict 0?
960 result.first = std::max(Analysis::CalibZERO, result.first);
961 return status;
962
963}
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.
CalibrationStatus getSystUncertainty(const CalibrationDataVariables &x, UncertaintyResult &result, TObject *obj=0)
retrieve the calibration total systematic uncertainty
double combinedUncertainty(double stat, const std::pair< double, double > &syst) const
utility function for combination of statistical and (a priori asymmetric) systematic uncertainty.
double getMCMCScaleFactor(const CalibrationDataVariables &variables, unsigned indexSF, unsigned int indexEff) const
MC/MC scale factor retrieval.
float extrapolate(const MuonLayerHough::Maximum &ref, const MuonLayerHough::Maximum &ex, bool doparabolic=false)

◆ getScaleFactorCovarianceMatrix()

TMatrixDSym Analysis::CalibrationDataInterfaceROOT::getScaleFactorCovarianceMatrix ( const std::string & author,
const std::string & label,
const std::string & OP,
const std::string & unc = "all" )

retrieve the named covariance matrix element corresponding to the binned calibration object.

The unc argument should correspond to a given source of statistical or systematic uncertainty, or "all" (in case the full covariance matrix is required) For 2D and 3D histograms, the bin numbering follows the "global" bin number as defined by class TH1.

Definition at line 2416 of file CalibrationDataInterfaceROOT.cxx.

2420{
2421 // Return the scale factor covariance matrix for the given calibration object.
2422 // This function is deprecated since its functionality is duplicated in the
2423 // CalibrationDataEigenVariations class.
2424 //
2425 // author: jet collection name
2426 // label: jet flavour label
2427 // OP: tagger working point
2428 // unc: source of uncertainty to consider
2429 // Catch issues with the specified input as early as possible
2430 TMatrixDSym dummy;
2431 if (unc == "comment" || unc == "result" || unc == "combined") return dummy;
2432
2433 unsigned int index;
2434 if (! retrieveCalibrationIndex (label, OP, author, true, index)) {
2435 // Return a dummy result if the object is not found
2436 cerr << "getScaleFactorCovarianceMatrix: unable to find SF calibration for object " << fullName(author, OP, label, true) << endl;
2437 return dummy;
2438 }
2439 CalibrationDataHistogramContainer* container = dynamic_cast<CalibrationDataHistogramContainer*>(m_objects[index]);
2440 if (!container) return dummy;
2441
2442 // retrieve the central calibration and its axes
2443 TH1* result = dynamic_cast<TH1*>(container->GetValue("result"));
2444 if (! result) return dummy;
2445 // "normal" case: single source of uncertainty
2446 if (unc != "all") {
2447 if (unc == "statistics") {
2448 return getStatCovarianceMatrix(result);
2449 } else {
2450 TH1* hunc = dynamic_cast<TH1*>(container->GetValue(unc.c_str()));
2451 if (! hunc) {
2452 cout << "getScaleFactorCovarianceMatrix: no uncertainty object found "
2453 << "corresponding to name " << unc << endl;
2454 return dummy;
2455 }
2456 return getSystCovarianceMatrix(result, hunc, container->isBinCorrelated(unc), unc, container->getTagWeightAxis());
2457 }
2458 }
2459
2460 // special case: complete covariance matrix. This is to be constructed
2461 // as the sum over all individual contributions.
2462 // First, treat the statistics separately (as above)
2463 TMatrixDSym cov = getStatCovarianceMatrix(result);
2464
2465 // Then loop through the list of (other) uncertainties
2466 std::vector<string> uncs = container->listUncertainties();
2467 for (unsigned int t = 0; t < uncs.size(); ++t) {
2468 if (uncs[t] == "comment" || uncs[t] == "result" || uncs[t] == "combined" ||
2469 uncs[t] == "statistics" || uncs[t]=="extrapolation" || uncs[t]=="MChadronisation" ||
2470 uncs[t]=="ReducedSets" || uncs[t]=="systematics") continue;
2471 TH1* hunc = dynamic_cast<TH1*>(container->GetValue(uncs[t].c_str()));
2472 if (not hunc) {
2473 std::cerr<<"Analysis::CalibrationDataInterfaceROOT::getScaleFactorCovarianceMatrix : dynamic cast failed\n";
2474 continue;
2475 }
2476 TMatrixDSym syst_cov = getSystCovarianceMatrix(result, hunc, container->isBinCorrelated(uncs[t]), uncs[t], container->getTagWeightAxis());
2477 cov += syst_cov;
2478 }
2479
2480 return cov;
2481}
virtual int getTagWeightAxis()
Test whether this calibration object is one for "continuous" calibration (this has some subtle conseq...
bool isBinCorrelated(const std::string &unc) const
Indicate whether the given uncertainty is correlated from bin to bin or not (note that this function ...

◆ getShiftedScaleFactors()

const TH1 * Analysis::CalibrationDataInterfaceROOT::getShiftedScaleFactors ( const std::string & author,
const std::string & label,
const std::string & OP,
const std::string & unc,
double sigmas )

retrieve the binned calibration object for the given flavour label and operating point, with the result shifted by the given number of standard deviations for the given systematic uncertainty.

A null result will be returned in case of error (e.g. if the calibration object isn't binned to begin with, or if the uncertainty asked for isn't fully correlated from bin to bin).

Definition at line 2159 of file CalibrationDataInterfaceROOT.cxx.

2164{
2165 // Retrieve the actual histogrammed calibration scale factors, identifying the object by name
2166 // and with the scale factors shifted by the uncertainties due to the given source of uncertainty
2167 // (where bin-to-bin correlations are accounted for, i.e., shifts may be either positive or negative).
2168 //
2169 // author: jet collection name
2170 // label: jet flavour label
2171 // OP: tagger working point
2172 // unc: source of uncertainty to consider
2173 // sigmas: number of standard deviations by which to shift the scale factor central values
2174
2175 // quick sanity check
2176 if (unc == "comment" || unc == "result" || unc == "combined" || unc == "statistics") return 0;
2177
2178 unsigned int index;
2179 if (! retrieveCalibrationIndex (label, OP, author, true, index)) {
2180 // Return a null result if the object is not found
2181 cerr << "getShiftedScaleFactors: unable to find SF calibration for object " << fullName(author, OP, label, true) << endl;
2182 return nullptr;
2183 }
2184 CalibrationDataHistogramContainer* container = dynamic_cast<CalibrationDataHistogramContainer*>(m_objects[index]);
2185 if (! container) return nullptr;
2186
2187 TH1* result = dynamic_cast<TH1*>(container->GetValue("result"));
2188 TH1* hunc = dynamic_cast<TH1*>(container->GetValue(unc.c_str()));
2189 // another sanity check...
2190 if ((! hunc) || (! result)) return nullptr;
2191 if (hunc->GetDimension() != result->GetDimension() || hunc->GetNbinsX() != result->GetNbinsX() ||
2192 hunc->GetNbinsX() != result->GetNbinsX() || hunc->GetNbinsX() != result->GetNbinsX())
2193 return nullptr;
2194 // also check that the uncertainty is to be treated as correlated from bin to bin
2195 // (for the variation is applied coherently, which isn't appropriate for uncertainties
2196 // that aren't correlated from bin to bin)
2197 if (! container->isBinCorrelated(unc)) return 0;
2198
2199 // if everything is consistent, the actual operation simply consists of adding histograms...
2200 std::string name(container->GetName()); name += "_"; name += unc; name += "_";
2201 TH1* shifted = dynamic_cast<TH1*>(result->Clone(name.c_str()));
2202 if (not shifted) return nullptr;
2203 shifted->Add(hunc, sigmas);
2204 return shifted;
2205}

◆ getWeightScaleFactor() [1/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getWeightScaleFactor ( const CalibrationDataVariables & variables,
const std::string & label,
Uncertainty unc,
unsigned int numVariation = 0,
unsigned int mapIndex = 0 )

efficiency scale factor retrieval by name

Definition at line 1489 of file CalibrationDataInterfaceROOT.cxx.

1492{
1493 // #1
1494 // Tag weight fraction scale factor retrieval identifying the requested calibration object by name.
1495 // The return value is either a (value, uncertainty) or (if eigenvector or named variations are specified)
1496 // an (up, down) variation pair, and will be a dummy value in case an error occurs.
1497 // Note that in contrast to the "regular" (non-continuous) case, the computation of the scale factor in
1498 // general needs the (selection- or even process-specific) MC tag weight fractions, in order to rescale
1499 // scale factors. This is used to ensure that the tag weight fractions (both in data and in MC) sum up to
1500 // unity for each given kinematic bin.
1501 //
1502 // variables: object holding kinematic (and other) information needed to compute the result
1503 // label: jet flavour label
1504 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1505 // named variations are to be computed)
1506 // numVariation: variation index (in case of eigenvector or named variations)
1507 // mapIndex: index to the MC efficiency map to be used for scale factor rescaling
1508
1509 static const string cont("Continuous");
1510
1511 unsigned int indexSF, indexEff;
1512 if (! (retrieveCalibrationIndex (label, cont, variables.jetAuthor, false, indexEff, mapIndex) &&
1513 retrieveCalibrationIndex (label, cont, variables.jetAuthor, true, indexSF))) {
1514 cerr << "getWeightScaleFactor: unable to find Eff calibration for object "
1515 << fullName(variables.jetAuthor, cont, label, false, mapIndex)
1516 << " or SF calibration for object "
1517 << fullName(variables.jetAuthor, cont, label, true) << endl;
1518 return Analysis::dummyResult;
1519 }
1520
1522 return (getWeightScaleFactor(variables, indexSF, indexEff, unc, numVariation, result) == Analysis::kError) ? Analysis::dummyResult : result;
1523}
CalibResult getWeightScaleFactor(const CalibrationDataVariables &variables, const std::string &label, Uncertainty unc, unsigned int numVariation=0, unsigned int mapIndex=0)
efficiency scale factor retrieval by name

◆ getWeightScaleFactor() [2/3]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::getWeightScaleFactor ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
unsigned int numVariation,
Analysis::CalibResult & result )

efficiency scale factor retrieval by index, with different signature

Definition at line 1554 of file CalibrationDataInterfaceROOT.cxx.

1558{
1559 // #3
1560 // Tag weight fraction scale factor retrieval identifying the requested calibration object by index.
1561 // Note that in contrast to the "regular" (non-continuous) case, the computation of the scale factor in
1562 // general needs the (selection- or even process-specific) MC tag weight fractions, in order to rescale
1563 // scale factors. This is used to ensure that the tag weight fractions (both in data and in MC) sum up to
1564 // unity for each given kinematic bin.
1565 //
1566 // variables: object holding kinematic (and other) information needed to compute the result
1567 // indexSF: index to calibration object
1568 // indexEff: index to MC tag weight
1569 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1570 // named variations are to be computed)
1571 // numVariation: variation index (in case of eigenvector or named variations)
1572 // result: (value, uncertainty) or (up, down) variation pair, depending on the unc value.
1573 // A dummy value will be returned in case of an error.
1574 CalibrationDataContainer* container = m_objects[indexSF];
1575 if (! container) return Analysis::kError;
1576 CalibrationDataContainer* effContainer = m_objects[indexEff];
1577 if (! effContainer) return Analysis::kError;
1578
1579 // the first time this combination of scale factor and "efficiency" objects is given, check on the
1580 // scale factors that will result from their combination (where the computations reproduce those
1581 // shown below)
1582 checkWeightScaleFactors(indexSF, indexEff);
1583
1584 // perform out-of-bound check of jet eta
1585 if (!checkAbsEta(variables, indexSF)) {
1586 if (m_verbose)
1587 cerr << "Jet |eta| is outside of the boundary!" << endl;
1588 return Analysis::kRange;
1589 }
1590
1591 // Always retrieve the result itself
1592 double value;
1593 Analysis::CalibrationStatus status = container->getResult(variables, value);
1594 if (status == Analysis::kError) return status;
1595 if (m_otherStrategy == GiveUp) assert (status != Analysis::kRange);
1596 else if (m_otherStrategy == GiveUpExtrapolated) assert (status != Analysis::kExtrapolatedRange);
1597 else if (m_otherStrategy == Flag) {
1598 if (status == Analysis::kRange)
1599 increaseCounter(indexSF);
1600 else if (status == Analysis::kExtrapolatedRange)
1601 increaseCounter(indexSF, Extrapolated);
1602 }
1603
1604 // Retrieve the reference MC tag weight fraction (corresponding to the calibration scale factors)
1605 Analysis::UncertaintyResult refMCResult(0,0);
1606 if (container->getUncertainty("MCreference", variables, refMCResult) == Analysis::kError)
1607 return Analysis::kError;
1608 double fracMCref = refMCResult.first;
1609 // Retrieve the MC reference information, if requested (the initialisation below is to make sure
1610 // that no exceptions in the code will be needed)
1611 double fracSFref = fracMCref, fracEffref = fracMCref;
1612 if (m_useMCMCSF) {
1613 int indexSFref = m_hadronisationReference[indexSF], indexEffref = m_hadronisationReference[indexEff];
1614 if (indexSFref < 0 || indexEffref < 0) {
1615 cerr << "getWeightScaleFactor: error: generator-specific corrections requested but necessary reference containers lacking " << endl;
1616 return Analysis::kError;
1617 } else {
1618 m_objects[indexSFref]->getResult(variables, fracSFref);
1619 m_objects[indexEffref]->getResult(variables, fracEffref);
1620 if (! (fracSFref > 0. && fracEffref > 0.)) {
1621 cerr << "getWeightScaleFactor: error: invalid reference tag weight fraction " <<fracSFref <<" " <<fracEffref << std::endl;
1622 return Analysis::kError;
1623 }
1624 }
1625 }
1626
1627 // Retrieve the MC tag weight fraction for the sample we need to reweight to
1628 double fracMCnew;
1629 Analysis::CalibrationStatus effStatus = effContainer->getResult(variables, fracMCnew);
1630 if (effStatus == Analysis::kError) return effStatus;
1631 if (m_otherStrategy == GiveUp) assert (effStatus != Analysis::kRange);
1632 else if (m_otherStrategy == Flag)
1633 if (effStatus == Analysis::kRange) increaseCounter(indexEff);
1634 // since we need to divide by this quantity, check that it is well-defined
1635 if (!(fracMCnew > 0.) and m_useTopologyRescaling) {// but we only care if using topology rescaling
1636 cerr << "getWeightScaleFactor: error: null fracMCnew would lead to invalid operation" << endl;
1637 return Analysis::kError;
1638 }
1639
1640 if (!m_runEigenVectorMethod && (unc == SFEigen || unc == SFNamed)) {
1641 cerr << "getWeightScaleFactor: ERROR. Trying to call eigenvector method but initialization not switched on in b-tagging .env config file." << endl;
1642 cerr << " Please correct your .env config file first. Nominal uncertainties used. " << endl;
1643 }
1644
1645 if (unc == SFEigen || unc == SFNamed) {
1646 std::shared_ptr<CalibrationDataEigenVariations> eigenVariation;
1647 try {
1648 eigenVariation = m_eigenVariationsMap.at(container);
1649 } catch (const std::out_of_range&) {
1650 cerr << "getWeightScaleFactor: could not retrieve eigenvector variation, while it should have been there." << endl;
1651 return Analysis::kError;
1652 }
1653 unsigned int maxVariations = (unc == SFEigen) ? eigenVariation->getNumberOfEigenVariations() : eigenVariation->getNumberOfNamedVariations();
1654 if (numVariation > maxVariations-1) {
1655 cerr << "getWeightScaleFactor: asked for " << ((unc == SFEigen) ? "eigenvariation" : "named variation") << " number: " << numVariation << " but overall number of available variations is: " << maxVariations << endl;
1656 return Analysis::kError;
1657 }
1658 TH1* up=0;
1659 TH1* down=0;
1660 bool isOK = (unc == SFEigen) ? eigenVariation->getEigenvectorVariation(numVariation,up,down) : eigenVariation->getNamedVariation(numVariation,up,down);
1661 if (!isOK) {
1662 cerr << "getWeightScaleFactor: Eigenvector object is there but cannot retrieve up and down uncertainty histograms." << endl;
1663 return Analysis::kError;
1664 }
1665 // the 'extrapolation' uncertainty (always a named one) needs a somewhat special treatment
1666 bool extrapolate = ( unc == SFNamed ) ? eigenVariation->isExtrapolationVariation(numVariation) : false;
1667
1668 double valueUp;
1669 double valueDown;
1670 Analysis::CalibrationStatus statusUp = container->getResult(variables, valueUp, up, extrapolate);
1671 Analysis::CalibrationStatus statusDown = container->getResult(variables, valueDown,down, extrapolate);
1672 if (statusUp == Analysis::kError || statusDown == Analysis::kError) return Analysis::kError;
1673
1674 // now carry out the rescaling. Protect against unphysical or suspiciously large scale factors
1675 double variationUp = valueUp - value;
1676 double variationDown = valueDown - value;
1677 // First step: from the calibration sample to its reference sample
1678 if (m_useTopologyRescaling) value = 1.0 + (value - 1.0) * (fracMCref / fracSFref);
1679 // Second step: from the calibration reference sample to the MC object's reference sample
1680 if (m_useMCMCSF) value *= (fracSFref / fracEffref);
1681 // Third step: from the MC object's reference sample to the MC sample itself
1682 if (m_useTopologyRescaling) value = 1.0 + (value - 1.0) * (fracEffref / fracMCnew);
1683 // Since all transformations of the scale factor itself are linear, the transformation of the variations is simpler.
1685 double f = (fracMCref / fracMCnew);
1686 variationUp *= f;
1687 variationDown *= f;
1688 } else if (m_useMCMCSF) {
1689 double f = (fracSFref / fracEffref);
1690 variationUp *= f;
1691 variationDown *= f;
1692 }
1693 valueUp = value + variationUp;
1694 valueDown = value + variationDown;
1695 if (valueUp < 0) {
1696 valueUp = 0; increaseCounter(indexSF, TagWeight);
1697 } else if (valueUp > m_maxTagWeight) {
1698 valueUp = m_maxTagWeight; increaseCounter(indexSF, TagWeight);
1699 }
1700 if (valueDown < 0) {
1701 valueDown = 0; increaseCounter(indexSF, TagWeight);
1702 } else if (valueDown > m_maxTagWeight) {
1703 valueDown = m_maxTagWeight; increaseCounter(indexSF, TagWeight);
1704 }
1705
1706 result.first = valueUp;
1707 result.second = valueDown;
1708 return statusUp;
1709 } //end eigenvector method
1710
1711 //Proceed with no-eigenvector result
1712
1713 // retrieve the statistical uncertainty if desired
1714 double stat(0);
1715 if (unc == Total || unc == Statistical) {
1716 if (container->getStatUncertainty(variables, stat) == Analysis::kError) {
1717 cerr << "getWeightScaleFactor: error retrieving Scale factor parameter covariance matrix!" << endl;
1718 return Analysis::kError;
1719 }
1720 }
1721 Analysis::UncertaintyResult uncertaintyResult(0,0);
1722 if (unc == Total || unc == Systematic) {
1723 if (container->getSystUncertainty(variables, uncertaintyResult) == Analysis::kError) {
1724 cerr << "getWeightScaleFactor: error retrieving Scale factor parameter systematic uncertainty!" << endl;
1725 return Analysis::kError;
1726 }
1727 } else if (unc == Extrapolation) {
1728 // this uncertainty is special, since it is not normally to be combined into the overall systematic uncertainty
1729 if (container->getUncertainty("extrapolation", variables, uncertaintyResult) == Analysis::kError)
1730 cerr << "getWeightScaleFactor: error retrieving Scale factor parameter extrapolation uncertainty!" << endl;
1731 } else if (unc == TauExtrapolation) {
1732 // also this uncertainty is special, since it it singles out an uncertainty relevant only for tau "jets",
1733 // and some care has to be taken not to duplicate or omit uncertainties
1734 if (container->getUncertainty("extrapolation from charm", variables, uncertaintyResult) == Analysis::kError)
1735 cerr << "getWeightScaleFactor: error retrieving Scale factor parameter extrapolation uncertainty!" << endl;
1736 }
1737
1738 double uncertainty = combinedUncertainty(stat, uncertaintyResult);
1739
1740 // Now carry out the rescaling. Again protect against unphysical or suspiciously large scale factors
1741 // First step: from the calibration sample to its reference sample
1742 if (m_useTopologyRescaling) value = 1.0 + (value - 1.0) * (fracMCref / fracSFref);
1743 // Second step: from the calibration reference sample to the MC object's reference sample
1744 if (m_useMCMCSF) value *= (fracSFref / fracEffref);
1745 // Third step: from the MC object's reference sample to the MC sample itself
1746 if (m_useTopologyRescaling) value = 1.0 + (value - 1.0) * (fracEffref / fracMCnew);
1747 if (value < 0) {
1748 value = 0; increaseCounter(indexSF, TagWeight);
1749 } else if (value > m_maxTagWeight) {
1751 }
1752 // Since all transformations of the scale factor itself are linear, the transformation of the uncertainty is simpler.
1754 uncertainty *= (fracMCref / fracMCnew);
1755 } else if (m_useMCMCSF) {
1756 uncertainty *= (fracSFref / fracEffref);
1757 }
1758
1759 result.first = std::max(0., value);
1760 result.second = uncertainty;
1761 // "Select" the status code for the actual calibration object (it is subject to more constraints)
1762 return status;
1763}
void checkWeightScaleFactors(unsigned int indexSF, unsigned int indexEff)

◆ getWeightScaleFactor() [3/3]

Analysis::CalibResult Analysis::CalibrationDataInterfaceROOT::getWeightScaleFactor ( const CalibrationDataVariables & variables,
unsigned int indexSF,
unsigned int indexEff,
Uncertainty unc,
unsigned int numVariation = 0 )

efficiency scale factor retrieval by index

Definition at line 1527 of file CalibrationDataInterfaceROOT.cxx.

1530{
1531 // #2
1532 // Tag weight fraction scale factor retrieval identifying the requested calibration object by index.
1533 // The return value is either a (value, uncertainty) or (if eigenvector or named variations are specified)
1534 // an (up, down) variation pair, and will be a dummy value in case an error occurs.
1535 // Note that in contrast to the "regular" (non-continuous) case, the computation of the scale factor in
1536 // general needs the (selection- or even process-specific) MC tag weight fractions, in order to rescale
1537 // scale factors. This is used to ensure that the tag weight fractions (both in data and in MC) sum up to
1538 // unity for each given kinematic bin.
1539 //
1540 // variables: object holding kinematic (and other) information needed to compute the result
1541 // indexSF: index to calibration object
1542 // indexEff: index to MC tag weight
1543 // unc: keyword indicating what uncertainties to evaluate (or whether eigenvector or
1544 // named variations are to be computed)
1545 // numVariation: variation index (in case of eigenvector or named variations)
1546
1548 return (getWeightScaleFactor(variables, indexSF, indexEff, unc, numVariation, result) == Analysis::kError) ?
1550}

◆ increaseCounter()

void Analysis::CalibrationDataInterfaceROOT::increaseCounter ( unsigned int index,
OutOfBoundsType oob = Main )
private

Definition at line 1960 of file CalibrationDataInterfaceROOT.cxx.

1962{
1963 // Internal method bumping the relevant counter out-of-bounds counter for the specified object.
1964 //
1965 // oob: further classification of out-of-bounds case
1966 // index: object index
1967
1968 // make sure the vectors are appropriately dimensioned
1969 if (index >= m_mainCounters.size()) {
1970 unsigned int minsize = (index == 0) ? 2 : 2*index;
1971 m_mainCounters.resize(minsize, 0);
1972 m_etaCounters.resize(minsize, 0);
1973 m_extrapolatedCounters.resize(minsize, 0);
1974 }
1975 switch (oob) {
1976 case Main:
1977 m_mainCounters[index]++; break;
1978 case Eta:
1979 m_etaCounters[index]++; break;
1980 case Extrapolated:
1981 default:
1983 }
1984}

◆ initialize()

void Analysis::CalibrationDataInterfaceROOT::initialize ( const std::string & jetauthor,
const std::string & OP,
Uncertainty unc )

initialization for PROOF usage

Definition at line 2485 of file CalibrationDataInterfaceROOT.cxx.

2486{
2487 // Preload objects necessary so that the input calibration file can be closed.
2488 // This functionality is only needed when using PROOF.
2489
2490 if((!m_fileEff)||(!m_fileSF)) {
2491 cerr << "initialize can only be called once per CalibrationDataInterfaceROOT object" << endl;
2492 return;
2493 } else {
2494 cout << "initializing BTagCalibrationDataInterfaceROOT for PROOF with jetAuthor = " << jetauthor << ", tagger = " << m_taggerName << ", operating point = " << OP << ", uncertainty = " << unc << endl;
2495 }
2496
2497 CalibrationDataVariables BTagVars;
2498 BTagVars.jetAuthor = jetauthor;
2499 BTagVars.jetPt = 100000.; //Irrelevant, just has to be valid to retrieve objects
2500 BTagVars.jetEta = 1.5; //Irrelevant, just has to be valid to retrieve objects
2501
2502 for(const auto& flavour : m_flavours){
2503 std::pair<double, double> BTagCalibResult;
2504 BTagCalibResult = getScaleFactor(BTagVars, flavour, OP, unc);
2505 std::cout << "CalibrationDataInterfaceROOT->initialize : BTagCalibResult " << std::endl;
2506
2507 std::pair<double, double> BTagCalibMCEff;
2508 BTagCalibMCEff = getMCEfficiency(BTagVars, flavour, OP, unc);
2509 std::cout << "CalibrationDataInterfaceROOT->initialize : BTagCalibMCEff " << std::endl;
2510 }
2511
2512 if (m_fileEff != m_fileSF) {
2513 m_fileEff->Close();
2514 delete m_fileEff;
2515 }
2516 m_fileSF->Close();
2517 delete m_fileSF;
2518 m_fileEff = 0; //prevents repeat deletion in destructor
2519 m_fileSF = 0; //prevents repeat deletion in destructor
2520}

◆ listScaleFactorUncertainties() [1/2]

std::vector< string > Analysis::CalibrationDataInterfaceROOT::listScaleFactorUncertainties ( const std::string & author,
const std::string & label,
const std::string & OP,
bool named = false )

retrieve the list of "uncertainties" relevant to the calibration object.

A few uncertainty names are predetermined: "result", "comment", "statistics", "systematics". Other sources of systematic uncertainty may be added. Note that the "systematics" source does not give access to correlations between bins. If the 'named' argument is true, the list does not include all uncertainties but only those excluded from the eigenvector construction (this option is only relevant if eigenvector use has been switched on to begin with). In this case the order of the uncertainties listed is important since it indicates the index by which the given named uncertainty is identified.

Definition at line 1988 of file CalibrationDataInterfaceROOT.cxx.

1992{
1993 // Retrieve the sources of uncertainty relevant for the given scale factor calibration object,
1994 // identifying the object by name.
1995 //
1996 // author: jet collection name
1997 // label: jet flavour label
1998 // OP: tagger working point
1999 // named: if false, an unsorted list of sources of uncertainties will be returned.
2000 // if true, only 'named' uncertainties will be returned, and the position in
2001 // the vector that is the return value determines the 'numVariation' index
2002 // that is to be used if named variations are to be retrieved.
2003
2004 unsigned int index;
2005 if (! retrieveCalibrationIndex (label, OP, author, true, index)) {
2006 // Return a dummy result if the object is not found
2007 cerr << "listScaleFactorUncertainties: unable to find SF calibration for object " << fullName(author, OP, label, true) << endl;
2008 std::vector<string> dummy;
2009 return dummy;
2010 }
2011 return listScaleFactorUncertainties(index, label, named);
2012}
std::vector< std::string > listScaleFactorUncertainties(const std::string &author, const std::string &label, const std::string &OP, bool named=false)
retrieve the list of "uncertainties" relevant to the calibration object.

◆ listScaleFactorUncertainties() [2/2]

std::vector< string > Analysis::CalibrationDataInterfaceROOT::listScaleFactorUncertainties ( unsigned int index,
const std::string & flavour,
bool named = false )

retrieve the list of "uncertainties" relevant to the calibration object.

A few uncertainty names are predetermined: "result", "comment", "statistics", "systematics". Other sources of systematic uncertainty may be added. Note that the "systematics" source does not give access to correlations between bins. If the 'named' argument is true, the list does not include all uncertainties but only those excluded from the eigenvector construction (this option is only relevant if eigenvector use has been switched on to begin with). In this case the order of the uncertainties listed is important since it indicates the index by which the given named uncertainty is identified.

Definition at line 2016 of file CalibrationDataInterfaceROOT.cxx.

2018{
2019 // Note: this method already works on a per-flavour basis, so passing flavour in is a simple addition
2020 // Method is called primarily from within the BTaggingEfficiencyTool - W.L.
2021 // Retrieve the sources of uncertainty relevant for the given scale factor calibration object,
2022 // identifying the object by index.
2023 //
2024 // index: index to scale factor calibration object
2025 // named: if false, an unsorted list of sources of uncertainties will be returned.
2026 // if true, only 'named' uncertainties will be returned, and the position in
2027 // the vector that is the return value determines the 'numVariation' index
2028 // that is to be used if named variations are to be retrieved.
2029
2030 std::vector<string> dummy;
2031 CalibrationDataContainer* container = m_objects[index];
2032
2033 if (container) {
2034 if (named) {
2035 // Find out which uncertainties are excluded from eigenvector construction
2036 if (! m_runEigenVectorMethod) return dummy;
2037 std::shared_ptr<CalibrationDataEigenVariations> eigenVariation=m_eigenVariationsMap.at(container);
2038 if (m_EVStrategy == Analysis::Uncertainty::SFEigen){
2039 std::vector<string> unordered = eigenVariation->listNamedVariations(); // this is for the regular EV
2040 std::vector<string> ordered(unordered.size());
2041 for (unsigned int i = 0; i < unordered.size(); ++i) {
2042 ordered[eigenVariation->getNamedVariationIndex(unordered[i])] = unordered[i];
2043 }
2044 return ordered;
2045 } else if (m_EVStrategy == Analysis::Uncertainty::SFGlobalEigen){
2046 // here we want to get the named uncertainties from the global eigenvariations flavour container specifically...
2047 std::shared_ptr<CalibrationDataGlobalEigenVariations> GEV = std::dynamic_pointer_cast<CalibrationDataGlobalEigenVariations>(eigenVariation);
2048 std::vector<std::string> unordered = GEV->listNamedVariations(flavour);
2049 std::vector<std::string> ordered(unordered.size()); // ordered by the NAMED VARIATION (internal) ORDERING
2050 for (unsigned int i = 0; i < unordered.size(); ++i) {
2051 ordered[GEV->getNamedVariationIndex(unordered[i], flavour)] = unordered[i];
2052 }
2053 return ordered;
2054 }
2055 }
2056 return container->listUncertainties(); // return this if not named
2057 }
2058
2059 return dummy;
2060}
std::vector< std::string > listUncertainties() const
retrieve the list of "uncertainties" accessible to this object.

◆ nameFromIndex()

std::string Analysis::CalibrationDataInterfaceROOT::nameFromIndex ( unsigned int index) const

Retrieve the name of the calibration object (container) given its index.

Definition at line 1946 of file CalibrationDataInterfaceROOT.cxx.

1947{
1948 // Return the object name corresponding to the given index.
1949
1950 for (std::map<std::string, unsigned int>::const_iterator it = m_objectIndices.begin();
1951 it != m_objectIndices.end(); ++it)
1952 if (it->second == index) return it->first;
1953
1954 // This should never happen..
1955 return string("");
1956}

◆ retrieveCalibrationIndex()

bool Analysis::CalibrationDataInterfaceROOT::retrieveCalibrationIndex ( const std::string & label,
const std::string & OP,
const std::string & author,
bool isSF,
unsigned int & index,
unsigned int mapIndex = 0 )

Retrieve the index of the calibration object (container) starting from the label and operating point.

The return value will be false if the requested object cannot be found.

Definition at line 688 of file CalibrationDataInterfaceROOT.cxx.

693{
694 // Retrieve the integer index corresponding to a given combination of
695 // flavour label / tagger / working point / jet collection name, and separately
696 // for calibration scale factors and MC efficiencies (all these ingredients are needed
697 // to specify fully the calibration object).
698 // In fact this method will also trigger the retrieval of the object itself, if not already
699 // done, and will cache it internally. The absence of the requested calibration object will
700 // be flagged by a false return value.
701 // This method is used internally but should also be called by users in order to exploit the
702 // "code speed-up" features documented above.
703 //
704 // label: jet flavour label
705 // OP: tagger working point
706 // author: jet collection name
707 // isSF: set to true (false) for scale factors (MC efficiencies)
708 // index: resulting index (meaningful only for a 'true' function return value)
709 // mapIndex: index to the MC efficiency map to be used
710
711 index = 0;
712
713 // construct the full name from the label, operating point, SF/Eff choice;
714 // then look up this full name
715 string name = fullName(author, OP, label, isSF, mapIndex);
716 std::map<string, unsigned int>::const_iterator it = m_objectIndices.find(name);
717 if (it == m_objectIndices.end()) {
718 // If no container is found, attempt to retrieve it here (this is so that users won't
719 // have to call the named scale factor etc. methods once just to retrieve the container).
720 string flavour = (label == "N/A") ? "Light" : label;
721 string cntname = getContainername(flavour, isSF, mapIndex);
722 if (m_verbose) std::cout << "CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container name is " << cntname << std::endl;
723 retrieveContainer(flavour, OP, author, cntname, isSF, m_verbose); // Only call this if you want to retrieve a currently not available container
724 it = m_objectIndices.find(name);
725 if (it == m_objectIndices.end()) return false;
726 } else {
727 if (m_verbose) std::cout << "CalibrationDataInterfaceROOT->retrieveCalibrationIndex : container " << name << " already cached! " << std::endl;
728 }
729
730 index = it->second;
731 return true;
732}
CalibrationDataContainer * retrieveContainer(const std::string &label, const std::string &OP, const std::string &author, const std::string &cntname, bool isSF, bool doPrint=true)
utility function taking care of object retrieval

◆ retrieveContainer()

CalibrationDataContainer * Analysis::CalibrationDataInterfaceROOT::retrieveContainer ( const std::string & label,
const std::string & OP,
const std::string & author,
const std::string & cntname,
bool isSF,
bool doPrint = true )

utility function taking care of object retrieval

Definition at line 2524 of file CalibrationDataInterfaceROOT.cxx.

2525{
2526 // Attempt to retrieve the given container from file. Note that also the corresponding
2527 // "hadronisation" reference is retrieved (if possible and not yet done).
2528 //
2529 // dir: name of the directory containing the requested container
2530 // cntname: name of the requested container itself (not including the full path)
2531 // isSF: set to false (true) if the object is to be retrieved from the MC efficiencies
2532 // file (the calibration scale factor file). Note that it is assumed that scale
2533 // factor objects will always be retrieved from the calibration scale factor file.
2534 // doPrint: if true, print out some basic information about the successfully retrieved container
2535 // (note that this is typically steered by the m_verbose setting;
2536 // only for the retrieval of the maps used for MC/MC SF calculations, this printout is always switched off)
2537
2538 string dir = m_taggerName + "/" + getAlias(author) + "/" + OP + "/" + label;
2539 // construct the full object name
2540 string name = dir + "/" + cntname;
2541
2542 // If the object cannot be found, then each call will result in a new attempt to
2543 // retrieve the object from the ROOT file. Hopefully this will not happen too often...
2544 unsigned int idx = m_objectIndices[name] = m_objects.size();
2545 // CalibrationDataContainer* cnt =
2546 // dynamic_cast<CalibrationDataContainer*>((isSF ? m_fileSF : m_fileEff) ->Get(name.c_str()));
2547 CalibrationDataContainer* cnt;
2548 (isSF ? m_fileSF : m_fileEff)->GetObject(name.c_str(), cnt);
2549 // If the requested object is a MC efficiency container and is not found, make a second attempt
2550 // to retrieve it from the calibration scale factor file. This will avoid the need to duplicate
2551 // efficiency containers so that the MC efficiency file needs to store only those containers
2552 // not already present in the calibration scale factor file. Of course this is meaningful only
2553 // if separate files are used to begin with.
2554 if (!isSF && !cnt && m_fileSF != m_fileEff) m_fileSF->GetObject(name.c_str(), cnt);
2555 m_objects.push_back(cnt);
2556 if (!cnt) {
2557 cerr << "btag Calib: retrieveContainer: failed to retrieve container named " << name << " from file" << endl;
2558 return 0;
2559 }
2560
2561 // For successfully retrieved containers, also print some more information (implemented on user request)
2562 if (doPrint) {
2563 cout << "CalibrationDataInterface: retrieved container " << name << " (with comment: '" << cnt->getComment() << "' and hadronisation setting '" << cnt->getHadronisation() << "')" << endl;
2564 }
2565
2566
2567 // If the requested object is a MC efficiency container, make sure to retrieve the corresponding
2568 // calibration scale factor container first (a feature first thought to be necessary, erroneously,
2569 // but left in since this ordering should not hurt in any case).
2570 if (m_refMap.find(dir) == m_refMap.end()) {
2571 if (isSF) {
2572 // Retrieve the mapping objects from both files and merge their information using the 'helper' class.
2573 // The map resulting from this is used to retrieve the information required to compute MC/MC scale factors.
2574 string hadronisationRefs(dir + "/MChadronisation_ref");
2575 TMap* mapSF = 0; m_fileSF->GetObject(hadronisationRefs.c_str(), mapSF);
2576 TMap* mapEff = 0; if (m_fileEff != m_fileSF) m_fileEff->GetObject(hadronisationRefs.c_str(), mapEff);
2577 m_refMap[dir] = new HadronisationReferenceHelper(mapSF, mapEff);
2578 delete mapSF;
2579 delete mapEff;
2580 } else {
2581 string SFCalibName = getContainername(getBasename(dir), true);
2582 if (m_objectIndices.find(SFCalibName) == m_objectIndices.end()) retrieveContainer(label, OP, author, SFCalibName, true, doPrint);
2583 }
2584 }
2585
2586 // Attempt to find the corresponding hadronisation reference container needed for the application of
2587 // MC/MC scale factors.
2588 if (idx+1 > m_hadronisationReference.size()) m_hadronisationReference.resize(idx+1, -1);
2590 string spec = cnt->getHadronisation();
2591 if (spec != "") {
2592 std::map<string, HadronisationReferenceHelper*>::const_iterator mapit = m_refMap.find(dir);
2593 if (mapit != m_refMap.end()) {
2594 string ref;
2595 if (mapit->second->getReference(spec, ref)) {
2596 // Retrieve the hadronisation reference if not already done. Note that the "isSF" is left unchanged:
2597 // this allows to retrieve the reference from the same file as the scale factor object. An exception
2598 // is the reference for the calibration scale factor object, which should always be obtained from
2599 // the scale factor file.
2600 // An efficiency container can be its own hadronisation reference (this is not "protected" against).
2601 string refname(dir + "/" + ref);
2602 std::map<string, unsigned int>::const_iterator it = m_objectIndices.find(refname);
2603 // If the reference cannot be found, assume that it hasn't yet been retrieved so attempt it now.
2604 if (it == m_objectIndices.end()) {
2605 // Omit the printout of container information here (the idea being that showing MC/MC SF information would confuse rather than help)
2606 retrieveContainer(label, OP, author, ref, isSF, false);
2607 it = m_objectIndices.find(refname);
2608 }
2609 if (it != m_objectIndices.end()) {
2610 m_hadronisationReference[idx] = it->second;
2611 }
2612 }
2613 } else if (m_useMCMCSF) {
2614 cerr << "btag Calib: retrieveContainer: MC hadronisation reference map not found -- this should not happen!" << endl;
2615 }
2616 }
2618 // Not being able to construct the MC/MC scale factors will lead to a potential bias.
2619 // However, this is not considered sufficiently severe that we will flag it as an error.
2620 if (m_useMCMCSF){
2621 cerr << "btag Calib: retrieveContainer: warning: unable to apply MC/MC scale factors for container " << name << " with hadronisation reference = '" << spec << "'" << endl;
2622 }
2623 }
2624
2625 // Initialize the Eigenvector variation object corresponding to this object, if applicable. Notes:
2626 // - the dual use of "isSF" (both referring to the file and to the object, see above) requires another protection here
2627 // - the constructor's second argument is used to determine whether to exclude a pre-determined set of uncertainties from the EV decomposition
2628 //
2629 // We also want to separate behavior between SFEigen and SFGlobalEigen systematic strategies
2630 // The former requires a CalibrationDataEigenVariations object to be made per flavour.
2631 // The latter combines all corresponding flavours, so once it's been made for a single flavour, it's cached under all the corresponding "flavour containers"
2632 // simulataneously in m_eigenVariationsMap, and is checked for on each subsequent call to this method.
2633 if (m_runEigenVectorMethod && isSF && name.find("_SF") != string::npos) {
2634 CalibrationDataHistogramContainer* histoContainer=dynamic_cast<CalibrationDataHistogramContainer*>(cnt);
2635 if (histoContainer==0) {
2636 cerr << "Could not cast Container to a HistogramContainer. " << endl;
2637 return 0;
2638 }
2639 if (m_EVStrategy == Analysis::Uncertainty::SFEigen){
2641 std::shared_ptr<CalibrationDataEigenVariations> newEigenVariation(new CalibrationDataEigenVariations(m_filenameSF, m_taggerName, OP, author, histoContainer, m_useRecommendedEVExclusions));
2642 newEigenVariation->setVerbose(m_verbose);
2643
2644 // At this point we may also want to reduce the number of eigenvector variations.
2645 // The choices are stored with the container object; but first we need to know what flavour we are dealing with.
2646 string flavour = dir.substr(dir.find_last_of("/")+1);
2647
2648 for (const auto & entry : m_excludeFromCovMatrix[flavour]) {
2649 newEigenVariation->excludeNamedUncertainty(entry, cnt);
2650 }
2651 newEigenVariation->initialize();
2652 int to_retain = histoContainer->getEigenvectorReduction(m_EVReductions[flavour]); // returns the number of eigenvariations to retain as per the EV reduction strategy
2653 if (to_retain > -1) {
2654 if (m_verbose) cout << "btag Calib: reducing number of eigenvector variations for flavour " << flavour << " to " << to_retain << endl;
2655 // The merged variations will end up as the first entry in the specified list, i.e., as the last of the variations to be "retained"
2656 newEigenVariation->mergeVariationsFrom(size_t(to_retain-1)); // All variations stored with indices larger than this are merged
2657 } else if (m_EVReductions[flavour] != Loose) {
2658 cerr << "btag Calib: unable to retrieve eigenvector reduction information for flavour " << flavour << " and scheme " << m_EVReductions[flavour] << "; not applying any reduction" << endl;
2659 }
2660 m_eigenVariationsMap[cnt]=std::move(newEigenVariation);
2661
2663 } else if (m_EVStrategy == Analysis::Uncertainty::SFGlobalEigen) {
2665 std::map<const CalibrationDataContainer*, std::shared_ptr<CalibrationDataEigenVariations> >::iterator evit = m_eigenVariationsMap.find(cnt);
2666 // The global implementation internally combines all the "flavour containers" (containers that correspond to each other, only with different flavours)
2667 // But the CalibrationDataInterfaceROOT object doesn't need to know that, so we want to get all the flavour containers in one go here
2668 // and map them (with m_eigenVariationsMap) to the same CalibrationDataGlobalEigenVariations pointer.
2669 // Then, in methods like getScaleFactor, we call the virtual methods which will give the proper result e.g. if you want the SF for a b-jet, it'll call the
2670
2671 if (evit == m_eigenVariationsMap.end()){
2672 // now to see if it's completely empty or not
2673 if (m_eigenVariationsMap.empty()){
2674 std::shared_ptr<CalibrationDataGlobalEigenVariations> newEigenVariation(new CalibrationDataGlobalEigenVariations(m_filenameSF, m_taggerName, OP, author, m_flavours, histoContainer, m_useRecommendedEVExclusions));
2675 for (const auto & entry : m_excludeFromCovMatrix[label]) {
2676 newEigenVariation->excludeNamedUncertainty(entry, label); // <---- custom exclude named uncertainties method for global variations
2677 }
2678
2679 newEigenVariation->initialize();
2680
2681 // flavour loop to get the flavour reduction schemes and apply them
2682 for (std::string& flavour : m_flavours){
2683 int to_retain = histoContainer->getEigenvectorReduction(m_EVReductions[flavour]); // returns the number of eigenvariations to retain as per the EV reduction strategy
2684 if (to_retain > -1) {
2685 if (m_verbose) cout << "btag Calib: reducing number of eigenvector variations for flavour " << flavour << " to " << to_retain << endl;
2686 // The merged variations will end up as the first entry in the specified list, i.e., as the last of the variations to be "retained"
2687 newEigenVariation->mergeVariationsFrom(size_t(to_retain-1), flavour); // All variations stored with indices larger than this are merged
2688 } else if (m_EVReductions[flavour] != Loose) {
2689 cerr << "btag Calib: unable to retrieve eigenvector reduction information for flavour " << flavour << " and scheme " << m_EVReductions[flavour] << "; not applying any reduction" << endl;
2690 }
2691 }
2692
2693 m_eigenVariationsMap.insert({cnt, newEigenVariation});
2694 } else {
2695 // Need to point to the CDGEV object four times in the m_eigenVariationsMap to appease the CDIROOT backend design...
2696 // Ok, turns out I can't retrieve the containers from CDGEV and insert them directly, because I'd have to use the containers directly instead..
2697 // So the strategy is to just take the CGEV objects that are already in the map, and mpa the present container to it
2698 std::shared_ptr<CalibrationDataEigenVariations> previous_eigenvariation = m_eigenVariationsMap.begin()->second;
2699 m_eigenVariationsMap.insert({cnt, previous_eigenvariation});
2700 }
2701
2702 } else {
2703 std::cout << "CalibrationDataInterfaceROOT->retrieveContainer : the CDGEV object for " << name << " already exists! " << std::endl;
2704 }
2706 }
2707 }
2708
2709 return cnt;
2710}
const boost::regex ref(r_ef)
static const std::string hadronisationRefs("MChadronisation_ref")
std::string getBasename(const std::string &name) const
auxiliary function for retrieval of name within the directory
virtual int getEigenvectorReduction(unsigned int choice) const
Retrieve the number of eigenvectors to be retained for the purpose of eigenvector variation reduction...

◆ runEigenVectorRecomposition() [1/2]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::runEigenVectorRecomposition ( const std::string & author,
const std::string & label,
const std::string & OP,
unsigned int mapindex = 0 )

run EigenVector Recomposition method

Definition at line 2208 of file CalibrationDataInterfaceROOT.cxx.

2211 {
2212 // run eigen vector recomposition method. If success, stored the retrieved coefficient map
2213 // in m_coefficientMap and return success. Otherwise return error and keep m_coefficientMap
2214 // untouched.
2215 // author: jet collection name
2216 // label: jet flavour label
2217 // OP: tagger working point
2218 // mapIndex: index to the MC efficiency map to be used. Should be 0?
2219 // Todo: What is mapindex?
2220 // Todo: Check the way xAODBTaggingTool initialize CDI. Check if that is the as how we are initialize CDI.
2222 cerr << "runEigenVectorRecomposition: Recomposition need to be ran with CalibrationDataInterfaceRoot initialized in eigenvector mode" << endl;
2223 return Analysis::kError;
2224 }
2225
2226 unsigned int indexSF;
2227 if (! retrieveCalibrationIndex (label, OP, author, true, indexSF, mapIndex)) {
2228 cerr << "runEigenVectorRecomposition: unable to find SF calibration for object "
2229 << fullName(author, OP, label, true) << endl;
2230 return Analysis::kError;
2231 }
2232
2233 return runEigenVectorRecomposition (label, indexSF);
2234}
CalibrationStatus runEigenVectorRecomposition(const std::string &author, const std::string &label, const std::string &OP, unsigned int mapindex=0)
run EigenVector Recomposition method

◆ runEigenVectorRecomposition() [2/2]

Analysis::CalibrationStatus Analysis::CalibrationDataInterfaceROOT::runEigenVectorRecomposition ( const std::string & label,
unsigned int mapindex = 0 )

Definition at line 2237 of file CalibrationDataInterfaceROOT.cxx.

2238 {
2239 // run eigen vector recomposition method. If success, stored the retrieved coefficient map
2240 // in m_coefficientMap and return success. Otherwise return error and keep m_coefficientMap
2241 // untouched.
2242 // label: jet flavour label
2243 // indexSF: index to scale factor calibration object
2244 CalibrationDataContainer* container = m_objects[indexSF];
2245 if (! container) {
2246 cerr << "runEigenVectorRecomposition: error retrieving container!" << endl;
2247 return Analysis::kError;
2248 }
2249
2250 // Retrieve eigenvariation
2251 std::shared_ptr<CalibrationDataEigenVariations> eigenVariation;
2252 try {
2253 eigenVariation = m_eigenVariationsMap.at(container);
2254 } catch (const std::out_of_range&) {
2255 cerr << "runEigenVectorRecomposition: Could not retrieve eigenvector variation, while it should have been there." << endl;
2256 return Analysis::kError;
2257 }
2258 // Doing eigenvector recomposition
2259 std::map<std::string, std::map<std::string, float>> coefficientMap;
2260 if(!eigenVariation->EigenVectorRecomposition(label, coefficientMap))
2261 return Analysis::kError;
2262
2263 m_coefficientMap = std::move(coefficientMap);
2264 return Analysis::kSuccess;
2265}

◆ setEffCalibrationNames()

void Analysis::CalibrationDataInterfaceBase::setEffCalibrationNames ( const std::map< std::string, std::vector< std::string > > & names)
inherited

Definition at line 63 of file CalibrationDataInterfaceBase.cxx.

65{
66 // Set the MC efficiency names.
67
69}

◆ setSFCalibrationNames()

void Analysis::CalibrationDataInterfaceBase::setSFCalibrationNames ( const std::map< std::string, std::string > & names)
inherited

Definition at line 87 of file CalibrationDataInterfaceBase.cxx.

88{
89 // Set the efficiency scale factor calibration names.
90
92}

◆ SFCalibrationName()

const std::string & Analysis::CalibrationDataInterfaceBase::SFCalibrationName ( const std::string & flavour) const
inherited

Definition at line 72 of file CalibrationDataInterfaceBase.cxx.

73{
74 // Return the efficiency scale factor calibration name for the given flavour.
75 // Note that no check is performed on the validity of the flavour.
76
77 try {
78 return m_calibrationSFNames.at(flavour);
79 }
80 catch (const std::out_of_range& e) {
81 std::cerr << "SFCalibrationName: flavour '" << flavour << "' is not known." << std::endl;
82 throw e;
83 }
84}

Member Data Documentation

◆ m_absEtaStrategy

OutOfBoundsStrategy Analysis::CalibrationDataInterfaceROOT::m_absEtaStrategy {}
private

Definition at line 474 of file CalibrationDataInterfaceROOT.h.

474{};

◆ m_aliases

std::map<std::string, std::string> Analysis::CalibrationDataInterfaceROOT::m_aliases
private

Do not attempt to persistify (PROOF)

jet author aliases (there is no single CalibrationBroker object here to take care of this, so we do it in this class)

Definition at line 405 of file CalibrationDataInterfaceROOT.h.

◆ m_calibrationEffNames

std::map<std::string, std::vector<std::string> > Analysis::CalibrationDataInterfaceBase::m_calibrationEffNames
privateinherited

this simply collects the per-flavour properties.

Definition at line 72 of file CalibrationDataInterfaceBase.h.

◆ m_calibrationSFNames

std::map<std::string, std::string> Analysis::CalibrationDataInterfaceBase::m_calibrationSFNames
privateinherited

Definition at line 73 of file CalibrationDataInterfaceBase.h.

◆ m_checkedWeightScaleFactors

std::vector<std::pair<unsigned int, unsigned int> > Analysis::CalibrationDataInterfaceROOT::m_checkedWeightScaleFactors
private

Definition at line 488 of file CalibrationDataInterfaceROOT.h.

◆ m_coefficientMap

std::map<std::string, std::map<std::string, float> > Analysis::CalibrationDataInterfaceROOT::m_coefficientMap
private

Definition at line 466 of file CalibrationDataInterfaceROOT.h.

◆ m_eigenVariationsMap

std::map<const CalibrationDataContainer*, std::shared_ptr<CalibrationDataEigenVariations> > Analysis::CalibrationDataInterfaceROOT::m_eigenVariationsMap
private

store the eigenvector class and associate to its CalibrationDataContainer

Definition at line 426 of file CalibrationDataInterfaceROOT.h.

◆ m_etaCounters

std::vector<unsigned int> Analysis::CalibrationDataInterfaceROOT::m_etaCounters
private

counters for flagging out-of-bound cases

Definition at line 480 of file CalibrationDataInterfaceROOT.h.

◆ m_EVReductions

std::map<std::string, Analysis::EVReductionStrategy> Analysis::CalibrationDataInterfaceROOT::m_EVReductions
private

Eigenvector reduction strategy (per flavour)

Definition at line 433 of file CalibrationDataInterfaceROOT.h.

◆ m_EVStrategy

Uncertainty Analysis::CalibrationDataInterfaceROOT::m_EVStrategy {}
private

Definition at line 430 of file CalibrationDataInterfaceROOT.h.

430{}; // <--- In addition, specify whether to use the global eigenvariations method

◆ m_excludeFromCovMatrix

std::map<std::string, std::vector<std::string> > Analysis::CalibrationDataInterfaceROOT::m_excludeFromCovMatrix
private

store the uncertainties which should be excluded from building the full covariance matrix

Definition at line 436 of file CalibrationDataInterfaceROOT.h.

◆ m_extrapolatedCounters

std::vector<unsigned int> Analysis::CalibrationDataInterfaceROOT::m_extrapolatedCounters
private

Definition at line 482 of file CalibrationDataInterfaceROOT.h.

◆ m_fileEff

TFile* Analysis::CalibrationDataInterfaceROOT::m_fileEff {}
private

pointer to the TFile object providing access to the calibrations

Definition at line 400 of file CalibrationDataInterfaceROOT.h.

400{};

◆ m_filenameEff

std::string Analysis::CalibrationDataInterfaceROOT::m_filenameEff
private

Definition at line 418 of file CalibrationDataInterfaceROOT.h.

◆ m_filenameSF

std::string Analysis::CalibrationDataInterfaceROOT::m_filenameSF
private

in addition, store also the filenames themselves (needed for the copy constructor)

Definition at line 417 of file CalibrationDataInterfaceROOT.h.

◆ m_fileSF

TFile* Analysis::CalibrationDataInterfaceROOT::m_fileSF {}
private

Do not attempt to persistify (PROOF)

Definition at line 401 of file CalibrationDataInterfaceROOT.h.

401{};

◆ m_flavours

std::vector<std::string> Analysis::CalibrationDataInterfaceROOT::m_flavours
private

Definition at line 419 of file CalibrationDataInterfaceROOT.h.

◆ m_hadronisationReference

std::vector<int> Analysis::CalibrationDataInterfaceROOT::m_hadronisationReference
private

store the 'hadronisation' reference for each object (-1 means no reference found)

Definition at line 461 of file CalibrationDataInterfaceROOT.h.

◆ m_mainCounters

std::vector<unsigned int> Analysis::CalibrationDataInterfaceROOT::m_mainCounters
private

Definition at line 481 of file CalibrationDataInterfaceROOT.h.

◆ m_maxAbsEta

double Analysis::CalibrationDataInterfaceROOT::m_maxAbsEta {}
private

|eta| bounds and strategy for dealing with out-of-bounds conditions

Definition at line 473 of file CalibrationDataInterfaceROOT.h.

473{};

◆ m_maxTagWeight

double Analysis::CalibrationDataInterfaceROOT::m_maxTagWeight {}
private

Definition at line 489 of file CalibrationDataInterfaceROOT.h.

489{};

◆ m_objectIndices

std::map<std::string, unsigned int> Analysis::CalibrationDataInterfaceROOT::m_objectIndices
private

Definition at line 411 of file CalibrationDataInterfaceROOT.h.

◆ m_objects

std::vector<CalibrationDataContainer*> Analysis::CalibrationDataInterfaceROOT::m_objects
private

cache the objects themselves (so that the user will not have to delete them after each call etc.).

The caching is done so that objects can be retrieved by number as well as by (OP, flavour, calibration name) combination.

Definition at line 410 of file CalibrationDataInterfaceROOT.h.

◆ m_otherStrategy

OutOfBoundsStrategy Analysis::CalibrationDataInterfaceROOT::m_otherStrategy {}
private

Definition at line 475 of file CalibrationDataInterfaceROOT.h.

475{};

◆ m_refMap

std::map<std::string, HadronisationReferenceHelper*> Analysis::CalibrationDataInterfaceROOT::m_refMap
private

the following maps (one for each directory) specify the name of the container serving as the 'hadronisation' reference for each object

Definition at line 459 of file CalibrationDataInterfaceROOT.h.

◆ m_runEigenVectorMethod

bool Analysis::CalibrationDataInterfaceROOT::m_runEigenVectorMethod {}
private

decide whether to run the eigenvector method or not

Definition at line 429 of file CalibrationDataInterfaceROOT.h.

429{};

◆ m_taggerName

std::string Analysis::CalibrationDataInterfaceBase::m_taggerName
protectedinherited

tagging algorithm name

Definition at line 94 of file CalibrationDataInterfaceBase.h.

◆ m_useMCMCSF

bool Analysis::CalibrationDataInterfaceROOT::m_useMCMCSF {}
private

specify whether or not to use MC/MC (hadronisation) scale factors (the fact that this is steerable is intended to be temporary only)

Definition at line 452 of file CalibrationDataInterfaceROOT.h.

452{};

◆ m_useRecommendedEVExclusions

bool Analysis::CalibrationDataInterfaceROOT::m_useRecommendedEVExclusions {}
private

if true, exclude pre-recommended lists of uncertainties from the covariance matrix building, in addition to the above user specified lists

Definition at line 441 of file CalibrationDataInterfaceROOT.h.

441{};

◆ m_useTopologyRescaling

bool Analysis::CalibrationDataInterfaceROOT::m_useTopologyRescaling {}
private

specify whether or not to use MC/MC (topology) scale factors (also this steering option may be removed)

Definition at line 455 of file CalibrationDataInterfaceROOT.h.

455{};

◆ m_verbose

bool Analysis::CalibrationDataInterfaceROOT::m_verbose {}
private

if true, allow also for some informational (and not only error/warning) messages

Definition at line 444 of file CalibrationDataInterfaceROOT.h.

444{};

The documentation for this class was generated from the following files: