#include #include #include #include #include #include COMET::ICDCChannelMap* COMET::ICDCChannelMap::fCDCChannelMap = NULL; COMET::ICDCChannelMap::ICDCChannelMap() { if(fCDCChannelMap){ COMETError("CDC channel map instance already exists," << " cannot change after intialisation"); return; } } COMET::ICDCChannelMap::~ICDCChannelMap() { delete fCDCChannelMap; } //---------------------------------------------------------------------- COMET::ICDCChannelMap& COMET::ICDCChannelMap::Get() { if(!fCDCChannelMap) fCDCChannelMap = new ICDCChannelMap(); return *fCDCChannelMap; } //---------------------------------------------------------------------- bool COMET::ICDCChannelMap::GetGeometryId(COMET::IGeometryId& geomId, COMET::ICDCChannelId channelId) { if (!channelId.IsCDCChannel()) { COMETDebug(channelId << " (" << channelId.AsUInt() << ") doesn'nt belong to CDC."); return false; } UInt_t layer = 100000, wire = 100000; // TODO ICDCChannelId::GetGeometryInfo NOT IMPLIMENTED!! if (!channelId.GetGeometryInfo(layer, wire)) { return false; } int isLayer = 0, active = 1; geomId = COMET::GeomId::CDC::SenseWireId(isLayer, layer, wire, active); return true; } //---------------------------------------------------------------------- bool COMET::ICDCChannelMap::GetChannelId(COMET::ICDCChannelId& channelId, COMET::IGeometryId geomId) { return true; } //---------------------------------------------------------------------- inline const COMET::IGeometryId COMET::ICDCChannelMap::BadGeomId() const { //Construct by hand as we are deliberately creating an invalid id //0x80000000 guard bit (Invalid => high) //0x7E000000 sub-det specifier range (CDC => normally 0x3) //so 0x86000000 == invalid-geomID in CDC range //0x01FFFFFF sub detector use range (25 bits) //Set all these high: 0x1FFFFFF return IGeometryId(0x87FFFFFF); // == 0x86000000 | 0x01FFFFFF; } //---------------------------------------------------------------------- inline const COMET::ICDCChannelId COMET::ICDCChannelMap::BadChanId() const { //Construct by hand as we are deliberately creating an invalid id //0x80000000 guard bit (Invalid => low) //0x7E000000 sub-det specifier range (CDC => normally 0x3) //so 0x06000000 == invalid-chanID in CDC range //0x01FFFFFF sub detector use range (25 bits) //Set all these high: 0x1FFFFFF return ICDCChannelId(0x07FFFFFF); // == 0x06000000 | 0x01000000 }