CMS 3D CMS Logo

List of all members | Public Member Functions
EcalEndcapNumberingScheme Class Reference

#include <EcalEndcapNumberingScheme.h>

Inheritance diagram for EcalEndcapNumberingScheme:
EcalNumberingScheme CaloNumberingScheme

Public Member Functions

 EcalEndcapNumberingScheme ()
 
uint32_t getUnitID (const EcalBaseNumber &baseNumber) const override
 
 ~EcalEndcapNumberingScheme () override
 
- Public Member Functions inherited from EcalNumberingScheme
 EcalNumberingScheme ()
 
 ~EcalNumberingScheme () override
 
- Public Member Functions inherited from CaloNumberingScheme
 CaloNumberingScheme (int iv=0)
 Constructor with optional verbosity control. More...
 
void setVerbosity (int)
 Verbosity setting. More...
 
virtual ~CaloNumberingScheme ()
 

Additional Inherited Members

- Protected Attributes inherited from CaloNumberingScheme
int verbosity
 Verbosity field: Zero = quiet, increasing integers mean more output. More...
 

Detailed Description

Definition at line 10 of file EcalEndcapNumberingScheme.h.

Constructor & Destructor Documentation

EcalEndcapNumberingScheme::EcalEndcapNumberingScheme ( )

Definition at line 11 of file EcalEndcapNumberingScheme.cc.

11  :
13  edm::LogInfo("EcalGeom") << "Creating EcalEndcapNumberingScheme";
14 }
EcalEndcapNumberingScheme::~EcalEndcapNumberingScheme ( )
override

Definition at line 16 of file EcalEndcapNumberingScheme.cc.

16  {
17  edm::LogInfo("EcalGeom") << "Deleting EcalEndcapNumberingScheme";
18 }

Member Function Documentation

uint32_t EcalEndcapNumberingScheme::getUnitID ( const EcalBaseNumber baseNumber) const
overridevirtual

Implements EcalNumberingScheme.

Definition at line 19 of file EcalEndcapNumberingScheme.cc.

References DetId::Ecal, EcalBaseNumber::getCopyNumber(), EcalBaseNumber::getLevelName(), EcalBaseNumber::getLevels(), triggerObjects_cff::id, DetId::rawId(), EEDetId::SCCRYSTALMODE, EEDetId::Subdet, EEDetId::validDetId(), and ecaldqm::zside().

19  {
20 
21 
22  const uint32_t nLevels ( baseNumber.getLevels() ) ;
23 
24  //LogDebug("EcalGeom") << "ECalEndcapNumberingScheme geometry levels = " << nLevels;
25 
26  if( 7 > nLevels )
27  {
28 
29  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
30  << "Not enough levels found in EcalBaseNumber ( "
31  << nLevels
32  << ") Returning 0" ;
33  return 0;
34  }
35 
36  if ( nLevels <= 10 )
37  {
38 
39 
40  // Static geometry
41 
42 
43  if (baseNumber.getLevels()<1) {
44  edm::LogWarning("EcalGeom") << "EalEndcaplNumberingScheme::getUnitID: No "
45  << "level found in EcalBaseNumber Returning 0";
46  return 0;
47  }
48 
49  int PVid = baseNumber.getCopyNumber(0);
50  int MVid = 1;
51  if (baseNumber.getLevels() > 1)
52  MVid = baseNumber.getCopyNumber(1);
53  else
54  edm::LogWarning("EcalGeom") << "ECalEndcapNumberingScheme::getUnitID: Null"
55  << " pointer to alveole ! Use default id=1";
56 
57  int zside = baseNumber.getCopyNumber("EREG");
58  zside=2*(1-zside)+1;
59  int module_number = MVid;
60  int crystal_number = PVid;
61 
62  uint32_t intindex = EEDetId(module_number,crystal_number,zside,EEDetId::SCCRYSTALMODE).rawId();
63 
64 //LogDebug("EcalGeom") << "EcalEndcapNumberingScheme: zside = " << zside
65 // << " super crystal = " << module_number << " crystal = "
66 // << crystal_number << " packed index = 0x" << std::hex
67 // << intindex << std::dec;
68 
69 
70  return intindex;
71  }
72  else
73  {
74  // algorithmic geometry
75 
76  const int ic ( baseNumber.getCopyNumber(0)%100 ) ; // crystal #, 0-44
77  const int icx ( ic/10 ) ;
78  const int icy ( ic%5 ) ;
79  const int is ( baseNumber.getCopyNumber(2)%100 ) ; // supercrystal #, 0-99
80  const int isx ( is/10 ) ;
81  const int isy ( is%10 ) ;
82 
83  const int iq ( 3 - 2*baseNumber.getCopyNumber(3) ) ; // quadrant #, -1, +1
84  const int id ( 3 - 2*baseNumber.getCopyNumber(5) ) ; // dee #, -1, +1
85 
86  const int iz ( 3 - 2*baseNumber.getCopyNumber(7) ) ; // z: -1, +1
87 
88  const int ix ( 50 + id*iz*( 5*isx + icx + 1 ) - ( id*iz - 1 )/2 ) ; // x: 1-100
89  const int iy ( 50 + id*iq*( 5*isy + icy + 1 ) - ( id*iq - 1 )/2 ) ; // y: 1-100
90 
91  const uint32_t idet ( DetId( DetId::Ecal, EEDetId::Subdet ) | ( ( ( 0<iz ? 0x4000 : 0 ) ) + ( ix<<7 ) + iy ) ) ;
92 
93  //*************************** ERROR CHECKING **********************************
94 
95  if( 0 > icx ||
96  4 < icx ||
97  0 > icy ||
98  4 < icy )
99  {
100  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
101  << "****************** Bad crystal number = " << ic
102  << ", Volume Name = " << baseNumber.getLevelName(0) ;
103  return 0 ;
104  }
105 
106  if( 0 > isx ||
107  9 < isx ||
108  0 > isy ||
109  9 < isy )
110  {
111  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
112  << "****************** Bad supercrystal number = " << is
113  << ", Volume Name = " << baseNumber.getLevelName(3) ;
114  return 0 ;
115  }
116 
117  if( 1 != iq &&
118  -1 != iq )
119  {
120  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
121  << "****************** Bad quadrant number = " << iq
122  << ", Volume Name = " << baseNumber.getLevelName(4) ;
123  return 0 ;
124  }
125 
126  if( 1 != id &&
127  -1 != id )
128  {
129  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
130  << "****************** Bad dee number = " << id
131  << ", Volume Name = " << baseNumber.getLevelName(6) ;
132  return 0 ;
133  }
134 
135  if( -1 != iz &&
136  1 != iz )
137  {
138  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
139  << "****************** Bad z-end number = " << iz
140  << ", Volume Name = " << baseNumber.getLevelName(8) ;
141  return 0 ;
142  }
143 
144  if( !EEDetId::validDetId( ix, iy, iz ) )
145  {
146  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
147  << "****************** Bad DetId numbers = "
148  << ix << ", " << iy << ", " << iz ;
149  return 0 ;
150  }
151 
152  //*************************************************************************************
153 /*
154  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::getUnitID(): "
155  <<std::dec<< ix << ", " << iy << ", " <<iq << ", " << id << ", " << iz << ", " << std::hex << idet ;
156 
157  edm::LogWarning("EdalGeom") << "ECalEndcapNumberingScheme::EEDetId: "
158  << EEDetId(idet) ;
159 */
160  return idet ;
161  }
162 }
std::string const & getLevelName(int level) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
int getCopyNumber(int level) const
int zside(DetId const &)
static const int SCCRYSTALMODE
Definition: EEDetId.h:340
Definition: DetId.h:18
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
Definition: EEDetId.h:248
int getLevels() const