9 #include "AliHighPtDeDxBase.h"
15 //_____________________________________________________________________________
18 AliHighPtDeDxBase* GetObject(TFile* file, Int_t filter, Bool_t phiCut,
19 Int_t run, Bool_t etaAbs,
20 Int_t etaLow, Int_t etaHigh, const Char_t* baseName="filter",
21 const Char_t* endName=0);
23 TFile* FindFileFresh(const Char_t* fileName);
24 TFile* FindFile(const Char_t* fileName);
25 void CutHistogram(TH1* hist, Double_t xMin, Double_t xMax);
26 void SetHistError(TH1* hist, Double_t error);
27 void CreateDir(const Char_t* dirName);
29 //___________________________________________________________________________
30 AliHighPtDeDxBase* GetObject(TFile* file, Int_t filter, Bool_t phiCut, Int_t run, Bool_t etaAbs,
31 Int_t etaLow, Int_t etaHigh,
32 const Char_t* baseName, const Char_t* endName)
34 TString objectName(baseName);
38 objectName += "phicut";
44 objectName += "etaabs";
46 objectName += etaHigh;
50 objectName += endName;
52 cout << "Getting object: " << objectName.Data() << endl;
54 return (AliHighPtDeDxBase*)(file->Get(objectName.Data()));
57 //______________________________________________________________________
58 TFile* FindFileFresh(const Char_t* fileName)
61 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(fileName);
67 file = TFile::Open(fileName, "READ");
70 cout << "File : " << fileName << " was not found" << endl;
75 //______________________________________________________________________
76 TFile* FindFile(const Char_t* fileName)
79 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(fileName);
84 file = TFile::Open(fileName, "READ");
87 cout << "File : " << fileName << " was not found" << endl;
92 //______________________________________________________________________
93 void CutHistogram(TH1* hist, Double_t xMin, Double_t xMax)
95 const Int_t n = hist->GetNbinsX();
97 for(Int_t bin = 1; bin <= n; bin++) {
99 Float_t x = hist->GetXaxis()->GetBinCenter(bin);
101 hist->SetBinContent(bin, 0);
102 hist->SetBinError(bin, 0);
103 } else if(x > xMax) {
104 hist->SetBinContent(bin, 0);
105 hist->SetBinError(bin, 0);
111 //______________________________________________________________________
112 void SetHistError(TH1* hist, Double_t error)
114 const Int_t n = hist->GetNbinsX();
116 for(Int_t bin = 1; bin <= n; bin++) {
118 // Float_t x = hist->GetXaxis()->GetBinCenter(bin);
119 hist->SetBinError(bin, error);
123 //______________________________________________________________________
124 void CreateDir(const Char_t* dirName)
126 TString pwd(gSystem->pwd());
127 gSystem->cd(pwd.Data());
129 if(gSystem->cd(dirName)) {
130 gSystem->cd(pwd.Data());
132 gSystem->mkdir(dirName, kTRUE); // kTRUE means recursive