ATLAS Offline Software
EventToTrackLinkNtupleTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // EventToTrackLinkNtupleTool.h
7 // Header file for EventToTrackLinkNtupleTool
9 // (c) ATLAS Detector software
11 // Wolfgang.Liebig -at- cern.ch
13 
14 #ifndef TRK_EVENTTRACKLINKNTUPLETOOL_H
15 #define TRK_EVENTTRACKLINKNTUPLETOOL_H
16 
18 
19 #include "GaudiKernel/ToolHandle.h"
21 #include <vector>
22 class TTree;
23 
30 namespace Trk {
31 
33  public:
34 
35  // standard AlgToolmethods
36  EventToTrackLinkNtupleTool(const std::string&,const std::string&,const IInterface*);
38 
39  // standard Athena methods
42 
44  virtual void registerTrackCollections( std::vector<std::string>, bool);
46  virtual void setTrackTreeIndices( unsigned int, int, int);
48  virtual void setGenParticleTreeIndices( int, int);
49 
53  virtual StatusCode addNtupleItems ( TTree*, const std::string );
54 
56  virtual StatusCode fillEventData ( );
57 
59  virtual StatusCode resetVariables ( );
60 
62  inline virtual bool isTrackLinkTool( ) const;
64  inline virtual bool isTrkParticleLinkTool( ) const;
66  inline virtual bool isTrkParticleTrigLinkTool( ) const;
68  inline virtual bool isInDetTrackTrigLinkTool( ) const;
70  inline virtual bool isEvtPropertyTool( ) const;
71 
72  private:
75 
76  std::string m_collectionType;
77  TTree* m_eventLinkTree;
78  bool m_doTruth;
79  std::vector<std::string> m_trackCollections;
80 
81  // --- ntuple items ---
82  std::vector<int> m_trackIndexBegin;
83  std::vector<int> m_nTracksPerEvent;
86 
87  static const std::string s_trackTypeName;
88  static const std::string s_trkParticleTypeName;
89  static const std::string s_trkParticleTrigTypeName;
90  static const std::string s_inDetTrackTrigTypeName;
91  };
92 
93 }
94 
95 
97  if( m_collectionType == s_trackTypeName) return true;
98  return false;
99  }
100 
102  if( m_collectionType == s_trkParticleTypeName) return true;
103  return false;
104  }
105 
107  if( m_collectionType == s_trkParticleTrigTypeName) return true;
108  return false;
109  }
110 
112  if( m_collectionType == s_inDetTrackTrigTypeName) return true;
113  return false;
114  }
115 
117  return false;
118  }
119 
120 
121 #endif // TRK_EVENTTRACKLINKNTUPLETOOL_H
Trk::EventToTrackLinkNtupleTool::EventToTrackLinkNtupleTool
EventToTrackLinkNtupleTool(const std::string &, const std::string &, const IInterface *)
Definition: EventToTrackLinkNtupleTool.cxx:25
Trk::EventToTrackLinkNtupleTool::m_collectionType
std::string m_collectionType
Definition: EventToTrackLinkNtupleTool.h:76
Trk::EventToTrackLinkNtupleTool::isInDetTrackTrigLinkTool
virtual bool isInDetTrackTrigLinkTool() const
is True if instance is Tool which links events property to InDetTrack recieved useing TrigDecTool
Definition: EventToTrackLinkNtupleTool.h:111
Trk::EventToTrackLinkNtupleTool
Definition: EventToTrackLinkNtupleTool.h:32
IEventPropertyNtupleTool.h
Trk::EventToTrackLinkNtupleTool::setGenParticleTreeIndices
virtual void setGenParticleTreeIndices(int, int)
see interface for documentation
Definition: EventToTrackLinkNtupleTool.cxx:96
Trk::EventToTrackLinkNtupleTool::m_trackIndexBegin
std::vector< int > m_trackIndexBegin
index-based link from event tree to track tree entry.
Definition: EventToTrackLinkNtupleTool.h:82
Trk::EventToTrackLinkNtupleTool::registerTrackCollections
virtual void registerTrackCollections(std::vector< std::string >, bool)
see interface for documentation
Definition: EventToTrackLinkNtupleTool.cxx:59
Trk::EventToTrackLinkNtupleTool::isTrackLinkTool
virtual bool isTrackLinkTool() const
is True if instance is Tool which links events property to Trk::Tracks
Definition: EventToTrackLinkNtupleTool.h:96
Trk::EventToTrackLinkNtupleTool::finalize
StatusCode finalize()
Definition: EventToTrackLinkNtupleTool.cxx:53
Trk::EventToTrackLinkNtupleTool::s_trackTypeName
static const std::string s_trackTypeName
denotes instance which deals with Trk::Track
Definition: EventToTrackLinkNtupleTool.h:87
Trk::EventToTrackLinkNtupleTool::initialize
StatusCode initialize()
Definition: EventToTrackLinkNtupleTool.cxx:47
Trk::EventToTrackLinkNtupleTool::isEvtPropertyTool
virtual bool isEvtPropertyTool() const
is True if instance is EventPropertyTool
Definition: EventToTrackLinkNtupleTool.h:116
Trk::EventToTrackLinkNtupleTool::m_nGenParticlesPerEvent
int m_nGenParticlesPerEvent
Definition: EventToTrackLinkNtupleTool.h:85
Trk::IEventPropertyNtupleTool
Definition: IEventPropertyNtupleTool.h:34
Trk::EventToTrackLinkNtupleTool::setTrackTreeIndices
virtual void setTrackTreeIndices(unsigned int, int, int)
see interface for documentation
Definition: EventToTrackLinkNtupleTool.cxx:85
Trk::EventToTrackLinkNtupleTool::s_inDetTrackTrigTypeName
static const std::string s_inDetTrackTrigTypeName
denotes instance which deals with InDetTrack obtained as feature using TriDecTool
Definition: EventToTrackLinkNtupleTool.h:90
Trk::EventToTrackLinkNtupleTool::m_trackCollections
std::vector< std::string > m_trackCollections
name of the TrackCollections to form tree branch names later
Definition: EventToTrackLinkNtupleTool.h:79
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Trk::EventToTrackLinkNtupleTool::m_nTracksPerEvent
std::vector< int > m_nTracksPerEvent
Definition: EventToTrackLinkNtupleTool.h:83
Trk::EventToTrackLinkNtupleTool::resetVariables
virtual StatusCode resetVariables()
reset ntuple variables (mainly for vectors which need to be cleared)
Definition: EventToTrackLinkNtupleTool.cxx:106
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::EventToTrackLinkNtupleTool::s_trkParticleTypeName
static const std::string s_trkParticleTypeName
denotes instance which deals with Rec::TrackParticle
Definition: EventToTrackLinkNtupleTool.h:88
Trk::EventToTrackLinkNtupleTool::~EventToTrackLinkNtupleTool
~EventToTrackLinkNtupleTool()
Trk::EventToTrackLinkNtupleTool::isTrkParticleLinkTool
virtual bool isTrkParticleLinkTool() const
is True if instance is Tool which links events property to Rec::TrkParticle
Definition: EventToTrackLinkNtupleTool.h:101
Trk::EventToTrackLinkNtupleTool::m_doTruth
bool m_doTruth
Switch to turn on / off truth.
Definition: EventToTrackLinkNtupleTool.h:78
Trk::EventToTrackLinkNtupleTool::m_genParticleIndexBegin
int m_genParticleIndexBegin
index-based link from event tree to truth tree entry.
Definition: EventToTrackLinkNtupleTool.h:84
Trk::EventToTrackLinkNtupleTool::checkCollectionType
StatusCode checkCollectionType() const
checks if recieved string collectionType corresponds to some collection type names [Trk::Track,...
Definition: EventToTrackLinkNtupleTool.cxx:110
Trk::EventToTrackLinkNtupleTool::m_eventLinkTree
TTree * m_eventLinkTree
pointer to event-wise ntuple trees (one for all input track collections + truth)
Definition: EventToTrackLinkNtupleTool.h:77
Trk::EventToTrackLinkNtupleTool::fillEventData
virtual StatusCode fillEventData()
calculate event-wide data and copy into TTree branches, but don't write the record yet.
Definition: EventToTrackLinkNtupleTool.cxx:102
Trk::EventToTrackLinkNtupleTool::isTrkParticleTrigLinkTool
virtual bool isTrkParticleTrigLinkTool() const
is True if instance is Tool which links events property to Rec::TrkParticle recieved useing TrigDecTo...
Definition: EventToTrackLinkNtupleTool.h:106
AthAlgTool
Definition: AthAlgTool.h:26
Trk::EventToTrackLinkNtupleTool::addNtupleItems
virtual StatusCode addNtupleItems(TTree *, const std::string)
add branches to the tree Should be called once dunring the initialisation phase by the calling algori...
Definition: EventToTrackLinkNtupleTool.cxx:66
Trk::EventToTrackLinkNtupleTool::s_trkParticleTrigTypeName
static const std::string s_trkParticleTrigTypeName
denotes instance which deals with Rec::TrackParticle obtained as feature using TriDecTool
Definition: EventToTrackLinkNtupleTool.h:89