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

#include <TruthBornLeptonCollectionMaker.h>

Inheritance diagram for DerivationFramework::TruthBornLeptonCollectionMaker:
Collaboration diagram for DerivationFramework::TruthBornLeptonCollectionMaker:

Public Member Functions

 TruthBornLeptonCollectionMaker (const std::string &t, const std::string &n, const IInterface *p)
 
 ~TruthBornLeptonCollectionMaker ()
 
StatusCode initialize ()
 
virtual StatusCode addBranches () const
 Pass the thinning service
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 ()
 AlgTool interface 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 ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool hasBareDescendent (const xAOD::TruthParticle *p) const
 Helper function for finding bare descendents of born leptons. 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

SG::ReadHandleKey< xAOD::TruthParticleContainerm_particlesKey {this, "ParticlesKey", "TruthParticles", "Name of TruthParticle key for input"}
 < Input particle collection key More...
 
SG::WriteHandleKey< xAOD::TruthParticleContainerm_collectionName {this, "NewCollectionName", "", "Name of TruthParticle key for output"}
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_originDecoratorKey {this, "classifierParticleOrigin", "TruthParticles.classifierParticleOrigin", "Particle origin decoration, set at initialisation"}
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_typeDecoratorKey {this, "classifierParticleType","TruthParticles.classifierParticleType", "Particle type decoration, set at initialisation"}
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_outcomeDecoratorKey {this, "classifierParticleOutCome", "TruthParticles.classifierParticleOutCome", "Particle outcome decoration, set at initialisation"}
 
SG::WriteDecorHandleKey< xAOD::TruthParticleContainerm_classificationDecoratorKey {this, "Classification", "TruthParticles.Classification", "Classification code decorator, set at initialisation"}
 
ServiceHandle< StoreGateSvcm_metaStore
 Handle on the metadata store for init. 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 31 of file TruthBornLeptonCollectionMaker.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

◆ TruthBornLeptonCollectionMaker()

DerivationFramework::TruthBornLeptonCollectionMaker::TruthBornLeptonCollectionMaker ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 27 of file TruthBornLeptonCollectionMaker.cxx.

30  : AthAlgTool(t,n,p)
31  , m_metaStore( "MetaDataStore", n )
32 {
33  declareInterface<DerivationFramework::IAugmentationTool>(this);
34  declareProperty( "MetaDataStore", m_metaStore );
35 }

◆ ~TruthBornLeptonCollectionMaker()

DerivationFramework::TruthBornLeptonCollectionMaker::~TruthBornLeptonCollectionMaker ( )

Definition at line 38 of file TruthBornLeptonCollectionMaker.cxx.

38  {
39 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::TruthBornLeptonCollectionMaker::addBranches ( ) const
virtual

Pass the thinning service

Implements DerivationFramework::IAugmentationTool.

Definition at line 74 of file TruthBornLeptonCollectionMaker.cxx.

75 {
76  // Event context
77  const EventContext& ctx = Gaudi::Hive::currentContext();
78 
79  // Set up for some metadata handling
80  static const bool is_sherpa = [this]() {
81  bool is_sherpa = false;
82  // TODO: needs to be made MT-friendly
83  if (m_metaStore->contains<xAOD::TruthMetaDataContainer>("TruthMetaData")){
84  // Note that I'd like to get this out of metadata in general, but it seems that the
85  // metadata isn't fully available in initialize, and since this is a const function
86  // I can only do the retrieve every event, rather than lazy-initializing, since this
87  // metadata ought not change during a run
88  const xAOD::TruthMetaDataContainer* truthMetaData(nullptr);
89  // Shamelessly stolen from the file meta data tool
90 
91  if (m_metaStore->retrieve(truthMetaData).isSuccess() && !truthMetaData->empty()){
92  // Let's just be super sure...
93  const std::string gens = truthMetaData->at(0)->generators();
94  is_sherpa = (gens.find("sherpa")==std::string::npos &&
95  gens.find("Sherpa")==std::string::npos &&
96  gens.find("SHERPA")==std::string::npos) ? false : true;
97  } // Seems to be the only sure way...
98  else {
99  ATH_MSG_WARNING("Found xAODTruthMetaDataContainer empty! Configuring to be NOT Sherpa.");
100  }
101  ATH_MSG_INFO("From metadata configured: Sherpa? " << is_sherpa);
102  }
103  else {
104  ATH_MSG_WARNING("Could not find metadata container in storegate; assuming NOT Sherpa");
105  }
106  return is_sherpa;
107  }();
108 
109  // Retrieve truth collections
111  if (!truthParticles.isValid()) {
112  ATH_MSG_ERROR("Couldn't retrieve TruthParticle collection with name " << m_particlesKey);
113  return StatusCode::FAILURE;
114  }
115 
116  // Create the new particle containers and WriteHandles
118  ATH_CHECK(newParticlesWriteHandle.record(std::make_unique<xAOD::TruthParticleContainer>(),
119  std::make_unique<xAOD::TruthParticleAuxContainer>()));
120  ATH_MSG_DEBUG( "Recorded new TruthParticleContainer with key: " << (m_collectionName.key()));
121 
122  // Set up decorators
127 
128  static const SG::ConstAccessor<unsigned int> classifierParticleTypeAcc("classifierParticleType");
129  static const SG::ConstAccessor<unsigned int> classifierParticleOriginAcc("classifierParticleOrigin");
130  static const SG::ConstAccessor<unsigned int> classifierParticleOutComeAcc("classifierParticleOutCome");
131  static const SG::ConstAccessor<unsigned int> ClassificationAcc("Classification");
132 
133  // add relevant particles to new collection
134  int sherpLepParentUniqueID = HepMC::UNDEFINED_ID;
135  for (unsigned int i=0; i<truthParticles->size(); ++i) {
136  // Grab the particle
137  const xAOD::TruthParticle* theParticle = (*truthParticles)[i];
138  if (!theParticle) continue; // Protection against null pointers
139  if (!theParticle->isLepton()) continue; // Only include leptons!
140 
141  if (is_sherpa > 0) {
142  // For Sherpa, skip is not status 11
143  if (theParticle->status() != 11) continue;
144  // Sherpa may have two sets of status == 11 leptons. Here we take the first set.
145  // To do so, we check the first status == 11 leptons,
146  // check that it has a child a parent barecode corresponding the the lepton's uniqueID
147  // If so, then save this parent uniqueID and skip all status 11 leptons with this parent uniqueID.
148 
149  if (sherpLepParentUniqueID == HepMC::UNDEFINED_ID) {
150  // Do test on first status 11 lepton
151  const xAOD::TruthParticle* thePartchild = theParticle->child();
152  if (thePartchild) {
153  int cparentUniqueID = (thePartchild->parent()) ? HepMC::uniqueID(thePartchild->parent()) : HepMC::UNDEFINED_ID;
154  if (cparentUniqueID == HepMC::uniqueID(theParticle)) {
155  sherpLepParentUniqueID = cparentUniqueID;
156  }
157  }
158  }
159  int puniqueID = (theParticle->parent()) ? HepMC::uniqueID(theParticle->parent()) : HepMC::UNDEFINED_ID;
160  if (sherpLepParentUniqueID > 0 && sherpLepParentUniqueID == puniqueID) continue;
161  } else if (is_sherpa == 0) {
162  // Some generators, look for leptons coming from vertices with other leptons
163  bool has_status_n3=false, has_status_3=false, has_V=false;
164  if (!MC::isPhysical(theParticle)){
165  // Look for other leptons in the production vertex... carefully
166  if (theParticle->hasProdVtx()){
167  const xAOD::TruthVertex * prod = theParticle->prodVtx();
168  for (size_t p=0;p<prod->nOutgoingParticles();++p){
169  if (prod->outgoingParticle(p) &&
170  prod->outgoingParticle(p)->isLepton()){
171  has_status_n3 = has_status_n3 || MC::isPhysical(prod->outgoingParticle(p));
172  has_status_3 = has_status_3 || MC::isPhysical(prod->outgoingParticle(p));
173  }
174  } // Loop over particles from the same production vertex
175  for (size_t p=0;p<prod->nIncomingParticles();++p){
176  // See if there was a boson going *into* the vertex
177  if (prod->incomingParticle(p) &&
178  (prod->incomingParticle(p)->isZ() || prod->incomingParticle(p)->isW() || prod->incomingParticle(p)->isHiggs()) ){
179  has_V=true;
180  break;
181  } // Found a vector boson
182  } // Loop over particles going into the same production vertex
183  } // Doesn't have a production vertex
184  }
185 
186  // Now we have all the information for the special case of V->l(born) l(bare) l(born) l(bare)
187  if ( !(has_status_3 && has_status_n3 && has_V && !MC::isPhysical(theParticle)) &&
188  theParticle->status()!=23){
189  // If not a special case, deal with the standard: has a boson parent, is a lepton, and has a descendent that is a bare lepton
190  if (!theParticle->parent()) continue;
191  if (!theParticle->parent()->isZ() && !theParticle->parent()->isW() && !theParticle->parent()->isHiggs()) continue;
192  if (!hasBareDescendent( theParticle ) ) continue;
193  }
194  } // End of treatment for generators that are not Sherpa
195 
196  // Add this particle to the new collection
197  xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
198  newParticlesWriteHandle->push_back( xTruthParticle );
199  // Fill with numerical content
200  *xTruthParticle=*theParticle;
201  // Copy over the decorations if they are available
202  typeDecorator(*xTruthParticle) = classifierParticleTypeAcc.withDefault(*theParticle, 0);
203  originDecorator(*xTruthParticle) = classifierParticleOriginAcc.withDefault(*theParticle, 0);
204  outcomeDecorator(*xTruthParticle) = classifierParticleOutComeAcc.withDefault(*theParticle, 0);
205  classificationDecorator(*xTruthParticle) = ClassificationAcc.withDefault(*theParticle, 0);
206  } // Loop over alll particles
207 
208  return StatusCode::SUCCESS;
209 }

◆ 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

◆ hasBareDescendent()

bool DerivationFramework::TruthBornLeptonCollectionMaker::hasBareDescendent ( const xAOD::TruthParticle p) const
private

Helper function for finding bare descendents of born leptons.

Definition at line 212 of file TruthBornLeptonCollectionMaker.cxx.

213 {
214  // Null pointer check
215  if (!p) return false;
216  // If we hit a bare descendent, then we're a winnner
217  if (p->isLepton() && MC::isStable(p) ) return true;
218  // Otherwise look through all the children
219  for (size_t c=0;c<p->nChildren();++c){
220  if (!p->child(c)) continue; // Null pointer protection
221  if (p->pdgId()!=p->child(c)->pdgId()) continue; // Different particle child
222  if (hasBareDescendent( p->child(c) )) return true;
223  }
224  // No luck -- this branch is a dead end
225  return false;
226 }

◆ initialize()

StatusCode DerivationFramework::TruthBornLeptonCollectionMaker::initialize ( )

Definition at line 42 of file TruthBornLeptonCollectionMaker.cxx.

43 {
44  ATH_MSG_VERBOSE("initialize() ...");
45 
46  // Input truth particles
48  ATH_MSG_INFO("Using " << m_particlesKey.key() << " as the input truth container key");
49 
50  // Output truth particles
51  if (m_collectionName.empty()) {
52  ATH_MSG_FATAL("No key provided for the new truth particle collection");
53  return StatusCode::FAILURE;
54  } else {ATH_MSG_INFO("New truth particle collection key: " << m_collectionName.key() );}
55  ATH_CHECK( m_collectionName.initialize());
56 
57  // Decoration keys
58  m_originDecoratorKey = m_collectionName.key() + ".classifierParticleOrigin";
59  ATH_CHECK(m_originDecoratorKey.initialize());
60  m_typeDecoratorKey = m_collectionName.key() + ".classifierParticleType";
61  ATH_CHECK(m_typeDecoratorKey.initialize());
62  m_outcomeDecoratorKey = m_collectionName.key() + ".classifierParticleOutCome";
63  ATH_CHECK(m_outcomeDecoratorKey.initialize());
64  m_classificationDecoratorKey = m_collectionName.key() + ".Classification";
66 
67  // TODO: needs to be made MT-friendly
68  ATH_CHECK( m_metaStore.retrieve() );
69 
70  return StatusCode::SUCCESS;
71 }

◆ 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& DerivationFramework::IAugmentationTool::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 31 of file IAugmentationTool.h.

31 { return IID_IAugmentationTool; }

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

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

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

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthBornLeptonCollectionMaker::m_classificationDecoratorKey {this, "Classification", "TruthParticles.Classification", "Classification code decorator, set at initialisation"}
private

Definition at line 52 of file TruthBornLeptonCollectionMaker.h.

◆ m_collectionName

SG::WriteHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthBornLeptonCollectionMaker::m_collectionName {this, "NewCollectionName", "", "Name of TruthParticle key for output"}
private

Definition at line 43 of file TruthBornLeptonCollectionMaker.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_metaStore

ServiceHandle<StoreGateSvc> DerivationFramework::TruthBornLeptonCollectionMaker::m_metaStore
private

Handle on the metadata store for init.

Definition at line 55 of file TruthBornLeptonCollectionMaker.h.

◆ m_originDecoratorKey

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthBornLeptonCollectionMaker::m_originDecoratorKey {this, "classifierParticleOrigin", "TruthParticles.classifierParticleOrigin", "Particle origin decoration, set at initialisation"}
private

Definition at line 46 of file TruthBornLeptonCollectionMaker.h.

◆ m_outcomeDecoratorKey

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthBornLeptonCollectionMaker::m_outcomeDecoratorKey {this, "classifierParticleOutCome", "TruthParticles.classifierParticleOutCome", "Particle outcome decoration, set at initialisation"}
private

Definition at line 50 of file TruthBornLeptonCollectionMaker.h.

◆ m_particlesKey

SG::ReadHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthBornLeptonCollectionMaker::m_particlesKey {this, "ParticlesKey", "TruthParticles", "Name of TruthParticle key for input"}
private

< Input particle collection key

Output particle collection key

Definition at line 40 of file TruthBornLeptonCollectionMaker.h.

◆ m_typeDecoratorKey

SG::WriteDecorHandleKey<xAOD::TruthParticleContainer> DerivationFramework::TruthBornLeptonCollectionMaker::m_typeDecoratorKey {this, "classifierParticleType","TruthParticles.classifierParticleType", "Particle type decoration, set at initialisation"}
private

Definition at line 48 of file TruthBornLeptonCollectionMaker.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:
xAOD::TruthVertex_v1::nOutgoingParticles
size_t nOutgoingParticles() const
Get the number of outgoing particles.
xAOD::TruthParticle_v1::parent
const TruthParticle_v1 * parent(size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Definition: TruthParticle_v1.cxx:131
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DerivationFramework::TruthBornLeptonCollectionMaker::m_originDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_originDecoratorKey
Definition: TruthBornLeptonCollectionMaker.h:47
DerivationFramework::TruthBornLeptonCollectionMaker::m_outcomeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_outcomeDecoratorKey
Definition: TruthBornLeptonCollectionMaker.h:51
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
xAOD::TruthParticle_v1::isW
bool isW() const
Check if this particle is a W boson.
SG::ConstAccessor< unsigned int >
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
xAOD::TruthParticle_v1::isZ
bool isZ() const
Check if this particle is a Z boson.
MC::isPhysical
bool isPhysical(const T &p)
Definition: HepMCHelpers.h:32
xAOD::TruthParticle_v1::isLepton
bool isLepton() const
Whether the particle is a lepton.
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
xAOD::TruthParticle
TruthParticle_v1 TruthParticle
Typedef to implementation.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticle.h:15
xAOD::TruthParticle_v1::hasProdVtx
bool hasProdVtx() const
Check for a production vertex on this particle.
Definition: TruthParticle_v1.cxx:74
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:113
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::TruthVertex_v1::incomingParticle
const TruthParticle_v1 * incomingParticle(size_t index) const
Get one of the incoming particles.
Definition: TruthVertex_v1.cxx:71
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
DerivationFramework::TruthBornLeptonCollectionMaker::m_collectionName
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_collectionName
Definition: TruthBornLeptonCollectionMaker.h:44
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:55
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
xAOD::TruthParticle_v1::prodVtx
const TruthVertex_v1 * prodVtx() const
The production vertex of this particle.
Definition: TruthParticle_v1.cxx:80
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:41
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DerivationFramework::TruthBornLeptonCollectionMaker::m_typeDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_typeDecoratorKey
Definition: TruthBornLeptonCollectionMaker.h:49
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
xAOD::TruthParticle_v1::status
int status() const
Status code.
MC::isStable
bool isStable(const T &p)
Definition: HepMCHelpers.h:30
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::TruthParticle_v1::isHiggs
bool isHiggs() const
Check if this particle is a Higgs boson.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::TruthVertex_v1::nIncomingParticles
size_t nIncomingParticles() const
Get the number of incoming particles.
Definition: TruthVertex_v1.cxx:49
xAOD::TruthParticle_v1::child
const TruthParticle_v1 * child(size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Definition: TruthParticle_v1.cxx:149
DerivationFramework::TruthBornLeptonCollectionMaker::hasBareDescendent
bool hasBareDescendent(const xAOD::TruthParticle *p) const
Helper function for finding bare descendents of born leptons.
Definition: TruthBornLeptonCollectionMaker.cxx:212
DerivationFramework::TruthBornLeptonCollectionMaker::m_classificationDecoratorKey
SG::WriteDecorHandleKey< xAOD::TruthParticleContainer > m_classificationDecoratorKey
Definition: TruthBornLeptonCollectionMaker.h:53
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
DerivationFramework::TruthBornLeptonCollectionMaker::m_metaStore
ServiceHandle< StoreGateSvc > m_metaStore
Handle on the metadata store for init.
Definition: TruthBornLeptonCollectionMaker.h:55
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
python.compressB64.c
def c
Definition: compressB64.py:93
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::TruthVertex_v1::outgoingParticle
const TruthParticle_v1 * outgoingParticle(size_t index) const
Get one of the outgoing particles.
Definition: TruthVertex_v1.cxx:121
fitman.k
k
Definition: fitman.py:528
DerivationFramework::TruthBornLeptonCollectionMaker::m_particlesKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_particlesKey
< Input particle collection key
Definition: TruthBornLeptonCollectionMaker.h:41