]>
Commit | Line | Data |
---|---|---|
67a6b178 | 1 | /************************************************************************* |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /********************************** | |
17 | * analysis task for nested loops * | |
18 | * * | |
19 | * authors: Naomi van der Kolk * | |
20 | * (kolk@nikhef.nl) * | |
21 | * Raimond Snellings * | |
22 | * (snelling@nikhef.nl) * | |
23 | * Ante Bilandzic * | |
24 | * (anteb@nikhef.nl) * | |
25 | * *******************************/ | |
26 | ||
27 | class TFile; | |
2701c4bc | 28 | class TString; |
67a6b178 | 29 | class TList; |
30 | class AliAnalysisTaskSE; | |
31 | ||
32 | #include "Riostream.h" | |
33 | #include "AliFlowEventSimple.h" | |
34 | #include "AliAnalysisTaskNestedLoops.h" | |
35 | #include "AliFlowAnalysisWithNestedLoops.h" | |
36 | ||
3a7af7bd | 37 | using std::cout; |
38 | using std::endl; | |
67a6b178 | 39 | ClassImp(AliAnalysisTaskNestedLoops) |
40 | ||
41 | //================================================================================================================ | |
42 | ||
43 | AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights): | |
44 | AliAnalysisTaskSE(name), | |
45 | fEvent(NULL), | |
46 | fNL(NULL), | |
47 | fListHistos(NULL), | |
e999459d | 48 | fHarmonic(0), |
49 | fOppositeChargesPOI(kFALSE), | |
50 | fEvaluateDifferential3pCorrelator(kFALSE), | |
67a6b178 | 51 | fUseParticleWeights(useParticleWeights), |
52 | fUsePhiWeights(kFALSE), | |
53 | fUsePtWeights(kFALSE), | |
54 | fUseEtaWeights(kFALSE), | |
e999459d | 55 | fWeightsList(NULL), |
56 | fEvaluateNestedLoopsForRAD(kTRUE), | |
57 | fEvaluateNestedLoopsForQC(kFALSE), | |
58 | fEvaluateNestedLoopsForMH(kFALSE) | |
67a6b178 | 59 | { |
60 | // constructor | |
61 | cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(const char *name, Bool_t useParticleWeights)"<<endl; | |
62 | ||
63 | // Define input and output slots here | |
64 | // Input slot #0 works with an AliFlowEventSimple | |
65 | DefineInput(0, AliFlowEventSimple::Class()); | |
66 | // Input slot #1 is needed for the weights input file: | |
67 | if(useParticleWeights) | |
68 | { | |
69 | DefineInput(1, TList::Class()); | |
70 | } | |
71 | // Output slot #0 is reserved | |
72 | // Output slot #1 writes into a TList container | |
73 | DefineOutput(1, TList::Class()); | |
74 | } | |
75 | ||
76 | AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops(): | |
77 | AliAnalysisTaskSE(), | |
78 | fEvent(NULL), | |
79 | fNL(NULL), | |
80 | fListHistos(NULL), | |
e999459d | 81 | fHarmonic(0), |
82 | fOppositeChargesPOI(kFALSE), | |
83 | fEvaluateDifferential3pCorrelator(kFALSE), | |
67a6b178 | 84 | fUseParticleWeights(kFALSE), |
85 | fUsePhiWeights(kFALSE), | |
86 | fUsePtWeights(kFALSE), | |
87 | fUseEtaWeights(kFALSE), | |
e999459d | 88 | fWeightsList(NULL), |
89 | fEvaluateNestedLoopsForRAD(kFALSE), | |
90 | fEvaluateNestedLoopsForQC(kFALSE), | |
91 | fEvaluateNestedLoopsForMH(kFALSE) | |
67a6b178 | 92 | { |
93 | // Dummy constructor | |
94 | cout<<"AliAnalysisTaskNestedLoops::AliAnalysisTaskNestedLoops()"<<endl; | |
95 | } | |
96 | ||
97 | //================================================================================================================ | |
98 | ||
99 | void AliAnalysisTaskNestedLoops::UserCreateOutputObjects() | |
100 | { | |
101 | // Called at every worker node to initialize | |
102 | cout<<"AliAnalysisTaskNestedLoops::UserCreateOutputObjects()"<<endl; | |
103 | ||
104 | // Analyser: | |
105 | fNL = new AliFlowAnalysisWithNestedLoops(); | |
106 | ||
e999459d | 107 | fNL->SetHarmonic(fHarmonic); |
108 | fNL->SetOppositeChargesPOI(fOppositeChargesPOI); | |
109 | fNL->SetEvaluateDifferential3pCorrelator(fEvaluateDifferential3pCorrelator); | |
110 | ||
67a6b178 | 111 | if(fUseParticleWeights) |
112 | { | |
113 | // Pass the flags to class: | |
114 | if(fUsePhiWeights) fNL->SetUsePhiWeights(fUsePhiWeights); | |
115 | if(fUsePtWeights) fNL->SetUsePtWeights(fUsePtWeights); | |
116 | if(fUseEtaWeights) fNL->SetUseEtaWeights(fUseEtaWeights); | |
117 | // Get data from input slot #1 which is used for weights: | |
118 | if(GetNinputs()==2) | |
119 | { | |
120 | fWeightsList = (TList*)GetInputData(1); | |
121 | } | |
122 | // Pass the list with weights to class: | |
123 | if(fWeightsList) fNL->SetWeightsList(fWeightsList); | |
124 | } | |
125 | ||
e999459d | 126 | fNL->SetEvaluateNestedLoopsForRAD(fEvaluateNestedLoopsForRAD); |
127 | fNL->SetEvaluateNestedLoopsForQC(fEvaluateNestedLoopsForQC); | |
128 | fNL->SetEvaluateNestedLoopsForMH(fEvaluateNestedLoopsForMH); | |
129 | ||
67a6b178 | 130 | fNL->Init(); |
131 | ||
132 | if(fNL->GetHistList()) | |
133 | { | |
134 | fListHistos = fNL->GetHistList(); | |
135 | // fListHistos->Print(); | |
136 | } else | |
137 | { | |
138 | Printf("ERROR: Could not retrieve histogram list (NL, Task::UserCreateOutputObjects()) !!!!"); | |
139 | } | |
61e0c8c0 | 140 | |
141 | PostData(1,fListHistos); | |
142 | ||
67a6b178 | 143 | } // end of void AliAnalysisTaskNestedLoops::UserCreateOutputObjects() |
144 | ||
145 | //================================================================================================================ | |
146 | ||
147 | void AliAnalysisTaskNestedLoops::UserExec(Option_t *) | |
148 | { | |
149 | // main loop (called for each event) | |
150 | fEvent = dynamic_cast<AliFlowEventSimple*>(GetInputData(0)); | |
151 | ||
152 | // Nested Loops: | |
153 | if(fEvent) | |
154 | { | |
155 | fNL->Make(fEvent); | |
156 | } else | |
157 | { | |
158 | cout<<"WARNING: No input data (NL, Task::UserExec()) !!!!"<<endl; | |
159 | cout<<endl; | |
160 | } | |
161 | ||
162 | PostData(1,fListHistos); | |
163 | } | |
164 | ||
165 | //================================================================================================================ | |
166 | ||
167 | void AliAnalysisTaskNestedLoops::Terminate(Option_t *) | |
168 | { | |
169 | //accessing the merged output list: | |
170 | fListHistos = (TList*)GetOutputData(1); | |
171 | ||
172 | fNL = new AliFlowAnalysisWithNestedLoops(); | |
173 | ||
174 | if(fListHistos) | |
175 | { | |
176 | fNL->GetOutputHistograms(fListHistos); | |
177 | fNL->Finish(); | |
178 | PostData(1,fListHistos); | |
179 | } else | |
180 | { | |
181 | cout<<" WARNING: histogram list pointer is empty (NL, Task::Terminate()) !!!!"<<endl; | |
182 | cout<<endl; | |
183 | } | |
184 | ||
185 | } // end of void AliAnalysisTaskNestedLoops::Terminate(Option_t *) | |
186 | ||
187 | ||
188 | ||
189 | ||
190 | ||
191 | ||
192 | ||
193 | ||
194 | ||
195 | ||
196 | ||
197 | ||
198 | ||
199 | ||
200 | ||
201 | ||
202 | ||
203 | ||
204 | ||
205 | ||
206 |