From 9b4208cfee27fe6b4371e12049305ff86f797bde Mon Sep 17 00:00:00 2001 From: Nicolas de Sereville <deserevi@ipno.in2p3.fr> Date: Wed, 4 Dec 2013 15:46:13 +0100 Subject: [PATCH] + Add GetSpectra() method in VDetector & DetectorManager --- NPLib/VDetector/DetectorManager.cxx | 13 +++++++++++++ NPLib/VDetector/DetectorManager.h | 7 ++++++- NPLib/VDetector/VDetector.h | 8 ++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 86bbd6a2e..232ffd148 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -748,3 +748,16 @@ void DetectorManager::InitSpectra(){ it->second->InitSpectra(); } +///////////////////////////////////////////////////////////////////////////////////////////////// +vector< map< vector<TString>, TH1* > > DetectorManager::GetSpectra() +{ + vector< map< vector<TString>, TH1* > > myVector; + + map<string,VDetector*>::iterator it; + // loop on detectors + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { + myVector.push_back(it->second->GetSpectra()); + } + + return myVector; +} diff --git a/NPLib/VDetector/DetectorManager.h b/NPLib/VDetector/DetectorManager.h index cb3d7488a..137bc7539 100644 --- a/NPLib/VDetector/DetectorManager.h +++ b/NPLib/VDetector/DetectorManager.h @@ -23,11 +23,15 @@ // NPL #include "VDetector.h" +// ROOT +#include "TH1.h" +#include "TString.h" + // STL #include <string> #include <map> - using namespace std ; + using namespace NPA ; // This class manage a map of virtual detector @@ -49,6 +53,7 @@ namespace NPA{ void ClearEventPhysics(); void ClearEventData(); void InitSpectra(); + vector< map< vector<TString>, TH1* > > GetSpectra(); private: // The map containning all detectors diff --git a/NPLib/VDetector/VDetector.h b/NPLib/VDetector/VDetector.h index eaf1876df..6d36b74b1 100644 --- a/NPLib/VDetector/VDetector.h +++ b/NPLib/VDetector/VDetector.h @@ -25,8 +25,14 @@ * * * Adding Fill Spectra Method to fill control Histogramm * *****************************************************************************/ + +// ROOT headers +#include "TH1.h" + // STL header #include <string> +#include <vector> +#include <map> using namespace std; namespace NPA { @@ -76,6 +82,8 @@ namespace NPA { virtual void CheckSpectra() {}; // Used for Online only, clear all the spectra hold by the Spectra class virtual void ClearSpectra() {}; + // Used for Online only, get all the spectra hold by the Spectra class + virtual map< vector<TString> , TH1*> GetSpectra() {map< vector<TString>, TH1* > x; return x;}; private: // The list below is here to help you building your own detector /* -- GitLab