Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:03

0001 #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
0002 #include "FWCore/Utilities/interface/Exception.h"
0003 
0004 #include <ostream>
0005 
0006 EcalTriggerElectronicsId::EcalTriggerElectronicsId() { EcalTriggerElectronicsId_ = 0xFFFFFFFFu; }
0007 
0008 EcalTriggerElectronicsId::EcalTriggerElectronicsId(uint32_t id) { EcalTriggerElectronicsId_ = id; }
0009 
0010 EcalTriggerElectronicsId::EcalTriggerElectronicsId(int tccid, int ttid, int pseudostripid, int channelid) {
0011   if ((tccid < MIN_TCCID) || (tccid > MAX_TCCID) || (ttid < MIN_TTID) || (ttid > MAX_TTID) ||
0012       (pseudostripid < MIN_PSEUDOSTRIPID) || (pseudostripid > MAX_PSEUDOSTRIPID) || (channelid < MIN_CHANNELID) ||
0013       (channelid > MAX_CHANNELID))
0014     throw cms::Exception("InvalidDetId") << "EcalTriggerElectronicsId:  Cannot create object.  Indexes out of bounds.";
0015   EcalTriggerElectronicsId_ =
0016       (channelid & 0x7) | ((pseudostripid & 0x7) << 3) | ((ttid & 0x7F) << 6) | ((tccid & 0x7F) << 13);
0017 }
0018 
0019 int EcalTriggerElectronicsId::zside() const {
0020   int tcc = tccId();
0021   if ((tcc >= MIN_TCCID_EEM && tcc <= MAX_TCCID_EEM))
0022     return -1;
0023   if ((tcc >= MIN_TCCID_EBM && tcc <= MAX_TCCID_EBM))
0024     return -1;
0025   if ((tcc >= MIN_TCCID_EEP && tcc <= MAX_TCCID_EEP))
0026     return +1;
0027   if ((tcc >= MIN_TCCID_EBP && tcc <= MAX_TCCID_EBP))
0028     return +1;
0029   return 0;
0030 }
0031 
0032 EcalSubdetector EcalTriggerElectronicsId::subdet() const {
0033   int tcc = tccId();
0034   if ((tcc >= MIN_TCCID_EBM && tcc <= MAX_TCCID_EBM) || (tcc >= MIN_TCCID_EBP && tcc <= MAX_TCCID_EBP))
0035     return EcalBarrel;
0036   else
0037     return EcalEndcap;
0038 }
0039 
0040 std::ostream& operator<<(std::ostream& os, const EcalTriggerElectronicsId& id) {
0041   return os << id.tccId() << ',' << id.ttId() << ',' << id.pseudoStripId() << ',' << id.channelId();
0042 }