diff --git a/CaloConditions/src/CaloDAQMap.cc b/CaloConditions/src/CaloDAQMap.cc index be889febdd..3865ea7c0a 100644 --- a/CaloConditions/src/CaloDAQMap.cc +++ b/CaloConditions/src/CaloDAQMap.cc @@ -5,33 +5,29 @@ using namespace std; namespace mu2e { - CaloSiPMId CaloDAQMap::offlineId(CaloRawSiPMId rawId) const { - if(!rawId.isValid()) { - throw cet::exception("CALODAQMP_RANGE") +CaloSiPMId CaloDAQMap::offlineId(CaloRawSiPMId rawId) const { + if (!rawId.isValid()) { + throw cet::exception("CALODAQMP_RANGE") << "CaloDAQMap::offlineId invalid input rawId" << rawId << std::endl; - } - CaloSiPMId offId = _raw2Offline[rawId.id()]; - if(!offId.isValid()) { - throw cet::exception("CALODAQMP_RANGE") - << "CaloDAQMap::offlineId no offline id for rawId " << rawId << std::endl; - } - return offId; } + return _raw2Offline[rawId.id()]; +} - CaloRawSiPMId CaloDAQMap::rawId(CaloSiPMId offId) const { - if(!offId.isValid()) { - throw cet::exception("CALODAQMP_RANGE") << "CaloDAQMap::rawId invalid input offlineId" << offId << std::endl; - } - return _offline2Raw[offId.id()]; +CaloRawSiPMId CaloDAQMap::rawId(CaloSiPMId offId) const { + if (!offId.isValid()) { + throw cet::exception("CALODAQMP_RANGE") + << "CaloDAQMap::rawId invalid input offlineId" << offId << std::endl; } + return _offline2Raw[offId.id()]; +} - void CaloDAQMap::print(std::ostream& os) const { - os << endl; - os << endl << "CaloDAQMap : " << endl; - os << endl << " offline raw " << endl; - for(uint16_t i=0; i #include +#include +#include namespace mu2e { - class CaloConst{ +class CaloConst { - // define the bit field shifts and masks - public: - constexpr static uint16_t _nCrystalPerDisk = 674; - constexpr static uint16_t _nSiPMPerCrystal = 2; - constexpr static uint16_t _nDisk = 2; - // PIN diodes are each one SiPM channel - constexpr static uint16_t _nPINDiodPerDisk = 8; - constexpr static uint16_t _nPINDiodeLaserBox = 4; - constexpr static uint16_t _nChannelSpares = 4; - constexpr static uint16_t _nCrystal = _nCrystalPerDisk*_nDisk; - constexpr static uint16_t _nCrystalChannel = _nCrystal*_nSiPMPerCrystal; - constexpr static uint16_t _nCaphriCrystal = 4; - // crystal numbers, not SiPM channels. Only in disk 0. - constexpr static std::array _caphriId = {582,609,610,637}; + // define the bit field shifts and masks +public: + constexpr static uint16_t _nCrystalPerDisk = 674; + constexpr static uint16_t _nSiPMPerCrystal = 2; + constexpr static uint16_t _nDisk = 2; + // PIN diodes are each one SiPM channel + constexpr static uint16_t _nPINDiodPerDisk = 8; + constexpr static uint16_t _nPINDiodeLaserBox = 4; + constexpr static uint16_t _nChannelSpares = 4; + constexpr static uint16_t _nCrystal = _nCrystalPerDisk * _nDisk; + constexpr static uint16_t _nCrystalChannel = _nCrystal * _nSiPMPerCrystal; + constexpr static uint16_t _nCaphriCrystal = 4; + // crystal numbers, not SiPM channels. Only in disk 0. + constexpr static std::array _caphriId = {582, 609, 610, 637}; - constexpr static uint16_t _nChannel = _nCrystalChannel + _nPINDiodPerDisk*_nDisk + _nPINDiodeLaserBox; - constexpr static uint16_t _nChannelDB = _nChannel + _nChannelSpares; + constexpr static uint16_t _nChannel = + _nCrystalChannel + _nPINDiodPerDisk * _nDisk + _nPINDiodeLaserBox; + constexpr static uint16_t _nChannelDB = _nChannel + _nChannelSpares; - constexpr static uint16_t _nDIRAC = 161; - constexpr static uint16_t _nChPerDIRAC = 20; - constexpr static uint16_t _nRawChannel = _nChPerDIRAC*_nDIRAC; + constexpr static uint16_t _nDIRAC = 161; + constexpr static uint16_t _nChPerDIRAC = 20; + constexpr static uint16_t _nRawChannel = _nChPerDIRAC * _nDIRAC; - constexpr static uint16_t _invalid = 9999; + constexpr static uint16_t _invalid = 9999; - using CaloSiPMId_type = std::uint16_t; + using CaloSiPMId_type = std::uint16_t; - enum SiPMn {SiPM0=0,SiPM1=1}; - enum detType {CsI=0,CAPHRI=1,PINDiode=2,Invalid=3}; + enum SiPMn { SiPM0 = 0, SiPM1 = 1 }; + enum detType { CsI = 0, CAPHRI = 1, PINDiode = 2, Invalid = 3 }; - }; + static std::string detTypeName(detType type); +}; -} +std::ostream& operator<<(std::ostream& ost, const CaloConst::detType& type); +} // namespace mu2e #endif /* DataProducts_CaloConst_hh */ diff --git a/DataProducts/src/CaloConst.cc b/DataProducts/src/CaloConst.cc new file mode 100644 index 0000000000..005eb9945b --- /dev/null +++ b/DataProducts/src/CaloConst.cc @@ -0,0 +1,26 @@ +#include "Offline/DataProducts/inc/CaloConst.hh" +#include + +namespace mu2e { + +std::string CaloConst::detTypeName(detType type) { + switch (type) { + case CaloConst::detType::CsI: + return "CsI"; + case CaloConst::detType::CAPHRI: + return "CAPHRI"; + case CaloConst::detType::PINDiode: + return "PINDiode"; + case CaloConst::detType::Invalid: + return "Invalid"; + default: + return "UNKNOWN"; + } +} + +std::ostream& operator<<(std::ostream& ost, const CaloConst::detType& type) { + ost << CaloConst::detTypeName(type); + return ost; +} + +} // end namespace mu2e