Skip to content
Snippets Groups Projects
Commit 953dcab5 authored by Administrator's avatar Administrator Committed by Florian Uhlig
Browse files

c2f: Add gFile + gDirectory protection

parent 63b9fff6
No related branches found
No related tags found
1 merge request!280Analysis fix tfile glob point
...@@ -104,6 +104,10 @@ Int_t CbmAnaTreeSource::ReadEvent(UInt_t unsignedInt) { ...@@ -104,6 +104,10 @@ Int_t CbmAnaTreeSource::ReadEvent(UInt_t unsignedInt) {
void CbmAnaTreeSource::Close() {} void CbmAnaTreeSource::Close() {}
void CbmAnaTreeSource::LoadConf(TString name) { void CbmAnaTreeSource::LoadConf(TString name) {
/// Save old global file and folder pointer to avoid messing with FairRoot
TFile* oldFile = gFile;
TDirectory* oldDir = gDirectory;
TFile* f = new TFile(name); TFile* f = new TFile(name);
// TTree *tree = (TTree*)f->Get("aTree"); // TTree *tree = (TTree*)f->Get("aTree");
AnalysisTree::Configuration* conf = AnalysisTree::Configuration* conf =
...@@ -155,6 +159,10 @@ void CbmAnaTreeSource::LoadConf(TString name) { ...@@ -155,6 +159,10 @@ void CbmAnaTreeSource::LoadConf(TString name) {
conf->GetBranchConfig("SimEventHeader").GetFieldId("psi_RP"); conf->GetBranchConfig("SimEventHeader").GetFieldId("psi_RP");
} }
/// Restore old global file and folder pointer to avoid messing with FairRoot
gFile = oldFile;
gDirectory = oldDir;
f->Close(); f->Close();
delete f; delete f;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment