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

#include <TruthIsolationTool.h>

Inheritance diagram for TruthIsolationTool:
Collaboration diagram for TruthIsolationTool:

Public Types

enum  ParticleSelect { UseChargedOnly = 0, UseAll }
 enumerator to decide which strategy to apply in the selection of particles during the Et-isolation computation More...
 

Public Member Functions

 TruthIsolationTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~TruthIsolationTool ()
 
StatusCode initialize ()
 
const std::string & etIsolationsName (const std::string &mcEvtName) const
 Return the name of the TruthEtIsolations container (ie: its StoreGate location) given the StoreGate location of a McEventCollection. More...
 
StatusCode buildEtIsolations (const std::string &mcEvtName, ITruthIsolationTool::ParticleSelect sel)
 Computes the isolation energies for each of the HepMC::GenEvent contained into the McEventCollection. More...
 
StatusCode registerAlias (const std::string &originalMcEvtColl, const std::string &aliasMcEvtColl)
 Make an alias in the map of isolation energies. 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 ()
 Inline methods:
More...
 

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::unordered_map< std::string, std::string > EtIsolMap_t
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode buildEtIsolations (const std::string &mcEvtName, const HepMC::GenEvent *genEvt, const std::size_t genIdx, TruthEtIsolations &etIsols, ITruthIsolationTool::ParticleSelect sel)
 Computes the isolation energies for a given HepMC::GenEvent contained into the McEventCollection. More...
 
void computeIso (const std::list< HepMC::ConstGenParticlePtr > &parts, const HepMC::ConstGenParticlePtr &p, TruthEtIsolations &etIsolations, ITruthIsolationTool::ParticleSelect sel)
 Computes and stores the list of transverse isolation energies for various cone sizes into the TruthEtIsolations container. More...
 
void setupTruthEtIsolationsPrefix (Gaudi::Details::PropertyBase &truthEtIsolationsPrefix)
 Callback method to ensure consistency of the TruthEtIsolations prefix key. More...
 
void setupMcEventsOutput (Gaudi::Details::PropertyBase &mcEventsOutputName)
 Callback method to ensure consistency of output McEventCollection key. More...
 
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

const HepPDT::ParticleDataTable * m_pdt
 Particle Property service. More...
 
StringProperty m_prefix
 Prefix for the TruthEtIsolations container. More...
 
StringProperty m_mcEventsOutputName
 Name of the McEventCollection we should attach isolations to. More...
 
DoubleProperty m_ptGamMin
 Minimum transverse energy of gammas to be taken into account into the isolation computation. More...
 
EtIsolMap_t m_etIsolMap
 A map of McEventCollection StoreGate locations to the according StoreGate location of TruthEtIsolations. More...
 
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 32 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.h.

Member Typedef Documentation

◆ EtIsolMap_t

typedef std::unordered_map<std::string, std::string> TruthIsolationTool::EtIsolMap_t
private

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ ParticleSelect

enumerator to decide which strategy to apply in the selection of particles during the Et-isolation computation

Enumerator
UseChargedOnly 
UseAll 

Definition at line 43 of file ITruthIsolationTool.h.

43  {
44  UseChargedOnly = 0,
45  UseAll
46  };

Constructor & Destructor Documentation

◆ TruthIsolationTool()

TruthIsolationTool::TruthIsolationTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 41 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

43  :
44  AthAlgTool ( type, name, parent ),
45  m_pdt ( nullptr )
46 {
47  //
48  // Property declaration
49  //
50 
51  declareProperty( "ptGammaMin",
52  m_ptGamMin = 0.5*GeV,
53  "Minimum transverse energy of gammas to be taken into "
54  "account into the isolation computation." );
55 
56  declareProperty( "TruthEtIsolationsPrefix",
57  m_prefix = "TruthEtIsol",
58  "Prefix for the TruthEtIsolations container. This is the "
59  "string which will be prepended to the key of the "
60  "McEventCollection to build the (StoreGate) output "
61  "location for the TruthEtIsolations.\nie: \"GEN_EVENT\" "
62  "--> \"<prefix>_GEN_EVENT\"" );
63  m_prefix.declareUpdateHandler
65  this );
66 
67  declareProperty( "McEventsOutput",
68  m_mcEventsOutputName = "GEN_AOD",
69  "Name of the McEventCollection we should attach "
70  "isolations to" );
71  m_mcEventsOutputName.declareUpdateHandler
73  this );
74 
75  declareInterface<ITruthIsolationTool>(this);
76 }

◆ ~TruthIsolationTool()

TruthIsolationTool::~TruthIsolationTool ( )
virtualdefault

Member Function Documentation

◆ buildEtIsolations() [1/2]

StatusCode TruthIsolationTool::buildEtIsolations ( const std::string &  mcEvtName,
const HepMC::GenEvent *  genEvt,
const std::size_t  genIdx,
TruthEtIsolations etIsols,
ITruthIsolationTool::ParticleSelect  sel 
)
private

Computes the isolation energies for a given HepMC::GenEvent contained into the McEventCollection.

Definition at line 179 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

184 {
185  if ( nullptr == genEvt ) {
186  msg(MSG::WARNING)
187  << "Null pointer to GenEvent (idx = [" << genIdx << "] from "
188  << "McEventCollection [" << mcEvtName << "]) !!"
189  << endmsg;
190  return StatusCode::RECOVERABLE;
191  }
192 
193  // create a reduced list of particles
195  for ( const auto& i: *genEvt) {
197  particles.push_back( i );
198  }
199  }
200 
201  for ( const auto& i: *genEvt) {
202  const HepMC::FourVector hlv = i->momentum();
203  const int ida = std::abs(i->pdg_id());
204  const double pt = hlv.perp();
205 
206  // Compute isolation only for photon, electron, muon or tau.
207  // Not for documentation particle
208  const bool doComputeIso = ( ( ida == 22 && pt > m_ptGamMin ) ||
209  ida == 11 || ida == 13 || ida == 15 ) &&
211  if ( doComputeIso ) {
212  computeIso( particles, i, etIsols, partSel );
213  }
214  }
215 
216  return StatusCode::SUCCESS;
217 }

◆ buildEtIsolations() [2/2]

StatusCode TruthIsolationTool::buildEtIsolations ( const std::string &  mcEvtName,
ITruthIsolationTool::ParticleSelect  sel 
)
virtual

Computes the isolation energies for each of the HepMC::GenEvent contained into the McEventCollection.

One can switch b/w using all particles or only the charged ones. Default (from interface) is to use all.

Implements ITruthIsolationTool.

Definition at line 121 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

123 {
124  // retrieve collection
125  const McEventCollection* mcEvts = nullptr;
126  if ( !evtStore()->retrieve( mcEvts, mcEvtName ).isSuccess() ) {
127  ATH_MSG_WARNING("Could not retrieve a McEventCollection at ["
128  << mcEvtName << "] !!" << endmsg
129  << "No Et-isolations will be computed !");
130  return StatusCode::RECOVERABLE;
131  }
132 
133  // the name of the output (filtered) McEventCollection we want to attach
134  // the Et-isolations to
135  const std::string& outMcEvtName = m_mcEventsOutputName.value();
136 
137  // create the container of TruthEtIsolations
138  std::ostringstream truthEtIsolName;
139  truthEtIsolName << m_prefix.value()
141  ? "Charged"
142  : "")
143  << "_" << outMcEvtName;
144 
146  if ( !evtStore()->record( etIsolations,
147  truthEtIsolName.str() ).isSuccess() ) {
148  delete etIsolations;
149  etIsolations = nullptr;
150  ATH_MSG_WARNING("Could not record a TruthEtIsolations container at ["
151  << truthEtIsolName.str() << "] !!");
152  return StatusCode::RECOVERABLE;
153  }
154  if ( !evtStore()->setConst( etIsolations ).isSuccess() ) {
155  ATH_MSG_WARNING("Could not setConst the TruthEtIsolations container at ["
156  << truthEtIsolName.str() << "] !!");
157  }
158 
159  // update our registry of EtIsol StoreGate locations
160  m_etIsolMap[outMcEvtName] = truthEtIsolName.str();
161 
162  bool allGood = true;
163  for ( std::size_t iMc = 0, iMax = mcEvts->size(); iMc != iMax; ++iMc ) {
164  TruthEtIsolations * etIsols = new TruthEtIsolations( outMcEvtName, iMc );
165  etIsolations->push_back( etIsols );
166  if ( !buildEtIsolations( mcEvtName, (*mcEvts)[iMc], iMc,
167  *etIsols, partSel ).isSuccess() ) {
168  msg(MSG::WARNING)
169  << "Problem encountered while computing Et-isolations for idx=["
170  << iMc << "] of McEventCollection [" << mcEvtName << "] !!"
171  << endmsg;
172  allGood = false;
173  }
174  }
175  return allGood ? StatusCode::SUCCESS : StatusCode::RECOVERABLE;
176 }

◆ computeIso()

void TruthIsolationTool::computeIso ( const std::list< HepMC::ConstGenParticlePtr > &  parts,
const HepMC::ConstGenParticlePtr p,
TruthEtIsolations etIsolations,
ITruthIsolationTool::ParticleSelect  sel 
)
private

Computes and stores the list of transverse isolation energies for various cone sizes into the TruthEtIsolations container.

Definition at line 220 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

224 {
225  const HepLorentzVector hlv = ::svToLv(part->momentum());
226  const int ida = std::abs(part->pdg_id());
227 
228  McAod::EtIsolations etIsol = { {0.*GeV, 0.*GeV, 0.*GeV, 0.*GeV,
229  0.*GeV, 0.*GeV, 0.*GeV, 0.*GeV} };
230  McAod::EtIsolations pxi = etIsol;
231  McAod::EtIsolations pyi = etIsol;
232 
233  int barcodepart = HepMC::barcode(part);
234  for (const auto & particle : particles) {
235  if ( HepMC::barcode(particle) == barcodepart ) {
236  continue;
237  }
238  if( partSel == ITruthIsolationTool::UseChargedOnly ) {
239  double particleCharge = MC::charge(particle->pdg_id());
240  if( std::abs(particleCharge)<1.e-2 )
241  continue;
242  }
243  const HepLorentzVector itrHlv = ::svToLv(particle->momentum());
244  const double r = hlv.deltaR(itrHlv);
245  for ( std::size_t iCone = 0;
247  ++iCone ) {
249  pxi[iCone] += itrHlv.px();
250  pyi[iCone] += itrHlv.py();
251  }
252  }
253  }
254 
255  //
256  // Correction for tau (as was done in the old tool for the time being)
257  double pxv = 0.*GeV;
258  double pyv = 0.*GeV;
259  auto decVtx = part->end_vertex();
260  if (ida == 15 && decVtx) {
261  for (const auto& child: *decVtx) {
262  if ( MC::isSimInteracting(child) ) {
263  if( partSel == ITruthIsolationTool::UseChargedOnly ) {
264  double particleCharge = MC::charge(child->pdg_id());
265  if( std::abs(particleCharge)<1.e-2 )
266  continue;
267  }
268  const HepMC::FourVector childHlv = child->momentum();
269  pxv += childHlv.px();
270  pyv += childHlv.py();
271  }
272  }
273  }
274 
275  for ( std::size_t i = 0;
276  i != static_cast<std::size_t>(TruthParticleParameters::NbrOfCones);
277  ++i ) {
278  pxi[i] -= pxv;
279  pyi[i] -= pyv;
280  etIsol[i] = std::sqrt(pxi[i]*pxi[i]+pyi[i]*pyi[i]);
281  }
282 
283  etIsolations.setEtIsol( part, etIsol );
284 }

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

◆ etIsolationsName()

const std::string & TruthIsolationTool::etIsolationsName ( const std::string &  mcEvtName) const
virtual

Return the name of the TruthEtIsolations container (ie: its StoreGate location) given the StoreGate location of a McEventCollection.

It returns an empty string if no TruthEtIsolations container has been processed by the isolation tool.

Implements ITruthIsolationTool.

Definition at line 109 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

110 {
111  static const std::string s_emptyString = "";
112  const EtIsolMap_t::const_iterator i = m_etIsolMap.find(mcEvtName);
113  if ( i != m_etIsolMap.end() ) {
114  return i->second;
115  }
116 
117  return s_emptyString;
118 }

◆ 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

◆ initialize()

StatusCode TruthIsolationTool::initialize ( )
virtual

Implements ITruthIsolationTool.

Definition at line 81 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

82 {
83  // retrieve StoreGate
84  if ( !evtStore().retrieve().isSuccess() ) {
85  ATH_MSG_ERROR("Could not get a handle on StoreGateSvc !!");
86  return StatusCode::FAILURE;
87  }
88 
89  ATH_MSG_INFO(" McEventsOutput: [" << m_mcEventsOutputName.value() << "]");
90 
91  // Get the Particle Properties Service
92  ServiceHandle<IPartPropSvc> partPropSvc("PartPropSvc", name());
93  if ( !partPropSvc.retrieve().isSuccess() ) {
94  ATH_MSG_ERROR(" Could not initialize Particle Properties Service");
95  return StatusCode::FAILURE;
96  }
97 
98  m_pdt = partPropSvc->PDT();
99  if ( nullptr == m_pdt ) {
100  ATH_MSG_ERROR("Could not retrieve HepPDT::ParticleDataTable from "\
101  "ParticleProperties Service !!");
102  return StatusCode::FAILURE;
103  }
104 
105  return StatusCode::SUCCESS;
106 }

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

const InterfaceID & ITruthIsolationTool::interfaceID ( )
inlinestaticinherited

Inline methods:

Definition at line 100 of file ITruthIsolationTool.h.

101 {
102  return IID_ITruthIsolationTool;
103 }

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

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

◆ registerAlias()

StatusCode TruthIsolationTool::registerAlias ( const std::string &  originalMcEvtColl,
const std::string &  aliasMcEvtColl 
)
virtual

Make an alias in the map of isolation energies.

Implements ITruthIsolationTool.

Definition at line 299 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

301 {
302  m_etIsolMap[aliasMcEvtColl] = m_etIsolMap[originalMcEvtColl];
303  return StatusCode::SUCCESS;
304 }

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

◆ setupMcEventsOutput()

void TruthIsolationTool::setupMcEventsOutput ( Gaudi::Details::PropertyBase &  mcEventsOutputName)
private

Callback method to ensure consistency of output McEventCollection key.

Definition at line 293 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

294 {
295  // no-op for now
296 }

◆ setupTruthEtIsolationsPrefix()

void TruthIsolationTool::setupTruthEtIsolationsPrefix ( Gaudi::Details::PropertyBase &  truthEtIsolationsPrefix)
private

Callback method to ensure consistency of the TruthEtIsolations prefix key.

Definition at line 287 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.

288 {
289  // no-op for now
290 }

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

EtIsolMap_t TruthIsolationTool::m_etIsolMap
private

A map of McEventCollection StoreGate locations to the according StoreGate location of TruthEtIsolations.

Definition at line 139 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.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_mcEventsOutputName

StringProperty TruthIsolationTool::m_mcEventsOutputName
private

Name of the McEventCollection we should attach isolations to.

Definition at line 128 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.h.

◆ m_pdt

const HepPDT::ParticleDataTable* TruthIsolationTool::m_pdt
private

Particle Property service.

Definition at line 118 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.h.

◆ m_prefix

StringProperty TruthIsolationTool::m_prefix
private

Prefix for the TruthEtIsolations container.

This is the string which will be prepended to the key of the McEventCollection to build the (StoreGate) output location for the TruthEtIsolations. ie: "GEN_EVENT" --> "<prefix>_GEN_EVENT"

Definition at line 124 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.h.

◆ m_ptGamMin

DoubleProperty TruthIsolationTool::m_ptGamMin
private

Minimum transverse energy of gammas to be taken into account into the isolation computation.

Default is ptMin = 0.5*GeV

Definition at line 134 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
beamspotman.r
def r
Definition: beamspotman.py:676
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
TruthParticleParameters::NbrOfCones
@ NbrOfCones
Definition: TruthParticleParamDefs.h:31
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TruthEtIsolationsContainer
Definition: TruthEtIsolationsContainer.h:26
test_pyathena.pt
pt
Definition: test_pyathena.py:11
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
TruthEtIsolations::setEtIsol
void setEtIsol(const HepMC::ConstGenParticlePtr &genParticle, const TruthParticleParameters::ConeSize coneIdx, const double etIsol)
Set the transverse energy isolation of a HepMC::GenParticle for a given Cone size.
Definition: TruthEtIsolations.cxx:127
TruthParticleParameters::ConeSize
ConeSize
Enum for Cone size indexes (for isolation)
Definition: TruthParticleParamDefs.h:20
TruthIsolationTool::m_pdt
const HepPDT::ParticleDataTable * m_pdt
Particle Property service.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.h:118
TruthIsolationTool::computeIso
void computeIso(const std::list< HepMC::ConstGenParticlePtr > &parts, const HepMC::ConstGenParticlePtr &p, TruthEtIsolations &etIsolations, ITruthIsolationTool::ParticleSelect sel)
Computes and stores the list of transverse isolation energies for various cone sizes into the TruthEt...
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx:220
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TruthIsolationTool::m_mcEventsOutputName
StringProperty m_mcEventsOutputName
Name of the McEventCollection we should attach isolations to.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.h:128
TruthIsolationTool::m_etIsolMap
EtIsolMap_t m_etIsolMap
A map of McEventCollection StoreGate locations to the according StoreGate location of TruthEtIsolatio...
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.h:139
TruthIsolationTool::setupMcEventsOutput
void setupMcEventsOutput(Gaudi::Details::PropertyBase &mcEventsOutputName)
Callback method to ensure consistency of output McEventCollection key.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx:293
MC::isGenStable
bool isGenStable(const T &p)
Determine if the particle is stable at the generator (not det-sim) level,.
Definition: HepMCHelpers.h:36
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
McAod::EtIsolations
std::array< double, TruthParticleParameters::NbrOfCones > EtIsolations
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
Definition: TruthParticleParamDefs.h:60
MC::isPhysical
bool isPhysical(const T &p)
Definition: HepMCHelpers.h:32
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TruthIsolationTool::m_ptGamMin
DoubleProperty m_ptGamMin
Minimum transverse energy of gammas to be taken into account into the isolation computation.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.h:134
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TruthParticleParameters::coneCut
double coneCut(const TruthParticleParameters::ConeSize idx)
The actual definition of delta R cuts for each cone.
Definition: TruthParticleParamDefs.h:38
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
checkRpcDigits.allGood
bool allGood
Loop over the SDOs & Digits.
Definition: checkRpcDigits.py:171
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
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
TruthIsolationTool::buildEtIsolations
StatusCode buildEtIsolations(const std::string &mcEvtName, ITruthIsolationTool::ParticleSelect sel)
Computes the isolation energies for each of the HepMC::GenEvent contained into the McEventCollection.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx:121
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
charge
double charge(const T &p)
Definition: AtlasPID.h:494
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TruthIsolationTool::setupTruthEtIsolationsPrefix
void setupTruthEtIsolationsPrefix(Gaudi::Details::PropertyBase &truthEtIsolationsPrefix)
Callback method to ensure consistency of the TruthEtIsolations prefix key.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx:287
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
a
TList * a
Definition: liststreamerinfos.cxx:10
h
TruthEtIsolations
Definition: TruthEtIsolations.h:40
ITruthIsolationTool::UseAll
@ UseAll
Definition: ITruthIsolationTool.h:45
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
MC::isSimInteracting
bool isSimInteracting(const T &p)
Identify if the particle could interact with the detector during the simulation, e....
Definition: HepMCHelpers.h:42
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
ITruthIsolationTool::UseChargedOnly
@ UseChargedOnly
Definition: ITruthIsolationTool.h:44
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
TruthEtIsolationsContainer
TruthEtIsolationsContainer
Definition: McParticleEventTPCnv.cxx:25
TruthIsolationTool::m_prefix
StringProperty m_prefix
Prefix for the TruthEtIsolations container.
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.h:124
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
GenParticles_t
std::list< HepMC::ConstGenParticlePtr > GenParticles_t
Definition: TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx:39
ServiceHandle< IPartPropSvc >