15 const std::vector<unsigned>
memDCC(memarr, memarr + 44);
34 throw cms::Exception(
"InvalidDetId") <<
"EcalDQMCommonUtils::dccId(" << _id.
rawId() <<
")" << std::endl;
49 if(_index >= memDCC.size())
return 0;
50 return memDCC.at(_index) + 1;
56 std::vector<unsigned>::const_iterator itr(
std::find(memDCC.begin(), memDCC.end(), _dccid - 1));
57 if(itr == memDCC.end())
return -1;
59 return (itr - memDCC.begin());
76 throw cms::Exception(
"InvalidDetId") <<
"EcalDQMCommonUtils::tccId(" << uint32_t(_id) <<
")" << std::endl;
100 throw cms::Exception(
"InvalidDetId") <<
"EcalDQMCommonUtils::towerId(" << std::hex << uint32_t(_id) <<
")" << std::endl;
123 throw cms::Exception(
"InvalidDetId") <<
"EcalDQMCommonUtils::ttId(" << std::hex << uint32_t(_id) <<
")" << std::endl;
139 if((ic - 1) / 20 > 4 && (ic - 1) % 20 < 10)
return 1;
142 unsigned iDCC(
dccId(_id) - 1);
149 std::pair<unsigned, unsigned>
152 int iDCC(_dccId - 1);
153 std::pair<unsigned, unsigned>
res;
155 res.first = (iDCC -
kEEmLow) * 2;
156 if(res.first == 0) res.first = 18;
157 res.second = (iDCC -
kEEmLow) * 2 + 1;
160 res.first = res.second = _dccId + 27;
162 res.first = (iDCC -
kEEpLow) * 2 + 90;
163 if(res.first == 90) res.first = 108;
164 res.second = (iDCC -
kEEpLow) * 2 + 91;
170 std::pair<unsigned, unsigned>
173 int iDCC(_dccId - 1);
174 std::pair<unsigned, unsigned>
res;
176 res.first = (iDCC -
kEEmLow) * 2 + 18;
177 if(res.first == 18) res.first = 36;
178 res.second = (iDCC -
kEEmLow) * 2 + 19;
181 res.first = res.second = _dccId + 27;
183 res.first = (iDCC -
kEEpLow) * 2 + 72;
184 if(res.first == 72) res.first = 90;
185 res.second = (iDCC -
kEEpLow) * 2 + 73;
194 std::vector<DetId>
res;
196 int ixbase((_scid.
ix() - 1) * 5);
197 int iybase((_scid.
iy() - 1) * 5);
199 for(
int ix(1); ix <= 5; ++ix){
200 for(
int iy(1); iy <= 5; ++iy){
202 res.push_back(
EEDetId(ixbase + ix, iybase + iy, _scid.
zside()));
216 return (((rawId >> 16) & 0
x1) == 1 ? 1 : -1);
218 return (((rawId >> 14) & 0
x1) == 1 ? 1 : -1);
220 return (((rawId >> 15) & 0
x1) == 1 ? 1 : -1);
222 return (((rawId >> 4) & 0x7f) >
kEBpLow ? 1 : -1);
224 throw cms::Exception(
"InvalidDetId") <<
"EcalDQMCommonUtils::zside(" << std::hex << uint32_t(_id) <<
")" << std::endl;
245 const double degToRad(0.0174533);
246 return (_ebid.
iphi() - 10.5) * degToRad;
252 const double degToRad(0.0174533);
253 double p(std::atan2(_eeid.
ix() - 50.5, _eeid.
iy() - 50.5));
254 if(
p < -10. * degToRad)
p += 360. * degToRad;
261 const double degToRad(0.0174533);
262 double p((_ttid.
iphi() - 0.5) * 5. * degToRad);
263 if(
p > 350. * degToRad)
p -= 360. * degToRad;
270 const double degToRad(0.0174533);
271 if(_phi < -10. * degToRad) _phi += 360. * degToRad;
283 return (scid.
ix() - 10) * (scid.
ix() - 10) + (scid.
iy() - 10) * (scid.
iy() - 10) < 25.;
287 return (eeid.
ix() - 50) * (eeid.
ix() - 50) + (eeid.
iy() - 50) * (eeid.
iy() - 50) < 625.;
318 unsigned smNumber(std::atoi(_smName.substr(3).c_str()));
320 if(_smName.find(
"EE-") == 0)
321 return kEEmLow + 1 + ((smNumber + 2) % 9);
322 else if(_smName.find(
"EB-") == 0)
324 else if(_smName.find(
"EB+") == 0)
326 else if(_smName.find(
"EE+") == 0)
327 return kEEpLow + 1 + ((smNumber + 2) % 9);
335 std::stringstream ss;
337 unsigned iSM(_dccId - 1);
340 ss <<
"EE-" << std::setw(2) << std::setfill(
'0') << (((iSM -
kEEmLow + 6) % 9) + 1);
342 ss <<
"EB-" << std::setw(2) << std::setfill(
'0') << (iSM -
kEBmLow + 1);
344 ss <<
"EB+" << std::setw(2) << std::setfill(
'0') << (iSM -
kEBpLow + 1);
346 ss <<
"EE+" << std::setw(2) << std::setfill(
'0') << (((iSM -
kEEpLow + 6) % 9) + 1);
357 if(_ab == 0)
return 50;
360 if(_ab == 0)
return 47;
363 if(_ab == 0)
return 1;
366 if(_ab == 0)
return 5;
376 unsigned iSM(_dccId - 1);
412 unsigned iSM(_dccId - 1);
447 if(_towerId == 69 || _towerId == 70)
return true;
448 else if((_dccId == 8 || _dccId == 53) && _towerId >= 18 && _towerId <= 24)
return false;
450 else return _towerId <= 68;
472 std::lock_guard<std::mutex>
lock(mapMutex);
474 if(_throw)
throw cms::Exception(
"InvalidCall") <<
"ElectronicsMapping not initialized";
488 std::lock_guard<std::mutex>
lock(mapMutex);
495 std::lock_guard<std::mutex>
lock(mapMutex);
497 if(_throw)
throw cms::Exception(
"InvalidCall") <<
"TrigTowerConstituentsMap not initialized";
511 std::lock_guard<std::mutex>
lock(mapMutex);
518 std::lock_guard<std::mutex>
lock(mapMutex);
520 if(_throw)
throw cms::Exception(
"InvalidCall") <<
"CaloGeometry not initialized";
534 std::lock_guard<std::mutex>
lock(mapMutex);
541 std::lock_guard<std::mutex>
lock(mapMutex);
543 if(_throw)
throw cms::Exception(
"InvalidCall") <<
"CaloTopology not initialized";
557 std::lock_guard<std::mutex>
lock(mapMutex);
std::vector< unsigned > const memDCC
static boost::mutex mutex
unsigned memDCCIndex(unsigned)
int tccId() const
get the DCC (Ecal Local DCC value not global one) id
CaloTopology const * topology(0)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
EcalElectronicsMapping const * getElectronicsMap()
constexpr uint32_t rawId() const
get the raw id
unsigned tccId(DetId const &)
bool isForward(DetId const &)
std::pair< unsigned, unsigned > outerTCCs(unsigned)
int towerId() const
get the tower id
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
bool ccuExists(unsigned, unsigned)
std::pair< int, int > getDCCandSC(EcalScDetId id) const
CaloGeometry const * geometry(0)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
CaloGeometry const * getGeometry()
unsigned ttId(DetId const &)
unsigned nSuperCrystals(unsigned)
int iphi() const
get the crystal iphi
unsigned EEPnDCC(unsigned _dee, unsigned _ab)
bool isEndcapTTId(DetId const &)
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
unsigned nCrystals(unsigned)
CaloTopology const * getTopology()
bool checkElectronicsMap(bool=true)
EcalTrigTowerConstituentsMap const * getTrigTowerMap()
int ttId() const
get the tower id
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
void setGeometry(CaloGeometry const *)
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
unsigned rtHalf(DetId const &)
static const float crystalUnitToEta
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
int iDCCId() const
get the DCCId
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
unsigned towerId(DetId const &)
bool isEcalScDetId(DetId const &)
unsigned memDCCId(unsigned)
bool isSingleChannelId(DetId const &)
int iphi() const
get the tower iphi
void setTopology(CaloTopology const *)
std::string smName(unsigned)
bool checkTopology(bool=true)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
bool checkTrigTowerMap(bool=true)
bool isCrystalId(DetId const &)
void setElectronicsMap(EcalElectronicsMapping const *)
EcalElectronicsMapping const * electronicsMap(0)
std::pair< unsigned, unsigned > innerTCCs(unsigned)
EcalTrigTowerConstituentsMap const * trigtowerMap(0)
std::vector< DetId > scConstituents(EcalScDetId const &)
void setTrigTowerMap(EcalTrigTowerConstituentsMap const *)
int iTT() const
sequential index within one DCC
bool checkGeometry(bool=true)
unsigned dccId(DetId const &)
double eta(EBDetId const &)
double phi(EBDetId const &)
int zside() const
get the z-side of the crystal (1/-1)
constexpr Detector det() const
get the detector field from this detid