#include #include #include #include #include #include #include #include #include #include #include "IGeomVisitor.hxx" #include "IGeomBase.hxx" //**************************************************************** const COMET::IGeomModuleBase& COMET::IGeomBase::GetModule(const char* name) const { //**************************************************************** TString stringname(name); const COMET::IGeomModuleBase* module = NULL; for (std::vector::const_iterator m = fModules.begin(); m != fModules.end(); ++m){ TString modpath((*m)->GetPath().c_str()); if ( modpath.Sizeof() >= stringname.Sizeof() && modpath.Contains(stringname)) module = *m; else if (modpath.Sizeof() < stringname.Sizeof() && stringname.Contains(modpath)) module = *m; } if (!module) throw COMET::ENoSuchModule(); return *module; } //**************************************************************** const COMET::IGeomModuleBase& COMET::IGeomBase::GetModule(COMET::IHandle hit) const { //**************************************************************** TVector3 hpos = hit->GetPosition(); gGeoManager->FindNode(hpos.X(),hpos.Y(),hpos.Z()); TString stringname(gGeoManager->GetPath()); const COMET::IGeomModuleBase* module = NULL; for (std::vector::const_iterator m = fModules.begin(); m != fModules.end(); ++m){ TString modpath((*m)->GetPath().c_str()); if ( modpath.Sizeof() >= stringname.Sizeof() && modpath.Contains(stringname)) module = *m; else if (modpath.Sizeof() < stringname.Sizeof() && stringname.Contains(modpath)) module = *m; } if (!module) throw COMET::ENoSuchModule(); return *module; } //**************************************************************** const COMET::IGeomModuleBase& COMET::IGeomBase::GetModule(TVector3 hpos) const { //**************************************************************** gGeoManager->FindNode(hpos.X(),hpos.Y(),hpos.Z()); TString stringname(gGeoManager->GetPath()); const COMET::IGeomModuleBase* module =NULL; for (std::vector::const_iterator m = fModules.begin(); m != fModules.end(); ++m){ TString modpath((*m)->GetPath().c_str()); if ( modpath.Sizeof() >= stringname.Sizeof() && modpath.Contains(stringname)) module = *m; else if (modpath.Sizeof() < stringname.Sizeof() && stringname.Contains(modpath)) module = *m; } if (!module) throw COMET::ENoSuchModule(); return *module; }