ATLAS Offline Software
TrigInDetRoadPredictorTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGINDETTRACKFITTER_TRIGINDETROADPREDICTORTOOL_H
6 #define TRIGINDETTRACKFITTER_TRIGINDETROADPREDICTORTOOL_H
7 
9 #include "GaudiKernel/ToolHandle.h"
10 #include "GaudiKernel/ServiceHandle.h"
11 
14 
15 // MagField cache
17 
18 
19 #include <vector>
20 #include <map>
21 #include <algorithm> //std::accumulate etc
22 
23 namespace InDetDD {
24  class PixelDetectorManager;
25  class SCT_DetectorManager;
26 }
27 
28 namespace Trk {
29  class SpacePoint;
30 }
31 
32 class PixelID;
33 class SCT_ID;
34 
36 {
37  public:
38  TrigInDetRoadPredictorTool( const std::string&, const std::string&, const IInterface* );
39 
40  virtual StatusCode initialize() override;
41 
42  virtual int getRoad(const std::vector<const Trk::SpacePoint*>&, std::vector<const InDetDD::SiDetectorElement*>&,
43  const EventContext&) const override;
44 
45 private:
46 
48  DetectorElementDescription(unsigned int h) : m_hash(h) {};
49  unsigned int m_hash{};
50  short m_index{};
51  float m_ref{};//z or Phi
52  float m_c[4][3]={};
53  float m_minBound{}, m_maxBound{};
54  };
55 
58  short m_index{};
59  float m_minCoord{}, m_maxCoord{}; //phi or R
60  std::vector<DetectorElementDescription> m_vDE;
61  };
62 
64  LayerDescription(unsigned int id, int nSL, unsigned int mType) : m_id(id), m_nSubLayers(nSL), m_mappingType(mType) {};
65  unsigned int m_id{};
66  int m_nSubLayers{};
67  unsigned int m_mappingType{};
68  std::map<short, DetectorElementsCollection> m_colls[2];
69  };
70 
71 
72  struct SearchInterval {
73  SearchInterval(float z, float r) : m_r(0.0), m_z(0.0), m_phi(0.0) {
74  m_vZx.push_back(z);
75  m_vRx.push_back(r);
76  }
77 
78  void addPoint(float z, float r) {
79  m_vZx.push_back(z);
80  m_vRx.push_back(r);
81  }
82 
83  float getAverageRadius() {
84  return std::accumulate(m_vRx.begin(), m_vRx.end(), 0)/m_vRx.size();
85  }
86 
87  float getAverageZ() {
88  return std::accumulate(m_vZx.begin(), m_vZx.end(), 0)/m_vZx.size();
89  }
90 
91  float getMinZ() const {
92  return *std::min_element( m_vZx.begin(), m_vZx.end());
93  }
94 
95  float getMaxZ() const {
96  return *std::max_element( m_vZx.begin(), m_vZx.end());
97  }
98 
99  float getMinR() const {
100  return *std::min_element( m_vRx.begin(), m_vRx.end());
101  }
102 
103  float getMaxR() const {
104  return *std::max_element( m_vRx.begin(), m_vRx.end());
105  }
106 
107  std::vector<float> m_vZx;
108  std::vector<float> m_vRx;
109  float m_r{};
110  float m_z{};
111  float m_phi{};
112  };
113 
114  struct VolumeBoundary {
115  int m_index{};
116  float m_zr[4]={};
117  int m_vol_id{};
118  std::vector<int> m_layers;
119  };
120 
121  struct LayerBoundary {
123  std::vector<float> m_z;
124  std::vector<float> m_r;
125  };
126 
128  void createHitBoxes();
129 
130  void addNewElement(unsigned int, short, short, const InDetDD::SiDetectorElement*);
131  void findDetectorElements(unsigned int, const SearchInterval&, std::vector<unsigned int>&, bool) const;
132 
133  ToolHandle<ITrigL2LayerNumberTool> m_layerNumberTool {this, "LayerNumberTool", "TrigL2LayerNumberToolITk"};
134 
135  Gaudi::Property<float> m_min_rz_rw {this, "MinRzRoadWidth", 3.0, "Minimum rz road width"};
136  Gaudi::Property<float> m_max_rz_rw {this, "MaxRzRoadWidth", 15.0, "Maximum rz road width"};
137  Gaudi::Property<float> m_min_rphi_rw {this, "MinRPhiRoadWidth", 3.0, "Minimum rphi road width"};
138  Gaudi::Property<float> m_max_rphi_rw {this, "MaxRPhiRoadWidth", 15.0, "Maximum rphi road width"};
139  Gaudi::Property<float> m_min_phi_rw {this, "MinPhiRoadWidth", 0.05, "Minimum phi road width"};
140  Gaudi::Property<float> m_max_phi_rw {this, "MaxPhiRoadWidth", 0.1, "Maximum phi road width"};
141 
143  this, "AtlasFieldCacheCondObj", "fieldCondObj",
144  "Name of the Magnetic Field conditions object key"};
145 
146  std::vector<VolumeBoundary> m_vBoundaries;
147  std::vector<LayerBoundary> m_lBoundaries;
148  std::map<unsigned int, LayerDescription> m_layerMap;
149 
152  const PixelID* m_pixelId{nullptr};
153  const SCT_ID* m_stripId{nullptr};
154 };
155 
156 #endif
TrigInDetRoadPredictorTool::DetectorElementsCollection::m_index
short m_index
Definition: TrigInDetRoadPredictorTool.h:58
TrigInDetRoadPredictorTool
Definition: TrigInDetRoadPredictorTool.h:36
beamspotman.r
def r
Definition: beamspotman.py:676
TrigInDetRoadPredictorTool::LayerDescription::m_mappingType
unsigned int m_mappingType
Definition: TrigInDetRoadPredictorTool.h:67
TrigInDetRoadPredictorTool::SearchInterval::getMaxR
float getMaxR() const
Definition: TrigInDetRoadPredictorTool.h:103
TrigInDetRoadPredictorTool::DetectorElementDescription::m_index
short m_index
Definition: TrigInDetRoadPredictorTool.h:50
TrigInDetRoadPredictorTool::SearchInterval
Definition: TrigInDetRoadPredictorTool.h:72
TrigInDetRoadPredictorTool::LayerDescription::m_nSubLayers
int m_nSubLayers
Definition: TrigInDetRoadPredictorTool.h:66
TrigInDetRoadPredictorTool::LayerBoundary::m_z
std::vector< float > m_z
Definition: TrigInDetRoadPredictorTool.h:123
InDetDD::SCT_DetectorManager
Definition: SCT_DetectorManager.h:49
max
#define max(a, b)
Definition: cfImp.cxx:41
TrigInDetRoadPredictorTool::VolumeBoundary::m_index
int m_index
Definition: TrigInDetRoadPredictorTool.h:115
TrigInDetRoadPredictorTool::m_stripManager
const InDetDD::SCT_DetectorManager * m_stripManager
Definition: TrigInDetRoadPredictorTool.h:151
TrigInDetRoadPredictorTool::DetectorElementDescription::m_ref
float m_ref
Definition: TrigInDetRoadPredictorTool.h:51
TrigInDetRoadPredictorTool::SearchInterval::m_vZx
std::vector< float > m_vZx
Definition: TrigInDetRoadPredictorTool.h:107
TrigInDetRoadPredictorTool::m_min_rz_rw
Gaudi::Property< float > m_min_rz_rw
Definition: TrigInDetRoadPredictorTool.h:135
ITrigInDetRoadPredictorTool
Definition: ITrigInDetRoadPredictorTool.h:22
AtlasFieldCacheCondObj.h
TrigInDetRoadPredictorTool::DetectorElementsCollection::m_vDE
std::vector< DetectorElementDescription > m_vDE
Definition: TrigInDetRoadPredictorTool.h:60
TrigInDetRoadPredictorTool::LayerBoundary::m_r
std::vector< float > m_r
Definition: TrigInDetRoadPredictorTool.h:124
TrigInDetRoadPredictorTool::SearchInterval::getAverageRadius
float getAverageRadius()
Definition: TrigInDetRoadPredictorTool.h:83
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
TrigInDetRoadPredictorTool::createHitBoxes
void createHitBoxes()
Definition: TrigInDetRoadPredictorTool.cxx:220
TrigInDetRoadPredictorTool::SearchInterval::getMinR
float getMinR() const
Definition: TrigInDetRoadPredictorTool.h:99
TrigInDetRoadPredictorTool::SearchInterval::getMinZ
float getMinZ() const
Definition: TrigInDetRoadPredictorTool.h:91
TrigInDetRoadPredictorTool::m_layerNumberTool
ToolHandle< ITrigL2LayerNumberTool > m_layerNumberTool
Definition: TrigInDetRoadPredictorTool.h:133
TrigInDetRoadPredictorTool::VolumeBoundary::m_layers
std::vector< int > m_layers
Definition: TrigInDetRoadPredictorTool.h:118
TrigInDetRoadPredictorTool::SearchInterval::getAverageZ
float getAverageZ()
Definition: TrigInDetRoadPredictorTool.h:87
TrigInDetRoadPredictorTool::DetectorElementDescription::m_maxBound
float m_maxBound
Definition: TrigInDetRoadPredictorTool.h:53
ITrigL2LayerNumberTool.h
TrigInDetRoadPredictorTool::DetectorElementDescription::DetectorElementDescription
DetectorElementDescription(unsigned int h)
Definition: TrigInDetRoadPredictorTool.h:48
TrigInDetRoadPredictorTool::m_min_phi_rw
Gaudi::Property< float > m_min_phi_rw
Definition: TrigInDetRoadPredictorTool.h:139
TrigInDetRoadPredictorTool::m_pixelManager
const InDetDD::PixelDetectorManager * m_pixelManager
Definition: TrigInDetRoadPredictorTool.h:150
TrigInDetRoadPredictorTool::m_min_rphi_rw
Gaudi::Property< float > m_min_rphi_rw
Definition: TrigInDetRoadPredictorTool.h:137
TrigInDetRoadPredictorTool::DetectorElementsCollection::DetectorElementsCollection
DetectorElementsCollection(short idx, float min, float max)
Definition: TrigInDetRoadPredictorTool.h:57
SpacePoint
Definition: Trigger/TrigAccel/TrigCudaFitter/src/SpacePoint.h:6
TrigInDetRoadPredictorTool::LayerBoundary
Definition: TrigInDetRoadPredictorTool.h:121
TrigInDetRoadPredictorTool::m_vBoundaries
std::vector< VolumeBoundary > m_vBoundaries
Definition: TrigInDetRoadPredictorTool.h:146
TrigInDetRoadPredictorTool::m_max_rphi_rw
Gaudi::Property< float > m_max_rphi_rw
Definition: TrigInDetRoadPredictorTool.h:138
TrigInDetRoadPredictorTool::VolumeBoundary::m_vol_id
int m_vol_id
Definition: TrigInDetRoadPredictorTool.h:117
TrigInDetRoadPredictorTool::VolumeBoundary::m_zr
float m_zr[4]
Definition: TrigInDetRoadPredictorTool.h:116
TrigInDetRoadPredictorTool::DetectorElementsCollection::m_maxCoord
float m_maxCoord
Definition: TrigInDetRoadPredictorTool.h:59
ITrigInDetRoadPredictorTool.h
TrigInDetRoadPredictorTool::m_pixelId
const PixelID * m_pixelId
Definition: TrigInDetRoadPredictorTool.h:152
z
#define z
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigInDetRoadPredictorTool::SearchInterval::m_z
float m_z
Definition: TrigInDetRoadPredictorTool.h:110
TrigInDetRoadPredictorTool::SearchInterval::addPoint
void addPoint(float z, float r)
Definition: TrigInDetRoadPredictorTool.h:78
AthAlgTool.h
TrigInDetRoadPredictorTool::TrigInDetRoadPredictorTool
TrigInDetRoadPredictorTool(const std::string &, const std::string &, const IInterface *)
Definition: TrigInDetRoadPredictorTool.cxx:29
TrigInDetRoadPredictorTool::LayerDescription::m_id
unsigned int m_id
Definition: TrigInDetRoadPredictorTool.h:65
TrigInDetRoadPredictorTool::LayerDescription::m_colls
std::map< short, DetectorElementsCollection > m_colls[2]
Definition: TrigInDetRoadPredictorTool.h:68
TrigInDetRoadPredictorTool::VolumeBoundary
Definition: TrigInDetRoadPredictorTool.h:114
TrigInDetRoadPredictorTool::addNewElement
void addNewElement(unsigned int, short, short, const InDetDD::SiDetectorElement *)
Definition: TrigInDetRoadPredictorTool.cxx:59
TrigInDetRoadPredictorTool::SearchInterval::SearchInterval
SearchInterval(float z, float r)
Definition: TrigInDetRoadPredictorTool.h:73
min
#define min(a, b)
Definition: cfImp.cxx:40
TrigInDetRoadPredictorTool::DetectorElementsCollection::m_minCoord
float m_minCoord
Definition: TrigInDetRoadPredictorTool.h:59
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:191
TrigInDetRoadPredictorTool::LayerBoundary::m_lay_id
int m_lay_id
Definition: TrigInDetRoadPredictorTool.h:122
TrigInDetRoadPredictorTool::m_layerMap
std::map< unsigned int, LayerDescription > m_layerMap
Definition: TrigInDetRoadPredictorTool.h:148
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
TrigInDetRoadPredictorTool::SearchInterval::m_phi
float m_phi
Definition: TrigInDetRoadPredictorTool.h:111
TrigInDetRoadPredictorTool::LayerBoundary::m_index
int m_index
Definition: TrigInDetRoadPredictorTool.h:122
TrigInDetRoadPredictorTool::SearchInterval::m_r
float m_r
Definition: TrigInDetRoadPredictorTool.h:109
SG::ReadCondHandleKey< AtlasFieldCacheCondObj >
TrigInDetRoadPredictorTool::DetectorElementDescription::m_hash
unsigned int m_hash
Definition: TrigInDetRoadPredictorTool.h:49
TrigInDetRoadPredictorTool::LayerBoundary::m_nVertices
int m_nVertices
Definition: TrigInDetRoadPredictorTool.h:122
TrigInDetRoadPredictorTool::m_lBoundaries
std::vector< LayerBoundary > m_lBoundaries
Definition: TrigInDetRoadPredictorTool.h:147
TrigInDetRoadPredictorTool::initialize
virtual StatusCode initialize() override
Definition: TrigInDetRoadPredictorTool.cxx:36
h
SCT_ID
Definition: SCT_ID.h:68
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
TrigInDetRoadPredictorTool::DetectorElementDescription::m_minBound
float m_minBound
Definition: TrigInDetRoadPredictorTool.h:53
TrigInDetRoadPredictorTool::SearchInterval::getMaxZ
float getMaxZ() const
Definition: TrigInDetRoadPredictorTool.h:95
TrigInDetRoadPredictorTool::m_fieldCondObjInputKey
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCondObjInputKey
Definition: TrigInDetRoadPredictorTool.h:142
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TrigInDetRoadPredictorTool::m_stripId
const SCT_ID * m_stripId
Definition: TrigInDetRoadPredictorTool.h:153
TrigInDetRoadPredictorTool::m_max_rz_rw
Gaudi::Property< float > m_max_rz_rw
Definition: TrigInDetRoadPredictorTool.h:136
TrigInDetRoadPredictorTool::m_max_phi_rw
Gaudi::Property< float > m_max_phi_rw
Definition: TrigInDetRoadPredictorTool.h:140
TrigInDetRoadPredictorTool::findDetectorElements
void findDetectorElements(unsigned int, const SearchInterval &, std::vector< unsigned int > &, bool) const
Definition: TrigInDetRoadPredictorTool.cxx:329
TrigInDetRoadPredictorTool::SearchInterval::m_vRx
std::vector< float > m_vRx
Definition: TrigInDetRoadPredictorTool.h:108
TrigInDetRoadPredictorTool::DetectorElementsCollection
Definition: TrigInDetRoadPredictorTool.h:56
TrigInDetRoadPredictorTool::DetectorElementDescription::m_c
float m_c[4][3]
Definition: TrigInDetRoadPredictorTool.h:52
AthAlgTool
Definition: AthAlgTool.h:26
PixelID
Definition: PixelID.h:67
TrigInDetRoadPredictorTool::LayerDescription
Definition: TrigInDetRoadPredictorTool.h:63
TrigInDetRoadPredictorTool::buildDetectorDescription
void buildDetectorDescription()
Definition: TrigInDetRoadPredictorTool.cxx:154
TrigInDetRoadPredictorTool::LayerDescription::LayerDescription
LayerDescription(unsigned int id, int nSL, unsigned int mType)
Definition: TrigInDetRoadPredictorTool.h:64
TrigInDetRoadPredictorTool::getRoad
virtual int getRoad(const std::vector< const Trk::SpacePoint * > &, std::vector< const InDetDD::SiDetectorElement * > &, const EventContext &) const override
Definition: TrigInDetRoadPredictorTool.cxx:435
TrigInDetRoadPredictorTool::DetectorElementDescription
Definition: TrigInDetRoadPredictorTool.h:47