ATLAS Offline Software
FPGATrackSimNNTrackTool.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef FPGATrackSimNNTRACKTOOL_H
4 #define FPGATrackSimNNTRACKTOOL_H
5 
14 #include "GaudiKernel/ServiceHandle.h"
16 
17 #include "OnnxRuntimeBase.h"
18 
25 
26 #include "GaudiKernel/ITHistSvc.h"
27 
29 
33 
34 
36 
38 {
40 
41  public:
42 
44  // AthAlgTool
45 
46  FPGATrackSimNNTrackTool(const std::string&, const std::string&, const IInterface*);
47 
48  virtual StatusCode initialize() override;
49  StatusCode getTracks(std::vector<std::shared_ptr<const FPGATrackSimRoad>> &roads, std::vector<FPGATrackSimTrack> &tracks);
50 
51  static float getXScale() { return 1015.;};
52  static float getYScale() { return 1015.;};
53  static float getZScale() { return 3000.;};
54 
55  // Flags
56 
57  Gaudi::Property <double> m_NNCut{ this, "NNCut", 0.2, " NN output value to cut on when selecting good tracks" };
58  Gaudi::Property <double> m_chi2_scalefactor{ this, "Chi2ScaleFactor", 40 / (1 - 0.1), "Scale factor to use in converting to a chi2, Nominal chi2ndof cut is 40 and we want to use NN>0.0075 (or NN<(1-0.0075)" };
59 
60 
61  private:
62 
63  ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this, "FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"};
64  ServiceHandle<ITHistSvc> m_tHistSvc{this, "THistSvc","THistSvc"};
65 
68 
69  bool m_useParamNN = true;
70 
71  void setTrackParameters(FPGATrackSimTrack& track, std::vector<float> inputTensorValues);
72 
73  std::vector<float> m_x; // x position of hit in road
74  std::vector<float> m_y; // y pos
75  std::vector<float> m_z; // z pos
76  std::vector<float> m_barcodefrac; // truth barcode fraction for the hit
77  std::vector<int> m_barcode; // truth barcode for the hit
78  std::vector<int> m_eventindex; // event index for the hit
79  std::vector<unsigned int> m_isPixel; // is hit pixel? if 0 it is strip
80  std::vector<unsigned int> m_layer; // layer ID
81  std::vector<unsigned int> m_isBarrel; // is hit in barrel? if 0 it is endcap
82  std::vector<unsigned int> m_etawidth;
83  std::vector<unsigned int> m_phiwidth;
84  std::vector<unsigned int> m_etamodule;
85  std::vector<unsigned int> m_phimodule;
86  std::vector<unsigned int> m_ID; // ID hash for hit
87 
88  std::vector<float> m_truth_d0;
89  std::vector<float> m_truth_z0;
90  std::vector<float> m_truth_pt;
91  std::vector<float> m_truth_eta;
92  std::vector<float> m_truth_phi;
93  std::vector<float> m_truth_pdg;
94  std::vector<int> m_truth_q;
95  std::vector<int> m_truth_barcode;
96  std::vector<int> m_truth_eventindex;
97 
99  // NN stuff
100  std::vector<const char*> m_input_node_names;
101  std::vector<int64_t> m_input_node_dims;
102  std::vector<const char*> m_output_node_names;
103 
104  void compute_truth(FPGATrackSimTrack & newtrk) const;
105 
106 };
107 
108 
109 #endif // FPGATrackSimNNTRACKTOOL_H
FPGATrackSimTrackingToolBase.h
FPGATrackSimNNTrackTool::m_input_node_dims
std::vector< int64_t > m_input_node_dims
Definition: FPGATrackSimNNTrackTool.h:101
FPGATrackSimNNTrackTool::m_output_node_names
std::vector< const char * > m_output_node_names
Definition: FPGATrackSimNNTrackTool.h:102
FPGATrackSimNNTrackTool::getTracks
StatusCode getTracks(std::vector< std::shared_ptr< const FPGATrackSimRoad >> &roads, std::vector< FPGATrackSimTrack > &tracks)
Definition: FPGATrackSimNNTrackTool.cxx:66
FPGATrackSimNNTrackTool::m_truth_eta
std::vector< float > m_truth_eta
Definition: FPGATrackSimNNTrackTool.h:91
FPGATrackSimNNTrackTool::m_truth_z0
std::vector< float > m_truth_z0
Definition: FPGATrackSimNNTrackTool.h:89
FPGATrackSimTrack
Definition: FPGATrackSimTrack.h:18
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimNNTrackTool::m_phiwidth
std::vector< unsigned int > m_phiwidth
Definition: FPGATrackSimNNTrackTool.h:83
IFPGATrackSimMappingSvc.h
FPGATrackSimNNTrackTool::m_fakeNN
OnnxRuntimeBase m_fakeNN
Definition: FPGATrackSimNNTrackTool.h:67
FPGATrackSimNNTrackTool::m_useParamNN
bool m_useParamNN
Definition: FPGATrackSimNNTrackTool.h:69
FPGATrackSimNNTrackTool::m_phimodule
std::vector< unsigned int > m_phimodule
Definition: FPGATrackSimNNTrackTool.h:85
FPGATrackSimNNTrackTool::m_truth_eventindex
std::vector< int > m_truth_eventindex
Definition: FPGATrackSimNNTrackTool.h:96
FPGATrackSimNNTrackTool::m_y
std::vector< float > m_y
Definition: FPGATrackSimNNTrackTool.h:74
IFPGATrackSimMappingSvc
Definition: IFPGATrackSimMappingSvc.h:17
FPGATrackSimNNTrackTool::getXScale
static float getXScale()
Definition: FPGATrackSimNNTrackTool.h:51
FPGATrackSimMultiTruth.h
FPGATrackSimNNTrackTool::m_barcode
std::vector< int > m_barcode
Definition: FPGATrackSimNNTrackTool.h:77
FPGATrackSimNNTrackTool::setTrackParameters
void setTrackParameters(FPGATrackSimTrack &track, std::vector< float > inputTensorValues)
Definition: FPGATrackSimNNTrackTool.cxx:49
FPGATrackSimNNTrackTool::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimNNTrackTool.h:64
FPGATrackSimNNTrackTool
Definition: FPGATrackSimNNTrackTool.h:38
FPGATrackSimTrackingToolBase
Definition: FPGATrackSimTrackingToolBase.h:21
FPGATrackSimNNTrackTool::m_etawidth
std::vector< unsigned int > m_etawidth
Definition: FPGATrackSimNNTrackTool.h:82
FPGATrackSimNNTrackTool::m_chi2_scalefactor
Gaudi::Property< double > m_chi2_scalefactor
Definition: FPGATrackSimNNTrackTool.h:58
OnnxRuntimeBase.h
FPGATrackSimNNTrackTool::m_input_node_names
std::vector< const char * > m_input_node_names
Definition: FPGATrackSimNNTrackTool.h:100
FPGATrackSimNNTrackTool::m_eventindex
std::vector< int > m_eventindex
Definition: FPGATrackSimNNTrackTool.h:78
FPGATrackSimNNTrackTool::m_barcodefrac
std::vector< float > m_barcodefrac
Definition: FPGATrackSimNNTrackTool.h:76
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FPGATrackSimNNTrackTool::m_truth_q
std::vector< int > m_truth_q
Definition: FPGATrackSimNNTrackTool.h:94
FPGATrackSimNNTrackTool::m_truth_d0
std::vector< float > m_truth_d0
Definition: FPGATrackSimNNTrackTool.h:88
FPGATrackSimNNTrackTool::m_etamodule
std::vector< unsigned int > m_etamodule
Definition: FPGATrackSimNNTrackTool.h:84
AthAlgTool.h
FPGATrackSimNNTrackTool::m_x
std::vector< float > m_x
Definition: FPGATrackSimNNTrackTool.h:73
FPGATrackSimNNTrackTool::m_z
std::vector< float > m_z
Definition: FPGATrackSimNNTrackTool.h:75
FPGATrackSimNNTrackTool::m_layer
std::vector< unsigned int > m_layer
Definition: FPGATrackSimNNTrackTool.h:80
FPGATrackSimNNTrackTool::m_NNCut
Gaudi::Property< double > m_NNCut
Definition: FPGATrackSimNNTrackTool.h:57
FPGATrackSimNNTrackTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimNNTrackTool.h:63
FPGATrackSimNNTrackTool::getZScale
static float getZScale()
Definition: FPGATrackSimNNTrackTool.h:53
FPGATrackSimNNTrackTool::getYScale
static float getYScale()
Definition: FPGATrackSimNNTrackTool.h:52
FPGATrackSimNNTrackTool::FPGATrackSimNNTrackTool
FPGATrackSimNNTrackTool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimNNTrackTool.cxx:21
OnnxRuntimeBase
Definition: OnnxRuntimeBase.h:13
FPGATrackSimNNTrackTool::m_truth_phi
std::vector< float > m_truth_phi
Definition: FPGATrackSimNNTrackTool.h:92
FPGATrackSimHit.h
: FPGATrackSim-specific class to represent an hit in the detector.
FPGATrackSimNNTrackTool::m_truth_pdg
std::vector< float > m_truth_pdg
Definition: FPGATrackSimNNTrackTool.h:93
FPGATrackSimNNTrackTool::compute_truth
void compute_truth(FPGATrackSimTrack &newtrk) const
Definition: FPGATrackSimNNTrackTool.cxx:266
FPGATrackSimNNTrackTool::m_paramNN
OnnxRuntimeBase m_paramNN
Definition: FPGATrackSimNNTrackTool.h:66
FPGATrackSimNNTrackTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimNNTrackTool.cxx:25
FPGATrackSimNNTrackTool::m_isPixel
std::vector< unsigned int > m_isPixel
Definition: FPGATrackSimNNTrackTool.h:79
FPGATrackSimNNTrackTool::m_isBarrel
std::vector< unsigned int > m_isBarrel
Definition: FPGATrackSimNNTrackTool.h:81
IFPGATrackSimBankSvc.h
FPGATrackSimNNTrackTool::m_truth_pt
std::vector< float > m_truth_pt
Definition: FPGATrackSimNNTrackTool.h:90
OnnxRuntimeBase::OnnxRuntimeBase
OnnxRuntimeBase()
Definition: OnnxRuntimeBase.cxx:14
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
FPGATrackSimRoad.h
Defines a class for roads.
FPGATrackSimNNTrackTool::m_truth_barcode
std::vector< int > m_truth_barcode
Definition: FPGATrackSimNNTrackTool.h:95
FPGATrackSimTruthTrack.h
FPGATrackSimNNTrackTool::m_ID
std::vector< unsigned int > m_ID
Definition: FPGATrackSimNNTrackTool.h:86
FPGATrackSimSectorBank.h
This file declares a class that stores the module IDs of the sectors.
FPGATrackSimTrack.h
ServiceHandle< IFPGATrackSimMappingSvc >