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

littrack: Add gFile + gDirectory protection

parent 672a44d9
No related branches found
No related tags found
No related merge requests found
...@@ -152,12 +152,18 @@ void CbmLitClusteringQa::Finish() { ...@@ -152,12 +152,18 @@ void CbmLitClusteringQa::Finish() {
void CbmLitClusteringQa::InitMuchGeoScheme(const string& digiFileName) { void CbmLitClusteringQa::InitMuchGeoScheme(const string& digiFileName) {
if (fDet.GetDet(ECbmModuleId::kMuch) && fMuchDigiFileName != "") { if (fDet.GetDet(ECbmModuleId::kMuch) && fMuchDigiFileName != "") {
TFile* oldfile = gFile; /// Save old global file and folder pointer to avoid messing with FairRoot
TFile* oldFile = gFile;
TDirectory* oldDir = gDirectory;
TFile* file = new TFile(digiFileName.c_str()); TFile* file = new TFile(digiFileName.c_str());
TObjArray* stations = (TObjArray*) file->Get("stations"); TObjArray* stations = (TObjArray*) file->Get("stations");
file->Close(); file->Close();
file->Delete(); file->Delete();
gFile = oldfile;
/// Restore old global file and folder pointer to avoid messing with FairRoot
gFile = oldFile;
gDirectory = oldDir;
CbmMuchGeoScheme::Instance()->Init(stations, 0); CbmMuchGeoScheme::Instance()->Init(stations, 0);
} }
} }
... ...
......
...@@ -74,12 +74,19 @@ InitStatus CbmMuchClustering::Init() { ...@@ -74,12 +74,19 @@ InitStatus CbmMuchClustering::Init() {
std::cout << "CbmMuchClustering::Init" << std::endl; std::cout << "CbmMuchClustering::Init" << std::endl;
// Initialize GeoScheme // Initialize GeoScheme
TFile* oldfile = gFile; /// Save old global file and folder pointer to avoid messing with FairRoot
TFile* oldFile = gFile;
TDirectory* oldDir = gDirectory;
TFile* file = new TFile(fDigiFile); TFile* file = new TFile(fDigiFile);
TObjArray* stations = (TObjArray*) file->Get("stations"); TObjArray* stations = (TObjArray*) file->Get("stations");
file->Close(); file->Close();
file->Delete(); file->Delete();
gFile = oldfile;
/// Restore old global file and folder pointer to avoid messing with FairRoot
gFile = oldFile;
gDirectory = oldDir;
fScheme->Init(stations, 0); fScheme->Init(stations, 0);
// Initialize arrays of objects // Initialize arrays of objects
ReadDataBranches(); ReadDataBranches();
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment