ATLAS Offline Software
TruthNtupleTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TruthNtupleTool.h
7 // Header file for TruthNtupleTool
9 // (c) ATLAS Detector software
11 // Sebastian.Fleischmann@cern.ch
13 
14 #ifndef TRK_TRUTHNTUPLETOOL_H
15 #define TRK_TRUTHNTUPLETOOL_H
16 
17 
19 #include "GaudiKernel/ITHistSvc.h"
20 #include "GaudiKernel/ServiceHandle.h"
21 #include "GaudiKernel/ToolHandle.h"
24 
27 #include <vector>
28 
29 
30 class TH1D;
31 class TTree;
32 
33 namespace Trk {
34 
35 
46 class TruthNtupleTool : virtual public Trk::ITruthNtupleTool, public AthAlgTool {
47 public:
48 
49  // standard AlgToolmethods
50  TruthNtupleTool(const std::string&,const std::string&,const IInterface*);
52 
53  // standard Athena methods
56 
57  virtual StatusCode writeTruthData ( const std::vector< Trk::ValidationTrackTruthData >& truthData );
58 
59  virtual unsigned int getNumberOfTreeRecords() const;
60 
61  virtual StatusCode initBranches(const std::vector<const Trk::ITrackTruthClassifier*>& classifiers,
62  bool,
63  const std::vector<std::string> trackCollectionNames);
64 
65 private:
66 
67  // jobOptions
68  std::string m_ntupleTreeName;
69  std::string m_ntupleFileName;
70  std::vector<double> m_etaBins;
71  bool m_fillJets;
72 
74  TTree* m_nt;
75 
76  unsigned int m_numberOfTreeEntries;
77 
78  // ntuple variables
81 
82  std::vector< std::vector<unsigned int>* > m_TrackLinkIndex;
83  std::vector< std::vector<float>* > m_mc_prob;
84  std::vector<unsigned int> m_classifications;
85  // Truth information
86  float m_mc_d0;
87  float m_mc_z0;
88  float m_mc_phi0;
89  float m_mc_theta;
90  float m_mc_qOverP;
91  float m_mc_qOverPt;
92  float m_mc_eta;
93 
96  float m_mc_energy;
98  float m_mc_prodR;
99  float m_mc_prodz;
100 
101  // statistics
102  std::vector< std::vector<TH1D*> > m_recoTrackCounts;
103  std::vector< std::vector<TH1D*> > m_truthTrackCounts;
104 
105  std::vector<const Trk::ITrackTruthClassifier*> m_trackTruthClassifiers;
106 
107  SG::ReadHandleKey<xAOD::EventInfo> m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"};
108 };
109 
110 
111 } // end of namespace
112 
113 #endif // TRK_TRUTHNTUPLETOOL_H
114 
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
Trk::TruthNtupleTool::m_trackTruthClassifiers
std::vector< const Trk::ITrackTruthClassifier * > m_trackTruthClassifiers
the truth classifiers
Definition: TruthNtupleTool.h:105
Trk::TruthNtupleTool::m_mc_jetLinkIndex
int m_mc_jetLinkIndex
link to jet this particle belongs to (if jet tree is ON)
Definition: TruthNtupleTool.h:97
Trk::TruthNtupleTool::m_mc_particleID
int m_mc_particleID
PDG ID of MC truth particle.
Definition: TruthNtupleTool.h:94
Trk::TruthNtupleTool::m_mc_uniqueID
int m_mc_uniqueID
MC truth particle's uniqueID.
Definition: TruthNtupleTool.h:95
Trk::TruthNtupleTool::getNumberOfTreeRecords
virtual unsigned int getNumberOfTreeRecords() const
Definition: TruthNtupleTool.cxx:325
Trk::TruthNtupleTool::m_mc_qOverP
float m_mc_qOverP
q/p of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:90
Trk::TruthNtupleTool::m_mc_d0
float m_mc_d0
d0 of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:86
Trk::TruthNtupleTool::m_classifications
std::vector< unsigned int > m_classifications
Definition: TruthNtupleTool.h:84
Trk::TruthNtupleTool::m_eventNumber
int m_eventNumber
event number to which this MC truth particle belongs
Definition: TruthNtupleTool.h:80
Trk::TruthNtupleTool::m_mc_energy
float m_mc_energy
MC truth particle's energy at production vertex.
Definition: TruthNtupleTool.h:96
ITrackTruthClassifier.h
Trk::TruthNtupleTool::m_runNumber
int m_runNumber
run number to which this MC truth particle belongs
Definition: TruthNtupleTool.h:79
Trk::TruthNtupleTool::m_ntupleFileName
std::string m_ntupleFileName
jobOption: Ntuple file and dir name
Definition: TruthNtupleTool.h:69
Trk::TruthNtupleTool::m_mc_eta
float m_mc_eta
eta of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:92
SG::ReadHandleKey< xAOD::EventInfo >
Trk::TruthNtupleTool::writeTruthData
virtual StatusCode writeTruthData(const std::vector< Trk::ValidationTrackTruthData > &truthData)
write track data to ntuple
Definition: TruthNtupleTool.cxx:239
Trk::TruthNtupleTool::initBranches
virtual StatusCode initBranches(const std::vector< const Trk::ITrackTruthClassifier * > &classifiers, bool, const std::vector< std::string > trackCollectionNames)
Definition: TruthNtupleTool.cxx:125
Trk::TruthNtupleTool::TruthNtupleTool
TruthNtupleTool(const std::string &, const std::string &, const IInterface *)
Definition: TruthNtupleTool.cxx:33
Trk::TruthNtupleTool::m_numberOfTreeEntries
unsigned int m_numberOfTreeEntries
Definition: TruthNtupleTool.h:76
Trk::TruthNtupleTool::m_TrackLinkIndex
std::vector< std::vector< unsigned int > * > m_TrackLinkIndex
Definition: TruthNtupleTool.h:82
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
Trk::TruthNtupleTool::m_mc_phi0
float m_mc_phi0
phi of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:88
Trk::TruthNtupleTool::m_truthTrackCounts
std::vector< std::vector< TH1D * > > m_truthTrackCounts
Definition: TruthNtupleTool.h:103
Trk::TruthNtupleTool::m_mc_qOverPt
float m_mc_qOverPt
q/pT of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:91
Trk::TruthNtupleTool::m_nt
TTree * m_nt
Pointer to the NTuple tree.
Definition: TruthNtupleTool.h:74
Trk::TruthNtupleTool::m_mc_z0
float m_mc_z0
z of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:87
Trk::TruthNtupleTool::m_mc_prob
std::vector< std::vector< float > * > m_mc_prob
Definition: TruthNtupleTool.h:83
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TruthNtupleTool::m_etaBins
std::vector< double > m_etaBins
Definition: TruthNtupleTool.h:70
Trk::TruthNtupleTool::m_ntupleTreeName
std::string m_ntupleTreeName
jobOption: Ntuple tree name
Definition: TruthNtupleTool.h:68
ITruthNtupleTool.h
EventInfo.h
Trk::TruthNtupleTool::~TruthNtupleTool
~TruthNtupleTool()
Trk::TruthNtupleTool::m_mc_prodz
float m_mc_prodz
z coordinate of particle's production vertex
Definition: TruthNtupleTool.h:99
Trk::TruthNtupleTool::initialize
StatusCode initialize()
Definition: TruthNtupleTool.cxx:81
Trk::TruthNtupleTool::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
Definition: TruthNtupleTool.h:73
AthAlgTool
Definition: AthAlgTool.h:26
Trk::TruthNtupleTool::finalize
StatusCode finalize()
finalize
Definition: TruthNtupleTool.cxx:189
Trk::ITruthNtupleTool
Definition: ITruthNtupleTool.h:55
Trk::TruthNtupleTool::m_mc_theta
float m_mc_theta
theta of MC truth particle's perigee parameters
Definition: TruthNtupleTool.h:89
Trk::TruthNtupleTool
Tool to fill basic information about the truth record.
Definition: TruthNtupleTool.h:46
Trk::TruthNtupleTool::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition: TruthNtupleTool.h:107
Trk::TruthNtupleTool::m_mc_prodR
float m_mc_prodR
Rxy of particle's production vertex.
Definition: TruthNtupleTool.h:98
Trk::TruthNtupleTool::m_recoTrackCounts
std::vector< std::vector< TH1D * > > m_recoTrackCounts
Definition: TruthNtupleTool.h:102
ServiceHandle< ITHistSvc >
Trk::TruthNtupleTool::m_fillJets
bool m_fillJets
jO: jet filling, set from external call
Definition: TruthNtupleTool.h:71