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  enum SubDet { TIB = 0, TOB = 1, TID = 2, TEC = 3, ALLSUBDETS = 4 };
27  enum Layer { TIBLAYERS = 4, TOBLAYERS = 6, TIDLAYERS = 3, TECLAYERS = 9, ALLLAYERS = 10 };
28 
30  typedef std::pair<uint32_t, std::vector<FedChannelConnection>> Element;
31  typedef std::vector<Element> ElementCabling;
32  typedef std::vector<ElementCabling> WedgeCabling;
33  typedef std::vector<WedgeCabling> RegionCabling;
34  typedef std::vector<RegionCabling> Cabling;
35 
38  typedef std::pair<double, double> Position;
39  typedef std::pair<uint32_t, uint32_t> PositionIndex;
40 
43  typedef uint32_t ElementIndex;
44 
45  SiStripRegionCabling(const uint32_t, const uint32_t, const double);
46 
48 
51  inline void setRegionCabling(const Cabling &);
52 
53  inline const Cabling &getRegionCabling() const;
54 
55  inline const uint32_t etadivisions() const;
56 
57  inline const uint32_t phidivisions() const;
58 
62  inline const std::pair<double, double> regionDimensions() const;
63 
64  inline const Position position(const uint32_t) const;
65 
66  inline const Position position(const PositionIndex) const;
67 
68  inline const PositionIndex positionIndex(const uint32_t) const;
69 
70  const PositionIndex positionIndex(const Position) const;
71 
72  const uint32_t region(const Position) const;
73 
74  inline const uint32_t region(const PositionIndex) const;
75 
78  PositionIndex increment(const PositionIndex, int, int) const;
79 
83  inline static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer);
84 
85  inline const ElementIndex elementIndex(const PositionIndex, const SubDet, const uint32_t layer) const;
86 
87  inline const ElementIndex elementIndex(const Position, const SubDet, const uint32_t layer) const;
88 
89  inline static const uint32_t layer(const ElementIndex);
90 
91  inline static const SubDet subdet(const ElementIndex);
92 
93  inline static const uint32_t region(const ElementIndex);
94 
95  // /** Methods for extracting det-id information */
96  //
97  static const SubDet subdetFromDetId(const uint32_t detid);
98 
100  void print(std::stringstream &) const;
101 
102 private:
104 
108 
110  double etamax_;
111 
114 };
115 
116 inline void SiStripRegionCabling::setRegionCabling(const Cabling &regioncabling) { regioncabling_ = regioncabling; }
117 
119 
120 inline const uint32_t SiStripRegionCabling::etadivisions() const { return static_cast<uint32_t>(etadivisions_); }
121 
122 inline const uint32_t SiStripRegionCabling::phidivisions() const { return static_cast<uint32_t>(phidivisions_); }
123 
124 inline const std::pair<double, double> SiStripRegionCabling::regionDimensions() const {
125  return std::pair<double, double>((2. * etamax_) / etadivisions_, 2. * M_PI / phidivisions_);
126 }
127 
130  return position(index);
131 }
132 
134  return Position(regionDimensions().first * (index.first + .5) - etamax_,
135  regionDimensions().second * (index.second + .5) - M_PI);
136 }
137 
140 }
141 
142 inline const uint32_t SiStripRegionCabling::region(const PositionIndex index) const {
143  return index.first * phidivisions_ + index.second;
144 }
145 
146 inline const uint32_t SiStripRegionCabling::elementIndex(const uint32_t region,
147  const SubDet subdet,
148  const uint32_t layer) {
149  return region * ALLSUBDETS * ALLLAYERS + subdet * ALLLAYERS + layer;
150 }
151 
153  const SubDet subdet,
154  const uint32_t layer) const {
155  return elementIndex(region(index), subdet, layer);
156 }
157 
159  const SubDet subdet,
160  const uint32_t layer) const {
162 }
163 
164 inline const uint32_t SiStripRegionCabling::layer(const uint32_t index) { return index % ALLLAYERS; }
165 
167  return static_cast<SiStripRegionCabling::SubDet>((index / ALLLAYERS) % ALLSUBDETS);
168 }
169 
170 inline const uint32_t SiStripRegionCabling::region(const uint32_t index) { return index / (ALLSUBDETS * ALLLAYERS); }
171 
172 #endif
SiStripRegionCabling::Position
std::pair< double, double > Position
Definition: SiStripRegionCabling.h:38
SiStripRegionCabling::RegionCabling
std::vector< WedgeCabling > RegionCabling
Definition: SiStripRegionCabling.h:33
SiStripRegionCabling::ALLLAYERS
Definition: SiStripRegionCabling.h:27
SiStripRegionCabling::print
void print(std::stringstream &) const
Definition: SiStripRegionCabling.cc:64
Handle.h
SiStripRegionCabling::increment
PositionIndex increment(const PositionIndex, int, int) const
Definition: SiStripRegionCabling.cc:30
SiStripRegionCabling::WedgeCabling
std::vector< ElementCabling > WedgeCabling
Definition: SiStripRegionCabling.h:32
SiStripRegionCabling::TIBLAYERS
Definition: SiStripRegionCabling.h:27
SiStripRegionCabling::getRegionCabling
const Cabling & getRegionCabling() const
Definition: SiStripRegionCabling.h:118
SiStripRegionCabling::TID
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::TOB
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::positionIndex
const PositionIndex positionIndex(const uint32_t) const
Definition: SiStripRegionCabling.h:138
SiStripRegionCabling::Layer
Layer
Definition: SiStripRegionCabling.h:27
SiStripRegionCabling::position
const Position position(const uint32_t) const
Definition: SiStripRegionCabling.h:128
SiStripRegionCabling::setRegionCabling
void setRegionCabling(const Cabling &)
Definition: SiStripRegionCabling.h:116
SiStripRegionCabling::ALLSUBDETS
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::phidivisions_
int phidivisions_
Definition: SiStripRegionCabling.h:107
SiStripRegionCabling::elementIndex
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
Definition: SiStripRegionCabling.h:146
SiStripRegionCabling::TOBLAYERS
Definition: SiStripRegionCabling.h:27
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
SiStripRegionCabling::layer
static const uint32_t layer(const ElementIndex)
Definition: SiStripRegionCabling.h:164
SiStripRegionCabling::TEC
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::SubDet
SubDet
Definition: SiStripRegionCabling.h:26
dqmdumpme.first
first
Definition: dqmdumpme.py:55
SiStripRegionCabling::TECLAYERS
Definition: SiStripRegionCabling.h:27
SiStripRegionCabling::etadivisions
const uint32_t etadivisions() const
Definition: SiStripRegionCabling.h:120
SiStripRegionCabling::etamax_
double etamax_
Definition: SiStripRegionCabling.h:110
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
SiStripRegionCabling::SiStripRegionCabling
SiStripRegionCabling()
Definition: SiStripRegionCabling.h:103
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
SiStripRegionCabling::etadivisions_
int etadivisions_
Definition: SiStripRegionCabling.h:106
SiStripRegionCabling::TIB
Definition: SiStripRegionCabling.h:26
SiStripRegionCabling::~SiStripRegionCabling
~SiStripRegionCabling()
Definition: SiStripRegionCabling.h:47
SiStripRegionCabling::phidivisions
const uint32_t phidivisions() const
Definition: SiStripRegionCabling.h:122
SiStripRegionCabling::region
const uint32_t region(const Position) const
Definition: SiStripRegionCabling.cc:25
SiStripRegionCabling::Cabling
std::vector< RegionCabling > Cabling
Definition: SiStripRegionCabling.h:34
SiStripRegionCabling::regioncabling_
Cabling regioncabling_
Definition: SiStripRegionCabling.h:113
FedChannelConnection.h
SiStripRegionCabling::TIDLAYERS
Definition: SiStripRegionCabling.h:27
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
SiStripRegionCabling::PositionIndex
std::pair< uint32_t, uint32_t > PositionIndex
Definition: SiStripRegionCabling.h:39
SiStripRegionCabling::ElementCabling
std::vector< Element > ElementCabling
Definition: SiStripRegionCabling.h:31
SiStripRegionCabling::Element
std::pair< uint32_t, std::vector< FedChannelConnection > > Element
Definition: SiStripRegionCabling.h:30
SiStripRegionCabling
Definition: SiStripRegionCabling.h:23
SiStripRegionCabling::regionDimensions
const std::pair< double, double > regionDimensions() const
Definition: SiStripRegionCabling.h:124
SiStripRegionCabling::subdet
static const SubDet subdet(const ElementIndex)
Definition: SiStripRegionCabling.h:166
SiStripRegionCabling::ElementIndex
uint32_t ElementIndex
Definition: SiStripRegionCabling.h:43