]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdEta/testAnalysis2.C
a lot of work on the analysis
[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"
12
16e24ca3 13void testAnalysis2(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aMC = kFALSE, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE)
75e130df 14{
16e24ca3 15 gSystem->Load("libEG");
16 gSystem->Load("libGeom");
17 gSystem->Load("libESD");
75e130df 18 gSystem->Load("libPWG0base");
16e24ca3 19 if (aMC != kFALSE)
20 gSystem->Load("libPWG0dep");
75e130df 21
16e24ca3 22 gROOT->ProcessLine(".L CreatedNdEta.C");
23 gROOT->ProcessLine(".L CreateCuts.C");
24
25 TChain* chain = 0;
26 TVirtualProof* proof = 0;
27 if (aProof == kFALSE)
28 chain = CreateESDChainFromDir(data, nRuns, offset);
29 else
30 {
31 chain = CreateESDChainFromList(data, nRuns, offset);
93b20362 32 proof = gROOT->Proof("jgrosseo@lxb6046");
16e24ca3 33
34 if (!proof)
35 {
36 printf("ERROR: PROOF connection not established.\n");
37 return;
38 }
39
40 if (proof->EnablePackage("ESD"))
41 {
42 printf("ERROR: ESD package could not be enabled.\n");
43 return;
44 }
45
46 if (proof->EnablePackage("PWG0base"))
47 {
48 printf("ERROR: PWG0base package could not be enabled.\n");
49 return;
50 }
51
52 if (aMC != kFALSE)
53 {
54 if (proof->EnablePackage("PWG0dep"))
55 {
56 printf("ERROR: PWG0dep package could not be enabled.\n");
57 return;
58 }
59 }
60
847489f7 61 //chain->SetProof(proof);
16e24ca3 62 }
75e130df 63
64 // ########################################################
65 // selection of esd tracks
16e24ca3 66 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
67 if (!esdTrackCuts)
dded7a68 68 {
16e24ca3 69 printf("ERROR: esdTrackCuts could not be created\n");
70 return;
dded7a68 71 }
37dbb69e 72
16e24ca3 73 chain->GetUserInfo()->Add(esdTrackCuts);
74 if (proof)
75 proof->AddInput(esdTrackCuts);
76
847489f7 77 if (aMC == kFALSE)
78 {
79 AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection();
80 dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction");
81 //dNdEtaCorrection->RemoveEdges(2, 0, 2);
82
83 chain->GetUserInfo()->Add(dNdEtaCorrection);
84 if (proof)
85 proof->AddInput(dNdEtaCorrection);
86 }
87
dc740de4 88 TString selectorName = ((aMC == kFALSE) ? "AlidNdEtaAnalysisESDSelector" : "AlidNdEtaAnalysisMCSelector");
4dd2ad81 89 AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
90
16e24ca3 91 // workaround for a bug in PROOF that only allows header files for .C files
92 // please create symlink from <selector>.cxx to <selector>.C
93 if (proof != kFALSE)
94 selectorName += ".C+";
95 else
96 selectorName += ".cxx+";
97
fcf2fb36 98 if (aDebug != kFALSE)
99 selectorName += "g";
100
dafef3c8 101 TStopwatch timer;
102 timer.Start();
103
847489f7 104 Long64_t result = -1;
105
106 if (proof != kFALSE)
107 result = chain->MakeTDSet()->Process(selectorName);
108 else
109 result = chain->Process(selectorName);
110
16e24ca3 111 if (result != 0)
112 {
113 printf("ERROR: Executing process failed with %d.\n", result);
114 return;
115 }
dafef3c8 116
117 timer.Stop();
118 timer.Print();
5fbd0b17 119
93b20362 120 CreatedNdEta(aMC ? kFALSE : kTRUE, aMC ? "analysis_mc.root" : "analysis_esd.root");
75e130df 121}
16e24ca3 122