diff --git a/NPLib/CATS/TCATSSpectra.cxx b/NPLib/CATS/TCATSSpectra.cxx index 99257513dd95d7c08a8fa27bea9122335a3b6024..d18c5ce99da8e336205904627ccc5074cdfe5efc 100644 --- a/NPLib/CATS/TCATSSpectra.cxx +++ b/NPLib/CATS/TCATSSpectra.cxx @@ -44,6 +44,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////////////// TCATSSpectra::TCATSSpectra(){ + SetName("CATS"); fNumberOfCats = 0; fStripsNumber = 28; @@ -60,7 +61,7 @@ TCATSSpectra::TCATSSpectra(unsigned int NumberOfCats){ cout << "TCATSSpectra: Initalising control spectra for " << NumberOfCats << " detectors" << endl; cout << "************************************************" << endl; } - + SetName("CATS"); fNumberOfCats = NumberOfCats; fStripsNumber = 28; // An histo of size fEventLoopSize is reset every fEventLoopSize to monitor the diff --git a/NPLib/Charissa/TCharissaSpectra.cxx b/NPLib/Charissa/TCharissaSpectra.cxx index 868468e3145d5d8374067509ff3ea87d7f106071..28fa2dda4644f4e2769a23bc594dd8a6d4012907 100644 --- a/NPLib/Charissa/TCharissaSpectra.cxx +++ b/NPLib/Charissa/TCharissaSpectra.cxx @@ -40,8 +40,8 @@ using namespace std; //////////////////////////////////////////////////////////////////////////////// -TCharissaSpectra::TCharissaSpectra() -{ +TCharissaSpectra::TCharissaSpectra(){ + SetName("Charissa"); fNumberOfTelescope = 0; fStripX = 16; fStripY = 16; @@ -59,6 +59,7 @@ TCharissaSpectra::TCharissaSpectra(unsigned int NumberOfTelescope) << NumberOfTelescope << " Telescopes" << endl << "************************************************" << endl ; + SetName("Charissa"); fNumberOfTelescope = NumberOfTelescope; fStripX = 16; fStripY = 16; diff --git a/NPLib/Core/NPVSpectra.cxx b/NPLib/Core/NPVSpectra.cxx index 2d460973dec7e9c15e2ea94797088a36da16c19f..d03f73dac29a37bbbc267285fc3b351b89aed686 100644 --- a/NPLib/Core/NPVSpectra.cxx +++ b/NPLib/Core/NPVSpectra.cxx @@ -5,7 +5,7 @@ * For the list of contributors see $NPTOOL/Licence/Contributors * *****************************************************************************/ -/***************************************************************************** +/**************************************************************************** * Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr * * * * Creation Date : dec 2013 * @@ -36,19 +36,15 @@ #include <cstdlib> using namespace std; - -VSpectra::VSpectra() -{ +//////////////////////////////////////////////////////////////////////////////// +VSpectra::VSpectra(){ + m_name="no_name"; } - - -VSpectra::~VSpectra() -{ +//////////////////////////////////////////////////////////////////////////////// +VSpectra::~VSpectra(){ } - - //////////////////////////////////////////////////////////////////////////////// TH1* VSpectra::AddHisto1D(string name, string title, Int_t nbinsx, Double_t xlow, Double_t xup, string family){ // create histo @@ -102,8 +98,7 @@ TH1* VSpectra::GetHisto(string& family, string& name){ } //////////////////////////////////////////////////////////////////////////////// -void VSpectra::WriteSpectra(string filename) -{ +void VSpectra::WriteSpectra(string filename){ TFile* f = NULL; if (filename != "VOID") { f = new TFile(filename.c_str(), "RECREATE"); @@ -114,11 +109,12 @@ void VSpectra::WriteSpectra(string filename) } // created dedicated directory for spectra - TDirectory *dir = (TDirectory*) f->Get("ControlSpectra"); + string dirname = "ControlSpectra/"+m_name; + TDirectory *dir = (TDirectory*) f->Get(dirname.c_str()); if (!dir) { - f->mkdir("ControlSpectra"); - f->cd("ControlSpectra"); + f->mkdir(dirname.c_str()); } + f->cd(dirname.c_str()); // write all histos map< vector<string>, TH1* >::iterator it; @@ -126,9 +122,12 @@ void VSpectra::WriteSpectra(string filename) it->second->Write(); } + // Go back to root directory + f->cd(); + // close file and delete associate pointer only in case // of filename. - if (filename != "VOID") { + if (filename != "VOID") { f->Close(); delete f; } diff --git a/NPLib/Core/NPVSpectra.h b/NPLib/Core/NPVSpectra.h index b0ce819cf6864127257b97e29976fc9ffa845a11..f66bf99353e08a3ee85f9c1a8b9f44e2c3b9a3c9 100644 --- a/NPLib/Core/NPVSpectra.h +++ b/NPLib/Core/NPVSpectra.h @@ -67,6 +67,12 @@ class VSpectra { private: // map holding histo pointers and their family names map< vector<string>, TH1* > fMapHisto; + + private: // Name of the Detector + string m_name; + + public: + inline void SetName(string name) {m_name=name;} }; #endif diff --git a/NPLib/Exogam/TExogamSpectra.cxx b/NPLib/Exogam/TExogamSpectra.cxx index 8676ed3c395dc35641c8211183f6085f5c3d76cb..a3b1e9634284a5f8f687e33b4e454b4b5b36bd32 100644 --- a/NPLib/Exogam/TExogamSpectra.cxx +++ b/NPLib/Exogam/TExogamSpectra.cxx @@ -40,6 +40,7 @@ using namespace NPUNITS; //////////////////////////////////////////////////////////////////////////////// TExogamSpectra::TExogamSpectra(){ + SetName("Exogam"); fnbinsRaw=16384; fbinRawMin=0; fbinRawMax=16384; @@ -56,6 +57,7 @@ TExogamSpectra::TExogamSpectra(unsigned int NumberOfClover){ << "TExogamSpectra : Initalising control spectra for " << NumberOfClover << " Clover" << endl << "************************************************" << endl ; + SetName("Exogam"); fNumberOfClover = NumberOfClover; fNumberOfSegments=4; fNumberOfCores=4; diff --git a/NPLib/MUST2/TMust2Spectra.cxx b/NPLib/MUST2/TMust2Spectra.cxx index 372a56f030159b94630fcca82ddc31477ab1124e..08f61511c53b293f4837df560ad8dbd22303c4c7 100644 --- a/NPLib/MUST2/TMust2Spectra.cxx +++ b/NPLib/MUST2/TMust2Spectra.cxx @@ -40,6 +40,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////////////// TMust2Spectra::TMust2Spectra(){ + SetName("Must2"); fNumberOfTelescope = 0; fStripX=128; fStripY=128; @@ -55,6 +56,7 @@ TMust2Spectra::TMust2Spectra(unsigned int NumberOfTelescope){ << NumberOfTelescope << " Telescopes" << endl << "************************************************" << endl ; + SetName("Must2"); fNumberOfTelescope = NumberOfTelescope; fStripX=128; fStripY=128; diff --git a/NPLib/Sharc/TSharcSpectra.cxx b/NPLib/Sharc/TSharcSpectra.cxx index 185b89b12c728196d44748097671bc943d606d2d..021084013ffc621c69a2bc1a3cc4f5391af51c76 100644 --- a/NPLib/Sharc/TSharcSpectra.cxx +++ b/NPLib/Sharc/TSharcSpectra.cxx @@ -38,6 +38,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////////////// TSharcSpectra::TSharcSpectra(){ + SetName("Sharc"); fNumberOfDetector = 0; fStripFront=24; fStripBack=48; @@ -50,7 +51,7 @@ TSharcSpectra::TSharcSpectra(unsigned int NumberOfDetector){ << "TSharcSpectra : Initalising control spectra for " << NumberOfDetector << " Detectors" << endl << "************************************************" << endl ; - + SetName("Sharc"); fNumberOfDetector = NumberOfDetector; fStripFront=24; fStripBack=48; diff --git a/NPLib/Tiara/TTiaraBarrelSpectra.cxx b/NPLib/Tiara/TTiaraBarrelSpectra.cxx index 474356680d450084042b9c09b3d1307d9ac7f7b5..c3c7bcd957a42a4cca4e82a614fa58237f16f07e 100644 --- a/NPLib/Tiara/TTiaraBarrelSpectra.cxx +++ b/NPLib/Tiara/TTiaraBarrelSpectra.cxx @@ -40,6 +40,7 @@ using namespace NPUNITS; //////////////////////////////////////////////////////////////////////////////// TTiaraBarrelSpectra::TTiaraBarrelSpectra(){ + SetName("TiaraBarrel"); fNumberOfDetector= 0; fInnerBarrelStrip=4; fOuterBarrelStrip=4; @@ -53,6 +54,7 @@ TTiaraBarrelSpectra::TTiaraBarrelSpectra(unsigned int NumberOfDetector){ << NumberOfDetector << " Detectors" << endl << "************************************************" << endl ; + SetName("TiaraBarrel"); fNumberOfDetector= NumberOfDetector; fInnerBarrelStrip=4; fOuterBarrelStrip=4; diff --git a/NPLib/Tiara/TTiaraHyballSpectra.cxx b/NPLib/Tiara/TTiaraHyballSpectra.cxx index 3a0ca4cf5613252559aa956ddaee8600345fc34d..dc2288b9eca17ae3b658e2461f9e5b470972948e 100644 --- a/NPLib/Tiara/TTiaraHyballSpectra.cxx +++ b/NPLib/Tiara/TTiaraHyballSpectra.cxx @@ -45,6 +45,7 @@ TTiaraHyballSpectra::TTiaraHyballSpectra(){ cout << "************************************************" << endl; } + SetName("TiaraHyball"); fRingsNumber = 16; fSectorsNumber = 8; fWedgesNumber = 6;