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

#include <Truth3CollectionMaker.h>

Inheritance diagram for DerivationFramework::Truth3CollectionMaker:
Collaboration diagram for DerivationFramework::Truth3CollectionMaker:

Public Member Functions

 Truth3CollectionMaker (const std::string &t, const std::string &n, const IInterface *p)
 
 ~Truth3CollectionMaker ()
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual StatusCode addBranches () const override
 Pass the thinning service
More...
 
StatusCode initializeParser (const ExpressionParsing::SelectionArg< 1 > &selection_string)
 
StatusCode finalizeParser ()
 
virtual bool updateDataNeeds (const std::vector< const DataObjID * > &input_data_in, const std::vector< const DataObjID * > &output_data_in, std::vector< Gaudi::DataHandle * > &new_input_handles, std::vector< Gaudi::DataHandle * > &new_output_handles) override
 Inform a dynamic data consumer about all consumed or produced data. More...
 
virtual bool renounceInput (const DataObjID &output_data_id) override
 
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

StatusCode _initializeParser (const ExpressionParsing::SelectionArg< NUM_PARSER > &selection_string, ExpressionParsing::AppendLoaderFunc pre_xaod_loader=ExpressionParsing::NoLoaderFunc, ExpressionParsing::AppendLoaderFunc post_xaod_loader=ExpressionParsing::NoLoaderFunc)
 
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...
 

Protected Attributes

ExpressionParsing::SGxAODProxyLoaderm_xAODProxyLoader
 The expression parser. More...
 
std::unique_ptr< ExpressionParsing::IProxyLoaderm_proxyLoaders
 
std::conditional< NUM_PARSER==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > >::type m_parser
 
std::vector< std::string > m_renounce
 

Private Types

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

std::atomic< unsigned int > m_ntotpart
 
std::atomic< unsigned int > m_npasspart
 
std::string m_particlesKey
 
std::string m_collectionName
 
std::string m_partString
 
ToolHandle< IMCTruthClassifierm_classifier
 
bool m_runClassifier
 
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 23 of file Truth3CollectionMaker.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

◆ Truth3CollectionMaker()

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

Definition at line 20 of file Truth3CollectionMaker.cxx.

22  :
24 //m_ntotvtx(0),
25 m_ntotpart(0),
26 //m_npassvtx(0),
27 m_npasspart(0),
28 m_particlesKey("TruthParticles"),
29 //m_verticesKey("TruthVertices"),
31 m_partString(""),
32 m_classifier("MCTruthClassifier/MCTruthClassifier"),
33 m_runClassifier(true)
34 {
35  declareInterface<DerivationFramework::IAugmentationTool>(this);
36  declareProperty("ParticlesKey", m_particlesKey);
37  //declareProperty("VerticesKey", m_verticesKey);
38  declareProperty("NewCollectionName", m_collectionName);
39  declareProperty("ParticleSelectionString", m_partString);
40  declareProperty("MCTruthClassifier", m_classifier);
41  declareProperty("RunClassifier", m_runClassifier);
42 }

◆ ~Truth3CollectionMaker()

DerivationFramework::Truth3CollectionMaker::~Truth3CollectionMaker ( )

Definition at line 45 of file Truth3CollectionMaker.cxx.

45  {
46 }

Member Function Documentation

◆ _initializeParser()

StatusCode ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::_initializeParser ( const ExpressionParsing::SelectionArg< NUM_PARSER > &  selection_string,
ExpressionParsing::AppendLoaderFunc  pre_xaod_loader = ExpressionParsing::NoLoaderFunc,
ExpressionParsing::AppendLoaderFunc  post_xaod_loader = ExpressionParsing::NoLoaderFunc 
)
protectedinherited

◆ addBranches()

StatusCode DerivationFramework::Truth3CollectionMaker::addBranches ( ) const
overridevirtual

Pass the thinning service

Implements DerivationFramework::IAugmentationTool.

Definition at line 86 of file Truth3CollectionMaker.cxx.

87 {
88 
89  // Retrieve truth collections
90  const xAOD::TruthParticleContainer* importedTruthParticles;
91  if (evtStore()->retrieve(importedTruthParticles,m_particlesKey).isFailure()) {
92  ATH_MSG_ERROR("No TruthParticle collection with name " << m_particlesKey << " found in StoreGate!");
93  return StatusCode::FAILURE;
94  }
95 
96  // Create the new containers
97  xAOD::TruthParticleContainer* newParticleCollection = new xAOD::TruthParticleContainer();
98  CHECK( evtStore()->record( newParticleCollection, m_collectionName ) );
99  xAOD::TruthParticleAuxContainer* newParticleAuxCollection = new xAOD::TruthParticleAuxContainer();
100  CHECK( evtStore()->record( newParticleAuxCollection, m_collectionName + "Aux." ) );
101  newParticleCollection->setStore( newParticleAuxCollection );
102  ATH_MSG_DEBUG( "Recorded new TruthParticleContainer with key: " << m_collectionName);
103 
104  // Set up a mask with the same entries as the full collections
105  unsigned int nParticles = importedTruthParticles->size();
106  m_ntotpart += nParticles;
107 
108  // Set up decorators
109  static const SG::AuxElement::Decorator< ElementLink<xAOD::TruthParticleContainer> > linkDecorator("originalTruthParticle");
110  static const SG::AuxElement::Decorator< int > originDecorator("particleMotherPdgId");
111  static const SG::AuxElement::Decorator< int > typeDecorator("particleOriginBarcode"); // FIXME barcode-based
112  static const SG::AuxElement::Decorator< float > typeDecoratorMass("particleOriginMass");
113  static const SG::AuxElement::Decorator< int > tauprongDecorator("nprong");
114  static const SG::AuxElement::Decorator< int > tautypeDecorator("islep");
115 
116  std::vector<int> entries;
117 
118  // Execute the text parsers and update the mask
119  if (!m_partString.empty()) {
120  entries = m_parser->evaluateAsVector();
121  // check the sizes are compatible
122  if (nParticles != entries.size() ) {
123  ATH_MSG_ERROR("Sizes incompatible! Are you sure your selection string used TruthParticles?");
124  return StatusCode::FAILURE;
125  } else {
126  // add relevant particles to new collection
127  for (unsigned int i=0; i<nParticles; ++i) {
128  ElementLink<xAOD::TruthParticleContainer> eltp(*importedTruthParticles,i);
129  if (entries[i]==1) {
130 
131  const xAOD::TruthParticle* theParticle = (*importedTruthParticles)[i];
132 
133  //SUSYTRUTH definitions are based on Appendix A in http://arxiv.org/pdf/1403.4853v1.pdf.
134 
135  //SUSYTRUTH Leptons
136  if (theParticle->isLepton()){
137  bool drop = false;
138  if (!theParticle->hasProdVtx()) drop = true;
139  else{
140  const int parentPDGID = abs(theParticle->prodVtx()->incomingParticle(0)->pdgId());
141  const double parentMass = theParticle->prodVtx()->incomingParticle(0)->p4().M()/1000.;
142  if (parentPDGID==24 && parentMass < 20){ //semi-leptonic b-decays in Herwig++ where the off-shell W is saved
143  drop = true;
144  }
145  else if (parentPDGID!=24 && parentPDGID!=15){ //what about W decays in Sherpa?
146  drop = true;
147  }
148  else if (parentPDGID==15){//check to make sure the tau came from a W
149  if (theParticle->prodVtx()->incomingParticle(0)->hasProdVtx()){
150  const xAOD::TruthParticle * mother_hold = theParticle->prodVtx()->incomingParticle(0)->prodVtx()->incomingParticle(0);
151  int mcount = 0;
152  while (mother_hold->hasProdVtx() && abs(mother_hold->pdgId())==15){
153  mcount++;
154  if (mcount > 10){ //should not ever come in here, but just in case there is a closed loop somewhere.
155  break;
156  }
157  mother_hold = mother_hold->prodVtx()->incomingParticle(0);
158  }
159  if (mcount > 10 || abs(mother_hold->pdgId())!=24){
160  drop = true;
161  }
162  else{
163  //keep
164  }
165  }
166  else{
167  drop = true;
168  }
169  }
170  }
171  if (drop){
172  entries[i]=0;
173  continue;
174  }
175  }
176 
177  xAOD::TruthParticle* xTruthParticle = new xAOD::TruthParticle();
178  newParticleCollection->push_back( xTruthParticle );
179 
180  int motherBarcode = HepMC::INVALID_PARTICLE_ID;
181  int motherPDGid = 0;
182  float mothermass = 0.;
183  if (theParticle->hasProdVtx()){
184  const xAOD::TruthParticle * mother_hold = theParticle->prodVtx()->incomingParticle(0);
185  motherBarcode = HepMC::barcode(mother_hold);
186  motherPDGid = mother_hold->pdgId();
187  mothermass = mother_hold->p4().M()/1000.;
188  xTruthParticle->setBarcode(motherBarcode); // FIXME barcode-based
189  int mcount = 0;
190  //Let's find the first mother of mothers that has a different PDGid
191  while (mother_hold->hasProdVtx() && mother_hold->pdgId()==theParticle->pdgId()){
192  mcount++;
193  if (mcount > 10){
194  break; //should not come in here, but just in case we have a closed loop from a bug
195  }
196  mother_hold = mother_hold->prodVtx()->incomingParticle(0);
197  motherBarcode = HepMC::barcode(mother_hold); // FIXME barcode-based
198  motherPDGid = mother_hold->pdgId();
199  mothermass = mother_hold->p4().M()/1000.;
200  }
201  }
202 
203  *xTruthParticle=*theParticle;
204  xTruthParticle->setBarcode(motherBarcode); // FIXME barcode-based
205  originDecorator(*xTruthParticle) = motherPDGid;
206  typeDecorator(*xTruthParticle) = motherBarcode; // FIXME barcode-based
207  typeDecoratorMass(*xTruthParticle) = mothermass;
208 
209  //Check for tau decays
210  if (abs(theParticle->pdgId()) == 15 && theParticle->hasDecayVtx()){
211  int nprong = 0;
212  int islep = 0;
213 
214  //Algorithm:
215  //Make a vector of all children of the tau. While one of the children has a child:
216  //Go down one level and store all of the children of the children. If no children have a child, stop.
217 
218  /*
219  std::vector< std::vector<const xAOD::TruthParticle *> > tau_family;
220  bool has_a_child = 0;
221  std::vector<const xAOD::TruthParticle *> tau_daughts_first;
222  for (unsigned int j=0; j<theParticle->nChildren(); j++){
223  const xAOD::TruthParticle * daught_hold = theParticle->decayVtx()->outgoingParticle(j);
224  tau_daughts_first.push_back(daught_hold);
225  if (daught_hold->hasDecayVtx()){
226  has_a_child = 1;
227  }
228  }
229  tau_family.push_back(tau_daughts_first);
230  int level = -1;
231  while (has_a_child){
232  level++;
233  has_a_child = 0;
234  std::vector<const xAOD::TruthParticle *> tau_daughts;
235  for (unsigned int j=0; j<tau_family[level].size(); j++){
236  for (unsigned int k=0; k<tau_family[level][j]->nChildren(); k++){
237  const xAOD::TruthParticle * daught_hold = tau_family[level][j]->decayVtx()->outgoingParticle(k);
238  tau_daughts.push_back(daught_hold);
239  if (daught_hold->hasDecayVtx()){
240  has_a_child = 1;
241  }
242  }
243  }
244  tau_family.push_back(tau_daughts);
245  }
246 
247  for (unsigned int i=0; i<tau_family.size(); i++){
248  for (unsigned int j=0; j<tau_family[i].size(); j++){
249  if (tau_family[i][j]->isChLepton()){
250  islep=1;
251  }
252  if (tau_family[i][j]->hasDecayVtx()){
253  continue;
254  }
255  if (tau_family[i][j]->isCharged()){
256  nprong++;
257  }
258  }
259  }
260  */
261 
262  //std::cout << "nprong " << nprong << " " << islep << std::endl;
263  tauprongDecorator(*xTruthParticle) = nprong;
264  tautypeDecorator(*xTruthParticle) = islep;
265  }
266  }
267  }
268  }
269  }
270  // Count the mask
271  for (unsigned int i=0; i<nParticles; ++i){
272  if (entries[i]) ++m_npasspart;
273  }
274 
275  return StatusCode::SUCCESS;
276 }

◆ 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 DerivationFramework::Truth3CollectionMaker::finalize ( )
overridevirtual

Definition at line 76 of file Truth3CollectionMaker.cxx.

77 {
78  ATH_MSG_VERBOSE("finalize() ...");
79  //ATH_MSG_INFO("Processed "<< m_ntotvtx <<" truth vertices, "<< m_npassvtx << " were retained ");
80  ATH_MSG_INFO("Processed "<< m_ntotpart <<" truth particles, "<< m_npasspart << " were retained ");
82  return StatusCode::SUCCESS;
83 }

◆ finalizeParser()

StatusCode ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::finalizeParser ( )
inherited

◆ initialize()

StatusCode DerivationFramework::Truth3CollectionMaker::initialize ( )
overridevirtual

Definition at line 49 of file Truth3CollectionMaker.cxx.

50 {
51  ATH_MSG_VERBOSE("initialize() ...");
52  if (m_runClassifier) ATH_CHECK(m_classifier.retrieve());
53 
54  if (m_particlesKey=="" /*|| m_verticesKey==""*/) {
55  ATH_MSG_FATAL("No truth particle collection provided to use as a basis for new collections");
56  return StatusCode::FAILURE;
57  } else {ATH_MSG_INFO("Using " << m_particlesKey << " as the source collections for new truth collections");}
58 
59  if (m_collectionName=="") {
60  ATH_MSG_FATAL("No key provided for the new truth particle collection");
61  return StatusCode::FAILURE;
62  } else {ATH_MSG_INFO("New truth particle collection key: " << m_collectionName );}
63 
64  if (m_partString=="") {
65  ATH_MSG_FATAL("No selection string provided");
66  return StatusCode::FAILURE;
67  } else {ATH_MSG_INFO("Truth particle selection string: " << m_partString );}
68 
69  // Set up the text-parsing machinery for thinning the truth directly according to user cuts
70  if ( !m_partString.empty() ) {
72  }
73  return StatusCode::SUCCESS;
74 }

◆ initializeParser()

StatusCode ExpressionParserUser< AthAlgTool , 1 >::initializeParser ( const ExpressionParsing::SelectionArg< NUM_PARSER > &  selection_string)
inherited

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

◆ renounceInput()

virtual bool ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::renounceInput ( const DataObjID &  output_data_id)
overridevirtualinherited

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

◆ updateDataNeeds()

virtual bool ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::updateDataNeeds ( const std::vector< const DataObjID * > &  input_data_in,
const std::vector< const DataObjID * > &  output_data_in,
std::vector< Gaudi::DataHandle * > &  new_input_handles,
std::vector< Gaudi::DataHandle * > &  new_output_handles 
)
overridevirtualinherited

Inform a dynamic data consumer about all consumed or produced data.

Parameters
input_data_inthe input data object IDs of all algorithms and tools
output_data_inthe output data object IDs of all algorithms and tools
new_input_handlesthe new input data handles added by this call
new_output_handlesthe new output data handles added by this call
Returns
true if the consumer did update its handles, false otherwise

Implements IDynamicDataConsumer.

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

ToolHandle<IMCTruthClassifier> DerivationFramework::Truth3CollectionMaker::m_classifier
private

Definition at line 37 of file Truth3CollectionMaker.h.

◆ m_collectionName

std::string DerivationFramework::Truth3CollectionMaker::m_collectionName
private

Definition at line 35 of file Truth3CollectionMaker.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_npasspart

std::atomic<unsigned int> DerivationFramework::Truth3CollectionMaker::m_npasspart
private

Definition at line 32 of file Truth3CollectionMaker.h.

◆ m_ntotpart

std::atomic<unsigned int> DerivationFramework::Truth3CollectionMaker::m_ntotpart
mutableprivate

Definition at line 32 of file Truth3CollectionMaker.h.

◆ m_parser

std::conditional< NUM_PARSER == 1, std::unique_ptr<ExpressionParsing::ExpressionParser>, std::array< std::unique_ptr<ExpressionParsing::ExpressionParser>, NUM_PARSER> >::type ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::m_parser
protectedinherited

Definition at line 100 of file ExpressionParserUser.h.

◆ m_particlesKey

std::string DerivationFramework::Truth3CollectionMaker::m_particlesKey
private

Definition at line 33 of file Truth3CollectionMaker.h.

◆ m_partString

std::string DerivationFramework::Truth3CollectionMaker::m_partString
private

Definition at line 36 of file Truth3CollectionMaker.h.

◆ m_proxyLoaders

std::unique_ptr<ExpressionParsing::IProxyLoader> ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::m_proxyLoaders
protectedinherited

Definition at line 97 of file ExpressionParserUser.h.

◆ m_renounce

std::vector<std::string> ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::m_renounce
protectedinherited

Definition at line 102 of file ExpressionParserUser.h.

◆ m_runClassifier

bool DerivationFramework::Truth3CollectionMaker::m_runClassifier
private

Definition at line 38 of file Truth3CollectionMaker.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_xAODProxyLoader

ExpressionParsing::SGxAODProxyLoader* ExpressionParserUserBase< AthAlgTool , NUM_PARSER >::m_xAODProxyLoader
protectedinherited

The expression parser.

Definition at line 96 of file ExpressionParserUser.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::Truth3CollectionMaker::m_collectionName
std::string m_collectionName
Definition: Truth3CollectionMaker.h:35
ExpressionParserUserBase< AthAlgTool, 1 >::finalizeParser
StatusCode finalizeParser()
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::Truth3CollectionMaker::m_partString
std::string m_partString
Definition: Truth3CollectionMaker.h:36
DerivationFramework::Truth3CollectionMaker::m_particlesKey
std::string m_particlesKey
Definition: Truth3CollectionMaker.h:33
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ExpressionParserUserBase< AthAlgTool, 1 >::m_parser
std::conditional< NUM_PARSER==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > >::type m_parser
Definition: ExpressionParserUser.h:100
xAOD::TruthParticle_v1::setBarcode
void setBarcode(int value)
Set barcode.
HepMC::INVALID_PARTICLE_ID
constexpr int INVALID_PARTICLE_ID
Definition: MagicNumbers.h:56
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
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
DerivationFramework::Truth3CollectionMaker::m_ntotpart
std::atomic< unsigned int > m_ntotpart
Definition: Truth3CollectionMaker.h:32
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
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
xAOD::TruthParticle_v1::isLepton
bool isLepton() const
Whether the particle is a lepton.
xAOD::TruthParticleAuxContainer_v1
Auxiliary store for the truth vertices.
Definition: TruthParticleAuxContainer_v1.h:27
xAOD::TruthParticle_v1::hasDecayVtx
bool hasDecayVtx() const
Check for a decay vertex on this particle.
xAOD::TruthParticleAuxContainer
TruthParticleAuxContainer_v1 TruthParticleAuxContainer
Declare the latest version of the truth particle auxiliary container.
Definition: TruthParticleAuxContainer.h:15
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
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:69
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
ExpressionParserUser< AthAlgTool >::initializeParser
StatusCode initializeParser(const ExpressionParsing::SelectionArg< 1 > &selection_string)
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
ExpressionParserUser< AthAlgTool >
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DerivationFramework::Truth3CollectionMaker::m_npasspart
std::atomic< unsigned int > m_npasspart
Definition: Truth3CollectionMaker.h:32
xAOD::TruthParticleContainer
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
Definition: Event/xAOD/xAODTruth/xAODTruth/TruthParticleContainer.h:17
a
TList * a
Definition: liststreamerinfos.cxx:10
h
DerivationFramework::Truth3CollectionMaker::m_runClassifier
bool m_runClassifier
Definition: Truth3CollectionMaker.h:38
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
entries
double entries
Definition: listroot.cxx:49
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
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
DerivationFramework::Truth3CollectionMaker::m_classifier
ToolHandle< IMCTruthClassifier > m_classifier
Definition: Truth3CollectionMaker.h:37
fitman.k
k
Definition: fitman.py:528