From 775ac74b0d92939716b833adaca22ad489f91df2 Mon Sep 17 00:00:00 2001 From: matta <matta@npt> Date: Fri, 11 Feb 2011 20:32:19 +0000 Subject: [PATCH] * Change logic for calling Calibration Manager - Calibration Manager is now called inside the detector manager - Code is ligther in NPA without explicit call of the Calibration Manager * Still a error message remain while launching the Template - Dont know where but he try to read the EG file somewhere inside the RootInput.... --- NPAnalysis/Template/src/Analysis.cc | 5 ----- NPLib/VDetector/DetectorManager.cxx | 9 +++++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NPAnalysis/Template/src/Analysis.cc b/NPAnalysis/Template/src/Analysis.cc index 5a12b578d..ea58ed178 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 356ee830c..5c8250e8b 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; } -- GitLab