diff --git a/NPAnalysis/Template/src/Analysis.cc b/NPAnalysis/Template/src/Analysis.cc index 5a12b578d1ecfbcd9805e594cf0ce7cef28c13e4..ea58ed178f7c359a77f8c815d4bc64cfc885d435 100644 --- a/NPAnalysis/Template/src/Analysis.cc +++ b/NPAnalysis/Template/src/Analysis.cc @@ -17,8 +17,6 @@ int main(int argc, char** argv) myOptionManager->SetDetectorFile(name); } - - // get input files from NPOptionManager string detectorfileName = myOptionManager->GetDetectorFile(); string calibrationfileName = myOptionManager->GetCalibrationFile(); @@ -26,13 +24,10 @@ int main(int argc, char** argv) // Instantiate RootOutput RootOutput::getInstance("Analysis/"+OutputfileName, "AnalysedTree"); - // Instantiate the Calibration Manger using a file - CalibrationManager* myCalibration = CalibrationManager::getInstance(calibrationfileName); // Instantiate the detector using a file NPA::DetectorManager* myDetector = new DetectorManager(); myDetector->ReadConfigurationFile(detectorfileName); - myCalibration->LoadParameterFromFile(); // Get the formed Chained Tree and Treat it TChain* Chain = RootInput:: getInstance() -> GetChain(); diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 356ee830c118eaaf80b73ac126476eae3916a6bf..5c8250e8ba75e93c7d5912b5785f3dd5326d107a 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -36,6 +36,11 @@ DetectorManager::~DetectorManager() // Read stream at ConfigFile and pick-up Token declaration of Detector void DetectorManager::ReadConfigurationFile(string Path) { + + // Instantiate the Calibration Manager + // All The detector will then add to it their parameter (see AddDetector) + CalibrationManager::getInstance(NPOptionManager::getInstance()->GetCalibrationFile()); + ////////General Reading needs//////// string LineBuffer; string DataBuffer; @@ -331,9 +336,13 @@ void DetectorManager::ReadConfigurationFile(string Path) ConfigFile.close(); + // Now that the detector are all added, they can initialise their Branch to the Root I/O InitializeRootInput(); InitializeRootOutput(); + // The calibration Manager got all the parameter added, so it can load them from the calibration file + CalibrationManager::getInstance()->LoadParameterFromFile(); + return; }