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 
5 #include <boost/cstdint.hpp>
8 #include <sstream>
9 #include <vector>
10 #include <map>
11 #include <cmath>
12 
24 
25  public:
26 
28  enum SubDet {TIB = 0, TOB = 1, TID = 2, TEC = 3, ALLSUBDETS = 4};
29  enum Layer {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:
105 
107 
111 
113  double etamax_;
114 
116  Cabling regioncabling_;
117 };
118 
119 inline void SiStripRegionCabling::setRegionCabling(const Cabling& regioncabling) {
120  regioncabling_ = regioncabling;
121 }
122 
124  return regioncabling_;
125 }
126 
127 inline const uint32_t SiStripRegionCabling::etadivisions() const {
128  return static_cast<uint32_t>(etadivisions_);
129 }
130 
131 inline const uint32_t SiStripRegionCabling::phidivisions() const {
132  return static_cast<uint32_t>(phidivisions_);
133 }
134 
135 inline const std::pair<double,double> SiStripRegionCabling::regionDimensions() const {
136  return std::pair<double,double>((2.*etamax_)/etadivisions_,2.*M_PI/phidivisions_);
137 }
138 
140  PositionIndex index = positionIndex(region);
141  return position(index);
142 }
143 
145  return Position(regionDimensions().first*(index.first+.5) - etamax_, regionDimensions().second*(index.second+.5)- M_PI);
146 }
147 
149  return PositionIndex(region/phidivisions_,region%phidivisions_);
150 }
151 
152 inline const uint32_t SiStripRegionCabling::region(const PositionIndex index) const {
153  return index.first*phidivisions_ + index.second;
154 }
155 
156 inline const uint32_t SiStripRegionCabling::elementIndex(const uint32_t region, const SubDet subdet, const uint32_t layer) {
157  return region*ALLSUBDETS*ALLLAYERS + subdet*ALLLAYERS + layer;
158 }
159 
160 inline const uint32_t SiStripRegionCabling::elementIndex(const PositionIndex index, const SubDet subdet, const uint32_t layer) const {
161  return elementIndex(region(index),subdet,layer);
162 }
163 
164 inline const uint32_t SiStripRegionCabling::elementIndex(const Position position, const SubDet subdet, const uint32_t layer) const {
165  return elementIndex(region(position),subdet,layer);
166 }
167 
168 inline const uint32_t SiStripRegionCabling::layer(const uint32_t index) {
169  return index%ALLLAYERS;
170 }
171 
173  return static_cast<SiStripRegionCabling::SubDet>((index/ALLLAYERS)%ALLSUBDETS);
174 }
175 
176 inline const uint32_t SiStripRegionCabling::region(const uint32_t index) {
177  return index/(ALLSUBDETS*ALLLAYERS);
178 }
179 
180 #endif
static const ElementIndex elementIndex(const uint32_t region, const SubDet, const uint32_t layer)
void print(std::stringstream &) const
const std::pair< double, double > regionDimensions() const
const PositionIndex positionIndex(const uint32_t) const
std::vector< Element > ElementCabling
U second(std::pair< T, U > const &p)
void setRegionCabling(const Cabling &)
const uint32_t phidivisions() const
std::vector< ElementCabling > WedgeCabling
static const SubDet subdet(const ElementIndex)
static const SubDet subdetFromDetId(const uint32_t detid)
std::pair< double, double > Position
const Cabling & getRegionCabling() const
std::pair< uint32_t, std::vector< FedChannelConnection > > Element
#define M_PI
const Position position(const uint32_t) const
const uint32_t region(const Position) const
const uint32_t etadivisions() const
PositionIndex increment(const PositionIndex, int, int) const
std::vector< WedgeCabling > RegionCabling
std::pair< uint32_t, uint32_t > PositionIndex
static const uint32_t layer(const ElementIndex)
std::vector< RegionCabling > Cabling