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

This tool can be used to identify the overlap of a V+jets and V+gamma sample or in fact between most V^n+gamma^m and V^n+gamma^(m-1) samples (e.g. More...

#include <VGammaORTool.h>

Inheritance diagram for VGammaORTool:
Collaboration diagram for VGammaORTool:

Public Member Functions

 VGammaORTool (const std::string &name)
virtual ~VGammaORTool () override
virtual StatusCode inOverlap (bool &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
 Determine whether current event is in overlap region (set via reference).
virtual StatusCode photonPtsOutsideDr (std::vector< float > &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
 Determine the pTs of photons outside the dR cut that is configured in tool initialization (dR_lepton_photon_cut).
virtual StatusCode photonPtsOutsideDrs (std::map< float, std::vector< float > > &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
 Determine the pTs of photons outside of several dR cuts that are configured in tool initialization (dR_lepton_photon_cuts).
virtual bool frixioneIsolated (const xAOD::TruthParticle &photon, const xAOD::TruthParticleContainer &truthParticles, float dR0, float exponent, float epsilon) const override
 Function determining whether a photon is frixione isolated from truthParticles Parameters as defined in https://arxiv.org/pdf/hep-ph/9801442.
std::vector< TLorentzVector > getPhotonP4s (const xAOD::TruthParticleContainer &truthParticleContainer) const
 Get final state photons from truthParticleContainer A minimum pT cut and isolation is applied according to tool configuration Filter function is applied, only photons from relevant origins are kept.
std::vector< TLorentzVector > getLeptonP4s (const xAOD::TruthParticleContainer &truthParticleContainer) const
 Get final state leptons from truthParticleContainer Filter function is applied, only leptons from relevant origins are kept.
virtual StatusCode initialize ()
 Dummy implementation of the initialisation function.
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.

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

StatusCode photonPtsOutsideDrs (std::map< float, std::vector< float > > &result, const std::vector< float > &drCuts, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const
StatusCode setInput (std::vector< TLorentzVector > &leptons_out, std::vector< TLorentzVector > &photons_out, const std::vector< TLorentzVector > *lepton_p4s, const std::vector< TLorentzVector > *photon_p4s, const std::vector< int > *lepton_origins, const std::vector< int > *photon_origins) const
std::vector< TLorentzVector > filterPhotonOrigins (const std::vector< TLorentzVector > &, const std::vector< int > &) const
std::vector< TLorentzVector > filterLeptonOrigins (const std::vector< TLorentzVector > &, const std::vector< int > &) const
bool isFromTau (const xAOD::TruthParticle &lepton, int nRecursions=0) const
bool checkPhotonPts (const std::vector< float > &photon_pts) const
float frixioneFunc (float dR, float dR0, float exponent, float epsilon) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

asg::AnaToolHandle< MCTruthClassifierm_truthClassifier
int m_n_leptons
std::vector< int > m_lepton_pdgIds
std::vector< int > m_preferred_lepton_origins
std::vector< int > m_lepton_veto_origins
std::vector< int > m_veto_photon_origins
std::vector< float > m_photon_pT_cuts
float m_dR_lepton_photon_cut
std::vector< float > m_dR_lepton_photon_cuts
bool m_use_gamma_iso
float m_frixione_dR
float m_frixione_exponent
float m_frixione_epsilon
std::vector< int > m_abs_pdgids_excluded_from_iso
float m_min_considered_photon_pT
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

This tool can be used to identify the overlap of a V+jets and V+gamma sample or in fact between most V^n+gamma^m and V^n+gamma^(m-1) samples (e.g.

V+gammagamma vs V+gamma or VV+gamma vs VV). It can either decide whether an event is in the overlap region for fixed cuts on photons and lepton or be used to extract relevant information from the event so that the overlap removal (OR) can be performed at a later stage with a simple 'if' statement.

The OR functions (inOverlap(result), photonPtsOutsideDr(result), or photonPtsOutsideDrs(result)), set the result via reference and return a status code. Usually the tool will take leptons and photons from the current event but this behavior can be overwritten by explicitly setting leptons and photons as additional arguments to the functions.

Further documented at https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/VGammaORTool

Definition at line 37 of file VGammaORTool.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

◆ VGammaORTool()

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

Definition at line 8 of file VGammaORTool.cxx.

9 : asg::AsgTool(name),
10 m_truthClassifier("MCTruthClassifier",this) {
11
12 declareProperty("n_leptons", m_n_leptons = -2);
13 declareProperty("lepton_pdgIds", m_lepton_pdgIds = {11, -11, 13, -13, 15, -15});
14 declareProperty("veto_lepton_origins", m_lepton_veto_origins = {3, 5, 6, 7, 8, 9, 23, 24, 25, 26, 27, 28, 29, 30, 31,
15 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42});
16 declareProperty("preferred_lepton_origins", m_preferred_lepton_origins = {1, 2, 4, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21});
17
18 declareProperty("veto_photon_origins", m_veto_photon_origins = {9, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 42});
19
20 declareProperty("photon_pT_cuts", m_photon_pT_cuts = {});
21 declareProperty("dR_lepton_photon_cut", m_dR_lepton_photon_cut = 0.1);
22 declareProperty("dR_lepton_photon_cuts", m_dR_lepton_photon_cuts = {0.0, 0.05, 0.075, 0.1, 0.125, 0.15, 0.2});
23
24 declareProperty("use_gamma_iso", m_use_gamma_iso = false);
25 declareProperty("frixione_dR", m_frixione_dR = 0.1);
26 declareProperty("frixione_exponent", m_frixione_exponent = 2);
27 declareProperty("frixione_epsilon", m_frixione_epsilon = 0.1);
28 declareProperty("abs_pdgids_excluded_from_iso", m_abs_pdgids_excluded_from_iso = {11, 12, 13, 14, 15, 16, 22});
29 declareProperty("min_considered_photon_pT", m_min_considered_photon_pT = 3.e3);
30
31 for (int origin : m_preferred_lepton_origins) {
32 if (std::find(m_lepton_veto_origins.begin(), m_lepton_veto_origins.end(), origin) != m_lepton_veto_origins.end()) {
33 ATH_MSG_ERROR(origin << " in both lepton origin and lepton veto origin, this is not correct.");
34 break;
35 }
36 }
37 // pT cuts are sorted in descending order
38 std::sort(m_photon_pT_cuts.begin(), m_photon_pT_cuts.end(), std::greater<float>());
39}
#define ATH_MSG_ERROR(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::vector< int > m_lepton_pdgIds
std::vector< float > m_dR_lepton_photon_cuts
float m_frixione_epsilon
std::vector< int > m_lepton_veto_origins
std::vector< float > m_photon_pT_cuts
std::vector< int > m_preferred_lepton_origins
asg::AnaToolHandle< MCTruthClassifier > m_truthClassifier
float m_dR_lepton_photon_cut
float m_frixione_exponent
std::vector< int > m_veto_photon_origins
float m_frixione_dR
std::vector< int > m_abs_pdgids_excluded_from_iso
float m_min_considered_photon_pT
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ ~VGammaORTool()

VGammaORTool::~VGammaORTool ( )
overridevirtual

Definition at line 41 of file VGammaORTool.cxx.

41 {
42}

Member Function Documentation

◆ checkPhotonPts()

bool VGammaORTool::checkPhotonPts ( const std::vector< float > & photon_pts) const
private

Definition at line 333 of file VGammaORTool.cxx.

333 {
334 if(m_photon_pT_cuts.size()==0){
335 ATH_MSG_ERROR("photon_pT_cuts needs to be a non-empty list, when inOverlap is called, set as property or in constructor.");
336 return false;
337 }
338 if(m_photon_pT_cuts.size()>photon_pts.size()){
339 return false;
340 }
341 for(uint i=0; i<m_photon_pT_cuts.size();i++){
342 if(photon_pts[i]<m_photon_pT_cuts[i]){
343 return false;
344 }
345 }
346 return true;
347}
unsigned int uint

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

◆ 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

◆ filterLeptonOrigins()

std::vector< TLorentzVector > VGammaORTool::filterLeptonOrigins ( const std::vector< TLorentzVector > & lepton_candidates,
const std::vector< int > & lepton_origins ) const
private

Definition at line 202 of file VGammaORTool.cxx.

203 {
204 // this should only happen if the user gives the wrong input
205 if (lepton_candidates.size() != lepton_origins.size()) {
207 "VGammaORTool::filterLeptonOrigins" << ": size of lepton candidates (" << lepton_candidates.size() << ") different from number of lepton origins (" << lepton_origins.size() <<
208 ").");
209 }
210 std::vector<TLorentzVector> lepton_p4s;
211 std::vector<TLorentzVector> leptons_not_vetoed_p4s;
212 // find both good photons and photons that are just not vetoed (lower quality, used as fall back)
213 for (uint i = 0; i < lepton_candidates.size(); i++) {
214 const TLorentzVector p4 = lepton_candidates[i];
215 const int p_origin = lepton_origins[i];
216 const bool use = std::find(m_preferred_lepton_origins.begin(), m_preferred_lepton_origins.end(), p_origin) != m_preferred_lepton_origins.end();
217 if (use) {
218 lepton_p4s.push_back(p4);
219 if (m_n_leptons>=0 && int(lepton_p4s.size()) >= m_n_leptons) {
220 // as soon as enough leptons are found, return them
221 // this is why the order of lepton candidates matters
222 // if this tool identifies the leptons, taus will be before mu/el and otherwise leptons are ordered by pT
223 // in most cases the origin should unambiguosly identify the lepton anyway
224 return lepton_p4s;
225 }
226 } else {
227 bool vetoed =
228 std::find(m_lepton_veto_origins.begin(), m_lepton_veto_origins.end(), p_origin) != m_lepton_veto_origins.end();
229 if (!vetoed) {
230 leptons_not_vetoed_p4s.push_back(p4);
231 }
232 }
233 }
234 // if not enough good leptons were found (or no expected number of leptons was set),
235 // the result is filled with leptons that were merely not vetoed
236 for (const auto& l : leptons_not_vetoed_p4s) {
237 lepton_p4s.push_back(l);
238 if (m_n_leptons>=0 && int(lepton_p4s.size()) >= m_n_leptons) break;
239 }
240 return lepton_p4s;
241}

◆ filterPhotonOrigins()

std::vector< TLorentzVector > VGammaORTool::filterPhotonOrigins ( const std::vector< TLorentzVector > & photon_candidates,
const std::vector< int > & photon_origins ) const
private

Definition at line 179 of file VGammaORTool.cxx.

180 {
181 // this should only happen if the user gives the wrong input
182 if (photon_candidates.size() != photon_origins.size()) {
184 "VGammaORTool::filterPhotonOrigins" << ": size of photon candidates (" << photon_candidates.size() << ") different from number of photon origins (" << photon_origins.size() <<
185 ").");
186 }
187 // filter out vetoed photons
188 std::vector<TLorentzVector> photon_p4s;
189 for (uint i = 0; i < photon_candidates.size(); i++) {
190 const TLorentzVector p4 = photon_candidates[i];
191 const int p_origin = photon_origins[i];
192 const bool vetoed =
193 std::find(m_veto_photon_origins.begin(), m_veto_photon_origins.end(), p_origin) != m_veto_photon_origins.end();
194 if (!vetoed) {
195 photon_p4s.push_back(p4);
196 }
197 }
198
199 return photon_p4s;
200}

◆ frixioneFunc()

float VGammaORTool::frixioneFunc ( float dR,
float dR0,
float exponent,
float epsilon ) const
private

Definition at line 392 of file VGammaORTool.cxx.

392 {
393 return epsilon * TMath::Power((1 - TMath::Cos(dR)) / (1 - TMath::Cos(dR0)), exponent);
394}

◆ frixioneIsolated()

bool VGammaORTool::frixioneIsolated ( const xAOD::TruthParticle & photon,
const xAOD::TruthParticleContainer & truthParticles,
float dR0,
float exponent,
float epsilon ) const
overridevirtual

Function determining whether a photon is frixione isolated from truthParticles Parameters as defined in https://arxiv.org/pdf/hep-ph/9801442.

Implements IVGammaORTool.

Definition at line 350 of file VGammaORTool.cxx.

352 {
353 // all photons are isolated if dR is negative
354 if (dR0 <= 0.) {
355 return true;
356 }
357 // create map between hadron-photon dr and hadron pt
358 std::map<float, float> dr_to_pt;
359 for (const auto *p : truthParticles) {
360 if (!MC::isStable(p) || HepMC::is_simulation_particle(p)) continue;
361 // ignore what typically is leptons and photons
363 std::abs(p->pdgId())) != m_abs_pdgids_excluded_from_iso.end()) {
364 continue;
365 }
366 const float dRgamma = photon.p4().DeltaR(p->p4());
367 // consider only photons withon isolation cone dR0
368 if (dRgamma < dR0) {
369 // should two hadrons have the same dr they are added up
370 if (dr_to_pt.count(dRgamma) > 0) {
371 dr_to_pt[dRgamma] += p->pt();
372 }
373 dr_to_pt[dRgamma] = p->pt();
374 }
375 }
376 // use map to determine whether photon is Frixione isolated
377 // map is sorted from low to high dr
378 float sumPt = 0.;
379 for (const auto& pair : dr_to_pt) {
380 sumPt += pair.second;
381 const float dRgamma = pair.first;
382 // if for any dRgamma the sum of pt of hadrons with a distrance of <=dRgamma to photon
383 // does not fulfill the Frixione condition, the photon is not isolated
384 if (sumPt > photon.pt() * frixioneFunc(dRgamma, dR0, exponent, epsilon)) {
385 return false;
386 }
387 }
388 // otherwise the photon is isolated
389 return true;
390}
float frixioneFunc(float dR, float dR0, float exponent, float epsilon) const
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.

◆ 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()

◆ getLeptonP4s()

std::vector< TLorentzVector > VGammaORTool::getLeptonP4s ( const xAOD::TruthParticleContainer & truthParticleContainer) const

Get final state leptons from truthParticleContainer Filter function is applied, only leptons from relevant origins are kept.

Definition at line 245 of file VGammaORTool.cxx.

245 {
246 std::vector<const xAOD::TruthParticle*> tau_candidates;
247 std::vector<const xAOD::TruthParticle*> elmu_candidates;
248 for (const auto *p : truthParticles) {
249 // ignore all particles created in Geant4
250 if (HepMC::is_simulation_particle(p)) continue;
251 // ignore all particles with the wrong pdgid
252 if (std::find(m_lepton_pdgIds.begin(), m_lepton_pdgIds.end(), p->pdgId()) == m_lepton_pdgIds.end()) continue;
253 // handle taus: use tau instances before decay into non-tau
254 if (MC::isTau(p)) {
255 bool childIsTau = false;
256 bool hasChildren = false;
257 // make sure tau has no tau children, i.e. is tau before decay
258 for (uint i = 0; i < p->nChildren(); i++) {
259 if (p->child(i) == nullptr) continue;
260 if (HepMC::is_same_particle(p->child(i),p)) continue;
261 hasChildren = true;
262 if (p->child(i)->pdgId() == p->pdgId()) {
263 childIsTau = true;
264 break;
265 }
266 }
267 if (hasChildren && !childIsTau) tau_candidates.push_back(p);
268 }
269 // electron and muons: use all status 1 not from tau
270 else if (MC::isStable(p) && !isFromTau(*p)) {
271 elmu_candidates.push_back(p);
272 }
273 }
274 // sort leptons by pT
275 sort(tau_candidates.begin(), tau_candidates.end(),
276 [](const xAOD::TruthParticle*& p1, const xAOD::TruthParticle*& p2) {
277 return p1->pt() > p2->pt();
278 });
279 sort(elmu_candidates.begin(), elmu_candidates.end(),
280 [](const xAOD::TruthParticle*& p1, const xAOD::TruthParticle*& p2) {
281 return p1->pt() > p2->pt();
282 });
283 // put taus before other leptons in a vector
284 std::vector<const xAOD::TruthParticle*> lepton_candidates(tau_candidates);
285 lepton_candidates.insert(lepton_candidates.end(), elmu_candidates.begin(), elmu_candidates.end());
286 // determine lepton origins
287 std::vector<TLorentzVector> lepton_p4s;
288 std::vector<int> lepton_origins;
289 static const SG::ConstAccessor<unsigned int> classifierParticleOriginAcc("classifierParticleOrigin");
290 for (const auto& p : lepton_candidates) {
291 const unsigned int origin = classifierParticleOriginAcc(*p);
292 lepton_origins.push_back(origin);
293 lepton_p4s.push_back(p->p4());
294 }
295 // filter out bad origins
296 return filterLeptonOrigins(lepton_p4s, lepton_origins);
297}
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
std::vector< TLorentzVector > filterLeptonOrigins(const std::vector< TLorentzVector > &, const std::vector< int > &) const
bool isFromTau(const xAOD::TruthParticle &lepton, int nRecursions=0) const
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
bool isTau(const T &p)
TruthParticle_v1 TruthParticle
Typedef to implementation.

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

◆ getPhotonP4s()

std::vector< TLorentzVector > VGammaORTool::getPhotonP4s ( const xAOD::TruthParticleContainer & truthParticleContainer) const

Get final state photons from truthParticleContainer A minimum pT cut and isolation is applied according to tool configuration Filter function is applied, only photons from relevant origins are kept.

Definition at line 299 of file VGammaORTool.cxx.

299 {
300 std::vector<TLorentzVector> photon_p4s;
301 std::vector<int> photon_origins;
302 for (const auto *p : truthParticles) {
303 // consider only final state photons, not from geant, above a lower pt cut
305 // require photons to be isolated if use_gamma_iso is true
307 // determine photon origin
308 static const SG::ConstAccessor<unsigned int> classifierParticleOriginAcc("classifierParticleOrigin");
309 const unsigned int origin = classifierParticleOriginAcc(*p);
310 photon_origins.push_back(origin);
311 photon_p4s.push_back(p->p4());
312 }
313 // filter out bad photons
314 return filterPhotonOrigins(photon_p4s, photon_origins);
315}
virtual bool frixioneIsolated(const xAOD::TruthParticle &photon, const xAOD::TruthParticleContainer &truthParticles, float dR0, float exponent, float epsilon) const override
Function determining whether a photon is frixione isolated from truthParticles Parameters as defined ...
std::vector< TLorentzVector > filterPhotonOrigins(const std::vector< TLorentzVector > &, const std::vector< int > &) const
bool isPhoton(const T &p)

◆ getProperty()

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

Get one of the tool's properties.

◆ initialize()

virtual StatusCode asg::AsgTool::initialize ( void )
inlinevirtualinherited

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 in asg::DataHandleTestTool, asg::UnitTestTool1, asg::UnitTestTool1A, asg::UnitTestTool2, asg::UnitTestTool3, AsgDeadHVCellRemovalTool, AsgElectronChargeIDSelectorTool, AsgElectronEfficiencyCorrectionTool, AsgElectronIsEMSelector, AsgElectronLikelihoodTool, AsgElectronSelectorTool, AsgForwardElectronIsEMSelector, AsgForwardElectronLikelihoodTool, AsgHelloTool, AsgPhotonEfficiencyCorrectionTool, AsgPhotonIsEMSelector, AthAsgExUnittestTool, AthONNX::JSSMLTool, AthOnnx::OnnxRuntimeInferenceTool, AthOnnx::OnnxRuntimeSessionToolCPU, AthOnnx::OnnxRuntimeSessionToolCUDA, BaseFakeBkgTool, BDTVertexWeightCalculator, BJetCorrectionTool, BookkeeperDumperTool, BookkeeperTool, BoostedJetTaggerTool, BTaggingEfficiencyJsonTool, BTaggingEfficiencyTool, BTaggingEigenVectorRecompositionTool, BTaggingSelectionJsonTool, BTaggingSelectionTool, BTaggingTruthTaggingTool, CaloClusterConstituentsOrigin, CenterOfMassShapesTool, ChargedHadronSubtractionTool, ClusterAtEMScaleTool, ClusterAtMLScaleTool, ClusterMatching::CaloClusterMatchingTool, columnar::ConfigurableColumnExampleTool, columnar::LinkColumnExampleTool, columnar::ModularExampleTool, columnar::MomentumAccessorExampleTool, columnar::OptionalColumnExampleTool, columnar::SimpleSelectorExampleTool, columnar::StringExampleTool, columnar::VariantExampleTool, columnar::VectorExampleTool, ConstitTimeCutTool, ConstituentSubtractorTool, CopyTruthJetParticles, CopyTruthParticles, CorrectPFOTool, CP::ApplyE2YFakeRate, CP::ApplyFakeFactor, CP::AsgFlagSelectionTool, CP::AsgMaskSelectionTool, CP::AsgMassSelectionTool, CP::AsgNumDecorationSelectionTool< T >, CP::AsgNumDecorationSelectionTool< int >, CP::AsgNumDecorationSelectionTool< uint8_t >, CP::AsgPtEtaSelectionTool, CP::AsymptMatrixTool, CP::BaseFakeBkgTool, CP::BaseLinearFakeBkgTool, CP::EgammaCalibrationAndSmearingTool, CP::EgammaIsGoodOQSelectionTool, CP::ElectronChargeEfficiencyCorrectionTool, CP::ElectronLRTOverlapRemovalTool, CP::FFJetSmearingTool, CP::FJvtEfficiencyTool, CP::FJvtSelectionTool, CP::IsolationCloseByCorrectionTool, CP::IsolationCorrectionTool, CP::IsolationHelper, CP::IsolationLowPtPLVTool, CP::IsolationSelectionTool, CP::JetQGTagger, CP::JetQGTaggerBDT, CP::JetTileCorrectionTool, CP::JvtEfficiencyTool, CP::JvtEfficiencyToolBase, CP::JvtSelectionTool, CP::JvtSelectionToolBase, CP::LhoodMM_tools, CP::MuonCalibIntHighpTSmearTool, CP::MuonCalibIntSagittaTool, CP::MuonCalibIntScaleSmearTool, CP::MuonCalibTool, CP::MuonEfficiencyScaleFactors, CP::MuonLRTOverlapRemovalTool, CP::MuonSelectionTool, CP::MuonTriggerScaleFactors, CP::MVATrackVertexAssociationTool, CP::NNJvtEfficiencyTool, CP::NNJvtSelectionTool, CP::PhotonPointingTool, CP::PhotonVertexSelectionTool, CP::PileupReweightingTool, CP::TrackVertexAssociationTool, D3PD::D3PDMCTruthClassifier, Diagram, DiTauMassTools::MissingMassTool, DiTauRecTools::DiTauDiscriminantTool, DiTauRecTools::DiTauIDVarCalculator, DiTauRecTools::DiTauOnnxDiscriminantTool, dRMatchingTool, ECUtils::EventCleaningTool, EfficiencyResponseHistos, EGammaAmbiguityTool, egammaMVACalibTool, EL::UnitTestTool, ElectronPhotonVariableCorrectionBase, ElectronPhotonVariableCorrectionTool, EnergyCorrelatorGeneralizedRatiosTool, EnergyCorrelatorGeneralizedTool, EnergyCorrelatorRatiosTool, EnergyCorrelatorTool, EnhancedBiasWeighter, EtaJESCalibStep, EventDensityTool, EventShapeCopier, ExtendTrackToLayerTool, FastJetInterfaceTool, FlavorTagDiscriminants::DL2Tool, FlavorTagDiscriminants::HbbTagTool, FlavorTagDiscriminants::TrackClassifier, FlavorTagDiscriminants::VRJetOverlapDecoratorTool, FlavorTagInference::GNNTool, FlavorTagInference::MultifoldGNNTool, FSR::FsrPhotonTool, GoodRunsListSelectionTool, GSCCalibStep, HI::HIEventSelectionTool, HI::HIPileupTool, HI::HIVertexSelectionTool, HIClusterSubtraction, HIEfficiencyResponseHistos, HIEventShapeFillerTool, HIEventShapeJetIteration, HIEventShapeMapTool, HIEventShapeSummaryTool, HiggsTruthCategoryTool, HIJetClusterIndexAssociationTool, HIJetClusterSubtractorTool, HIJetConstituentModifierTool, HIJetConstituentSubtractionTool, HIJetDRAssociationTool, HIJetMaxOverMeanTool, HIJetSignificanceTool, HIJetUEMonitoring, HistoDefinitionTool, HistoGroupBase, HistosForJetSelection, HIUEModulatorTool, IDTPM::DeltaRMatchingToolBase< T, R >, IDTPM::DeltaRMatchingToolBase< xAOD::TrackParticle >, IDTPM::DeltaRMatchingToolBase< xAOD::TrackParticle, xAOD::TruthParticle >, IDTPM::DeltaRMatchingToolBase< xAOD::TruthParticle, xAOD::TrackParticle >, IDTPM::EFTrackMatchingTool, IDTPM::JsonPlotsDefReadTool, IDTPM::OfflineTrackQualitySelectionTool, IDTPM::RoiSelectionTool, IDTPM::StableDeltaRMatchingTool< T, R >, IDTPM::StableDeltaRMatchingTool< xAOD::TrackParticle, xAOD::TrackParticle >, IDTPM::StableDeltaRMatchingTool< xAOD::TrackParticle, xAOD::TruthParticle >, IDTPM::StableDeltaRMatchingTool< xAOD::TruthParticle, xAOD::TrackParticle >, IDTPM::TrackAnalysisInfoWriteTool, IDTPM::TrackObjectSelectionTool, IDTPM::TrackQualitySelectionTool, IDTPM::TrackRoiSelectionTool, IDTPM::TrackTruthMatchingTool, IDTPM::TruthQualitySelectionTool, IDTPM::TruthTrackMatchingTool, IDTPM::VertexQualitySelectionTool, IDTPM::VertexRoiSelectionTool, IHIEventShapeMapTool, InDet::InclusiveTrackFilterTool, InDet::InDetHardScatterSelectionTool, InDet::InDetSecVtxTrackSelectionTool, InDet::InDetTrackBiasingTool, InDet::InDetTrackSelectionTool, InDet::InDetTrackSmearingTool, InDet::InDetTrackSystematicsTool, InDet::InDetTrackTruthFilterTool, InDet::InDetTrackTruthOriginTool, InDet::InDetUsedInFitTrackDecoratorTool, InDet::JetTrackFilterTool, InDetGNNHardScatterSelection::GNNTool, InDetSecVtxTruthMatchTool, InDetVertexTruthMatchTool, InSituCalibStep, JetAttributeHisto, JetAttributeRatioSelector, JetAttributeSelector, JetBadChanCorrTool, JetBalancePFlowJvtTool, JetBottomUpSoftDrop, JetCalibrationTool, JetCalibTool, JetCaloCellQualityTool, JetCaloEnergies, JetCaloQualityTool, JetCaloQualityToolFE, JetCleaningTool, JetClusterer, JetClustererByVertex, JetClusterMomentsTool, JetConstitFourMomTool, JetConstituentFrac, JetConstituentModSequence, JetConstituentsRetriever, JetContainerHistoFiller, JetCopier, JetDRTrackAssocTool, JetECPSFractionTool, JetEMScaleMomTool, JetEventSelector, JetFinder, JetForwardJvtTool, JetForwardJvtToolBDT, JetForwardPFlowJvtTool, JetFromPseudojet, JetGrooming::JetGroomer, JetGrooming::JetTrimming, JetGrooming::RecSoftDrop, JetGrooming::SoftDrop, JetGroomMRatio, JetHelper::HistoInput1D, JetHelper::HistoInput2D, JetHelper::HistoInput3D, JetHelper::VarTool, JetHistoBase, JetInputElRemovalTool, JetIsolationTool, JetLArHVTool, JetModifiedMassDrop, JetOriginCorrectionTool, JetParticleAssociation, JetPileupLabelingTool, JetPileupTag::JetVertexNNTagger, JetPruner, JetPseudojetCopier, JetPseudojetRetriever, JetPtAssociationTool, JetQGTaggerVariableTool, JetQuarkChargeLabelingTool, JetReclusterer, JetReclusteringTool, JetRecTool, JetRecursiveSoftDrop, JetSelectorAttribute, JetSelectorAttributeRunII, JetSoftDrop, JetSplitter, JetSubStructureMomentToolsBase, JetToolRunner, JetTrackMomentsTool, JetTrackSumMomentsTool, JetTrimmer, JetTruthLabelingTool, JetTruthParticleSelectorTool, JetUncertaintiesTool, JetUsedInFitTrackDecoratorTool, JetVertexFractionTool, JetVertexTaggerTool, JetVoronoiDiagramHelpers::Diagram, JetVoronoiMomentsTool, JetWidthTool, JSSTaggerBase, JSSTaggerUtils, JSSWTopTaggerANN, JSSWTopTaggerDNN, KTSplittingScaleTool, LeadingJetsRelations, LVL1::L1CaloCells2TriggerTowers, LVL1::L1CaloFcal23Cells2RxMappingTool, LVL1::L1CaloLArTowerEnergy, LVL1::L1CaloMonitoringCaloTool, LVL1::L1CaloOfflineTriggerTowerTools, LVL1::L1CaloTTIdTools, LVL1::L1CaloxAODOfflineTriggerTowerTools, LVL1::TrigT1CaloMonErrorTool, LVL1::TrigT1CaloMonErrorToolV1, LVL1BS::PpmByteStreamReadV1V2Tool, LVL1BS::TrigT1CaloDataAccessV2, MBTSTimeFilterTool, MCTruthClassifier, met::ColumnarMETMaker, met::METAssociationTool, met::METAssociator, met::METBuilderTool, met::METCaloRegionsTool, met::METEgammaAssociator, met::METElectronAssociator, met::METJetAssocTool, met::METJetTool, met::METMaker, met::METMuonAssociator, met::METNet, met::METPhotonAssociator, met::METRecoTool, met::METRefinerTool, met::METRegionsTool, met::METSignificance, met::METSoftAssociator, met::METSoftTermsTool, met::METSystematicsTool, met::METTauAssociator, met::METTrackFilterTool, met::METTruthAssociator, met::METTruthTool, MissingCellListTool, MvaTESEvaluator, MvaTESVariableDecorator, NSubjettinessRatiosTool, NSubjettinessTool, ORUtils::BaseOverlapTool, ORUtils::OverlapRemovalTool, PanTau::PanTauProcessor, PanTau::Tool_DecayModeDeterminator, PanTau::Tool_DetailsArranger, PanTau::Tool_FeatureExtractor, PanTau::Tool_InformationStore, PanTau::Tool_InputConverter, PanTau::Tool_ModeDiscriminator, PanTau::Tool_TauConstituentGetter, PanTau::Tool_TauConstituentSelector, ParticleJetDeltaRLabelTool, ParticleJetGhostLabelTool, ParticleScaleFactorTool, PDFWeight, Pileup1DResidualCalibStep, PileupAreaCalibStep, PMGTools::PMGCrossSectionTool, PMGTools::PMGDecayProductsSelectionTool, PMGTools::PMGHFProductionFractionTool, PMGTools::PMGSherpa22VJetsWeightTool, PMGTools::PMGSherpaVjetsSysTool, PMGTools::PMGTruthWeightTool, PuppiWeightTool, QwTool, Ringer::AsgRingerSelectorTool, SimpleMuonTriggerScaleFactors, SmearingCalibStep, SmoothedTopTagger, SmoothedWZTagger, SoftKillerWeightTool, ST::SUSYObjDef_xAOD, TauAnalysisTools::BuildTruthTaus, TauAnalysisTools::CommonDiTauEfficiencyTool, TauAnalysisTools::CommonDiTauSmearingTool, TauAnalysisTools::CommonEfficiencyTool, TauAnalysisTools::CommonSmearingTool, TauAnalysisTools::DiTauEfficiencyCorrectionsTool, TauAnalysisTools::DiTauSelectionTool, TauAnalysisTools::DiTauSmearingTool, TauAnalysisTools::DiTauTruthMatchingTool, TauAnalysisTools::TauEfficiencyCorrectionsTool, TauAnalysisTools::TauHFVetoTool, TauAnalysisTools::TauSelectionTool, TauAnalysisTools::TauSmearingTool, TauAnalysisTools::TauTruthMatchingTool, TauAnalysisTools::TauTruthTrackMatchingTool, TauAODMuonRemovalTool, TauCalibrateLC, TauCombinedTES, TauDecayModeNNClassifier, TauElectronVetoVariables, TauEleOverlapChecker, TauGNNEvaluator, TauJetRNNEvaluator, TauPi0CreateROI, TauPi0ScoreCalculator, TauRecToolBase, tauRecTools::TauTrackRNNClassifier, tauRecTools::TrackRNN, TauShotFinder, TauTrackFinder, TauVertexedClusterDecorator, TauVertexFinder, TauVertexVariables, TauWPDecorator, TrackTruthSelectionTool, TrackVertexAssociationTool, Trig::DRScoringTool, Trig::EgammaDRScoringTool, Trig::IParticleRetrievalTool, Trig::JetManagerTool, Trig::MatchFromCompositeTool, Trig::MatchingTool, Trig::R3IParticleRetrievalTool, Trig::R3MatchingTool, Trig::StaticBunchCrossingTool, Trig::TrigConfBunchCrossingTool, Trig::TrigDecisionTool, Trig::TrigDecisionToolLite, Trig::TrigEgammaEmulationBaseHypoTool, Trig::TrigEgammaEmulationChain, Trig::TrigEgammaEmulationFastCaloHypoTool, Trig::TrigEgammaEmulationPrecisionElectronHypoTool, Trig::TrigEgammaEmulationPrecisionPhotonHypoTool, Trig::TrigEgammaEmulationToolMT, Trig::TrigEgammaMatchingTool, Trig::TrigMuonMatching, Trig::TypedScoringTool, Trig::xAODBunchCrossingTool, TrigConf::xAODConfigTool, TrigEgammaMatchingToolMT, TrigFastCalibWithRings, TrigGlobalEfficiencyCorrectionTool, Validator, VoronoiWeightTool, WeightsAgregator, WeightToolBase, xAOD::BPhysBlindingTool, xAOD::BPhysTrackVertexMapTool, xAOD::CaloIsolationTool, xAOD::TrackIsolationTool, xAODMaker::TriggerMenuMetaDataTool, xAODMaker::TruthMetaDataTool, xAODtoHepMCTool, ZDC::RPDAnalysisTool, ZDC::RpdSubtractCentroidTool, ZDC::ZdcAnalysisTool, ZDC::ZdcLEDAnalysisTool, ZDC::ZdcRecTool, ZDC::ZdcTrigValidTool, ZdcByteStreamReadV1V2Tool, ZdcDataAccessV2, ZdcRecChannelToolLucrod, ZdcRecChannelToolV2, and ZMassConstraint::ConstraintFit.

Definition at line 133 of file AsgTool.h.

133{ return StatusCode::SUCCESS; }

◆ inOverlap()

StatusCode VGammaORTool::inOverlap ( bool & result,
const std::vector< TLorentzVector > * leptons = 0,
const std::vector< TLorentzVector > * photons = 0,
const std::vector< int > * lepton_origins = 0,
const std::vector< int > * photon_origins = 0 ) const
overridevirtual

Determine whether current event is in overlap region (set via reference).

The overlap region is defined by dR_lepton_photon_cut, photon_pT_cut and many more configurable parameters. Note that the function returns a status code. The first agument is the result, the remaining arguments are optional:

  • If null pointers are given for leptons or photons, they will be taken from the event
  • One can override this behaviour by manually specifying vectors of lepton/photon
  • If lepton or photon origins are given in addition to the lepton four vectors, particles from irrelevant origins (e.g. decays) are filtered out This can be useful when working with derivations which store the origin but not the full truth record

Implements IVGammaORTool.

Definition at line 48 of file VGammaORTool.cxx.

52 {
53 std::vector<float> photon_pts;
54 ANA_CHECK(photonPtsOutsideDr(photon_pts,leptons,photons,lepton_origins,photon_origins));
55 result = checkPhotonPts(photon_pts);
56 return StatusCode::SUCCESS;
57}
#define ANA_CHECK(EXP)
check whether the given expression was successful
virtual StatusCode photonPtsOutsideDr(std::vector< float > &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
Determine the pTs of photons outside the dR cut that is configured in tool initialization (dR_lepton_...
bool checkPhotonPts(const std::vector< float > &photon_pts) const

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

◆ isFromTau()

bool VGammaORTool::isFromTau ( const xAOD::TruthParticle & lepton,
int nRecursions = 0 ) const
private

Definition at line 317 of file VGammaORTool.cxx.

317 {
318 // avoid being stuck in some weird particle family tree
319 if(nRecursions>20){
320 return false;
321 }
322 for(uint i=0; i<lepton.nParents(); i++){
323 const xAOD::TruthParticle* parent=lepton.parent(i);
324 if (MC::isTau(parent)) return true;
325 if(parent->pdgId()==lepton.pdgId()){
326 return isFromTau(lepton, nRecursions+1);
327 }
328 }
329 return false;
330
331}
int pdgId() const
PDG ID code.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
size_t nParents() const
Number of parents of this particle.

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

◆ photonPtsOutsideDr()

StatusCode VGammaORTool::photonPtsOutsideDr ( std::vector< float > & result,
const std::vector< TLorentzVector > * leptons = 0,
const std::vector< TLorentzVector > * photons = 0,
const std::vector< int > * lepton_origins = 0,
const std::vector< int > * photon_origins = 0 ) const
overridevirtual

Determine the pTs of photons outside the dR cut that is configured in tool initialization (dR_lepton_photon_cut).

Calculates a vector of photon pts, ordered by descending pt. Once these values are calculated they can be stored and used to easily perform OR with arbitrary pT. Note that the function returns a status code. The first agument is the result, the remaining arguments are optional

  • If null pointers are given for leptons or photons, they will be taken from the event
  • One can override this behaviour by manually specifying vectors of lepton/photon
  • If lepton or photon origins are given in addition to the lepton four vectors, particles from irrelevant origins (e.g. decays) are filtered out This can be useful when working with derivations which store the origin but not the full truth record

Implements IVGammaORTool.

Definition at line 62 of file VGammaORTool.cxx.

66 {
67 std::map<float, std::vector<float> > photon_pt_map;
68 ANA_CHECK(photonPtsOutsideDrs(photon_pt_map,std::vector<float>(1, m_dR_lepton_photon_cut),leptons,photons,lepton_origins,photon_origins));
69 result = photon_pt_map[m_dR_lepton_photon_cut];
70 return StatusCode::SUCCESS;
71}
virtual StatusCode photonPtsOutsideDrs(std::map< float, std::vector< float > > &result, const std::vector< TLorentzVector > *leptons=0, const std::vector< TLorentzVector > *photons=0, const std::vector< int > *lepton_origins=0, const std::vector< int > *photon_origins=0) const override
Determine the pTs of photons outside of several dR cuts that are configured in tool initialization (d...

◆ photonPtsOutsideDrs() [1/2]

StatusCode VGammaORTool::photonPtsOutsideDrs ( std::map< float, std::vector< float > > & result,
const std::vector< float > & drCuts,
const std::vector< TLorentzVector > * leptons = 0,
const std::vector< TLorentzVector > * photons = 0,
const std::vector< int > * lepton_origins = 0,
const std::vector< int > * photon_origins = 0 ) const
private

Definition at line 89 of file VGammaORTool.cxx.

94 {
95 std::vector<TLorentzVector> good_leptons;
96 std::vector<TLorentzVector> good_photons;
97 ANA_CHECK(setInput(good_leptons,good_photons,leptons,photons,lepton_origins,photon_origins));
98
99 // the actual OR algorithm is here, pts of photon outside dRs are determined first
100 for (const auto& drCut : drCuts) {
101 result[drCut] = std::vector<float>();
102 for (const auto& photon : good_photons) {
103 bool tooCloseToLepton = false;
104 for (uint i_lep = 0; i_lep < good_leptons.size() && (m_n_leptons<0 || int(i_lep) < m_n_leptons); i_lep++) {
105 const float dr = photon.DeltaR(good_leptons[i_lep]);
106 if (dr < drCut) {
107 tooCloseToLepton = true;
108 break;
109 }
110 }
111 if (!tooCloseToLepton) result[drCut].push_back(photon.Pt());
112 }
113 // photon pts are sorted and returned
114 std::sort(result[drCut].begin(), result[drCut].end(), std::greater<float>());
115 }
116
117 return StatusCode::SUCCESS;
118}
StatusCode setInput(std::vector< TLorentzVector > &leptons_out, std::vector< TLorentzVector > &photons_out, const std::vector< TLorentzVector > *lepton_p4s, const std::vector< TLorentzVector > *photon_p4s, const std::vector< int > *lepton_origins, const std::vector< int > *photon_origins) const

◆ photonPtsOutsideDrs() [2/2]

StatusCode VGammaORTool::photonPtsOutsideDrs ( std::map< float, std::vector< float > > & result,
const std::vector< TLorentzVector > * leptons = 0,
const std::vector< TLorentzVector > * photons = 0,
const std::vector< int > * lepton_origins = 0,
const std::vector< int > * photon_origins = 0 ) const
overridevirtual

Determine the pTs of photons outside of several dR cuts that are configured in tool initialization (dR_lepton_photon_cuts).

Calculates a mapping between dRs and vector of photon pts (ordered by descending pt). Once these values are calculated they can be stored and used to easily perform OR with arbitrary pT and multiple dR cuts. Note that the function returns a status code. The first agument is the result, the remaining arguments are optional

  • If null pointers are given for leptons or photons, they will be taken from the event
  • One can override this behaviour by manually specifying vectors of lepton/photon
  • If lepton or photon origins are given in addition to the lepton four vectors, particles from irrelevant origins (e.g. decays) are filtered out This can be useful when working with derivations which store the origin but not the full truth record

Implements IVGammaORTool.

Definition at line 76 of file VGammaORTool.cxx.

80 {
81 ANA_CHECK(photonPtsOutsideDrs(result,m_dR_lepton_photon_cuts,leptons,photons,lepton_origins,photon_origins));
82 return StatusCode::SUCCESS;
83}

◆ print()

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

◆ setInput()

StatusCode VGammaORTool::setInput ( std::vector< TLorentzVector > & leptons_out,
std::vector< TLorentzVector > & photons_out,
const std::vector< TLorentzVector > * lepton_p4s,
const std::vector< TLorentzVector > * photon_p4s,
const std::vector< int > * lepton_origins,
const std::vector< int > * photon_origins ) const
private

Definition at line 122 of file VGammaORTool.cxx.

127 {
128
129 // truth particles are retrieved from event if not given by user
130 const xAOD::TruthParticleContainer* truthMuons(nullptr);
131 const xAOD::TruthParticleContainer* truthElectrons(nullptr);
132 const xAOD::TruthParticleContainer* truthPhotons(nullptr);
133 if(lepton_p4s==0 || photon_p4s==0){
134 ANA_CHECK(evtStore()->retrieve(truthMuons,"TruthMuons"));
135 ANA_CHECK(evtStore()->retrieve(truthElectrons,"TruthElectrons"));
136 ANA_CHECK(evtStore()->retrieve(truthPhotons, "TruthPhotons"));
137 }
138
139 // relevant photons and leptons identified
140 if(lepton_p4s==0){
141 std::vector<TLorentzVector> muonsOut=getLeptonP4s(*truthMuons);
142 std::vector<TLorentzVector> electronsOut=getLeptonP4s(*truthElectrons);
143 leptons_out.insert(leptons_out.end(),muonsOut.begin(),muonsOut.end());
144 leptons_out.insert(leptons_out.end(),electronsOut.begin(),electronsOut.end());
145 }
146 else{
147 if(lepton_origins!=0){
148 leptons_out = filterLeptonOrigins(*lepton_p4s,*lepton_origins);
149 }
150 else{
151 leptons_out = *lepton_p4s;
152 }
153 }
154 if(photon_p4s==0){
155 photons_out = getPhotonP4s(*truthPhotons);
156 }
157 else{
158 if(photon_origins!=0){
159 photons_out = filterPhotonOrigins(*photon_p4s,*photon_origins);
160 }
161 else{
162 photons_out = *photon_p4s;
163 }
164 }
165
166 ATH_MSG_DEBUG("VGammaORTool::setInput" << ": Found " << photons_out.size() << " photons.");
167 ATH_MSG_DEBUG("VGammaORTool::setInput" << ": Found " << leptons_out.size() << " leptons.");
168
169 if (m_n_leptons >=0 && int(leptons_out.size()) < m_n_leptons) {
171 "VGammaORTool::setInput" << ": Found " << leptons_out.size() << " leptons but expected " << m_n_leptons << ".");
172 }
173
174 return StatusCode::SUCCESS;
175}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::vector< TLorentzVector > getPhotonP4s(const xAOD::TruthParticleContainer &truthParticleContainer) const
Get final state photons from truthParticleContainer A minimum pT cut and isolation is applied accordi...
std::vector< TLorentzVector > getLeptonP4s(const xAOD::TruthParticleContainer &truthParticleContainer) const
Get final state leptons from truthParticleContainer Filter function is applied, only leptons from rel...
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.

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

std::vector<int> VGammaORTool::m_abs_pdgids_excluded_from_iso
private

Definition at line 193 of file VGammaORTool.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_dR_lepton_photon_cut

float VGammaORTool::m_dR_lepton_photon_cut
private

Definition at line 180 of file VGammaORTool.h.

◆ m_dR_lepton_photon_cuts

std::vector<float> VGammaORTool::m_dR_lepton_photon_cuts
private

Definition at line 182 of file VGammaORTool.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_frixione_dR

float VGammaORTool::m_frixione_dR
private

Definition at line 187 of file VGammaORTool.h.

◆ m_frixione_epsilon

float VGammaORTool::m_frixione_epsilon
private

Definition at line 191 of file VGammaORTool.h.

◆ m_frixione_exponent

float VGammaORTool::m_frixione_exponent
private

Definition at line 189 of file VGammaORTool.h.

◆ m_lepton_pdgIds

std::vector<int> VGammaORTool::m_lepton_pdgIds
private

Definition at line 161 of file VGammaORTool.h.

◆ m_lepton_veto_origins

std::vector<int> VGammaORTool::m_lepton_veto_origins
private

Definition at line 169 of file VGammaORTool.h.

◆ m_min_considered_photon_pT

float VGammaORTool::m_min_considered_photon_pT
private

Definition at line 196 of file VGammaORTool.h.

◆ m_n_leptons

int VGammaORTool::m_n_leptons
private

Definition at line 158 of file VGammaORTool.h.

◆ m_photon_pT_cuts

std::vector<float> VGammaORTool::m_photon_pT_cuts
private

Definition at line 178 of file VGammaORTool.h.

◆ m_preferred_lepton_origins

std::vector<int> VGammaORTool::m_preferred_lepton_origins
private

Definition at line 166 of file VGammaORTool.h.

◆ m_truthClassifier

asg::AnaToolHandle<MCTruthClassifier> VGammaORTool::m_truthClassifier
private

Definition at line 150 of file VGammaORTool.h.

◆ m_use_gamma_iso

bool VGammaORTool::m_use_gamma_iso
private

Definition at line 185 of file VGammaORTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_veto_photon_origins

std::vector<int> VGammaORTool::m_veto_photon_origins
private

Definition at line 175 of file VGammaORTool.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: