CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TkDetMap.h
Go to the documentation of this file.
1 #ifndef CalibTracker_SiStripCommon_TKHistoMap_h
2 #define CalibTracker_SiStripCommon_TKHistoMap_h
3 
4 
5 #include <map>
6 #include <boost/cstdint.hpp>
11 
12 class TkLayerMap{
13 
14  public:
15 
16  struct XYbin{
17  XYbin(const XYbin& in){ix=in.ix;iy=in.iy;x=in.x;y=in.y;}
18  XYbin(int16_t _ix=-999, int16_t _iy=-999, float _x=-999., float _y=-999.){ix=_ix;iy=_iy;x=_x;y=_y;}
19  int16_t ix,iy;
20  float x,y;
21  };
22 
23  enum TkLayerEnum { INVALID=0,
24  TIB_L1, //1
28  TIDM_D1, //5
31  TIDP_D1, //8
34  TOB_L1, //11
40  TECM_W1, //17
49  TECP_W1, //26
57  TECP_W9 //34
58  };
59 
60 
61  TkLayerMap(int in);
63  delete [] binToDet;
64  };
65 
66  const XYbin getXY(uint32_t detid, int layerEnumNb=0) const;
67 
68  int get_nchX( ) const {return nchX;}
69  int get_nchY( ) const {return nchY;}
70  double get_lowX( ) const {return lowX;}
71  double get_highX( ) const {return highX;}
72  double get_lowY( ) const {return lowY;}
73  double get_highY( ) const {return highY;}
74 
75  static const int16_t layerSearch(uint32_t detid);
76 
77  uint32_t getDetFromBin(int ix, int iy) const;
78  const uint32_t* getBinToDet() const {return binToDet;}
79 
80  private:
81 
82  XYbin getXY_TIB(uint32_t detid, int layerEnumNb=0) const;
83  XYbin getXY_TOB(uint32_t detid, int layerEnumNb=0) const;
84  XYbin getXY_TID(uint32_t detid, int layerEnumNb=0) const;
85  XYbin getXY_TEC(uint32_t detid, int layerEnumNb=0) const;
86 
87  void initialize(int layer);
88 
89  void createTIB(std::vector<uint32_t>& TkDetIdList, int layer);
90  void createTOB(std::vector<uint32_t>& TkDetIdList, int layer);
91  void createTID(std::vector<uint32_t>& TkDetIdList, int layer);
92  void createTEC(std::vector<uint32_t>& TkDetIdList, int layer);
93 
94  private:
95  uint32_t get_Offset( TIBDetId ) const;
96 
97  uint32_t* binToDet;
98 
99  int layerEnumNb_; //In the enumerator sequence
100  int nchX;
101  int nchY;
102  double lowX,highX;
103  double lowY, highY;
104 
106  uint32_t Nstring_ext, Nrod, Offset;
107 
108 };
109 
110 class TkDetMap{
111 
112  public:
113  TkDetMap();
115  ~TkDetMap();
116 
117  const TkLayerMap::XYbin& getXY(uint32_t& , uint32_t& cached_detid , int16_t& cached_layer , TkLayerMap::XYbin& cached_XYbin) const;
118  std::string getLayerName(int& in) const;
119  int getLayerNum(const std::string& in) const;
120  void getSubDetLayerSide(int& in,SiStripDetId::SubDetector&,uint32_t& layer,uint32_t& side) const;
121 
122  int16_t FindLayer(uint32_t& detid , uint32_t& cached_detid , int16_t& cached_layer , TkLayerMap::XYbin& cached_XYbin) const;
123 
124  void getComponents(int layer,
125  int& nchX,double& lowX,double& highX,
126  int& nchY,double& lowY,double& highY) const;
127 
128  uint32_t getDetFromBin(int layer, int ix, int iy) const { return TkMap[layer]->getDetFromBin(ix,iy); }
129  uint32_t getDetFromBin(const std::string& layerName, int ix, int iy) const {return getDetFromBin(getLayerNum(layerName),ix,iy);}
130 
131  void getDetsForLayer(int layer,std::vector<uint32_t>& output) const;
132 
133  private:
134 
135  void doMe();
136 
137  private:
138  typedef std::vector<const TkLayerMap*> detmapType;
140  //uint32_t cached_detid;
141  //int16_t cached_layer;
142  //TkLayerMap::XYbin cached_XYbin;
143 };
144 
145 
146 #endif
int getLayerNum(const std::string &in) const
Definition: TkDetMap.cc:777
TkLayerMap(int in)
Definition: TkDetMap.cc:14
uint32_t getDetFromBin(int ix, int iy) const
Definition: TkDetMap.cc:81
double get_highX() const
Definition: TkDetMap.h:71
std::vector< const TkLayerMap * > detmapType
Definition: TkDetMap.h:138
XYbin getXY_TID(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:579
~TkLayerMap()
Definition: TkDetMap.h:62
TkDetMap()
Definition: TkDetMap.cc:630
void createTEC(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:494
void createTIB(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:437
static const int16_t layerSearch(uint32_t detid)
Definition: TkDetMap.cc:89
int get_nchX() const
Definition: TkDetMap.h:68
XYbin getXY_TEC(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:597
uint32_t * binToDet
Definition: TkDetMap.h:97
int layerEnumNb_
Definition: TkDetMap.h:99
std::vector< uint32_t > BinForRing
Definition: TkDetMap.h:105
uint32_t getDetFromBin(const std::string &layerName, int ix, int iy) const
Definition: TkDetMap.h:129
~TkDetMap()
Definition: TkDetMap.cc:644
uint32_t getDetFromBin(int layer, int ix, int iy) const
Definition: TkDetMap.h:128
uint32_t Nrod
Definition: TkDetMap.h:106
void getSubDetLayerSide(int &in, SiStripDetId::SubDetector &, uint32_t &layer, uint32_t &side) const
Definition: TkDetMap.cc:849
std::string getLayerName(int &in) const
Definition: TkDetMap.cc:702
double get_lowX() const
Definition: TkDetMap.h:70
uint32_t Offset
Definition: TkDetMap.h:106
detmapType TkMap
Definition: TkDetMap.h:139
XYbin(int16_t _ix=-999, int16_t _iy=-999, float _x=-999., float _y=-999.)
Definition: TkDetMap.h:18
double highX
Definition: TkDetMap.h:102
void getDetsForLayer(int layer, std::vector< uint32_t > &output) const
Definition: TkDetMap.cc:695
std::vector< uint32_t > ModulesInRingFront
Definition: TkDetMap.h:105
void getComponents(int layer, int &nchX, double &lowX, double &highX, int &nchY, double &lowY, double &highY) const
Definition: TkDetMap.cc:684
void createTID(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:475
XYbin getXY_TIB(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:544
double get_highY() const
Definition: TkDetMap.h:73
void createTOB(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:456
uint32_t get_Offset(TIBDetId) const
Definition: TkDetMap.cc:536
double lowY
Definition: TkDetMap.h:103
const XYbin getXY(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:515
int nchY
Definition: TkDetMap.h:101
void initialize(int layer)
Definition: TkDetMap.cc:109
std::vector< uint32_t > ModulesInRingBack
Definition: TkDetMap.h:105
int get_nchY() const
Definition: TkDetMap.h:69
int16_t FindLayer(uint32_t &detid, uint32_t &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:664
XYbin getXY_TOB(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:562
std::vector< uint32_t > SingleExtString
Definition: TkDetMap.h:105
const uint32_t * getBinToDet() const
Definition: TkDetMap.h:78
uint32_t Nstring_ext
Definition: TkDetMap.h:106
const TkLayerMap::XYbin & getXY(uint32_t &, uint32_t &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:652
double lowX
Definition: TkDetMap.h:102
int nchX
Definition: TkDetMap.h:100
void doMe()
Definition: TkDetMap.cc:634
double get_lowY() const
Definition: TkDetMap.h:72
XYbin(const XYbin &in)
Definition: TkDetMap.h:17
double highY
Definition: TkDetMap.h:103