#include "IStrawTrkChannelMap.hxx" #include "COMETGeomId.hxx" #include "COMETGeomIdDef.hxx" #include "IStrawTrkGeomId.hxx" #include "ICOMETLog.hxx" #include #include COMET::IStrawTrkChannelMap* COMET::IStrawTrkChannelMap::fStrawTrkChannelMap = NULL; COMET::IStrawTrkChannelMap::IStrawTrkChannelMap() { if(fStrawTrkChannelMap){ COMETError("StrawTrk channel map instance already exists, cannot change after intialisation"); return; } } COMET::IStrawTrkChannelMap::~IStrawTrkChannelMap() { delete fStrawTrkChannelMap; } //---------------------------------------------------------------------- COMET::IStrawTrkChannelMap& COMET::IStrawTrkChannelMap::Get(){ if(!fStrawTrkChannelMap) fStrawTrkChannelMap = new IStrawTrkChannelMap(); return *fStrawTrkChannelMap; } //---------------------------------------------------------------------- bool COMET::IStrawTrkChannelMap::GetGeometryId(COMET::IGeometryId& geomId, COMET::IStrawTrkChannelId channelId) const{ if(!channelId.IsStrawTrkChannel()){ COMETDebug("ChannelId = " << channelId << " (" << channelId.AsUInt() << ") does not belong to StrawTrk."); return false; } UInt_t stationId, manifold, strawId; UInt_t layer = 1, strawGas = 1; if(channelId.GetModuleId(stationId, manifold, strawId)){ geomId = COMET::GeomId::StrawTrk::Module(stationId, manifold, layer, strawId, strawGas, 0); return true; } return false; } //---------------------------------------------------------------------- bool COMET::IStrawTrkChannelMap::GetChannelId(COMET::IStrawTrkChannelId& channelId, COMET::IGeometryId geomId) const{ UInt_t stationId = COMET::GeomId::StrawTrk::GetStationId(geomId); UInt_t manifoldId = COMET::GeomId::StrawTrk::GetManifoldId(geomId); UInt_t strawId = COMET::GeomId::StrawTrk::GetStrawId(geomId); // Set channel if(stationId<0 || manifoldId<0 || strawId<0) return false; channelId = IStrawTrkChannelId(stationId, manifoldId, strawId); return true; } //---------------------------------------------------------------------- inline const bool COMET::IStrawTrkChannelMap::IsBadGeomId(COMET::IGeometryId& geomId) const { //if(geomId.AsInt()==0x00000000) return true; return false; } //---------------------------------------------------------------------- inline const bool COMET::IStrawTrkChannelMap::IsBadChannelId(COMET::IStrawTrkChannelId& channelId) const { //if(channelId.AsUInt()==0x00000000) return true; return false; }