ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
Trk::TrackValidationNtupleWriter Class Reference

#include <TrackValidationNtupleWriter.h>

Inheritance diagram for Trk::TrackValidationNtupleWriter:
Collaboration diagram for Trk::TrackValidationNtupleWriter:

Public Member Functions

 TrackValidationNtupleWriter (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor. More...
 
 ~TrackValidationNtupleWriter ()
 Default Destructor. More...
 
StatusCode initialize ()
 standard Athena-Algorithm method More...
 
StatusCode execute ()
 standard Athena-Algorithm method More...
 
StatusCode finalize ()
 standard Athena-Algorithm method More...
 
virtual StatusCode sysInitialize () override
 Override sysInitialize. More...
 
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies. 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 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
 

Protected Member Functions

StatusCode writeTrackData (unsigned int trackColIndex, std::vector< Trk::ValidationTrackTruthData > &truthData, const Trk::Vertex *primaryVertex=NULL)
 < following methods and atributes are used in derived class TrigTrackValidationNtupleWriter Private method to associate truth to a track More...
 
StatusCode writeTrackParticleData (unsigned int trackParticleColIndex)
 method to write track particle data to Ntuple. More...
 
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

ToolHandleArray< Trk::ITrackValidationNtupleToolm_ValidationNtupleTools
 set of tools for writing Trk::Track into the Ntuple More...
 
ToolHandle< Trk::IValidationNtupleToolm_ValTrkParticleNtupleTool
 Tool for writting Rec::TrackParticle into the Ntuple – OBSOLETE. More...
 
ToolHandle< Trk::ITruthNtupleToolm_truthNtupleTool
 
ToolHandle< Trk::IJetTruthNtupleToolm_jetTruthNtupleTool
 
ToolHandleArray< Trk::ITrackTruthClassifierm_trackTruthClassifierHandles
 jobO: list of truth classifiers More...
 
std::vector< const Trk::ITrackTruthClassifier * > m_trackTruthClassifiers
 the truth classifiers More...
 
ToolHandleArray< Trk::IEventPropertyNtupleToolm_eventPropertyNtupleHandles
 jobO: list of event property tools More...
 
std::vector< Trk::IEventPropertyNtupleTool * > m_eventPropertyNtupleTools
 list of event property tools More...
 
std::vector< std::string > m_inputTrackCollection
 name of the TrackCollection More...
 
std::vector< std::string > m_inputTrackParticleCollection
 name of the TrackParticleCollection More...
 
std::vector< std::string > m_trackTruthCollectionName
 name of the TrackTruthCollection More...
 
std::string m_McEventCollectionName
 name of the McEventCollection More...
 
std::string m_inputPrimaryVertexCollection
 SG key of the input primary vertex collection (used by the track selector) More...
 
std::string m_ntupleFileName
 jobOption: Ntuple file name More...
 
std::string m_ntupleDirName
 jobOption: Ntuple directory name More...
 
ToolHandle< Trk::ITruthToTrackm_truthToTrack
 Tool handle to the Trk::TruthToTrack tool. More...
 
ToolHandle< Trk::ITrackSelectorToolm_trackSelector
 Tool handle to the Trk::ITrackSelectorTool. More...
 
ToolHandle< Trk::IGenParticleSelectorm_genPartSelector
 Tool handle to the Trk::IGenParticleSelector. More...
 
ToolHandle< Trk::IGenParticleJetFinderm_genJetFinder
 Tool to find jets. More...
 
bool m_useExternalEventLinkTree
 if TVNW should make event tree itself or assume CBNT does More...
 
bool m_doTruth
 Switch to turn on / off truth. More...
 
bool m_doTrackParticle
 
HepMC::GenParticlePtr m_visibleParticleWithoutTruth
 Switch to turn on/pff recording track particle trees into Ntuple. More...
 
std::vector< unsigned int > m_nTrackTreeRecords
 
std::vector< TTree * > m_trees
 Pointer to the NTuple trees (one for each input track collection) More...
 
TTree * m_eventLinkTree
 pointer to event-wise ntuple trees (one for all input track collections + truth) More...
 

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

DataObjIDColl m_extendedExtraObjects
 
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

Validation Algorithm to retrieve a Track Collection, loop over the tracks and write track information into ntuples using IValidationNtupleTool. For information about the ntuple variables filled, have a look into the IValidationNtupleTool implementation used.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch, Sebas.nosp@m.tian.nosp@m..Flei.nosp@m.schm.nosp@m.ann@c.nosp@m.ern..nosp@m.ch, Wolfg.nosp@m.ang..nosp@m.Liebi.nosp@m.g@ce.nosp@m.rn.ch

Definition at line 48 of file TrackValidationNtupleWriter.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrackValidationNtupleWriter()

Trk::TrackValidationNtupleWriter::TrackValidationNtupleWriter ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Athena-Algorithm Constructor.

Definition at line 45 of file TrackValidationNtupleWriter.cxx.

45  :
46  AthAlgorithm(name,pSvcLocator),
48  m_ValTrkParticleNtupleTool("Trk::BasicValTrkParticleNtupleTool/BasicValTrkParticleNtupleTool"),
49  m_truthNtupleTool("Trk::TruthNtupleTool/TruthNtupleTool"),
57  m_McEventCollectionName("TruthEvent"),
59  m_ntupleFileName("TRKVAL"),
60  m_ntupleDirName("Validation"),
61  m_truthToTrack("Trk::TruthToTrack/TruthToTrack"),
62  m_trackSelector("InDet::InDetTrackSelectorTool/InDetTrackSelectorTool"),
63  m_genPartSelector("Trk::InDetReconstructableSelector/InDetReconstructableSelector"),
64  m_genJetFinder("Trk::GenParticleJetFinder/GenParticleJetFinder"),
66  m_doTruth(true),
67  m_doTrackParticle(false),
70  m_trees(0),
71  m_eventLinkTree(nullptr)
72 
73 {
74  m_ValidationNtupleTools.push_back("Trk::TrackInformationNtupleTool/TrackInformationNtupleTool");
75  m_ValidationNtupleTools.push_back("Trk::PerigeeParametersNtupleTool/PerigeeParametersNtupleTool");
76  m_ValidationNtupleTools.push_back("Trk::MeasurementVectorNtupleTool/MeasurementVectorNtupleTool");
77  m_trackTruthClassifierHandles.push_back("Trk::PrimaryTruthClassifier/PrimaryTruthClassifier");
78 
79  m_eventPropertyNtupleHandles.push_back("Trk::EventPropertyNtupleTool/EventPropertyNtupleTool");
80  m_eventPropertyNtupleHandles.push_back("Trk::EventToTrackLinkNtupleTool/EventToTrackLinkNtupleTool");
81 
82  m_inputTrackCollection.emplace_back("Tracks");
83  m_trackTruthCollectionName.emplace_back("TrackTruthCollection");
84 
85  declareProperty("TrackCollection", m_inputTrackCollection, "Names of the track collections");
86  declareProperty("TrackParticleCollection", m_inputTrackParticleCollection, "Names of the track particle collections");
87  declareProperty("TrackTruthCollection", m_trackTruthCollectionName, "Names of the truth track collections (if DoTruth=True)");
88  declareProperty("TruthCollection", m_McEventCollectionName, "Name of the truth (gen event) collection (if DoTruth=True)");
89  declareProperty("PrimaryVertexCollection", m_inputPrimaryVertexCollection, "SG key of input PrimaryVertex collection (needed for TrackSelector, if no vertex collection is given, the selector will not use the vertex position)");
90  declareProperty("NtupleFileName", m_ntupleFileName, "Ntuple file handle");
91  declareProperty("NtupleDirectoryName", m_ntupleDirName, "directory name for ntuple tree");
92  //declareProperty("NtupleTreeName", m_ntupleTreeNames, "Name of the ntuple trees (list corresponding to the list of input track collections)");
93  declareProperty("UseExternalEventLinkTree", m_useExternalEventLinkTree, "flag if event link tree is supplied externally, eg as part of CBNT");
94  declareProperty("DoTruth", m_doTruth, "Write truth data?");
95  declareProperty("ValidationNtupleTools", m_ValidationNtupleTools, "Tool to write the validation ntuple");
96  declareProperty("ValTrkParticleNtupleTool", m_ValTrkParticleNtupleTool, "Tool to write the validation ntuple for Track Particles");
97  declareProperty("TruthNtupleTool", m_truthNtupleTool, "Tool to write the truth ntuple");
98  declareProperty("JetNtupleTool", m_jetTruthNtupleTool, "Tool to add jet information to ntuple");
99  declareProperty("TruthToTrackTool", m_truthToTrack, "Tool for truth to track");
100  declareProperty("TrackSelectorTool", m_trackSelector, "Tool for the selection of tracks");
101  declareProperty("GenParticleSelectorTool", m_genPartSelector, "Tool for the selection of truth particles");
102  declareProperty("GenParticleJetFinder", m_genJetFinder, "Tool for jet clustering (MC)");
103  declareProperty("TruthClassifierTools", m_trackTruthClassifierHandles, "List of truth classifier tools");
104  declareProperty("EventPropertyNtupleTools", m_eventPropertyNtupleHandles,"List of event property ntuple tools");
105  declareProperty("doTrackParticle", m_doTrackParticle, "Swith to record Rec:TrackParticle Trees");
106 }

◆ ~TrackValidationNtupleWriter()

Trk::TrackValidationNtupleWriter::~TrackValidationNtupleWriter ( )
default

Default Destructor.

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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; }

◆ execute()

StatusCode Trk::TrackValidationNtupleWriter::execute ( )

standard Athena-Algorithm method

Definition at line 318 of file TrackValidationNtupleWriter.cxx.

318  {
319 
320 // std::cout<< "TrackValidationNtupleWriter execute() start" <<std::endl;
321 
322  ATH_MSG_DEBUG ("TrackValidationNtupleWriter execute() start");
323 
324  StatusCode sc = StatusCode::SUCCESS; if (sc.isFailure()) { /* mute sc*/ }
325  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex ) {
326  if (m_eventPropertyNtupleTools[toolIndex]->resetVariables( ).isFailure()){};
327  }
328 
329  const McEventCollection* mcEventColl = nullptr;
330 
331  unsigned int nTruthTreeRecordsAtCurrentEvent = 0;
332  std::vector<Trk::ValidationTrackTruthData> truthData;
333  std::vector<HepMC::ConstGenParticlePtr>* selecParticles = nullptr;
334  //std::vector<const Trk::TrackParameters*> extrapolatedTruthPerigees;
335  //std::vector<std::vector<unsigned int> > classifications;
336  std::vector< Trk::GenParticleJet >* genParticleJets = nullptr;
337  //std::map<HepMC::GenParticle*, unsigned int> particleToIndexMap;
338  if (m_doTruth)
339  {
340  // retrieve gen event collection
341  if (evtStore()->retrieve(mcEventColl, m_McEventCollectionName).isFailure())
342  {
343  std::string key = "G4Truth";
344  if (evtStore()->retrieve(mcEventColl, key).isFailure())
345  {
346  msg(MSG::WARNING) << "Could not find the McEventCollection" << endmsg;
347  return StatusCode::SUCCESS;
348  }
349  }
350 
351 // std::cout<<"collecton retrieved "<<std::endl;
352 
353  // select stable, charged particles
354  selecParticles = m_genPartSelector->selectGenSignal(mcEventColl);
355  if (selecParticles)
356  {
357 // std::cout<<"there are selected particles "<<std::endl;
358 
359  // init the classification:
360  //classifications.resize(selecParticles->size());
361  //truthData.classifications.resize(selecParticles->size());
362  //truthData.truthPerigee.resize(selecParticles->size());
363  for (unsigned int toolIndex = 0 ; toolIndex < m_trackTruthClassifiers.size(); ++toolIndex )
364  {
365  m_trackTruthClassifiers[toolIndex]->initClassification(*mcEventColl, selecParticles);
366  }
367 
368  for ( const auto& genParticle: *selecParticles)
369  {
370  //truthData.genParticle = (*selecParticles);
372  partData.genParticle = genParticle;
373  // Perform extrapolation to generate perigee parameters
374  const Trk::TrackParameters* generatedTrackPerigee(nullptr);
375  if ( genParticle->production_vertex() )
376  {
377  generatedTrackPerigee = m_truthToTrack->makePerigeeParameters( genParticle );
378  if (generatedTrackPerigee == nullptr && HepMC::generations(genParticle) > 0 ) {
379  ATH_MSG_DEBUG ("No perigee available for interacting truth particle."
380  <<" -> This is OK for particles from the TrackRecord, but probably"
381  <<" a bug for production vertex particles.");
382  }
383 
384  }
385  partData.truthPerigee = generatedTrackPerigee;
386  // get classification
387  partData.classifications.reserve(m_trackTruthClassifiers.size());
388  for (unsigned int toolIndex = 0 ; toolIndex < m_trackTruthClassifiers.size(); ++toolIndex )
389  {
390  partData.classifications.push_back(m_trackTruthClassifiers[toolIndex]->classify(genParticle));
391  }
392  // resize the truth to track vectors to the number of input track collections:
393  partData.truthToTrackIndices.resize(m_inputTrackCollection.size());
395  truthData.push_back(partData);
396  //partIndex++;
397  }
398 
399 // std::cout<<"Second loop done "<<std::endl;
400 
401  if (! m_jetTruthNtupleTool.empty()) {
402 
403 // std::cout<<"Second loop done "<<std::endl;
404  genParticleJets = m_genJetFinder->jetMCFinder(*selecParticles);
405  if (!genParticleJets) ATH_MSG_DEBUG ("no jets found!");
406  else ATH_MSG_DEBUG ("jets found: " << genParticleJets->size());
407  }
408 // std::cout<<" end of jet truth tool check"<<std::endl;
409 
410  } // end if (selecParticles)
411  nTruthTreeRecordsAtCurrentEvent = m_truthNtupleTool->getNumberOfTreeRecords();
412  } // end if(m_doTruth)
413 
414 // std::cout<<"Finished working with truth part"<<std::endl;
415 
416  // get vertex collection so that the track selector is able to make a correct d0, z0 cut
417  const VxContainer* primaryVertexContainer = nullptr;
418  if (!m_trackSelector.empty() && !m_inputPrimaryVertexCollection.empty()) {
419  sc = evtStore()->retrieve(primaryVertexContainer, m_inputPrimaryVertexCollection);
420  if ( !primaryVertexContainer || sc.isFailure() ) {
421  ATH_MSG_ERROR( " Primary Vertex container (" << m_inputPrimaryVertexCollection << ") not found in StoreGate" );
422  delete genParticleJets;
423  return StatusCode::FAILURE;
424  }
425  }
426  const Trk::Vertex* vertex = nullptr;
427  if (primaryVertexContainer) {
428  if (!primaryVertexContainer->empty()) vertex = &((*primaryVertexContainer)[0]->recVertex());
429  }
430 
431  // fill the track trees for each track collection
432  for (unsigned int trackColIndex = 0; trackColIndex<m_inputTrackCollection.size(); trackColIndex++)
433  {
434  sc = writeTrackData(trackColIndex, truthData, vertex);
435  if (sc.isFailure()) {
436  ATH_MSG_ERROR ("Failure when writing track data for collection " << m_inputTrackCollection[trackColIndex]);
437  delete genParticleJets;
438  return sc;
439  }
440  }
441 
442  // fill track particle data
443  if(m_doTrackParticle){
444  for (unsigned int trackParticleColIndex = 0; trackParticleColIndex<m_inputTrackParticleCollection.size(); trackParticleColIndex++)
445  {
446  sc = writeTrackParticleData(trackParticleColIndex);
447  if (sc.isFailure()) {
448  msg(MSG::ERROR) <<"Failure when writing TrackParticle data for collection " << m_inputTrackParticleCollection[trackParticleColIndex] << endmsg;
449  delete genParticleJets;
450  return sc;
451  }
452  }
453 }
454  if (m_doTruth) {
455  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex )
456  if( m_eventPropertyNtupleTools[toolIndex]->isTrackLinkTool() ) {
457  m_eventPropertyNtupleTools[toolIndex]->setGenParticleTreeIndices
458  (nTruthTreeRecordsAtCurrentEvent,
459  selecParticles ? (int)selecParticles->size() : 0);
460  }
461  }
462 
463  // fill info about whole event
464  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex ) {
465  sc = m_eventPropertyNtupleTools[toolIndex]->fillEventData( );
466  if (sc.isFailure()) {
467  msg(MSG::ERROR) <<"Failure when filling event data." << endmsg;
468  delete genParticleJets;
469  return sc;
470  }
471  }
472 
474 
475  // fill info about jets
476  std::vector<unsigned int> truthToJetIndices(selecParticles ? selecParticles->size() : 0);
477  if (m_doTruth && selecParticles && genParticleJets && !m_jetTruthNtupleTool.empty() ) {
478 
479  const unsigned int nJetTruthTreeRecordsAtCurrentEvent
480  = m_jetTruthNtupleTool->getNumberOfTreeRecords();
481 
482  for( std::vector<Trk::GenParticleJet>::iterator itrMcJet = genParticleJets->begin();
483  itrMcJet < genParticleJets->end() ; ++itrMcJet) {
484 
485  std::vector<int> indices = (*itrMcJet).getIndicesInEvent();
486  if (!indices.empty())
487  for (std::vector<int>::const_iterator k =indices.begin(); k != indices.end(); ++k) {
488  if (*k >= 0 && *k <= (int)selecParticles->size() ) {
489  truthData[*k].truthToJetIndex = nJetTruthTreeRecordsAtCurrentEvent
490  + int(itrMcJet - genParticleJets->begin()) + 1;
491  } else {
492  msg(MSG::WARNING) <<" mistake with jet::indexInEvent !! " << *k << endmsg;
493  }
494  }
495  }
496  sc = m_jetTruthNtupleTool->writeJetTruthData(*genParticleJets,
497  nTruthTreeRecordsAtCurrentEvent);
498  if ( sc.isFailure() ){
499  msg(MSG::ERROR) << "Jet Truth Ntuple Tool could not fill data" << endmsg;
500  delete genParticleJets;
501  return StatusCode::FAILURE;
502  }
503  }
504 
505 
506  if (m_doTruth && selecParticles){
507  sc = m_truthNtupleTool->writeTruthData( truthData );
508  if ( sc.isFailure() ){
509  msg(MSG::ERROR) << "Truth Ntuple Tool could not fill data" << endmsg;
510  delete genParticleJets;
511  return StatusCode::FAILURE;
512  }
513  } // end if (m_doTruth && selecParticles)
514 
515  delete selecParticles;
516  delete genParticleJets;
517  std::vector<Trk::ValidationTrackTruthData>::iterator truthDataIter = truthData.begin();
518  for (; truthDataIter != truthData.end(); ++truthDataIter) {
519  delete (*truthDataIter).truthPerigee;
520  (*truthDataIter).truthPerigee = nullptr;
521  }
522  return StatusCode::SUCCESS;
523 }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51 {
52  // If we didn't find any symlinks to add, just return the collection
53  // from the base class. Otherwise, return the extended collection.
54  if (!m_extendedExtraObjects.empty()) {
56  }
57  return Algorithm::extraOutputDeps();
58 }

◆ finalize()

StatusCode Trk::TrackValidationNtupleWriter::finalize ( )

standard Athena-Algorithm method

Definition at line 732 of file TrackValidationNtupleWriter.cxx.

732  {
733 
734  msg(MSG::INFO) << "TrackValidationNtupleWriter finalize()" << endmsg;
735 
736 #ifdef HEPMC3
737  //This is smart pointer in HepMC3
738 #else
740 #endif
741  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex ){
742  if (m_eventPropertyNtupleTools[toolIndex]->resetVariables( ).isFailure()){};
743  }
744 
745  return StatusCode::SUCCESS;
746 }

◆ initialize()

StatusCode Trk::TrackValidationNtupleWriter::initialize ( )

standard Athena-Algorithm method

Definition at line 110 of file TrackValidationNtupleWriter.cxx.

110  {
111 
112  msg(MSG::INFO) <<"TrackValidationNtupleWriter initialize()" << endmsg;
113 
114  //check that m_inputTrackCollection and m_trackTruthCollectionName have the same size
115  if (m_doTruth && (m_inputTrackCollection.size() != m_trackTruthCollectionName.size())) {
116  msg(MSG::FATAL) << "joboptions TrackCollection and TrackTruthCollection have different sizes!" << endmsg;
117  msg(MSG::FATAL) << "If you like to get truth data (DoTruth=True)," << endmsg;
118  msg(MSG::FATAL) << " please make sure to set for each TrackCollection the corresponding TrackTruthCollection" << endmsg;
119  return StatusCode::FAILURE;
120  }
121 
122  // Get Validation ntuple Tools
124  if (sc.isFailure()) {
125  msg(MSG::FATAL) << "Could not retrieve "<< m_ValidationNtupleTools <<" (to write validation ntuple) "<< endmsg;
126  return sc;
127  }
128  if(m_doTrackParticle){
129  // Get TrackParticle Validation ntuple Tool
130  sc = m_ValTrkParticleNtupleTool.retrieve();
131  if (sc.isFailure()) {
132  msg(MSG::FATAL) << "Could not retrieve "<< m_ValTrkParticleNtupleTool <<" (to write TrackParticle validation ntuple) "<< endmsg;
133  return sc;
134  }
135  }
136 
137  // Get the Track Selector Tool
138  if ( !m_trackSelector.empty() ) {
139  sc = m_trackSelector.retrieve();
140  if (sc.isFailure()) {
141  msg(MSG::FATAL) << "Could not retrieve "<< m_trackSelector <<" (to select the tracks which are written to the ntuple) "<< endmsg;
142  msg(MSG::INFO) << "Set the ToolHandle to None if track selection is supposed to be disabled" << endmsg;
143  return sc;
144  }
145  }
146 
147  msg(MSG::INFO) <<"Track Selector retrieved" << endmsg;
148  // -------------------------------
149  // get event property tools
151  if ( m_eventPropertyNtupleHandles.retrieve().isFailure() ) {
152  msg(MSG::ERROR) << "Failed to retreive " << m_eventPropertyNtupleHandles << endmsg;
153  } else {
154  msg(MSG::INFO) << "Retrieved " << m_eventPropertyNtupleHandles << endmsg;
155  }
156 
157 
158  //std::vector<std::string> classifierNames(0);
159  itTools = m_eventPropertyNtupleHandles.begin();
160  for ( ; itTools != m_eventPropertyNtupleHandles.end(); ++itTools ) {
161  // add tool to list
162  m_eventPropertyNtupleTools.push_back(&(*(*itTools)));
163  }
164 
165  // Retrieve the TruthToTrack tool if truth is required
166  if ( m_doTruth ) {
167  sc = m_truthToTrack.retrieve();
168  if (sc.isFailure()) {
169  ATH_MSG_FATAL ("Could not retrieve "<< m_truthToTrack);
170  return sc;
171  }
172 
173  // retrieve truth selector for efficiency denominator
174  sc = m_genPartSelector.retrieve();
175  if (sc.isFailure()) {
176  ATH_MSG_FATAL ("Could not retrieve "<< m_genPartSelector);
177  return sc;
178  }
179 
180  // -------------------------------
181  // get given classifier tools
183  if ( m_trackTruthClassifierHandles.retrieve().isFailure() ) {
184  msg(MSG::ERROR) << "Failed to retreive " << m_trackTruthClassifierHandles << endmsg;
185  } else {
186  msg(MSG::INFO) << "Retrieved " << m_trackTruthClassifierHandles << endmsg;
187  }
188  //std::vector<std::string> classifierNames(0);
189  itTools = m_trackTruthClassifierHandles.begin();
190  for ( ; itTools != m_trackTruthClassifierHandles.end(); ++itTools ) {
191  // add tool to list
192  m_trackTruthClassifiers.push_back(&(*(*itTools)));
193  //classifierNames.push_back((*itTools)->nameOfClassifier());
194  }
195 
196  // Get the Jet-Truth Ntuple Tool
197  if (! m_jetTruthNtupleTool.empty()) {
198  sc = m_jetTruthNtupleTool.retrieve();
199  if (sc.isFailure()) {
200  msg(MSG::ERROR) << "Could not retrieve "<< m_jetTruthNtupleTool
201  << " (to write jet data)."<< endmsg << "--> Instead configure "
202  << "to empty string if jet data not desired." << endmsg;
203  return sc;
204  }
205  sc = m_genJetFinder.retrieve();
206  if (sc.isFailure()) {
207  msg(MSG::ERROR) << "Could not retrieve "<< m_genJetFinder
208  << " (to find jets at truth level)."<< endmsg;
209  return sc;
210  }
211  }
212 
213  // Get the Truth Ntuple Tool
214  sc = m_truthNtupleTool.retrieve();
215  if (sc.isFailure()) {
216  msg(MSG::FATAL) << "Could not retrieve "<< m_truthNtupleTool <<" (to write truth data) "<< endmsg;
217  return sc;
218  }
219  bool include_jets = (! m_jetTruthNtupleTool.empty());
220  sc = m_truthNtupleTool->initBranches(m_trackTruthClassifiers, include_jets, m_inputTrackCollection);
221  if (sc.isFailure()) return sc;
222 
224 
225  } // if truth is activated
226 
227  // ---------------------------
228  // retrieve pointer to THistSvc
229  SmartIF<ITHistSvc> tHistSvc{service("THistSvc")};
230  ATH_CHECK( tHistSvc.isValid() );
231 
232  // ---------------------------
233  // create tree for each given track collection and register it to THistSvc
234  std::vector<std::string>::const_iterator trackColNameIter = m_inputTrackCollection.begin();
235  //for (unsigned int trackColIndex = 0; trackColIndex<m_inputTrackCollection.size(); trackColIndex++) {
236  for (; trackColNameIter != m_inputTrackCollection.end(); ++trackColNameIter) {
237  TTree* tree = new TTree((*trackColNameIter).c_str(), ((*trackColNameIter)+" Validation").c_str());
238  m_trees.push_back(tree);
239  std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleDirName+"/"+(*trackColNameIter);
240  sc = tHistSvc->regTree(fullNtupleName, tree);
241  if (sc.isFailure()) {
242  msg(MSG::ERROR) << "Unable to register TTree : " << fullNtupleName << endmsg;
243  return sc;
244  }
245  // add the ntuple branches to this tree
247  itTools = m_ValidationNtupleTools.begin();
248  for ( ; itTools != m_ValidationNtupleTools.end(); ++itTools ) {
249  if (((*itTools)->addNtupleItems(tree)).isFailure()) {
250  msg(MSG::ERROR) << "ValidationNtupleTool could not add its branches"
251  << " for tree " << fullNtupleName << endmsg;
252  return StatusCode::FAILURE;
253  }
254  }
255  // initialize tree offsets to 0:
256  m_nTrackTreeRecords.push_back( 0 );
257  }
258 
259 
260  // create tree for each given track particle collection and register it to THistSvc
261  std::vector<std::string>::const_iterator trackParticleColNameIter = m_inputTrackParticleCollection.begin();
262 
263  for (; trackParticleColNameIter != m_inputTrackParticleCollection.end(); ++trackParticleColNameIter ) {
264  TTree* tree = new TTree((*trackParticleColNameIter).c_str(), ((*trackParticleColNameIter)+" Validation").c_str());
265  m_trees.push_back(tree);
266  std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleDirName+"/"+(*trackParticleColNameIter);
267  sc = tHistSvc->regTree(fullNtupleName, tree);
268  if (sc.isFailure()) {
269  msg(MSG::ERROR) << "Unable to register TTree : " << fullNtupleName << endmsg;
270  return sc;
271  }
272  // add the ntuple branches to this tree
273  sc = m_ValTrkParticleNtupleTool->addNtupleItems(tree);
274  if (sc.isFailure()) {
275  msg(MSG::ERROR) << "ValidationNtupleTool could not add its branches for tree " << fullNtupleName << endmsg;
276  return sc;
277  }
278 
279  } //loop over m_inputTrackParticleCollection
280 
281  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex ) {
282  if( m_eventPropertyNtupleTools[toolIndex]->isTrackLinkTool( ) ) {
283  m_eventPropertyNtupleTools[toolIndex]->registerTrackCollections( m_inputTrackCollection,
284  m_doTruth );
285  } //if
286  else if(m_eventPropertyNtupleTools[toolIndex]->isTrkParticleLinkTool() ) // register just Trk::TrackParticleBase collection retrieved from SG
287  m_eventPropertyNtupleTools[toolIndex]->registerTrackCollections( m_inputTrackParticleCollection, m_doTruth );
288  } // for over m_eventPropertyNtupleTools
289 
290  // ---------------------------
291  // add event-wise track tree with link to the information in the track-wise tree
293  m_eventLinkTree = new TTree("EventToTrackLink", "Event to track entry link");
294  std::string fullNtupleName = "/"+m_ntupleFileName+"/"+m_ntupleDirName+"/EventToTrackLink";
295  sc = tHistSvc->regTree(fullNtupleName, m_eventLinkTree);
296  if (sc.isFailure()) {
297  msg(MSG::ERROR) << "Unable to register TTree : " << fullNtupleName << endmsg;
298  return sc;
299  }
300 
301  for (unsigned int toolIndex=0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex ) {
302  if( m_eventPropertyNtupleTools[toolIndex]->isTrkParticleLinkTool() ||
303  m_eventPropertyNtupleTools[toolIndex]->isTrackLinkTool( ) ||
304  m_eventPropertyNtupleTools[toolIndex]->isEvtPropertyTool( ) ) {
305  if( m_eventPropertyNtupleTools[toolIndex]->addNtupleItems( m_eventLinkTree ).isFailure() )
306  {
307  msg(MSG::ERROR) << "Unable to add items into the event tree: " << m_eventLinkTree->GetTitle() << endmsg;
308  return StatusCode::SUCCESS;
309  } // if addNtupleItems isFailure
310  } // if Track or TrackParticle
311  } //loop over m_eventPropertyNtupleTools
312  } // if not use external link tree
313  return StatusCode::SUCCESS;
314 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< Algorithm > >::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.

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

MsgStream& AthCommonMsg< Algorithm >::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< Algorithm >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, PyAthena::Alg, and AthHistogramAlgorithm.

Definition at line 66 of file AthAlgorithm.cxx.

66  {
68 
69  if (sc.isFailure()) {
70  return sc;
71  }
72  ServiceHandle<ICondSvc> cs("CondSvc",name());
73  for (auto h : outputHandles()) {
74  if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75  // do this inside the loop so we don't create the CondSvc until needed
76  if ( cs.retrieve().isFailure() ) {
77  ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78  return StatusCode::SUCCESS;
79  }
80  if (cs->regHandle(this,*h).isFailure()) {
81  sc = StatusCode::FAILURE;
82  ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83  << " with CondSvc");
84  }
85  }
86  }
87  return sc;
88 }

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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  }

◆ writeTrackData()

StatusCode Trk::TrackValidationNtupleWriter::writeTrackData ( unsigned int  trackColIndex,
std::vector< Trk::ValidationTrackTruthData > &  truthData,
const Trk::Vertex primaryVertex = NULL 
)
protected

< following methods and atributes are used in derived class TrigTrackValidationNtupleWriter Private method to associate truth to a track

Definition at line 525 of file TrackValidationNtupleWriter.cxx.

527  {
528  StatusCode sc = StatusCode::SUCCESS; if (sc.isFailure()) { /* mute sc*/ }
529  // retrieve reconstructed tracks
530  const TrackCollection* tracks = nullptr;
531  if (!m_inputTrackCollection[trackColIndex].empty() && evtStore()->contains<TrackCollection>(m_inputTrackCollection[trackColIndex])) {
532  sc = evtStore()->retrieve(tracks, m_inputTrackCollection[trackColIndex]);
533  if (sc.isFailure()) {
534  msg(MSG::WARNING) <<"Tracks not found: " << m_inputTrackCollection[trackColIndex] << endmsg;
535  return StatusCode::SUCCESS;
536  } else {
537  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<"Tracks found: " << m_inputTrackCollection[trackColIndex] <<endmsg;
538  }
539  } else {
540  msg(MSG::WARNING) <<"TrackCollection " << m_inputTrackCollection[trackColIndex] << " not found in StoreGate." << endmsg;
541  return StatusCode::SUCCESS;
542  }
543 
544  const TrackTruthCollection* trackTruthCollection = nullptr;
545  if (m_doTruth) {
546  // retrieve track truth collection
547  if (!m_trackTruthCollectionName[trackColIndex].empty() && evtStore()->contains<TrackTruthCollection>(m_trackTruthCollectionName[trackColIndex])) {
548  sc = evtStore()->retrieve(trackTruthCollection, m_trackTruthCollectionName[trackColIndex]);
549  if (sc.isFailure()) {
550  msg(MSG::WARNING) <<"TrackTruthCollection not found: " << m_trackTruthCollectionName[trackColIndex] << endmsg;
551  // FIXME: return is not good here...
552  return StatusCode::SUCCESS;
553  } else {
554  ATH_MSG_DEBUG ("TrackTruthColl found: " << m_trackTruthCollectionName[trackColIndex]);
555  // TODO: use trackTruthCollection.trackCollectionLink() to check whether consistent track collection was used
556  }
557  } else {
558  msg(MSG::WARNING) <<"TrackTruthCollection " << m_trackTruthCollectionName[trackColIndex] << " not found in StoreGate." << endmsg;
559  // FIXME: return is not good here...
560  return StatusCode::SUCCESS;
561  }
562  } // end if m_doTruth
563 
564  const unsigned int nTruthTreeRecordsAtCurrentEvent =
565  (m_doTruth ? m_truthNtupleTool->getNumberOfTreeRecords() : 0 );
566 
567  int trackTreeIndexBegin = m_trees[trackColIndex]->GetEntries();
568  int nTracksPerEvent = 0;
569 
570  // loop over tracks
571  TrackCollection::const_iterator trackIterator = (*tracks).begin();
572  for ( ; trackIterator < (*tracks).end(); ++trackIterator) {
573  if (!((*trackIterator))) {
574  msg(MSG::WARNING) <<"TrackCollection " << m_inputTrackCollection[trackColIndex] << "contains empty entries" << endmsg;
575  continue;
576  }
577  if (m_trackSelector.empty() || m_trackSelector->decision(*(*trackIterator), primaryVertex)) {
578  ATH_MSG_VERBOSE ("track selected!");
580  itTools = m_ValidationNtupleTools.begin();
581  for ( ; itTools != m_ValidationNtupleTools.end(); ++itTools ) {
582  if (((*itTools)->fillTrackData( *(*trackIterator), 0 )).isFailure()) {
583  ATH_MSG_ERROR ("Validation Ntuple Tool could not fill track data.");
584  return StatusCode::FAILURE;
585  }
586  }
587  nTracksPerEvent += 1;
588 
589  if (m_doTruth){
590  // find matching truth particle
591  const TrackTruth* trackTruth = nullptr;
592  HepMC::ConstGenParticlePtr genParticle{nullptr};
593  TrackTruthCollection::const_iterator truthIterator = trackTruthCollection->find( trackIterator - (*tracks).begin() );
594  if ( truthIterator == trackTruthCollection->end() ){
595  ATH_MSG_DEBUG ("No matching truth particle found for track");
596  } else {
597  trackTruth = &((*truthIterator).second);
598  if ( !(trackTruth->particleLink().isValid()) ) {
599  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Link to generated particle information is not there - assuming a lost G4 particle ('fake fake')." << endmsg;
600  genParticle = m_visibleParticleWithoutTruth; // with pdg_id 0
601  } else {
602 #ifdef HEPMC3
603  genParticle = trackTruth->particleLink().scptr();
604 #else
605  genParticle = trackTruth->particleLink().cptr();
606 #endif
607  if ( genParticle!=nullptr && genParticle->pdg_id() == 0 ) {
608  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Associated Particle ID " << genParticle->pdg_id()
609  << " does not conform to PDG requirements... ignore it!" << endmsg;
610  genParticle = nullptr;
611  }
612  }
613  }
614  if (genParticle) {
615  ATH_MSG_VERBOSE("Associated Particle ID: " << genParticle->pdg_id());
616  // Perform extrapolation to generate perigee parameters
617  const Trk::TrackParameters* generatedTrackPerigee(nullptr);
618  const Trk::TrackParameters* newTrackPerigee(nullptr);
619  // fill the truth data in the track tree
620  int truthIndex = -1;
621  // TODO: do the search somehow better:
622  std::vector<Trk::ValidationTrackTruthData>::iterator matchedPartIter = truthData.begin();
623  for (; matchedPartIter != truthData.end(); ++matchedPartIter) {
624  truthIndex++;
625  if ((*matchedPartIter).genParticle == genParticle) break;
626  }
627  if (matchedPartIter == truthData.end()) {
628  // did not find particle in list of selected particles
629  truthIndex = -1;
630  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "Matched particle " << genParticle << " is not in list of selected particles" << endmsg;
631  if ( genParticle->production_vertex() ) {
632  newTrackPerigee = m_truthToTrack->makePerigeeParameters( genParticle );
633  generatedTrackPerigee = newTrackPerigee;
634  }
635  } else {
636  // store the index in the track tree of the current track (establish link from truth to track)
637  (*matchedPartIter).truthToTrackIndices[trackColIndex].push_back(m_nTrackTreeRecords[trackColIndex]);
638  (*matchedPartIter).truthToTrackMatchingProbabilities[trackColIndex].push_back(trackTruth->probability());
639  generatedTrackPerigee = (*matchedPartIter).truthPerigee;
640  // calculate entry index in tree:
641  truthIndex += nTruthTreeRecordsAtCurrentEvent;
642  }
644  itTools = m_ValidationNtupleTools.begin();
645  for ( ; itTools != m_ValidationNtupleTools.end(); ++itTools ) {
646  if (((*itTools)->fillTrackTruthData( generatedTrackPerigee, *trackTruth, truthIndex )).isFailure()) {
647  ATH_MSG_ERROR ("Validation Ntuple Tool could not fill track truth data.");
648  delete newTrackPerigee;
649  return StatusCode::FAILURE;
650  }
651  }
652  // New memory allocated for the true perigee - must be deleted
653  delete newTrackPerigee;
654 
655  } // end if (genParticle)
656  } // end if (m_doTruth)
657 
658  m_trees[trackColIndex]->Fill();
659  itTools = m_ValidationNtupleTools.begin();
660  for ( ; itTools != m_ValidationNtupleTools.end(); ++itTools )
661  (*itTools)->resetVariables();
662  // call getEntries - 1, push_back in index vektor
663 
664  m_nTrackTreeRecords[trackColIndex]++;
665  } else {
666  if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) <<"track not selected!" <<endmsg;
667  }
668  } // end for (trackIterator)
669 
670  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex )
671  if( m_eventPropertyNtupleTools[toolIndex]->isTrackLinkTool() ) m_eventPropertyNtupleTools[toolIndex]->setTrackTreeIndices
672  (trackColIndex, trackTreeIndexBegin, nTracksPerEvent );
673 
674  return StatusCode::SUCCESS;
675 }

◆ writeTrackParticleData()

StatusCode Trk::TrackValidationNtupleWriter::writeTrackParticleData ( unsigned int  trackParticleColIndex)
protected

method to write track particle data to Ntuple.

Rec::Track particles are retrived from the SG

Definition at line 677 of file TrackValidationNtupleWriter.cxx.

677  {
678 
679  msg(MSG::DEBUG) << "writeTrackParticleData method started" << endmsg;
680 
681  // retrieve Trk::TrackParticleBaseCollection from the SG
682  const Trk::TrackParticleBaseCollection* trackParticles = nullptr;
683 
684  if (!m_inputTrackParticleCollection[trackParticleColIndex].empty() &&
685  evtStore()->contains<Trk::TrackParticleBaseCollection>(m_inputTrackParticleCollection[trackParticleColIndex])) {
686  if (evtStore()->retrieve(trackParticles, m_inputTrackParticleCollection[trackParticleColIndex]).isFailure()) {
687  msg(MSG::WARNING) <<"Trk::TrackParticleBasesContainer not found:" << m_inputTrackParticleCollection[trackParticleColIndex] << endmsg;
688  return StatusCode::SUCCESS;
689  } else {
690  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<"Trk::TrackParticleBasesContainer found: "<< m_inputTrackParticleCollection[trackParticleColIndex] <<endmsg;
691  }
692  } else {
693  msg(MSG::WARNING) <<"Trk::TrackParticleBasesContainer " << m_inputTrackParticleCollection[trackParticleColIndex] << " not found in StoreGate." << endmsg;
694  return StatusCode::SUCCESS;
695  }
696 
697  // indexes for eventPropertyNtupleTool
698  int trackTreeIndexBegin = m_trees[trackParticleColIndex + m_inputTrackCollection.size()]->GetEntries();
699  int nTrkParticlesPerEvent = 0;
700 
701  // fill coresponding Rec:TrackParticle tree using BasicTrkParticleValidationNtuple
702  Trk::TrackParticleBaseCollection::const_iterator trackParticleIterator = (*trackParticles).begin();
703  for ( ; trackParticleIterator < (*trackParticles).end(); ++trackParticleIterator) {
704  if (!((*trackParticleIterator))) {
705  msg(MSG::WARNING) <<"TrackParticleCollection " << m_inputTrackParticleCollection[trackParticleColIndex] << "contains empty entries" << endmsg;
706  continue;
707  } // if emty entry
708 
709  if ( m_ValTrkParticleNtupleTool->fillTrackParticleData( *(*trackParticleIterator) ).isFailure() ){
710  msg(MSG::ERROR) << "Validation Ntuple Tool could not fill track data." << endmsg;
711  return StatusCode::FAILURE;
712  } // if StatusCode is FAILURE
713  nTrkParticlesPerEvent += 1;
714 
715  if ( m_ValTrkParticleNtupleTool->writeRecord(m_trees[trackParticleColIndex + m_inputTrackCollection.size()]).isFailure() ){
716  msg(MSG::ERROR) << "Validation Ntuple Tool could not write track data." << endmsg;
717  return StatusCode::FAILURE;
718  }
719  } // loop over Rec::TrackPartcielContainer
720 
721  // Record link between Event Property and Trk::TrackParticleBase information
722  for (unsigned int toolIndex = 0 ; toolIndex < m_eventPropertyNtupleTools.size(); ++toolIndex ){
723  if( m_eventPropertyNtupleTools[toolIndex]->isTrkParticleLinkTool() )
724  m_eventPropertyNtupleTools[toolIndex]->setTrackTreeIndices(trackParticleColIndex, trackTreeIndexBegin, nTrkParticlesPerEvent );
725  }
726 
727  msg(MSG::DEBUG) <<"writeTrackParticleData successfully finished " << endmsg;
728  return StatusCode::SUCCESS;
729 }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doTrackParticle

bool Trk::TrackValidationNtupleWriter::m_doTrackParticle
protected

Definition at line 97 of file TrackValidationNtupleWriter.h.

◆ m_doTruth

bool Trk::TrackValidationNtupleWriter::m_doTruth
protected

Switch to turn on / off truth.

Definition at line 96 of file TrackValidationNtupleWriter.h.

◆ m_eventLinkTree

TTree* Trk::TrackValidationNtupleWriter::m_eventLinkTree
protected

pointer to event-wise ntuple trees (one for all input track collections + truth)

Definition at line 102 of file TrackValidationNtupleWriter.h.

◆ m_eventPropertyNtupleHandles

ToolHandleArray<Trk::IEventPropertyNtupleTool> Trk::TrackValidationNtupleWriter::m_eventPropertyNtupleHandles
protected

jobO: list of event property tools

Definition at line 80 of file TrackValidationNtupleWriter.h.

◆ m_eventPropertyNtupleTools

std::vector<Trk::IEventPropertyNtupleTool*> Trk::TrackValidationNtupleWriter::m_eventPropertyNtupleTools
protected

list of event property tools

Definition at line 81 of file TrackValidationNtupleWriter.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_genJetFinder

ToolHandle<Trk::IGenParticleJetFinder> Trk::TrackValidationNtupleWriter::m_genJetFinder
protected

Tool to find jets.

Definition at line 94 of file TrackValidationNtupleWriter.h.

◆ m_genPartSelector

ToolHandle<Trk::IGenParticleSelector> Trk::TrackValidationNtupleWriter::m_genPartSelector
protected

Tool handle to the Trk::IGenParticleSelector.

Definition at line 93 of file TrackValidationNtupleWriter.h.

◆ m_inputPrimaryVertexCollection

std::string Trk::TrackValidationNtupleWriter::m_inputPrimaryVertexCollection
protected

SG key of the input primary vertex collection (used by the track selector)

Definition at line 87 of file TrackValidationNtupleWriter.h.

◆ m_inputTrackCollection

std::vector<std::string> Trk::TrackValidationNtupleWriter::m_inputTrackCollection
protected

name of the TrackCollection

Definition at line 83 of file TrackValidationNtupleWriter.h.

◆ m_inputTrackParticleCollection

std::vector<std::string> Trk::TrackValidationNtupleWriter::m_inputTrackParticleCollection
protected

name of the TrackParticleCollection

Definition at line 84 of file TrackValidationNtupleWriter.h.

◆ m_jetTruthNtupleTool

ToolHandle<Trk::IJetTruthNtupleTool> Trk::TrackValidationNtupleWriter::m_jetTruthNtupleTool
protected

Definition at line 77 of file TrackValidationNtupleWriter.h.

◆ m_McEventCollectionName

std::string Trk::TrackValidationNtupleWriter::m_McEventCollectionName
protected

name of the McEventCollection

Definition at line 86 of file TrackValidationNtupleWriter.h.

◆ m_nTrackTreeRecords

std::vector<unsigned int> Trk::TrackValidationNtupleWriter::m_nTrackTreeRecords
protected

Definition at line 100 of file TrackValidationNtupleWriter.h.

◆ m_ntupleDirName

std::string Trk::TrackValidationNtupleWriter::m_ntupleDirName
protected

jobOption: Ntuple directory name

Definition at line 89 of file TrackValidationNtupleWriter.h.

◆ m_ntupleFileName

std::string Trk::TrackValidationNtupleWriter::m_ntupleFileName
protected

jobOption: Ntuple file name

Definition at line 88 of file TrackValidationNtupleWriter.h.

◆ m_trackSelector

ToolHandle<Trk::ITrackSelectorTool> Trk::TrackValidationNtupleWriter::m_trackSelector
protected

Tool handle to the Trk::ITrackSelectorTool.

Definition at line 92 of file TrackValidationNtupleWriter.h.

◆ m_trackTruthClassifierHandles

ToolHandleArray<Trk::ITrackTruthClassifier> Trk::TrackValidationNtupleWriter::m_trackTruthClassifierHandles
protected

jobO: list of truth classifiers

Definition at line 78 of file TrackValidationNtupleWriter.h.

◆ m_trackTruthClassifiers

std::vector<const Trk::ITrackTruthClassifier*> Trk::TrackValidationNtupleWriter::m_trackTruthClassifiers
protected

the truth classifiers

Definition at line 79 of file TrackValidationNtupleWriter.h.

◆ m_trackTruthCollectionName

std::vector<std::string> Trk::TrackValidationNtupleWriter::m_trackTruthCollectionName
protected

name of the TrackTruthCollection

Definition at line 85 of file TrackValidationNtupleWriter.h.

◆ m_trees

std::vector<TTree*> Trk::TrackValidationNtupleWriter::m_trees
protected

Pointer to the NTuple trees (one for each input track collection)

Definition at line 101 of file TrackValidationNtupleWriter.h.

◆ m_truthNtupleTool

ToolHandle<Trk::ITruthNtupleTool> Trk::TrackValidationNtupleWriter::m_truthNtupleTool
protected

Definition at line 76 of file TrackValidationNtupleWriter.h.

◆ m_truthToTrack

ToolHandle<Trk::ITruthToTrack> Trk::TrackValidationNtupleWriter::m_truthToTrack
protected

Tool handle to the Trk::TruthToTrack tool.

Definition at line 91 of file TrackValidationNtupleWriter.h.

◆ m_useExternalEventLinkTree

bool Trk::TrackValidationNtupleWriter::m_useExternalEventLinkTree
protected

if TVNW should make event tree itself or assume CBNT does

Definition at line 95 of file TrackValidationNtupleWriter.h.

◆ m_ValidationNtupleTools

ToolHandleArray<Trk::ITrackValidationNtupleTool> Trk::TrackValidationNtupleWriter::m_ValidationNtupleTools
protected

set of tools for writing Trk::Track into the Ntuple

Definition at line 74 of file TrackValidationNtupleWriter.h.

◆ m_ValTrkParticleNtupleTool

ToolHandle<Trk::IValidationNtupleTool> Trk::TrackValidationNtupleWriter::m_ValTrkParticleNtupleTool
protected

Tool for writting Rec::TrackParticle into the Ntuple – OBSOLETE.

Definition at line 75 of file TrackValidationNtupleWriter.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_visibleParticleWithoutTruth

HepMC::GenParticlePtr Trk::TrackValidationNtupleWriter::m_visibleParticleWithoutTruth
protected

Switch to turn on/pff recording track particle trees into Ntuple.

cludge to treat G4's "fake fakes"

Definition at line 99 of file TrackValidationNtupleWriter.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Trk::Vertex
Definition: Tracking/TrkEvent/VxVertex/VxVertex/Vertex.h:26
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Trk::TrackValidationNtupleWriter::m_inputTrackCollection
std::vector< std::string > m_inputTrackCollection
name of the TrackCollection
Definition: TrackValidationNtupleWriter.h:83
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
Trk::TrackValidationNtupleWriter::m_eventLinkTree
TTree * m_eventLinkTree
pointer to event-wise ntuple trees (one for all input track collections + truth)
Definition: TrackValidationNtupleWriter.h:102
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Trk::TrackValidationNtupleWriter::writeTrackParticleData
StatusCode writeTrackParticleData(unsigned int trackParticleColIndex)
method to write track particle data to Ntuple.
Definition: TrackValidationNtupleWriter.cxx:677
Common::classify
void classify(ToolHandle< IMCTruthClassifier > &m_classif, const xAOD::TruthParticle *theParticle, unsigned int &particleOutCome, unsigned int &result, int &hadron_pdg, unsigned int &particleType, unsigned int &particleOrigin)
Definition: Common.cxx:96
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::ValidationTrackTruthData::genParticle
HepMC::ConstGenParticlePtr genParticle
Definition: ITruthNtupleTool.h:38
Trk::indices
std::pair< long int, long int > indices
Definition: AlSymMatBase.h:24
Trk::TrackValidationNtupleWriter::m_ValidationNtupleTools
ToolHandleArray< Trk::ITrackValidationNtupleTool > m_ValidationNtupleTools
set of tools for writing Trk::Track into the Ntuple
Definition: TrackValidationNtupleWriter.h:74
tree
TChain * tree
Definition: tile_monitor.h:30
Trk::ValidationTrackTruthData::truthToTrackIndices
std::vector< std::vector< unsigned int > > truthToTrackIndices
Definition: ITruthNtupleTool.h:40
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
Trk::ValidationTrackTruthData::truthToTrackMatchingProbabilities
std::vector< std::vector< float > > truthToTrackMatchingProbabilities
Definition: ITruthNtupleTool.h:41
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Trk::TrackValidationNtupleWriter::m_doTruth
bool m_doTruth
Switch to turn on / off truth.
Definition: TrackValidationNtupleWriter.h:96
Trk::TrackValidationNtupleWriter::m_inputTrackParticleCollection
std::vector< std::string > m_inputTrackParticleCollection
name of the TrackParticleCollection
Definition: TrackValidationNtupleWriter.h:84
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
empty
bool empty(TH1 *h)
Definition: computils.cxx:294
Trk::TrackValidationNtupleWriter::m_visibleParticleWithoutTruth
HepMC::GenParticlePtr m_visibleParticleWithoutTruth
Switch to turn on/pff recording track particle trees into Ntuple.
Definition: TrackValidationNtupleWriter.h:99
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
Trk::TrackValidationNtupleWriter::m_ntupleFileName
std::string m_ntupleFileName
jobOption: Ntuple file name
Definition: TrackValidationNtupleWriter.h:88
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
Trk::TrackValidationNtupleWriter::m_inputPrimaryVertexCollection
std::string m_inputPrimaryVertexCollection
SG key of the input primary vertex collection (used by the track selector)
Definition: TrackValidationNtupleWriter.h:87
TrackTruthCollection
Definition: TrackTruthCollection.h:21
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
AthAlgorithm::sysInitialize
virtual StatusCode sysInitialize() override
Override sysInitialize.
Definition: AthAlgorithm.cxx:66
Trk::TrackValidationNtupleWriter::m_eventPropertyNtupleTools
std::vector< Trk::IEventPropertyNtupleTool * > m_eventPropertyNtupleTools
list of event property tools
Definition: TrackValidationNtupleWriter.h:81
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::TrackValidationNtupleWriter::m_eventPropertyNtupleHandles
ToolHandleArray< Trk::IEventPropertyNtupleTool > m_eventPropertyNtupleHandles
jobO: list of event property tools
Definition: TrackValidationNtupleWriter.h:80
AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
Return this algorithm's output handles.
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::TrackValidationNtupleWriter::m_ValTrkParticleNtupleTool
ToolHandle< Trk::IValidationNtupleTool > m_ValTrkParticleNtupleTool
Tool for writting Rec::TrackParticle into the Ntuple – OBSOLETE.
Definition: TrackValidationNtupleWriter.h:75
Trk::ParametersBase
Definition: ParametersBase.h:55
Trk::TrackValidationNtupleWriter::m_genPartSelector
ToolHandle< Trk::IGenParticleSelector > m_genPartSelector
Tool handle to the Trk::IGenParticleSelector.
Definition: TrackValidationNtupleWriter.h:93
VxContainer
Definition: VxContainer.h:28
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DataVector< Trk::Track >
TrackTruth::particleLink
const HepMcParticleLink & particleLink() const
Definition: TrackTruth.h:26
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
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
Trk::TrackValidationNtupleWriter::m_trackTruthClassifierHandles
ToolHandleArray< Trk::ITrackTruthClassifier > m_trackTruthClassifierHandles
jobO: list of truth classifiers
Definition: TrackValidationNtupleWriter.h:78
Trk::TrackValidationNtupleWriter::m_ntupleDirName
std::string m_ntupleDirName
jobOption: Ntuple directory name
Definition: TrackValidationNtupleWriter.h:89
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Trk::TrackValidationNtupleWriter::m_trackSelector
ToolHandle< Trk::ITrackSelectorTool > m_trackSelector
Tool handle to the Trk::ITrackSelectorTool.
Definition: TrackValidationNtupleWriter.h:92
Trk::TrackValidationNtupleWriter::m_genJetFinder
ToolHandle< Trk::IGenParticleJetFinder > m_genJetFinder
Tool to find jets.
Definition: TrackValidationNtupleWriter.h:94
AthAlgorithm::m_extendedExtraObjects
DataObjIDColl m_extendedExtraObjects
Definition: AthAlgorithm.h:79
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
TrackTruth
MC particle associated with a reco track + the quality of match.
Definition: TrackTruth.h:14
Trk::TrackValidationNtupleWriter::m_truthNtupleTool
ToolHandle< Trk::ITruthNtupleTool > m_truthNtupleTool
Definition: TrackValidationNtupleWriter.h:76
Trk::ValidationTrackTruthData::classifications
std::vector< unsigned int > classifications
Definition: ITruthNtupleTool.h:43
Trk::ValidationTrackTruthData::truthPerigee
const Trk::TrackParameters * truthPerigee
Definition: ITruthNtupleTool.h:39
a
TList * a
Definition: liststreamerinfos.cxx:10
HepMC::newGenParticlePtr
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
Definition: GenParticle.h:39
Trk::TrackValidationNtupleWriter::writeTrackData
StatusCode writeTrackData(unsigned int trackColIndex, std::vector< Trk::ValidationTrackTruthData > &truthData, const Trk::Vertex *primaryVertex=NULL)
< following methods and atributes are used in derived class TrigTrackValidationNtupleWriter Private m...
Definition: TrackValidationNtupleWriter.cxx:525
h
Trk::TrackValidationNtupleWriter::m_jetTruthNtupleTool
ToolHandle< Trk::IJetTruthNtupleTool > m_jetTruthNtupleTool
Definition: TrackValidationNtupleWriter.h:77
Trk::TrackValidationNtupleWriter::m_McEventCollectionName
std::string m_McEventCollectionName
name of the McEventCollection
Definition: TrackValidationNtupleWriter.h:86
Trk::TrackValidationNtupleWriter::m_trackTruthCollectionName
std::vector< std::string > m_trackTruthCollectionName
name of the TrackTruthCollection
Definition: TrackValidationNtupleWriter.h:85
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::TrackValidationNtupleWriter::m_trees
std::vector< TTree * > m_trees
Pointer to the NTuple trees (one for each input track collection)
Definition: TrackValidationNtupleWriter.h:101
TrackTruth::probability
float probability() const
Definition: TrackTruth.h:28
Trk::TrackValidationNtupleWriter::m_nTrackTreeRecords
std::vector< unsigned int > m_nTrackTreeRecords
Definition: TrackValidationNtupleWriter.h:100
Trk::TrackValidationNtupleWriter::m_truthToTrack
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
Tool handle to the Trk::TruthToTrack tool.
Definition: TrackValidationNtupleWriter.h:91
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
AthAlgorithm::AthAlgorithm
AthAlgorithm()
Default constructor:
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
LHEF::Writer
Pythia8::Writer Writer
Definition: Prophecy4fMerger.cxx:12
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
HepMC::generations
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (TODO migrate to be...
Definition: MagicNumbers.h:345
Trk::TrackValidationNtupleWriter::m_trackTruthClassifiers
std::vector< const Trk::ITrackTruthClassifier * > m_trackTruthClassifiers
the truth classifiers
Definition: TrackValidationNtupleWriter.h:79
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
Trk::TrackValidationNtupleWriter::m_doTrackParticle
bool m_doTrackParticle
Definition: TrackValidationNtupleWriter.h:97
fitman.k
k
Definition: fitman.py:528
Trk::ValidationTrackTruthData
Definition: ITruthNtupleTool.h:36
Trk::TrackValidationNtupleWriter::m_useExternalEventLinkTree
bool m_useExternalEventLinkTree
if TVNW should make event tree itself or assume CBNT does
Definition: TrackValidationNtupleWriter.h:95
ServiceHandle< ICondSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37