CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PixelBarrelNameUpgrade Class Reference

#include <PixelBarrelNameUpgrade.h>

Inheritance diagram for PixelBarrelNameUpgrade:
PixelModuleName

Public Types

enum  Shell { mO = 1, mI = 2, pO = 3, pI = 4 }
 
- Public Types inherited from PixelModuleName
enum  ModuleType {
  v1x2, v1x5, v1x8, v2x3,
  v2x4, v2x5, v2x8
}
 

Public Member Functions

PXBDetId getDetId ()
 return the DetId More...
 
bool isHalfModule () const
 full or half module More...
 
int ladderName () const
 ladder id (index in phi) More...
 
int layerName () const
 layer id More...
 
int moduleName () const
 module id (index in z) More...
 
PixelModuleName::ModuleType moduleType () const override
 module Type More...
 
std::string name () const override
 from base class More...
 
bool operator== (const PixelModuleName &) const override
 check equality of modules from datamemebers More...
 
 PixelBarrelNameUpgrade (const DetId &)
 ctor from DetId More...
 
 PixelBarrelNameUpgrade (Shell shell=mO, int layer=0, int module=0, int ladder=0)
 ctor for defined name with dummy parameters More...
 
 PixelBarrelNameUpgrade (std::string name)
 ctor from name string More...
 
int sectorName () const
 sector id More...
 
Shell shell () const
 
 ~PixelBarrelNameUpgrade () override
 
- Public Member Functions inherited from PixelModuleName
virtual bool isBarrel () const
 true for barrel modules More...
 
 PixelModuleName (bool isBarrel)
 
virtual ~PixelModuleName ()
 

Private Attributes

int theLadder
 
int theLayer
 
int theModule
 
Shell thePart
 

Additional Inherited Members

- Static Public Member Functions inherited from PixelModuleName
static bool isBarrel (uint32_t rawDetId)
 

Detailed Description

Module name (as in PixelDatabase) in barrel

Definition at line 14 of file PixelBarrelNameUpgrade.h.

Member Enumeration Documentation

◆ Shell

Enumerator
mO 
mI 
pO 
pI 

Definition at line 16 of file PixelBarrelNameUpgrade.h.

16 { mO = 1, mI = 2, pO = 3, pI = 4 };

Constructor & Destructor Documentation

◆ PixelBarrelNameUpgrade() [1/3]

PixelBarrelNameUpgrade::PixelBarrelNameUpgrade ( const DetId id)

ctor from DetId

Definition at line 11 of file PixelBarrelNameUpgrade.cc.

11  : PixelModuleName(true) {
12  // uint32_t rawId = id.rawId();
13  PXBDetId cmssw_numbering(id);
14 
15  theLayer = cmssw_numbering.layer();
16 
17  int oldModule = cmssw_numbering.module() - 4;
18  if (oldModule <= 0)
19  oldModule--; // -4, ..., -1, +1, ...,+4
20 
21  int oldLadder = cmssw_numbering.ladder();
22 
23  if (theLayer == 1) {
24  if (oldLadder <= 3)
25  oldLadder = 4 - oldLadder; // +1, ..., +3
26  else if (oldLadder >= 4 && oldLadder <= 9)
27  oldLadder = 3 - oldLadder; // -1, ..., -6
28  else if (oldLadder >= 10)
29  oldLadder = 16 - oldLadder; // +6, ..., +4
30  } else if (theLayer == 2) {
31  if (oldLadder <= 7)
32  oldLadder = 8 - oldLadder;
33  else if (oldLadder >= 8 && oldLadder <= 21)
34  oldLadder = 7 - oldLadder;
35  else if (oldLadder >= 22)
36  oldLadder = 36 - oldLadder;
37  } else if (theLayer == 3) {
38  if (oldLadder <= 11)
39  oldLadder = 12 - oldLadder;
40  else if (oldLadder >= 12 && oldLadder <= 33)
41  oldLadder = 11 - oldLadder;
42  else if (oldLadder >= 34)
43  oldLadder = 56 - oldLadder;
44  } else if (theLayer == 4) {
45  if (oldLadder <= 16)
46  oldLadder = 17 - oldLadder;
47  else if (oldLadder >= 17 && oldLadder <= 48)
48  oldLadder = 16 - oldLadder;
49  else if (oldLadder >= 49)
50  oldLadder = 81 - oldLadder;
51  }
52 
53  //
54  // part
55  //
56  if (oldModule < 0 && oldLadder < 0)
57  thePart = mO;
58  else if (oldModule > 0 && oldLadder < 0)
59  thePart = pO;
60  else if (oldModule < 0 && oldLadder > 0)
61  thePart = mI;
62  else if (oldModule > 0 && oldLadder > 0)
63  thePart = pI;
64  //std::cout << "(oldModule, oldLadder)============(" << oldModule << ", "<< oldLadder<<" )" << std::endl;
65 
66  //
67  // ladder
68  //
69  theLadder = abs(oldLadder);
70 
71  //
72  // module
73  //
74  theModule = abs(oldModule);
75 }

References funct::abs(), PXBDetId::ladder(), PXBDetId::layer(), mI, mO, PXBDetId::module(), pI, pO, theLadder, theLayer, theModule, and thePart.

◆ PixelBarrelNameUpgrade() [2/3]

PixelBarrelNameUpgrade::PixelBarrelNameUpgrade ( Shell  shell = mO,
int  layer = 0,
int  module = 0,
int  ladder = 0 
)
inline

ctor for defined name with dummy parameters

Definition at line 22 of file PixelBarrelNameUpgrade.h.

◆ PixelBarrelNameUpgrade() [3/3]

PixelBarrelNameUpgrade::PixelBarrelNameUpgrade ( std::string  name)

ctor from name string

Definition at line 78 of file PixelBarrelNameUpgrade.cc.

79  : PixelModuleName(true), thePart(mO), theLayer(0), theModule(0), theLadder(0) {
80  std::cout << "NAME=" << name << std::endl;
81  // parse the name string
82  // first, check to make sure this is an BPix name, should start with "BPix_"
83  // also check to make sure the needed parts are present
84  if ((name.substr(0, 5) != "BPix_") || (name.find("_B") == string::npos) || (name.find("_LYR") == string::npos) ||
85  (name.find("_LDR") == string::npos) || (name.find("_MOD") == string::npos)) {
86  edm::LogError("BadNameString|SiPixel")
87  << "Bad name string in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
88  return;
89  }
90 
91  // strip off ROC part if it's there
92  if (name.find("_ROC") != string::npos)
93  name = name.substr(0, name.find("_ROC"));
94 
95  // find shell
96  string shellString = name.substr(name.find("_B") + 2, name.find("_SEC") - name.find("_B") - 2);
97  if (shellString == "mO")
98  thePart = mO;
99  else if (shellString == "mI")
100  thePart = mI;
101  else if (shellString == "pO")
102  thePart = pO;
103  else if (shellString == "pI")
104  thePart = pI;
105  else {
106  edm::LogError("BadNameString|SiPixel")
107  << "Unable to determine shell in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
108  }
109 
110  // find the layer
111  string layerString = name.substr(name.find("_LYR") + 4, name.find("_LDR") - name.find("_LYR") - 4);
112  if (layerString == "1")
113  theLayer = 1;
114  else if (layerString == "2")
115  theLayer = 2;
116  else if (layerString == "3")
117  theLayer = 3;
118  else if (layerString == "4")
119  theLayer = 4;
120  else {
121  edm::LogError("BadNameString|SiPixel")
122  << "Unable to determine layer in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
123  }
124 
125  // find the ladder
126  string ladderString = name.substr(name.find("_LDR") + 4, name.find("_MOD") - name.find("_LDR") - 4);
127  if (ladderString.substr(ladderString.size() - 1, 1) == "F") {
128  int ladderNum = atoi(ladderString.substr(0, ladderString.size() - 1).c_str());
129  if (theLayer == 1 && ladderNum >= 1 && ladderNum <= 6)
130  theLadder = ladderNum;
131  else if (theLayer == 2 && ladderNum >= 1 && ladderNum <= 14)
132  theLadder = ladderNum;
133  else if (theLayer == 3 && ladderNum >= 1 && ladderNum <= 22)
134  theLadder = ladderNum;
135  else if (theLayer == 4 && ladderNum >= 1 && ladderNum <= 32)
136  theLadder = ladderNum;
137  else {
138  edm::LogError("BadNameString|SiPixel")
139  << "Unable to determine ladder in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
140  }
141  } // full ladders
142  else {
143  edm::LogError("BadNameString|SiPixel")
144  << "Unable to determine ladder in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
145  }
146 
147  // find the module
148  string moduleString = name.substr(name.find("_MOD") + 4, name.size() - name.find("_MOD") - 4);
149  if (moduleString == "1")
150  theModule = 1;
151  else if (moduleString == "2")
152  theModule = 2;
153  else if (moduleString == "3")
154  theModule = 3;
155  else if (moduleString == "4")
156  theModule = 4;
157  else {
158  edm::LogError("BadNameString|SiPixel")
159  << "Unable to determine module in PixelBarrelNameUpgrade::PixelBarrelName(std::string): " << name;
160  }
161 
162 } // PixelBarrelNameUpgrade::PixelBarrelName(std::string name)

References gather_cfg::cout, mI, mO, name(), pI, pO, theLadder, theLayer, theModule, and thePart.

◆ ~PixelBarrelNameUpgrade()

PixelBarrelNameUpgrade::~PixelBarrelNameUpgrade ( )
inlineoverride

Definition at line 28 of file PixelBarrelNameUpgrade.h.

28 {}

Member Function Documentation

◆ getDetId()

PXBDetId PixelBarrelNameUpgrade::getDetId ( void  )

return the DetId

Definition at line 398 of file PixelBarrelNameUpgrade.cc.

398  {
399  uint32_t layer = 0;
400  uint32_t ladder = 0;
401  uint32_t module = 0;
402 
403  layer = layerName();
404  uint32_t tmpLadder = ladderName();
405  uint32_t tmpModule = moduleName();
406 
407  // translate the ladder number from the naming convention to the cmssw convention
408  bool outer = false;
409  Shell shell = thePart;
410  outer = (shell == mO) || (shell == pO);
411  if (outer) {
412  if (layer == 1)
413  ladder = tmpLadder + 3;
414  else if (layer == 2)
415  ladder = tmpLadder + 7;
416  else if (layer == 3)
417  ladder = tmpLadder + 11;
418  else if (layer == 4)
419  ladder = tmpLadder + 16;
420  } // outer
421  else { // inner
422  if (layer == 1) {
423  if (tmpLadder <= 3)
424  ladder = 4 - tmpLadder;
425  else if (tmpLadder <= 6)
426  ladder = 16 - tmpLadder;
427  } // layer 1
428  else if (layer == 2) {
429  if (tmpLadder <= 7)
430  ladder = 8 - tmpLadder;
431  else if (tmpLadder <= 14)
432  ladder = 36 - tmpLadder;
433  } // layer 2
434  else if (layer == 3) {
435  if (tmpLadder <= 11)
436  ladder = 12 - tmpLadder;
437  else if (tmpLadder <= 22)
438  ladder = 56 - tmpLadder;
439  } // layer 3
440  else if (layer == 4) {
441  if (tmpLadder <= 16)
442  ladder = 17 - tmpLadder;
443  else if (tmpLadder <= 32)
444  ladder = 81 - tmpLadder;
445  } // layer 4
446  } // inner
447 
448  // translate the module number from naming convention to cmssw convention
449  // numbering starts at positive z
450  if (shell == pO || shell == pI)
451  module = tmpModule + 4;
452  else // negative z side
453  module = 5 - tmpModule;
454 
455  return PXBDetId(layer, ladder, module);
456 
457 } // PXBDetId PixelBarrelNameUpgrade::getDetId()

References PVValHelper::ladder, ladderName(), phase1PixelTopology::layer, layerName(), mO, callgraph::module, moduleName(), SurfaceOrientation::outer, pI, pO, and thePart.

◆ isHalfModule()

bool PixelBarrelNameUpgrade::isHalfModule ( ) const

full or half module

Definition at line 353 of file PixelBarrelNameUpgrade.cc.

353  {
354  bool halfModule = false;
355  // if (theLadder == 1) halfModule = true;
356  // if (theLayer == 1 && theLadder == 10) halfModule = true;
357  // if (theLayer == 2 && theLadder == 16) halfModule = true;
358  // if (theLayer == 3 && theLadder == 22) halfModule = true;
359  return halfModule;
360 }

Referenced by moduleType().

◆ ladderName()

int PixelBarrelNameUpgrade::ladderName ( ) const
inline

ladder id (index in phi)

Definition at line 42 of file PixelBarrelNameUpgrade.h.

42 { return theLadder; }

References theLadder.

Referenced by getDetId(), SiPixelFolderOrganizer::getModuleFolder(), and SiPixelFolderOrganizer::setModuleFolder().

◆ layerName()

int PixelBarrelNameUpgrade::layerName ( ) const
inline

◆ moduleName()

int PixelBarrelNameUpgrade::moduleName ( ) const
inline

module id (index in z)

Definition at line 39 of file PixelBarrelNameUpgrade.h.

39 { return theModule; }

References theModule.

Referenced by getDetId(), SiPixelFolderOrganizer::getModuleFolder(), and SiPixelFolderOrganizer::setModuleFolder().

◆ moduleType()

PixelModuleName::ModuleType PixelBarrelNameUpgrade::moduleType ( ) const
overridevirtual

module Type

Implements PixelModuleName.

Definition at line 362 of file PixelBarrelNameUpgrade.cc.

References isHalfModule(), PixelModuleName::v1x8, and PixelModuleName::v2x8.

◆ name()

string PixelBarrelNameUpgrade::name ( ) const
overridevirtual

from base class

Implements PixelModuleName.

Definition at line 375 of file PixelBarrelNameUpgrade.cc.

375  {
376  std::ostringstream stm;
377 
378  stm << "BPix_B" << thePart << "_SEC" << sectorName() << "_LYR" << theLayer << "_LDR" << theLadder;
379  stm << "F";
380  stm << "_MOD" << theModule;
381 
382  return stm.str();
383 }

References sectorName(), theLadder, theLayer, theModule, and thePart.

Referenced by config.CFG::__str__(), validation.Sample::digest(), VIDSelectorBase.VIDSelectorBase::initialize(), and PixelBarrelNameUpgrade().

◆ operator==()

bool PixelBarrelNameUpgrade::operator== ( const PixelModuleName o) const
overridevirtual

check equality of modules from datamemebers

Implements PixelModuleName.

Definition at line 366 of file PixelBarrelNameUpgrade.cc.

366  {
367  if (o.isBarrel()) {
368  const PixelBarrelNameUpgrade* other = dynamic_cast<const PixelBarrelNameUpgrade*>(&o);
369  return (other && thePart == other->thePart && theLayer == other->theLayer && theModule == other->theModule &&
370  theLadder == other->theLadder);
371  } else
372  return false;
373 }

References EcalTangentSkim_cfg::o, trackingPlots::other, theLadder, theLayer, theModule, and thePart.

◆ sectorName()

int PixelBarrelNameUpgrade::sectorName ( ) const

sector id

Definition at line 164 of file PixelBarrelNameUpgrade.cc.

164  {
165  int sector = 0;
166  if (theLayer == 1) {
167  switch (theLadder) {
168  case 1: {
169  sector = 1;
170  break;
171  }
172  case 2: {
173  sector = 2;
174  break;
175  }
176  case 3: {
177  sector = 3;
178  break;
179  }
180  case 4: {
181  sector = 6;
182  break;
183  }
184  case 5: {
185  sector = 7;
186  break;
187  }
188  case 6: {
189  sector = 8;
190  break;
191  }
192  default:;
193  };
194  } else if (theLayer == 2) {
195  switch (theLadder) {
196  case 1:
197  case 2: {
198  sector = 1;
199  break;
200  }
201  case 3:
202  case 4: {
203  sector = 2;
204  break;
205  }
206  case 5:
207  case 6: {
208  sector = 3;
209  break;
210  }
211  case 7: {
212  sector = 4;
213  break;
214  }
215  case 8: {
216  sector = 5;
217  break;
218  }
219  case 9:
220  case 10: {
221  sector = 6;
222  break;
223  }
224  case 11:
225  case 12: {
226  sector = 7;
227  break;
228  }
229  case 13:
230  case 14: {
231  sector = 8;
232  break;
233  }
234  default:;
235  };
236  } else if (theLayer == 3) {
237  switch (theLadder) {
238  case 1:
239  case 2:
240  case 3: {
241  sector = 1;
242  break;
243  }
244  case 4:
245  case 5:
246  case 6: {
247  sector = 2;
248  break;
249  }
250  case 7:
251  case 8:
252  case 9: {
253  sector = 3;
254  break;
255  }
256  case 10:
257  case 11: {
258  sector = 4;
259  break;
260  }
261  case 12:
262  case 13: {
263  sector = 5;
264  break;
265  }
266  case 14:
267  case 15:
268  case 16: {
269  sector = 6;
270  break;
271  }
272  case 17:
273  case 18:
274  case 19: {
275  sector = 7;
276  break;
277  }
278  case 20:
279  case 21:
280  case 22: {
281  sector = 8;
282  break;
283  }
284  default:;
285  };
286  } else if (theLayer == 4) {
287  switch (theLadder) {
288  case 1:
289  case 2:
290  case 3:
291  case 4: {
292  sector = 1;
293  break;
294  }
295  case 5:
296  case 6:
297  case 7:
298  case 8: {
299  sector = 2;
300  break;
301  }
302  case 9:
303  case 10:
304  case 11:
305  case 12: {
306  sector = 3;
307  break;
308  }
309  case 13:
310  case 14:
311  case 15:
312  case 16: {
313  sector = 4;
314  break;
315  }
316  case 17:
317  case 18:
318  case 19:
319  case 20: {
320  sector = 5;
321  break;
322  }
323  case 21:
324  case 22:
325  case 23:
326  case 24: {
327  sector = 6;
328  break;
329  }
330  case 25:
331  case 26:
332  case 27:
333  case 28: {
334  sector = 7;
335  break;
336  }
337  case 29:
338  case 30:
339  case 31:
340  case 32: {
341  sector = 8;
342  break;
343  }
344  default:;
345  };
346  }
347 
348  return sector;
349 }

References theLadder, and theLayer.

Referenced by name().

◆ shell()

Shell PixelBarrelNameUpgrade::shell ( ) const
inline

Definition at line 33 of file PixelBarrelNameUpgrade.h.

33 { return thePart; }

References thePart.

Referenced by SiPixelFolderOrganizer::getModuleFolder(), and SiPixelFolderOrganizer::setModuleFolder().

Member Data Documentation

◆ theLadder

int PixelBarrelNameUpgrade::theLadder
private

◆ theLayer

int PixelBarrelNameUpgrade::theLayer
private

◆ theModule

int PixelBarrelNameUpgrade::theModule
private

Definition at line 61 of file PixelBarrelNameUpgrade.h.

Referenced by moduleName(), name(), operator==(), and PixelBarrelNameUpgrade().

◆ thePart

Shell PixelBarrelNameUpgrade::thePart
private

Definition at line 60 of file PixelBarrelNameUpgrade.h.

Referenced by getDetId(), name(), operator==(), PixelBarrelNameUpgrade(), and shell().

PixelBarrelNameUpgrade::theLadder
int theLadder
Definition: PixelBarrelNameUpgrade.h:61
PixelBarrelNameUpgrade::moduleName
int moduleName() const
module id (index in z)
Definition: PixelBarrelNameUpgrade.h:39
PixelBarrelNameUpgrade::pO
Definition: PixelBarrelNameUpgrade.h:16
PixelBarrelNameUpgrade::sectorName
int sectorName() const
sector id
Definition: PixelBarrelNameUpgrade.cc:164
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PixelBarrelNameUpgrade
Definition: PixelBarrelNameUpgrade.h:14
PixelBarrelNameUpgrade::pI
Definition: PixelBarrelNameUpgrade.h:16
PixelBarrelNameUpgrade::mI
Definition: PixelBarrelNameUpgrade.h:16
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
trackingPlots.other
other
Definition: trackingPlots.py:1464
PixelBarrelNameUpgrade::thePart
Shell thePart
Definition: PixelBarrelNameUpgrade.h:60
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
PixelBarrelNameUpgrade::mO
Definition: PixelBarrelNameUpgrade.h:16
PixelBarrelNameUpgrade::isHalfModule
bool isHalfModule() const
full or half module
Definition: PixelBarrelNameUpgrade.cc:353
PixelBarrelNameUpgrade::Shell
Shell
Definition: PixelBarrelNameUpgrade.h:16
PixelModuleName::v1x8
Definition: PixelModuleName.h:14
PixelBarrelNameUpgrade::theLayer
int theLayer
Definition: PixelBarrelNameUpgrade.h:61
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
shell
Definition: shell.py:1
callgraph.module
module
Definition: callgraph.py:61
PixelBarrelNameUpgrade::layerName
int layerName() const
layer id
Definition: PixelBarrelNameUpgrade.h:36
PixelModuleName::v2x8
Definition: PixelModuleName.h:14
PVValHelper::ladder
Definition: PVValidationHelpers.h:73
PixelBarrelNameUpgrade::ladderName
int ladderName() const
ladder id (index in phi)
Definition: PixelBarrelNameUpgrade.h:42
PixelBarrelNameUpgrade::name
std::string name() const override
from base class
Definition: PixelBarrelNameUpgrade.cc:375
PixelBarrelNameUpgrade::theModule
int theModule
Definition: PixelBarrelNameUpgrade.h:61
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PixelModuleName::PixelModuleName
PixelModuleName(bool isBarrel)
Definition: PixelModuleName.h:16
PXBDetId
Definition: PXBDetId.h:16
SurfaceOrientation::outer
Definition: Surface.h:19