#include "ITOFChannelMap.hxx" #include "COMETGeomId.hxx" #include "COMETGeomIdDef.hxx" #include "ICOMETLog.hxx" #include "ITOFGeomId.hxx" #include COMET::ITOFChannelMap* COMET::ITOFChannelMap::fTOFChannelMap = NULL; COMET::ITOFChannelMap::ITOFChannelMap() { if(fTOFChannelMap){ COMETError("TOF channel map instance already exists," << " cannot change after intialisation"); return; } } COMET::ITOFChannelMap::~ITOFChannelMap() { delete fTOFChannelMap; } //---------------------------------------------------------------------- COMET::ITOFChannelMap& COMET::ITOFChannelMap::Get() { if(!fTOFChannelMap) fTOFChannelMap = new ITOFChannelMap(); return *fTOFChannelMap; } //---------------------------------------------------------------------- bool COMET::ITOFChannelMap::GetGeometryId(COMET::IGeometryId& geomId, COMET::ITOFChannelId channelId) { //empty placeholder to be filled //geomId = channelId; geomId = COMET::GeomId::TOF::Module(channelId.GetLayer(), channelId.GetModule()); return true; } //---------------------------------------------------------------------- bool COMET::ITOFChannelMap::GetChannelId(COMET::ITOFChannelId& channelId, COMET::IGeometryId geomId) { //empty placeholder to be filled //channelId = geomId; return true; } //---------------------------------------------------------------------- inline const COMET::IGeometryId COMET::ITOFChannelMap::BadGeomId() const { //Construct by hand as we are deliberately creating an invalid id //0x80000000 guard bit (Invalid => high) //0x7E000000 sub-det specifier range (TOF => normally 0x3) //so 0x86000000 == invalid-geomID in TOF range //0x01FFFFFF sub detector use range (25 bits) //Set all these high: 0x1FFFFFF return IGeometryId(0x87FFFFFF); // == 0x86000000 | 0x01FFFFFF; } //---------------------------------------------------------------------- inline const COMET::ITOFChannelId COMET::ITOFChannelMap::BadChanId() const { //Construct by hand as we are deliberately creating an invalid id //0x80000000 guard bit (Invalid => low) //0x7E000000 sub-det specifier range (TOF => normally 0x3) //so 0x06000000 == invalid-chanID in TOF range //0x01FFFFFF sub detector use range (25 bits) //Set all these high: 0x1FFFFFF return ITOFChannelId(0x07FFFFFF); // == 0x06000000 | 0x01000000 }