CMS 3D CMS Logo

SiStripRegionCabling.h
Go to the documentation of this file.
1 #ifndef CalibTracker_SiStripConnectivity_SiStripRegionCabling_H
2 #define CalibTracker_SiStripConnectivity_SiStripRegionCabling_H
3 #define _USE_MATH_DEFINES
4 
7 #include <cmath>
8 #include <map>
9 #include <sstream>
10 #include <vector>
11 #include <cstdint>
12 
24 public:
26  typedef int SubDet;
27  static constexpr int TIB = 0, TOB = 1, TID = 2, TEC = 3, ALLSUBDETS = 4;
28  typedef int Layer;
29  static constexpr int TIBLAYERS = 4, TOBLAYERS = 6, TIDLAYERS = 3, TECLAYERS = 9, ALLLAYERS = 10;
30 
32  typedef std::pair<uint32_t, std::vector<FedChannelConnection>> Element;
33  typedef std::vector<Element> ElementCabling;
34  typedef std::vector<ElementCabling> WedgeCabling;
35  typedef std::vector<WedgeCabling> RegionCabling;
36  typedef std::vector<RegionCabling> Cabling;
37 
40  typedef std::pair<double, double> Position;
41  typedef std::pair<uint32_t, uint32_t> PositionIndex;
42 
45  typedef uint32_t ElementIndex;
46 
47  SiStripRegionCabling(const uint32_t, const uint32_t, const double);
48 
50 
53  inline void setRegionCabling(const Cabling &);
54 
55  inline const Cabling &getRegionCabling() const;
56 
57  inline const uint32_t etadivisions() const;
58 
59  inline const uint32_t phidivisions() const;
60 
64  inline const std::pair<double, double> regionDimensions() const;
65 
66  inline const Position position(const uint32_t) const;
67 
68  inline const Position position(const PositionIndex) const;
69 
70  inline const PositionIndex positionIndex(const uint32_t) const;
71 
72  const PositionIndex positionIndex(const Position) const;
73 
74  const uint32_t region(const Position) const;
75 
76  inline const uint32_t region(const PositionIndex) const;
77 
80  PositionIndex increment(const PositionIndex, int, int) const;
81 
85  inline static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer);
86 
87  inline const ElementIndex elementIndex(const PositionIndex, const SubDet, const uint32_t layer) const;
88 
89  inline const ElementIndex elementIndex(const Position, const SubDet, const uint32_t layer) const;
90 
91  inline static const uint32_t layer(const ElementIndex);
92 
93  inline static const SubDet subdet(const ElementIndex);
94 
95  inline static const uint32_t region(const ElementIndex);
96 
97  // /** Methods for extracting det-id information */
98  //
99  static const SubDet subdetFromDetId(const uint32_t detid);
100 
102  void print(std::stringstream &) const;
103 
104 private:
106 
110 
112  double etamax_;
113 
116 };
117 
118 inline void SiStripRegionCabling::setRegionCabling(const Cabling &regioncabling) { regioncabling_ = regioncabling; }
119 
121 
122 inline const uint32_t SiStripRegionCabling::etadivisions() const { return static_cast<uint32_t>(etadivisions_); }
123 
124 inline const uint32_t SiStripRegionCabling::phidivisions() const { return static_cast<uint32_t>(phidivisions_); }
125 
126 inline const std::pair<double, double> SiStripRegionCabling::regionDimensions() const {
127  return std::pair<double, double>((2. * etamax_) / etadivisions_, 2. * M_PI / phidivisions_);
128 }
129 
132  return position(index);
133 }
134 
136  return Position(regionDimensions().first * (index.first + .5) - etamax_,
137  regionDimensions().second * (index.second + .5) - M_PI);
138 }
139 
142 }
143 
144 inline const uint32_t SiStripRegionCabling::region(const PositionIndex index) const {
145  return index.first * phidivisions_ + index.second;
146 }
147 
148 inline const uint32_t SiStripRegionCabling::elementIndex(const uint32_t region,
149  const SubDet subdet,
150  const uint32_t layer) {
151  return region * ALLSUBDETS * ALLLAYERS + subdet * ALLLAYERS + layer;
152 }
153 
155  const SubDet subdet,
156  const uint32_t layer) const {
157  return elementIndex(region(index), subdet, layer);
158 }
159 
161  const SubDet subdet,
162  const uint32_t layer) const {
164 }
165 
166 inline const uint32_t SiStripRegionCabling::layer(const uint32_t index) { return index % ALLLAYERS; }
167 
169  return static_cast<SiStripRegionCabling::SubDet>((index / ALLLAYERS) % ALLSUBDETS);
170 }
171 
172 inline const uint32_t SiStripRegionCabling::region(const uint32_t index) { return index / (ALLSUBDETS * ALLLAYERS); }
173 
174 #endif
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
std::pair< uint32_t, uint32_t > PositionIndex
const uint32_t phidivisions() const
std::pair< uint32_t, std::vector< FedChannelConnection > > Element
static constexpr int TID
static constexpr int TOBLAYERS
const Cabling & getRegionCabling() const
std::vector< Element > ElementCabling
static constexpr int TIB
const Position position(const uint32_t) const
U second(std::pair< T, U > const &p)
void setRegionCabling(const Cabling &)
static constexpr int TIBLAYERS
const uint32_t region(const Position) const
static const SubDet subdet(const ElementIndex)
static const SubDet subdetFromDetId(const uint32_t detid)
std::vector< RegionCabling > Cabling
#define M_PI
std::pair< double, double > Position
const PositionIndex positionIndex(const uint32_t) const
const uint32_t etadivisions() const
static constexpr int ALLLAYERS
std::vector< WedgeCabling > RegionCabling
static int position[264][3]
Definition: ReadPGInfo.cc:289
const std::pair< double, double > regionDimensions() const
PositionIndex increment(const PositionIndex, int, int) const
void print(std::stringstream &) const
static constexpr int TOB
std::vector< ElementCabling > WedgeCabling
static constexpr int TECLAYERS
static constexpr int TIDLAYERS
static constexpr int TEC
static const uint32_t layer(const ElementIndex)
static constexpr int ALLSUBDETS