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>
10 
11 class TkLayerMap{
12 
13  public:
14 
15  struct XYbin{
16  XYbin(const XYbin& in){ix=in.ix;iy=in.iy;x=in.x;y=in.y;}
17  XYbin(int16_t _ix=-999, int16_t _iy=-999, float _x=-999., float _y=-999.){ix=_ix;iy=_iy;x=_x;y=_y;}
18  int16_t ix,iy;
19  float x,y;
20  };
21 
22  enum TkLayerEnum { INVALID=0,
23  TIB_L1, //1
27  TIDM_D1, //5
30  TIDP_D1, //8
33  TOB_L1, //11
39  TECM_W1, //17
48  TECP_W1, //26
56  TECP_W9 //34
57  };
58 
59 
60  TkLayerMap(int in);
62  delete [] binToDet;
63  };
64 
65  const XYbin getXY(uint32_t& detid, int layerEnumNb=0);
66 
67  int& get_nchX(){return nchX;}
68  int& get_nchY(){return nchY;}
69  double& get_lowX(){return lowX;}
70  double& get_highX(){return highX;}
71  double& get_lowY(){return lowY;}
72  double& get_highY(){return highY;}
73 
74  static const int16_t layerSearch(uint32_t detid);
75 
76  uint32_t getDetFromBin(int ix, int iy);
77  uint32_t* getBinToDet(){return binToDet;}
78 
79  private:
80 
81  XYbin getXY_TIB(uint32_t& detid, int layerEnumNb=0);
82  XYbin getXY_TOB(uint32_t& detid, int layerEnumNb=0);
83  XYbin getXY_TID(uint32_t& detid, int layerEnumNb=0);
84  XYbin getXY_TEC(uint32_t& detid, int layerEnumNb=0);
85 
86  void initialize(int layer);
87 
88  void createTIB(std::vector<uint32_t>& TkDetIdList, int layer);
89  void createTOB(std::vector<uint32_t>& TkDetIdList, int layer);
90  void createTID(std::vector<uint32_t>& TkDetIdList, int layer);
91  void createTEC(std::vector<uint32_t>& TkDetIdList, int layer);
92 
93  private:
94  uint32_t* binToDet;
96 
97  int layerEnumNb_; //In the enumerator sequence
98  int nchX;
99  int nchY;
100  double lowX,highX;
101  double lowY, highY;
102 
104  uint32_t Nstring_ext, Nrod, Offset;
105 
106 };
107 
108 class TkDetMap{
109 
110  public:
111  TkDetMap();
113  ~TkDetMap();
114 
115  const TkLayerMap::XYbin& getXY(uint32_t&);
116  std::string getLayerName(int& in);
117  int getLayerNum(std::string& in);
118  void getSubDetLayerSide(int& in,SiStripDetId::SubDetector&,uint32_t& layer,uint32_t& side);
119 
120  int16_t FindLayer(uint32_t& detid);
121 
122  void getComponents(int& layer,
123  int& nchX,double& lowX,double& highX,
124  int& nchY,double& lowY,double& highY);
125 
126  uint32_t getDetFromBin(int layer, int ix, int iy){ return TkMap[layer]->getDetFromBin(ix,iy); }
127  uint32_t getDetFromBin(std::string layerName, int ix, int iy){return getDetFromBin(getLayerNum(layerName),ix,iy);}
128 
129  void getDetsForLayer(int layer,std::vector<uint32_t>& output);
130 
131  private:
132 
133  void doMe();
134 
135  private:
136  typedef std::vector<TkLayerMap*> detmapType;
138  uint32_t cached_detid;
139  int16_t cached_layer;
141 };
142 
143 
144 #endif
TkLayerMap(int in)
Definition: TkDetMap.cc:14
uint32_t getDetFromBin(int layer, int ix, int iy)
Definition: TkDetMap.h:126
double & get_lowX()
Definition: TkDetMap.h:69
~TkLayerMap()
Definition: TkDetMap.h:61
XYbin getXY_TOB(uint32_t &detid, int layerEnumNb=0)
Definition: TkDetMap.cc:547
TkDetMap()
Definition: TkDetMap.cc:609
void createTEC(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:487
int & get_nchY()
Definition: TkDetMap.h:68
std::vector< TkLayerMap * > detmapType
Definition: TkDetMap.h:136
void createTIB(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:436
static const int16_t layerSearch(uint32_t detid)
Definition: TkDetMap.cc:89
uint32_t * binToDet
Definition: TkDetMap.h:94
int layerEnumNb_
Definition: TkDetMap.h:97
std::vector< uint32_t > BinForRing
Definition: TkDetMap.h:103
int getLayerNum(std::string &in)
Definition: TkDetMap.cc:759
~TkDetMap()
Definition: TkDetMap.cc:625
uint32_t getDetFromBin(std::string layerName, int ix, int iy)
Definition: TkDetMap.h:127
XYbin xybin
Definition: TkDetMap.h:95
uint32_t Nrod
Definition: TkDetMap.h:104
void getDetsForLayer(int layer, std::vector< uint32_t > &output)
Definition: TkDetMap.cc:677
int & get_nchX()
Definition: TkDetMap.h:67
double & get_lowY()
Definition: TkDetMap.h:71
double & get_highY()
Definition: TkDetMap.h:72
uint32_t Offset
Definition: TkDetMap.h:104
detmapType TkMap
Definition: TkDetMap.h:137
XYbin(int16_t _ix=-999, int16_t _iy=-999, float _x=-999., float _y=-999.)
Definition: TkDetMap.h:17
const XYbin getXY(uint32_t &detid, int layerEnumNb=0)
Definition: TkDetMap.cc:506
double highX
Definition: TkDetMap.h:100
std::vector< uint32_t > ModulesInRingFront
Definition: TkDetMap.h:103
int16_t cached_layer
Definition: TkDetMap.h:139
double & get_highX()
Definition: TkDetMap.h:70
XYbin getXY_TIB(uint32_t &detid, int layerEnumNb=0)
Definition: TkDetMap.cc:527
void createTID(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:470
uint32_t * getBinToDet()
Definition: TkDetMap.h:77
void createTOB(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:453
int16_t FindLayer(uint32_t &detid)
Definition: TkDetMap.cc:646
void getSubDetLayerSide(int &in, SiStripDetId::SubDetector &, uint32_t &layer, uint32_t &side)
Definition: TkDetMap.cc:831
double lowY
Definition: TkDetMap.h:101
TkLayerMap::XYbin cached_XYbin
Definition: TkDetMap.h:140
int nchY
Definition: TkDetMap.h:99
uint32_t cached_detid
Definition: TkDetMap.h:138
void initialize(int layer)
Definition: TkDetMap.cc:108
void getComponents(int &layer, int &nchX, double &lowX, double &highX, int &nchY, double &lowY, double &highY)
Definition: TkDetMap.cc:666
const TkLayerMap::XYbin & getXY(uint32_t &)
Definition: TkDetMap.cc:633
std::vector< uint32_t > ModulesInRingBack
Definition: TkDetMap.h:103
std::string getLayerName(int &in)
Definition: TkDetMap.cc:684
XYbin getXY_TID(uint32_t &detid, int layerEnumNb=0)
Definition: TkDetMap.cc:562
std::vector< uint32_t > SingleExtString
Definition: TkDetMap.h:103
XYbin getXY_TEC(uint32_t &detid, int layerEnumNb=0)
Definition: TkDetMap.cc:577
uint32_t Nstring_ext
Definition: TkDetMap.h:104
uint32_t getDetFromBin(int ix, int iy)
Definition: TkDetMap.cc:81
double lowX
Definition: TkDetMap.h:100
int nchX
Definition: TkDetMap.h:98
void doMe()
Definition: TkDetMap.cc:615
XYbin(const XYbin &in)
Definition: TkDetMap.h:16
double highY
Definition: TkDetMap.h:101