CMS 3D CMS Logo

PixelBarrelName.cc
Go to the documentation of this file.
2 
4 
5 //#include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
7 
8 #include <sstream>
9 #include <iostream>
10 
11 using namespace std;
12 
13 namespace {
14  // ladder limits
15  // for phase 0
16  const int lL[2][12] = {{5, 15, 26, 8, 24, 41, 11, 33, 56, 0, 0, 0}, {3, 9, 16, 7, 21, 36, 11, 33, 56, 16, 48, 81}};
17  // for phase 1
18  //const int lL[12] ={ 3, 9,16, 7,21,36,11,33,56,16,48,81};
19  //const bool phase1 = false; // this has to come from the trackerTopology class
20 } // namespace
21 
23  : PixelModuleName(true), thePart(mO), theLayer(0), theModule(0), theLadder(0), phase1(phase) {
24  theLayer = tt->pxbLayer(id);
25  int oldModule = tt->pxbModule(id); // CMSSW convention
26  int oldLadder = tt->pxbLadder(id); // CMSSW convention
27 
28  int ladder = convertLadderNumber(oldLadder); // convert to online convention
29  int module = oldModule - 4; // convert
30  if (module <= 0)
31  module--;
32 
33  //
34  // part
35  //
36  if (module < 0 && ladder < 0)
37  thePart = mO;
38  else if (module > 0 && ladder < 0)
39  thePart = pO;
40  else if (module < 0 && ladder > 0)
41  thePart = mI;
42  else if (module > 0 && ladder > 0)
43  thePart = pI;
44 
45  //
46  // ladder
47  //
48  theLadder = abs(ladder);
49 
50  //
51  // module
52  //
53  theModule = abs(module);
54 }
55 
56 // Old constructor, works with the old pixel classes DO NOT USE
58  : PixelModuleName(true), thePart(mO), theLayer(0), theModule(0), theLadder(0), phase1(phase) {
59  // uint32_t rawId = id.rawId();
60  PXBDetId cmssw_numbering(id);
61 
62  theLayer = cmssw_numbering.layer();
63 
64  int oldModule = cmssw_numbering.module() - 4;
65  if (oldModule <= 0)
66  oldModule--;
67  int oldLadder = cmssw_numbering.ladder();
68 
69  if (phase1) { // phase 1
70 
71  if (theLayer == 1) {
72  if (oldLadder <= 3)
73  oldLadder = 4 - oldLadder; // +1, ..., +3
74  else if (oldLadder >= 4 && oldLadder <= 9)
75  oldLadder = 3 - oldLadder; // -1, ..., -6
76  else if (oldLadder >= 10)
77  oldLadder = 16 - oldLadder; // +6, ..., +4
78  } else if (theLayer == 2) {
79  if (oldLadder <= 7)
80  oldLadder = 8 - oldLadder;
81  else if (oldLadder >= 8 && oldLadder <= 21)
82  oldLadder = 7 - oldLadder;
83  else if (oldLadder >= 22)
84  oldLadder = 36 - oldLadder;
85  } else if (theLayer == 3) {
86  if (oldLadder <= 11)
87  oldLadder = 12 - oldLadder;
88  else if (oldLadder >= 12 && oldLadder <= 33)
89  oldLadder = 11 - oldLadder;
90  else if (oldLadder >= 34)
91  oldLadder = 56 - oldLadder;
92  } else if (theLayer == 4) {
93  if (oldLadder <= 16)
94  oldLadder = 17 - oldLadder;
95  else if (oldLadder >= 17 && oldLadder <= 48)
96  oldLadder = 16 - oldLadder;
97  else if (oldLadder >= 49)
98  oldLadder = 81 - oldLadder;
99  }
100 
101  } else { // phase 0
102 
103  if (theLayer == 1) {
104  if (oldLadder <= 5)
105  oldLadder = 6 - oldLadder;
106  else if (oldLadder >= 6 && oldLadder <= 15)
107  oldLadder = 5 - oldLadder;
108  else if (oldLadder >= 16)
109  oldLadder = 26 - oldLadder;
110  } else if (theLayer == 2) {
111  if (oldLadder <= 8)
112  oldLadder = 9 - oldLadder;
113  else if (oldLadder >= 9 && oldLadder <= 24)
114  oldLadder = 8 - oldLadder;
115  else if (oldLadder >= 25)
116  oldLadder = 41 - oldLadder;
117  } else if (theLayer == 3) {
118  if (oldLadder <= 11)
119  oldLadder = 12 - oldLadder;
120  else if (oldLadder >= 12 && oldLadder <= 33)
121  oldLadder = 11 - oldLadder;
122  else if (oldLadder >= 34)
123  oldLadder = 56 - oldLadder;
124  }
125  } // end phase 0/1
126 
127  //
128  // part
129  //
130  if (oldModule < 0 && oldLadder < 0)
131  thePart = mO;
132  else if (oldModule > 0 && oldLadder < 0)
133  thePart = pO;
134  else if (oldModule < 0 && oldLadder > 0)
135  thePart = mI;
136  else if (oldModule > 0 && oldLadder > 0)
137  thePart = pI;
138 
139  //
140  // ladder
141  //
142  theLadder = abs(oldLadder);
143 
144  //
145  // module
146  //
147  theModule = abs(oldModule);
148 }
149 
150 // convert ladder number
152  int ladder = -1;
153  int ind = 0;
154  if (phase1)
155  ind = 1;
156 
157  if (theLayer == 1) {
158  if (oldLadder <= lL[ind][0])
159  ladder = (lL[ind][0] + 1) - oldLadder;
160  else if (oldLadder >= (lL[ind][0] + 1) && oldLadder <= lL[ind][1])
161  ladder = lL[ind][0] - oldLadder;
162  else if (oldLadder >= (lL[ind][1] + 1))
163  ladder = lL[ind][2] - oldLadder;
164 
165  } else if (theLayer == 2) {
166  if (oldLadder <= lL[ind][3])
167  ladder = (lL[ind][3] + 1) - oldLadder;
168  else if (oldLadder >= (lL[ind][3] + 1) && oldLadder <= lL[ind][4])
169  ladder = lL[ind][3] - oldLadder;
170  else if (oldLadder >= (lL[ind][4] + 1))
171  ladder = lL[ind][5] - oldLadder;
172 
173  } else if (theLayer == 3) {
174  if (oldLadder <= lL[ind][6])
175  ladder = (lL[ind][6] + 1) - oldLadder;
176  else if (oldLadder >= (lL[ind][6] + 1) && oldLadder <= lL[ind][7])
177  ladder = lL[ind][6] - oldLadder;
178  else if (oldLadder >= (lL[ind][7] + 1))
179  ladder = lL[ind][8] - oldLadder;
180 
181  } else if (theLayer == 4) {
182  if (oldLadder <= lL[ind][9])
183  ladder = (lL[ind][9] + 1) - oldLadder;
184  else if (oldLadder >= (lL[ind][9] + 1) && oldLadder <= lL[ind][10])
185  ladder = lL[ind][9] - oldLadder;
186  else if (oldLadder >= (lL[ind][10] + 1))
187  ladder = lL[ind][11] - oldLadder;
188  }
189 
190  return ladder;
191 }
192 
193 // constructor from name string
195  : PixelModuleName(true), thePart(mO), theLayer(0), theModule(0), theLadder(0), phase1(phase) {
196  // parse the name string
197  // first, check to make sure this is an BPix name, should start with "BPix_"
198  // also check to make sure the needed parts are present
199  if ((name.substr(0, 5) != "BPix_") || (name.find("_B") == string::npos) || (name.find("_LYR") == string::npos) ||
200  (name.find("_LDR") == string::npos) || (name.find("_MOD") == string::npos)) {
201  edm::LogError("BadNameString|SiPixel")
202  << "Bad name string in PixelBarrelName::PixelBarrelName(std::string): " << name;
203  return;
204  }
205 
206  // strip off ROC part if it's there
207  if (name.find("_ROC") != string::npos)
208  name = name.substr(0, name.find("_ROC"));
209 
210  // find shell
211  string shellString = name.substr(name.find("_B") + 2, name.find("_SEC") - name.find("_B") - 2);
212  if (shellString == "mO")
213  thePart = mO;
214  else if (shellString == "mI")
215  thePart = mI;
216  else if (shellString == "pO")
217  thePart = pO;
218  else if (shellString == "pI")
219  thePart = pI;
220  else {
221  edm::LogError("BadNameString|SiPixel")
222  << "Unable to determine shell in PixelBarrelName::PixelBarrelName(std::string): " << name;
223  }
224 
225  // find the layer
226  string layerString = name.substr(name.find("_LYR") + 4, name.find("_LDR") - name.find("_LYR") - 4);
227  if (layerString == "1")
228  theLayer = 1;
229  else if (layerString == "2")
230  theLayer = 2;
231  else if (layerString == "3")
232  theLayer = 3;
233  else if (phase1 && layerString == "4")
234  theLayer = 4;
235  else {
236  edm::LogError("BadNameString|SiPixel")
237  << "Unable to determine layer in PixelBarrelName::PixelBarrelName(std::string): " << name;
238  }
239 
240  // find the ladder
241  string ladderString = name.substr(name.find("_LDR") + 4, name.find("_MOD") - name.find("_LDR") - 4);
242 
243  if (phase1) { // phase 1 ladders
244  // do we want to kee the "F" for phase1?
245  if (ladderString.substr(ladderString.size() - 1, 1) == "F") {
246  int ladderNum = atoi(ladderString.substr(0, ladderString.size() - 1).c_str());
247  if (theLayer == 1 && ladderNum >= 1 && ladderNum <= 6)
248  theLadder = ladderNum;
249  else if (theLayer == 2 && ladderNum >= 1 && ladderNum <= 14)
250  theLadder = ladderNum;
251  else if (theLayer == 3 && ladderNum >= 1 && ladderNum <= 22)
252  theLadder = ladderNum;
253  else if (theLayer == 4 && ladderNum >= 1 && ladderNum <= 32)
254  theLadder = ladderNum;
255  else {
256  edm::LogError("BadNameString|SiPixel")
257  << "Unable to determine ladder in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
258  }
259  } // full ladders
260  else {
261  edm::LogError("BadNameString|SiPixel")
262  << "Unable to determine ladder in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
263  }
264 
265  } else { // phase 0 ladders
266 
267  if (ladderString == "1H")
268  theLadder = 1;
269  else if (ladderString == "10H" && theLayer == 1)
270  theLadder = 10;
271  else if (ladderString == "16H" && theLayer == 2)
272  theLadder = 16;
273  else if (ladderString == "22H" && theLayer == 3)
274  theLadder = 22;
275  else if (ladderString.substr(ladderString.size() - 1, 1) == "F") {
276  int ladderNum = atoi(ladderString.substr(0, ladderString.size() - 1).c_str());
277  if (theLayer == 1 && ladderNum > 1 && ladderNum < 10)
278  theLadder = ladderNum;
279  else if (theLayer == 2 && ladderNum > 1 && ladderNum < 16)
280  theLadder = ladderNum;
281  else if (theLayer == 3 && ladderNum > 1 && ladderNum < 22)
282  theLadder = ladderNum;
283  else {
284  edm::LogError("BadNameString|SiPixel")
285  << "Unable to determine ladder in PixelBarrelName::PixelBarrelName(std::string): " << name;
286  }
287  } // full ladders
288  else {
289  edm::LogError("BadNameString|SiPixel")
290  << "Unable to determine ladder in PixelBarrelName::PixelBarrelName(std::string): " << name;
291  }
292  } // phase0/1
293 
294  // find the module
295  string moduleString = name.substr(name.find("_MOD") + 4, name.size() - name.find("_MOD") - 4);
296  if (moduleString == "1")
297  theModule = 1;
298  else if (moduleString == "2")
299  theModule = 2;
300  else if (moduleString == "3")
301  theModule = 3;
302  else if (moduleString == "4")
303  theModule = 4;
304  else {
305  edm::LogError("BadNameString|SiPixel")
306  << "Unable to determine module in PixelBarrelName::PixelBarrelName(std::string): " << name;
307  }
308 
309 } // PixelBarrelName::PixelBarrelName(std::string name)
310 
312  int sector = 0;
313 
314  if (theLayer == 1) {
315  if (phase1) { // phase 1
316  // Layer 1 for phase1 is special, modules on a ladder are shared in different sectors
317  // Ladder Module Sector
318  // 1 2,3,4 1
319  // 1 1 2
320  // 2 3,4 2
321  // 2 1,2 3
322  // 3 4 3
323  // 3 1,2,3 4
324  // 4 2,3,4 5
325  // 4 1 6
326  // 5 3,4 6
327  // 5 1,2 7
328  // 6 4 7
329  // 6 1,2,3 8
330 
331  switch (theLadder) {
332  case 1: { // ladder 1
333  if (theModule >= 2) {
334  sector = 1;
335  break;
336  } // mods 2,3,4
337  else {
338  sector = 2;
339  break;
340  } // mods 1
341  }
342  case 2: { // ladder 2
343  if (theModule >= 3) {
344  sector = 2;
345  break;
346  } // mods 3,4
347  else {
348  sector = 3;
349  break;
350  } // mods 1,2
351  }
352  case 3: { // ladder 3
353  if (theModule >= 4) {
354  sector = 3;
355  break;
356  } else {
357  sector = 4;
358  break;
359  }
360  sector = 3;
361  break;
362  }
363  case 4: { // ladder 4
364  if (theModule >= 2) {
365  sector = 5;
366  break;
367  } else {
368  sector = 6;
369  break;
370  }
371  sector = 6;
372  break;
373  }
374  case 5: { // ladder 5
375  if (theModule >= 3) {
376  sector = 6;
377  break;
378  } else {
379  sector = 7;
380  break;
381  }
382  sector = 7;
383  break;
384  }
385  case 6: { // ladder 6
386  if (theModule >= 4) {
387  sector = 7;
388  break;
389  } // mods 4
390  else {
391  sector = 8;
392  break;
393  } // mods 1,2,3
394  sector = 8;
395  break;
396  }
397  default:;
398  };
399 
400  } else { // phase 0
401  switch (theLadder) {
402  case 1:
403  case 2: {
404  sector = 1;
405  break;
406  }
407  case 3: {
408  sector = 2;
409  break;
410  }
411  case 4: {
412  sector = 3;
413  break;
414  }
415  case 5: {
416  sector = 4;
417  break;
418  }
419  case 6: {
420  sector = 5;
421  break;
422  }
423  case 7: {
424  sector = 6;
425  break;
426  }
427  case 8: {
428  sector = 7;
429  break;
430  }
431  case 9:
432  case 10: {
433  sector = 8;
434  break;
435  }
436  default:;
437  };
438  } // phase0/1
439 
440  } else if (theLayer == 2) {
441  if (phase1) { // phase 1
442  switch (theLadder) {
443  case 1:
444  case 2: {
445  sector = 1;
446  break;
447  }
448  case 3:
449  case 4: {
450  sector = 2;
451  break;
452  }
453  case 5: {
454  sector = 3;
455  break;
456  }
457  case 6:
458  case 7: {
459  sector = 4;
460  break;
461  }
462  case 8:
463  case 9: {
464  sector = 5;
465  break;
466  }
467  case 10: {
468  sector = 6;
469  break;
470  }
471  case 11:
472  case 12: {
473  sector = 7;
474  break;
475  }
476  case 13:
477  case 14: {
478  sector = 8;
479  break;
480  }
481  default:;
482  };
483 
484  } else { // phase 0
485  switch (theLadder) {
486  case 1:
487  case 2: {
488  sector = 1;
489  break;
490  }
491  case 3:
492  case 4: {
493  sector = 2;
494  break;
495  }
496  case 5:
497  case 6: {
498  sector = 3;
499  break;
500  }
501  case 7:
502  case 8: {
503  sector = 4;
504  break;
505  }
506  case 9:
507  case 10: {
508  sector = 5;
509  break;
510  }
511  case 11:
512  case 12: {
513  sector = 6;
514  break;
515  }
516  case 13:
517  case 14: {
518  sector = 7;
519  break;
520  }
521  case 15:
522  case 16: {
523  sector = 8;
524  break;
525  }
526  default:;
527  };
528  } // enad phase0/1
529 
530  } else if (theLayer == 3) {
531  if (phase1) { // phase 1
532  switch (theLadder) {
533  case 1:
534  case 2: {
535  sector = 1;
536  break;
537  }
538  case 3:
539  case 4:
540  case 5: {
541  sector = 2;
542  break;
543  }
544  case 6:
545  case 7:
546  case 8: {
547  sector = 3;
548  break;
549  }
550  case 9:
551  case 10:
552  case 11: {
553  sector = 4;
554  break;
555  }
556  case 12:
557  case 13:
558  case 14: {
559  sector = 5;
560  break;
561  }
562  case 15:
563  case 16:
564  case 17: {
565  sector = 6;
566  break;
567  }
568  case 18:
569  case 19:
570  case 20: {
571  sector = 7;
572  break;
573  }
574  case 21:
575  case 22: {
576  sector = 8;
577  break;
578  }
579  default:;
580  };
581 
582  } else { // phase 0
583  switch (theLadder) {
584  case 1:
585  case 2:
586  case 3: {
587  sector = 1;
588  break;
589  }
590  case 4:
591  case 5:
592  case 6: {
593  sector = 2;
594  break;
595  }
596  case 7:
597  case 8:
598  case 9: {
599  sector = 3;
600  break;
601  }
602  case 10:
603  case 11: {
604  sector = 4;
605  break;
606  }
607  case 12:
608  case 13: {
609  sector = 5;
610  break;
611  }
612  case 14:
613  case 15:
614  case 16: {
615  sector = 6;
616  break;
617  }
618  case 17:
619  case 18:
620  case 19: {
621  sector = 7;
622  break;
623  }
624  case 20:
625  case 21:
626  case 22: {
627  sector = 8;
628  break;
629  }
630  default:;
631  };
632  } // end phase 0/1
633 
634  } else if (theLayer == 4) {
635  if (phase1) { // phase 1
636  switch (theLadder) {
637  case 1:
638  case 2:
639  case 3:
640  case 4: {
641  sector = 1;
642  break;
643  }
644  case 5:
645  case 6:
646  case 7:
647  case 8: {
648  sector = 2;
649  break;
650  }
651  case 9:
652  case 10:
653  case 11:
654  case 12: {
655  sector = 3;
656  break;
657  }
658  case 13:
659  case 14:
660  case 15:
661  case 16: {
662  sector = 4;
663  break;
664  }
665  case 17:
666  case 18:
667  case 19:
668  case 20: {
669  sector = 5;
670  break;
671  }
672  case 21:
673  case 22:
674  case 23:
675  case 24: {
676  sector = 6;
677  break;
678  }
679  case 25:
680  case 26:
681  case 27:
682  case 28: {
683  sector = 7;
684  break;
685  }
686  case 29:
687  case 30:
688  case 31:
689  case 32: {
690  sector = 8;
691  break;
692  }
693  default:;
694  };
695  } // end phase1
696 
697  } // layer
698 
699  return sector;
700 }
701 
703  bool halfModule = false;
704 
705  if (!phase1) {
706  if (theLadder == 1)
707  halfModule = true;
708  if (theLayer == 1 && theLadder == 10)
709  halfModule = true;
710  if (theLayer == 2 && theLadder == 16)
711  halfModule = true;
712  if (theLayer == 3 && theLadder == 22)
713  halfModule = true;
714  }
715  return halfModule;
716 }
717 
720 }
721 
723  if (o.isBarrel()) {
724  const PixelBarrelName* other = dynamic_cast<const PixelBarrelName*>(&o);
725  return (other && thePart == other->thePart && theLayer == other->theLayer && theModule == other->theModule &&
726  theLadder == other->theLadder);
727  } else
728  return false;
729 }
730 
731 string PixelBarrelName::name() const {
732  std::ostringstream stm;
733 
734  stm << "BPix_B" << thePart << "_SEC" << sectorName() << "_LYR" << theLayer << "_LDR" << theLadder;
735  if (isHalfModule())
736  stm << "H";
737  else
738  stm << "F";
739  stm << "_MOD" << theModule;
740 
741  return stm.str();
742 }
743 
744 // return the DetId, uses the new topology class
746  uint32_t layer = 0;
747  uint32_t ladder = 0;
748  uint32_t module = 0;
749 
750  layer = layerName();
751  int tmpLadder = ladderName();
752  uint32_t tmpModule = moduleName();
753 
754  // translate the ladder number from the naming convention to the cmssw convention
755  bool outer = false;
756  Shell shell = thePart;
757  int ind = 0;
758  if (phase1)
759  ind = 1;
760  outer = (shell == mO) || (shell == pO);
761  if (outer) {
762  if (layer == 1)
763  ladder = tmpLadder + lL[ind][0];
764  else if (layer == 2)
765  ladder = tmpLadder + lL[ind][3];
766  else if (layer == 3)
767  ladder = tmpLadder + lL[ind][6];
768  else if (layer == 4)
769  ladder = tmpLadder + lL[ind][9];
770  } // outer
771  else { // inner
772  if (layer == 1) {
773  if (tmpLadder <= lL[ind][0])
774  ladder = (lL[ind][0] + 1) - tmpLadder;
775  else
776  ladder = lL[ind][2] - tmpLadder;
777  } else if (layer == 2) {
778  if (tmpLadder <= lL[ind][3])
779  ladder = (lL[ind][3] + 1) - tmpLadder;
780  else
781  ladder = lL[ind][5] - tmpLadder;
782  } else if (layer == 3) {
783  if (tmpLadder <= lL[ind][6])
784  ladder = (lL[ind][6] + 1) - tmpLadder;
785  else
786  ladder = lL[ind][8] - tmpLadder;
787  } else if (layer == 4) {
788  if (tmpLadder <= lL[ind][9])
789  ladder = (lL[ind][9] + 1) - tmpLadder;
790  else
791  ladder = lL[ind][11] - tmpLadder;
792  } // layer
793  } // inner
794 
795  // translate the module number from naming convention to cmssw convention
796  // numbering starts at positive z
797  if (shell == pO || shell == pI)
798  module = tmpModule + 4;
799  else // negative z side
800  module = 5 - tmpModule;
801 
802  DetId id = tt->pxbDetId(layer, ladder, module);
803  return id;
804 }
805 
806 // return the pixel DetId, obsolete, uses the old index class
808  uint32_t layer = 0;
809  uint32_t ladder = 0;
810  uint32_t module = 0;
811 
812  layer = layerName();
813  uint32_t tmpLadder = ladderName();
814  uint32_t tmpModule = moduleName();
815 
816  // translate the ladder number from the naming convention to the cmssw convention
817  bool outer = false;
818  Shell shell = thePart;
819  outer = (shell == mO) || (shell == pO);
820 
821  if (phase1) { // phase 1
822 
823  if (outer) { // outer
824  if (layer == 1)
825  ladder = tmpLadder + 3;
826  else if (layer == 2)
827  ladder = tmpLadder + 7;
828  else if (layer == 3)
829  ladder = tmpLadder + 11;
830  else if (layer == 4)
831  ladder = tmpLadder + 16;
832  } else { // inner
833  if (layer == 1) {
834  if (tmpLadder <= 3)
835  ladder = 4 - tmpLadder;
836  else if (tmpLadder <= 6)
837  ladder = 16 - tmpLadder;
838  } else if (layer == 2) {
839  if (tmpLadder <= 7)
840  ladder = 8 - tmpLadder;
841  else if (tmpLadder <= 14)
842  ladder = 36 - tmpLadder;
843  } else if (layer == 3) {
844  if (tmpLadder <= 11)
845  ladder = 12 - tmpLadder;
846  else if (tmpLadder <= 22)
847  ladder = 56 - tmpLadder;
848  } else if (layer == 4) {
849  if (tmpLadder <= 16)
850  ladder = 17 - tmpLadder;
851  else if (tmpLadder <= 32)
852  ladder = 81 - tmpLadder;
853  } // layer
854  } // inner
855 
856  } else { // phase 0
857  if (outer) { // outer
858  if (layer == 1)
859  ladder = tmpLadder + 5;
860  else if (layer == 2)
861  ladder = tmpLadder + 8;
862  else if (layer == 3)
863  ladder = tmpLadder + 11;
864  } else { // inner
865  if (layer == 1) { // layer 1
866  if (tmpLadder <= 5)
867  ladder = 6 - tmpLadder;
868  else if (tmpLadder <= 10)
869  ladder = 26 - tmpLadder;
870  } else if (layer == 2) { // layer 2
871  if (tmpLadder <= 8)
872  ladder = 9 - tmpLadder;
873  else if (tmpLadder <= 16)
874  ladder = 41 - tmpLadder;
875  } else if (layer == 3) { // layer 3
876  if (tmpLadder <= 11)
877  ladder = 12 - tmpLadder;
878  else if (tmpLadder <= 22)
879  ladder = 56 - tmpLadder;
880  } // end layer
881  } // inner
882 
883  } // phase
884 
885  // translate the module number from naming convention to cmssw convention
886  // numbering starts at positive z
887  if (shell == pO || shell == pI)
888  module = tmpModule + 4;
889  else // negative z side
890  module = 5 - tmpModule;
891 
892  return PXBDetId(layer, ladder, module);
893 }
894 
895 std::ostream& operator<<(std::ostream& out, const PixelBarrelName::Shell& t) {
896  switch (t) {
897  case (PixelBarrelName::pI): {
898  out << "pI";
899  break;
900  }
901  case (PixelBarrelName::pO): {
902  out << "pO";
903  break;
904  }
905  case (PixelBarrelName::mI): {
906  out << "mI";
907  break;
908  }
909  case (PixelBarrelName::mO): {
910  out << "mO";
911  break;
912  }
913  default:
914  out << "unknown";
915  };
916  return out;
917 }
int convertLadderNumber(int oldLadder)
int moduleName() const
module id (index in z)
unsigned int module() const
det id
Definition: PXBDetId.h:37
unsigned int layer() const
layer id
Definition: PXBDetId.h:31
Log< level::Error, false > LogError
Definition: TTTypes.h:54
PixelModuleName::ModuleType moduleType() const override
module Type
bool isHalfModule() const
full or half module
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::ostream & operator<<(std::ostream &out, const PixelBarrelName::Shell &t)
Definition: DetId.h:17
std::string name() const override
from base class
int layerName() const
layer id
PixelBarrelName(const DetId &, const TrackerTopology *tt, bool phase=false)
ctor from DetId
int ladderName() const
ladder id (index in phi)
Definition: shell.py:1
bool operator==(const PixelModuleName &) const override
check equality of modules from datamemebers
unsigned int ladder() const
ladder id
Definition: PXBDetId.h:34
PXBDetId getDetId()
return the DetId
int sectorName() const
sector id