Go to the documentation of this file.00001
00002
00003
00005 #include "Geometry/EcalCommonData/interface/EcalBarrelNumberingScheme.h"
00006 #include "DataFormats/EcalDetId/interface/EBDetId.h"
00007
00008 #include <iostream>
00009
00010 EcalBarrelNumberingScheme::EcalBarrelNumberingScheme() :
00011 EcalNumberingScheme() {
00012 edm::LogInfo("EcalGeom") << "Creating EcalBarrelNumberingScheme";
00013 }
00014
00015 EcalBarrelNumberingScheme::~EcalBarrelNumberingScheme() {
00016 edm::LogInfo("EcalGeom") << "Deleting EcalBarrelNumberingScheme";
00017 }
00018
00019 uint32_t EcalBarrelNumberingScheme::getUnitID(const EcalBaseNumber& baseNumber) const {
00020
00021 const uint32_t nLevels ( baseNumber.getLevels() ) ;
00022
00023
00024
00025
00026 if( 12 > nLevels )
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 const std::string& cryName ( baseNumber.getLevelName( 0 ) ) ;
00036
00037 const int cryType ( ::atoi( cryName.c_str() + 5 ) ) ;
00038
00039 const int off ( 12 < nLevels ? 3 : 0 ) ;
00040
00041 const uint32_t wallCopy ( baseNumber.getCopyNumber( 3 + off ) ) ;
00042 const uint32_t hawCopy ( baseNumber.getCopyNumber( 4 + off ) ) ;
00043 const uint32_t fawCopy ( baseNumber.getCopyNumber( 5 + off ) ) ;
00044 const uint32_t supmCopy ( baseNumber.getCopyNumber( 6 + off ) ) ;
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 if( 1 > cryType ||
00058 17 < cryType )
00059 {
00060 edm::LogWarning("EdalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
00061 << "****************** Bad crystal name = "
00062 << cryName
00063 << ", Volume Name = "
00064 << baseNumber.getLevelName(0) ;
00065 return 0 ;
00066 }
00067
00068 if( 1 > wallCopy ||
00069 5 < wallCopy )
00070 {
00071 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
00072 << "****************** Bad wall copy = "
00073 << wallCopy
00074 << ", Volume Name = "
00075 << baseNumber.getLevelName(3) ;
00076 return 0 ;
00077 }
00078
00079 if( 1 > hawCopy ||
00080 2 < hawCopy )
00081 {
00082 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
00083 << "****************** Bad haw copy = "
00084 << hawCopy
00085 << ", Volume Name = "
00086 << baseNumber.getLevelName(4) ;
00087 return 0 ;
00088 }
00089
00090 if( 1 > fawCopy ||
00091 10 < fawCopy )
00092 {
00093 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
00094 << "****************** Bad faw copy = "
00095 << fawCopy
00096 << ", Volume Name = "
00097 << baseNumber.getLevelName(5) ;
00098 return 0 ;
00099 }
00100
00101 if( 1 > supmCopy ||
00102 36 < supmCopy )
00103 {
00104 edm::LogWarning("EcalGeom") << "ECalBarrelNumberingScheme::getUnitID(): "
00105 << "****************** Bad supermodule copy = "
00106 << supmCopy
00107 << ", Volume Name = "
00108 << baseNumber.getLevelName(6) ;
00109 return 0 ;
00110 }
00111
00112
00113
00114 const int32_t zsign ( 18 < supmCopy ? -1 : 1 ) ;
00115
00116 const int32_t eta ( 5*( cryType - 1 ) + wallCopy ) ;
00117
00118 const int32_t phi ( 18 < supmCopy ?
00119 20*( supmCopy - 19 ) + 2*( 10 - fawCopy ) + 3 - hawCopy :
00120 20*( supmCopy - 1 ) + 2*( fawCopy - 1 ) + hawCopy ) ;
00121
00122 const int32_t intindex ( EBDetId( zsign*eta, phi ).rawId() ) ;
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 return intindex ;
00145 }