#include "dNdEtaAnalysis.h"
+#include <TFile.h>
+#include <TH2F.h>
+#include <TH1D.h>
+#include <TMath.h>
+#include <TCanvas.h>
+
//____________________________________________________________________
ClassImp(dNdEtaAnalysis)
fName = TString(name);
- hEtaVsVtx = new TH2F("eta_vs_vtx","",80,-20,20,120,-6,6);
- hVtx = (TH1F*)hEtaVsVtx->ProjectionX("vtx");
- hdNdEta = (TH1F*)hEtaVsVtx->ProjectionY("dNdEta");
+ hEtaVsVtx = new TH2F("eta_vs_vtx","",80,-20,20,120,-6,6);
+ hEtaVsVtxUncorrected = new TH2F("eta_vs_vtx_uncorrected","",80,-20,20,120,-6,6);
+ hVtx = hEtaVsVtx->ProjectionX("vtx");
+ hdNdEta = hEtaVsVtx->ProjectionY("dNdEta");
hEtaVsVtx->SetXTitle("vtx z [cm]");
hEtaVsVtx->SetYTitle("#eta");
hEtaVsVtx->Sumw2();
hVtx->Sumw2();
-
}
//____________________________________________________________________
void
dNdEtaAnalysis::FillTrack(Float_t vtx, Float_t eta, Float_t weight) {
hEtaVsVtx->Fill(vtx, eta, weight);
+ hEtaVsVtxUncorrected->Fill(vtx,eta);
}
//____________________________________________________________________
dndeta = dndeta/hdNdEta->GetBinWidth(i_eta);
error = error/hdNdEta->GetBinWidth(i_eta);
- hdNdEta->SetBinContent(i_eta, dndeta);
- hdNdEta->SetBinError(i_eta, error);
+ hdNdEta->SetBinContent(i_eta, dndeta);
+ hdNdEta->SetBinError(i_eta, error);
}
}
gDirectory->cd("../");
}
+//____________________________________________________________________
+void dNdEtaAnalysis::DrawHistograms()
+{
+ TCanvas* canvas = new TCanvas("dNdEtaAnalysis", "dNdEtaAnalysis", 800, 800);
+ canvas->Divide(2, 2);
+
+ canvas->cd(1);
+ if (hEtaVsVtx)
+ hEtaVsVtx->Draw("COLZ");
+
+ canvas->cd(2);
+ if (hEtaVsVtxUncorrected)
+ hEtaVsVtxUncorrected->Draw("COLZ");
+
+ canvas->cd(3);
+ if (hVtx)
+ hVtx->Draw();
+
+ canvas->cd(4);
+ if (hdNdEta)
+ hdNdEta->Draw();
+}
// - figure out correct way to treat the errors
// - add functionality to make dn/deta for different mult classes?
-#ifndef ROOT_TObject
-#include "TObject.h"
-#endif
-#ifndef ROOT_TFile
-#include "TFile.h"
-#endif
-#ifndef ROOT_TH2
-#include "TH2.h"
-#endif
-#ifndef ROOT_TMath
-#include "TMath.h"
-#endif
+#include <TObject.h>
+#include <TString.h>
-class dNdEtaAnalysis : public TObject
-{
-protected:
-
- TString fName;
-
- TH2F* hEtaVsVtx;
- TH1F* hVtx;
- TH1F* hdNdEta;
+class TH2F;
+class TH1D;
+class dNdEtaAnalysis : public TObject
+{
public:
dNdEtaAnalysis(Char_t* name="dndeta_correction");
void FillTrack(Float_t vtx, Float_t eta, Float_t weight);
void FillEvent(Float_t vtx);
-
+
void Finish();
-
+
+ void DrawHistograms();
void SaveHistograms();
-
+
+ TH2F* GetEtaVsVtxHistogram() { return hEtaVsVtx; }
+ TH2F* GetEtaVsVtxUncorrectedHistogram() { return hEtaVsVtxUncorrected; }
+ TH1D* GetVtxHistogram() { return hVtx; }
+ TH1D* GetdNdEtaHistogram() { return hdNdEta; }
+
+ void SetEtaVsVtxHistogram(TH2F* aHist) { hEtaVsVtx = aHist; }
+ void SetEtaVsVtxUncorrectedHistogram(TH2F* aHist) { hEtaVsVtxUncorrected = aHist; }
+ void SetVtxHistogram(TH1D* aHist) { hVtx = aHist; }
+ void SetdNdEtaHistogram(TH1D* aHist) { hdNdEta = aHist; }
+
+protected:
+ TString fName;
+
+ TH2F* hEtaVsVtx;
+ TH2F* hEtaVsVtxUncorrected;
+ TH1D* hVtx;
+ TH1D* hdNdEta;
+
ClassDef(dNdEtaAnalysis,0)
};
if (!presentDir->IsDirectory())
continue;
// check that the files are there
- sprintf(str,"%s/%s",dataDir, presentDir->GetName());
- if ((!gSystem->Which(str,"galice.root")) ||
- (!gSystem->Which(str,"AliESDs.root")))
+ TString currentDataDir;
+ currentDataDir.Form("%s/%s",dataDir, presentDir->GetName());
+ if ((!gSystem->Which(currentDataDir.Data(),"galice.root")) ||
+ (!gSystem->Which(currentDataDir.Data(),"AliESDs.root")))
continue;
if (nRunCounter++ >= nRuns)
gAlice=0;
}
- sprintf(str,"%s/run%d/galice.root",dataDir,r);
+ sprintf(str,"%s/galice.root",currentDataDir.Data());
AliRunLoader* runLoader = AliRunLoader::Open(str);
runLoader->LoadgAlice();
// #########################################################
// open esd file and get the tree
- sprintf(str,"%s/run%d/AliESDs.root",dataDir,r);
+ sprintf(str,"%s/AliESDs.root",currentDataDir.Data());
// close it first to avoid memory leak
if (esdFile)
if (esdFile->IsOpen())