From afcde574f28c1cea0015421531e225f08e3f44e9 Mon Sep 17 00:00:00 2001 From: nkx Date: Sat, 26 Mar 2022 03:07:26 +0800 Subject: [PATCH 1/5] Update TRestRun.h --- source/framework/core/inc/TRestRun.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); From 63fa89be971f6a93d9bb88824acb4fc841fd2d7c Mon Sep 17 00:00:00 2001 From: nkx Date: Sat, 26 Mar 2022 03:15:03 +0800 Subject: [PATCH 2/5] TRestRun::TRestRun(string) supports both root file and rml file --- source/framework/core/src/TRestRun.cxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index 9eb4af106..688656beb 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(rootfilename); + } else if (filename.find(".rml") == string::npos) { + Initialize(); + LoadConfigFromFile(filename); + } else { + ferr << "TRestRun::TRestRun(): input file error!" << endl; + } } TRestRun::~TRestRun() { From a3f0b6f66bb10d7ebbd04070405858496f5f78a7 Mon Sep 17 00:00:00 2001 From: Javier Galan Date: Fri, 25 Mar 2022 21:58:11 +0100 Subject: [PATCH 3/5] Update TRestRun.cxx --- source/framework/core/src/TRestRun.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index 688656beb..6aee7e41d 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -41,7 +41,7 @@ TRestRun::TRestRun() { Initialize(); } TRestRun::TRestRun(string filename) { if (filename.find(".root") == string::npos) { Initialize(); - OpenInputFile(rootfilename); + OpenInputFile(filename); } else if (filename.find(".rml") == string::npos) { Initialize(); LoadConfigFromFile(filename); From 4183d1a417c4c915e0c00a6cf0923c51d83c0090 Mon Sep 17 00:00:00 2001 From: nkx Date: Sat, 26 Mar 2022 14:15:19 +0800 Subject: [PATCH 4/5] remove the use of ferr that may cause the garfield problem --- source/framework/core/src/TRestRun.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index 6aee7e41d..7b1067d90 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -46,7 +46,7 @@ TRestRun::TRestRun(string filename) { Initialize(); LoadConfigFromFile(filename); } else { - ferr << "TRestRun::TRestRun(): input file error!" << endl; + // ferr << "TRestRun::TRestRun(): input file error!" << endl; } } From 3e629ab277b4e3130f26c06d8e88ebf6b8471d6a Mon Sep 17 00:00:00 2001 From: jgalan Date: Sat, 26 Mar 2022 12:46:14 +0100 Subject: [PATCH 5/5] TRestRun constructor. Fixing typo --- source/framework/core/src/TRestRun.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index 7b1067d90..35f56c88f 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -39,14 +39,14 @@ ClassImp(TRestRun); TRestRun::TRestRun() { Initialize(); } TRestRun::TRestRun(string filename) { - if (filename.find(".root") == string::npos) { + if (filename.find(".root") != string::npos) { Initialize(); OpenInputFile(filename); - } else if (filename.find(".rml") == string::npos) { + } else if (filename.find(".rml") != string::npos) { Initialize(); - LoadConfigFromFile(filename); + LoadConfigFromFile(filename); } else { - // ferr << "TRestRun::TRestRun(): input file error!" << endl; + ferr << "TRestRun::TRestRun(): input file error!" << endl; } }