ATLAS Offline Software
Loading...
Searching...
No Matches
met::METSystematicsTool Class Reference

#include <METSystematicsTool.h>

Inheritance diagram for met::METSystematicsTool:
Collaboration diagram for met::METSystematicsTool:

Public Member Functions

 METSystematicsTool (const std::string &name)
StatusCode softTrkSystInitialize ()
StatusCode softCaloSystInitialize ()
StatusCode jetTrkSystInitialize ()
StatusCode initialize ()
 Dummy implementation of the initialisation function.
CP::CorrectionCode applyCorrection (xAOD::MissingET &inputMet, const xAOD::MissingETAssociationHelper &helper) const
CP::CorrectionCode correctedCopy (const xAOD::MissingET &met, xAOD::MissingET *&outputmet, const xAOD::MissingETAssociationHelper &helper) const
bool isAffectedBySystematic (const CP::SystematicVariation &var) const
 Declare the interface that this class provides.
CP::SystematicSet affectingSystematics () const
 the list of all systematics this tool can be affected by
CP::SystematicSet recommendedSystematics () const
 the list of all systematics this tool recommends to use
StatusCode applySystematicVariation (const CP::SystematicSet &set)
 effects: configure this tool for the given list of systematic variations.
StatusCode sysApplySystematicVariation (const CP::SystematicSet &)
 effects: configure this tool for the given list of systematic variations.
void setRandomSeed (unsigned long seed) const
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
const SystematicSetappliedSystematics () const
 returns: the list of systematics that have been applied to this tool.
std::string appliedSystematicsString () const
 returns: a string representation of appliedSystematics() guarantee: strong failures: out of memory II rationale: this is meant to be used when printing out the applied systematics for debugging purposes (or when embedding them in a string).
void testInvariant () const
 effects: test the invariance of this object guarantee: no-fail
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.
StatusCode addAffectingSystematic (const SystematicVariation &systematic, bool recommended)
 effects: add a systematic to the list of registered systematics.
StatusCode addRecommendedSystematic (const SystematicVariation &systematic)
 effects: add a systematic to the list of recommended systematics failures: unsupported systematic
void addAffectingSystematics (const SystematicSet &systematics)
 effects: add a SystematicSet to the registered systematics.
StatusCode addRecommendedSystematics (const SystematicSet &systematics)
 effects: add a SystematicSet to the recommended systematics.

Protected Attributes

SystematicSet m_affectingSystematics
 description: members directly corresponding to accessors
SystematicSet m_recommendedSystematics

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

 FRIEND_TEST (METSystTest, TestDefaultHistosFilled)
 FRIEND_TEST (METSystTest, TestJetTrkHistosFilled)
 FRIEND_TEST (METSystTest, TestAddAffectingSystematic)
 FRIEND_TEST (METSystTest, TestProjectST)
 FRIEND_TEST (METSystTest, TestProjectST2)
 METSystematicsTool ()
CP::CorrectionCode internalSoftTermApplyCorrection (xAOD::MissingET &softMet, xAOD::MissingETContainer const *METcont, xAOD::EventInfo const &eInfo) const
CP::CorrectionCode calcJetTrackMETWithSyst (xAOD::MissingET &jettrkmet, const xAOD::MissingETAssociationHelper &helper) const
CP::CorrectionCode calcJetTrackMETWithSyst (xAOD::MissingET &jettrkmet, const xAOD::MissingETAssociationHelper &helper, const xAOD::Jet *jet) const
CP::CorrectionCode getCorrectedJetTrackMET (xAOD::MissingET &jettrkmet, const xAOD::MissingETAssociationHelper &helper) const
TRandom3 * getTLSRandomGen () const
int getNPV () const
xAOD::EventInfo const * getDefaultEventInfo () const
StatusCode addMETAffectingSystematics ()
StatusCode extractHistoPath (std::string &histfile, std::string &systpath, std::string &configdir, std::string &suffix, SystType const &type)
missingEt calcPtHard (xAOD::MissingETContainer const *const cont) const
missingEt variedSoftTerm (missingEt const &softTerms, missingEt const &ptHard, double varPara, double varPerp) const
missingEt projectST (missingEt const &softTerms, missingEt const &ptHard) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SystApplied m_appliedSystEnum {NONE}
Gaudi::Property< std::string > m_configPrefix {this, "ConfigPrefix", "METUtilities/R22_PreRecs", ""}
Gaudi::Property< std::string > m_configSoftTrkFile {this, "ConfigSoftTrkFile", "TrackSoftTerms-pflow_Dec24.config", ""}
Gaudi::Property< std::string > m_configJetTrkFile {this, "ConfigJetTrkFile", "", ""}
Gaudi::Property< std::string > m_configSoftCaloFile {this, "ConfigSoftCaloFile", "", ""}
Gaudi::Property< boolm_useDevArea {this, "UseDevArea", false, ""}
std::unique_ptr< TH3D > m_trk_shiftpara_pthard_njet_mu {}
std::unique_ptr< TH3D > m_trk_resopara_pthard_njet_mu {}
std::unique_ptr< TH3D > m_trk_resoperp_pthard_njet_mu {}
std::unique_ptr< TH3D > m_calo_shiftpara_pthard_njet_mu {}
std::unique_ptr< TH3D > m_calo_resopara_pthard_njet_mu {}
std::unique_ptr< TH3D > m_calo_resoperp_pthard_njet_mu {}
std::unique_ptr< TH2D > m_jet_systRpt_pt_eta {}
boost::thread_specific_ptr< TRandom3 > m_rand_tls
int m_units {-1}
SG::ReadHandleKey< xAOD::VertexContainerm_VertexContKey {this, "VertexContainer", "PrimaryVertices", ""}
SG::ReadHandleKey< xAOD::MissingETContainerm_TruthContKey {this, "TruthContainer", "MET_Truth", ""}
SG::ReadHandleKey< xAOD::EventInfom_EventInfoKey {this, "EventInfo", "EventInfo", ""}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
SystematicSetm_appliedSystematics
 description: pointer to currenty applied systematics
std::unordered_map< SystematicSet, SystematicSetm_systFilterMap
 map of cached systematics filtering

Detailed Description

Definition at line 84 of file METSystematicsTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ METSystematicsTool() [1/2]

met::METSystematicsTool::METSystematicsTool ( const std::string & name)

Definition at line 31 of file METSystematicsTool.cxx.

33 {
34 ATH_MSG_DEBUG (__PRETTY_FUNCTION__ );
35
36 applySystematicVariation(CP::SystematicSet()).ignore();
37 }
#define ATH_MSG_DEBUG(x)
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition AsgTool.cxx:58
StatusCode applySystematicVariation(const CP::SystematicSet &set)
effects: configure this tool for the given list of systematic variations.

◆ METSystematicsTool() [2/2]

met::METSystematicsTool::METSystematicsTool ( )
private

Member Function Documentation

◆ addAffectingSystematic()

StatusCode CP::SystematicsTool::addAffectingSystematic ( const SystematicVariation & systematic,
bool recommended )
protectedinherited

effects: add a systematic to the list of registered systematics.

It will optionally also add this sytematic to the recommended set. side effects: this will add the systematic to the global list of systematics, if not already there guarantee: strong failures: out of memory II

Definition at line 111 of file SystematicsTool.cxx.

112 {
113
114 RCU_READ_INVARIANT( this );
115
116 SystematicRegistry& reg = SystematicRegistry::getInstance();
117 reg.registerSystematic( systematic );
118 m_affectingSystematics.insert( systematic );
119 if( recommended ) {
120 if( addRecommendedSystematic(systematic) != StatusCode::SUCCESS ) {
121 return StatusCode::FAILURE;
122 }
123 }
124 return StatusCode::SUCCESS;
125 }
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
StatusCode addRecommendedSystematic(const SystematicVariation &systematic)
effects: add a systematic to the list of recommended systematics failures: unsupported systematic
SystematicSet m_affectingSystematics
description: members directly corresponding to accessors

◆ addAffectingSystematics()

void CP::SystematicsTool::addAffectingSystematics ( const SystematicSet & systematics)
protectedinherited

effects: add a SystematicSet to the registered systematics.

Definition at line 141 of file SystematicsTool.cxx.

142 {
143
144 RCU_READ_INVARIANT( this );
145
146 SystematicRegistry& reg = SystematicRegistry::getInstance();
148 reg.registerSystematics( systematics );
149 }
static const std::vector< std::string > systematics

◆ addMETAffectingSystematics()

StatusCode met::METSystematicsTool::addMETAffectingSystematics ( )
private

Definition at line 39 of file METSystematicsTool.cxx.

39 {
40 ATH_MSG_VERBOSE (__PRETTY_FUNCTION__ );
41
42 if(!m_configSoftTrkFile.empty()){
43 if( !(addAffectingSystematic( softTrkAffSyst::MET_SoftTrk_ScaleUp , true /*recommended */ ) &&
47 addAffectingSystematic( softTrkAffSyst::MET_SoftTrk_ResoCorr , false /*not recommended */) ) ) {
48 ATH_MSG_ERROR("failed to properly add softTrk affecting systematics " );
49 return StatusCode::FAILURE;
50 }
51 }
52 if(!m_configSoftCaloFile.empty()){
58 ATH_MSG_ERROR("failed to properly add softCalo affecting systematics " );
59 return StatusCode::FAILURE;
60 }
61 }
62 if(!m_configJetTrkFile.empty()){
63 if( !(addAffectingSystematic( jetTrkAffSyst::MET_JetTrk_ScaleUp , true /*recommended */ ) &&
65 ATH_MSG_ERROR("failed to properly add jetTrk affecting systematics " );
66 return StatusCode::FAILURE;
67 }
68 }
69
70 ATH_MSG_INFO( "AffectingSystematics are:" );
71 for(const auto& syst : m_affectingSystematics) {
72 ATH_MSG_INFO( syst.name() );
73 }
74
75 ATH_MSG_DEBUG("These systematics are set based on your config files: " );
76 ATH_MSG_DEBUG("ConfigSoftTrkFile: " << m_configSoftTrkFile );
77 ATH_MSG_DEBUG("ConfigSoftCaloFile: "<< m_configSoftCaloFile);
78 ATH_MSG_DEBUG("ConfigSoftJetFile: " << m_configJetTrkFile );
79
80 return StatusCode::SUCCESS;
81 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
StatusCode addAffectingSystematic(const SystematicVariation &systematic, bool recommended)
effects: add a systematic to the list of registered systematics.
Gaudi::Property< std::string > m_configSoftCaloFile
Gaudi::Property< std::string > m_configSoftTrkFile
Gaudi::Property< std::string > m_configJetTrkFile
static const CP::SystematicVariation MET_JetTrk_ScaleDown("MET_JetTrk_Scale__1down")
static const CP::SystematicVariation MET_JetTrk_ScaleUp("MET_JetTrk_Scale__1up")
static const CP::SystematicVariation MET_SoftCalo_ResoPara("MET_SoftCalo_ResoPara")
static const CP::SystematicVariation MET_SoftCalo_ResoPerp("MET_SoftCalo_ResoPerp")
static const CP::SystematicVariation MET_SoftCalo_ScaleUp("MET_SoftCalo_Scale__1up")
static const CP::SystematicVariation MET_SoftCalo_ScaleDown("MET_SoftCalo_Scale__1down")
static const CP::SystematicVariation MET_SoftCalo_ResoCorr("MET_SoftCalo_ResoCorr")
static const CP::SystematicVariation MET_SoftTrk_ResoPara("MET_SoftTrk_ResoPara")
static const CP::SystematicVariation MET_SoftTrk_ResoPerp("MET_SoftTrk_ResoPerp")
static const CP::SystematicVariation MET_SoftTrk_ResoCorr("MET_SoftTrk_ResoCorr")
static const CP::SystematicVariation MET_SoftTrk_ScaleDown("MET_SoftTrk_Scale__1down")
static const CP::SystematicVariation MET_SoftTrk_ScaleUp("MET_SoftTrk_Scale__1up")

◆ addRecommendedSystematic()

StatusCode CP::SystematicsTool::addRecommendedSystematic ( const SystematicVariation & systematic)
protectedinherited

effects: add a systematic to the list of recommended systematics failures: unsupported systematic

Definition at line 127 of file SystematicsTool.cxx.

128 {
129
130 RCU_READ_INVARIANT( this );
131
132 SystematicRegistry& reg = SystematicRegistry::getInstance();
133 m_recommendedSystematics.insert( systematic );
134 if( reg.addSystematicToRecommended( systematic ) !=
135 StatusCode::SUCCESS ) {
136 return StatusCode::FAILURE;
137 }
138 return StatusCode::SUCCESS;
139 }
SystematicSet m_recommendedSystematics

◆ addRecommendedSystematics()

StatusCode CP::SystematicsTool::addRecommendedSystematics ( const SystematicSet & systematics)
protectedinherited

effects: add a SystematicSet to the recommended systematics.

Definition at line 151 of file SystematicsTool.cxx.

152 {
153
154 RCU_READ_INVARIANT( this );
155
156 SystematicRegistry& reg = SystematicRegistry::getInstance();
158 if( reg.addSystematicsToRecommended( systematics ) !=
159 StatusCode::SUCCESS ) {
160 return StatusCode::FAILURE;
161 }
162 return StatusCode::SUCCESS;
163 }

◆ affectingSystematics()

CP::SystematicSet met::METSystematicsTool::affectingSystematics ( ) const
inlinevirtual

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 125 of file METSystematicsTool.h.

virtual SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of ...

◆ appliedSystematics()

const SystematicSet & CP::SystematicsTool::appliedSystematics ( ) const
inherited

returns: the list of systematics that have been applied to this tool.

this is not including systematics that were applied, but do not affect this tool guarantee: no-fail

Definition at line 54 of file SystematicsTool.cxx.

54 {
55
56 RCU_READ_INVARIANT( this );
57 if(m_appliedSystematics == 0){
58 std::cerr << "SystematicsTool::appliedSystematics WARNING: "
59 << "no systematic configuration has been applied yet. "
60 << "Returning NULL" << std::endl;
61 static const SystematicSet dummy;
62 return dummy;
63 }
65 }
SystematicSet * m_appliedSystematics
description: pointer to currenty applied systematics

◆ appliedSystematicsString()

std::string CP::SystematicsTool::appliedSystematicsString ( ) const
inherited

returns: a string representation of appliedSystematics() guarantee: strong failures: out of memory II rationale: this is meant to be used when printing out the applied systematics for debugging purposes (or when embedding them in a string).

Definition at line 67 of file SystematicsTool.cxx.

67 {
68
69 RCU_READ_INVARIANT( this );
70 return m_appliedSystematics->name();
71 }

◆ applyCorrection()

CP::CorrectionCode met::METSystematicsTool::applyCorrection ( xAOD::MissingET & inputMet,
const xAOD::MissingETAssociationHelper & helper ) const
virtual

Implements IMETSystematicsTool.

Definition at line 236 of file METSystematicsTool.cxx.

237 {
238
239 //if asking for jet track systematics, the user needs to give a met association helper (with a map) as well
240 //if using a different jetContainer, you can give it as an option to applyCorrection
241 ATH_MSG_VERBOSE (__PRETTY_FUNCTION__ );
242
243 if( getDefaultEventInfo() == nullptr) {
244 ATH_MSG_WARNING("event info is empty, returning without applying correction");
246 }
247
249 ATH_MSG_WARNING("This tool should be applied to MC only. Return without changing the input MET object");
251 }
252
254
255 xAOD::MissingETContainer const * METcont = dynamic_cast<xAOD::MissingETContainer const*>(inputMet.container());
256 if(METcont == nullptr){
257 ATH_MSG_WARNING("MissingET object not owned by a container. Returning without applying correction" );
259 }
260
261 return internalSoftTermApplyCorrection(inputMet, METcont, *getDefaultEventInfo());
262 }
263
265 ){
266 if( helper.map() == nullptr) {
267 ATH_MSG_WARNING("The MissingETAssociationMap for the given MissingETAssociationHelper is null. Returning without applying correction ");
269 }
270
271 return getCorrectedJetTrackMET(inputMet, helper);
272 }
273
274 ATH_MSG_WARNING("METSystematicsTool received a MissingET object it can't correct. You should only pass soft MET terms or jet track MET terms.");
276 }
#define ATH_MSG_WARNING(x)
bool const RAWDATA *ch2 const
@ Error
Some error happened during the object correction.
const SG::AuxVectorData * container() const
Return the container holding this element.
CP::CorrectionCode internalSoftTermApplyCorrection(xAOD::MissingET &softMet, xAOD::MissingETContainer const *METcont, xAOD::EventInfo const &eInfo) const
CP::CorrectionCode getCorrectedJetTrackMET(xAOD::MissingET &jettrkmet, const xAOD::MissingETAssociationHelper &helper) const
xAOD::EventInfo const * getDefaultEventInfo() const
@ IS_SIMULATION
true: simulation, false: data
MissingETBase::Types::bitmask_t source() const
MET object source tag.
static bool isSoftTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)
static bool isJetTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)

◆ applySystematicVariation()

StatusCode met::METSystematicsTool::applySystematicVariation ( const CP::SystematicSet & systConfig)
inlinevirtual

effects: configure this tool for the given list of systematic variations.

any requested systematics that are not affecting this tool will be silently ignored (unless they cause other errors). failures: systematic unknown failures: requesting multiple variations on the same systematic (e.g. up & down) failures: requesting an unsupported variation on an otherwise supported systematic (e.g. a 2 sigma variation and the tool only supports 1 sigma variations) failures: unsupported combination of supported systematic failures: other tool specific errors

Implements CP::ISystematicsTool.

Definition at line 127 of file METSystematicsTool.h.

virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)
effects: configure this tool for the given list of systematic variations.

◆ calcJetTrackMETWithSyst() [1/2]

CP::CorrectionCode met::METSystematicsTool::calcJetTrackMETWithSyst ( xAOD::MissingET & jettrkmet,
const xAOD::MissingETAssociationHelper & helper ) const
private

Definition at line 500 of file METSystematicsTool.cxx.

501 {
502 ATH_MSG_VERBOSE(__PRETTY_FUNCTION__);
503
504 if( m_jet_systRpt_pt_eta == nullptr ) {
505 ATH_MSG_ERROR("jet track systematics histogram not initialized properly.") ;
507 }
508
511
512 double uncert = 0.;
513 int jetCount=0;
514
515 std::vector<const xAOD::Jet*> jets;
516 for(const iplink_t& jetlink : acc_constitObjLinks(jettrkmet)) {
517 if((*jetlink)->type()!=xAOD::Type::Jet) {
518 ATH_MSG_ERROR("Invalid object of type " << (*jetlink)->type() << " in jet term");
520 }
521 jets.push_back(static_cast<const xAOD::Jet*>(*jetlink));
522 }
523 bool originalInputs = jets.empty() ? false : !acc_originalObject.isAvailable(*jets.front());
524 for(const xAOD::Jet *jet : jets) {
525 const MissingETAssociation* assoc = nullptr;
526 const MissingETAssociationMap* map = helper.map();
527 if(originalInputs) {
529 } else {
530 const IParticle* orig = *acc_originalObject(*jet);
531 assoc = MissingETComposition::getAssociation(map,static_cast<const xAOD::Jet*>(orig));
532 }
533 MissingETBase::Types::constvec_t trkvec = assoc->jetTrkVec();
534 if(std::abs(jet->eta())<=2.5){
535 jetCount++;
536 int phbin = std::as_const(m_jet_systRpt_pt_eta)->GetXaxis()->FindBin(jet->pt()/1e3);
537 if(phbin>m_jet_systRpt_pt_eta->GetNbinsX()) phbin = m_jet_systRpt_pt_eta->GetNbinsX();
538
539 int etabin = std::as_const(m_jet_systRpt_pt_eta)->GetYaxis()->FindBin(std::abs( jet->eta() ));
540 if(etabin>m_jet_systRpt_pt_eta->GetNbinsY()) etabin = m_jet_systRpt_pt_eta->GetNbinsY();
541 float uncert_frac=(trkvec.sumpt())*(m_jet_systRpt_pt_eta->GetBinContent(phbin, etabin));
542
543 ATH_MSG_VERBOSE("Sumpt: "<< trkvec.sumpt());
544 ATH_MSG_VERBOSE("jet uncert: "<< m_jet_systRpt_pt_eta->GetBinContent(phbin, etabin));
545 uncert = std::sqrt(uncert*uncert+uncert_frac*uncert_frac);
546 }
547 }
548
549 ATH_MSG_VERBOSE("Uncertainty: "<< uncert);
550 ATH_MSG_VERBOSE("Jet Counting: "<< jetCount);
551
552 // Flip sign for down variation
553 if(m_appliedSystEnum == MET_JETTRK_SCALEDOWN) uncert *= -1.;
554
555 jettrkmet.setMpx ( jettrkmet.mpx()*(1 + uncert/(std::abs(jettrkmet.mpx())*std::sqrt(2))));
556 jettrkmet.setMpy ( jettrkmet.mpy()*(1 + uncert/(std::abs(jettrkmet.mpy())*std::sqrt(2))));
557 jettrkmet.setSumet( jettrkmet.sumet() + uncert);
558
560 }
@ Ok
The correction was done successfully.
std::unique_ptr< TH2D > m_jet_systRpt_pt_eta
float sumpt() const
Returns sum of component pt.
void setMpy(float value)
Set the component.
float sumet() const
Returns.
void setMpx(float value)
Set the component.
float mpx() const
Returns .
float mpy() const
Returns .
void setSumet(float value)
Set .
xAOD::MissingETAssociation_v1::ConstVec constvec_t
Type for constituent vector.
ElementLink< xAOD::IParticleContainer > iplink_t
static const SG::AuxElement::ConstAccessor< iplink_t > acc_originalObject("originalObjectLink")
@ MET_JETTRK_SCALEDOWN
@ MET_JETTRK_SCALEUP
static const SG::AuxElement::ConstAccessor< std::vector< iplink_t > > acc_constitObjLinks("ConstitObjectLinks")
@ Jet
The object is a jet.
Definition ObjectType.h:40
Jet_v1 Jet
Definition of the current "jet version".
MissingETAssociation_v1 MissingETAssociation
Version control by type definition.
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
static const MissingETAssociation * getAssociation(const MissingETAssociationMap *pMap, const Jet *pJet)

◆ calcJetTrackMETWithSyst() [2/2]

CP::CorrectionCode met::METSystematicsTool::calcJetTrackMETWithSyst ( xAOD::MissingET & jettrkmet,
const xAOD::MissingETAssociationHelper & helper,
const xAOD::Jet * jet ) const
private

Definition at line 457 of file METSystematicsTool.cxx.

459 {
460 ATH_MSG_VERBOSE(__PRETTY_FUNCTION__);
461
462 if( m_jet_systRpt_pt_eta == nullptr ) {
463 ATH_MSG_ERROR("jet track systematics histogram not initialized properly.") ;
465 }
466
469 MissingETBase::Types::constvec_t trkvec = assoc->overlapTrkVec(helper);
470
471 int phbin = std::as_const(m_jet_systRpt_pt_eta)->GetXaxis()->FindBin(jet->pt()/1e3);
472 if(phbin>m_jet_systRpt_pt_eta->GetNbinsX()) phbin = m_jet_systRpt_pt_eta->GetNbinsX();
473
474 int etabin = std::as_const(m_jet_systRpt_pt_eta)->GetYaxis()->FindBin(std::abs( jet->eta() ));
475 if(etabin>m_jet_systRpt_pt_eta->GetNbinsY()) etabin = m_jet_systRpt_pt_eta->GetNbinsY();
476
477 double uncert = 0.;
478 switch( m_appliedSystEnum ){
479 case MET_JETTRK_SCALEUP : {
480 uncert = m_jet_systRpt_pt_eta->GetBinContent(phbin,etabin);
481 break;
482 }
483 case MET_JETTRK_SCALEDOWN : {
484 uncert = -1.*m_jet_systRpt_pt_eta->GetBinContent(phbin,etabin);
485 break;
486 }
487 default:
488 break;
489 }
490
491 ATH_MSG_VERBOSE("Uncertainty on this jet is " << uncert);
492
493 jettrkmet.setMpx ( jettrkmet.mpx() - trkvec.cpx() * uncert);
494 jettrkmet.setMpy ( jettrkmet.mpy() - trkvec.cpy() * uncert);
495 } else { ATH_MSG_VERBOSE("No jet track systematics applied"); }
496
498 }
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
ConstVec overlapTrkVec(const MissingETAssociationHelper &helper) const
Retrieve total track-based vector to be subtracted from the jet.

◆ calcPtHard()

missingEt met::METSystematicsTool::calcPtHard ( xAOD::MissingETContainer const *const cont) const
private

Definition at line 606 of file METSystematicsTool.cxx.

607 {
608 ATH_MSG_VERBOSE(__PRETTY_FUNCTION__ );
609
610 //get truth container
611 SG::ReadHandle<xAOD::MissingETContainer> truthCont(m_TruthContKey);
612 if (!truthCont.isValid()) {
613
614 ATH_MSG_ERROR( m_TruthContKey.key() << " container empty or doesn't exist, calcPtHard returning zero.");
615 return {};
616 }
617
619 if(truthiter == truthCont->end()){
620 ATH_MSG_ERROR( "NonInt is not in " << m_TruthContKey.key() << ". calcPtHard returing zero." );
621 return {};
622 }
623 const xAOD::MissingET& truthmet = **truthiter;
624
625 missingEt ptHard;
626 ptHard.mpx = truthmet.mpx();
627 ptHard.mpy = truthmet.mpy();
628 ptHard.sumet = truthmet.sumet();
629 ptHard.name = truthmet.name();
630 ptHard.source = truthmet.source();
631
632 //loop over all non soft or total terms
633 for(xAOD::MissingETContainer::const_iterator iMET=cont->begin();iMET!=cont->end(); ++iMET ) {
634 if( !( MissingETBase::Source::isSoftTerm( (*iMET)->source() ) ||
635 MissingETBase::Source::isTotalTerm( (*iMET)->source() ) ) ) {
636 ptHard.mpx -= (*iMET)->mpx();
637 ptHard.mpy -= (*iMET)->mpy();
638 ptHard.sumet += (*iMET)->sumet();
639 }
640 }
641
642 if( ptHard.sumet < 0 ) {
643 ATH_MSG_ERROR("PtHard has a negative sumet, returning ptHart = 0");
644 return {};
645 }
646
647 ptHard.mpx *= 1./(double(m_units)) ;
648 ptHard.mpy *= 1./(double(m_units)) ;
649 ptHard.sumet*= 1./(double(m_units)) ;
650
651 // protect from zero pthard. protects against an empty pthard for the soft term systematic
652 if(ptHard.sumet<1.0e-6){
653 ptHard.sumet=1.0e-6;
654 ptHard.mpx=1.0e-6;
655 ptHard.mpy=0.0;
656 }
657
658 return ptHard;
659 }
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
SG::ReadHandleKey< xAOD::MissingETContainer > m_TruthContKey
const std::string & name() const
Identifier getters.
MissingET_v1 MissingET
Version control by type defintion.
static Types::bitmask_t truthNonInt()
Standard bit pattern indicating genuine true MET.
static bool isTotalTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)

◆ correctedCopy()

CP::CorrectionCode met::METSystematicsTool::correctedCopy ( const xAOD::MissingET & met,
xAOD::MissingET *& outputmet,
const xAOD::MissingETAssociationHelper & helper ) const
virtual

Implements IMETSystematicsTool.

Definition at line 279 of file METSystematicsTool.cxx.

281 { ATH_MSG_VERBOSE (__PRETTY_FUNCTION__ );
282 xAOD::MissingET * copy = nullptr;
283
284 if(outputmet != nullptr ){
285 ATH_MSG_WARNING("Please pass a nullptr to the 2nd argument of correctedCopy to fill the output pointer");
286 ATH_MSG_WARNING("Returning without making a correctedCopy");
288 }
289
290 if( getDefaultEventInfo() == nullptr) {
291 ATH_MSG_WARNING("event info is empty, return a nullptr");
292 outputmet = nullptr;
294 }
295
297 ATH_MSG_WARNING("This tool should be applied to MC only. Return without changing the input MET object");
298 outputmet = nullptr;
300 }
301
303 xAOD::MissingETContainer const * METcont = dynamic_cast<xAOD::MissingETContainer const*>(met.container());
304 if(METcont == nullptr){
305 ATH_MSG_WARNING("MissingET object not owned by a container. Unable to apply correction, returning output MET object as null" );
306 outputmet = nullptr;
308 }
309 copy = new xAOD::MissingET(met);
310
312 outputmet = nullptr; delete copy;
314 }
315 }//soft term source
316 if( //MissingETBase::Source::isTrackTerm(met.source()) &&
318 if( helper.map() == nullptr) {
319 ATH_MSG_WARNING("MissingETAssociationHelper contained a null MissingETAssociationMap pointer");
320 outputmet = nullptr; delete copy;
322 }
323 delete copy;
324 copy = new xAOD::MissingET(met);
326 outputmet = nullptr; delete copy;
328 }
329 }//jet track term source
330
331 outputmet = copy;
333 }
bool copy
Definition calibdata.py:26

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extractHistoPath()

StatusCode met::METSystematicsTool::extractHistoPath ( std::string & histfile,
std::string & systpath,
std::string & configdir,
std::string & suffix,
SystType const & type )
private

Definition at line 661 of file METSystematicsTool.cxx.

666 {
667 ATH_MSG_VERBOSE (__PRETTY_FUNCTION__);
668 TEnv reader;
669
670 std::string configpath = "";
671 std::string configfile = "";
672 if(m_useDevArea) { configpath += "dev/"; }
673
674 switch(type){
675 case SOFTCALO : configfile += m_configSoftCaloFile.value();
677 break;
678 case SOFTTRK : configfile += m_configSoftTrkFile.value();
680 break;
681 case JETTRK : configfile += m_configJetTrkFile.value();
682 configpath = PathResolverFindCalibFile(m_configPrefix.value()+m_configJetTrkFile.value());
683 break;
684 default : configpath = "";
685 }
686
687 ATH_MSG_INFO( "Searching for configFile: " << configfile);
688 ATH_MSG_DEBUG( "PWD: " << gSystem->Getenv("PWD") ) ;
689 ATH_MSG_DEBUG( "CALIBPATH: " << gSystem->Getenv("CALIBPATH") );
690
691 if(configpath.empty() || configfile.empty() ){
692 ATH_MSG_ERROR( "Path Resolver couldn't find config file");
693 return StatusCode::FAILURE;
694 }
695
696 if( reader.ReadFile(configpath.c_str(),EEnvLevel(0)) < 0) {
697 ATH_MSG_ERROR( "Couldn't read the track config file!" );
698 return StatusCode::FAILURE;
699 }
700
701 ATH_MSG_INFO( "Configuring from file : " << configpath );
702
703
704 switch(type){
705 case SOFTCALO:
706 histfile = reader.GetValue( "Conf.InputFile" , "");
707 systpath = reader.GetValue( "GlobalSyst.sourcedir" , "" );
708 break;
709 case SOFTTRK:
710 histfile = reader.GetValue( "Conf.InputFile" , "");
711 systpath = reader.GetValue( "PtHardSyst.sourcedir" , "" );
712 suffix = reader.GetValue( "PtHardSyst.suffix" , "" );
713 break;
714 case JETTRK:
715 histfile = reader.GetValue( "JetTrkSyst.InputFile" , "");
716 histfile = m_configPrefix + histfile;
717 systpath = "/";
718 break;
719 default:
720 break;
721 }
722 if(m_useDevArea) histfile = "dev/"+histfile;
723
724 std::string const units_string = reader.GetValue( "Units", "" );
725
726 //check if we already set the units in another config file
727 if(m_units == 1000){
728 if(units_string != "GeV"){
729 ATH_MSG_ERROR("initialized the different systematics using two config files that conflict on units");
730 return StatusCode::FAILURE;
731 }
732 }
733 if(m_units == 1){
734 if( (!units_string.empty()) && (units_string != "MeV")){
735 ATH_MSG_ERROR("initialized the different systematics using two config files that conflict on units");
736 return StatusCode::FAILURE;
737 }
738 }
739
740 //set the units again
741 if( (units_string.empty()) || (units_string == "MeV") ){
742 m_units = 1;
743 }else if(units_string == "GeV"){
744 m_units = 1000;
745 }else{
746 ATH_MSG_ERROR("You specified an incorrect 'Units' value. Please specify MeV , GeV , or leave it blank for MeV");
747 return StatusCode::FAILURE;
748 }
749
750 ATH_MSG_INFO( "Will read histograms from : " << histfile );
751 ATH_MSG_DEBUG( "Systpath :" << systpath ) ;
753 ATH_MSG_INFO("Extracted histogram path : " << histpath);
754
755 if(histfile.empty() || systpath.empty() || histpath.empty() ){
756 ATH_MSG_ERROR("Failed to correctly set histfile path, or path to histograms inside of the histfile" );
757 return StatusCode::FAILURE;
758 }
759
760
761 if( (m_units != 1) && (m_units != 1000) && (m_units != -1)){
762 ATH_MSG_ERROR("Something is wrong with your units initialization. Please contact the developers (you should never get here).");
763 return StatusCode::FAILURE;
764 }
765
766 return StatusCode::SUCCESS;
767 }
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Gaudi::Property< std::string > m_configPrefix
Gaudi::Property< bool > m_useDevArea
reader
read the goodrunslist xml file(s)
Definition collisions.py:22

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ FRIEND_TEST() [1/5]

met::METSystematicsTool::FRIEND_TEST ( METSystTest ,
TestAddAffectingSystematic  )
private

◆ FRIEND_TEST() [2/5]

met::METSystematicsTool::FRIEND_TEST ( METSystTest ,
TestDefaultHistosFilled  )
private

◆ FRIEND_TEST() [3/5]

met::METSystematicsTool::FRIEND_TEST ( METSystTest ,
TestJetTrkHistosFilled  )
private

◆ FRIEND_TEST() [4/5]

met::METSystematicsTool::FRIEND_TEST ( METSystTest ,
TestProjectST  )
private

◆ FRIEND_TEST() [5/5]

met::METSystematicsTool::FRIEND_TEST ( METSystTest ,
TestProjectST2  )
private

◆ getCorrectedJetTrackMET()

CP::CorrectionCode met::METSystematicsTool::getCorrectedJetTrackMET ( xAOD::MissingET & jettrkmet,
const xAOD::MissingETAssociationHelper & helper ) const
private

Definition at line 562 of file METSystematicsTool.cxx.

564 {
565
566 const MissingETAssociationMap* map = helper.map();
567 if(!map) {
568 ATH_MSG_ERROR("MissingETAssociationMap null, error calculating jet track systematics.");
570 }
571
572 if(calcJetTrackMETWithSyst(jettrkmet, helper) != CP::CorrectionCode::Ok){
573 ATH_MSG_ERROR("Failed to calculate jet track systematics.");
575 }
577 }
CP::CorrectionCode calcJetTrackMETWithSyst(xAOD::MissingET &jettrkmet, const xAOD::MissingETAssociationHelper &helper) const

◆ getDefaultEventInfo()

xAOD::EventInfo const * met::METSystematicsTool::getDefaultEventInfo ( ) const
private

Definition at line 771 of file METSystematicsTool.cxx.

772 {
773
774 SG::ReadHandle<xAOD::EventInfo> eInfoConst(m_EventInfoKey);
775 if (!eInfoConst.isValid()) {
776
777 ATH_MSG_ERROR("Failed to retrieve default EventInfo object");
778 }
779 return &*eInfoConst;
780 }
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getNPV()

int met::METSystematicsTool::getNPV ( ) const
private

Definition at line 782 of file METSystematicsTool.cxx.

782 {
783 SG::ReadHandle<xAOD::VertexContainer> vertices(m_VertexContKey);
784
785 if (!vertices.isValid()) {
786
787 ATH_MSG_ERROR("Failed to retrieve default NPV value from PrimaryVertices");
788 return 0;
789 }
790
791 int NPV = 0;
793 for (itr = vertices->begin(); itr != vertices->end(); ++itr)
794 if ( (*itr)->vertexType() != xAOD::VxType::NoVtx) NPV++;
795
796 return NPV;
797 }
SG::ReadHandleKey< xAOD::VertexContainer > m_VertexContKey
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ getTLSRandomGen()

TRandom3 * met::METSystematicsTool::getTLSRandomGen ( ) const
private

Definition at line 799 of file METSystematicsTool.cxx.

799 {
800 TRandom3* random = m_rand_tls.get();
801 if (!random) {
802 random = new TRandom3();
803 m_rand_tls.reset(random);
804 }
805 return random;
806 }
boost::thread_specific_ptr< TRandom3 > m_rand_tls

◆ initialize()

StatusCode met::METSystematicsTool::initialize ( void )
virtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 83 of file METSystematicsTool.cxx.

84 {
85 ATH_MSG_VERBOSE (__PRETTY_FUNCTION__ );
86 // ReadHandleKey(s)
87
88 ATH_CHECK( m_VertexContKey.initialize() );
89 ATH_CHECK( m_TruthContKey.initialize() );
90 ATH_CHECK( m_EventInfoKey.initialize() );
91
92 const char lastchar = m_configPrefix.value().back();
93 if (lastchar != '/') {
94 m_configPrefix = m_configPrefix.value() + "/";
95 }
96
97 if(m_configSoftTrkFile.empty() &&
98 m_configSoftCaloFile.empty() &&
99 m_configJetTrkFile.empty() ) ATH_MSG_WARNING("you have initialized the METSystematicsTool with no configuration file. The tool will do nothing. Please set the configuration file properties.");
100
104
106 }
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ internalSoftTermApplyCorrection()

CP::CorrectionCode met::METSystematicsTool::internalSoftTermApplyCorrection ( xAOD::MissingET & softMet,
xAOD::MissingETContainer const * METcont,
xAOD::EventInfo const & eInfo ) const
private

Definition at line 335 of file METSystematicsTool.cxx.

338 { //this is equivalent of "getSoftTerms"
339
340 ATH_MSG_VERBOSE( __PRETTY_FUNCTION__ );
341
342
343 if( ! MissingETBase::Source::isSoftTerm(softMet.source()) ){
344 ATH_MSG_ERROR("not soft met, cannot apply soft term correction to this MET");
346 }
347
348 bool doSyst = false;
351 ATH_MSG_VERBOSE("Track soft term " << softMet.name()
352 << ", met = " << softMet.met()
353 << ", applied systematic is " << m_appliedSystEnum
354 << ", do syst? " << doSyst);
355 } else {
357 ATH_MSG_VERBOSE("Calo soft term " << softMet.name()
358 << ", met = " << softMet.met()
359 << ", applied systematic is " << m_appliedSystEnum
360 << ", do syst? " << doSyst);
361 }
362
363 if(!doSyst) {
364 ATH_MSG_DEBUG("Ignore irrelevant systematic.");
366 }
367
368 //this is for speed
369 //we avoid creating met private stores here
370 missingEt softMetStruct;
371 softMetStruct.mpx = softMet.mpx();
372 softMetStruct.mpy = softMet.mpy();
373 softMetStruct.sumet = softMet.sumet();
374 softMetStruct.name = softMet.name();
375 softMetStruct.source = softMet.source();
376
377 if(METcont == nullptr){
378 ATH_MSG_WARNING("failed to retrieve MET container from passed object");
380 }
381
382 missingEt const ptHard = calcPtHard(METcont);
383 double const ptHardMet = std::sqrt( ptHard.mpx * ptHard.mpx +
384 ptHard.mpy * ptHard.mpy ) ;
385
386 const xAOD::MissingET* jetterm = *METcont->find( MissingETBase::Source::jet() );
387 size_t njet = (jetterm==nullptr) ? 0 : acc_constitObjLinks(*jetterm ).size();
388
389 const std::unique_ptr<TH3D>* shiftHist = (MissingETBase::Source::isTrackTerm(softMetStruct.source) ? &m_trk_shiftpara_pthard_njet_mu : &m_calo_shiftpara_pthard_njet_mu);
390
391 int phbin = std::as_const(*shiftHist)->GetXaxis()->FindBin( ptHardMet ) ;
392 if(phbin>(*shiftHist)->GetNbinsX()) phbin = (*shiftHist)->GetNbinsX();
393
394 int const jetbin = std::as_const(*shiftHist)->GetYaxis()->FindBin(njet);
395 int const mubin = std::as_const(*shiftHist)->GetZaxis()->FindBin(eInfo.actualInteractionsPerCrossing() );
396 double const scalePara = (*shiftHist)->GetBinContent(phbin,jetbin,mubin);
397
398 double const randGaus = getTLSRandomGen()->Gaus(0.,1.);
399 double smearPara(0), smearPerp(0);
400
401 ATH_MSG_DEBUG("About to apply systematic " << appliedSystematicsString() );
402
403 //now we need to know what soft term systematics we are doing
404 //m_appliedSystEnum was cached by the applySystematicVariation method
405 switch( m_appliedSystEnum ){
408 softMetStruct = variedSoftTerm(softMetStruct, ptHard, scalePara, 0.);
409 break;
412 softMetStruct = variedSoftTerm(softMetStruct, ptHard, -1.*scalePara, 0.);
413 break;
415 smearPara = m_trk_resopara_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
416 softMetStruct = variedSoftTerm(softMetStruct, ptHard, smearPara, 0.);
417 break;
419 smearPerp = m_trk_resoperp_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
420 softMetStruct = variedSoftTerm(softMetStruct, ptHard, 0., smearPerp);
421 break;
423 smearPara = m_trk_resopara_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
424 smearPerp = m_trk_resoperp_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
425 softMetStruct = variedSoftTerm(softMetStruct, ptHard, smearPara, smearPerp);
426 break;
428 smearPara = m_calo_resopara_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
429 softMetStruct = variedSoftTerm(softMetStruct, ptHard, smearPara, 0.);
430 break;
432 smearPerp = m_calo_resoperp_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
433 softMetStruct = variedSoftTerm(softMetStruct, ptHard, 0., smearPerp);
434 break;
436 smearPara = m_calo_resopara_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
437 smearPerp = m_calo_resoperp_pthard_njet_mu->GetBinContent(phbin,jetbin,mubin)*randGaus;
438 softMetStruct = variedSoftTerm(softMetStruct, ptHard, smearPara, smearPerp);
439 break;
440 default:
441 ATH_MSG_DEBUG("No systematic applied, returning nominal MET term");
442 }
443
444 //fill the softMet back with the struct values to return
445 softMet.setMpx( softMetStruct.mpx);
446 softMet.setMpy( softMetStruct.mpy);
447 softMet.setSumet( softMetStruct.sumet);
448 softMet.setName( softMetStruct.name);
449 softMet.setSource( softMetStruct.source);
450
451 ATH_MSG_VERBOSE("Output soft term " << softMet.name()
452 << ", met = " << softMet.met() );
453
455 }
std::string appliedSystematicsString() const
returns: a string representation of appliedSystematics() guarantee: strong failures: out of memory II...
std::unique_ptr< TH3D > m_calo_resopara_pthard_njet_mu
std::unique_ptr< TH3D > m_calo_resoperp_pthard_njet_mu
TRandom3 * getTLSRandomGen() const
std::unique_ptr< TH3D > m_calo_shiftpara_pthard_njet_mu
missingEt variedSoftTerm(missingEt const &softTerms, missingEt const &ptHard, double varPara, double varPerp) const
std::unique_ptr< TH3D > m_trk_resopara_pthard_njet_mu
std::unique_ptr< TH3D > m_trk_shiftpara_pthard_njet_mu
missingEt calcPtHard(xAOD::MissingETContainer const *const cont) const
std::unique_ptr< TH3D > m_trk_resoperp_pthard_njet_mu
void setSource(MissingETBase::Types::bitmask_t src)
Set the source of the MET object.
float met() const
Returns .
void setName(const std::string &name)
Set the name of the MET object.
@ MET_SOFTTRK_SCALEUP
@ MET_SOFTCALO_RESOCORR
@ MET_SOFTCALO_SCALEUP
@ MET_SOFTCALO_SCALEDOWN
@ MET_SOFTTRK_RESOPARA
@ MET_SOFTTRK_RESOCORR
@ MET_SOFTTRK_RESOPERP
@ MET_SOFTCALO_RESOPERP
@ MET_SOFTCALO_RESOPARA
@ MET_SOFTTRK_SCALEDOWN
static Types::bitmask_t jet(Region reg=Region::FullAcceptance)
Standard MET term from reconstructed jets.
static bool isTrackTerm(Types::bitmask_t bits, Region reg=Region::FullAcceptance)

◆ isAffectedBySystematic()

bool met::METSystematicsTool::isAffectedBySystematic ( const CP::SystematicVariation & systematic) const
inlinevirtual

Declare the interface that this class provides.

returns: whether this tool is affected by the given systematics

Implements CP::ISystematicsTool.

Definition at line 124 of file METSystematicsTool.h.

virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const
returns: whether this tool is affected by the given systematic guarantee: no-fail

◆ jetTrkSystInitialize()

StatusCode met::METSystematicsTool::jetTrkSystInitialize ( )

Definition at line 141 of file METSystematicsTool.cxx.

142 {
143 ATH_MSG_VERBOSE (__PRETTY_FUNCTION__);
144
145 std::string histfile = "";
146 std::string gsystpath = "";
147 std::string configdir = "";
148 std::string blank = "";
149
150 ATH_CHECK( extractHistoPath(histfile,gsystpath, configdir,blank , JETTRK) );//properly sets the paths
151
152 TFile infile((configdir).c_str());
153
154 m_jet_systRpt_pt_eta.reset(dynamic_cast<TH2D*>( infile.Get("jet_systRpt_pt_eta")));
155
157 ATH_MSG_ERROR("Could not get jet track histo from the config file:" << histfile);
158 return StatusCode::FAILURE;
159 }
160
161 m_jet_systRpt_pt_eta->SetDirectory(nullptr);
162
163 ATH_MSG_VERBOSE( __PRETTY_FUNCTION__ << " DONE!!");
164 return StatusCode::SUCCESS;
165 }
StatusCode extractHistoPath(std::string &histfile, std::string &systpath, std::string &configdir, std::string &suffix, SystType const &type)
str infile
Definition run.py:13

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ projectST()

missingEt met::METSystematicsTool::projectST ( missingEt const & softTerms,
missingEt const & ptHard ) const
private

Definition at line 591 of file METSystematicsTool.cxx.

592 {
593 double const ptHardMet = std::sqrt( ptHard.mpx * ptHard.mpx +
594 ptHard.mpy * ptHard.mpy );
595
596 double const ux = ptHard.mpx/ptHardMet;
597 double const uy = ptHard.mpy/ptHardMet;
598 double const projL = ux*softTerms.mpx + uy*softTerms.mpy;
599 double const projT = uy*softTerms.mpx - ux*softTerms.mpy;
600 missingEt proj(projL,projT,softTerms.sumet,
601 softTerms.name,softTerms.source);
602
603 return proj;
604 }

◆ recommendedSystematics()

CP::SystematicSet met::METSystematicsTool::recommendedSystematics ( ) const
inlinevirtual

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 126 of file METSystematicsTool.h.

virtual SystematicSet recommendedSystematics() const
returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of ...

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setRandomSeed()

void met::METSystematicsTool::setRandomSeed ( unsigned long seed) const
virtual

Implements IMETSystematicsTool.

Definition at line 808 of file METSystematicsTool.cxx.

808 {
809 getTLSRandomGen()->SetSeed(seed);
810 }

◆ softCaloSystInitialize()

StatusCode met::METSystematicsTool::softCaloSystInitialize ( )

Definition at line 108 of file METSystematicsTool.cxx.

109 {
110 ATH_MSG_INFO("Doing SoftCalo systematics initialization. THIS IS FOR SOFTWARE DEVELOPMENT ONLY.");
111 ATH_MSG_INFO("CST IS NOT YET RECOMMENDED OR SUPPORTED BY THE MET GROUP.");
112
113 std::string histfile = "";
114 std::string systpath = "";
115 std::string histpath = "";
116 std::string suffix = "";
117
118 ATH_CHECK( extractHistoPath(histfile,systpath,histpath,suffix,SOFTCALO) );//properly sets the paths
119
120 TFile infile(histpath.c_str());
121 m_calo_resoperp_pthard_njet_mu.reset(dynamic_cast<TH3D*>( infile.Get((systpath+"/resoperp_"+suffix).c_str()) ));
122 m_calo_resopara_pthard_njet_mu.reset(dynamic_cast<TH3D*>( infile.Get((systpath+"/resopara_"+suffix).c_str()) ));
123 m_calo_shiftpara_pthard_njet_mu.reset(dynamic_cast<TH3D*>( infile.Get((systpath+"/shiftpara_"+suffix).c_str())));
124
128 ATH_MSG_ERROR("Could not get all calo histos from the config file:" << histfile );
129 return StatusCode::FAILURE;
130 }
131
132 m_calo_resoperp_pthard_njet_mu ->SetDirectory(nullptr);
133 m_calo_resopara_pthard_njet_mu ->SetDirectory(nullptr);
134 m_calo_shiftpara_pthard_njet_mu->SetDirectory(nullptr);
135
136 ATH_MSG_VERBOSE( __PRETTY_FUNCTION__ << " DONE!!" );
137 return StatusCode::SUCCESS;
138 }

◆ softTrkSystInitialize()

StatusCode met::METSystematicsTool::softTrkSystInitialize ( )

Definition at line 168 of file METSystematicsTool.cxx.

169 {
170
171 std::string histfile = "";
172 std::string psystpath = "";
173 std::string histpath = "";
174 std::string suffix = "";
175
176 ATH_CHECK( extractHistoPath(histfile,psystpath,histpath, suffix, SOFTTRK) );//properly sets the paths
177
178 TFile infile(histpath.c_str());
179
180 m_trk_resoperp_pthard_njet_mu.reset(dynamic_cast<TH3D*>( infile.Get((psystpath+"/resoperp_"+suffix).c_str()) ));
181 m_trk_resopara_pthard_njet_mu.reset(dynamic_cast<TH3D*>( infile.Get((psystpath+"/resopara_"+suffix).c_str()) ));
182 m_trk_shiftpara_pthard_njet_mu.reset(dynamic_cast<TH3D*>( infile.Get((psystpath+"/shiftpara_"+suffix).c_str())));
183
187 ATH_MSG_ERROR("Could not get all track histos from the config file:" << histfile );
188 return StatusCode::FAILURE;
189 }
190
191 m_trk_resoperp_pthard_njet_mu ->SetDirectory(nullptr);
192 m_trk_resopara_pthard_njet_mu ->SetDirectory(nullptr);
193 m_trk_shiftpara_pthard_njet_mu->SetDirectory(nullptr);
194
195 ATH_MSG_VERBOSE( __PRETTY_FUNCTION__ <<" DONE!!");
196 return StatusCode::SUCCESS;
197 }

◆ sysApplySystematicVariation()

StatusCode met::METSystematicsTool::sysApplySystematicVariation ( const CP::SystematicSet & systConfig)
virtual

effects: configure this tool for the given list of systematic variations.

systConfig is guaranteed to contain only supported systematics. guarantee: basic failures: out of memory II failures: unsupported combination of supported systematics failures: other tool specific errors

Implements CP::SystematicsTool.

Definition at line 199 of file METSystematicsTool.cxx.

199 {//this should already be filtered for MET systematics
200 ATH_MSG_VERBOSE (__PRETTY_FUNCTION__ );
201 // Only a single systematic can be applied at a time:
202 // If at some point we can deal with multiple systematics, we will check here that the combination we are given will work
203
205 if( systSet.empty() ) {
206 ATH_MSG_DEBUG("No affecting systematics received.");
207 return StatusCode::SUCCESS;
208 } else if( systSet.size() > 1 ) {
209 ATH_MSG_WARNING("Tool does not support multiple systematics, returning unsupported" );
210 return StatusCode::FAILURE;
211 }
212 CP::SystematicVariation systVar = *systSet.begin();
213 if ( systVar == CP::SystematicVariation("") ) m_appliedSystEnum = NONE ;
226 else{
227 ATH_MSG_WARNING("unsupported systematic applied " );
228 return StatusCode::FAILURE;
229 }
230
231 ATH_MSG_DEBUG("applied systematic is " << m_appliedSystEnum );
232
233 return StatusCode::SUCCESS;
234 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ testInvariant()

void CP::SystematicsTool::testInvariant ( ) const
inherited

effects: test the invariance of this object guarantee: no-fail

Definition at line 165 of file SystematicsTool.cxx.

165 {
166
167 //RCU_INVARIANT( this != 0 );
168 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ variedSoftTerm()

missingEt met::METSystematicsTool::variedSoftTerm ( missingEt const & softTerms,
missingEt const & ptHard,
double varPara,
double varPerp ) const
private

Definition at line 579 of file METSystematicsTool.cxx.

582 {
583
584 missingEt projection = projectST(softTerms,ptHard);
585 projection.mpx += varPara;
586 projection.mpy += varPerp;
587
588 return projectST(projection, ptHard);
589 }
missingEt projectST(missingEt const &softTerms, missingEt const &ptHard) const

Member Data Documentation

◆ m_affectingSystematics

SystematicSet CP::SystematicsTool::m_affectingSystematics
protectedinherited

description: members directly corresponding to accessors

Definition at line 146 of file SystematicsTool.h.

◆ m_appliedSystematics

SystematicSet* CP::SystematicsTool::m_appliedSystematics
privateinherited

description: pointer to currenty applied systematics

Definition at line 151 of file SystematicsTool.h.

◆ m_appliedSystEnum

SystApplied met::METSystematicsTool::m_appliedSystEnum {NONE}
private

Definition at line 138 of file METSystematicsTool.h.

138{NONE};

◆ m_calo_resopara_pthard_njet_mu

std::unique_ptr<TH3D> met::METSystematicsTool::m_calo_resopara_pthard_njet_mu {}
private

Definition at line 161 of file METSystematicsTool.h.

161{};

◆ m_calo_resoperp_pthard_njet_mu

std::unique_ptr<TH3D> met::METSystematicsTool::m_calo_resoperp_pthard_njet_mu {}
private

Definition at line 162 of file METSystematicsTool.h.

162{};

◆ m_calo_shiftpara_pthard_njet_mu

std::unique_ptr<TH3D> met::METSystematicsTool::m_calo_shiftpara_pthard_njet_mu {}
private

Definition at line 160 of file METSystematicsTool.h.

160{};

◆ m_configJetTrkFile

Gaudi::Property<std::string> met::METSystematicsTool::m_configJetTrkFile {this, "ConfigJetTrkFile", "", ""}
private

Definition at line 153 of file METSystematicsTool.h.

153{this, "ConfigJetTrkFile", "", ""};

◆ m_configPrefix

Gaudi::Property<std::string> met::METSystematicsTool::m_configPrefix {this, "ConfigPrefix", "METUtilities/R22_PreRecs", ""}
private

Definition at line 151 of file METSystematicsTool.h.

151{this, "ConfigPrefix", "METUtilities/R22_PreRecs", ""};

◆ m_configSoftCaloFile

Gaudi::Property<std::string> met::METSystematicsTool::m_configSoftCaloFile {this, "ConfigSoftCaloFile", "", ""}
private

Definition at line 154 of file METSystematicsTool.h.

154{this, "ConfigSoftCaloFile", "", ""};

◆ m_configSoftTrkFile

Gaudi::Property<std::string> met::METSystematicsTool::m_configSoftTrkFile {this, "ConfigSoftTrkFile", "TrackSoftTerms-pflow_Dec24.config", ""}
private

Definition at line 152 of file METSystematicsTool.h.

152{this, "ConfigSoftTrkFile", "TrackSoftTerms-pflow_Dec24.config", ""};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_EventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> met::METSystematicsTool::m_EventInfoKey {this, "EventInfo", "EventInfo", ""}
private

Definition at line 177 of file METSystematicsTool.h.

177{this, "EventInfo", "EventInfo", ""};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_jet_systRpt_pt_eta

std::unique_ptr<TH2D> met::METSystematicsTool::m_jet_systRpt_pt_eta {}
private

Definition at line 163 of file METSystematicsTool.h.

163{};

◆ m_rand_tls

boost::thread_specific_ptr<TRandom3> met::METSystematicsTool::m_rand_tls
mutableprivate

Definition at line 165 of file METSystematicsTool.h.

◆ m_recommendedSystematics

SystematicSet CP::SystematicsTool::m_recommendedSystematics
protectedinherited

Definition at line 147 of file SystematicsTool.h.

◆ m_systFilterMap

std::unordered_map<SystematicSet, SystematicSet> CP::SystematicsTool::m_systFilterMap
privateinherited

map of cached systematics filtering

Definition at line 154 of file SystematicsTool.h.

◆ m_trk_resopara_pthard_njet_mu

std::unique_ptr<TH3D> met::METSystematicsTool::m_trk_resopara_pthard_njet_mu {}
private

Definition at line 158 of file METSystematicsTool.h.

158{};

◆ m_trk_resoperp_pthard_njet_mu

std::unique_ptr<TH3D> met::METSystematicsTool::m_trk_resoperp_pthard_njet_mu {}
private

Definition at line 159 of file METSystematicsTool.h.

159{};

◆ m_trk_shiftpara_pthard_njet_mu

std::unique_ptr<TH3D> met::METSystematicsTool::m_trk_shiftpara_pthard_njet_mu {}
private

Definition at line 157 of file METSystematicsTool.h.

157{};

◆ m_TruthContKey

SG::ReadHandleKey<xAOD::MissingETContainer> met::METSystematicsTool::m_TruthContKey {this, "TruthContainer", "MET_Truth", ""}
private

Definition at line 176 of file METSystematicsTool.h.

176{this, "TruthContainer", "MET_Truth", ""};

◆ m_units

int met::METSystematicsTool::m_units {-1}
private

Definition at line 168 of file METSystematicsTool.h.

168{-1};//by default = -1, not set. Set to 1 (MeV) if not value found in config file

◆ m_useDevArea

Gaudi::Property<bool> met::METSystematicsTool::m_useDevArea {this, "UseDevArea", false, ""}
private

Definition at line 155 of file METSystematicsTool.h.

155{this, "UseDevArea", false, ""};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_VertexContKey

SG::ReadHandleKey<xAOD::VertexContainer> met::METSystematicsTool::m_VertexContKey {this, "VertexContainer", "PrimaryVertices", ""}
private

Definition at line 175 of file METSystematicsTool.h.

175{this, "VertexContainer", "PrimaryVertices", ""};

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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