00001 #ifndef LARUTILMANAGER_CC
00002 #define LARUTILMANAGER_CC
00003
00004 #include "LArUtilManager.hh"
00005
00006 namespace larutil {
00007
00008 bool LArUtilManager::Reconfigure(larlight::GEO::DetId_t type)
00009 {
00010
00011 if(type == LArUtilConfig::Detector()) return true;
00012
00013 bool status = LArUtilConfig::SetDetector(type);
00014
00015 if(!status) return status;
00016
00017 return ReconfigureUtilities();
00018
00019 }
00020
00021 bool LArUtilManager::ReconfigureUtilities()
00022 {
00023 bool status = true;
00024
00025
00026 larlight::Message::send(larlight::MSG::NORMAL,__FUNCTION__,"Reconfiguring Geometry");
00027 Geometry* geom = (Geometry*)(Geometry::GetME(false));
00028 geom->SetFileName(Form("%s/LArUtil/dat/%s",
00029 getenv("LARLIGHT_CORE_DIR"),
00030 kUTIL_DATA_FILENAME[LArUtilConfig::Detector()].c_str()));
00031 geom->SetTreeName(kTREENAME_GEOMETRY);
00032 status = status && geom->LoadData(true);
00033
00034
00035 larlight::Message::send(larlight::MSG::NORMAL,__FUNCTION__,"Reconfiguring LArProperties");
00036 LArProperties* larp = (LArProperties*)(LArProperties::GetME(false));
00037 larp->SetFileName(Form("%s/LArUtil/dat/%s",
00038 getenv("LARLIGHT_CORE_DIR"),
00039 kUTIL_DATA_FILENAME[LArUtilConfig::Detector()].c_str()));
00040 larp->SetTreeName(kTREENAME_LARPROPERTIES);
00041 status = status && larp->LoadData(true);
00042
00043
00044 larlight::Message::send(larlight::MSG::NORMAL,__FUNCTION__,"Reconfiguring DetectorProperties");
00045 DetectorProperties* detp = (DetectorProperties*)(DetectorProperties::GetME(false));
00046 detp->SetFileName(Form("%s/LArUtil/dat/%s",
00047 getenv("LARLIGHT_CORE_DIR"),
00048 kUTIL_DATA_FILENAME[LArUtilConfig::Detector()].c_str()));
00049 detp->SetTreeName(kTREENAME_DETECTORPROPERTIES);
00050 status = status && detp->LoadData(true);
00051
00052 if(status){
00053
00054
00055 larlight::Message::send(larlight::MSG::NORMAL,__FUNCTION__,"Reconfiguring GeometryUtilities...");
00056 GeometryUtilities* gser = (GeometryUtilities*)(GeometryUtilities::GetME());
00057 gser->Reconfigure();
00058
00059 }
00060
00061 return status;
00062 }
00063
00064 }
00065
00066 #endif