ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleScaleFactorTool Class Reference

#include <ParticleScaleFactorTool.h>

Inheritance diagram for ParticleScaleFactorTool:
Collaboration diagram for ParticleScaleFactorTool:

Classes

struct  Hists

Public Member Functions

 ParticleScaleFactorTool (const std::string &name)
 ~ParticleScaleFactorTool ()
virtual StatusCode initialize () override
 Initialize is required by AsgTool base class.
virtual double evaluate (const xAOD::IParticle *particle) const override
 returns: the value that was calculated from the xAOD::IParticle
bool isAffectedBySystematic (const CP::SystematicVariation &systematic) const override
 The ISystematicsTool methods.
CP::SystematicSet affectingSystematics () const override
 the list of all systematics this tool can be affected by
CP::SystematicSet recommendedSystematics () const override
 the list of all systematics this tool recommends to use
StatusCode applySystematicVariation (const CP::SystematicSet &systConfig) override
 effects: configure this tool for the given list of systematic variations.
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
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.

Static Public Member Functions

static double part_pt (const xAOD::IParticle &p)
static double part_pt_gev (const xAOD::IParticle &p)
static double part_eta (const xAOD::IParticle &p)
static double part_decor (const xAOD::IParticle &p, const std::string &varname)

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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_configFile
CP::SystematicVariation m_currentSyst
std::map< xAOD::Type::ObjectType, Histsm_hists
CP::SystematicSet m_affectingSysts
bool m_isNominal =true
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

Detailed Description

Definition at line 19 of file ParticleScaleFactorTool.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

◆ ParticleScaleFactorTool()

ParticleScaleFactorTool::ParticleScaleFactorTool ( const std::string & name)

Definition at line 18 of file ParticleScaleFactorTool.cxx.

18 : asg::AsgTool( name ){
19
20 declareProperty( "File", m_configFile = "" , "User should specify config file to read");
21
22}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~ParticleScaleFactorTool()

ParticleScaleFactorTool::~ParticleScaleFactorTool ( )

Definition at line 24 of file ParticleScaleFactorTool.cxx.

24 {
25
26 //delete all histograms
27 for(auto& a : m_hists) {
28 for(auto& b : a.second.hists) {
29 delete b.second;
30 }
31 }
32
33}
static Double_t a
std::map< xAOD::Type::ObjectType, Hists > m_hists

Member Function Documentation

◆ affectingSystematics()

CP::SystematicSet ParticleScaleFactorTool::affectingSystematics ( ) const
inlineoverridevirtual

the list of all systematics this tool can be affected by

Implements CP::IReentrantSystematicsTool.

Definition at line 63 of file ParticleScaleFactorTool.h.

63{ return m_affectingSysts; }

◆ applySystematicVariation()

StatusCode ParticleScaleFactorTool::applySystematicVariation ( const CP::SystematicSet & systConfig)
overridevirtual

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 247 of file ParticleScaleFactorTool.cxx.

247 {
248 for(auto& syst : systConfig) {
249 for(auto& s : m_affectingSysts) {
250 if(s.basename()==syst.basename()) {
251 m_currentSyst = syst; m_isNominal=false;
252 return StatusCode::SUCCESS;
253 }
254 }
255 }
256 m_currentSyst = CP::SystematicVariation("");
257 m_isNominal = true;
258 return StatusCode::SUCCESS;
259}
CP::SystematicVariation m_currentSyst

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

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

◆ evaluate()

double ParticleScaleFactorTool::evaluate ( const xAOD::IParticle * ) const
overridevirtual

returns: the value that was calculated from the xAOD::IParticle

Implements IObservableTool.

Definition at line 190 of file ParticleScaleFactorTool.cxx.

190 {
191 //check we have a hist for this particle type
192 auto histItr = m_hists.find(particle->type());
193 if(histItr==m_hists.end()) {
194 ATH_MSG_ERROR("No scale factor available for particle type: " << particle->type());
195 throw std::runtime_error(TString::Format("%s : No scale factor available for particle type %d",name().c_str(),int(particle->type())).Data());
196 }
197
198
199 std::pair<CP::SystematicVariation,TH1*> res = histItr->second.getHist(m_currentSyst);
200
201 const TH1* hist = res.second;
202
203
204 int bin = 0;
205 switch(hist->GetDimension()) {
206 case 1: bin = hist->FindFixBin(histItr->second.axisFuncs[0](*particle)); break;
207 case 2: bin = hist->FindFixBin(histItr->second.axisFuncs[0](*particle),histItr->second.axisFuncs[1](*particle)); break;
208 case 3: bin = hist->FindFixBin(histItr->second.axisFuncs[0](*particle),histItr->second.axisFuncs[1](*particle),histItr->second.axisFuncs[2](*particle)); break;
209 }
210
211 if(res.first.parameter() == 0.) return hist->GetBinContent(bin); //must have been nominal;
212
213 double nom = histItr->second.getHist(CP::SystematicVariation("")).second->GetBinContent(bin);
214 //got here so get nominal hist and do difference ...
215 return nom + (m_currentSyst.parameter()/res.first.parameter()) * (hist->GetBinContent(bin) - nom);
216
217
218
219
220
221}
#define ATH_MSG_ERROR(x)
std::pair< std::vector< unsigned int >, bool > res
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

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

◆ 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

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

◆ getProperty()

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

Get one of the tool's properties.

◆ initialize()

StatusCode ParticleScaleFactorTool::initialize ( void )
overridevirtual

Initialize is required by AsgTool base class.

Reimplemented from asg::AsgTool.

Definition at line 35 of file ParticleScaleFactorTool.cxx.

35 {
36
37
39 if(file=="") return StatusCode::FAILURE;
40
41 TFile* f = TFile::Open(file.c_str());
42
43 if(!f) {
44 ATH_MSG_ERROR("Could not open file " << file);
45 return StatusCode::FAILURE;
46 }
47
48 m_affectingSysts.insert(CP::SystematicVariation("")); //add the nominal syst
49
50 //loop over the keys in the file, we are looking for TDirectory (systematics) and TH1 (factors)
51 std::unique_ptr<TIterator> itr(f->GetListOfKeys()->MakeIterator());
52 TKey* key = 0;
53 while( (key = static_cast<TKey*>(itr->Next())) ) {
54 TClass* cl = TClass::GetClass(key->GetClassName());
55 if(!cl || !cl->InheritsFrom(TDirectory::Class())) continue;
56 ATH_MSG_DEBUG("Detected systematic " << key->GetName());
57 m_affectingSysts.insert(CP::SystematicVariation(key->GetName()));
58 if(!CP::SystematicVariation(key->GetName()).parameter()) {
59 ATH_MSG_ERROR("Systematic must be of form: <string>__Xup OR <string>__Xdown ... where X is a number");
60 return StatusCode::FAILURE;
61 }
62 }
63
64 itr->Reset();
65 while( (key = static_cast<TKey*>(itr->Next())) ) {
66 TClass* cl = TClass::GetClass(key->GetClassName());
67 if(!cl || !cl->InheritsFrom("TH1")) continue;
68
69
70 ATH_MSG_DEBUG("Detected scale factor " << key->GetName());
71
72 //loop over systematics
73 for(auto& syst : m_affectingSysts) {
74 TString h = (syst==CP::SystematicVariation("")) ? std::string(key->GetName()) : syst.name()+ "/" + std::string(key->GetName());
75 TH1* hist = static_cast<TH1*>(f->Get(h));
76 if(!hist) {
77 if(!(syst==CP::SystematicVariation(""))) {
78 ATH_MSG_VERBOSE("No " << syst.name() << " variation of " << key->GetName());
79 continue; //fine, just no systematic variation
80 } else {
81 ATH_MSG_ERROR("Failed at retrieving " << key->GetName());
82 return StatusCode::FAILURE;
83 }
84 }
85 //detect particle type from title
87 if(strcmp(hist->GetTitle(),"Electron")==0) type = xAOD::Type::Electron;
88 else if(strcmp(hist->GetTitle(),"Muon")==0) type = xAOD::Type::Muon;
89 else if(strcmp(hist->GetTitle(),"Jet")==0) type = xAOD::Type::Jet;
90 else if(strcmp(hist->GetTitle(),"Photon")==0) type = xAOD::Type::Photon;
91 else if(strcmp(hist->GetTitle(),"Tau")==0) type = xAOD::Type::Tau;
92 else {
93 ATH_MSG_ERROR("Unknown particle type: " << hist->GetTitle());
94 return StatusCode::FAILURE;
95 }
96
97 //check all axis are labelled
98 if(strlen(hist->GetXaxis()->GetTitle())==0 ||
99 (hist->GetDimension()>1 && strlen(hist->GetYaxis()->GetTitle())==0) ||
100 (hist->GetDimension()>2 && strlen(hist->GetZaxis()->GetTitle())==0) ) {
101 ATH_MSG_ERROR("All axis of histogram " << hist->GetName() << " need to be labelled");
102 return StatusCode::FAILURE;
103 }
104 //see if nominal already present, if it is we have to 'extend' the existing histogram
105 TH1*& existHist = m_hists[type].hists[syst.name()];
106 if(existHist) {
107 ATH_MSG_DEBUG("Combining " << hist->GetTitle() << ": f(" <<
108 existHist->GetXaxis()->GetTitle() << "," << hist->GetXaxis()->GetTitle() <<
109 ") = 2*f(" << existHist->GetXaxis()->GetTitle() << ")*f(" <<
110 hist->GetXaxis()->GetTitle() << ")/[f(" << existHist->GetXaxis()->GetTitle() <<
111 ")+f(" << hist->GetXaxis()->GetTitle() << ")]");
112
113 TH1* newHist = 0;
114 if(existHist->GetDimension()==1 && hist->GetDimension()==1) {
115 std::vector<double> binEdges1, binEdges2;
116 for(int i=1;i<=existHist->GetNbinsX()+1;i++) binEdges1.push_back(existHist->GetBinLowEdge(i));
117 for(int i=1;i<=hist->GetNbinsX()+1;i++) binEdges2.push_back(hist->GetBinLowEdge(i));
118 newHist = new TH2D("myHist","myHist",existHist->GetNbinsX(),&binEdges1[0],hist->GetNbinsX(),&binEdges2[0]);
119 newHist->SetDirectory(0);
120 newHist->GetXaxis()->SetTitle(existHist->GetTitle());
121 newHist->GetYaxis()->SetTitle(hist->GetTitle());
122 for(int i=0;i<=existHist->GetNbinsX()+1;i++) {
123 for(int j=0;j<=hist->GetNbinsX()+1;j++) {
124 double a = existHist->GetBinContent(i); double b = hist->GetBinContent(j);
125 if(a && b) newHist->SetBinContent(newHist->GetBin(i,j), 2.0 * (a*b)/(a+b) );
126 //combine error ...
127 if(!(syst==CP::SystematicVariation(""))) {
128 double da = existHist->GetBinError(i);double db = hist->GetBinError(j);
129 if(a && b) newHist->SetBinError(newHist->GetBin(i,j), 2.0 * (da*b*b + db*a*a)/((a+b)*(a+b)) );
130 }
131 }
132 }
133 delete existHist;
134 existHist = newHist;
135 } else {
136 ATH_MSG_ERROR("Unsupported scale factor reparamertization :-(");
137 return StatusCode::FAILURE;
138 }
139
140 } else {
141 existHist = static_cast<TH1*>(hist->Clone("myHist")); existHist->SetDirectory(0);
142 //no systematic if nominal hist ...
143 //if(syst==CP::SystematicVariation("")) for(int i=0;i<(hist->GetNbinsX()+2)*(hist->GetNbinsY()+2)*(hist->GetNbinsZ()+2);i++) hist->SetBinError(i,0);
144 }
145
146 if(syst==CP::SystematicVariation("")) {
147 for(int i=0;i<hist->GetDimension();i++) {
148 std::string axisTitle = ( i==0 ) ? hist->GetXaxis()->GetTitle() : ( (i==1) ? hist->GetYaxis()->GetTitle() : hist->GetZaxis()->GetTitle() );
149 axisTitle.erase(remove_if(axisTitle.begin(), axisTitle.end(), isspace),axisTitle.end());
150 std::function<double(const xAOD::IParticle&)> bfunc;
151 ATH_MSG_DEBUG(" Parameter " << axisTitle);
152 if(axisTitle=="pt" || axisTitle=="pt/MeV" || axisTitle=="pt[MeV]") {
153 bfunc = part_pt;
154 } else if(axisTitle == "pt/GeV" || axisTitle=="pt[GeV]") {
155 bfunc = part_pt_gev;
156 } else if(axisTitle=="eta") {
157 bfunc = part_eta;
158 } else {
159 bfunc = std::bind(part_decor, std::placeholders::_1, axisTitle);
160 }
161 m_hists[type].axisFuncs.push_back(std::move(bfunc));
162 }
163 }
164 }
165
166
167
168
169 }
170
171 //remove the nominal syst to finish up
172 CP::SystematicSet tmpSet(m_affectingSysts);
173 m_affectingSysts.clear();
174 for(auto& s : tmpSet) {
175 if(s==CP::SystematicVariation("")) continue;
176 m_affectingSysts.insert(s);
177 //m_affectingSysts.insert(CP::SystematicVariation(s.basename(),-1)); //add the negative fluctuation
178 }
179
180
181 f->Close();
182 delete f;
183 f = 0;
184
185 if(CP::SystematicRegistry::getInstance().registerSystematics(*this) != StatusCode::SUCCESS ) return StatusCode::FAILURE;
186
187 return StatusCode::SUCCESS;
188}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
static SystematicRegistry & getInstance()
Get the singleton instance of the registry for the curren thread.
static double part_decor(const xAOD::IParticle &p, const std::string &varname)
static double part_pt_gev(const xAOD::IParticle &p)
static double part_eta(const xAOD::IParticle &p)
static double part_pt(const xAOD::IParticle &p)
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
ObjectType
Type of objects that have a representation in the xAOD EDM.
Definition ObjectType.h:32
@ Jet
The object is a jet.
Definition ObjectType.h:40
@ Photon
The object is a photon.
Definition ObjectType.h:47
@ Other
An object not falling into any of the other categories.
Definition ObjectType.h:34
@ Muon
The object is a muon.
Definition ObjectType.h:48
@ Electron
The object is an electron.
Definition ObjectType.h:46
@ Tau
The object is a tau (jet)
Definition ObjectType.h:49
TFile * file

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

◆ isAffectedBySystematic()

bool ParticleScaleFactorTool::isAffectedBySystematic ( const CP::SystematicVariation & systematic) const
inlineoverridevirtual

The ISystematicsTool methods.

Implements CP::ISystematicsTool.

Definition at line 62 of file ParticleScaleFactorTool.h.

62{ return (m_affectingSysts.find(systematic)!=m_affectingSysts.end()); }

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

◆ part_decor()

double ParticleScaleFactorTool::part_decor ( const xAOD::IParticle & p,
const std::string & varname )
inlinestatic

Definition at line 37 of file ParticleScaleFactorTool.h.

37 {
38 SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance();
39 const SG::auxid_t auxid = reg.findAuxID( varname );
40 if( auxid == SG::null_auxid ) {
41 throw std::runtime_error("unknown aux id for decoration: " + varname);
42 }
43 const std::type_info* ti = reg.getType( auxid );
44 if( *ti == typeid( double ) ) {
45 SG::ConstAccessor<double> acc (varname);
46 return acc(p);
47 } else if( *ti == typeid( float ) ) {
48 SG::ConstAccessor<float> acc (varname);
49 return acc(p);
50 } else if( *ti == typeid( int ) ) {
51 SG::ConstAccessor<int> acc (varname);
52 return acc(p);
53 } else if( *ti == typeid( unsigned int ) ) {
54 SG::ConstAccessor<unsigned int> acc (varname);
55 return acc(p);
56 }
57 throw std::runtime_error("Unrecognised type for decoration: " + varname);
58 }
static AuxTypeRegistry & instance()
Return the singleton registry instance.
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27

◆ part_eta()

double ParticleScaleFactorTool::part_eta ( const xAOD::IParticle & p)
inlinestatic

Definition at line 36 of file ParticleScaleFactorTool.h.

◆ part_pt()

double ParticleScaleFactorTool::part_pt ( const xAOD::IParticle & p)
inlinestatic

Definition at line 34 of file ParticleScaleFactorTool.h.

34{return p.pt();}

◆ part_pt_gev()

double ParticleScaleFactorTool::part_pt_gev ( const xAOD::IParticle & p)
inlinestatic

Definition at line 35 of file ParticleScaleFactorTool.h.

35{return p.pt()*1e-3;}

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ recommendedSystematics()

CP::SystematicSet ParticleScaleFactorTool::recommendedSystematics ( ) const
inlineoverridevirtual

the list of all systematics this tool recommends to use

Implements CP::IReentrantSystematicsTool.

Definition at line 64 of file ParticleScaleFactorTool.h.

64{ return affectingSystematics(); }
CP::SystematicSet affectingSystematics() const override
the list of all systematics this tool can be affected by

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

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

◆ 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

Member Data Documentation

◆ m_affectingSysts

CP::SystematicSet ParticleScaleFactorTool::m_affectingSysts
private

Definition at line 80 of file ParticleScaleFactorTool.h.

◆ m_configFile

std::string ParticleScaleFactorTool::m_configFile
private

Definition at line 68 of file ParticleScaleFactorTool.h.

◆ m_currentSyst

CP::SystematicVariation ParticleScaleFactorTool::m_currentSyst
private

Definition at line 70 of file ParticleScaleFactorTool.h.

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

std::map<xAOD::Type::ObjectType,Hists> ParticleScaleFactorTool::m_hists
private

Definition at line 78 of file ParticleScaleFactorTool.h.

◆ m_isNominal

bool ParticleScaleFactorTool::m_isNominal =true
private

Definition at line 81 of file ParticleScaleFactorTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

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