CMS 3D CMS Logo

TrackerModule.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTMTT_TrackerModule_h
2 #define L1Trigger_TrackFindingTMTT_TrackerModule_h
3 
8 
9 #include <vector>
10 #include <set>
11 #include <array>
12 #include <map>
13 #include <cmath>
14 
15 class TrackerGeometry;
16 class TrackerTopology;
17 class PixelGeomDetUnit;
18 class PixelTopology;
19 
20 namespace tmtt {
21 
22  //=== Get info about tracker module
23 
24  class TrackerModule {
25  public:
27 
28  // Info used to define firmware module type.
29  struct ModuleTypeCfg {
30  std::vector<double> pitchVsType;
31  std::vector<double> spaceVsType;
32  std::vector<bool> barrelVsType;
33  std::vector<bool> psVsType;
34  std::vector<bool> tiltedVsType;
35  };
36 
37  // Here detId is ID of lower sensor in stacked module.
38  TrackerModule(const TrackerGeometry* trackerGeometry,
39  const TrackerTopology* trackerTopology,
40  const ModuleTypeCfg& moduleTypeCfg,
41  const DetId& detId);
42 
43  // Det ID of lower sensor in stacked module.
44  const DetId& detId() const { return detId_; }
45  unsigned int rawDetId() const { return detId_.rawId(); }
46  // Det ID of stacked module.
47  const DetId& stackedDetId() const { return stackedDetId_; }
48  unsigned int rawStackedDetId() const { return stackedDetId_.rawId(); }
49  // Tracker specific DetUnit & topology.
50  const PixelGeomDetUnit* specDet() const { return specDet_; }
51  const PixelTopology* specTopol() const { return specTopol_; }
52  // Coordinates of centre of two sensors in (r,phi,z)
53  float minR() const { return moduleMinR_; }
54  float maxR() const { return moduleMaxR_; }
55  float minPhi() const { return moduleMinPhi_; }
56  float maxPhi() const { return moduleMaxPhi_; }
57  float minZ() const { return moduleMinZ_; }
58  float maxZ() const { return moduleMaxZ_; }
59  // Polar angle of module.
60  float theta() const { return atan2(moduleMinR_, moduleMinZ_); }
61  // Which of two sensors in module is furthest from beam-line?
63  // Module type: PS or 2S?
64  bool psModule() const { return psModule_; }
65  bool barrel() const { return barrel_; }
66  // Tracker layer ID number (1-6 = barrel layer; 11-15 = endcap A disk; 21-25 = endcap B disk)
67  unsigned int layerId() const { return layerId_; }
68  // Reduced layer ID (in range 1-7), for packing into 3 bits to simplify the firmware.
69  unsigned int layerIdReduced() const { return layerIdReduced_; }
70  // Endcap ring of module (returns zero in case of barrel)
71  unsigned int endcapRing() const { return endcapRing_; }
72  // True if stub is in tilted barrel module.
73  bool tiltedBarrel() const { return tiltedBarrel_; }
74  // Angle between normal to module and beam-line along +ve z axis. (In range -PI/2 to +PI/2).
75  float tiltAngle() const { return tiltAngle_; }
76  // Width of sensitive region of sensor.
77  float sensorWidth() const { return sensorWidth_; }
78  // Sensor spacing in module
79  float sensorSpacing() const { return sensorSpacing_; }
80  // No. of strips in sensor.
81  unsigned int nStrips() const { return nStrips_; }
82  // Strip pitch (or pixel pitch along shortest axis).
83  float stripPitch() const { return stripPitch_; }
84  // Strip length (or pixel pitch along longest axis).
85  float stripLength() const { return stripLength_; }
86  // Hit resolution perpendicular to strip (or to longest pixel axis). Measures phi.
87  float sigmaPerp() const { return invRoot12 * stripPitch_; }
88  // Hit resolution parallel to strip (or to longest pixel axis). Measures r or z.
89  float sigmaPar() const { return invRoot12 * stripLength_; }
90  // Sensor pitch over separation.
91  float pitchOverSep() const { return stripPitch_ / sensorSpacing_; }
92  // "B" parameter correction for module tilt.
93  float paramB() const { return std::abs(cos(theta() - tiltAngle()) / sin(theta())); }
94  // Module type ID defined by firmware.
95  unsigned int moduleTypeID() const { return moduleTypeID_; }
96 
97  //--- Utilties
98 
99  // Calculate reduced layer ID (in range 1-7), for packing into 3 bits to simplify the firmware.
100  static unsigned int calcLayerIdReduced(unsigned int layerId) {
101  // Don't bother distinguishing two endcaps, as no track can have stubs in both.
102  unsigned int lay = (layerId < 20) ? layerId : layerId - 10;
103 
104  // No genuine track can have stubs in both barrel layer 6 and endcap disk 11 etc., so merge their layer IDs.
105  if (lay == 6)
106  lay = 11;
107  else if (lay == 5)
108  lay = 12;
109  else if (lay == 4)
110  lay = 13;
111  else if (lay == 3)
112  lay = 15;
113  // At this point, the reduced layer ID can have values of 1, 2, 11, 12, 13, 14, 15. So correct to put in range 1-7.
114  if (lay > 10)
115  lay -= 8;
116 
117  if (lay < 1 || lay > 7)
118  throw cms::Exception("LogicError") << "TrackerModule: Reduced layer ID out of expected range";
119 
120  return lay;
121  }
122 
123  // Get module type ID defined by firmware.
124  unsigned int calcModuleType(float pitch, float space, bool barrel, bool tiltedBarrel, bool psModule) const;
125 
126  private:
131  float moduleMinR_;
132  float moduleMaxR_;
135  float moduleMinZ_;
136  float moduleMaxZ_;
138  bool psModule_;
139  bool barrel_;
140  unsigned int layerId_;
141  unsigned int layerIdReduced_;
142  unsigned int endcapRing_;
144  float tiltAngle_;
147  unsigned int nStrips_;
148  float stripPitch_;
150  unsigned int moduleTypeID_;
151 
153 
154  static const float invRoot12;
155  };
156 
157 } // namespace tmtt
158 #endif
float stripLength() const
Definition: TrackerModule.h:85
float maxPhi() const
Definition: TrackerModule.h:56
float sigmaPerp() const
Definition: TrackerModule.h:87
unsigned int rawDetId() const
Definition: TrackerModule.h:45
bool outerModuleAtSmallerR() const
Definition: TrackerModule.h:62
const DetId & detId() const
Definition: TrackerModule.h:44
unsigned int nStrips_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
unsigned int moduleTypeID_
unsigned int calcModuleType(float pitch, float space, bool barrel, bool tiltedBarrel, bool psModule) const
float sensorSpacing() const
Definition: TrackerModule.h:79
const PixelGeomDetUnit * specDet_
unsigned int layerId() const
Definition: TrackerModule.h:67
static const float invRoot12
std::vector< bool > tiltedVsType
Definition: TrackerModule.h:34
float maxZ() const
Definition: TrackerModule.h:58
float minZ() const
Definition: TrackerModule.h:57
bool psModule() const
Definition: TrackerModule.h:64
unsigned int rawStackedDetId() const
Definition: TrackerModule.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static unsigned int calcLayerIdReduced(unsigned int layerId)
float tiltAngle() const
Definition: TrackerModule.h:75
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const PixelTopology * specTopol() const
Definition: TrackerModule.h:51
TrackerModule(const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const ModuleTypeCfg &moduleTypeCfg, const DetId &detId)
float minPhi() const
Definition: TrackerModule.h:55
unsigned int endcapRing() const
Definition: TrackerModule.h:71
float maxR() const
Definition: TrackerModule.h:54
unsigned int layerId_
float theta() const
Definition: TrackerModule.h:60
float minR() const
Definition: TrackerModule.h:53
Definition: DetId.h:17
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
float pitchOverSep() const
Definition: TrackerModule.h:91
float sigmaPar() const
Definition: TrackerModule.h:89
std::vector< double > pitchVsType
Definition: TrackerModule.h:30
unsigned int endcapRing_
std::vector< double > spaceVsType
Definition: TrackerModule.h:31
bool barrel() const
Definition: TrackerModule.h:65
unsigned int nStrips() const
Definition: TrackerModule.h:81
ModuleTypeCfg moduleTypeCfg_
const PixelTopology * specTopol_
unsigned int moduleTypeID() const
Definition: TrackerModule.h:95
std::vector< bool > barrelVsType
Definition: TrackerModule.h:32
const DetId & stackedDetId() const
Definition: TrackerModule.h:47
unsigned int layerIdReduced() const
Definition: TrackerModule.h:69
const PixelGeomDetUnit * specDet() const
Definition: TrackerModule.h:50
float sensorWidth() const
Definition: TrackerModule.h:77
unsigned int layerIdReduced_
float paramB() const
Definition: TrackerModule.h:93
bool tiltedBarrel() const
Definition: TrackerModule.h:73
float stripPitch() const
Definition: TrackerModule.h:83