Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions CaloConditions/src/CaloDAQMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<CaloConst::_nRawChannel;i++) {
os << setw(6) << _raw2Offline[i].id() << setw(6) << i << endl;
}
os << endl;
void CaloDAQMap::print(std::ostream& os) const {
os << endl;
os << endl << "CaloDAQMap : " << endl;
os << endl << " offline raw " << endl;
for (uint16_t i = 0; i < CaloConst::_nRawChannel; i++) {
os << setw(6) << _raw2Offline[i].id() << setw(6) << i << endl;
}
os << endl;
}
} // namespace mu2e
1 change: 1 addition & 0 deletions DataProducts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cet_make_library(
SOURCE
src/CaloConst.cc
src/CaloRawSiPMId.cc
src/CaloSiPMId.cc
src/CompressedPDGCode.cc
Expand Down
57 changes: 31 additions & 26 deletions DataProducts/inc/CaloConst.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,46 @@
//
#include <array>
#include <cstdint>
#include <string>
#include <ostream>

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<uint16_t,_nCaphriCrystal> _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<uint16_t, _nCaphriCrystal> _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 */
26 changes: 26 additions & 0 deletions DataProducts/src/CaloConst.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "Offline/DataProducts/inc/CaloConst.hh"
#include <ostream>

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