updating makefile to include evgen headers to compile systematics selector
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / testAnalysis2.C
CommitLineData
dc740de4 1/* $Id$ */
2
75e130df 3//
4// Script to test the dN/dEta analysis using the dNdEtaAnalysis and
5// dNdEtaCorrection classes. Note that there is a cut on the events,
6// so the measurement will be biassed.
7//
8// implementation with TSelector
9//
10
11#include "../CreateESDChain.C"
0bd1f8a0 12#include "../PWG0Helper.C"
75e130df 13
5c495d37 14void testAnalysis2(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* correctionMapFile = "correction_map.root", const char* correctionMapFolder = "dndeta_correction", const char* option = "")
75e130df 15{
0bd1f8a0 16 if (aProof)
17 connectProof("proof01@lxb6046");
10ebe68d 18
0bd1f8a0 19 TString libraries("libEG;libGeom;libESD;libPWG0base");
20 TString packages("PWG0base");
21 if (aMC != kFALSE)
16e24ca3 22 {
0bd1f8a0 23 libraries += ";libVMC;libMinuit;libSTEER;libPWG0dep;libEVGEN;libFASTSIM;libmicrocern;libpdf;libpythia6;libEGPythia6;libAliPythia6";
24 packages += ";PWG0dep";
25 }
16e24ca3 26
0bd1f8a0 27 if (!prepareQuery(libraries, packages, kTRUE))
28 return;
16e24ca3 29
0bd1f8a0 30 //TODO somehow prevent loading several times
31 gROOT->ProcessLine(".L CreateCuts.C");
32 gROOT->ProcessLine(".L drawPlots.C");
16e24ca3 33
0bd1f8a0 34 TChain* chain = CreateESDChain(data, nRuns, offset);
75e130df 35
75e130df 36 // selection of esd tracks
16e24ca3 37 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
38 if (!esdTrackCuts)
dded7a68 39 {
16e24ca3 40 printf("ERROR: esdTrackCuts could not be created\n");
41 return;
dded7a68 42 }
37dbb69e 43
0bd1f8a0 44 TList inputList;
45 inputList.Add(esdTrackCuts);
16e24ca3 46
847489f7 47 if (aMC == kFALSE)
48 {
0bd1f8a0 49 AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection(correctionMapFolder, correctionMapFolder);
50 dNdEtaCorrection->LoadHistograms(correctionMapFile, correctionMapFolder);
10ebe68d 51 dNdEtaCorrection->ReduceInformation();
0bd1f8a0 52 dNdEtaCorrection->SetName("dndeta_correction");
53 dNdEtaCorrection->SetTitle("dndeta_correction");
847489f7 54
0bd1f8a0 55 inputList.Add(dNdEtaCorrection);
847489f7 56 }
57
dc740de4 58 TString selectorName = ((aMC == kFALSE) ? "AlidNdEtaAnalysisESDSelector" : "AlidNdEtaAnalysisMCSelector");
4dd2ad81 59 AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
60
10ebe68d 61 selectorName += ".cxx++";
16e24ca3 62
fcf2fb36 63 if (aDebug != kFALSE)
64 selectorName += "g";
65
5c495d37 66 Int_t result = executeQuery(chain, &inputList, selectorName, option);
847489f7 67
0bd1f8a0 68 if (result >= 0)
16e24ca3 69 {
0bd1f8a0 70 dNdEtaAnalysis* fdNdEtaAnalysis = new dNdEtaAnalysis("dndeta", "dndeta");
5fbd0b17 71
0bd1f8a0 72 TFile* file = TFile::Open(aMC ? "analysis_mc.root" : "analysis_esd.root");
73 if (!file)
74 {
75 cout << "Error. File not found" << endl;
76 return;
77 }
78 fdNdEtaAnalysis->LoadHistograms();
79 fdNdEtaAnalysis->DrawHistograms();
10ebe68d 80
0bd1f8a0 81 dNdEta(kTRUE);
10ebe68d 82 }
75e130df 83}