#include "ICOMETLog.hxx" #include "IECALChannelId.hxx" #include ClassImp(COMET::IECALChannelId); //======================================================================== // Constructor //======================================================================== COMET::IECALChannelId::IECALChannelId(UInt_t id): IECALTrigChannelId(id) {} COMET::IECALChannelId::IECALChannelId(const COMET::IChannelId& src): IECALTrigChannelId(src) {} COMET::IECALChannelId::IECALChannelId(const UInt_t subDet, const UInt_t Channel) { if (subDet != COMET::IChannelId::kECAL) { COMETSevere("Invalid sub-detector field: " << subDet); } SetChannel(Channel); } COMET::IECALChannelId::IECALChannelId(const UInt_t subDet, const UInt_t block, const UInt_t crystal) { if (subDet != COMET::IChannelId::kECAL) { COMETSevere("Invalid sub-detector field: " << subDet); } SetFromGeomComponentNumber(block, crystal); } //======================================================================== // Destructor //======================================================================== COMET::IECALChannelId::~IECALChannelId() {} //======================================================================== // AsString //======================================================================== std::string COMET::IECALChannelId::AsString() const { return GetAsString("ECAL", this->GetChannel()); } //======================================================================== // SetChannel //======================================================================== void COMET::IECALChannelId::SetChannel(int val) { SetGuardBit(); SetSubDetector(COMET::IChannelId::kECAL); SetField(val, kChanMSB, kChanLSB); SetField(0, kSpareMSB, kSpareLSB); } //======================================================================== // SetFromGeomComponentNumber //======================================================================== void COMET::IECALChannelId::SetFromGeomComponentNumber(const UInt_t block, const UInt_t crystal) { SetGuardBit(); SetSubDetector(COMET::IChannelId::kECAL); SetField(block, kBlockMSB, kBlockLSB ); SetField(crystal, kCrystalMSB, kCrystalLSB); SetField(0, kSpareMSB, kSpareLSB ); } //======================================================================== // GetComponentNumber //======================================================================== bool COMET::IECALChannelId::GetComponentNumber(UInt_t& block, UInt_t& crystal) const { block = GetField(kBlockMSB, kBlockLSB ); crystal = GetField(kCrystalMSB, kCrystalLSB); COMETNamedVerbose("IECALChannelId", "ECAL component nums: " << AsUInt() << " Block:" << block << " Crystal:" << crystal ); return true; }