CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
PixelBarrelName Class Reference

#include <PixelBarrelName.h>

Inheritance diagram for PixelBarrelName:
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...
 
virtual PixelModuleName::ModuleType moduleType () const
 module Type More...
 
virtual std::string name () const
 from base class More...
 
virtual bool operator== (const PixelModuleName &) const
 check equality of modules from datamemebers More...
 
 PixelBarrelName (const DetId &)
 ctor from DetId More...
 
 PixelBarrelName (Shell shell=mO, int layer=0, int module=0, int ladder=0)
 ctor for defined name with dummy parameters More...
 
 PixelBarrelName (std::string name)
 ctor from name string More...
 
int sectorName () const
 sector id More...
 
Shell shell () const
 
virtual ~PixelBarrelName ()
 
- 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 PixelBarrelName.h.

Member Enumeration Documentation

Enumerator
mO 
mI 
pO 
pI 

Definition at line 17 of file PixelBarrelName.h.

Constructor & Destructor Documentation

PixelBarrelName::PixelBarrelName ( const DetId id)

ctor from DetId

Definition at line 12 of file PixelBarrelName.cc.

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

13  : PixelModuleName(true)
14 {
15 
16 // uint32_t rawId = id.rawId();
17  PXBDetId cmssw_numbering(id);
18 
19 
20  theLayer = cmssw_numbering.layer();
21 
22  int oldModule = cmssw_numbering.module() -4; if (oldModule<=0) oldModule--;
23 
24  int oldLadder = cmssw_numbering.ladder();
25  if (theLayer == 1) {
26  if (oldLadder <= 5) oldLadder = 6-oldLadder;
27  else if (oldLadder >= 6 && oldLadder <= 15 ) oldLadder = 5-oldLadder;
28  else if (oldLadder >= 16) oldLadder = 26-oldLadder;
29  }
30  else if (theLayer == 2) {
31  if (oldLadder <= 8) oldLadder = 9-oldLadder;
32  else if (oldLadder >= 9 && oldLadder <= 24) oldLadder = 8-oldLadder;
33  else if (oldLadder >= 25) oldLadder = 41-oldLadder;
34  }
35  else if (theLayer == 3) {
36  if (oldLadder <= 11) oldLadder = 12-oldLadder;
37  else if (oldLadder >= 12 && oldLadder <= 33) oldLadder = 11-oldLadder;
38  else if (oldLadder >= 34) oldLadder = 56-oldLadder;
39  }
40 
41  //
42  // part
43  //
44  if (oldModule < 0 && oldLadder < 0) thePart = mO;
45  else if (oldModule > 0 && oldLadder < 0) thePart = pO;
46  else if (oldModule < 0 && oldLadder > 0) thePart = mI;
47  else if (oldModule > 0 && oldLadder > 0) thePart = pI;
48 
49 
50  //
51  // ladder
52  //
53  theLadder = abs(oldLadder);
54 
55  //
56  // module
57  //
58  theModule = abs(oldModule);
59 
60 }
#define abs(x)
Definition: mlp_lapack.h:159
PixelModuleName(bool isBarrel)
PixelBarrelName::PixelBarrelName ( Shell  shell = mO,
int  layer = 0,
int  module = 0,
int  ladder = 0 
)
inline

ctor for defined name with dummy parameters

Definition at line 23 of file PixelBarrelName.h.

24  : PixelModuleName(true),
25  thePart(shell), theLayer(layer), theModule(module), theLadder(ladder)
26  { }
PixelModuleName(bool isBarrel)
Shell shell() const
Definition: vlib.h:209
PixelBarrelName::PixelBarrelName ( std::string  name)

ctor from name string

Definition at line 63 of file PixelBarrelName.cc.

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

64  : PixelModuleName(true), thePart(mO), theLayer(0),
65  theModule(0), theLadder(0) {
66 
67  // parse the name string
68  // first, check to make sure this is an BPix name, should start with "BPix_"
69  // also check to make sure the needed parts are present
70  if ( (name.substr(0, 5) != "BPix_") ||
71  (name.find("_B") == string::npos) ||
72  (name.find("_LYR") == string::npos) ||
73  (name.find("_LDR") == string::npos) ||
74  (name.find("_MOD") == string::npos) ) {
75  edm::LogError ("BadNameString|SiPixel")
76  << "Bad name string in PixelBarrelName::PixelBarrelName(std::string): "
77  << name;
78  return;
79  }
80 
81  // strip off ROC part if it's there
82  if (name.find("_ROC") != string::npos)
83  name = name.substr(0, name.find("_ROC"));
84 
85  // find shell
86  string shellString = name.substr(name.find("_B")+2, name.find("_SEC")-name.find("_B")-2);
87  if (shellString == "mO") thePart = mO;
88  else if (shellString == "mI") thePart = mI;
89  else if (shellString == "pO") thePart = pO;
90  else if (shellString == "pI") thePart = pI;
91  else {
92  edm::LogError ("BadNameString|SiPixel")
93  << "Unable to determine shell in PixelBarrelName::PixelBarrelName(std::string): "
94  << name;
95  }
96 
97  // find the layer
98  string layerString = name.substr(name.find("_LYR")+4, name.find("_LDR")-name.find("_LYR")-4);
99  if (layerString == "1") theLayer = 1;
100  else if (layerString == "2") theLayer = 2;
101  else if (layerString == "3") theLayer = 3;
102  else {
103  edm::LogError ("BadNameString|SiPixel")
104  << "Unable to determine layer in PixelBarrelName::PixelBarrelName(std::string): "
105  << name;
106  }
107 
108  // find the ladder
109  string ladderString = name.substr(name.find("_LDR")+4, name.find("_MOD")-name.find("_LDR")-4);
110  if (ladderString == "1H") theLadder = 1;
111  else if (ladderString == "10H" && theLayer == 1) theLadder = 10;
112  else if (ladderString == "16H" && theLayer == 2) theLadder = 16;
113  else if (ladderString == "22H" && theLayer == 3) theLadder = 22;
114  else if (ladderString.substr(ladderString.size()-1, 1) == "F") {
115  int ladderNum = atoi(ladderString.substr(0, ladderString.size() -1).c_str());
116  if (theLayer == 1 && ladderNum > 1 && ladderNum < 10) theLadder = ladderNum;
117  else if (theLayer == 2 && ladderNum > 1 && ladderNum < 16) theLadder = ladderNum;
118  else if (theLayer == 3 && ladderNum > 1 && ladderNum < 22) theLadder = ladderNum;
119  else {
120  edm::LogError ("BadNameString|SiPixel")
121  << "Unable to determine ladder in PixelBarrelName::PixelBarrelName(std::string): "
122  << name;
123  }
124  } // full ladders
125  else {
126  edm::LogError ("BadNameString|SiPixel")
127  << "Unable to determine ladder in PixelBarrelName::PixelBarrelName(std::string): "
128  << name;
129  }
130 
131  // find the module
132  string moduleString = name.substr(name.find("_MOD")+4, name.size()-name.find("_MOD")-4);
133  if (moduleString == "1") theModule = 1;
134  else if (moduleString == "2") theModule = 2;
135  else if (moduleString == "3") theModule = 3;
136  else if (moduleString == "4") theModule = 4;
137  else {
138  edm::LogError ("BadNameString|SiPixel")
139  << "Unable to determine module in PixelBarrelName::PixelBarrelName(std::string): "
140  << name;
141  }
142 
143 } // PixelBarrelName::PixelBarrelName(std::string name)
PixelModuleName(bool isBarrel)
virtual std::string name() const
from base class
virtual PixelBarrelName::~PixelBarrelName ( )
inlinevirtual

Definition at line 31 of file PixelBarrelName.h.

31 { }

Member Function Documentation

PXBDetId PixelBarrelName::getDetId ( void  )

return the DetId

Definition at line 228 of file PixelBarrelName.cc.

References ladderName(), layerName(), mO, moduleName(), SurfaceOrientation::outer, pI, pO, shell(), and thePart.

228  {
229 
230  uint32_t layer = 0;
231  uint32_t ladder = 0;
232  uint32_t module = 0;
233 
234  layer = layerName();
235  uint32_t tmpLadder = ladderName();
236  uint32_t tmpModule = moduleName();
237 
238  // translate the ladder number from the naming convention to the cmssw convention
239  bool outer = false;
240  Shell shell = thePart;
241  outer = (shell == mO) || (shell == pO);
242  if (outer) {
243  if (layer == 1)
244  ladder = tmpLadder + 5;
245  else if (layer == 2)
246  ladder = tmpLadder + 8;
247  else if (layer == 3)
248  ladder = tmpLadder + 11;
249  } // outer
250  else { // inner
251  if (layer == 1) {
252  if (tmpLadder <= 5) ladder = 6 - tmpLadder;
253  else if (tmpLadder <= 10) ladder = 26 - tmpLadder;
254  } // layer 1
255  else if (layer == 2) {
256  if (tmpLadder <= 8) ladder = 9 - tmpLadder;
257  else if (tmpLadder <= 16) ladder = 41 - tmpLadder;
258  } // layer 2
259  else if (layer == 3) {
260  if (tmpLadder <= 11) ladder = 12 - tmpLadder;
261  else if (tmpLadder <= 22) ladder = 56 - tmpLadder;
262  } // layer 3
263  } // inner
264 
265  // translate the module number from naming convention to cmssw convention
266  // numbering starts at positive z
267  if (shell == pO || shell == pI)
268  module = tmpModule + 4;
269  else // negative z side
270  module = 5 - tmpModule;
271 
272  return PXBDetId(layer, ladder, module);
273 
274 } // PXBDetId PixelBarrelName::getDetId()
int moduleName() const
module id (index in z)
int ladderName() const
ladder id (index in phi)
int layerName() const
layer id
Shell shell() const
Definition: vlib.h:209
bool PixelBarrelName::isHalfModule ( ) const

full or half module

Definition at line 189 of file PixelBarrelName.cc.

References theLadder, and theLayer.

Referenced by PixelToLNKAssociateFromAscii::addConnections(), SiPixelHitEfficiencySource::analyze(), SiPixelHitEfficiencyModule::book(), SiPixelTrackResidualModule::book(), SiPixelRecHitModule::book(), SiPixelDigiModule::book(), SiPixelClusterModule::book(), SiPixelDigiModule::fill(), SiPixelInformationExtractor::findNoisyPixels(), sipixelobjects::FrameConversion::FrameConversion(), PixelBarrelLinkMaker::links(), moduleType(), and name().

190 {
191  bool halfModule = false;
192  if (theLadder == 1) halfModule = true;
193  if (theLayer == 1 && theLadder == 10) halfModule = true;
194  if (theLayer == 2 && theLadder == 16) halfModule = true;
195  if (theLayer == 3 && theLadder == 22) halfModule = true;
196  return halfModule;
197 }
int PixelBarrelName::ladderName ( ) const
inline
int PixelBarrelName::layerName ( ) const
inline
int PixelBarrelName::moduleName ( ) const
inline
PixelModuleName::ModuleType PixelBarrelName::moduleType ( ) const
virtual

module Type

Implements PixelModuleName.

Definition at line 199 of file PixelBarrelName.cc.

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

string PixelBarrelName::name ( ) const
virtual
bool PixelBarrelName::operator== ( const PixelModuleName o) const
virtual

check equality of modules from datamemebers

Implements PixelModuleName.

Definition at line 204 of file PixelBarrelName.cc.

References PixelModuleName::isBarrel(), python.connectstrParser::o, theLadder, theLayer, theModule, and thePart.

205 {
206  if ( o.isBarrel() ) {
207  const PixelBarrelName *other = dynamic_cast<const PixelBarrelName*>(&o);
208  return ( other
209  && thePart == other->thePart
210  && theLayer == other->theLayer
211  && theModule == other->theModule
212  && theLadder == other->theLadder);
213  } else return false;
214 }
virtual bool isBarrel() const
true for barrel modules
int PixelBarrelName::sectorName ( ) const

sector id

Definition at line 145 of file PixelBarrelName.cc.

References theLadder, and theLayer.

Referenced by name().

146 {
147  int sector = 0;
148  if (theLayer==1) {
149  switch (theLadder) {
150  case 1 : case 2: {sector = 1; break;}
151  case 3 : {sector = 2; break;}
152  case 4 : {sector = 3; break;}
153  case 5 : {sector = 4; break;}
154  case 6 : {sector = 5; break;}
155  case 7 : {sector = 6; break;}
156  case 8 : {sector = 7; break;}
157  case 9 : case 10:{sector = 8; break;}
158  default: ;
159  };
160  } else if (theLayer==2) {
161  switch (theLadder) {
162  case 1 : case 2: {sector = 1; break;}
163  case 3 : case 4: {sector = 2; break;}
164  case 5 : case 6: {sector = 3; break;}
165  case 7 : case 8: {sector = 4; break;}
166  case 9 : case 10: {sector = 5; break;}
167  case 11 : case 12: {sector = 6; break;}
168  case 13 : case 14: {sector = 7; break;}
169  case 15 : case 16: {sector = 8; break;}
170  default: ;
171  };
172  } else if (theLayer==3) {
173  switch (theLadder) {
174  case 1 : case 2: case 3: {sector = 1; break;}
175  case 4 : case 5: case 6: {sector = 2; break;}
176  case 7 : case 8: case 9: {sector = 3; break;}
177  case 10 : case 11: {sector = 4; break;}
178  case 12 : case 13: {sector = 5; break;}
179  case 14 : case 15: case 16: {sector = 6; break;}
180  case 17 : case 18: case 19: {sector = 7; break;}
181  case 20 : case 21: case 22: {sector = 8; break;}
182  default: ;
183  };
184  }
185  return sector;
186 
187 }
Shell PixelBarrelName::shell ( ) const
inline

Member Data Documentation

int PixelBarrelName::theLadder
private
int PixelBarrelName::theLayer
private

Definition at line 64 of file PixelBarrelName.h.

Referenced by isHalfModule(), layerName(), name(), operator==(), PixelBarrelName(), and sectorName().

int PixelBarrelName::theModule
private

Definition at line 64 of file PixelBarrelName.h.

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

Shell PixelBarrelName::thePart
private

Definition at line 63 of file PixelBarrelName.h.

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