Adding draw and Print function to AliESDtrackCuts
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / runMultiplicitySelector.C
CommitLineData
0ab29cfa 1/* $Id$ */
2
3//
4// script to run the AliMultiplicityESDSelector
5//
6
7#include "../CreateESDChain.C"
0bd1f8a0 8#include "../PWG0Helper.C"
0ab29cfa 9
03244034 10void runMultiplicitySelector(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kFALSE, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, const char* option = "")
0ab29cfa 11{
0bd1f8a0 12 if (aProof)
13 connectProof("proof01@lxb6046");
14
15 TString libraries("libEG;libGeom;libESD;libPWG0base");
16 TString packages("PWG0base");
10ebe68d 17
0ab29cfa 18 if (aMC != kFALSE)
0bd1f8a0 19 {
20 libraries += ";libVMC;libMinuit;libSTEER;libPWG0dep;libEVGEN;libFASTSIM;libmicrocern;libpdf;libpythia6;libEGPythia6;libAliPythia6";
21 packages += ";PWG0dep";
22 }
23
24 if (!prepareQuery(libraries, packages, kTRUE))
25 return;
0ab29cfa 26
0ab29cfa 27 gROOT->ProcessLine(".L CreateCuts.C");
28 gROOT->ProcessLine(".L drawPlots.C");
29
0ab29cfa 30 // selection of esd tracks
31 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
32 if (!esdTrackCuts)
33 {
34 printf("ERROR: esdTrackCuts could not be created\n");
35 return;
36 }
37
0bd1f8a0 38 TList inputList;
39 inputList.Add(esdTrackCuts);
40
03244034 41 TChain* chain = CreateESDChain(data, nRuns, offset, kFALSE, kFALSE, "check");
0ab29cfa 42
43 TString selectorName = ((aMC == kFALSE) ? "AliMultiplicityESDSelector" : "AliMultiplicityMCSelector");
44 AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
45
0bd1f8a0 46 selectorName += ".cxx+";
0ab29cfa 47
48 if (aDebug != kFALSE)
49 selectorName += "g";
50
03244034 51 Int_t result = executeQuery(chain, &inputList, selectorName, option);
0ab29cfa 52
53 if (result != 0)
54 {
55 printf("ERROR: Executing process failed with %d.\n", result);
56 return;
57 }
0a173978 58}
0ab29cfa 59
0a173978 60void draw(const char* fileName = "multiplicityMC.root")
61{
62 gSystem->Load("libPWG0base");
63
64 AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
65
66 TFile::Open(fileName);
67 mult->LoadHistograms("Multiplicity");
68
69 mult->DrawHistograms();
0ab29cfa 70}
71
0a173978 72void* fit(const char* fileName = "multiplicityMC.root")
73{
74 gSystem->Load("libPWG0base");
75
76 AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
77
78 TFile::Open(fileName);
79 mult->LoadHistograms("Multiplicity");
80
81 mult->ApplyMinuitFit(3, kFALSE);
9ca6be09 82 mult->ApplyGaussianMethod(3, kFALSE);
83 mult->ApplyBayesianMethod(3, kFALSE);
84
85 return mult;
86}
87
88void* fitOther(const char* fileNameMC = "multiplicityMC.root", const char* fileNameESD = "multiplicityESD.root")
89{
90 gSystem->Load("libPWG0base");
91
92 AliMultiplicityCorrection* mult = new AliMultiplicityCorrection("Multiplicity", "Multiplicity");
93
94 TFile::Open(fileNameMC);
95 mult->LoadHistograms("Multiplicity");
96
97 TFile::Open(fileNameESD);
98 TH2F* hist = (TH2F*) gFile->Get("Multiplicity/fMultiplicityESD3");
99 TH2F* hist2 = (TH2F*) gFile->Get("Multiplicity/fMultiplicityMC3");
100
101 mult->SetMultiplicityESD(3, hist);
102 mult->SetMultiplicityMC(3, hist2);
103
104 mult->ApplyMinuitFit(3, kFALSE);
105 mult->ApplyGaussianMethod(3, kFALSE);
106 mult->ApplyBayesianMethod(3, kFALSE);
0a173978 107
108 return mult;
109}