ATLAS Offline Software
FPGATrackSimHoughRootOutputTool.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef FPGATrackSimHOUGHROOTOUTPUTTOOL_H
4 #define FPGATrackSimHOUGHROOTOUTPUTTOOL_H
5 
14 #include "GaudiKernel/ServiceHandle.h"
16 
22 
23 #include "GaudiKernel/ITHistSvc.h"
24 
27 
28 #include "TTree.h"
29 
30 
33 
35 {
36  public:
37 
39  // AthAlgTool
40 
41  FPGATrackSimHoughRootOutputTool(const std::string&, const std::string&, const IInterface*);
42 
43  virtual StatusCode initialize() override;
44  StatusCode fillTree(std::vector<FPGATrackSimRoad*> &roads, const std::vector<FPGATrackSimTruthTrack> &truthTracks, const std::vector<FPGATrackSimOfflineTrack> &offlineTracks);
45 
46  private:
47 
49 
50  void ResetVectors();
51 
52  ServiceHandle<IFPGATrackSimEventSelectionSvc> m_EvtSel {this, "FPGATrackSimEventSelectionSvc", "FPGATrackSimEventSelectionSvc"};
53  ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};
54  ServiceHandle<ITHistSvc> m_tHistSvc {this, "THistSvc", "THistSvc"};
55 
56 
57  TTree *m_tree = nullptr; // output tree
58  std::vector<float> m_x; // x position of hit in road
59  std::vector<float> m_y; // y pos
60  std::vector<float> m_z; // z pos
61  std::vector<float> m_barcodefrac; // truth barcode fraction for the hit
62  std::vector<int> m_barcode; // truth barcode for the hit
63  std::vector<int> m_eventindex; // event index for the hit
64  std::vector<unsigned int> m_isPixel; // is hit pixel? if 0 it is strip
65  std::vector<unsigned int> m_layer; // layer ID
66  std::vector<unsigned int> m_isBarrel; // is hit in barrel? if 0 it is endcap
67  std::vector<unsigned int> m_etawidth;
68  std::vector<unsigned int> m_phiwidth;
69  std::vector<unsigned int> m_etamodule;
70  std::vector<unsigned int> m_phimodule;
71  std::vector<unsigned int> m_ID; // ID hash for hit
72 
73  float m_phi = 0.0F; // phi pre-estimate from the 2d hough
74  float m_invpt = 0.0F; // invpt pre-estimate from the 2d hough
75 
76  // quantities for the track matched to truth, not per hit
78  float m_candidate_barcode = 0.0F;
79  float m_candidate_eventindex = 0.0F;
80 
81  // track number in the event, since the request is to store this per road
82  // naively vectors of vectors and one entry per event makes more sense but this was the
83  // request from the ML people
84  int m_tracknumber = 0;
85 
86  // this is the tree index used to connect to the truth information
87  int m_treeindex = 0;
88 
89  // road number separates information from each road;
90  int m_roadnumber = 0;
91 
92  // Separate tree with truth track information
93  TTree *m_truthtree = nullptr; // output tree
94 
95  std::vector<float> m_truth_d0;
96  std::vector<float> m_truth_z0;
97  std::vector<float> m_truth_pt;
98  std::vector<float> m_truth_eta;
99  std::vector<float> m_truth_phi;
100  std::vector<float> m_truth_pdg;
101  std::vector<int> m_truth_q;
102  std::vector<int> m_truth_barcode;
103  std::vector<int> m_truth_eventindex;
104 
105  // And now the offline information
106  TTree *m_offlinetree = nullptr;
107  std::vector<int> m_offline_n_holes;
108  std::vector<int> m_offline_n_measurement;
109  std::vector<int> m_offline_n_inertmaterial;
110  std::vector<int> m_offline_n_brempoint;
111  std::vector<int> m_offline_n_scatterer;
112  std::vector<int> m_offline_n_perigee;
113  std::vector<int> m_offline_n_outlier;
114  std::vector<int> m_offline_n_other;
115 
116  std::vector<float> m_offline_d0;
117  std::vector<float> m_offline_z0;
118  std::vector<float> m_offline_pt;
119  std::vector<float> m_offline_eta;
120  std::vector<float> m_offline_phi;
121  std::vector<int> m_offline_q;
122  std::vector<int> m_offline_barcode;
123  std::vector<float> m_offline_barcodefrac;
124 };
125 
126 
127 #endif // FPGATrackSimHOUGHROOTOUTPUTTOOL_H
FPGATrackSimHoughRootOutputTool::m_barcodefrac
std::vector< float > m_barcodefrac
Definition: FPGATrackSimHoughRootOutputTool.h:61
FPGATrackSimHoughRootOutputTool::m_truth_phi
std::vector< float > m_truth_phi
Definition: FPGATrackSimHoughRootOutputTool.h:99
FPGATrackSimHoughRootOutputTool::m_offline_z0
std::vector< float > m_offline_z0
Definition: FPGATrackSimHoughRootOutputTool.h:117
FPGATrackSimHoughRootOutputTool::m_isBarrel
std::vector< unsigned int > m_isBarrel
Definition: FPGATrackSimHoughRootOutputTool.h:66
FPGATrackSimHoughRootOutputTool::m_layer
std::vector< unsigned int > m_layer
Definition: FPGATrackSimHoughRootOutputTool.h:65
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimHoughRootOutputTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimHoughRootOutputTool.cxx:17
FPGATrackSimHoughRootOutputTool::m_offline_phi
std::vector< float > m_offline_phi
Definition: FPGATrackSimHoughRootOutputTool.h:120
IFPGATrackSimMappingSvc.h
FPGATrackSimHoughRootOutputTool::m_x
std::vector< float > m_x
Definition: FPGATrackSimHoughRootOutputTool.h:58
FPGATrackSimOfflineTrack.h
FPGATrackSimHoughRootOutputTool::m_offlinetree
TTree * m_offlinetree
Definition: FPGATrackSimHoughRootOutputTool.h:106
FPGATrackSimHoughRootOutputTool::m_offline_n_brempoint
std::vector< int > m_offline_n_brempoint
Definition: FPGATrackSimHoughRootOutputTool.h:110
IFPGATrackSimEventSelectionSvc
Definition: IFPGATrackSimEventSelectionSvc.h:22
FPGATrackSimHoughRootOutputTool::m_etawidth
std::vector< unsigned int > m_etawidth
Definition: FPGATrackSimHoughRootOutputTool.h:67
IFPGATrackSimMappingSvc
Definition: IFPGATrackSimMappingSvc.h:17
FPGATrackSimMultiTruth.h
FPGATrackSimHoughRootOutputTool::m_treeindex
int m_treeindex
Definition: FPGATrackSimHoughRootOutputTool.h:87
FPGATrackSimHoughRootOutputTool::m_isPixel
std::vector< unsigned int > m_isPixel
Definition: FPGATrackSimHoughRootOutputTool.h:64
FPGATrackSimHoughRootOutputTool::m_phi
float m_phi
Definition: FPGATrackSimHoughRootOutputTool.h:73
FPGATrackSimHoughRootOutputTool::m_offline_n_outlier
std::vector< int > m_offline_n_outlier
Definition: FPGATrackSimHoughRootOutputTool.h:113
FPGATrackSimHoughRootOutputTool::m_phiwidth
std::vector< unsigned int > m_phiwidth
Definition: FPGATrackSimHoughRootOutputTool.h:68
FPGATrackSimHoughRootOutputTool::m_truth_z0
std::vector< float > m_truth_z0
Definition: FPGATrackSimHoughRootOutputTool.h:96
FPGATrackSimHoughRootOutputTool::m_offline_d0
std::vector< float > m_offline_d0
Definition: FPGATrackSimHoughRootOutputTool.h:116
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimHoughRootOutputTool::m_offline_eta
std::vector< float > m_offline_eta
Definition: FPGATrackSimHoughRootOutputTool.h:119
AthAlgTool.h
FPGATrackSimHoughRootOutputTool::m_z
std::vector< float > m_z
Definition: FPGATrackSimHoughRootOutputTool.h:60
FPGATrackSimHoughRootOutputTool::m_offline_n_measurement
std::vector< int > m_offline_n_measurement
Definition: FPGATrackSimHoughRootOutputTool.h:108
FPGATrackSimHoughRootOutputTool::m_candidate_eventindex
float m_candidate_eventindex
Definition: FPGATrackSimHoughRootOutputTool.h:79
FPGATrackSimHoughRootOutputTool::m_candidate_barcodefrac
float m_candidate_barcodefrac
Definition: FPGATrackSimHoughRootOutputTool.h:77
FPGATrackSimHoughRootOutputTool::m_invpt
float m_invpt
Definition: FPGATrackSimHoughRootOutputTool.h:74
FPGATrackSimHoughRootOutputTool::m_truth_eventindex
std::vector< int > m_truth_eventindex
Definition: FPGATrackSimHoughRootOutputTool.h:103
FPGATrackSimHoughRootOutputTool::m_truthtree
TTree * m_truthtree
Definition: FPGATrackSimHoughRootOutputTool.h:93
FPGATrackSimHoughRootOutputTool::m_offline_q
std::vector< int > m_offline_q
Definition: FPGATrackSimHoughRootOutputTool.h:121
FPGATrackSimHoughRootOutputTool::ResetVectors
void ResetVectors()
Definition: FPGATrackSimHoughRootOutputTool.cxx:239
FPGATrackSimHoughRootOutputTool::m_truth_d0
std::vector< float > m_truth_d0
Definition: FPGATrackSimHoughRootOutputTool.h:95
FPGATrackSimHoughRootOutputTool
Definition: FPGATrackSimHoughRootOutputTool.h:35
FPGATrackSimHoughRootOutputTool::m_etamodule
std::vector< unsigned int > m_etamodule
Definition: FPGATrackSimHoughRootOutputTool.h:69
FPGATrackSimHoughRootOutputTool::m_truth_pdg
std::vector< float > m_truth_pdg
Definition: FPGATrackSimHoughRootOutputTool.h:100
FPGATrackSimHoughRootOutputTool::m_offline_n_perigee
std::vector< int > m_offline_n_perigee
Definition: FPGATrackSimHoughRootOutputTool.h:112
FPGATrackSimHoughRootOutputTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimHoughRootOutputTool.h:53
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
FPGATrackSimHoughRootOutputTool::m_truth_eta
std::vector< float > m_truth_eta
Definition: FPGATrackSimHoughRootOutputTool.h:98
FPGATrackSimHoughRootOutputTool::m_truth_q
std::vector< int > m_truth_q
Definition: FPGATrackSimHoughRootOutputTool.h:101
FPGATrackSimHoughRootOutputTool::m_offline_n_inertmaterial
std::vector< int > m_offline_n_inertmaterial
Definition: FPGATrackSimHoughRootOutputTool.h:109
FPGATrackSimHoughRootOutputTool::fillTree
StatusCode fillTree(std::vector< FPGATrackSimRoad * > &roads, const std::vector< FPGATrackSimTruthTrack > &truthTracks, const std::vector< FPGATrackSimOfflineTrack > &offlineTracks)
Definition: FPGATrackSimHoughRootOutputTool.cxx:96
FPGATrackSimHoughRootOutputTool::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimHoughRootOutputTool.h:54
FPGATrackSimHoughRootOutputTool::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition: FPGATrackSimHoughRootOutputTool.h:52
FPGATrackSimHoughRootOutputTool::m_roadnumber
int m_roadnumber
Definition: FPGATrackSimHoughRootOutputTool.h:90
FPGATrackSimHoughRootOutputTool::FPGATrackSimHoughRootOutputTool
FPGATrackSimHoughRootOutputTool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimHoughRootOutputTool.cxx:10
FPGATrackSimHoughRootOutputTool::m_offline_barcode
std::vector< int > m_offline_barcode
Definition: FPGATrackSimHoughRootOutputTool.h:122
FPGATrackSimHoughRootOutputTool::m_offline_n_scatterer
std::vector< int > m_offline_n_scatterer
Definition: FPGATrackSimHoughRootOutputTool.h:111
FPGATrackSimHoughRootOutputTool::m_eventindex
std::vector< int > m_eventindex
Definition: FPGATrackSimHoughRootOutputTool.h:63
FPGATrackSimHoughRootOutputTool::m_candidate_barcode
float m_candidate_barcode
Definition: FPGATrackSimHoughRootOutputTool.h:78
FPGATrackSimHoughRootOutputTool::m_offline_n_other
std::vector< int > m_offline_n_other
Definition: FPGATrackSimHoughRootOutputTool.h:114
FPGATrackSimHoughRootOutputTool::m_offline_n_holes
std::vector< int > m_offline_n_holes
Definition: FPGATrackSimHoughRootOutputTool.h:107
FPGATrackSimHoughRootOutputTool::m_offline_pt
std::vector< float > m_offline_pt
Definition: FPGATrackSimHoughRootOutputTool.h:118
FPGATrackSimHoughRootOutputTool::m_tracknumber
int m_tracknumber
Definition: FPGATrackSimHoughRootOutputTool.h:84
FPGATrackSimRoad.h
Defines a class for roads.
FPGATrackSimHoughRootOutputTool::m_offline_barcodefrac
std::vector< float > m_offline_barcodefrac
Definition: FPGATrackSimHoughRootOutputTool.h:123
FPGATrackSimHoughRootOutputTool::m_phimodule
std::vector< unsigned int > m_phimodule
Definition: FPGATrackSimHoughRootOutputTool.h:70
AthAlgTool
Definition: AthAlgTool.h:26
FPGATrackSimHoughRootOutputTool::m_ID
std::vector< unsigned int > m_ID
Definition: FPGATrackSimHoughRootOutputTool.h:71
FPGATrackSimHoughRootOutputTool::m_truth_barcode
std::vector< int > m_truth_barcode
Definition: FPGATrackSimHoughRootOutputTool.h:102
FPGATrackSimHoughRootOutputTool::m_y
std::vector< float > m_y
Definition: FPGATrackSimHoughRootOutputTool.h:59
FPGATrackSimHoughRootOutputTool::m_tree
TTree * m_tree
Definition: FPGATrackSimHoughRootOutputTool.h:57
FPGATrackSimHoughRootOutputTool::m_barcode
std::vector< int > m_barcode
Definition: FPGATrackSimHoughRootOutputTool.h:62
FPGATrackSimHoughRootOutputTool::m_truth_pt
std::vector< float > m_truth_pt
Definition: FPGATrackSimHoughRootOutputTool.h:97
FPGATrackSimTruthTrack.h
FPGATrackSimHoughRootOutputTool::bookTree
StatusCode bookTree()
Definition: FPGATrackSimHoughRootOutputTool.cxx:29
ServiceHandle< IFPGATrackSimEventSelectionSvc >