diff --git a/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDraw.cxx b/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDraw.cxx index 0b341d3d50f6388c73e065d38161e0434a1344fb..d7621240379afc71ab2d8de364f7c10f8f1a01d5 100644 --- a/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDraw.cxx +++ b/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDraw.cxx @@ -59,6 +59,10 @@ void CbmAnaDielectronTaskDraw::DrawHistFromFile(const string& fileName, fCuts.SetDefaultCuts(); + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + fHM = new CbmHistManager(); TFile* file = new TFile(fileName.c_str()); fHM->ReadFromFile(file); @@ -94,6 +98,10 @@ void CbmAnaDielectronTaskDraw::DrawHistFromFile(const string& fileName, DrawPmtXY(); DrawMomLikeHist(); SaveCanvasToImage(); + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; } void CbmAnaDielectronTaskDraw::DrawMomLikeHist() { diff --git a/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDrawAll.cxx b/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDrawAll.cxx index aad49e2288cd848b9a97d3e5b00c5a2579eee97f..0f9174e958db5a6a7f5b9f3d2ba0b7756cfc4464 100644 --- a/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDrawAll.cxx +++ b/analysis/PWGDIL/dielectron/lmvm/CbmAnaDielectronTaskDrawAll.cxx @@ -52,6 +52,10 @@ void CbmAnaDielectronTaskDrawAll::DrawHistosFromFile( fileNamePhi, fileNameOmegaDalitz}; + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + fHM.resize(fNofSignals); for (int i = 0; i < fNofSignals; i++) { fHM[i] = new CbmHistManager(); @@ -84,6 +88,10 @@ void CbmAnaDielectronTaskDrawAll::DrawHistosFromFile( DrawSBgVsMinv(); SaveHist(); SaveCanvasToImage(); + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; } @@ -225,7 +233,7 @@ void CbmAnaDielectronTaskDrawAll::DrawMinv(CbmLmvmAnalysisSteps step) { if (fDrawQgp) sQgp->GetXaxis()->SetRangeUser(0, 2.); sPhi->GetXaxis()->SetRangeUser(0, 2.); - /* + /* if (step == kMc) { DrawH1({coctail, sPi0, sEta, sOmegaDalitz, sOmega, sInmed, sQgp, sPhi}, {"", "", "", "", "", "", "", ""}, kLinear, kLog, false, 0.8, 0.8, 0.99, 0.99); diff --git a/analysis/PWGDIL/dielectron/lmvm/CbmAnaLmvmDrawStudy.cxx b/analysis/PWGDIL/dielectron/lmvm/CbmAnaLmvmDrawStudy.cxx index e7d5d4a0d2d5684abfae3de789e9b2d231f5243b..ddb8c901ab3b9d1dd8b4aaf74bc370e91364ca3f 100644 --- a/analysis/PWGDIL/dielectron/lmvm/CbmAnaLmvmDrawStudy.cxx +++ b/analysis/PWGDIL/dielectron/lmvm/CbmAnaLmvmDrawStudy.cxx @@ -40,6 +40,10 @@ void CbmAnaLmvmDrawStudy::DrawFromFile(const vector<string>& fileNames, const vector<string>& fileNamesMean, const vector<string>& studyNames, const string& outputDir) { + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + fOutputDir = outputDir; SetDefaultDrawStyle(); @@ -74,6 +78,10 @@ void CbmAnaLmvmDrawStudy::DrawFromFile(const vector<string>& fileNames, DrawDistributions("lmvm_study_source_pt_", "fh_source_pt_", kTtCut, kGamma); SaveCanvasToImage(); + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; } TCanvas* CbmAnaLmvmDrawStudy::CreateCanvas(const string& name, @@ -121,6 +129,10 @@ void CbmAnaLmvmDrawStudy::SetAnalysisStepLabels(TH1* h) { } void CbmAnaLmvmDrawStudy::DrawMinv() { + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + vector<TH1*> hPtCut, hTtCut; hPtCut.resize(fMeanFiles.size()); hTtCut.resize(fMeanFiles.size()); @@ -160,6 +172,10 @@ void CbmAnaLmvmDrawStudy::DrawMinv() { for (int i = 0; i < fNofStudies; i++){ hbg[i]->SetLineWidth(3.); */ + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; } void CbmAnaLmvmDrawStudy::DrawNofBgTracks() { diff --git a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisSpectrum.cxx b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisSpectrum.cxx index 44d2d83b46a63347b3b0ad87a3b17720a69b6148..c71335e94e6a937507f5bf323b508e74c4a68d1e 100644 --- a/analysis/PWGDIL/dielectron/papaframework/PairAnalysisSpectrum.cxx +++ b/analysis/PWGDIL/dielectron/papaframework/PairAnalysisSpectrum.cxx @@ -769,11 +769,20 @@ void PairAnalysisSpectrum::Write() /// /// write to output file /// + + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + TFile* fout = new TFile("test.root", "RECREATE"); fout->cd(); // fTree->Print(); fTree->Write(); fout->Close(); + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; } //______________________________________________ diff --git a/analysis/PWGDIL/dielectron/pi0eta/CbmKresGammaCorrection.cxx b/analysis/PWGDIL/dielectron/pi0eta/CbmKresGammaCorrection.cxx index e1ca4a299945c618d69c27ac36a2133980003984..616a9466c69f76ed0c2e90de4241849550a8f128 100644 --- a/analysis/PWGDIL/dielectron/pi0eta/CbmKresGammaCorrection.cxx +++ b/analysis/PWGDIL/dielectron/pi0eta/CbmKresGammaCorrection.cxx @@ -46,6 +46,11 @@ void CbmKresGammaCorrection::Init(std::vector<std::vector<double>>& vect_all, (int) OA, (int) IM); /// most recent files for conversion cout << "file is " << Correction_path << endl; + + /// Save old global file and folder pointer to avoid messing with FairRoot + TFile* oldFile = gFile; + TDirectory* oldDir = gDirectory; + TFile* fcorrection = new TFile( Correction_path .c_str()); // file with almost ?? Mio photons, homogeneously distributed over interested region @@ -109,6 +114,10 @@ void CbmKresGammaCorrection::Init(std::vector<std::vector<double>>& vect_all, } vect_onetwo.push_back(rapidity_column); } + + /// Restore old global file and folder pointer to avoid messing with FairRoot + gFile = oldFile; + gDirectory = oldDir; } void CbmKresGammaCorrection::Finish() {