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 |
13 | void 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); |
8b3563f4 |
32 | proof = TProof::Open("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 | |
8b3563f4 |
73 | //chain->GetUserInfo()->Add(esdTrackCuts); |
74 | //if (proof) |
75 | // proof->AddInput(esdTrackCuts); |
16e24ca3 |
76 | |
847489f7 |
77 | if (aMC == kFALSE) |
78 | { |
8b3563f4 |
79 | AlidNdEtaCorrection* dNdEtaCorrection = new AlidNdEtaCorrection("dndeta_correction", "dndeta_correction"); |
847489f7 |
80 | dNdEtaCorrection->LoadHistograms("correction_map.root","dndeta_correction"); |
81 | //dNdEtaCorrection->RemoveEdges(2, 0, 2); |
82 | |
8b3563f4 |
83 | //chain->GetUserInfo()->Add(dNdEtaCorrection); |
84 | //if (proof) |
85 | // proof->AddInput(dNdEtaCorrection); |
847489f7 |
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) |
8b3563f4 |
94 | selectorName += ".C++"; |
16e24ca3 |
95 | else |
8b3563f4 |
96 | selectorName += ".cxx++"; |
16e24ca3 |
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 | |