#include #include #include //#define DEBUG_TOFFinder #ifdef DEBUG_TOFFinder #include #endif #include "COMETGeomId.hxx" #include "COMETGeomIdDef.hxx" #include "ITOFGeomId.hxx" #include "ITOFIdFinder.hxx" #include "ICOMETLog.hxx" COMET::ITOFIdFinder::ITOFIdFinder() {;} COMET::ITOFIdFinder::~ITOFIdFinder() {;} bool COMET::ITOFIdFinder::Search(const std::vector& names, COMET::IGeometryId& id){ bool foundTOF = false, foundMod = false; for (std::vector::const_iterator it=names.begin(); it!=names.end();++it) { if ((*it).find("TOFDetector")!=std::string::npos) { foundTOF=true; } if ((*it).find("Module_")!=std::string::npos) { foundMod=true; } } if (foundTOF && foundMod) { Int_t layer = -1, module = -1; module = ModuleNo(names.back()); layer = ModuleNo(names.at(names.size()-2)); if (module<0||layer<0) { COMETNamedDebug("ITOFIdFinder", "Coudn't find Layer or Module!!\n" << " Print all module names -->"); for (std::vector::const_iterator it=names.begin(); it!=names.end(); ++it) { COMETNamedDebug("ITOFIdFinder", (*it)); } return false; } id = COMET::GeomId::TOF::Module(layer, module); return true; } else return false; }