Go to the documentation of this file.00001 #include "DataFormats/HcalDetId/interface/CastorElectronicsId.h"
00002
00003
00004 CastorElectronicsId::CastorElectronicsId() {
00005 castorElectronicsId_=0xffffffffu;
00006 }
00007
00008 CastorElectronicsId::CastorElectronicsId(uint32_t id) {
00009 castorElectronicsId_=id;
00010 }
00011
00012 CastorElectronicsId::CastorElectronicsId(int fiberChan, int fiberIndex, int spigot, int dccid) {
00013 castorElectronicsId_=(fiberChan&0x3) | (((fiberIndex-1)&0xf)<<2) |
00014 ((spigot&0xF)<<6) | ((dccid&0xF)<<10);
00015 }
00016
00017 CastorElectronicsId::CastorElectronicsId(int slbChan, int slbSite, int spigot, int dccid, int crate, int slot, int tb) {
00018 castorElectronicsId_=(slbChan&0x3) | (((slbSite-1)&0xf)<<2) |
00019 ((spigot&0xF)<<6) | ((dccid&0xF)<<10);
00020 castorElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
00021 castorElectronicsId_|=0x02000000;
00022 }
00023
00024 std::string CastorElectronicsId::slbChannelCode() const {
00025 std::string retval;
00026 if (isTriggerChainId()) {
00027 if (htrTopBottom()) {
00028 switch (slbChannelIndex()) {
00029 case (0): retval="A0"; break;
00030 case (1): retval="A1"; break;
00031 case (2): retval="C0"; break;
00032 case (3): retval="C1"; break;
00033 }
00034 } else {
00035 switch (slbChannelIndex()) {
00036 case (0): retval="B0"; break;
00037 case (1): retval="B1"; break;
00038 case (2): retval="D0"; break;
00039 case (3): retval="D1"; break;
00040 }
00041 }
00042 }
00043 return retval;
00044 }
00045
00046 void CastorElectronicsId::setHTR(int crate, int slot, int tb) {
00047 castorElectronicsId_&=0x3FFF;
00048 castorElectronicsId_|=((tb&0x1)<<19) | ((slot&0x1f)<<14) | ((crate&0x3f)<<20);
00049 }
00050
00051 std::ostream& operator<<(std::ostream& os,const CastorElectronicsId& id) {
00052 if (id.isTriggerChainId()) {
00053 return os << id.dccid() << ',' << id.spigot() << ",SLB" << id.slbSiteNumber() << ',' << id.slbChannelIndex() << " (HTR "
00054 << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom()==1)?('t'):('b')) << ')';
00055
00056 } else {
00057 return os << id.dccid() << ',' << id.spigot() << ',' << id.fiberIndex() << ',' << id.fiberChanId() << " (HTR "
00058 << id.readoutVMECrateId() << ":" << id.htrSlot() << ((id.htrTopBottom()==1)?('t'):('b')) << ')';
00059 }
00060 }
00061
00062