ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
JetTruthParticleSelectorTool Class Reference

#include <JetTruthParticleSelectorTool.h>

Inheritance diagram for JetTruthParticleSelectorTool:
Collaboration diagram for JetTruthParticleSelectorTool:

Public Member Functions

 JetTruthParticleSelectorTool (const std::string &s)
 
virtual ~JetTruthParticleSelectorTool ()
 
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function. More...
 
virtual StatusCode finalize () override
 
bool operator() (const xAOD::TruthParticle *truth)
 alias 'selector' to operator(const IN4M*) More...
 
bool selector (const xAOD::TruthParticle *truth)
 
void setupEvent ()
 
bool passKinematics (const xAOD::TruthParticle *truth) const
 
virtual void print () const
 Print the state of the tool. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Types

enum  SelectionMode {
  Invalid = -1, StableNoMuonNoNu, MuonOnly, NuOnly,
  NoWZDecay
}
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Private Types

typedef std::map< int, long long > PDGList
 
typedef std::map< int, double > Average
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

double m_min_pt
 
double m_max_pt
 
double m_maxAbsEta
 
double m_minEta
 
double m_maxEta
 
double m_wzPhotonCone
 
bool m_useOnlyCharged
 
bool m_listPDGofStables
 
std::string m_selectionModeName
 
SelectionMode m_selectionMode
 
PDGList m_pdgList
 
Average m_avP
 
Average m_av2P
 
Average m_avPt
 
Average m_av2Pt
 
Average m_avEta
 
Average m_av2Eta
 
Average m_avPhi
 
Average m_av2Phi
 
Average m_avM
 
Average m_av2M
 
std::vector< const xAOD::TruthParticle * > m_wzLeptons
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 21 of file JetTruthParticleSelectorTool.h.

Member Typedef Documentation

◆ Average

typedef std::map< int, double > JetTruthParticleSelectorTool::Average
private

Definition at line 80 of file JetTruthParticleSelectorTool.h.

◆ PDGList

typedef std::map< int, long long > JetTruthParticleSelectorTool::PDGList
private

Definition at line 77 of file JetTruthParticleSelectorTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ SelectionMode

Enumerator
Invalid 
StableNoMuonNoNu 
MuonOnly 
NuOnly 
NoWZDecay 

Definition at line 50 of file JetTruthParticleSelectorTool.h.

50  {
51  Invalid = -1,
53  MuonOnly,
54  NuOnly,
55  NoWZDecay,
56  };

Constructor & Destructor Documentation

◆ JetTruthParticleSelectorTool()

JetTruthParticleSelectorTool::JetTruthParticleSelectorTool ( const std::string &  s)

Definition at line 128 of file JetTruthParticleSelectorTool.cxx.

128  :
129  asg::AsgTool(n),
130  m_min_pt(-1),
131  m_max_pt(-1),
132  m_maxAbsEta(-1),
133  m_minEta(-5),
134  m_maxEta( 5),
135  m_wzPhotonCone(0.1),
136  m_useOnlyCharged(false),
137  m_listPDGofStables(false),
138  m_selectionModeName("StableNoMuonNoNu"),
140 {
141 
142  declareInterface<JetTruthParticleSelectorTool>(this);
143  declareProperty("min_pT", m_min_pt);
144  declareProperty("max_pT", m_max_pt);
145  declareProperty("max_absEta", m_maxAbsEta);
146  declareProperty("minEta", m_minEta);
147  declareProperty("maxEta", m_maxEta);
148  declareProperty("WZModePhotonCone", m_wzPhotonCone);
149 
150  declareProperty("useChargedParticlesOnly", m_useOnlyCharged);
151  declareProperty("MakeListOfStableParticles", m_listPDGofStables);
152  declareProperty("SelectionMode", m_selectionModeName);
153 }

◆ ~JetTruthParticleSelectorTool()

JetTruthParticleSelectorTool::~JetTruthParticleSelectorTool ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty() [1/4]

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

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

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

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

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

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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

◆ finalize()

StatusCode JetTruthParticleSelectorTool::finalize ( )
overridevirtual

Definition at line 277 of file JetTruthParticleSelectorTool.cxx.

278 {
279  if (m_listPDGofStables)
280  {
281  msg(MSG::INFO) << "Counts of PDGs of all stable particles :" << endmsg;
282  msg(MSG::INFO) << "========================================" << endmsg;
283  msg(MSG::INFO) << "| PDG | # particles |" << endmsg;
284  for ( PDGList::iterator it = m_pdgList.begin(); it != m_pdgList.end(); ++it )
285  {
286  msg(MSG::INFO) << "|"
287  << std::setw(10) << it->first << " |"
288  << std::setw(10) << it->second << " |"
289  << endmsg;
290  }
291  msg(MSG::INFO) << "| PDG | <p> | rms | <pt> | rms | <eta> | rms |" << endmsg;
292  for ( PDGList::iterator it = m_pdgList.begin(); it != m_pdgList.end(); ++it )
293  {
294  int n=it->second;
295  double p=m_avP[it->first]/n;
296  double p2=std::sqrt(m_av2P[it->first]/n-
297  m_avP[it->first]*m_avP[it->first]/n/n);
298  double pt=m_avPt[it->first]/n;
299  double pt2=std::sqrt(m_av2Pt[it->first]/n-
300  m_avPt[it->first]*m_avPt[it->first]/n/n);
301  double eta=m_avEta[it->first]/n;
302  double eta2=std::sqrt(m_av2Eta[it->first]/n-
303  m_avEta[it->first]*m_avEta[it->first]/n/n);
304  msg(MSG::INFO) << "|"
305  << std::setw(15) << it->first << " |"
306  << std::setw(15) << p << " |"
307  << std::setw(15) << p2 << " |"
308  << std::setw(15) << pt << " |"
309  << std::setw(15) << pt2 << " |"
310  << std::setw(15) << eta << " |"
311  << std::setw(15) << eta2 << " |"
312  << endmsg;
313  }
314  msg(MSG::INFO) << "| PDG | <phi> | rms | <m> | rms |" << endmsg;
315  for ( PDGList::iterator it = m_pdgList.begin(); it != m_pdgList.end(); ++it )
316  {
317  int n=it->second;
318  double phi=m_avPhi[it->first]/n;
319  double phi2=std::sqrt(m_av2Phi[it->first]/n-
320  m_avPhi[it->first]*m_avPhi[it->first]/n/n);
321  double m=m_avM[it->first]/n;
322  double m2=0;
323  if ( m_av2M[it->first]/n > m_avM[it->first]*m_avM[it->first]/n/n)
324  m2=std::sqrt(m_av2M[it->first]/n-
325  m_avM[it->first]*m_avM[it->first]/n/n);
326  msg(MSG::INFO) << "|"
327  << std::setw(15) << it->first << " |"
328  << std::setw(15) << phi << " |"
329  << std::setw(15) << phi2 << " |"
330  << std::setw(15) << m << " |"
331  << std::setw(15) << m2 << " |"
332  << endmsg;
333  }
334  }
335  return StatusCode::SUCCESS;
336 }

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

◆ 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 JetTruthParticleSelectorTool::initialize ( )
overridevirtual

Dummy implementation of the initialisation function.

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

Reimplemented from asg::AsgTool.

Definition at line 163 of file JetTruthParticleSelectorTool.cxx.

164 {
165 
166 
167  if( m_selectionModeName == "StableNoMuonNoNu") m_selectionMode = StableNoMuonNoNu ;
168  else if(m_selectionModeName == "MuonOnly") m_selectionMode = MuonOnly ;
169  else if(m_selectionModeName == "NuOnly") m_selectionMode = NuOnly ;
170  else if(m_selectionModeName == "NoWZDecay") m_selectionMode = NoWZDecay ;
171  else {
172  ATH_MSG_ERROR(" Unknown truth selection mode "<< m_selectionMode);
173  return StatusCode::FAILURE;
174  }
175 
176  m_pdgList.clear();
177  m_avP.clear();
178  m_av2P.clear();
179  m_avPt.clear();
180  m_av2Pt.clear();
181  m_avEta.clear();
182  m_av2Eta.clear();
183  m_avPhi.clear();
184  m_av2Phi.clear();
185  m_avM.clear();
186  m_av2M.clear();
187 
188  return StatusCode::SUCCESS;
189 }

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

◆ interfaceID()

static const InterfaceID& JetTruthParticleSelectorTool::interfaceID ( )
inlinestatic

Definition at line 44 of file JetTruthParticleSelectorTool.h.

44 {return IID_JetTruthParticleSelectorTool;}

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

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

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

◆ operator()()

bool JetTruthParticleSelectorTool::operator() ( const xAOD::TruthParticle truth)
inline

alias 'selector' to operator(const IN4M*)

Definition at line 37 of file JetTruthParticleSelectorTool.h.

37 { return this->selector(truth);}

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

◆ passKinematics()

bool JetTruthParticleSelectorTool::passKinematics ( const xAOD::TruthParticle truth) const

Definition at line 192 of file JetTruthParticleSelectorTool.cxx.

192  {
193  auto truth4Mom = truthPart->p4();
194  // some safety checks ... both will crash the eta calculation
195  if ( truth4Mom.E() <= 0 ) return false;
196  if ( truth4Mom.P() - truth4Mom.Pz() <= 0 ) return false;
197 
198  double pt = truth4Mom.Pt();
199  if ( m_min_pt > 0 && pt < m_min_pt ) return false;
200  if ( m_max_pt > 0 && pt > m_max_pt ) return false;
201  double eta = truth4Mom.Eta();
202  if ( m_maxAbsEta > 0 && fabs(eta) > m_maxAbsEta ) return false;
203  if ( eta < m_minEta ) return false;
204  if ( eta > m_maxEta ) return false;
205  return true;
206 }

◆ print()

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

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ selector()

bool JetTruthParticleSelectorTool::selector ( const xAOD::TruthParticle truth)

Definition at line 208 of file JetTruthParticleSelectorTool.cxx.

208  {
209 
210  bool result = false;
211  if (MC::isGeantino(truthPart)) return false; // protect against unexpected geantinos
212 
213  switch( m_selectionMode) { // For now only 4 modes used in practice for jets...
214  // a switch statement is probably not optimal here...
215  case StableNoMuonNoNu:
216  result =( MC::isStableOrSimDecayed(truthPart) && !HepMC::is_simulation_particle(truthPart) && !MC::isZeroEnergyPhoton(truthPart) &&
217  passKinematics(truthPart) && !MC::isMuon(truthPart) && (!( MC::isStable(truthPart) && MC::isSpecialNonInteracting(truthPart))));
218  break;
219  case NuOnly:
220  result= ( MC::isStableOrSimDecayed(truthPart) && !HepMC::is_simulation_particle(truthPart) && !MC::isZeroEnergyPhoton(truthPart) &&
221  passKinematics(truthPart) && MC::isStable(truthPart) && MC::isSpecialNonInteracting(truthPart));
222  break;
223  case MuonOnly:
224  result = MC::isMuon(truthPart);
225  break;
226  case NoWZDecay:
227  result = (MC::isStableOrSimDecayed(truthPart) && !HepMC::is_simulation_particle(truthPart) && !MC::isZeroEnergyPhoton(truthPart) &&
228  passKinematics(truthPart) &&
229  !isWZDecay(truthPart, m_wzLeptons, m_wzPhotonCone*m_wzPhotonCone) &&
230  !isLeptonFromTau(truthPart) );
231  break;
232  default:
233  break;
234  }
235 
236  if (m_listPDGofStables && result ) {
237  int apId = abs(truthPart->pdgId());
238  auto truth4Mom = truthPart->p4();
239  double p = truth4Mom.P();
240  double phi = truth4Mom.Phi();
241  double pt = truth4Mom.Pt();
242  double eta = truth4Mom.Eta();
243  PDGList::iterator it = m_pdgList.find(apId);
244  if ( it == m_pdgList.end() ) {
245  m_pdgList[apId]=1;
246  m_avP[apId]=p;
247  m_av2P[apId]=p * p;
248  m_avPt[apId]=pt;
249  m_av2Pt[apId]=pt * pt;
250  m_avEta[apId]=eta;
251  m_av2Eta[apId]=eta * eta;
252  m_avPhi[apId]=phi;
253  m_av2Phi[apId]=phi * phi;
254  m_avM[apId]=truthPart->m();
255  m_av2M[apId]=truthPart->m() * truthPart->m();
256  } else {
257  it->second++;
258  m_avP[apId]+=p;
259  m_av2P[apId]+=p * p;
260  m_avPt[apId]+=pt;
261  m_av2Pt[apId]+=pt * pt;
262  m_avEta[apId]+=eta;
263  m_av2Eta[apId]+=eta * eta;
264  m_avPhi[apId]+=phi;
265  m_av2Phi[apId]+=phi * phi;
266  m_avM[apId]+=truthPart->m();
267  m_av2M[apId]+=truthPart->m() * truthPart->m();
268  }
269  }
270 
271  ATH_MSG_VERBOSE("Truth selection result: " << truthPart<<", result=" << result);
272 
273  return result;
274 }

◆ setupEvent()

void JetTruthParticleSelectorTool::setupEvent ( )

Definition at line 158 of file JetTruthParticleSelectorTool.cxx.

158  {
159  m_wzLeptons.clear();
160 }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_av2Eta

Average JetTruthParticleSelectorTool::m_av2Eta
private

Definition at line 86 of file JetTruthParticleSelectorTool.h.

◆ m_av2M

Average JetTruthParticleSelectorTool::m_av2M
private

Definition at line 90 of file JetTruthParticleSelectorTool.h.

◆ m_av2P

Average JetTruthParticleSelectorTool::m_av2P
private

Definition at line 82 of file JetTruthParticleSelectorTool.h.

◆ m_av2Phi

Average JetTruthParticleSelectorTool::m_av2Phi
private

Definition at line 88 of file JetTruthParticleSelectorTool.h.

◆ m_av2Pt

Average JetTruthParticleSelectorTool::m_av2Pt
private

Definition at line 84 of file JetTruthParticleSelectorTool.h.

◆ m_avEta

Average JetTruthParticleSelectorTool::m_avEta
private

Definition at line 85 of file JetTruthParticleSelectorTool.h.

◆ m_avM

Average JetTruthParticleSelectorTool::m_avM
private

Definition at line 89 of file JetTruthParticleSelectorTool.h.

◆ m_avP

Average JetTruthParticleSelectorTool::m_avP
private

Definition at line 81 of file JetTruthParticleSelectorTool.h.

◆ m_avPhi

Average JetTruthParticleSelectorTool::m_avPhi
private

Definition at line 87 of file JetTruthParticleSelectorTool.h.

◆ m_avPt

Average JetTruthParticleSelectorTool::m_avPt
private

Definition at line 83 of file JetTruthParticleSelectorTool.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_listPDGofStables

bool JetTruthParticleSelectorTool::m_listPDGofStables
private

Definition at line 72 of file JetTruthParticleSelectorTool.h.

◆ m_max_pt

double JetTruthParticleSelectorTool::m_max_pt
private

Definition at line 62 of file JetTruthParticleSelectorTool.h.

◆ m_maxAbsEta

double JetTruthParticleSelectorTool::m_maxAbsEta
private

Definition at line 63 of file JetTruthParticleSelectorTool.h.

◆ m_maxEta

double JetTruthParticleSelectorTool::m_maxEta
private

Definition at line 65 of file JetTruthParticleSelectorTool.h.

◆ m_min_pt

double JetTruthParticleSelectorTool::m_min_pt
private

Definition at line 61 of file JetTruthParticleSelectorTool.h.

◆ m_minEta

double JetTruthParticleSelectorTool::m_minEta
private

Definition at line 64 of file JetTruthParticleSelectorTool.h.

◆ m_pdgList

PDGList JetTruthParticleSelectorTool::m_pdgList
private

Definition at line 78 of file JetTruthParticleSelectorTool.h.

◆ m_selectionMode

SelectionMode JetTruthParticleSelectorTool::m_selectionMode
private

Definition at line 75 of file JetTruthParticleSelectorTool.h.

◆ m_selectionModeName

std::string JetTruthParticleSelectorTool::m_selectionModeName
private

Definition at line 74 of file JetTruthParticleSelectorTool.h.

◆ m_useOnlyCharged

bool JetTruthParticleSelectorTool::m_useOnlyCharged
private

Definition at line 71 of file JetTruthParticleSelectorTool.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.

◆ m_wzLeptons

std::vector<const xAOD::TruthParticle*> JetTruthParticleSelectorTool::m_wzLeptons
private

Definition at line 92 of file JetTruthParticleSelectorTool.h.

◆ m_wzPhotonCone

double JetTruthParticleSelectorTool::m_wzPhotonCone
private

Definition at line 66 of file JetTruthParticleSelectorTool.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
get_generator_info.result
result
Definition: get_generator_info.py:21
python.SystemOfUnits.m2
int m2
Definition: SystemOfUnits.py:92
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
JetTruthParticleSelectorTool::StableNoMuonNoNu
@ StableNoMuonNoNu
Definition: JetTruthParticleSelectorTool.h:52
MC::isSpecialNonInteracting
bool isSpecialNonInteracting(const T &p)
Identify a special non-interacting particles.
Definition: HepMCHelpers.h:83
JetTruthParticleSelectorTool::passKinematics
bool passKinematics(const xAOD::TruthParticle *truth) const
Definition: JetTruthParticleSelectorTool.cxx:192
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetTruthParticleSelectorTool::NoWZDecay
@ NoWZDecay
Definition: JetTruthParticleSelectorTool.h:55
skel.it
it
Definition: skel.GENtoEVGEN.py:396
JetTruthParticleSelectorTool::m_avPt
Average m_avPt
Definition: JetTruthParticleSelectorTool.h:83
test_pyathena.pt
pt
Definition: test_pyathena.py:11
JetTruthParticleSelectorTool::MuonOnly
@ MuonOnly
Definition: JetTruthParticleSelectorTool.h:53
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
JetTruthParticleSelectorTool::m_min_pt
double m_min_pt
Definition: JetTruthParticleSelectorTool.h:61
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
JetTruthParticleSelectorTool::m_max_pt
double m_max_pt
Definition: JetTruthParticleSelectorTool.h:62
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
JetTruthParticleSelectorTool::NuOnly
@ NuOnly
Definition: JetTruthParticleSelectorTool.h:54
JetTruthParticleSelectorTool::m_avPhi
Average m_avPhi
Definition: JetTruthParticleSelectorTool.h:87
JetTruthParticleSelectorTool::m_av2Pt
Average m_av2Pt
Definition: JetTruthParticleSelectorTool.h:84
JetTruthParticleSelectorTool::m_wzLeptons
std::vector< const xAOD::TruthParticle * > m_wzLeptons
Definition: JetTruthParticleSelectorTool.h:92
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
JetTruthParticleSelectorTool::m_wzPhotonCone
double m_wzPhotonCone
Definition: JetTruthParticleSelectorTool.h:66
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
JetTruthParticleSelectorTool::m_av2Phi
Average m_av2Phi
Definition: JetTruthParticleSelectorTool.h:88
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
JetTruthParticleSelectorTool::m_selectionModeName
std::string m_selectionModeName
Definition: JetTruthParticleSelectorTool.h:74
HepMC::is_simulation_particle
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...
Definition: MagicNumbers.h:342
JetTruthParticleSelectorTool::m_av2M
Average m_av2M
Definition: JetTruthParticleSelectorTool.h:90
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
JetTruthParticleSelectorTool::Invalid
@ Invalid
Definition: JetTruthParticleSelectorTool.h:51
JetTruthParticleSelectorTool::m_av2P
Average m_av2P
Definition: JetTruthParticleSelectorTool.h:82
python.xAODType.dummy
dummy
Definition: xAODType.py:4
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
JetTruthParticleSelectorTool::m_listPDGofStables
bool m_listPDGofStables
Definition: JetTruthParticleSelectorTool.h:72
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
JetTruthParticleSelectorTool::m_useOnlyCharged
bool m_useOnlyCharged
Definition: JetTruthParticleSelectorTool.h:71
JetTruthParticleSelectorTool::selector
bool selector(const xAOD::TruthParticle *truth)
Definition: JetTruthParticleSelectorTool.cxx:208
JetTruthParticleSelectorTool::m_maxEta
double m_maxEta
Definition: JetTruthParticleSelectorTool.h:65
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
JetTruthParticleSelectorTool::m_avP
Average m_avP
Definition: JetTruthParticleSelectorTool.h:81
isGeantino
bool isGeantino(const T &p)
Definition: AtlasPID.h:229
JetTruthParticleSelectorTool::m_maxAbsEta
double m_maxAbsEta
Definition: JetTruthParticleSelectorTool.h:63
MC::isStableOrSimDecayed
bool isStableOrSimDecayed(const T &p)
Identify if particle is satble or decayed in simulation.
Definition: HepMCHelpers.h:65
JetTruthParticleSelectorTool::m_av2Eta
Average m_av2Eta
Definition: JetTruthParticleSelectorTool.h:86
MC::isStable
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
Definition: HepMCHelpers.h:45
a
TList * a
Definition: liststreamerinfos.cxx:10
h
JetTruthParticleSelectorTool::m_avM
Average m_avM
Definition: JetTruthParticleSelectorTool.h:89
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
JetTruthParticleSelectorTool::m_pdgList
PDGList m_pdgList
Definition: JetTruthParticleSelectorTool.h:78
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
MC::isZeroEnergyPhoton
bool isZeroEnergyPhoton(const T &p)
Identify a photon with zero energy. Probably a workaround for a generator bug.
Definition: HepMCHelpers.h:71
JetTruthParticleSelectorTool::m_avEta
Average m_avEta
Definition: JetTruthParticleSelectorTool.h:85
SG::DataProxy
Definition: DataProxy.h:44
JetTruthParticleSelectorTool::m_minEta
double m_minEta
Definition: JetTruthParticleSelectorTool.h:64
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
JetTruthParticleSelectorTool::m_selectionMode
SelectionMode m_selectionMode
Definition: JetTruthParticleSelectorTool.h:75
fitman.k
k
Definition: fitman.py:528
isMuon
bool isMuon(const T &p)
Definition: AtlasPID.h:154