15 #include "GaudiKernel/ITHistSvc.h"
31 m_collectionType(s_trackTypeName),
32 m_eventLinkTree(nullptr),
34 m_trackIndexBegin(std::vector<int>()),
35 m_nTracksPerEvent(std::vector<int>()),
36 m_genParticleIndexBegin(0),
37 m_nGenParticlesPerEvent(0)
39 declareInterface<IEventPropertyNtupleTool>(
this);
40 declareProperty(
"CollectionType",m_collectionType,
"Type of collection which associated with this instance ["
41 +s_trackTypeName+
", "+s_trkParticleTypeName+
", "+s_trkParticleTrigTypeName+
", "+s_inDetTrackTrigTypeName+
"]");
48 if(checkCollectionType().isFailure())
return StatusCode::FAILURE;
55 return StatusCode::SUCCESS;
59 ( std::vector<std::string> collections,
bool doTruth) {
60 m_trackCollections = collections;
62 m_trackIndexBegin.resize(m_trackCollections.size());
63 m_nTracksPerEvent.resize(m_trackCollections.size());
67 if (!
tree)
return StatusCode::FAILURE;
70 m_eventLinkTree =
tree;
71 for (
unsigned int tColIndex = 0; tColIndex<m_trackCollections.size(); tColIndex++) {
72 m_eventLinkTree->Branch((cbnt_prefix+m_trackCollections[tColIndex]+
"IndexBegin").c_str(),
73 &(m_trackIndexBegin.at(tColIndex)) );
74 m_eventLinkTree->Branch((cbnt_prefix+
"n"+m_trackCollections[tColIndex]+
"PerEvent").c_str(),
75 &(m_nTracksPerEvent.at(tColIndex)) );
78 m_eventLinkTree->Branch((cbnt_prefix+
"GenParticlesIndexBegin").c_str(), &m_genParticleIndexBegin );
79 m_eventLinkTree->Branch((cbnt_prefix+
"nGenParticlesPerEvent").c_str(), &m_nGenParticlesPerEvent );
81 return StatusCode::SUCCESS;
85 (
unsigned int tColIndex,
87 int nTracksPerEvent ) {
89 ATH_MSG_VERBOSE (
"Collection index "<<tColIndex<<
"\tm_trackIndexBegin\t"<< m_trackIndexBegin.size() );
90 m_trackIndexBegin[tColIndex] = indexBegin;
91 m_nTracksPerEvent[tColIndex] = nTracksPerEvent;
92 if (m_nTracksPerEvent[tColIndex]==0) m_trackIndexBegin[tColIndex]=0;
97 int nGenParticlesPerEvent) {
98 m_genParticleIndexBegin = indexBegin;
99 m_nGenParticlesPerEvent = nGenParticlesPerEvent;
103 return StatusCode::SUCCESS;
107 return StatusCode::SUCCESS;
111 if(( m_collectionType != s_trackTypeName) && (m_collectionType != s_trkParticleTypeName) && (m_collectionType != s_trkParticleTrigTypeName) && (m_collectionType != s_inDetTrackTrigTypeName)) {
112 ATH_MSG_ERROR (
"Recieved collection type: "<< m_collectionType
113 <<
"does not correspond to any of following types:"<< s_trackTypeName
114 <<
", "<<s_trkParticleTypeName <<
", "<<s_trkParticleTrigTypeName
115 <<
", "<<s_inDetTrackTrigTypeName);
117 return StatusCode::FAILURE;
119 return StatusCode::SUCCESS;