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

MQ: Add gFile + gDirectory protection

parent e6553509
No related branches found
No related tags found
1 merge request!283Core tfile glob point
...@@ -388,11 +388,13 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) { ...@@ -388,11 +388,13 @@ bool CbmMqHistoServer::PrepareCanvas(uint32_t uCanvIdx) {
} }
bool CbmMqHistoServer::SaveHistograms() { bool CbmMqHistoServer::SaveHistograms() {
/// Save old global file and folder pointer to avoid messing with FairRoot
TFile* oldFile = gFile;
TDirectory* oldDir = gDirectory;
/// (Re-)Create ROOT file to store the histos /// (Re-)Create ROOT file to store the histos
TDirectory* oldDir = NULL; TFile* histoFile = nullptr;
TFile* histoFile = NULL;
// Store current directory position to allow restore later
oldDir = gDirectory;
// open separate histo file in recreate mode // open separate histo file in recreate mode
histoFile = new TFile(fsHistoFileName.data(), "RECREATE"); histoFile = new TFile(fsHistoFileName.data(), "RECREATE");
...@@ -423,8 +425,10 @@ bool CbmMqHistoServer::SaveHistograms() { ...@@ -423,8 +425,10 @@ bool CbmMqHistoServer::SaveHistograms() {
histoFile->cd(); histoFile->cd();
} // for( UInt_t uHisto = 0; uHisto < fvCanvas.size(); ++uHisto ) } // for( UInt_t uHisto = 0; uHisto < fvCanvas.size(); ++uHisto )
// Restore original directory position /// Restore old global file and folder pointer to avoid messing with FairRoot
oldDir->cd(); gFile = oldFile;
gDirectory = oldDir;
histoFile->Close(); histoFile->Close();
return true; return true;
......
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