ATLAS Offline Software
Loading...
Searching...
No Matches
jet::FlavourUncertaintyComponent Class Reference

#include <FlavourUncertaintyComponent.h>

Inheritance diagram for jet::FlavourUncertaintyComponent:
Collaboration diagram for jet::FlavourUncertaintyComponent:

Public Member Functions

 FlavourUncertaintyComponent (const ComponentHelper &component, const TString &jetType, const TString &analysisRootFileName, const TString &defaultAnalysisRootFileName, const TString &path, const TString &calibArea, const bool absEtaGluonFraction, const TString &analysisHistPattern="", const TString &NjetAccessorName="Njet")
 FlavourUncertaintyComponent (const FlavourUncertaintyComponent &toCopy)
virtual FlavourUncertaintyComponentclone () const
virtual ~FlavourUncertaintyComponent ()
virtual StatusCode initialize (TFile *histFile)
virtual FlavourComp::TypeEnum getFlavourType () const
virtual TString getName () const
virtual TString getValidName () const
virtual CompScaleVar::TypeEnum getScaleVar () const
virtual JetTopology::TypeEnum getTopology () const
virtual bool isAlwaysZero () const
virtual bool getValidity (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual double getUncertainty (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual bool getValidUncertainty (double &unc, const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Protected Member Functions

virtual bool getValidityImpl (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual double getUncertaintyImpl (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual bool getValidBool (const double validity) const
virtual double getSplitFactor (const xAOD::Jet &jet) const
virtual double getAbsMass (const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
virtual double getMassOverPt (const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const
virtual double getMassOverE (const xAOD::Jet &jet, const CompMassDef::TypeEnum massDef) const

Protected Attributes

bool m_isInit {}
const TString m_uncHistName
const TString m_validHistName
const CompScaleVar::TypeEnum m_scaleVar
const JetTopology::TypeEnum m_topology
const float m_energyScale {}
const Interpolate::TypeEnum m_interpolate
const int m_splitNumber {}
int m_numExpectedHist {}
UncertaintyHistogramm_uncHist {}
UncertaintyHistogramm_validHist {}

Private Types

enum  FlavourRespType { FlavourResp_UNKNOWN , FlavourResp_GLUON , FlavourResp_QUARK }

Private Member Functions

 FlavourUncertaintyComponent (const std::string &name="")
double getFlavourResponseUncertainty (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
double getFlavourCompositionUncertainty (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
double getBJESUncertainty (const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
double getGluonFraction (const double pT, const double eta, const int nJets) const
double getGluonFractionError (const double pT, const double eta, const int nJets) const
double getGluonResponseDifference (const double pT, const double eta) const
double getGluonResponseBaseline (const double pT, const double eta) const
double getQuarkResponseBaseline (const double pT, const double eta) const
StatusCode readNjetsHistograms (std::vector< UncertaintyHistogram * > &hists, const std::vector< TString > &histKeys)
StatusCode getNjetFromKey (const TString &key, int &nJets) const
StatusCode checkNjetsInput (int &nJets) const
bool isBjet (const xAOD::Jet &jet) const
void getGluonKeys (TFile *analysisFile, std::vector< TString > &gluonFractionKeys, std::vector< TString > &gluonFractionErrorKeys) const
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

const FlavourComp::TypeEnum m_flavourType
const TString m_jetType
const TString m_analysisFileName
const TString m_analysisHistPattern
const TString m_defAnaFileName
const TString m_path
const TString m_calibArea
const bool m_absEta
const bool m_absEtaGluonFraction
const TString m_secondUncName
std::string m_largeRJetTruthLabelName
std::vector< LargeRJetTruthLabel::TypeEnumm_largeRJetTruthLabels
UncertaintyHistogramm_secondUncHist
FlavourRespType m_respType
FlavourRespType m_secondRespType
SG::AuxElement::Accessor< char > m_BjetAccessor
SG::AuxElement::Accessor< int > m_NjetAccessor
SG::AuxElement::Accessor< int > m_largeRJetTruthLabelAccessor
std::vector< UncertaintyHistogram * > m_gluonFractionHists
std::vector< UncertaintyHistogram * > m_gluonFractionErrorHists
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 13 of file FlavourUncertaintyComponent.h.

Member Enumeration Documentation

◆ FlavourRespType

Constructor & Destructor Documentation

◆ FlavourUncertaintyComponent() [1/3]

jet::FlavourUncertaintyComponent::FlavourUncertaintyComponent ( const ComponentHelper & component,
const TString & jetType,
const TString & analysisRootFileName,
const TString & defaultAnalysisRootFileName,
const TString & path,
const TString & calibArea,
const bool absEtaGluonFraction,
const TString & analysisHistPattern = "",
const TString & NjetAccessorName = "Njet" )

Definition at line 45 of file FlavourUncertaintyComponent.cxx.

55 : UncertaintyComponent(component,component.flavourType == FlavourComp::Composition ? 2 : 1)
56 , m_flavourType(component.flavourType)
57 , m_jetType(jetType)
58 , m_analysisFileName(analysisRootFileName)
59 , m_analysisHistPattern(analysisHistPattern)
60 , m_defAnaFileName(defaultAnalysisRootFileName)
61 , m_path(path)
62 , m_calibArea(calibArea)
63 , m_absEta(CompParametrization::isAbsEta(component.parametrization))
64 , m_absEtaGluonFraction(absEtaGluonFraction)
65 , m_secondUncName(component.uncNames.size()>1 ? component.uncNames.at(1) : "")
66 , m_largeRJetTruthLabelName(component.LargeRJetTruthLabelName)
67 , m_largeRJetTruthLabels(component.LargeRJetTruthLabels)
68 , m_secondUncHist(nullptr)
71 , m_BjetAccessor("IsBjet")
72 , m_NjetAccessor(NjetAccessorName.Data())
76{
77 ATH_MSG_DEBUG("Created FlavourUncertaintyComponent named" << m_uncHistName.Data());
78
79 // Ensure that the flavour type and ref values are sensible
81 ATH_MSG_FATAL("Flavour type is UNKNOWN: " << m_uncHistName.Data());
82}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_DEBUG(x)
SG::AuxElement::Accessor< int > m_largeRJetTruthLabelAccessor
SG::AuxElement::Accessor< char > m_BjetAccessor
SG::AuxElement::Accessor< int > m_NjetAccessor
std::vector< UncertaintyHistogram * > m_gluonFractionErrorHists
std::vector< UncertaintyHistogram * > m_gluonFractionHists
std::vector< LargeRJetTruthLabel::TypeEnum > m_largeRJetTruthLabels
UncertaintyComponent(const ComponentHelper &component, const size_t numHist=1)
bool isAbsEta(const TypeEnum type)

◆ FlavourUncertaintyComponent() [2/3]

jet::FlavourUncertaintyComponent::FlavourUncertaintyComponent ( const FlavourUncertaintyComponent & toCopy)

Definition at line 84 of file FlavourUncertaintyComponent.cxx.

85 : UncertaintyComponent(toCopy)
86 , m_flavourType(toCopy.m_flavourType)
87 , m_jetType(toCopy.m_jetType)
88 , m_analysisFileName(toCopy.m_analysisFileName)
89 , m_analysisHistPattern(toCopy.m_analysisHistPattern)
90 , m_defAnaFileName(toCopy.m_defAnaFileName)
91 , m_path(toCopy.m_path)
92 , m_calibArea(toCopy.m_calibArea)
93 , m_absEta(toCopy.m_absEta)
94 , m_absEtaGluonFraction(toCopy.m_absEtaGluonFraction)
95 , m_secondUncName(toCopy.m_secondUncName)
96 , m_largeRJetTruthLabelName(toCopy.m_largeRJetTruthLabelName)
97 , m_largeRJetTruthLabels(toCopy.m_largeRJetTruthLabels)
98 , m_secondUncHist(nullptr)
99 , m_respType(toCopy.m_respType)
100 , m_secondRespType(toCopy.m_secondRespType)
101 , m_BjetAccessor(toCopy.m_BjetAccessor)
102 , m_NjetAccessor(toCopy.m_NjetAccessor)
103 , m_largeRJetTruthLabelAccessor(toCopy.m_largeRJetTruthLabelAccessor)
106{
107 ATH_MSG_DEBUG(Form("Creating copy of FlavourUncertaintyComponent named %s",m_uncHistName.Data()));
108
109 if (toCopy.m_secondUncHist)
110 m_secondUncHist = new UncertaintyHistogram(*toCopy.m_secondUncHist);
111
112 for (size_t iHist = 0; iHist < toCopy.m_gluonFractionHists.size(); ++iHist)
113 if (toCopy.m_gluonFractionHists.at(iHist))
114 m_gluonFractionHists.push_back(new UncertaintyHistogram(*toCopy.m_gluonFractionHists.at(iHist)));
115
116 for (size_t iHist = 0; iHist < toCopy.m_gluonFractionErrorHists.size(); ++iHist)
117 if (toCopy.m_gluonFractionErrorHists.at(iHist))
118 m_gluonFractionErrorHists.push_back(new UncertaintyHistogram(*toCopy.m_gluonFractionErrorHists.at(iHist)));
119}

◆ ~FlavourUncertaintyComponent()

jet::FlavourUncertaintyComponent::~FlavourUncertaintyComponent ( )
virtual

Definition at line 126 of file FlavourUncertaintyComponent.cxx.

127{
129
130 for (size_t iHisto = 0; iHisto < m_gluonFractionHists.size(); ++iHisto)
131 {
134 }
135 m_gluonFractionHists.clear();
137}

◆ FlavourUncertaintyComponent() [3/3]

jet::FlavourUncertaintyComponent::FlavourUncertaintyComponent ( const std::string & name = "")
private

Member Function Documentation

◆ checkNjetsInput()

StatusCode jet::FlavourUncertaintyComponent::checkNjetsInput ( int & nJets) const
private

Definition at line 632 of file FlavourUncertaintyComponent.cxx.

633{
634 // nJets = 0 is the inclusive composition
635 // nJets = # is the composition for # jets
636 // nJets < 0 uses default if available
637 // nJets > MAX uses default if available
638 // nJets = #, but # is NULL uses default if available
639
640 // Case of no histograms is checked in initialization, no need to repeat here
641 // Initialization also ensures gluonFractionHists and gluonFractionErrorHists are consistent
642
643 // Check if we need to use the default histogram
644 if (nJets < 0 || nJets >= static_cast<int>(m_gluonFractionHists.size()) || m_gluonFractionHists.at(nJets) == nullptr)
645 {
646 // Check if we can fall back on the default bin (does it exist?)
647 if (m_gluonFractionHists.at(0) == nullptr)
648 {
649 ATH_MSG_ERROR("nJets of " << nJets << " is invalid, and default does not exist to fall back on, for " << getName().Data());
650 return StatusCode::FAILURE;
651 }
652 // Fall back on the default bin
653 nJets = 0;
654 }
655 // Otherwise, the specified nJets value is fine and doesn't need to be touched
656
657
658 return StatusCode::SUCCESS;
659}
#define ATH_MSG_ERROR(x)
@ Data
Definition BaseObject.h:11
virtual TString getName() const

◆ clone()

FlavourUncertaintyComponent * jet::FlavourUncertaintyComponent::clone ( ) const
virtual

Implements jet::UncertaintyComponent.

Definition at line 121 of file FlavourUncertaintyComponent.cxx.

122{
123 return new FlavourUncertaintyComponent(*this);
124}
FlavourUncertaintyComponent(const ComponentHelper &component, const TString &jetType, const TString &analysisRootFileName, const TString &defaultAnalysisRootFileName, const TString &path, const TString &calibArea, const bool absEtaGluonFraction, const TString &analysisHistPattern="", const TString &NjetAccessorName="Njet")

◆ getAbsMass()

double jet::UncertaintyComponent::getAbsMass ( const xAOD::Jet & jet,
const CompMassDef::TypeEnum massDef ) const
protectedvirtualinherited

Definition at line 309 of file UncertaintyComponent.cxx.

310{
311 // Check for the simple case (where we want the default four-vector itself)
312 if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
313 return jet.m();
314
315 // Not the simple case, check for the specified four-vector instead and return it if it is available
316 JetFourMomAccessor scale(CompMassDef::getJetScaleString(massDef).Data());
317 if (scale.isAvailable(jet))
318 return scale(jet).M();
319
320 // Fall-back on the TA moment as a float if applicable (legacy support)
321 SG::AuxElement::ConstAccessor<float> scaleTAMoment("JetTrackAssistedMassCalibrated");
322 if (massDef == CompMassDef::TAMass && scaleTAMoment.isAvailable(jet))
323 return scaleTAMoment(jet);
324
325 // Fall-back on the calo mass as the 4-vec if applicable (legacy support)
326 if (massDef == CompMassDef::CaloMass)
327 return jet.m();
328
329 // Specified scale is not available, error
330 ATH_MSG_ERROR("Failed to retrieve the " << CompMassDef::enumToString(massDef).Data() << " mass from the jet");
331 return JESUNC_ERROR_CODE;
332}
virtual double m() const
The invariant mass of the particle.
Definition Jet_v1.cxx:59
TString getJetScaleString(const TypeEnum type)
TString enumToString(const TypeEnum type)

◆ getBJESUncertainty()

double jet::FlavourUncertaintyComponent::getBJESUncertainty ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
private

Definition at line 517 of file FlavourUncertaintyComponent.cxx.

518{
519 // Ensure this is a b-jet
520 if (!isBjet(jet))
521 return 0;
522 return m_uncHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta());
523}
bool isBjet(const xAOD::Jet &jet) const
UncertaintyHistogram * m_uncHist
virtual double pt() const
The transverse momentum ( ) of the particle.
Definition Jet_v1.cxx:44
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition Jet_v1.cxx:49

◆ getFlavourCompositionUncertainty()

double jet::FlavourUncertaintyComponent::getFlavourCompositionUncertainty ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
private

Definition at line 457 of file FlavourUncertaintyComponent.cxx.

458{
459 // Returns the flavor composition uncertainty using the formula:
460 //
461 // Uncertainty = df * | Rq - Rg | / ( fg * Rg + (1 - fg) * Rq )
462 // with
463 // Rs = fg * Rg + (1 - fg) * Rq as heavy q uncertainties accounted separately
464 // df = error on fg
465 // fg = fraction of gluons
466 // Rq = light quark response
467 // Rg = gluon response
468
469 // Check if this is a b-jet
470 if (isBjet(jet))
471 return 0;
472
473 // Get the number of jets
474 int nJets = 0;
475 if (m_gluonFractionHists.size() > 1)
476 {
477 if (m_NjetAccessor.isAvailable(eInfo))
478 nJets = m_NjetAccessor(eInfo);
479 else
480 {
481 ATH_MSG_ERROR("Specified Njets treatment, but did not decorate EventInfo object");
482 return JESUNC_ERROR_CODE;
483 }
484 }
485
486
487 if (checkNjetsInput(nJets).isFailure())
488 return JESUNC_ERROR_CODE;
489
490 const double pT = jet.pt()*m_energyScale;
491 const double eta = m_absEta ? fabs(jet.eta()) : jet.eta();
492
493 //calculating the sample response:
494 //fg*Rg + (1-fg)*Rq
495 const double gluonFrac = getGluonFraction(pT,eta,nJets);
496 const double Rg = getGluonResponseBaseline(pT,eta);
497 const double Rq = getQuarkResponseBaseline(pT,eta);
498
499 const double Rsample = gluonFrac * Rg + (1-gluonFrac) * Rq;
500
501 //this should never happen (it means the Rg == Rq == 0), but checking anyway
502 if (Rsample==0)
503 {
504 ATH_MSG_ERROR(Form("R(sample) = 0 for pT=%.1f, eta=%.2f",pT,eta));
505 return JESUNC_ERROR_CODE;
506 }
507
508 //calculating the uncertainty
509 const double gluonFracError = getGluonFractionError(pT,eta,nJets);
510 //coverity[divide_by_zero]
511 const double flavorCompUnc = gluonFracError*fabs(Rq-Rg)/Rsample;
512
513 return flavorCompUnc;
514
515}
Scalar eta() const
pseudorapidity method
double getGluonFractionError(const double pT, const double eta, const int nJets) const
double getGluonFraction(const double pT, const double eta, const int nJets) const
double getGluonResponseBaseline(const double pT, const double eta) const
double getQuarkResponseBaseline(const double pT, const double eta) const

◆ getFlavourResponseUncertainty()

double jet::FlavourUncertaintyComponent::getFlavourResponseUncertainty ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
private

Definition at line 421 of file FlavourUncertaintyComponent.cxx.

422{
423 // Assumption:
424 // dR(q) = JES uncertainty (measured in gamma/Z+jet)
425 // dR(g) = JES uncertainty (+) additional gluon response component
426 // component to be added to JES uncertainty:
427 // fg*dR(gluon response modelling uncertainty)
428 // where gluon response modelling uncertainty is taken as difference between gluon response in Pythia and Herwig++
429
430 // Check if this is a b-jet
431 if (isBjet(jet))
432 return 0;
433
434 // Get the number of jets
435 int nJets = 0;
436 if (m_gluonFractionHists.size() > 1)
437 {
438 if (m_NjetAccessor.isAvailable(eInfo))
439 nJets = m_NjetAccessor(eInfo);
440 else
441 {
442 ATH_MSG_ERROR("Specified Njets treatment, but did not decorate EventInfo object");
443 return JESUNC_ERROR_CODE;
444 }
445 }
446
447 if (checkNjetsInput(nJets).isFailure())
448 return JESUNC_ERROR_CODE;
449
450 const double pT = jet.pt()*m_energyScale;
451 const double eta = m_absEta ? fabs(jet.eta()) : jet.eta();
452
453 // return the uncertainty
454 return getGluonResponseDifference(pT,eta) * getGluonFraction(pT,eta,nJets);
455}
double getGluonResponseDifference(const double pT, const double eta) const

◆ getFlavourType()

virtual FlavourComp::TypeEnum jet::FlavourUncertaintyComponent::getFlavourType ( ) const
inlinevirtual

Definition at line 33 of file FlavourUncertaintyComponent.h.

33{ return m_flavourType; }

◆ getGluonFraction()

double jet::FlavourUncertaintyComponent::getGluonFraction ( const double pT,
const double eta,
const int nJets ) const
private

Definition at line 532 of file FlavourUncertaintyComponent.cxx.

533{
534 // nJets value checking is done in checkNjetsInput
535 return m_gluonFractionHists.at(nJets)->getValue(pT,m_absEtaGluonFraction ? std::abs(eta) : eta);
536}

◆ getGluonFractionError()

double jet::FlavourUncertaintyComponent::getGluonFractionError ( const double pT,
const double eta,
const int nJets ) const
private

Definition at line 538 of file FlavourUncertaintyComponent.cxx.

539{
540 // nJets value checking is done in checkNjetsInput
541 return m_gluonFractionErrorHists.at(nJets)->getValue(pT,m_absEtaGluonFraction ? std::abs(eta) : eta);
542}

◆ getGluonKeys()

void jet::FlavourUncertaintyComponent::getGluonKeys ( TFile * analysisFile,
std::vector< TString > & gluonFractionKeys,
std::vector< TString > & gluonFractionErrorKeys ) const
private

Definition at line 671 of file FlavourUncertaintyComponent.cxx.

672{
673 TList* keys = analysisFile->GetListOfKeys();
674 TIter nextkey(keys);
675 if (m_analysisHistPattern != "")
676 {
677 ATH_MSG_DEBUG("Ignoring histograms which don't contain pattern " << m_analysisHistPattern.Data());
678 }
679 while (TKey* key = dynamic_cast<TKey*>(nextkey()))
680 {
681 const TString keyName = key->GetName();
682 //Ignoring histograms which doesn't contain user-defined pattern
683 if (m_analysisHistPattern != "" && !keyName.Contains(m_analysisHistPattern)) continue;
684 if (keyName.Contains(m_jetType) && !keyName.Contains("valid"))
685 {
686 if (keyName.Contains("gluonFractionError"))
687 gluonFractionErrorKeys.push_back(keyName);
688 else if (keyName.Contains("gluonFraction"))
689 gluonFractionKeys.push_back(keyName);
690 }
691 }
692}

◆ getGluonResponseBaseline()

double jet::FlavourUncertaintyComponent::getGluonResponseBaseline ( const double pT,
const double eta ) const
private

Definition at line 554 of file FlavourUncertaintyComponent.cxx.

555{
557 {
558 ATH_MSG_ERROR("This method is only useable for FlavourComposition uncertainties, not " << getName().Data());
559 return JESUNC_ERROR_CODE;
560 }
561
563 return m_uncHist->getValue(pT,eta);
565 return m_secondUncHist->getValue(pT,eta);
566 ATH_MSG_ERROR("Unexpected flavour response parametrization: " << getName().Data());
567 return JESUNC_ERROR_CODE;
568}

◆ getGluonResponseDifference()

double jet::FlavourUncertaintyComponent::getGluonResponseDifference ( const double pT,
const double eta ) const
private

Definition at line 544 of file FlavourUncertaintyComponent.cxx.

545{
547 {
548 ATH_MSG_ERROR("This method is only useable for FlavourResponse uncertainties, not " << getName().Data());
549 return JESUNC_ERROR_CODE;
550 }
551 return m_uncHist->getValue(pT,eta);
552}

◆ getMassOverE()

double jet::UncertaintyComponent::getMassOverE ( const xAOD::Jet & jet,
const CompMassDef::TypeEnum massDef ) const
protectedvirtualinherited

Definition at line 360 of file UncertaintyComponent.cxx.

361{
362 // Check for the simple case (where we want the default four-vector itself)
363 if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
364 return jet.m()/jet.e();
365
366 // Not the simple case, check for the specified four-vector instead and return it if it is available
367 JetFourMomAccessor scale(CompMassDef::getJetScaleString(massDef).Data());
368 if (scale.isAvailable(jet))
369 return scale(jet).M()/scale(jet).E();
370
371 // Fall-back on the TA moment as a float if applicable (legacy support)
372 SG::AuxElement::ConstAccessor<float> scaleTAMoment("JetTrackAssistedMassCalibrated");
373 if (massDef == CompMassDef::TAMass && scaleTAMoment.isAvailable(jet))
374 return scaleTAMoment(jet)/jet.e();
375
376 // Fall-back on the calo mass as the 4-vec if applicable (legacy support)
377 if (massDef == CompMassDef::CaloMass)
378 return jet.m()/jet.e();
379
380 // Specified scale is not available, error
381 ATH_MSG_ERROR("Failed to retrieve the " << CompMassDef::enumToString(massDef).Data() << " mass from the jet");
382 return JESUNC_ERROR_CODE;
383
384}
virtual double e() const
The total energy of the particle.
Definition Jet_v1.cxx:63

◆ getMassOverPt()

double jet::UncertaintyComponent::getMassOverPt ( const xAOD::Jet & jet,
const CompMassDef::TypeEnum massDef ) const
protectedvirtualinherited

Definition at line 334 of file UncertaintyComponent.cxx.

335{
336 // Check for the simple case (where we want the default four-vector itself)
337 if (massDef == CompMassDef::UNKNOWN || massDef == CompMassDef::FourVecMass)
338 return jet.m()/jet.pt();
339
340 // Not the simple case, check for the specified four-vector instead and return it if it is available
341 JetFourMomAccessor scale(CompMassDef::getJetScaleString(massDef).Data());
342 if (scale.isAvailable(jet))
343 return scale(jet).M()/scale(jet).Pt();
344
345 // Fall-back on the TA moment as a float if applicable (legacy support)
346 SG::AuxElement::ConstAccessor<float> scaleTAMoment("JetTrackAssistedMassCalibrated");
347 if (massDef == CompMassDef::TAMass && scaleTAMoment.isAvailable(jet))
348 return scaleTAMoment(jet)/jet.pt();
349
350 // Fall-back on the calo mass as the 4-vec if applicable (legacy support)
351 if (massDef == CompMassDef::CaloMass)
352 return jet.m()/jet.pt();
353
354 // Specified scale is not available, error
355 ATH_MSG_ERROR("Failed to retrieve the " << CompMassDef::enumToString(massDef).Data() << " mass from the jet");
356 return JESUNC_ERROR_CODE;
357
358}

◆ getName()

virtual TString jet::UncertaintyComponent::getName ( ) const
inlinevirtualinherited

Definition at line 35 of file UncertaintyComponent.h.

35{ return m_uncHistName; }

◆ getNjetFromKey()

StatusCode jet::FlavourUncertaintyComponent::getNjetFromKey ( const TString & key,
int & nJets ) const
private

Definition at line 615 of file FlavourUncertaintyComponent.cxx.

616{
617 std::vector<TString> tokens = utils::vectorize<TString>(key,"_");
618 if (tokens.size() > 2 && tokens.at(tokens.size()-1).Contains("nJet",TString::kIgnoreCase))
619 {
620 TString nJetStr = tokens.at(tokens.size()-1).ReplaceAll("nJet","");
621 nJetStr = nJetStr.ReplaceAll("njet","");
622 nJetStr = nJetStr.ReplaceAll("Njet","");
623 if (!utils::getTypeObjFromString<int>(nJetStr,nJets))
624 {
625 ATH_MSG_ERROR("Found nJets histogram, but failed to parse the index: " << key.Data());
626 return StatusCode::FAILURE;
627 }
628 }
629 return StatusCode::SUCCESS;
630}
bool getTypeObjFromString(const std::string &str, T &obj)
bool vectorize(const TString &str, const TString &sep, std::vector< T > &result)

◆ getQuarkResponseBaseline()

double jet::FlavourUncertaintyComponent::getQuarkResponseBaseline ( const double pT,
const double eta ) const
private

Definition at line 570 of file FlavourUncertaintyComponent.cxx.

571{
573 {
574 ATH_MSG_ERROR("This method is only useable for FlavourComposition uncertainties, not " << getName().Data());
575 return JESUNC_ERROR_CODE;
576 }
578 return m_uncHist->getValue(pT,eta);
580 return m_secondUncHist->getValue(pT,eta);
581 ATH_MSG_ERROR("Unexpected flavour response parametrization: " << getName().Data());
582 return JESUNC_ERROR_CODE;
583}

◆ getScaleVar()

virtual CompScaleVar::TypeEnum jet::UncertaintyComponent::getScaleVar ( ) const
inlinevirtualinherited

Definition at line 37 of file UncertaintyComponent.h.

37{ return m_scaleVar; }
const CompScaleVar::TypeEnum m_scaleVar

◆ getSplitFactor()

double jet::UncertaintyComponent::getSplitFactor ( const xAOD::Jet & jet) const
protectedvirtualinherited

Definition at line 196 of file UncertaintyComponent.cxx.

197{
198 // Immediate return for the most common case
199 if (!m_splitNumber)
200 return 1;
201
202 // SplitNumber was specified, we have to calculate the factor
203 double splitFactor = 1;
204 const TH1* histo = m_uncHist->getHisto();
205
206 if (m_splitNumber == 1 || m_splitNumber == -1)
207 {
208 // Straight line in log(pT) from 0 to 1
209 // y = mx+b
210 // m = 1/[log(max)-log(min)]
211 // x = log(min) --> b = -m*log(min)
212
213 const double minPt = histo->GetXaxis()->GetBinLowEdge(1);
214 const double maxPt = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
215 const double valPt = jet.pt()*m_energyScale;
216
217 const double slope = 1./(log(maxPt)-log(minPt));
218 const double intercept = -slope*log(minPt);
219
220 splitFactor = slope*log(valPt <= minPt ? minPt+1.e-3 : valPt >= maxPt ? maxPt-1.e-3 : valPt)+intercept;
221 }
222 else if (m_splitNumber == 2 || m_splitNumber == -2)
223 {
224 // Straight line in |eta| from 0 to 1
225 // y = mx + b
226 // m = 1/(max - min)
227 // x = min --> b = -m*min
228 const double minEta = 0;
229 const double maxEta = 4.5;
230 const double absEta = fabs(jet.eta());
231
232 const double slope = 1./(maxEta - minEta);
233 const double intercept = -slope*minEta;
234
235 splitFactor = slope*(absEta <= minEta ? minEta+1.e-3 : absEta >= maxEta ? maxEta-1.e-3 : absEta)+intercept;
236 }
237 else if (m_splitNumber == 3 || m_splitNumber == -3)
238 {
239 // Increasing with log(pT) and increasing with |eta|
240 // z = mx + ny + c
241 // z(min,min) = 0
242 // z(max,max) = 1
243 // Linear in both dimensions means need factor of 1/2 in a single dimension
244 // m = 0.5/[log(maxPt)-log(minPt)]
245 // n = 0.5/(maxEta - minEta)
246 // c = -minPt*m - minEta*n
247 // 2*z = (logx-logxmin)/(logxmax-logxmin) + (y-ymin)/(ymax-ymin)
248 const double minPt = histo->GetXaxis()->GetBinLowEdge(1);
249 const double maxPt = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
250 const double valPt = jet.pt()*m_energyScale;
251
252 const double minEta = 0;
253 const double maxEta = 4.5;
254 const double absEta = fabs(jet.eta());
255
256 const double slopePt = 1./(log(maxPt)-log(minPt));
257 const double slopeEta = 1./(maxEta-minEta);
258
259 const double fixedPt = valPt <= minPt ? minPt+1.e-3 : valPt >= maxPt ? maxPt - 1.e-3 : valPt;
260 const double fixedEta = absEta <= minEta ? minEta+1.e-3 : absEta >= maxEta ? maxEta-1.e-3 : absEta;
261
262 splitFactor = (slopePt*(log(fixedPt)-log(minPt)) + slopeEta*(fixedEta-minEta))/2.;
263 }
264 else if (m_splitNumber == 4 || m_splitNumber == -4)
265 {
266 // Increasing with log(pT) and decreasing with |eta|
267 // See description above, follows similarly
268 // 2*z = (logx-logxmin)/(logxmax-logxmin) + (ymax-y)/(ymax-ymin)
269 const double minPt = histo->GetXaxis()->GetBinLowEdge(1);
270 const double maxPt = histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1);
271 const double valPt = jet.pt()*m_energyScale;
272
273 const double minEta = 0;
274 const double maxEta = 4.5;
275 const double absEta = fabs(jet.eta());
276
277 const double slopePt = 1./(log(maxPt)-log(minPt));
278 const double slopeEta = 1./(maxEta-minEta);
279
280 const double fixedPt = valPt <= minPt ? minPt+1.e-3 : valPt >= maxPt ? maxPt - 1.e-3 : valPt;
281 const double fixedEta = absEta <= minEta ? minEta+1.e-3 : absEta >= maxEta ? maxEta-1.e-3 : absEta;
282
283 splitFactor = (slopePt*(log(fixedPt)-log(minPt)) + slopeEta*(maxEta-fixedEta))/2.;
284 }
285
286
287 // Now check if this is the functional part or the complementary part
288 if (m_splitNumber < 0)
289 splitFactor = sqrt(1-splitFactor*splitFactor);
290
291 return splitFactor;
292}
constexpr float maxEta
bool absEta(const xAOD::TauJet &tau, float &out)

◆ getTopology()

virtual JetTopology::TypeEnum jet::UncertaintyComponent::getTopology ( ) const
inlinevirtualinherited

Definition at line 38 of file UncertaintyComponent.h.

38{ return m_topology; }
const JetTopology::TypeEnum m_topology

◆ getUncertainty()

double jet::UncertaintyComponent::getUncertainty ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtualinherited

Definition at line 169 of file UncertaintyComponent.cxx.

170{
171 if (!m_isInit)
172 {
173 ATH_MSG_ERROR("Component hasn't been initialized: " << getName().Data());
174 return JESUNC_ERROR_CODE;
175 }
176 return getUncertaintyImpl(jet,eInfo)*getSplitFactor(jet);
177}
virtual double getUncertaintyImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const =0
virtual double getSplitFactor(const xAOD::Jet &jet) const

◆ getUncertaintyImpl()

double jet::FlavourUncertaintyComponent::getUncertaintyImpl ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
protectedvirtual

Implements jet::UncertaintyComponent.

Definition at line 368 of file FlavourUncertaintyComponent.cxx.

369{
370 // First, check if we even want to apply the uncertainty (large-R specific break-out)
371 // Check if we are supposed to only use given truth labels
372 if (!m_largeRJetTruthLabels.empty())
373 {
374 // If we are asking to check truth labels, then retrieve the truth jet label from the jet
375 if (!m_largeRJetTruthLabelAccessor.isAvailable(jet))
376 {
377 // Unable to retrieve truth label, but we were told to look for it, error
378 ATH_MSG_ERROR("Unable to retrieve LargeRJetTruthLabel: " + m_largeRJetTruthLabelName + " from the jet. Please use JetTruthLabeling before calling this function.");
379 return JESUNC_ERROR_CODE;
380 }
381 // Ok, the label exists, now check what it is
383 if (largeRJetTruthLabel == LargeRJetTruthLabel::UNKNOWN)
384 {
385 // This is an error - the label exists but it is unrecognized
386 ATH_MSG_ERROR("UNKNOWN LargeRJetTruthLabel on the jet. Please use JetTruthLabeling before calling this function or check the jet for irregularities.");
387 return JESUNC_ERROR_CODE;
388 }
389 // Not unknown, now check if it is one of the labels we want to apply this uncertainty for
390 bool relevantLabel = false;
392 {
393 if (aLabel == largeRJetTruthLabel)
394 relevantLabel = true;
395 }
396
397 // If we don't want to apply an uncertainty to jets with this label, then return 0 here (no uncertainty)
398 if (!relevantLabel)
399 return 0;
400 // Otherwise, continue as usual
401 }
402
403
404 // Now, we do want t o apply the uncertainty, so do it
405 double unc = JESUNC_ERROR_CODE;
407 unc = getFlavourResponseUncertainty(jet,eInfo);
409 unc = getFlavourCompositionUncertainty(jet,eInfo);
411 unc = getBJESUncertainty(jet,eInfo);
412 else
413 {
414 ATH_MSG_ERROR("Unknown flavour type for " << getName().Data());
415 return unc;
416 }
417
418 return unc;
419}
double getBJESUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
double getFlavourResponseUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
double getFlavourCompositionUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
TypeEnum intToEnum(const int type)

◆ getValidBool()

bool jet::UncertaintyComponent::getValidBool ( const double validity) const
protectedvirtualinherited

Definition at line 301 of file UncertaintyComponent.cxx.

302{
303 if (validity < 1.e-5 && validity > -1.e-5) return false;
304 if (validity < 1+1.e-5 && validity > 1-1.e-5) return true;
305 ATH_MSG_ERROR(Form("Validity value not in expected range: %lf for histogram %s",validity,getValidName().Data()));
306 return false;
307}
virtual TString getValidName() const

◆ getValidity()

bool jet::UncertaintyComponent::getValidity ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtualinherited

Definition at line 159 of file UncertaintyComponent.cxx.

160{
161 if (!m_isInit)
162 {
163 ATH_MSG_ERROR("Component hasn't been initialized: " << getName().Data());
164 return false;
165 }
166 return getValidityImpl(jet,eInfo);
167}
virtual bool getValidityImpl(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const =0

◆ getValidityImpl()

bool jet::FlavourUncertaintyComponent::getValidityImpl ( const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
protectedvirtual

Implements jet::UncertaintyComponent.

Definition at line 345 of file FlavourUncertaintyComponent.cxx.

346{
347 // Currently only one validity histogram exists
348 // Might need to expand in the future
349
350 return !m_validHist ? true : getValidBool(m_validHist->getValue(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()));
351
352// // Valid only if all histogram(s) are valid
353// // Histograms to consider varies by flavour type
354// // Start with the standard histograms
355// for (size_t iHisto = 0; iHisto < m_histos.size(); ++iHisto)
356// if (!m_histos.at(iHisto)->getValidity(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()))
357// return false;
358//
359// // Now do analysis histograms
360// for (size_t iHisto = 0; iHisto < m_gluonFractionHists.size(); ++iHisto)
361// if (!m_gluonFractionHists.at(iHisto)->getValidity(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()) ||
362// !m_gluonFractionErrorHists.at(iHisto)->getValidity(jet.pt()*m_energyScale,m_absEta ? fabs(jet.eta()) : jet.eta()) )
363// return false;
364//
365// return true;
366}
virtual bool getValidBool(const double validity) const
UncertaintyHistogram * m_validHist

◆ getValidName()

virtual TString jet::UncertaintyComponent::getValidName ( ) const
inlinevirtualinherited

Definition at line 36 of file UncertaintyComponent.h.

36{ return m_validHistName; }

◆ getValidUncertainty()

bool jet::UncertaintyComponent::getValidUncertainty ( double & unc,
const xAOD::Jet & jet,
const xAOD::EventInfo & eInfo ) const
virtualinherited

Definition at line 179 of file UncertaintyComponent.cxx.

180{
181 if (getValidity(jet,eInfo))
182 {
183 unc = getUncertainty(jet,eInfo);
184 return true;
185 }
186 return false;
187}
virtual double getUncertainty(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const
virtual bool getValidity(const xAOD::Jet &jet, const xAOD::EventInfo &eInfo) const

◆ initialize()

StatusCode jet::FlavourUncertaintyComponent::initialize ( TFile * histFile)
virtual

Reimplemented from jet::UncertaintyComponent.

Definition at line 141 of file FlavourUncertaintyComponent.cxx.

142{
143 // Call the base class first
144 if (UncertaintyComponent::initialize(histFile).isFailure())
145 return StatusCode::FAILURE;
146
147 // Ensure that the number of histograms matches what is expected for Flavour components
149 {
150 if (m_secondUncName != "")
151 {
152 ATH_MSG_ERROR("Expected one histogram for FlavourResponse: " << getName().Data());
153 return StatusCode::FAILURE;
154 }
155 }
157 {
158 ATH_MSG_ERROR("Expected two histograms for FlavourComposition: " << getName().Data());
159 return StatusCode::FAILURE;
160 }
162 {
163 ATH_MSG_ERROR("Expected one histogram for bJES uncertainty: " << getName().Data());
164 return StatusCode::FAILURE;
165 }
166
167 // Get the flavour response types if applicable
169 {
170 if ( m_uncHistName.Contains("glu",TString::kIgnoreCase) && (m_secondUncName.Contains("light",TString::kIgnoreCase) || m_secondUncName.Contains("quark",TString::kIgnoreCase)) )
171 {
174 }
175 else if ( (m_uncHistName.Contains("light",TString::kIgnoreCase) || m_uncHistName.Contains("quark",TString::kIgnoreCase)) && m_secondUncName.Contains("glu",TString::kIgnoreCase) )
176 {
179 }
180 else
181 {
182 // Unexpected inputs
183 ATH_MSG_ERROR("Component is FlavourComposition, but histogram names are unexpected (need to discriminate gluon vs quark response histograms): " << m_uncHistName.Data() << " and " << m_secondUncName.Data());
184 return StatusCode::FAILURE;
185 }
186
187 }
188
189 // Create the second histogram if applicable
191 {
192 m_secondUncHist = new UncertaintyHistogram(m_secondUncName,m_interpolate);
193 if (!m_secondUncHist)
194 {
195 ATH_MSG_ERROR("Failed to create second uncertainty histogram for component: " << getName().Data());
196 return StatusCode::FAILURE;
197 }
198 if (m_secondUncHist->initialize(histFile).isFailure()) return StatusCode::FAILURE;
199 }
200
201 // Now read the analysis input histograms if this is not a bJES component
203 {
205 if (!analysisFile || analysisFile->IsZombie())
206 {
207 ATH_MSG_ERROR("Cannot open analysis histogram file: " << m_analysisFileName.Data());
208 return StatusCode::FAILURE;
209 }
210
211 // Retrieve the gluon fraction(s) and gluon fraction uncertainty(ies)
212 // May be a single histogram (default) or specified by nJet bins
213 // Store all of the key names for now, retrieval will happen later
214 std::vector<TString> gluonFractionKeys;
215 std::vector<TString> gluonFractionErrorKeys;
216 getGluonKeys(analysisFile,gluonFractionKeys,gluonFractionErrorKeys);
217
218
219 // Ensure we found histograms...
220 if (gluonFractionKeys.empty() || gluonFractionErrorKeys.empty())
221 {
222 ATH_MSG_ERROR(Form("Failed to find gluon fraction histogram(s), found %zu nominal and %zu error hists in file %s",gluonFractionKeys.size(),gluonFractionErrorKeys.size(),m_analysisFileName.Data()));
223 return StatusCode::FAILURE;
224 }
225
226 // Determine the max nJet value
227 int nJetsMax = -1;
228 for (size_t iKey = 0; iKey < gluonFractionKeys.size(); ++iKey)
229 {
230 int nJets = -1;
231 if (getNjetFromKey(gluonFractionKeys.at(iKey),nJets).isFailure())
232 return StatusCode::FAILURE;
233 if (nJets > nJetsMax && nJets < 1000)
234 nJetsMax = nJets;
235 }
236
237 // If there is only one histogram and it's not an nJets histogram, this is trivial
238 if (nJetsMax < 0 && gluonFractionKeys.size() == 1 && gluonFractionErrorKeys.size() == 1)
239 {
240 m_gluonFractionHists.push_back(new UncertaintyHistogram(gluonFractionKeys.at(0),m_interpolate));
241 m_gluonFractionErrorHists.push_back(new UncertaintyHistogram(gluonFractionErrorKeys.at(0),m_interpolate));
242 }
243 // If there is more than one histogram and they are not nJets histograms, this is a problem
244 else if (nJetsMax < 0 && gluonFractionKeys.size() > 1)
245 {
246 ATH_MSG_ERROR(Form("Found %zu gluon fraction histograms, but they do not appear to be binned by nJets:",gluonFractionKeys.size()));
247 for (size_t iKey = 0; iKey < gluonFractionKeys.size(); ++iKey)
248 ATH_MSG_ERROR(Form("\tKey %zu: %s",iKey,gluonFractionKeys.at(iKey).Data()));
249 return StatusCode::FAILURE;
250 }
251 else
252 {
253 // Fill the actual vectors now, in proper order
254 for (int nJets = 0; nJets <= nJetsMax; ++nJets)
255 {
256 m_gluonFractionHists.push_back(nullptr);
257 m_gluonFractionErrorHists.push_back(nullptr);
258 }
259 if (readNjetsHistograms(m_gluonFractionHists,gluonFractionKeys).isFailure())
260 return StatusCode::FAILURE;
261 if (readNjetsHistograms(m_gluonFractionErrorHists,gluonFractionErrorKeys).isFailure())
262 return StatusCode::FAILURE;
263
264 // Ensure that every non-NULL gluon fraction has a non-NULL gluon fraction error
265 // (Note that not all indices must be filled, as maybe an analyis is only 4 and 5 jets)
266 for (size_t iJet = 0; iJet < m_gluonFractionHists.size(); ++iJet)
267 {
268 if (m_gluonFractionHists.at(iJet) && !m_gluonFractionErrorHists.at(iJet))
269 {
270 ATH_MSG_ERROR(Form("nJets = %zu was specified for the gluon fraction, but not the error",iJet));
271 return StatusCode::FAILURE;
272 }
273 else if (!m_gluonFractionHists.at(iJet) && m_gluonFractionErrorHists.at(iJet))
274 {
275 ATH_MSG_ERROR(Form("nJets = %zu was specified for the error, but not the gluon fraction",iJet));
276 return StatusCode::FAILURE;
277 }
278 }
279 }
280
281 // Initialize the non-NULL histograms
282 for (size_t iHist = 0; iHist < m_gluonFractionHists.size(); ++iHist)
283 {
284 if (m_gluonFractionHists.at(iHist) && m_gluonFractionHists.at(iHist)->initialize(analysisFile).isFailure())
285 return StatusCode::FAILURE;
286 if (m_gluonFractionErrorHists.at(iHist) && m_gluonFractionErrorHists.at(iHist)->initialize(analysisFile).isFailure())
287 return StatusCode::FAILURE;
288 }
289
290 // We're finally done reading that file...
291 analysisFile->Close();
292
293
294 // If nJets treatment is specified, and a default analysis file is specified, use this to fill the zero-bin
295 // The zero-bin is used whenever a multiplicity that is not explicitly specified is requested
296 if (m_defAnaFileName != "" && m_gluonFractionHists.size() > 1 && m_gluonFractionHists.at(0) == nullptr)
297 {
298 // Open the default file
300 if (!defAnaFile || defAnaFile->IsZombie())
301 {
302 ATH_MSG_ERROR("Cannot open default analysis histogram file: " << m_defAnaFileName.Data());
303 return StatusCode::FAILURE;
304 }
305
306 // Retrieve the gluon fraction(s) and gluon fraction uncertainty(ies)
307 // May be a single histogram (default) or specified by nJet bins
308 // Store all of the key names for now, retrieval will happen later
309 std::vector<TString> gluonFractionDefaultKeys;
310 std::vector<TString> gluonFractionErrorDefaultKeys;
311 getGluonKeys(defAnaFile,gluonFractionDefaultKeys,gluonFractionErrorDefaultKeys);
312
313 // Ensure that there is exactly one histogram (not another nJets file, not missing)
314 if (gluonFractionDefaultKeys.size() != 1 || gluonFractionErrorDefaultKeys.size() != 1)
315 {
316 ATH_MSG_ERROR(Form("When using the default file to fill unspecified nJets histograms, exactly one gluon fraction and one gluon fraction uncertainty histogram are required. Instead, we found %zu and %zu respectively in the file %s",gluonFractionDefaultKeys.size(),gluonFractionErrorDefaultKeys.size(),m_defAnaFileName.Data()));
317 return StatusCode::FAILURE;
318 }
319
320 // Fill the empty zero-bin histograms
321 m_gluonFractionHists.at(0) = new UncertaintyHistogram(gluonFractionDefaultKeys.at(0),m_interpolate);
322 m_gluonFractionErrorHists.at(0) = new UncertaintyHistogram(gluonFractionErrorDefaultKeys.at(0),m_interpolate);
323
324 // Now initialize them
325 if (m_gluonFractionHists.at(0)->initialize(defAnaFile).isFailure())
326 return StatusCode::FAILURE;
327 if (m_gluonFractionErrorHists.at(0)->initialize(defAnaFile).isFailure())
328 return StatusCode::FAILURE;
329
330 // We're done reading that file now too
331 defAnaFile->Close();
332 }
333
334 }
335
336 return StatusCode::SUCCESS;
337}
StatusCode getNjetFromKey(const TString &key, int &nJets) const
void getGluonKeys(TFile *analysisFile, std::vector< TString > &gluonFractionKeys, std::vector< TString > &gluonFractionErrorKeys) const
StatusCode readNjetsHistograms(std::vector< UncertaintyHistogram * > &hists, const std::vector< TString > &histKeys)
const Interpolate::TypeEnum m_interpolate
virtual StatusCode initialize(TFile *histFile)
TFile * readRootFile(const TString &fileName, const TString &path="", const TString &calibArea="")

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ isAlwaysZero()

bool jet::UncertaintyComponent::isAlwaysZero ( ) const
virtualinherited

Reimplemented in jet::CombinedMassUncertaintyComponent.

Definition at line 140 of file UncertaintyComponent.cxx.

141{
142 if (!m_isInit)
143 {
144 ATH_MSG_ERROR("Cannot call method before initialization, component: " << getName().Data());
145 return false;
146 }
147
148 const TH1* histo = m_uncHist->getHisto();
149 return !(fabs(histo->GetMinimum()) > 1.e-8 || fabs(histo->GetMaximum()) > 1.e-8);
150}

◆ isBjet()

bool jet::FlavourUncertaintyComponent::isBjet ( const xAOD::Jet & jet) const
private

Definition at line 661 of file FlavourUncertaintyComponent.cxx.

662{
663 // If not specified, assume it's not a b-jet
664 if (!m_BjetAccessor.isAvailable(jet)) return false;
665
666 // If it's available, return the value (now a char, so check non-equality with 0)
667 return m_BjetAccessor(jet) != 0;
668}

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41 {
42#ifndef XAOD_STANDALONE
43 return ::AthMessaging::msgLvl( lvl );
44#else // not XAOD_STANDALONE
45 return m_msg.msgLevel( lvl );
46#endif // not XAOD_STANDALONE
47 }

◆ readNjetsHistograms()

StatusCode jet::FlavourUncertaintyComponent::readNjetsHistograms ( std::vector< UncertaintyHistogram * > & hists,
const std::vector< TString > & histKeys )
private

Definition at line 592 of file FlavourUncertaintyComponent.cxx.

593{
594 for (size_t iKey = 0; iKey < histKeys.size(); ++iKey)
595 {
596 const TString& histName = histKeys.at(iKey);
597 int nJets = -1;
598 if (getNjetFromKey(histName,nJets).isFailure())
599 return StatusCode::FAILURE;
600 if (nJets < 0 || nJets >= static_cast<int>(hists.size()))
601 {
602 ATH_MSG_ERROR(Form("Unexpected gluon fraction nJet %d of index %zu: %s",nJets,iKey,histName.Data()));
603 return StatusCode::FAILURE;
604 }
605 if (hists[nJets])
606 {
607 ATH_MSG_ERROR(Form("A histo for nJets of %d was already found, blocking double-creation of %s",nJets,histName.Data()));
608 return StatusCode::FAILURE;
609 }
610 hists[nJets] = new UncertaintyHistogram(histName,m_interpolate);
611 }
612 return StatusCode::SUCCESS;
613}

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_absEta

const bool jet::FlavourUncertaintyComponent::m_absEta
private

Definition at line 55 of file FlavourUncertaintyComponent.h.

◆ m_absEtaGluonFraction

const bool jet::FlavourUncertaintyComponent::m_absEtaGluonFraction
private

Definition at line 56 of file FlavourUncertaintyComponent.h.

◆ m_analysisFileName

const TString jet::FlavourUncertaintyComponent::m_analysisFileName
private

Definition at line 50 of file FlavourUncertaintyComponent.h.

◆ m_analysisHistPattern

const TString jet::FlavourUncertaintyComponent::m_analysisHistPattern
private

Definition at line 51 of file FlavourUncertaintyComponent.h.

◆ m_BjetAccessor

SG::AuxElement::Accessor<char> jet::FlavourUncertaintyComponent::m_BjetAccessor
private

Definition at line 67 of file FlavourUncertaintyComponent.h.

◆ m_calibArea

const TString jet::FlavourUncertaintyComponent::m_calibArea
private

Definition at line 54 of file FlavourUncertaintyComponent.h.

◆ m_defAnaFileName

const TString jet::FlavourUncertaintyComponent::m_defAnaFileName
private

Definition at line 52 of file FlavourUncertaintyComponent.h.

◆ m_energyScale

const float jet::UncertaintyComponent::m_energyScale {}
protectedinherited

Definition at line 55 of file UncertaintyComponent.h.

55{};

◆ m_flavourType

const FlavourComp::TypeEnum jet::FlavourUncertaintyComponent::m_flavourType
private

Definition at line 48 of file FlavourUncertaintyComponent.h.

◆ m_gluonFractionErrorHists

std::vector<UncertaintyHistogram*> jet::FlavourUncertaintyComponent::m_gluonFractionErrorHists
private

Definition at line 73 of file FlavourUncertaintyComponent.h.

◆ m_gluonFractionHists

std::vector<UncertaintyHistogram*> jet::FlavourUncertaintyComponent::m_gluonFractionHists
private

Definition at line 72 of file FlavourUncertaintyComponent.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_interpolate

const Interpolate::TypeEnum jet::UncertaintyComponent::m_interpolate
protectedinherited

Definition at line 56 of file UncertaintyComponent.h.

◆ m_isInit

bool jet::UncertaintyComponent::m_isInit {}
protectedinherited

Definition at line 50 of file UncertaintyComponent.h.

50{};

◆ m_jetType

const TString jet::FlavourUncertaintyComponent::m_jetType
private

Definition at line 49 of file FlavourUncertaintyComponent.h.

◆ m_largeRJetTruthLabelAccessor

SG::AuxElement::Accessor<int> jet::FlavourUncertaintyComponent::m_largeRJetTruthLabelAccessor
private

Definition at line 69 of file FlavourUncertaintyComponent.h.

◆ m_largeRJetTruthLabelName

std::string jet::FlavourUncertaintyComponent::m_largeRJetTruthLabelName
private

Definition at line 59 of file FlavourUncertaintyComponent.h.

◆ m_largeRJetTruthLabels

std::vector<LargeRJetTruthLabel::TypeEnum> jet::FlavourUncertaintyComponent::m_largeRJetTruthLabels
private

Definition at line 62 of file FlavourUncertaintyComponent.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_NjetAccessor

SG::AuxElement::Accessor<int> jet::FlavourUncertaintyComponent::m_NjetAccessor
private

Definition at line 68 of file FlavourUncertaintyComponent.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_numExpectedHist

int jet::UncertaintyComponent::m_numExpectedHist {}
protectedinherited

Definition at line 59 of file UncertaintyComponent.h.

59{};

◆ m_path

const TString jet::FlavourUncertaintyComponent::m_path
private

Definition at line 53 of file FlavourUncertaintyComponent.h.

◆ m_respType

FlavourRespType jet::FlavourUncertaintyComponent::m_respType
private

Definition at line 65 of file FlavourUncertaintyComponent.h.

◆ m_scaleVar

const CompScaleVar::TypeEnum jet::UncertaintyComponent::m_scaleVar
protectedinherited

Definition at line 53 of file UncertaintyComponent.h.

◆ m_secondRespType

FlavourRespType jet::FlavourUncertaintyComponent::m_secondRespType
private

Definition at line 66 of file FlavourUncertaintyComponent.h.

◆ m_secondUncHist

UncertaintyHistogram* jet::FlavourUncertaintyComponent::m_secondUncHist
private

Definition at line 64 of file FlavourUncertaintyComponent.h.

◆ m_secondUncName

const TString jet::FlavourUncertaintyComponent::m_secondUncName
private

Definition at line 57 of file FlavourUncertaintyComponent.h.

◆ m_splitNumber

const int jet::UncertaintyComponent::m_splitNumber {}
protectedinherited

Definition at line 57 of file UncertaintyComponent.h.

57{};

◆ m_topology

const JetTopology::TypeEnum jet::UncertaintyComponent::m_topology
protectedinherited

Definition at line 54 of file UncertaintyComponent.h.

◆ m_uncHist

UncertaintyHistogram* jet::UncertaintyComponent::m_uncHist {}
protectedinherited

Definition at line 60 of file UncertaintyComponent.h.

60{};

◆ m_uncHistName

const TString jet::UncertaintyComponent::m_uncHistName
protectedinherited

Definition at line 51 of file UncertaintyComponent.h.

◆ m_validHist

UncertaintyHistogram* jet::UncertaintyComponent::m_validHist {}
protectedinherited

Definition at line 61 of file UncertaintyComponent.h.

61{};

◆ m_validHistName

const TString jet::UncertaintyComponent::m_validHistName
protectedinherited

Definition at line 52 of file UncertaintyComponent.h.


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