From 94a627fa8714b6a512ab85b39e7c4c7a3c3496ad Mon Sep 17 00:00:00 2001 From: matta <matta@npt> Date: Mon, 7 Feb 2011 19:07:40 +0000 Subject: [PATCH] * Add IsEmpty method to TAsciiFile * Add config register in TMust2Physicis --- NPLib/IORoot/RootInput.cxx | 10 ++++++++++ NPLib/MUST2/TMust2Physics.cxx | 6 ++++-- NPLib/Tools/TAsciiFile.h | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/NPLib/IORoot/RootInput.cxx b/NPLib/IORoot/RootInput.cxx index 55d13fcde..3590f7c94 100644 --- a/NPLib/IORoot/RootInput.cxx +++ b/NPLib/IORoot/RootInput.cxx @@ -216,6 +216,7 @@ string RootInput::DumpAsciiFile(const char* type, const char* folder) else name = sfolder + "/" + title; aFile->WriteToFile(name.c_str()); } + else if (stype == "DetectorConfiguration") { TAsciiFile *aFile = (TAsciiFile*)pRootFile->Get(stype.c_str()); // build file name @@ -225,8 +226,17 @@ string RootInput::DumpAsciiFile(const char* type, const char* folder) else name = sfolder + "/" + title; aFile->WriteToFile(name.c_str()); } + else if (stype == "Calibration") { + TAsciiFile *aFile = (TAsciiFile*)pRootFile->Get(stype.c_str()); + // build file name + string title = aFile->GetTitle(); + unsigned int pos = title.rfind("/"); + if (pos != string::npos) name = sfolder + title.substr(pos); + else name = sfolder + "/" + title; + aFile->WriteToFile(name.c_str()); } + else if (stype == "RunToTreat") { } else { diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx index 143a5449f..a4bd87c94 100644 --- a/NPLib/MUST2/TMust2Physics.cxx +++ b/NPLib/MUST2/TMust2Physics.cxx @@ -31,7 +31,7 @@ using namespace MUST2_LOCAL; // NPL #include "RootInput.h" #include "RootOutput.h" - +#include "TAsciiFile.h" // ROOT #include "TChain.h" /////////////////////////////////////////////////////////////////////////// @@ -554,7 +554,9 @@ void TMust2Physics::ReadAnalysisConfig() return; } cout << " Loading user parameter for Analysis from ConfigMust2.dat " << endl; - + TAsciiFile* asciiConfig = RootOutput::getInstance->GetAsciiFileAnalysisConfig(); + asciiConfig->Append(FileName.c_str()); + // read analysis config file string LineBuffer,DataBuffer,whatToDo; while (!AnalysisConfigFile.eof()) { diff --git a/NPLib/Tools/TAsciiFile.h b/NPLib/Tools/TAsciiFile.h index a448b9a17..560447670 100644 --- a/NPLib/Tools/TAsciiFile.h +++ b/NPLib/Tools/TAsciiFile.h @@ -50,6 +50,8 @@ class TAsciiFile : public TNamed { void Print(const Option_t*) const {}; void Print() const; void Print(UInt_t begin, UInt_t end) const; + bool IsEmpty () {if (fLines.size()!=0) return true; + else return false ;} ClassDef(TAsciiFile, 1); // Class TAsciiFile for storing ascii text }; -- GitLab