ATLAS Offline Software
Loading...
Searching...
No Matches
METSystematicsTool.h File Reference
#include "METInterface/IMETSystematicsTool.h"
#include "AsgDataHandles/ReadHandleKey.h"
#include "AsgTools/PropertyWrapper.h"
#include "AsgTools/AsgTool.h"
#include "ColumnarMode/ColumnarMode.h"
#include "PATInterfaces/SystematicsTool.h"
#include "TH1.h"
#include "TH2.h"
#include "TH3.h"
#include "TRandom3.h"
#include "xAODTracking/VertexContainer.h"
#include "xAODMissingET/MissingETContainer.h"
#include "xAODMissingET/MissingETAssociationMap.h"
#include "xAODMissingET/MissingETAssociationHelper.h"
#include "boost/thread/tss.hpp"
#include "gtest/gtest_prod.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

namespace ADD_CMODE (met)

Function Documentation

◆ ADD_CMODE()

namespace ADD_CMODE ( met )

Definition at line 1 of file METSystematicsTool.h.

37 {
38
40
41 //we create this to avoid calling the xAOD::MissingET constructor
42 //since it creates a private store which is slow
43 //please forgive the code duplication :)
44 struct missingEt {
45 missingEt() : mpx(0), mpy(0), sumet(0), name(""), source(static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Type::UnknownType)){}
46 missingEt(double mpx_in, double mpy_in, double sumet_in) :
47 mpx(mpx_in),
48 mpy(mpy_in),
49 sumet(sumet_in),
50 name(""),
51 source(static_cast<MissingETBase::Types::bitmask_t>(MissingETBase::Source::Type::UnknownType))
52 {}
53 missingEt(double mpx_in, double mpy_in, double sumet_in, std::string const & iname, MissingETBase::Types::bitmask_t const & isource ) :
54 mpx(mpx_in),
55 mpy(mpy_in),
56 sumet(sumet_in),
57 name(iname),
58 source(isource)
59 {}
60
61 double mpx;
62 double mpy;
63 double sumet;
64 std::string name;
66 };
67
68 //this is to speed up applyCorrection lookup.
69 //we still store the full list in appliedSystematics()/m_appliedSystematics
70 enum SystApplied {
71 NONE ,
72 MET_SOFTTRK_SCALEUP ,
73 MET_SOFTTRK_SCALEDOWN ,
74 MET_SOFTTRK_RESOPARA ,
75 MET_SOFTTRK_RESOPERP ,
76 MET_SOFTTRK_RESOCORR ,
77 MET_SOFTCALO_SCALEUP ,
78 MET_SOFTCALO_SCALEDOWN,
79 MET_SOFTCALO_RESOPARA ,
80 MET_SOFTCALO_RESOPERP ,
81 MET_SOFTCALO_RESOCORR ,
82 MET_JETTRK_SCALEUP ,
83 MET_JETTRK_SCALEDOWN
84 };
85
86 class METSystematicsTool : public virtual IMETSystematicsTool,
87 public asg::AsgTool,
89 {
90 // This macro defines the constructor with the interface declaration
91 ASG_TOOL_CLASS(METSystematicsTool, IMETSystematicsTool)
92
93 // FRIEND_TEST( METSystTest, TestGetEventInfo );
94 FRIEND_TEST( METSystTest, TestDefaultHistosFilled );
95 FRIEND_TEST( METSystTest, TestJetTrkHistosFilled );
96 FRIEND_TEST( METSystTest, TestAddAffectingSystematic );
97 FRIEND_TEST( METSystTest, TestProjectST );
98 FRIEND_TEST( METSystTest, TestProjectST2 );
99
100 public:
101
102 //Constructor
103 METSystematicsTool(const std::string& name);
104
105 //Destructor
106 // virtual ~METSystematicsTool();
107
108 StatusCode softTrkSystInitialize(); //initialize softTrk scale/reo histos from config file
109 StatusCode softCaloSystInitialize();//initialize softCalo scale/reso histos from config file
110 StatusCode jetTrkSystInitialize(); //initialize jetTrk scale/reso histos from config file
111
112 //required asg tool interface functions
114
115 //required correction tool functions
116 //we don't inherit from CorrectionTool directly, since we don't want to implement applyContainerCorrection
117 CP::CorrectionCode applyCorrection(xAOD::MissingET& inputMet,
118 const xAOD::MissingETAssociationHelper& helper) const;
119 CP::CorrectionCode correctedCopy(const xAOD::MissingET& met, xAOD::MissingET*& outputmet,
120 const xAOD::MissingETAssociationHelper& helper) const;
121 //We don't want these for MET since we only apply systematics to the soft term, and this may be unclear
122 //virtual CP::CorrectionCode applyContainerCorrection(xAOD::MissingETContainer& inputs, const CP::xAOD::EventInfo& eInfo) const;
123 //virtual CP::CorrectionCode applyContainerCorrection(xAOD::MissingETContainer& inputs, const CP::xAOD::EventInfo& eInfo) const;
124
125 //required ISystematicTool functions
126 bool isAffectedBySystematic (const CP::SystematicVariation& var) const{return CP::SystematicsTool::isAffectedBySystematic(var) ;}
127 CP::SystematicSet affectingSystematics () const{ return CP::SystematicsTool::affectingSystematics () ;}
128 CP::SystematicSet recommendedSystematics () const{ return CP::SystematicsTool::recommendedSystematics() ;}
129 StatusCode applySystematicVariation(const CP::SystematicSet& set){ return CP::SystematicsTool::applySystematicVariation(set) ;}
130 StatusCode sysApplySystematicVariation(const CP::SystematicSet&); //when inheriting from SystematicsTool, we should only have to implement this one
131
132 void setRandomSeed(unsigned long seed) const;
133
134 private:
135
136 //default constructor
137 METSystematicsTool();
138
139 //this saves the the currently applied systematic as an enum for faster lookup
140 SystApplied m_appliedSystEnum{NONE};
141
142 //these are the internal computation functions
143 CP::CorrectionCode internalSoftTermApplyCorrection(xAOD::MissingET& softMet,
144 xAOD::MissingETContainer const * METcont,
145 xAOD::EventInfo const & eInfo
146 ) const;
147 CP::CorrectionCode calcJetTrackMETWithSyst(xAOD::MissingET& jettrkmet, const xAOD::MissingETAssociationHelper& helper) const;
148 CP::CorrectionCode calcJetTrackMETWithSyst(xAOD::MissingET& jettrkmet, const xAOD::MissingETAssociationHelper& helper, const xAOD::Jet* jet) const;
149 CP::CorrectionCode getCorrectedJetTrackMET(xAOD::MissingET& jettrkmet, const xAOD::MissingETAssociationHelper& helper) const;
150 TRandom3* getTLSRandomGen() const;
151
152 //declared properties
153 Gaudi::Property<std::string> m_configPrefix{this, "ConfigPrefix", "METUtilities/R22_PreRecs", ""};
154 Gaudi::Property<std::string> m_configSoftTrkFile{this, "ConfigSoftTrkFile", "TrackSoftTerms-pflow_Dec24.config", ""};
155 Gaudi::Property<std::string> m_configJetTrkFile{this, "ConfigJetTrkFile", "", ""};
156 Gaudi::Property<std::string> m_configSoftCaloFile{this, "ConfigSoftCaloFile", "", ""};
157 Gaudi::Property<bool> m_useDevArea{this, "UseDevArea", false, ""};
158
159 std::unique_ptr<TH3D> m_trk_shiftpara_pthard_njet_mu{};
160 std::unique_ptr<TH3D> m_trk_resopara_pthard_njet_mu{};
161 std::unique_ptr<TH3D> m_trk_resoperp_pthard_njet_mu{};
162 std::unique_ptr<TH3D> m_calo_shiftpara_pthard_njet_mu{};
163 std::unique_ptr<TH3D> m_calo_resopara_pthard_njet_mu{};
164 std::unique_ptr<TH3D> m_calo_resoperp_pthard_njet_mu{};
165 std::unique_ptr<TH2D> m_jet_systRpt_pt_eta{};
166
167 mutable boost::thread_specific_ptr<TRandom3> m_rand_tls; // thread-specific random number generator
168
169 //internal property
170 int m_units{-1};//by default = -1, not set. Set to 1 (MeV) if not value found in config file
171
172 int getNPV() const;
173 xAOD::EventInfo const * getDefaultEventInfo() const;
174
175
176 //Read/write handles
177 SG::ReadHandleKey<xAOD::VertexContainer> m_VertexContKey{this, "VertexContainer", "PrimaryVertices", ""};
178 SG::ReadHandleKey<xAOD::MissingETContainer> m_TruthContKey{this, "TruthContainer", "MET_Truth", ""};
179 SG::ReadHandleKey<xAOD::EventInfo> m_EventInfoKey{this, "EventInfo", "EventInfo", ""};
180
181 StatusCode addMETAffectingSystematics();
182 StatusCode extractHistoPath(std::string & histfile, std::string & systpath, std::string & configdir, std::string & suffix, met::SystType const & type);
183
184 missingEt calcPtHard(xAOD::MissingETContainer const * const cont) const;
185 missingEt variedSoftTerm (missingEt const & softTerms, missingEt const & ptHard, double varPara, double varPerp) const;
186 missingEt projectST (missingEt const & softTerms, missingEt const & ptHard) const;
187
188
189
190 };//METSystematicsTool
191
192}
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
RootType Type
virtual SystematicSet affectingSystematics() const =0
the list of all systematics this tool can be affected by
virtual SystematicSet recommendedSystematics() const =0
the list of all systematics this tool recommends to use
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)=0
effects: configure this tool for the given list of systematic variations.
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const =0
Declare the interface that this class provides.
Base class for CP tools providing systematic variations.
virtual bool isAffectedBySystematic(const SystematicVariation &systematic) const
returns: whether this tool is affected by the given systematic guarantee: no-fail
virtual StatusCode sysApplySystematicVariation(const SystematicSet &systConfig)=0
effects: configure this tool for the given list of systematic variations.
virtual SystematicSet recommendedSystematics() const
returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of ...
virtual SystematicSet affectingSystematics() const
returns: the list of all systematics this tool can be affected by guarantee: strong failures: out of ...
virtual StatusCode applySystematicVariation(const SystematicSet &systConfig)
effects: configure this tool for the given list of systematic variations.
virtual CP::CorrectionCode applyCorrection(xAOD::MissingET &met, const xAOD::MissingETAssociationHelper &helper) const =0
virtual void setRandomSeed(unsigned long seed) const =0
virtual CP::CorrectionCode correctedCopy(const xAOD::MissingET &met, xAOD::MissingET *&outputmet, const xAOD::MissingETAssociationHelper &helper) const =0
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
std::tuple< WrapType< TYPES >... > Types
A simple tuple of multiple types.
::StatusCode StatusCode
StatusCode definition for legacy code.
uint64_t bitmask_t
Type for status word bit mask.
TRandom3 * getTLSRandomGen()
Jet_v1 Jet
Definition of the current "jet version".
EventInfo_v1 EventInfo
Definition of the latest event info version.
MissingET_v1 MissingET
Version control by type defintion.
Definition MissingET.h:15
MissingETContainer_v1 MissingETContainer
void initialize()