diff --git a/source/framework/core/inc/TRestRun.h b/source/framework/core/inc/TRestRun.h index b84b51b95..9fc12dafc 100644 --- a/source/framework/core/inc/TRestRun.h +++ b/source/framework/core/inc/TRestRun.h @@ -59,13 +59,15 @@ class TRestRun : public TRestMetadata { int fEventIndexCounter = 0; //! bool fHangUpEndFile = false; //! bool fFromRML = false; //! + + void InitFromConfigFile(); + private: string ReplaceMetadataMember(const string instr); public: /// REST run class void Initialize(); - void InitFromConfigFile(); // file operation void OpenInputFile(int i); @@ -239,7 +241,7 @@ class TRestRun : public TRestMetadata { // Construtor & Destructor TRestRun(); - TRestRun(string rootfilename); + TRestRun(string filename); ~TRestRun(); ClassDef(TRestRun, 4); diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index 9eb4af106..35f56c88f 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -38,9 +38,16 @@ ClassImp(TRestRun); TRestRun::TRestRun() { Initialize(); } -TRestRun::TRestRun(string rootfilename) { - Initialize(); - OpenInputFile(rootfilename); +TRestRun::TRestRun(string filename) { + if (filename.find(".root") != string::npos) { + Initialize(); + OpenInputFile(filename); + } else if (filename.find(".rml") != string::npos) { + Initialize(); + LoadConfigFromFile(filename); + } else { + ferr << "TRestRun::TRestRun(): input file error!" << endl; + } } TRestRun::~TRestRun() {