a/ AliTRDCalibChamberStatus (in ProcessEvent the warning and in Check trying to fix...
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / correct.C
CommitLineData
7a1ac44b 1void loadlibs()
2{
3 gSystem->Load("libTree");
4 gSystem->Load("libVMC");
5
6 gSystem->Load("libSTEERBase");
7 gSystem->Load("libANALYSIS");
8 gSystem->Load("libPWG0base");
9}
10
1d107532 11void FinishAnalysisAll(const char* dataInput = "analysis_esd_raw.root", const char* dataOutput = "analysis_esd.root", const char* correctionMapFile = "correction_map2.root", const char* correctionMapFolder = "dndeta_correction_ua5")
7a1ac44b 12{
13 loadlibs();
14
15 AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
1d107532 16 if (!TFile::Open(correctionMapFile))
17 return;
7a1ac44b 18 dNdEtaCorrection->LoadHistograms();
19
20 TFile* file = TFile::Open(dataInput);
21
22 if (!file)
23 {
24 cout << "Error. File not found" << endl;
25 return;
26 }
27
28 // Note: the last parameter does not define which analysis is going to happen, the histograms will be overwritten when loading from the f
29 dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaNSD", "dndetaNSD");
30 fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
69b09e3b 31 fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kNSD, "ESD -> NSD");
7a1ac44b 32 //fdNdEtaAnalysis->DrawHistograms(kTRUE);
33 TFile* file2 = TFile::Open(dataOutput, "RECREATE");
34 fdNdEtaAnalysis->SaveHistograms();
35
36 file->cd();
37 dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
38 fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
69b09e3b 39 fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kINEL, "ESD -> full inelastic");
7a1ac44b 40 //fdNdEtaAnalysis->DrawHistograms(kTRUE);
41 file2->cd();
42 fdNdEtaAnalysis->SaveHistograms();
43
44 file->cd();
45 fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTr", "dndetaTr");
46 fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
69b09e3b 47 fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kVertexReco, "ESD -> minimum bias");
7a1ac44b 48 //fdNdEtaAnalysis->DrawHistograms(kTRUE);
49 file2->cd();
50 fdNdEtaAnalysis->SaveHistograms();
51
52 file->cd();
53 fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTrVtx", "dndetaTrVtx");
54 fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
69b09e3b 55 fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kTrack2Particle, "ESD -> MB with vertex");
7a1ac44b 56 //fdNdEtaAnalysis->DrawHistograms(kTRUE);
57 file2->cd();
58 fdNdEtaAnalysis->SaveHistograms();
59
60 file->cd();
61 fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracks", "dndetaTracks");
62 fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
69b09e3b 63 fdNdEtaAnalysis->Finish(0, 0.21, AlidNdEtaCorrection::kNone, "ESD raw with pt cut");
7a1ac44b 64 //fdNdEtaAnalysis->DrawHistograms(kTRUE);
65 file2->cd();
66 fdNdEtaAnalysis->SaveHistograms();
67
68 file->cd();
69 fdNdEtaAnalysis = new dNdEtaAnalysis("dndetaTracksAll", "dndetaTracksAll");
70 fdNdEtaAnalysis->LoadHistograms("fdNdEtaAnalysisESD");
71 fdNdEtaAnalysis->Finish(0, -1, AlidNdEtaCorrection::kNone, "ESD raw");
72 //fdNdEtaAnalysis->DrawHistograms(kTRUE);
73 file2->cd();
74 fdNdEtaAnalysis->SaveHistograms();
75
76 file2->Write();
77 file2->Close();
78}
79
80void* FinishAnalysis(const char* analysisFile = "analysis_esd_raw.root", const char* analysisDir = "fdNdEtaAnalysisESD", const char* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction", Bool_t useUncorrected = kFALSE, Bool_t simple = kFALSE)
81{
82 loadlibs();
83
84 TFile* file = TFile::Open(analysisFile);
85
86 dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis(analysisDir, analysisDir);
87 fdNdEtaAnalysis->LoadHistograms();
88
89 if (correctionMapFile)
90 {
91 AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
92 TFile::Open(correctionMapFile);
93 dNdEtaCorrection->LoadHistograms();
94
69b09e3b 95 fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0.21, AlidNdEtaCorrection::kINEL);
7a1ac44b 96 //fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0, AlidNdEtaCorrection::kINEL);
97 //fdNdEtaAnalysis->Finish(dNdEtaCorrection, 0, AlidNdEtaCorrection::kTrack2Particle);
98 }
99 else
69b09e3b 100 fdNdEtaAnalysis->Finish(0, 0.21, AlidNdEtaCorrection::kNone);
7a1ac44b 101
102 fdNdEtaAnalysis->DrawHistograms(simple);
103
104 TH1* hist = fdNdEtaAnalysis->GetdNdEtaHistogram(1);
105 Int_t binLeft = hist->GetXaxis()->FindBin(-0.5);
106 Int_t binRight = hist->GetXaxis()->FindBin(0.5);
107 Float_t value1 = hist->Integral(binLeft, binRight);
108
109 hist = fdNdEtaAnalysis->GetdNdEtaHistogram(2);
110 Float_t value2 = hist->Integral(binLeft, binRight);
111
112 if (value2 > 0)
113 printf("Ratio is %f, values are %f %f\n", value1 / value2, value1, value2);
114
115 return fdNdEtaAnalysis;
116}
117
69b09e3b 118void correct(Bool_t onlyESD = kFALSE)
b0913a13 119{
b0913a13 120 FinishAnalysisAll();
121 gROOT->ProcessLine(".L $ALICE_ROOT/PWG0/dNdEta/drawPlots.C");
69b09e3b 122 dNdEta(onlyESD);
b0913a13 123}
124
125