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 
23 
24 #include "GaudiKernel/ITHistSvc.h"
25 
29 
30 #include "lwtnn/LightweightGraph.hh"
31 #include "lwtnn/parse_json.hh"
32 
33 
35 
37 {
38  public:
39 
41  // AthAlgTool
42 
43  FPGATrackSimNNTrackTool(const std::string&, const std::string&, const IInterface*);
44 
45  virtual StatusCode initialize() override;
46  StatusCode getTracks(std::vector<FPGATrackSimRoad*> &roads, std::vector<FPGATrackSimTrack> &tracks,
47  const FPGATrackSimNNMap *nnMap);
48 
49  static float getXScale() { return 1015;};
50  static float getYScale() { return 1015;};
51  static float getZScale() { return 3000;};
52 
53  // Flags
54 
55  Gaudi::Property <double> m_NNCut { this, "NNCut", 0.0, " NN output value to cut on when selecting good tracks"};
56  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)"};
57 
58 
59  private:
60 
61  ServiceHandle<IFPGATrackSimMappingSvc> m_FPGATrackSimMapping{this, "FPGATrackSimMappingSvc","FPGATrackSimMappingSvc"};
62  ServiceHandle<ITHistSvc> m_tHistSvc{this, "THistSvc","THistSvc"};
63 
64  std::vector<float> m_x; // x position of hit in road
65  std::vector<float> m_y; // y pos
66  std::vector<float> m_z; // z pos
67  std::vector<float> m_barcodefrac; // truth barcode fraction for the hit
68  std::vector<int> m_barcode; // truth barcode for the hit
69  std::vector<int> m_eventindex; // event index for the hit
70  std::vector<unsigned int> m_isPixel; // is hit pixel? if 0 it is strip
71  std::vector<unsigned int> m_layer; // layer ID
72  std::vector<unsigned int> m_isBarrel; // is hit in barrel? if 0 it is endcap
73  std::vector<unsigned int> m_etawidth;
74  std::vector<unsigned int> m_phiwidth;
75  std::vector<unsigned int> m_etamodule;
76  std::vector<unsigned int> m_phimodule;
77  std::vector<unsigned int> m_ID; // ID hash for hit
78 
79  std::vector<float> m_truth_d0;
80  std::vector<float> m_truth_z0;
81  std::vector<float> m_truth_pt;
82  std::vector<float> m_truth_eta;
83  std::vector<float> m_truth_phi;
84  std::vector<float> m_truth_pdg;
85  std::vector<int> m_truth_q;
86  std::vector<int> m_truth_barcode;
87  std::vector<int> m_truth_eventindex;
88 
90  // NN stuff
91  std::vector<const char*> m_input_node_names;
92  std::vector<int64_t> m_input_node_dims;
93  std::vector<const char*> m_output_node_names;
94 
95  void compute_truth(FPGATrackSimTrack & newtrk) const;
96 
97 };
98 
99 
100 #endif // FPGATrackSimNNTRACKTOOL_H
FPGATrackSimNNTrackTool::getTracks
StatusCode getTracks(std::vector< FPGATrackSimRoad * > &roads, std::vector< FPGATrackSimTrack > &tracks, const FPGATrackSimNNMap *nnMap)
Definition: FPGATrackSimNNTrackTool.cxx:33
FPGATrackSimNNTrackTool::m_input_node_dims
std::vector< int64_t > m_input_node_dims
Definition: FPGATrackSimNNTrackTool.h:92
FPGATrackSimNNTrackTool::m_output_node_names
std::vector< const char * > m_output_node_names
Definition: FPGATrackSimNNTrackTool.h:93
FPGATrackSimNNTrackTool::m_truth_eta
std::vector< float > m_truth_eta
Definition: FPGATrackSimNNTrackTool.h:82
FPGATrackSimNNTrackTool::m_truth_z0
std::vector< float > m_truth_z0
Definition: FPGATrackSimNNTrackTool.h:80
FPGATrackSimTrack
Definition: FPGATrackSimTrack.h:16
FPGATrackSimPlaneMap.h
Maps physical layers to logical layers.
FPGATrackSimNNTrackTool::m_phiwidth
std::vector< unsigned int > m_phiwidth
Definition: FPGATrackSimNNTrackTool.h:74
IFPGATrackSimMappingSvc.h
FPGATrackSimNNTrackTool::m_phimodule
std::vector< unsigned int > m_phimodule
Definition: FPGATrackSimNNTrackTool.h:76
FPGATrackSimNNTrackTool::m_truth_eventindex
std::vector< int > m_truth_eventindex
Definition: FPGATrackSimNNTrackTool.h:87
FPGATrackSimNNTrackTool::m_y
std::vector< float > m_y
Definition: FPGATrackSimNNTrackTool.h:65
IFPGATrackSimMappingSvc
Definition: IFPGATrackSimMappingSvc.h:17
FPGATrackSimNNTrackTool::getXScale
static float getXScale()
Definition: FPGATrackSimNNTrackTool.h:49
FPGATrackSimMultiTruth.h
FPGATrackSimNNTrackTool::m_barcode
std::vector< int > m_barcode
Definition: FPGATrackSimNNTrackTool.h:68
FPGATrackSimNNTrackTool::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimNNTrackTool.h:62
FPGATrackSimNNTrackTool
Definition: FPGATrackSimNNTrackTool.h:37
FPGATrackSimNNTrackTool::m_etawidth
std::vector< unsigned int > m_etawidth
Definition: FPGATrackSimNNTrackTool.h:73
FPGATrackSimNNTrackTool::m_chi2_scalefactor
Gaudi::Property< double > m_chi2_scalefactor
Definition: FPGATrackSimNNTrackTool.h:56
FPGATrackSimNNTrackTool::m_input_node_names
std::vector< const char * > m_input_node_names
Definition: FPGATrackSimNNTrackTool.h:91
FPGATrackSimNNTrackTool::m_eventindex
std::vector< int > m_eventindex
Definition: FPGATrackSimNNTrackTool.h:69
FPGATrackSimNNTrackTool::m_barcodefrac
std::vector< float > m_barcodefrac
Definition: FPGATrackSimNNTrackTool.h:67
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:85
FPGATrackSimNNTrackTool::m_truth_d0
std::vector< float > m_truth_d0
Definition: FPGATrackSimNNTrackTool.h:79
FPGATrackSimNNTrackTool::m_etamodule
std::vector< unsigned int > m_etamodule
Definition: FPGATrackSimNNTrackTool.h:75
AthAlgTool.h
FPGATrackSimNNTrackTool::m_x
std::vector< float > m_x
Definition: FPGATrackSimNNTrackTool.h:64
FPGATrackSimNNTrackTool::m_z
std::vector< float > m_z
Definition: FPGATrackSimNNTrackTool.h:66
FPGATrackSimNNTrackTool::m_layer
std::vector< unsigned int > m_layer
Definition: FPGATrackSimNNTrackTool.h:71
FPGATrackSimNNMap
Definition: FPGATrackSimNNMap.h:27
FPGATrackSimNNTrackTool::m_NNCut
Gaudi::Property< double > m_NNCut
Definition: FPGATrackSimNNTrackTool.h:55
FPGATrackSimNNTrackTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimNNTrackTool.h:61
FPGATrackSimNNTrackTool::getZScale
static float getZScale()
Definition: FPGATrackSimNNTrackTool.h:51
FPGATrackSimNNTrackTool::getYScale
static float getYScale()
Definition: FPGATrackSimNNTrackTool.h:50
FPGATrackSimNNTrackTool::FPGATrackSimNNTrackTool
FPGATrackSimNNTrackTool(const std::string &, const std::string &, const IInterface *)
Definition: FPGATrackSimNNTrackTool.cxx:21
FPGATrackSimNNTrackTool::m_truth_phi
std::vector< float > m_truth_phi
Definition: FPGATrackSimNNTrackTool.h:83
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:84
FPGATrackSimNNTrackTool::compute_truth
void compute_truth(FPGATrackSimTrack &newtrk) const
Definition: FPGATrackSimNNTrackTool.cxx:189
FPGATrackSimNNTrackTool::initialize
virtual StatusCode initialize() override
Definition: FPGATrackSimNNTrackTool.cxx:26
FPGATrackSimNNTrackTool::m_isPixel
std::vector< unsigned int > m_isPixel
Definition: FPGATrackSimNNTrackTool.h:70
FPGATrackSimNNTrackTool::m_isBarrel
std::vector< unsigned int > m_isBarrel
Definition: FPGATrackSimNNTrackTool.h:72
IFPGATrackSimBankSvc.h
FPGATrackSimNNTrackTool::m_truth_pt
std::vector< float > m_truth_pt
Definition: FPGATrackSimNNTrackTool.h:81
FPGATrackSimRoad.h
Defines a class for roads.
AthAlgTool
Definition: AthAlgTool.h:26
FPGATrackSimNNTrackTool::m_truth_barcode
std::vector< int > m_truth_barcode
Definition: FPGATrackSimNNTrackTool.h:86
FPGATrackSimTruthTrack.h
FPGATrackSimNNTrackTool::m_ID
std::vector< unsigned int > m_ID
Definition: FPGATrackSimNNTrackTool.h:77
FPGATrackSimSectorBank.h
This file declares a class that stores the module IDs of the sectors.
FPGATrackSimTrack.h
ServiceHandle< IFPGATrackSimMappingSvc >