16 const int lL[2][12] ={{5,15,26, 8,24,41,11,33,56, 0, 0, 0},
17 {3, 9,16, 7,21,36,11,33,56,16,48,81}};
25 theModule(0), theLadder(0), phase1(phase) {
33 if (module<=0) module--;
38 if (module < 0 && ladder < 0)
thePart =
mO;
39 else if (module > 0 && ladder < 0)
thePart =
pO;
41 else if (module > 0 && ladder > 0)
thePart =
pI;
65 int oldModule = cmssw_numbering.
module() -4;
if (oldModule<=0) oldModule--;
66 int oldLadder = cmssw_numbering.
ladder();
71 if (oldLadder <= 3) oldLadder = 4-oldLadder;
72 else if (oldLadder >= 4 && oldLadder <= 9 ) oldLadder = 3-oldLadder;
73 else if (oldLadder >= 10) oldLadder = 16-oldLadder;
76 if (oldLadder <= 7) oldLadder = 8-oldLadder;
77 else if (oldLadder >= 8 && oldLadder <= 21) oldLadder = 7-oldLadder;
78 else if (oldLadder >= 22) oldLadder = 36-oldLadder;
81 if (oldLadder <= 11) oldLadder = 12-oldLadder;
82 else if (oldLadder >= 12 && oldLadder <= 33) oldLadder = 11-oldLadder;
83 else if (oldLadder >= 34) oldLadder = 56-oldLadder;
86 if (oldLadder <= 16) oldLadder = 17-oldLadder;
87 else if (oldLadder >= 17 && oldLadder <= 48) oldLadder = 16-oldLadder;
88 else if (oldLadder >= 49) oldLadder = 81-oldLadder;
94 if (oldLadder <= 5) oldLadder = 6-oldLadder;
95 else if (oldLadder >= 6 && oldLadder <= 15 ) oldLadder = 5-oldLadder;
96 else if (oldLadder >= 16) oldLadder = 26-oldLadder;
99 if (oldLadder <= 8) oldLadder = 9-oldLadder;
100 else if (oldLadder >= 9 && oldLadder <= 24) oldLadder = 8-oldLadder;
101 else if (oldLadder >= 25) oldLadder = 41-oldLadder;
104 if (oldLadder <= 11) oldLadder = 12-oldLadder;
105 else if (oldLadder >= 12 && oldLadder <= 33) oldLadder = 11-oldLadder;
106 else if (oldLadder >= 34) oldLadder = 56-oldLadder;
113 if (oldModule < 0 && oldLadder < 0)
thePart =
mO;
114 else if (oldModule > 0 && oldLadder < 0)
thePart =
pO;
115 else if (oldModule < 0 && oldLadder > 0)
thePart =
mI;
116 else if (oldModule > 0 && oldLadder > 0)
thePart =
pI;
139 if (oldLadder <= lL[ind][0] )
140 ladder =(lL[ind][0]+1)-oldLadder;
141 else if (oldLadder >= (lL[ind][0]+1) && oldLadder <= lL[ind][1])
142 ladder = lL[ind][0]-oldLadder;
143 else if (oldLadder >= (lL[ind][1]+1) )
144 ladder = lL[ind][2]-oldLadder;
148 if (oldLadder <= lL[ind][3])
149 ladder =(lL[ind][3]+1)-oldLadder;
150 else if (oldLadder >= (lL[ind][3]+1) && oldLadder <= lL[ind][4])
151 ladder = lL[ind][3]-oldLadder;
152 else if (oldLadder >= (lL[ind][4]+1))
153 ladder = lL[ind][5]-oldLadder;
157 if (oldLadder <= lL[ind][6])
158 ladder = (lL[ind][6]+1)-oldLadder;
159 else if (oldLadder >= (lL[ind][6]+1) && oldLadder <= lL[ind][7])
160 ladder = lL[ind][6]-oldLadder;
161 else if (oldLadder >= (lL[ind][7]+1))
162 ladder = lL[ind][8]-oldLadder;
166 if (oldLadder <= lL[ind][9])
167 ladder =(lL[ind][9]+1)-oldLadder;
168 else if (oldLadder >= (lL[ind][9]+1) && oldLadder <= lL[ind][10])
169 ladder = lL[ind][9]-oldLadder;
170 else if (oldLadder >= (lL[ind][10]+1))
171 ladder = lL[ind][11]-oldLadder;
186 if ( (name.substr(0, 5) !=
"BPix_") ||
187 (name.find(
"_B") == string::npos) ||
188 (name.find(
"_LYR") == string::npos) ||
189 (name.find(
"_LDR") == string::npos) ||
190 (name.find(
"_MOD") == string::npos) ) {
192 <<
"Bad name string in PixelBarrelName::PixelBarrelName(std::string): " 198 if (name.find(
"_ROC") != string::npos)
199 name = name.substr(0, name.find(
"_ROC"));
202 string shellString = name.substr(name.find(
"_B")+2, name.find(
"_SEC")-name.find(
"_B")-2);
204 else if (shellString ==
"mI")
thePart =
mI;
205 else if (shellString ==
"pO")
thePart =
pO;
206 else if (shellString ==
"pI")
thePart =
pI;
209 <<
"Unable to determine shell in PixelBarrelName::PixelBarrelName(std::string): " 214 string layerString = name.substr(name.find(
"_LYR")+4, name.find(
"_LDR")-name.find(
"_LYR")-4);
215 if (layerString ==
"1")
theLayer = 1;
216 else if (layerString ==
"2")
theLayer = 2;
217 else if (layerString ==
"3")
theLayer = 3;
221 <<
"Unable to determine layer in PixelBarrelName::PixelBarrelName(std::string): " 226 string ladderString = name.substr(name.find(
"_LDR")+4, name.find(
"_MOD")-name.find(
"_LDR")-4);
230 if (ladderString.substr(ladderString.size()-1, 1) ==
"F") {
231 int ladderNum = atoi(ladderString.substr(0, ladderString.size() -1).c_str());
233 else if (
theLayer == 2 && ladderNum >= 1 && ladderNum <= 14)
theLadder = ladderNum;
234 else if (
theLayer == 3 && ladderNum >= 1 && ladderNum <= 22)
theLadder = ladderNum;
235 else if (
theLayer == 4 && ladderNum >= 1 && ladderNum <= 32)
theLadder = ladderNum;
238 <<
"Unable to determine ladder in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " 244 <<
"Unable to determine ladder in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " 255 else if (ladderString.substr(ladderString.size()-1, 1) ==
"F") {
256 int ladderNum = atoi(ladderString.substr(0, ladderString.size() -1).c_str());
258 else if (
theLayer == 2 && ladderNum > 1 && ladderNum < 16)
theLadder = ladderNum;
259 else if (
theLayer == 3 && ladderNum > 1 && ladderNum < 22)
theLadder = ladderNum;
262 <<
"Unable to determine ladder in PixelBarrelName::PixelBarrelName(std::string): " 268 <<
"Unable to determine ladder in PixelBarrelName::PixelBarrelName(std::string): " 274 string moduleString = name.substr(name.find(
"_MOD")+4, name.size()-name.find(
"_MOD")-4);
276 else if (moduleString ==
"2")
theModule = 2;
277 else if (moduleString ==
"3")
theModule = 3;
278 else if (moduleString ==
"4")
theModule = 4;
281 <<
"Unable to determine module in PixelBarrelName::PixelBarrelName(std::string): " 312 else {sector = 2;
break;}
316 else {sector = 3;
break;}
320 else {sector = 4;
break;}
325 else {sector = 6;
break;}
330 else {sector = 7;
break;}
335 else {sector = 8;
break;}
343 case 1 :
case 2: {sector = 1;
break;}
344 case 3 : {sector = 2;
break;}
345 case 4 : {sector = 3;
break;}
346 case 5 : {sector = 4;
break;}
347 case 6 : {sector = 5;
break;}
348 case 7 : {sector = 6;
break;}
349 case 8 : {sector = 7;
break;}
350 case 9 :
case 10:{sector = 8;
break;}
359 case 1:
case 2: {sector = 1;
break;}
360 case 3:
case 4: {sector = 2;
break;}
361 case 5: {sector = 3;
break;}
362 case 6:
case 7: {sector = 4;
break;}
363 case 8:
case 9: {sector = 5;
break;}
364 case 10: {sector = 6;
break;}
365 case 11:
case 12: {sector = 7;
break;}
366 case 13:
case 14: {sector = 8;
break;}
372 case 1 :
case 2: {sector = 1;
break;}
373 case 3 :
case 4: {sector = 2;
break;}
374 case 5 :
case 6: {sector = 3;
break;}
375 case 7 :
case 8: {sector = 4;
break;}
376 case 9 :
case 10: {sector = 5;
break;}
377 case 11 :
case 12: {sector = 6;
break;}
378 case 13 :
case 14: {sector = 7;
break;}
379 case 15 :
case 16: {sector = 8;
break;}
388 case 1:
case 2: {sector = 1;
break;}
389 case 3:
case 4:
case 5: {sector = 2;
break;}
390 case 6:
case 7:
case 8: {sector = 3;
break;}
391 case 9:
case 10:
case 11: {sector = 4;
break;}
392 case 12:
case 13:
case 14: {sector = 5;
break;}
393 case 15:
case 16:
case 17: {sector = 6;
break;}
394 case 18:
case 19:
case 20: {sector = 7;
break;}
395 case 21:
case 22: {sector = 8;
break;}
401 case 1 :
case 2:
case 3: {sector = 1;
break;}
402 case 4 :
case 5:
case 6: {sector = 2;
break;}
403 case 7 :
case 8:
case 9: {sector = 3;
break;}
404 case 10 :
case 11: {sector = 4;
break;}
405 case 12 :
case 13: {sector = 5;
break;}
406 case 14 :
case 15:
case 16: {sector = 6;
break;}
407 case 17 :
case 18:
case 19: {sector = 7;
break;}
408 case 20 :
case 21:
case 22: {sector = 8;
break;}
417 case 1 :
case 2:
case 3:
case 4: {sector = 1;
break;}
418 case 5 :
case 6:
case 7:
case 8: {sector = 2;
break;}
419 case 9 :
case 10:
case 11:
case 12: {sector = 3;
break;}
420 case 13 :
case 14:
case 15:
case 16: {sector = 4;
break;}
421 case 17 :
case 18:
case 19:
case 20: {sector = 5;
break;}
422 case 21 :
case 22:
case 23:
case 24: {sector = 6;
break;}
423 case 25 :
case 26:
case 27:
case 28: {sector = 7;
break;}
424 case 29 :
case 30:
case 31:
case 32: {sector = 8;
break;}
437 bool halfModule =
false;
467 std::ostringstream stm;
491 outer = (shell ==
mO) || (shell ==
pO);
494 ladder = tmpLadder + lL[ind][0];
496 ladder = tmpLadder + lL[ind][3];
498 ladder = tmpLadder + lL[ind][6];
500 ladder = tmpLadder + lL[ind][9];
504 if (tmpLadder <= lL[ind][0]) ladder = (lL[ind][0]+1) - tmpLadder;
505 else ladder = lL[ind][2] - tmpLadder;
506 }
else if (layer == 2) {
507 if (tmpLadder <= lL[ind][3]) ladder = (lL[ind][3]+1) - tmpLadder;
508 else ladder = lL[ind][5] - tmpLadder;
509 }
else if (layer == 3) {
510 if (tmpLadder <= lL[ind][6]) ladder = (lL[ind][6]+1) - tmpLadder;
511 else ladder = lL[ind][8] - tmpLadder;
512 }
else if (layer == 4) {
513 if (tmpLadder <= lL[ind][9]) ladder = (lL[ind][9]+1) - tmpLadder;
514 else ladder = lL[ind][11] - tmpLadder;
520 if (shell ==
pO || shell ==
pI)
521 module = tmpModule + 4;
523 module = 5 - tmpModule;
543 outer = (shell ==
mO) || (shell ==
pO);
549 ladder = tmpLadder + 3;
551 ladder = tmpLadder + 7;
553 ladder = tmpLadder + 11;
555 ladder = tmpLadder + 16;
558 if (tmpLadder <= 3) ladder = 4 - tmpLadder;
559 else if (tmpLadder <= 6) ladder = 16 - tmpLadder;
560 }
else if (layer == 2) {
561 if (tmpLadder <= 7) ladder = 8 - tmpLadder;
562 else if (tmpLadder <= 14) ladder = 36 - tmpLadder;
563 }
else if (layer == 3) {
564 if (tmpLadder <= 11) ladder = 12 - tmpLadder;
565 else if (tmpLadder <= 22) ladder = 56 - tmpLadder;
566 }
else if (layer == 4) {
567 if (tmpLadder <= 16) ladder = 17 - tmpLadder;
568 else if (tmpLadder <= 32) ladder = 81 - tmpLadder;
575 ladder = tmpLadder + 5;
577 ladder = tmpLadder + 8;
579 ladder = tmpLadder + 11;
582 if (tmpLadder <= 5) ladder = 6 - tmpLadder;
583 else if (tmpLadder <= 10) ladder = 26 - tmpLadder;
584 }
else if (layer == 2) {
585 if (tmpLadder <= 8) ladder = 9 - tmpLadder;
586 else if (tmpLadder <= 16) ladder = 41 - tmpLadder;
587 }
else if (layer == 3) {
588 if (tmpLadder <= 11) ladder = 12 - tmpLadder;
589 else if (tmpLadder <= 22) ladder = 56 - tmpLadder;
598 if (shell ==
pO || shell ==
pI)
599 module = tmpModule + 4;
601 module = 5 - tmpModule;
603 return PXBDetId(layer, ladder, module);
613 default: out <<
"unknown";
int moduleName() const
module id (index in z)
int convertLadderNumber(int oldLadder)
unsigned int pxbLadder(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
unsigned int ladder() const
ladder id
unsigned int layer() const
layer id
bool isHalfModule() const
full or half module
int sectorName() const
sector id
unsigned int module() const
det id
Abs< T >::type abs(const T &t)
std::ostream & operator<<(std::ostream &out, const PixelBarrelName::Shell &t)
virtual bool operator==(const PixelModuleName &) const
check equality of modules from datamemebers
unsigned int pxbLayer(const DetId &id) const
virtual bool isBarrel() const
true for barrel modules
int ladderName() const
ladder id (index in phi)
virtual std::string name() const
from base class
int layerName() const
layer id
PixelBarrelName(const DetId &, const TrackerTopology *tt, bool phase=false)
ctor from DetId
DetId pxbDetId(uint32_t layer, uint32_t ladder, uint32_t module) const
PXBDetId getDetId()
return the DetId
virtual PixelModuleName::ModuleType moduleType() const
module Type