CMS 3D CMS Logo

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