#include <Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h>
Public Member Functions | |
EcalBarrelNumberingScheme () | |
virtual uint32_t | getUnitID (const EcalBaseNumber &baseNumber) const |
~EcalBarrelNumberingScheme () |
Definition at line 10 of file EcalBarrelNumberingScheme.h.
EcalBarrelNumberingScheme::EcalBarrelNumberingScheme | ( | ) |
Definition at line 10 of file EcalBarrelNumberingScheme.cc.
00010 : 00011 EcalNumberingScheme() { 00012 edm::LogInfo("EcalGeom") << "Creating EcalBarrelNumberingScheme"; 00013 }
EcalBarrelNumberingScheme::~EcalBarrelNumberingScheme | ( | ) |
Definition at line 15 of file EcalBarrelNumberingScheme.cc.
00015 { 00016 edm::LogInfo("EcalGeom") << "Deleting EcalBarrelNumberingScheme"; 00017 }
uint32_t EcalBarrelNumberingScheme::getUnitID | ( | const EcalBaseNumber & | baseNumber | ) | const [virtual] |
Implements EcalNumberingScheme.
Definition at line 19 of file EcalBarrelNumberingScheme.cc.
References eta, EcalBaseNumber::getCopyNumber(), EcalBaseNumber::getLevelName(), EcalBaseNumber::getLevels(), int, LogDebug, and phi.
00019 { 00020 00021 const uint32_t nLevels ( baseNumber.getLevels() ) ; 00022 00023 LogDebug("EcalGeom") << "ECalBarrelNumberingScheme geometry levels = " << nLevels; 00024 00025 if( 7 > nLevels ) 00026 { 00027 00028 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " 00029 << "Not enough levels found in EcalBaseNumber ( " 00030 << nLevels 00031 << ") Returning 0" ; 00032 return 0; 00033 } 00034 00035 // Static geometry 00036 00037 if ( nLevels <= 8 ) { 00038 00039 00040 if (baseNumber.getLevels()<1) { 00041 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID: No " 00042 << "level found in EcalBaseNumber Returning 0"; 00043 return 0; 00044 } 00045 00046 int PVid = baseNumber.getCopyNumber(0); 00047 int MVid = 1; 00048 int MMVid = 1; 00049 00050 if (baseNumber.getLevels() > 1) { 00051 MVid = baseNumber.getCopyNumber(1); 00052 } else { 00053 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID: Null" 00054 << " pointer to alveole ! Use default id=1"; } 00055 if (baseNumber.getLevels() > 2) { 00056 MMVid = baseNumber.getCopyNumber(2); 00057 } else { 00058 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID: Null" 00059 << " pointer to module ! Use default id=1"; 00060 } 00061 00062 // z side 00063 int zside = baseNumber.getCopyNumber("EREG"); 00064 if ( zside == 1 || zside == 2 ) { 00065 zside=2*(1-zside)+1; 00066 } 00067 else if ( zside == 0 ) { 00068 // MTCC geometry 00069 int zMTCC = baseNumber.getCopyNumber("EREG_P"); 00070 if ( zMTCC == 1 ) { 00071 zside = 1; 00072 } 00073 } 00074 00075 // eta index of in Lyon geometry 00076 int ieta = PVid%5; 00077 if( ieta == 0) {ieta = 5;} 00078 int eta = 5 * (int) ((float)(PVid - 1)/10.) + ieta; 00079 00080 // phi index in Lyon geometry 00081 int isubm = 1 + (int) ((float)(PVid - 1)/5.); 00082 int iphi = (isubm%2) == 0 ? 2: 1; 00083 int phi=-1; 00084 00085 if (zside == 1) 00086 phi = (20*(18-MMVid) + 2*(10-MVid) + iphi + 20) % 360 ; 00087 else if (zside == -1) 00088 phi = (541 - (20*(18-MMVid) + 2*(10-MVid) + iphi) ) % 360 ; 00089 00090 if (phi == 0) 00091 phi = 360; 00092 00093 //pack it into an integer 00094 // to be consistent with EBDetId convention 00095 // zside=2*(1-zside)+1; 00096 uint32_t intindex = EBDetId(zside*eta,phi).rawId(); 00097 00098 LogDebug("EcalGeom") << "EcalBarrelNumberingScheme zside = " << zside 00099 << " eta = " << eta << " phi = " << phi 00100 << " packed index = 0x" << std::hex << intindex 00101 << std::dec; 00102 return intindex; 00103 00104 } 00105 00106 // Algorithmic geometry 00107 00108 else 00109 00110 { 00111 00112 const std::string & cryName = baseNumber.getLevelName( 0 ) ; // name of crystal volume 00113 //std::istringstream stream ( cryName.substr( cryName.find_first_of('_') + 1, 2 ) ) ; 00114 //int cryType ( -1 ) ; 00115 // stream >> cryType ; 00116 int cryType = ::atoi( cryName.substr( cryName.find_first_of('_') + 1, 2 ).c_str()); 00117 00118 const uint32_t wallCopy ( baseNumber.getCopyNumber( 3 ) ) ; 00119 const uint32_t hawCopy ( baseNumber.getCopyNumber( 4 ) ) ; 00120 const uint32_t fawCopy ( baseNumber.getCopyNumber( 5 ) ) ; 00121 const uint32_t supmCopy ( baseNumber.getCopyNumber( 6 ) ) ; 00122 00123 00124 LogDebug("EcalGeom") << baseNumber.getLevelName(0) << ", " 00125 << baseNumber.getLevelName(1) << ", " 00126 << baseNumber.getLevelName(2) << ", " 00127 << baseNumber.getLevelName(3) << ", " 00128 << baseNumber.getLevelName(4) << ", " 00129 << baseNumber.getLevelName(5) << ", " 00130 << baseNumber.getLevelName(6) << ", " 00131 << baseNumber.getLevelName(7) ; 00132 00133 // error checking 00134 00135 if( 1 > cryType || 00136 17 < cryType ) 00137 { 00138 edm::LogWarning("EdalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " 00139 << "****************** Bad crystal name = " << cryName 00140 << ", Volume Name = " << baseNumber.getLevelName(0) ; 00141 return 0 ; 00142 } 00143 00144 if( 1 > wallCopy || 00145 5 < wallCopy ) 00146 { 00147 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " 00148 << "****************** Bad wall copy = " << wallCopy 00149 << ", Volume Name = " << baseNumber.getLevelName(3) ; 00150 return 0 ; 00151 } 00152 00153 if( 1 > hawCopy || 00154 2 < hawCopy ) 00155 { 00156 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " 00157 << "****************** Bad haw copy = " << hawCopy 00158 << ", Volume Name = " << baseNumber.getLevelName(4) ; 00159 return 0 ; 00160 } 00161 00162 if( 1 > fawCopy || 00163 10 < fawCopy ) 00164 { 00165 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " 00166 << "****************** Bad faw copy = " << fawCopy 00167 << ", Volume Name = " << baseNumber.getLevelName(5) ; 00168 return 0 ; 00169 } 00170 00171 if( 1 > supmCopy || 00172 36 < supmCopy ) 00173 { 00174 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): " 00175 << "****************** Bad supermodule copy = " << supmCopy 00176 << ", Volume Name = " << baseNumber.getLevelName(6) ; 00177 return 0 ; 00178 } 00179 00180 // all inputs are fine. Go ahead and decode 00181 00182 const int32_t zsign ( 18 < supmCopy ? -1 : 1 ) ; 00183 00184 const int32_t eta ( 5*( cryType - 1 ) + wallCopy ) ; 00185 00186 const int32_t phi ( 18 < supmCopy ? 00187 20*( supmCopy - 19 ) + 2*( 10 - fawCopy ) + 3 - hawCopy : 00188 20*( supmCopy - 1 ) + 2*( fawCopy - 1 ) + hawCopy ) ; 00189 00190 const int32_t intindex ( EBDetId( zsign*eta, phi ).rawId() ) ; 00191 00192 00193 LogDebug("EcalGeom") << "EcalBarrelNumberingScheme: " 00194 << "supmCopy = " << supmCopy 00195 << ", fawCopy = " << fawCopy 00196 << ", hawCopy = " << hawCopy 00197 << ", wallCopy = " << wallCopy 00198 << ", cryType = " << cryType 00199 << "\n zsign = " << zsign 00200 << ", eta = " << eta 00201 << ", phi = " << phi 00202 << ", packed index = 0x" << std::hex << intindex << std::dec ; 00203 00204 return intindex; 00205 } 00206 00207 }