CMS 3D CMS Logo

TkDetMap.cc
Go to the documentation of this file.
8 
10 
11 #include <iostream>
12 #include <cstring>
13 
14 TkLayerMap::TkLayerMap(int in):layerEnumNb_(in){
15 
16  LogTrace("TkLayerMap") <<" TkLayerMap::constructor for layer " << in;
17 
19 
20  if(!edm::Service<SiStripDetInfoFileReader>().isAvailable()){
21  edm::LogError("TkLayerMap") <<
22  "\n------------------------------------------"
23  "\nUnAvailable Service SiStripDetInfoFileReader: please insert in the configuration file an instance like"
24  "\n\tprocess.SiStripDetInfoFileReader = cms.Service(\"SiStripDetInfoFileReader\")"
25  "\n------------------------------------------";
26  }
27 
29 
30  std::vector<uint32_t> TkDetIdList=fr->getAllDetIds();
31 
32  switch (layerEnumNb_)
33  {
34  case TkLayerMap::TIB_L1:
35  case TkLayerMap::TIB_L2:
36  case TkLayerMap::TIB_L3:
37  case TkLayerMap::TIB_L4:
38  createTIB(TkDetIdList,layerEnumNb_);
39  break;
46  createTID(TkDetIdList,layerEnumNb_);
47  break;
48  case TkLayerMap::TOB_L1:
49  case TkLayerMap::TOB_L2:
50  case TkLayerMap::TOB_L3:
51  case TkLayerMap::TOB_L4:
52  case TkLayerMap::TOB_L5:
53  case TkLayerMap::TOB_L6:
54  createTOB(TkDetIdList,layerEnumNb_);
55  break;
60  case TkLayerMap::TECP_W5:
69  case TkLayerMap::TECM_W5:
74  createTEC(TkDetIdList,layerEnumNb_);
75  break;
76  default:
77  edm::LogError("TkLayerMap") <<" TkLayerMap::requested creation of a wrong layer Nb "<< layerEnumNb_;
78  }
79 }
80 
81 uint32_t TkLayerMap::getDetFromBin(int ix, int iy) const {
82 
83  int val=(ix-1)+nchX*(iy-1);
84  if(val>-1 && val < nchX*nchY)
85  return binToDet[val];
86  return 0;
87 }
88 
89 const int16_t TkLayerMap::layerSearch(uint32_t detid) {
90 
91  // switch((detid>>25)&0x7){
92  if(SiStripDetId(detid).subDetector()==SiStripDetId::TIB){
93  TIBDetId D(detid);
94  return TkLayerMap::TIB_L1 -1 +D.layerNumber();
95  } else if (SiStripDetId(detid).subDetector()==SiStripDetId::TID){
96  TIDDetId D(detid);
97  return TkLayerMap::TIDM_D1 -1 + (D.side() -1)*3 + D.wheel();
98  } else if (SiStripDetId(detid).subDetector()==SiStripDetId::TOB){
99  TOBDetId D(detid);
100  return TkLayerMap::TOB_L1 -1 +D.layerNumber();
101  } else if (SiStripDetId(detid).subDetector()==SiStripDetId::TEC){
102  TECDetId D(detid);
103  return TkLayerMap::TECM_W1 -1 + (D.side() -1)*9 + D.wheel();
104  }
105  return 0;
106 }
107 
108 
109 void TkLayerMap::initialize(int layer){
110 
111  switch (layer){
112  case TkLayerMap::TIB_L1: //TIBL1
113 
114  Nstring_ext=30;
115  SingleExtString.insert(SingleExtString.begin(),8,0);
116  SingleExtString.insert(SingleExtString.begin()+8,7,1);
117  SingleExtString.insert(SingleExtString.begin()+15,8,2);
118  SingleExtString.insert(SingleExtString.begin()+23,7,3);
119  nchX=12;
120  lowX=-6;
121  highX=6;
122  nchY=2*(Nstring_ext+1);
123  lowY=-1.*(Nstring_ext+1.);
124  highY=(Nstring_ext+1);
125 
126  break;
127  case TkLayerMap::TIB_L2:
128 
129  Nstring_ext=38;
130  SingleExtString.insert(SingleExtString.begin(),10,0);
131  SingleExtString.insert(SingleExtString.begin()+10,9,1);
132  SingleExtString.insert(SingleExtString.begin()+19,10,2);
133  SingleExtString.insert(SingleExtString.begin()+29,9,3);
134  nchX=12;
135  lowX=-6;
136  highX=6;
137  nchY=2*(Nstring_ext+1);
138  lowY=-1.*(Nstring_ext+1.);
139  highY=(Nstring_ext+1);
140 
141  break;
142  case TkLayerMap::TIB_L3:
143 
144  Nstring_ext=46;
145  SingleExtString.insert(SingleExtString.begin(),23,0);
146  SingleExtString.insert(SingleExtString.begin()+23,23,1);
147  nchX=12;
148  lowX=-6;
149  highX=6;
151  lowY=0;
152  highY=nchY;
153 
154  break;
155  case TkLayerMap::TIB_L4:
156 
157  Nstring_ext=56;
158  SingleExtString.insert(SingleExtString.begin(),14,0);
159  SingleExtString.insert(SingleExtString.begin()+14,14,1);
160  SingleExtString.insert(SingleExtString.begin()+28,14,2);
161  SingleExtString.insert(SingleExtString.begin()+42,14,3);
162  nchX=12;
163  lowX=-6.;
164  highX=6.;
166  lowY=0.;
167  highY=nchY;
168 
169  break;
170  case TkLayerMap::TIDM_D1: //TID
171  case TkLayerMap::TIDM_D2: //TID
172  case TkLayerMap::TIDM_D3: //TID
173 
174  nchX=7;
175  lowX=-7.;
176  highX=0.;
177  nchY=40;
178  lowY=0.0;
179  highY=1.*nchY;
180 
181  break;
182  case TkLayerMap::TIDP_D1: //TID
183  case TkLayerMap::TIDP_D2: //TID
184  case TkLayerMap::TIDP_D3: //TID
185 
186  nchX=7;
187  lowX=0.;
188  highX=7.;
189  nchY=40;
190  lowY=0.0;
191  highY=1.*nchY;
192 
193  break;
194  case TkLayerMap::TOB_L1: //TOBL1
195 
196  Nrod=42;
197  nchX=12;
198  lowX=-6.;
199  highX=6.;
200  nchY=2*(Nrod+1);
201  lowY=-1.*(Nrod+1.);
202  highY=(Nrod+1.);
203 
204  break;
205  case TkLayerMap::TOB_L2:
206 
207  Nrod=48;
208  nchX=12;
209  lowX=-6.;
210  highX=6.;
211  nchY=int(2.*(Nrod+1.));
212  lowY=-1.*(Nrod+1.);
213  highY=(Nrod+1.);
214 
215  break;
216  case TkLayerMap::TOB_L3: //TOBL3
217 
218  Nrod=54;
219  nchX=12;
220  lowX=-6.;
221  highX=6.;
222  nchY=Nrod;
223  lowY=0.;
224  highY=1.*Nrod;
225 
226  break;
227  case TkLayerMap::TOB_L4:
228 
229  Nrod=60;
230  nchX=12;
231  lowX=-6.;
232  highX=6.;
233  nchY=Nrod;
234  lowY=0.;
235  highY=1.*Nrod;
236 
237  break;
238  case TkLayerMap::TOB_L5:
239 
240  Nrod=66;
241  nchX=12;
242  lowX=-6.;
243  highX=6.;
244  nchY=Nrod;
245  lowY=0.;
246  highY=1.*Nrod;
247 
248  break;
249  case TkLayerMap::TOB_L6:
250 
251  Nrod=74;
252  nchX=12;
253  lowX=-6.;
254  highX=6.;
255  nchY=Nrod;
256  lowY=0.;
257  highY=1.*Nrod;
258 
259  break;
260  default: //TEC
261  switch (layer){
262  case TkLayerMap::TECM_W1:
263  case TkLayerMap::TECM_W2:
264  case TkLayerMap::TECM_W3:
265  nchX=16;
266  lowX=-16.;
267  highX=0.;
268  nchY=80;
269  lowY=0.;
270  highY=1.*nchY;
271 
272  BinForRing.push_back(0); //null value for component 0
273  BinForRing.push_back(1);
274  BinForRing.push_back(4);
275  BinForRing.push_back(7);
276  BinForRing.push_back(9);
277  BinForRing.push_back(11);
278  BinForRing.push_back(14);
279  BinForRing.push_back(16);
280  break;
281  case TkLayerMap::TECM_W4:
282  case TkLayerMap::TECM_W5:
283  case TkLayerMap::TECM_W6:
284  nchX=13;
285  lowX=-16.;
286  highX=-3.;
287  nchY=80;
288  lowY=0.;
289  highY=1.*nchY;
290 
291  BinForRing.push_back(0); //null value for component 0
292  BinForRing.push_back(0);
293  BinForRing.push_back(1);
294  BinForRing.push_back(4);
295  BinForRing.push_back(6);
296  BinForRing.push_back(8);
297  BinForRing.push_back(11);
298  BinForRing.push_back(13);
299  break;
300  case TkLayerMap::TECM_W7:
301  case TkLayerMap::TECM_W8:
302  nchX=10;
303  lowX=-16.;
304  highX=-6.;
305  nchY=80;
306  lowY=0.;
307  highY=1.*nchY;
308 
309  BinForRing.push_back(0); //null value for component 0
310  BinForRing.push_back(0);
311  BinForRing.push_back(0);
312  BinForRing.push_back(1);
313  BinForRing.push_back(3);
314  BinForRing.push_back(5);
315  BinForRing.push_back(8);
316  BinForRing.push_back(10);
317  break;
318  case TkLayerMap::TECM_W9:
319  nchX=8;
320  lowX=-16.;
321  highX=-8.;
322  nchY=80;
323  lowY=0.;
324  highY=1.*nchY;
325 
326  BinForRing.push_back(0); //null value for component 0
327  BinForRing.push_back(0);
328  BinForRing.push_back(0);
329  BinForRing.push_back(0);
330  BinForRing.push_back(1);
331  BinForRing.push_back(3);
332  BinForRing.push_back(6);
333  BinForRing.push_back(8);
334  break;
335  case TkLayerMap::TECP_W1:
336  case TkLayerMap::TECP_W2:
337  case TkLayerMap::TECP_W3:
338  nchX=16;
339  lowX=0.;
340  highX=16.;
341  nchY=80;
342  lowY=0.;
343  highY=1.*nchY;
344 
345  BinForRing.push_back(0); //null value for component 0
346  BinForRing.push_back(1);
347  BinForRing.push_back(4);
348  BinForRing.push_back(7);
349  BinForRing.push_back(9);
350  BinForRing.push_back(11);
351  BinForRing.push_back(14);
352  BinForRing.push_back(16);
353  break;
354  case TkLayerMap::TECP_W4:
355  case TkLayerMap::TECP_W5:
356  case TkLayerMap::TECP_W6:
357  nchX=13;
358  lowX=3.;
359  highX=16.;
360  nchY=80;
361  lowY=0.;
362  highY=1.*nchY;
363 
364  BinForRing.push_back(0); //null value for component 0
365  BinForRing.push_back(0);
366  BinForRing.push_back(1);
367  BinForRing.push_back(4);
368  BinForRing.push_back(6);
369  BinForRing.push_back(8);
370  BinForRing.push_back(11);
371  BinForRing.push_back(13);
372  break;
373  case TkLayerMap::TECP_W7:
374  case TkLayerMap::TECP_W8:
375  nchX=10;
376  lowX=6.;
377  highX=16.;
378  nchY=80;
379  lowY=0.;
380  highY=1.*nchY;
381 
382  BinForRing.push_back(0); //null value for component 0
383  BinForRing.push_back(0);
384  BinForRing.push_back(0);
385  BinForRing.push_back(1);
386  BinForRing.push_back(3);
387  BinForRing.push_back(5);
388  BinForRing.push_back(8);
389  BinForRing.push_back(10);
390  break;
391  case TkLayerMap::TECP_W9:
392  nchX=8;
393  lowX=8.;
394  highX=16.;
395  nchY=80;
396  lowY=0.;
397  highY=1.*nchY;
398 
399  BinForRing.push_back(0); //null value for component 0
400  BinForRing.push_back(0);
401  BinForRing.push_back(0);
402  BinForRing.push_back(0);
403  BinForRing.push_back(1);
404  BinForRing.push_back(3);
405  BinForRing.push_back(6);
406  BinForRing.push_back(8);
407  }
408 
409 
410  ModulesInRingFront.push_back(0); //null value for component 0
411  ModulesInRingFront.push_back(2);
412  ModulesInRingFront.push_back(2);
413  ModulesInRingFront.push_back(3);
414  ModulesInRingFront.push_back(4);
415  ModulesInRingFront.push_back(2);
416  ModulesInRingFront.push_back(4);
417  ModulesInRingFront.push_back(5);
418 
419  ModulesInRingBack.push_back(0); //null value for component 0
420  ModulesInRingBack.push_back(1);
421  ModulesInRingBack.push_back(1);
422  ModulesInRingBack.push_back(2);
423  ModulesInRingBack.push_back(3);
424  ModulesInRingBack.push_back(3);
425  ModulesInRingBack.push_back(3);
426  ModulesInRingBack.push_back(5);
427  }
428 
429  for (size_t i=0;i<SingleExtString.size();i++)
430  LogTrace("TkLayerMap") << "[initialize SingleExtString["<<i<<"] " << SingleExtString[i];
431 
432  binToDet= new uint32_t[nchX*nchY];
433  for(size_t i=0;i<(size_t) nchX*nchY;++i)
434  binToDet[i]=0;
435 }
436 
437 void TkLayerMap::createTIB(std::vector<uint32_t>& TkDetIdList,int layerEnumNb){
438 
439  std::vector<uint32_t> LayerDetIdList;
440  SiStripSubStructure siStripSubStructure;
441 
442  //extract vector of module in the layer
443  siStripSubStructure.getTIBDetectors(TkDetIdList,LayerDetIdList,layerEnumNb,0,0,0);
444 
445  LogTrace("TkLayerMap") << "[TkLayerMap::createTIB12] layer " << layerEnumNb << " number of dets " << LayerDetIdList.size() << " lowY " << lowY << " high " << highY << " Nstring " << Nstring_ext;
446 
447  XYbin xyb;
448 
449  for(size_t j=0;j<LayerDetIdList.size();++j){
450  xyb=getXY_TIB(LayerDetIdList[j],layerEnumNb);
451  binToDet[(xyb.ix-1)+nchX*(xyb.iy-1)]=LayerDetIdList[j];
452  LogTrace("TkLayerMap") << "[TkLayerMap::createTIB] " << LayerDetIdList[j]<< " " << xyb.ix << " " << xyb.iy << " " << xyb.x << " " << xyb.y ;
453  }
454 }
455 
456 void TkLayerMap::createTOB(std::vector<uint32_t>& TkDetIdList,int layerEnumNb){
457 
458  std::vector<uint32_t> LayerDetIdList;
459  SiStripSubStructure siStripSubStructure;
460 
461  //extract vector of module in the layer
462  siStripSubStructure.getTOBDetectors(TkDetIdList,LayerDetIdList,layerEnumNb-10,0,0);
463 
464  LogTrace("TkLayerMap") << "[TkLayerMap::createTOB] layer " << layerEnumNb-10 << " number of dets " << LayerDetIdList.size() << " lowY " << lowY << " high " << highY << " Nstring " << Nstring_ext;
465 
466  XYbin xyb;
467 
468  for(size_t j=0;j<LayerDetIdList.size();++j){
469  xyb=getXY_TOB(LayerDetIdList[j],layerEnumNb);
470  binToDet[(xyb.ix-1)+nchX*(xyb.iy-1)]=LayerDetIdList[j];
471  LogTrace("TkLayerMap") << "[TkLayerMap::createTOB] " << LayerDetIdList[j]<< " " << xyb.ix << " " << xyb.iy << " " << xyb.x << " " << xyb.y ;
472  }
473 }
474 
475 void TkLayerMap::createTID(std::vector<uint32_t>& TkDetIdList,int layerEnumNb){
476 
477  std::vector<uint32_t> LayerDetIdList;
478  SiStripSubStructure siStripSubStructure;
479 
480  //extract vector of module in the layer
481  siStripSubStructure.getTIDDetectors(TkDetIdList,LayerDetIdList,(layerEnumNb-TkLayerMap::TIDM_D1)/3+1,(layerEnumNb-TkLayerMap::TIDM_D1)%3+1,0,0);
482 
483  LogTrace("TkLayerMap") << "[TkLayerMap::createTID] layer side " << (layerEnumNb-TkLayerMap::TIDM_D1)/3+1 << " nb " << (layerEnumNb-TkLayerMap::TIDM_D1)%3+1 << " number of dets " << LayerDetIdList.size() << " lowY " << lowY << " high " << highY << " Nstring " << Nstring_ext;
484 
485  XYbin xyb;
486 
487  for(size_t j=0;j<LayerDetIdList.size();++j){
488  xyb=getXY_TID(LayerDetIdList[j],layerEnumNb);
489  binToDet[(xyb.ix-1)+nchX*(xyb.iy-1)]=LayerDetIdList[j];
490  LogTrace("TkLayerMap") << "[TkLayerMap::createTID] " << LayerDetIdList[j]<< " " << xyb.ix << " " << xyb.iy << " " << xyb.x << " " << xyb.y ;
491  }
492 }
493 
494 void TkLayerMap::createTEC(std::vector<uint32_t>& TkDetIdList,int layerEnumNb){
495 
496  std::vector<uint32_t> LayerDetIdList;
497  SiStripSubStructure siStripSubStructure;
498 
499  //extract vector of module in the layer
500  siStripSubStructure.getTECDetectors(TkDetIdList,LayerDetIdList,(layerEnumNb-TkLayerMap::TECM_W1)/9+1,(layerEnumNb-TkLayerMap::TECM_W1)%9+1,0,0);
501 
502  LogTrace("TkLayerMap") << "[TkLayerMap::createTEC] layer side " << (layerEnumNb-TkLayerMap::TECM_W1)/9+1 << " " << (layerEnumNb-TkLayerMap::TECM_W1)%9+1 << " number of dets " << LayerDetIdList.size() << " lowY " << lowY << " high " << highY << " Nstring " << Nstring_ext;
503 
504  XYbin xyb;
505 
506  for(size_t j=0;j<LayerDetIdList.size();++j){
507  xyb=getXY_TEC(LayerDetIdList[j],layerEnumNb);
508  binToDet[(xyb.ix-1)+nchX*(xyb.iy-1)]=LayerDetIdList[j];
509  LogTrace("TkLayerMap") << "[TkLayerMap::createTEC] " << LayerDetIdList[j]<< " " << xyb.ix << " " << xyb.iy << " " << xyb.x << " " << xyb.y ;
510 
511  }
512 }
513 
514 
515 const TkLayerMap::XYbin TkLayerMap::getXY(uint32_t detid, int layerEnumNb) const {
516  LogTrace("TkLayerMap") << "[TkLayerMap::getXY] " << detid << " layer " << layerEnumNb;
517 
518  if(!layerEnumNb)
519  layerEnumNb=layerSearch(detid);
520 
521  if(layerEnumNb!=layerEnumNb_)
522  throw cms::Exception("CorruptedData")
523  << "[TkLayerMap::getXY] Fill of DetId " << detid << " layerEnumNb " << layerEnumNb << " are requested to wrong TkLayerMap " << layerEnumNb_ << " \nPlease check the TkDetMap code";
524 
525 
526  if(layerEnumNb>=TkLayerMap::TIB_L1 && layerEnumNb<=TkLayerMap::TIB_L4)
527  return getXY_TIB(detid,layerEnumNb);
528  else if(layerEnumNb>=TkLayerMap::TIDM_D1 && layerEnumNb<=TkLayerMap::TIDP_D3)
529  return getXY_TID(detid,layerEnumNb);
530  else if(layerEnumNb>=TkLayerMap::TOB_L1 && layerEnumNb<=TkLayerMap::TOB_L6)
531  return getXY_TOB(detid,layerEnumNb);
532  else
533  return getXY_TEC(detid,layerEnumNb);
534 }
535 
536 uint32_t TkLayerMap::get_Offset( TIBDetId D ) const {
537  if(D.layerNumber()%2)
538  return D.isInternalString()?2:1;
539  else
540  return D.isInternalString()?1:2;
541 }
542 
543 
544 TkLayerMap::XYbin TkLayerMap::getXY_TIB(uint32_t detid, int layerEnumNb) const {
545  if(!layerEnumNb)
546  layerEnumNb=layerSearch(detid);
547 
548  TIBDetId D(detid);
549 
550  XYbin xyb;
551  xyb.ix=2*(D.isZMinusSide()?-1*D.moduleNumber()+3:D.moduleNumber()+2)+get_Offset(D);
553  if(D.layerNumber()<3 && !D.isStereo())
554  xyb.iy+=Nstring_ext+2;
555 
556  xyb.x=lowX+xyb.ix-0.5;
557  xyb.y=lowY+xyb.iy-0.5;
558  return xyb;
559 
560 }
561 
562 TkLayerMap::XYbin TkLayerMap::getXY_TOB(uint32_t detid, int layerEnumNb) const {
563  if(!layerEnumNb)
564  layerEnumNb=layerSearch(detid);
565 
566  TOBDetId D(detid);
567 
568  XYbin xyb;
569  xyb.ix=D.isZMinusSide()?-1*D.moduleNumber()+7:D.moduleNumber()+6;
570  xyb.iy=D.rodNumber();
571  if(D.layerNumber()<3 && !D.isStereo())
572  xyb.iy+=Nrod+2;
573 
574  xyb.x=lowX+xyb.ix-0.5;
575  xyb.y=lowY+xyb.iy-0.5;
576  return xyb;
577 }
578 
579 TkLayerMap::XYbin TkLayerMap::getXY_TID(uint32_t detid, int layerEnumNb) const {
580  if(!layerEnumNb)
581  layerEnumNb=layerSearch(detid);
582 
583  TIDDetId D(detid);
584 
585  XYbin xyb;
586 
587  xyb.ix=D.isZMinusSide()?-3*D.ring()+10:3*D.ring()-2;
588  if(D.isStereo())
589  xyb.ix+=(D.isZMinusSide()?-1:1);
590  xyb.iy= int(2. * D.moduleNumber() - (D.isBackRing()?0.:1.));
591 
592  xyb.x=lowX+xyb.ix-0.5;
593  xyb.y=lowY+xyb.iy-0.5;
594  return xyb;
595 }
596 
597 TkLayerMap::XYbin TkLayerMap::getXY_TEC(uint32_t detid, int layerEnumNb) const {
598  if(!layerEnumNb)
599  layerEnumNb=layerSearch(detid);
600 
601  TECDetId D(detid);
602 
603  XYbin xyb;
604 
605  xyb.ix=D.isZMinusSide()?BinForRing[7]-BinForRing[D.ring()]+1:BinForRing[D.ring()]; //after the introduction of plus and minus histos, the BinForRing should have been changed. on the contrary we hack this part of the code
606  if(D.isStereo())
607  xyb.ix+=(D.isZMinusSide()?-1:1);
608 
609  if(D.isZMinusSide()){
611  if(D.isBackPetal())
612  xyb.iy+=ModulesInRingBack[D.ring()];
613  }else{
615  if(D.isBackPetal())
616  xyb.iy+=ModulesInRingFront[D.ring()];
617  }
618 
619  xyb.x=lowX+xyb.ix-0.5;
620  xyb.y=lowY+xyb.iy-0.5;
621  return xyb;
622 }
623 
624 //--------------------------------------
625 
627  doMe();
628 }
629 
631  doMe();
632 }
633 
635  LogTrace("TkDetMap") <<"TkDetMap::constructor ";
636 
637  TkMap.resize(35);
638  //Create TkLayerMap for each layer declared in the TkLayerEnum
639  for(int layer=1;layer<35;++layer){
640  TkMap[layer]=new TkLayerMap(layer);
641  }
642 }
643 
645  detmapType::iterator iter=TkMap.begin();
646  detmapType::iterator iterE=TkMap.end();
647 
648  for(;iter!=iterE;++iter)
649  delete (*iter);
650 }
651 
652 const TkLayerMap::XYbin& TkDetMap::getXY(uint32_t& detid , uint32_t& cached_detid , int16_t& cached_layer , TkLayerMap::XYbin& cached_XYbin) const {
653  LogTrace("TkDetMap") <<"[getXY] detid "<< detid << " cache " << cached_detid << " layer " << cached_layer << " XY " << cached_XYbin.ix << " " << cached_XYbin.iy << " " << cached_XYbin.x << " " << cached_XYbin.y ;
654  if(detid==cached_detid)
655  return cached_XYbin;
656 
657  /*FIXME*/
658  //if (layer!=INVALID)
659  FindLayer(detid , cached_detid , cached_layer , cached_XYbin );
660  LogTrace("TkDetMap") <<"[getXY] detid "<< detid << " cache " << cached_detid << " layer " << cached_layer << " XY " << cached_XYbin.ix << " " << cached_XYbin.iy << " " << cached_XYbin.x << " " << cached_XYbin.y ;
661  return cached_XYbin;
662 }
663 
664 int16_t TkDetMap::FindLayer(uint32_t& detid , uint32_t& cached_detid , int16_t& cached_layer , TkLayerMap::XYbin& cached_XYbin) const {
665 
666  if(detid==cached_detid)
667  return cached_layer;
668 
669  cached_detid=detid;
670 
671  int16_t layer=TkLayerMap::layerSearch(detid);
672  LogTrace("TkDetMap") <<"[FindLayer] detid "<< detid << " layer " << layer;
673  if(layer!=cached_layer){
674  cached_layer=layer;
675  }
676  cached_XYbin=TkMap[cached_layer]->getXY(detid,layer);
677  LogTrace("TkDetMap") <<"[FindLayer] detid "<< detid << " cached_XYbin " << cached_XYbin.ix << " "<< cached_XYbin.iy;
678 
679  return cached_layer;
680 }
681 
682 
683 
684 void TkDetMap::getComponents(int layer,
685  int& nchX,double& lowX,double& highX,
686  int& nchY,double& lowY,double& highY) const {
687  nchX=TkMap[layer]->get_nchX();
688  lowX=TkMap[layer]->get_lowX();
689  highX=TkMap[layer]->get_highX();
690  nchY=TkMap[layer]->get_nchY();
691  lowY=TkMap[layer]->get_lowY();
692  highY=TkMap[layer]->get_highY();
693 }
694 
695 void TkDetMap::getDetsForLayer(int layer,std::vector<uint32_t>& output) const {
696  output.clear();
697  size_t size_=TkMap[layer]->get_nchX()*TkMap[layer]->get_nchY();
698  output.resize(size_);
699  memcpy((void*)&output[0],(void*)TkMap[layer]->getBinToDet(),size_*sizeof(uint32_t));
700 }
701 
703  switch (in)
704  {
705  case TkLayerMap::TIB_L1:
706  return "TIB_L1";
707  case TkLayerMap::TIB_L2:
708  return "TIB_L2";
709  case TkLayerMap::TIB_L3:
710  return "TIB_L3";
711  case TkLayerMap::TIB_L4:
712  return "TIB_L4";
713  case TkLayerMap::TIDP_D1:
714  return "TIDP_D1";
715  case TkLayerMap::TIDP_D2:
716  return "TIDP_D2";
717  case TkLayerMap::TIDP_D3:
718  return "TIDP_D3";
719  case TkLayerMap::TIDM_D1:
720  return "TIDM_D1";
721  case TkLayerMap::TIDM_D2:
722  return "TIDM_D2";
723  case TkLayerMap::TIDM_D3:
724  return "TIDM_D3";
725  case TkLayerMap::TOB_L1:
726  return "TOB_L1";
727  case TkLayerMap::TOB_L2:
728  return "TOB_L2";
729  case TkLayerMap::TOB_L3:
730  return "TOB_L3";
731  case TkLayerMap::TOB_L4:
732  return "TOB_L4";
733  case TkLayerMap::TOB_L5:
734  return "TOB_L5";
735  case TkLayerMap::TOB_L6:
736  return "TOB_L6";
737  case TkLayerMap::TECP_W1:
738  return "TECP_W1";
739  case TkLayerMap::TECP_W2:
740  return "TECP_W2";
741  case TkLayerMap::TECP_W3:
742  return "TECP_W3";
743  case TkLayerMap::TECP_W4:
744  return "TECP_W4";
745  case TkLayerMap::TECP_W5:
746  return "TECP_W5";
747  case TkLayerMap::TECP_W6:
748  return "TECP_W6";
749  case TkLayerMap::TECP_W7:
750  return "TECP_W7";
751  case TkLayerMap::TECP_W8:
752  return "TECP_W8";
753  case TkLayerMap::TECP_W9:
754  return "TECP_W9";
755  case TkLayerMap::TECM_W1:
756  return "TECM_W1";
757  case TkLayerMap::TECM_W2:
758  return "TECM_W2";
759  case TkLayerMap::TECM_W3:
760  return "TECM_W3";
761  case TkLayerMap::TECM_W4:
762  return "TECM_W4";
763  case TkLayerMap::TECM_W5:
764  return "TECM_W5";
765  case TkLayerMap::TECM_W6:
766  return "TECM_W6";
767  case TkLayerMap::TECM_W7:
768  return "TECM_W7";
769  case TkLayerMap::TECM_W8:
770  return "TECM_W8";
771  case TkLayerMap::TECM_W9:
772  return "TECM_W9";
773  }
774  return "Invalid";
775 }
776 
778  if(in.compare( "TIB_L1")==0)
779  return TkLayerMap::TIB_L1;
780  if(in.compare( "TIB_L2")==0)
781  return TkLayerMap::TIB_L2;
782  if(in.compare( "TIB_L3")==0)
783  return TkLayerMap::TIB_L3;
784  if(in.compare( "TIB_L4")==0)
785  return TkLayerMap::TIB_L4;
786  if(in.compare( "TIDP_D1")==0)
787  return TkLayerMap::TIDP_D1;
788  if(in.compare( "TIDP_D2")==0)
789  return TkLayerMap::TIDP_D2;
790  if(in.compare( "TIDP_D3")==0)
791  return TkLayerMap::TIDP_D3;
792  if(in.compare( "TIDM_D1")==0)
793  return TkLayerMap::TIDM_D1;
794  if(in.compare( "TIDM_D2")==0)
795  return TkLayerMap::TIDM_D2;
796  if(in.compare( "TIDM_D3")==0)
797  return TkLayerMap::TIDM_D3;
798  if(in.compare( "TOB_L1")==0)
799  return TkLayerMap::TOB_L1;
800  if(in.compare( "TOB_L2")==0)
801  return TkLayerMap::TOB_L2;
802  if(in.compare( "TOB_L3")==0)
803  return TkLayerMap::TOB_L3;
804  if(in.compare( "TOB_L4")==0)
805  return TkLayerMap::TOB_L4;
806  if(in.compare( "TOB_L5")==0)
807  return TkLayerMap::TOB_L5;
808  if(in.compare( "TOB_L6")==0)
809  return TkLayerMap::TOB_L6;
810  if(in.compare( "TECP_W1")==0)
811  return TkLayerMap::TECP_W1;
812  if(in.compare( "TECP_W2")==0)
813  return TkLayerMap::TECP_W2;
814  if(in.compare( "TECP_W3")==0)
815  return TkLayerMap::TECP_W3;
816  if(in.compare( "TECP_W4")==0)
817  return TkLayerMap::TECP_W4;
818  if(in.compare( "TECP_W5")==0)
819  return TkLayerMap::TECP_W5;
820  if(in.compare( "TECP_W6")==0)
821  return TkLayerMap::TECP_W6;
822  if(in.compare( "TECP_W7")==0)
823  return TkLayerMap::TECP_W7;
824  if(in.compare( "TECP_W8")==0)
825  return TkLayerMap::TECP_W8;
826  if(in.compare( "TECP_W9")==0)
827  return TkLayerMap::TECP_W9;
828  if(in.compare( "TECM_W1")==0)
829  return TkLayerMap::TECM_W1;
830  if(in.compare( "TECM_W2")==0)
831  return TkLayerMap::TECM_W2;
832  if(in.compare( "TECM_W3")==0)
833  return TkLayerMap::TECM_W3;
834  if(in.compare( "TECM_W4")==0)
835  return TkLayerMap::TECM_W4;
836  if(in.compare( "TECM_W5")==0)
837  return TkLayerMap::TECM_W5;
838  if(in.compare( "TECM_W6")==0)
839  return TkLayerMap::TECM_W6;
840  if(in.compare( "TECM_W7")==0)
841  return TkLayerMap::TECM_W7;
842  if(in.compare( "TECM_W8")==0)
843  return TkLayerMap::TECM_W8;
844  if(in.compare( "TECM_W9")==0)
845  return TkLayerMap::TECM_W9;
846  return 0;
847 }
848 
849 void TkDetMap::getSubDetLayerSide(int& in,SiStripDetId::SubDetector& subDet,uint32_t& layer,uint32_t& side) const {
850  switch (in)
851  {
852  case TkLayerMap::TIB_L1:
853  subDet = SiStripDetId::TIB;
854  layer = 1;
855  break;
856  case TkLayerMap::TIB_L2:
857  subDet = SiStripDetId::TIB;
858  layer = 2;
859  break;
860  case TkLayerMap::TIB_L3:
861  subDet = SiStripDetId::TIB;
862  layer = 3;
863  break;
864  case TkLayerMap::TIB_L4:
865  subDet = SiStripDetId::TIB;
866  layer = 4;
867  break;
868  case TkLayerMap::TIDP_D1:
869  subDet = SiStripDetId::TID;
870  layer = 1;
871  side=2;
872  break;
873  case TkLayerMap::TIDP_D2:
874  subDet = SiStripDetId::TID;
875  layer = 2;
876  side=2;
877  break;
878  case TkLayerMap::TIDP_D3:
879  subDet = SiStripDetId::TID;
880  layer = 3;
881  side=2;
882  break;
883  case TkLayerMap::TIDM_D1:
884  subDet = SiStripDetId::TID;
885  layer = 1;
886  side=1;
887  break;
888  case TkLayerMap::TIDM_D2:
889  subDet = SiStripDetId::TID;
890  layer = 2;
891  side=1;
892  break;
893  case TkLayerMap::TIDM_D3:
894  subDet = SiStripDetId::TID;
895  layer = 3;
896  side=1;
897  break;
898  case TkLayerMap::TOB_L1:
899  subDet = SiStripDetId::TOB;
900  layer = 1;
901  break;
902  case TkLayerMap::TOB_L2:
903  subDet = SiStripDetId::TOB;
904  layer = 2;
905  break;
906  case TkLayerMap::TOB_L3:
907  subDet = SiStripDetId::TOB;
908  layer = 3;
909  break;
910  case TkLayerMap::TOB_L4:
911  subDet = SiStripDetId::TOB;
912  layer = 4;
913  break;
914  case TkLayerMap::TOB_L5:
915  subDet = SiStripDetId::TOB;
916  layer = 5;
917  break;
918  case TkLayerMap::TOB_L6:
919  subDet = SiStripDetId::TOB;
920  layer = 6;
921  break;
922  case TkLayerMap::TECP_W1:
923  subDet = SiStripDetId::TEC;
924  layer = 1;
925  side=2;
926  break;
927  case TkLayerMap::TECP_W2:
928  subDet = SiStripDetId::TEC;
929  layer = 2;
930  side=2;
931  break;
932  case TkLayerMap::TECP_W3:
933  subDet = SiStripDetId::TEC;
934  layer = 3;
935  side=2;
936  break;
937  case TkLayerMap::TECP_W4:
938  subDet = SiStripDetId::TEC;
939  layer = 4;
940  side=2;
941  break;
942  case TkLayerMap::TECP_W5:
943  subDet = SiStripDetId::TEC;
944  layer = 5;
945  side=2;
946  break;
947  case TkLayerMap::TECP_W6:
948  subDet = SiStripDetId::TEC;
949  layer = 6;
950  side=2;
951  break;
952  case TkLayerMap::TECP_W7:
953  subDet = SiStripDetId::TEC;
954  layer = 7;
955  side=2;
956  break;
957  case TkLayerMap::TECP_W8:
958  subDet = SiStripDetId::TEC;
959  layer = 8;
960  side=2;
961  break;
962  case TkLayerMap::TECP_W9:
963  subDet = SiStripDetId::TEC;
964  layer = 9;
965  side=2;
966  break;
967  case TkLayerMap::TECM_W1:
968  subDet = SiStripDetId::TEC;
969  layer = 1;
970  side=1;
971  break;
972  case TkLayerMap::TECM_W2:
973  subDet = SiStripDetId::TEC;
974  layer = 2;
975  side=1;
976  break;
977  case TkLayerMap::TECM_W3:
978  subDet = SiStripDetId::TEC;
979  layer = 3;
980  side=1;
981  break;
982  case TkLayerMap::TECM_W4:
983  subDet = SiStripDetId::TEC;
984  layer = 4;
985  side=1;
986  break;
987  case TkLayerMap::TECM_W5:
988  subDet = SiStripDetId::TEC;
989  layer = 5;
990  side=1;
991  break;
992  case TkLayerMap::TECM_W6:
993  subDet = SiStripDetId::TEC;
994  layer = 6;
995  side=1;
996  break;
997  case TkLayerMap::TECM_W7:
998  subDet = SiStripDetId::TEC;
999  layer = 7;
1000  side=1;
1001  break;
1002  case TkLayerMap::TECM_W8:
1003  subDet = SiStripDetId::TEC;
1004  layer = 8;
1005  side=1;
1006  break;
1007  case TkLayerMap::TECM_W9:
1008  subDet = SiStripDetId::TEC;
1009  layer = 9;
1010  side=1;
1011  break;
1012  }
1013 }
1014 
1015 // LocalWords: TkLayerMap
int getLayerNum(const std::string &in) const
Definition: TkDetMap.cc:777
bool isZMinusSide() const
Definition: TIBDetId.h:79
unsigned int rodNumber() const
Definition: TOBDetId.h:77
TkLayerMap(int in)
Definition: TkDetMap.cc:14
uint32_t getDetFromBin(int ix, int iy) const
Definition: TkDetMap.cc:81
unsigned int petalNumber() const
Definition: TECDetId.h:94
unsigned int stringNumber() const
Definition: TIBDetId.h:87
bool isStereo()
Definition: TIDDetId.h:109
XYbin getXY_TID(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:579
TkDetMap()
Definition: TkDetMap.cc:630
void createTEC(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:494
bool isBackRing() const
Definition: TIDDetId.h:85
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
XYbin getXY_TEC(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:597
unsigned int side() const
positive or negative id
Definition: TECDetId.h:47
uint32_t * binToDet
Definition: TkDetMap.h:97
unsigned int layerNumber() const
Definition: TIBDetId.h:83
int layerEnumNb_
Definition: TkDetMap.h:99
std::vector< uint32_t > BinForRing
Definition: TkDetMap.h:105
~TkDetMap()
Definition: TkDetMap.cc:644
bool isZMinusSide() const
Definition: TOBDetId.h:69
bool isZMinusSide() const
Definition: TECDetId.h:86
uint32_t Nrod
Definition: TkDetMap.h:106
const std::vector< uint32_t > & getAllDetIds() const
unsigned int layerNumber() const
Definition: TOBDetId.h:73
void getTOBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tobDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t rod=0) const
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
unsigned int moduleNumber() const
Definition: TIBDetId.h:91
bool isStereo()
Definition: TECDetId.h:118
unsigned int ring() const
ring id
Definition: TIDDetId.h:55
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
#define LogTrace(id)
bool isStereo()
Definition: TOBDetId.h:89
unsigned int moduleNumber() const
Definition: TECDetId.h:102
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
void getComponents(int layer, int &nchX, double &lowX, double &highX, int &nchY, double &lowY, double &highY) const
Definition: TkDetMap.cc:684
bool isZMinusSide() const
Definition: TIDDetId.h:81
void createTID(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:475
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:151
XYbin getXY_TIB(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:544
bool isBackPetal() const
Definition: TECDetId.h:106
unsigned int side() const
positive or negative id
Definition: TIDDetId.h:45
void createTOB(std::vector< uint32_t > &TkDetIdList, int layer)
Definition: TkDetMap.cc:456
uint32_t get_Offset(TIBDetId) const
Definition: TkDetMap.cc:536
bool isInternalString() const
Definition: TIBDetId.h:95
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
double lowY
Definition: TkDetMap.h:103
void getTECDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tecDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t petal_bkw_frw=0, uint32_t petal=0, uint32_t ring=0, uint32_t ster=0) const
const XYbin getXY(uint32_t detid, int layerEnumNb=0) const
Definition: TkDetMap.cc:515
bool isStereo()
Definition: TIBDetId.h:107
int nchY
Definition: TkDetMap.h:101
double a
Definition: hdecay.h:121
void initialize(int layer)
Definition: TkDetMap.cc:109
void getTIBDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tibDetRawIds, uint32_t layer=0, uint32_t bkw_frw=0, uint32_t int_ext=0, uint32_t string=0) const
unsigned int ring() const
ring id
Definition: TECDetId.h:71
std::vector< uint32_t > ModulesInRingBack
Definition: TkDetMap.h:105
int16_t FindLayer(uint32_t &detid, uint32_t &cached_detid, int16_t &cached_layer, TkLayerMap::XYbin &cached_XYbin) const
Definition: TkDetMap.cc:664
void getTIDDetectors(const std::vector< uint32_t > &inputDetRawIds, std::vector< uint32_t > &tidDetRawIds, uint32_t side=0, uint32_t wheel=0, uint32_t ring=0, uint32_t ster=0) const
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
unsigned int moduleNumber() const
Definition: TIDDetId.h:101
double lowX
Definition: TkDetMap.h:102
int nchX
Definition: TkDetMap.h:100
void doMe()
Definition: TkDetMap.cc:634
unsigned int moduleNumber() const
Definition: TOBDetId.h:81
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50
double highY
Definition: TkDetMap.h:103