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
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...
 
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...
 
 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
 
virtual ~PixelBarrelNameUpgrade ()
 
- 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

Constructor & Destructor Documentation

PixelBarrelNameUpgrade::PixelBarrelNameUpgrade ( const DetId id)

ctor from DetId

Definition at line 11 of file PixelBarrelNameUpgrade.cc.

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

12  : PixelModuleName(true)
13 {
14 
15 // uint32_t rawId = id.rawId();
16  PXBDetId cmssw_numbering(id);
17 
18 
19  theLayer = cmssw_numbering.layer();
20 
21  int oldModule = cmssw_numbering.module() -4; if (oldModule<=0) oldModule--; // -4, ..., -1, +1, ...,+4
22 
23  int oldLadder = cmssw_numbering.ladder();
24 
25  if (theLayer == 1) {
26  if (oldLadder <= 3) oldLadder = 4-oldLadder; // +1, ..., +3
27  else if (oldLadder >= 4 && oldLadder <= 9 ) oldLadder = 3-oldLadder; // -1, ..., -6
28  else if (oldLadder >= 10) oldLadder = 16-oldLadder; // +6, ..., +4
29  }
30  else if (theLayer == 2) {
31  if (oldLadder <= 7) oldLadder = 8-oldLadder;
32  else if (oldLadder >= 8 && oldLadder <= 21) oldLadder = 7-oldLadder;
33  else if (oldLadder >= 22) oldLadder = 36-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  else if (theLayer == 4) {
41  if (oldLadder <= 16) oldLadder = 17-oldLadder;
42  else if (oldLadder >= 17 && oldLadder <= 48) oldLadder = 16-oldLadder;
43  else if (oldLadder >= 49) oldLadder = 81-oldLadder;
44  }
45 
46  //
47  // part
48  //
49  if (oldModule < 0 && oldLadder < 0) thePart = mO;
50  else if (oldModule > 0 && oldLadder < 0) thePart = pO;
51  else if (oldModule < 0 && oldLadder > 0) thePart = mI;
52  else if (oldModule > 0 && oldLadder > 0) thePart = pI;
53  //std::cout << "(oldModule, oldLadder)============(" << oldModule << ", "<< oldLadder<<" )" << std::endl;
54 
55  //
56  // ladder
57  //
58  theLadder = abs(oldLadder);
59 
60  //
61  // module
62  //
63  theModule = abs(oldModule);
64 
65 }
PixelModuleName(bool isBarrel)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 23 of file PixelBarrelNameUpgrade.h.

PixelBarrelNameUpgrade::PixelBarrelNameUpgrade ( std::string  name)

ctor from name string

Definition at line 69 of file PixelBarrelNameUpgrade.cc.

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

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

Definition at line 31 of file PixelBarrelNameUpgrade.h.

31 { }

Member Function Documentation

PXBDetId PixelBarrelNameUpgrade::getDetId ( void  )

return the DetId

Definition at line 264 of file PixelBarrelNameUpgrade.cc.

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

264  {
265 
266  uint32_t layer = 0;
267  uint32_t ladder = 0;
268  uint32_t module = 0;
269 
270  layer = layerName();
271  uint32_t tmpLadder = ladderName();
272  uint32_t tmpModule = moduleName();
273 
274  // translate the ladder number from the naming convention to the cmssw convention
275  bool outer = false;
276  Shell shell = thePart;
277  outer = (shell == mO) || (shell == pO);
278  if (outer) {
279  if (layer == 1)
280  ladder = tmpLadder + 3;
281  else if (layer == 2)
282  ladder = tmpLadder + 7;
283  else if (layer == 3)
284  ladder = tmpLadder + 11;
285  else if (layer == 4)
286  ladder = tmpLadder + 16;
287  } // outer
288  else { // inner
289  if (layer == 1) {
290  if (tmpLadder <= 3) ladder = 4 - tmpLadder;
291  else if (tmpLadder <= 6) ladder = 16 - tmpLadder;
292  } // layer 1
293  else if (layer == 2) {
294  if (tmpLadder <= 7) ladder = 8 - tmpLadder;
295  else if (tmpLadder <= 14) ladder = 36 - tmpLadder;
296  } // layer 2
297  else if (layer == 3) {
298  if (tmpLadder <= 11) ladder = 12 - tmpLadder;
299  else if (tmpLadder <= 22) ladder = 56 - tmpLadder;
300  } // layer 3
301  else if (layer == 4) {
302  if (tmpLadder <= 16) ladder = 17 - tmpLadder;
303  else if (tmpLadder <= 32) ladder = 81 - tmpLadder;
304  } // layer 4
305  } // inner
306 
307  // translate the module number from naming convention to cmssw convention
308  // numbering starts at positive z
309  if (shell == pO || shell == pI)
310  module = tmpModule + 4;
311  else // negative z side
312  module = 5 - tmpModule;
313 
314  return PXBDetId(layer, ladder, module);
315 
316 } // PXBDetId PixelBarrelNameUpgrade::getDetId()
int ladderName() const
ladder id (index in phi)
int moduleName() const
module id (index in z)
Definition: vlib.h:208
int layerName() const
layer id
bool PixelBarrelNameUpgrade::isHalfModule ( ) const

full or half module

Definition at line 209 of file PixelBarrelNameUpgrade.cc.

Referenced by SiPixelHitEfficiencySource::analyze(), SiPixelTrackResidualModule::book(), SiPixelHitEfficiencyModule::book(), SiPixelRecHitModule::book(), SiPixelDigiModule::book(), SiPixelClusterModule::book(), SiPixelDigiModule::fill(), and moduleType().

210 {
211  bool halfModule = false;
212 // if (theLadder == 1) halfModule = true;
213 // if (theLayer == 1 && theLadder == 10) halfModule = true;
214 // if (theLayer == 2 && theLadder == 16) halfModule = true;
215 // if (theLayer == 3 && theLadder == 22) halfModule = true;
216  return halfModule;
217 }
int PixelBarrelNameUpgrade::ladderName ( ) const
inline
int PixelBarrelNameUpgrade::layerName ( ) const
inline
int PixelBarrelNameUpgrade::moduleName ( ) const
inline
PixelModuleName::ModuleType PixelBarrelNameUpgrade::moduleType ( ) const
virtual
string PixelBarrelNameUpgrade::name ( ) const
virtual
bool PixelBarrelNameUpgrade::operator== ( const PixelModuleName o) const
virtual

check equality of modules from datamemebers

Implements PixelModuleName.

Definition at line 227 of file PixelBarrelNameUpgrade.cc.

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

228 {
229  if ( o.isBarrel() ) {
230  const PixelBarrelNameUpgrade *other = dynamic_cast<const PixelBarrelNameUpgrade*>(&o);
231  return ( other
232  && thePart == other->thePart
233  && theLayer == other->theLayer
234  && theModule == other->theModule
235  && theLadder == other->theLadder);
236  } else return false;
237 }
virtual bool isBarrel() const
true for barrel modules
int PixelBarrelNameUpgrade::sectorName ( ) const

sector id

Definition at line 150 of file PixelBarrelNameUpgrade.cc.

References theLadder, and theLayer.

Referenced by name().

151 {
152  int sector = 0;
153  if (theLayer==1) {
154  switch (theLadder) {
155  case 1 : {sector = 1; break;}
156  case 2 : {sector = 2; break;}
157  case 3 : {sector = 3; break;}
158  case 4 : {sector = 6; break;}
159  case 5 : {sector = 7; break;}
160  case 6 : {sector = 8; break;}
161  default: ;
162  };
163  } else if (theLayer==2) {
164  switch (theLadder) {
165  case 1 : case 2: {sector = 1; break;}
166  case 3 : case 4: {sector = 2; break;}
167  case 5 : case 6: {sector = 3; break;}
168  case 7 : {sector = 4; break;}
169  case 8 : {sector = 5; break;}
170  case 9 : case 10: {sector = 6; break;}
171  case 11 : case 12: {sector = 7; break;}
172  case 13 : case 14: {sector = 8; break;}
173  default: ;
174  };
175  } else if (theLayer==3) {
176  switch (theLadder) {
177  case 1 : case 2: case 3: {sector = 1; break;}
178  case 4 : case 5: case 6: {sector = 2; break;}
179  case 7 : case 8: case 9: {sector = 3; break;}
180  case 10 : case 11: {sector = 4; break;}
181  case 12 : case 13: {sector = 5; break;}
182  case 14 : case 15: case 16: {sector = 6; break;}
183  case 17 : case 18: case 19: {sector = 7; break;}
184  case 20 : case 21: case 22: {sector = 8; break;}
185  default: ;
186  };
187  }
188  else if (theLayer==4) {
189  switch (theLadder) {
190  case 1 : case 2: case 3: case 4: {sector = 1; break;}
191  case 5 : case 6: case 7: case 8: {sector = 2; break;}
192  case 9 : case 10: case 11: case 12: {sector = 3; break;}
193  case 13 : case 14: case 15: case 16: {sector = 4; break;}
194  case 17 : case 18: case 19: case 20: {sector = 5; break;}
195  case 21 : case 22: case 23: case 24: {sector = 6; break;}
196  case 25 : case 26: case 27: case 28: {sector = 7; break;}
197  case 29 : case 30: case 31: case 32: {sector = 8; break;}
198  default: ;
199  };
200  }
201 
202 
203  return sector;
204 
205 }
Shell PixelBarrelNameUpgrade::shell ( ) const
inline

Member Data Documentation

int PixelBarrelNameUpgrade::theLadder
private
int PixelBarrelNameUpgrade::theLayer
private
int PixelBarrelNameUpgrade::theModule
private

Definition at line 64 of file PixelBarrelNameUpgrade.h.

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

Shell PixelBarrelNameUpgrade::thePart
private

Definition at line 63 of file PixelBarrelNameUpgrade.h.

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