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