#include #include #include #include #include "IScintDetGeom.hxx" #include "TGeoManager.h" #include "TGeoBBox.h" #include "IOADatabase.hxx" #include "IGeomIdManager.hxx" COMET::IScintDetGeom::IScintDetGeom(const char* mothervolname, const char* layername, const char* barname) : fMotherVol(mothervolname), fLayerName(layername), fBarName(barname){ } COMET::IScintDetGeom::~IScintDetGeom() {} const COMET::IScintBarGeom& COMET::IScintDetGeom::GetBar(COMET::IGeometryId geomId) const { std::map::const_iterator s = fBarList.find(geomId); if (s == fBarList.end()) { COMETSevere("bar not found!!!!"); throw COMET::ENoSuchScintBarGeom(); } return *((s->second)); } const COMET::IScintDetGeom::BarMap& COMET::IScintDetGeom::GetBars() const { return fBarList; } void COMET::IScintDetGeom::ls(const char*) { COMETInfo("||| Module path keywords :"<< fMotherVol.c_str()<<" "<< fLayerName.c_str()<<" "); Int_t cntx = 0, cnty = 0, cntxr= 0, cntyr = 0; for (std::map::iterator b = fBarList.begin(); b != fBarList.end(); ++b){ if (!(*b).second->GetOrientation()){ ++cntx; cntxr += (*b).second->GetNumOfSensors(); } else if ((*b).second->GetOrientation() != 0){ ++cnty; cntyr += (*b).second->GetNumOfSensors(); } } COMETInfo(" tot bars : " <CdTop(); FindModuleBars(); } Bool_t COMET::IScintDetGeom::FindModuleBars() { std::string thePath(gGeoManager->GetPath()); // considered here for now that for detector // that specify X and Y in volume name the bar orientation // is set accordingly and except the ECAL which is // particular, all other scintillator detectors have // their photosensors on the + side and if not specified // then it is considered that the path corresponds to the // which has 2 end readout for all modules. COMET::IScintBarGeom* bar = NULL; if (thePath.find(fMotherVol)!=std::string::npos && thePath.find(fLayerName)!=std::string::npos && thePath.find(fBarName)!=std::string::npos) { gGeoManager->GetCurrentNodeId(); COMET::IGeometryId bgeom; COMET::IOADatabase::Get().GeomId().FindGeometryId(bgeom); if (thePath.find("X")!=std::string::npos) { bar = new COMET::IScintBarGeom(bgeom, 0, 1); } else if (thePath.find("Y")!=std::string::npos) { bar = new COMET::IScintBarGeom(bgeom, 1, 1); } else { bar = new COMET::IScintBarGeom(bgeom, 0, 2); } fBarList[bgeom] = bar; gGeoManager->CdUp(); return kTRUE; } if (gGeoManager->GetCurrentNode()->GetNdaughters()>0) { for (int i=0;iGetCurrentNode()->GetNdaughters();i++) { gGeoManager->CdDown(i); FindModuleBars(); } } gGeoManager->CdUp(); return kTRUE; }