]>
Commit | Line | Data |
---|---|---|
1c1d4332 | 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 * | |
940a5ed1 | 13 | * provided "as is" without express or implied warranty. * |
1c1d4332 | 14 | **************************************************************************/ |
15 | ||
fdff44c8 | 16 | //////////////////////////////////////////////////// |
17 | // AliAnalysisTaskFlowEvent: | |
18 | // | |
19 | // analysis task for filling the flow event | |
20 | // from MCEvent, ESD, AOD .... | |
940a5ed1 | 21 | // and put it in an output stream so it can |
22 | // be used by the various flow analysis methods | |
fdff44c8 | 23 | // for cuts the correction framework is used |
24 | // which also outputs QA histograms to view | |
25 | // the effects of the cuts | |
26 | //////////////////////////////////////////////////// | |
27 | ||
1c1d4332 | 28 | #include "Riostream.h" //needed as include |
29 | #include "TChain.h" | |
30 | #include "TTree.h" | |
31 | #include "TFile.h" //needed as include | |
32 | #include "TList.h" | |
489fdf79 | 33 | #include "TRandom3.h" |
34 | #include "TTimeStamp.h" | |
1c1d4332 | 35 | |
7183fe85 | 36 | // ALICE Analysis Framework |
1c1d4332 | 37 | #include "AliAnalysisManager.h" |
fbdb53fa | 38 | #include "AliAnalysisTaskSE.h" |
85d2ee8d | 39 | #include "AliESDtrackCuts.h" |
1c1d4332 | 40 | |
7183fe85 | 41 | // ESD interface |
1c1d4332 | 42 | #include "AliESDEvent.h" |
43 | #include "AliESDInputHandler.h" | |
44 | ||
7183fe85 | 45 | // AOD interface |
1c1d4332 | 46 | #include "AliAODEvent.h" |
47 | #include "AliAODInputHandler.h" | |
48 | ||
7183fe85 | 49 | // Monte Carlo Event |
1c1d4332 | 50 | #include "AliMCEventHandler.h" |
51 | #include "AliMCEvent.h" | |
52 | ||
7183fe85 | 53 | // ALICE Correction Framework |
1c1d4332 | 54 | #include "AliCFManager.h" |
55 | ||
7183fe85 | 56 | // Interface to Event generators to get Reaction Plane Angle |
57 | #include "AliGenCocktailEventHeader.h" | |
58 | #include "AliGenHijingEventHeader.h" | |
48ad51a1 | 59 | #include "AliGenGeVSimEventHeader.h" |
26f120fa | 60 | #include "AliGenEposEventHeader.h" |
7183fe85 | 61 | |
62 | // Interface to make the Flow Event Simple used in the flow analysis methods | |
940a5ed1 | 63 | #include "AliFlowEvent.h" |
1c1d4332 | 64 | |
7183fe85 | 65 | #include "AliAnalysisTaskFlowEvent.h" |
66 | ||
77111ee6 | 67 | #include "AliLog.h" |
68 | ||
1c1d4332 | 69 | ClassImp(AliAnalysisTaskFlowEvent) |
940a5ed1 | 70 | |
1c1d4332 | 71 | //________________________________________________________________________ |
940a5ed1 | 72 | AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() : |
73 | AliAnalysisTaskSE(), | |
46bec39c | 74 | // fOutputFile(NULL), |
1c1d4332 | 75 | fAnalysisType("ESD"), |
ef4799a7 | 76 | fRPType("Global"), |
1c1d4332 | 77 | fCFManager1(NULL), |
78 | fCFManager2(NULL), | |
79 | fQAInt(NULL), | |
80 | fQADiff(NULL), | |
fdff44c8 | 81 | fMinMult(0), |
82 | fMaxMult(10000000), | |
7a01f4a7 | 83 | fMinA(-1.0), |
84 | fMaxA(-0.01), | |
85 | fMinB(0.01), | |
86 | fMaxB(1.0), | |
489fdf79 | 87 | fQA(kFALSE), |
88 | fMCReactionPlaneAngle(0.), | |
89 | fCount(0), | |
90 | fNoOfLoops(1), | |
91 | fEllipticFlowValue(0.), | |
92 | fSigmaEllipticFlowValue(0.), | |
93 | fMultiplicityOfEvent(1000000000), | |
94 | fSigmaMultiplicityOfEvent(0), | |
65201059 | 95 | fMyTRandom3(NULL), |
96 | fbAfterburnerOn(kFALSE) | |
1c1d4332 | 97 | { |
98 | // Constructor | |
99 | cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent()"<<endl; | |
100 | } | |
101 | ||
489fdf79 | 102 | //________________________________________________________________________ |
940a5ed1 | 103 | AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on, UInt_t iseed) : |
104 | AliAnalysisTaskSE(name), | |
105 | // fOutputFile(NULL), | |
489fdf79 | 106 | fAnalysisType("ESD"), |
ef4799a7 | 107 | fRPType("Global"), |
489fdf79 | 108 | fCFManager1(NULL), |
109 | fCFManager2(NULL), | |
110 | fQAInt(NULL), | |
111 | fQADiff(NULL), | |
fdff44c8 | 112 | fMinMult(0), |
113 | fMaxMult(10000000), | |
7a01f4a7 | 114 | fMinA(-1.0), |
115 | fMaxA(-0.01), | |
116 | fMinB(0.01), | |
117 | fMaxB(1.0), | |
489fdf79 | 118 | fQA(on), |
119 | fMCReactionPlaneAngle(0.), | |
120 | fCount(0), | |
121 | fNoOfLoops(1), | |
122 | fEllipticFlowValue(0.), | |
123 | fSigmaEllipticFlowValue(0.), | |
124 | fMultiplicityOfEvent(1000000000), | |
125 | fSigmaMultiplicityOfEvent(0), | |
65201059 | 126 | fMyTRandom3(NULL), |
127 | fbAfterburnerOn(kFALSE) | |
489fdf79 | 128 | { |
129 | // Constructor | |
130 | cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on, UInt_t iseed)"<<endl; | |
940a5ed1 | 131 | fMyTRandom3 = new TRandom3(iseed); |
489fdf79 | 132 | gRandom->SetSeed(fMyTRandom3->Integer(65539)); |
65201059 | 133 | |
134 | ||
135 | // Define output slots here | |
489fdf79 | 136 | // Define here the flow event output |
940a5ed1 | 137 | DefineOutput(1, AliFlowEventSimple::Class()); |
138 | if(on) | |
139 | { | |
65201059 | 140 | DefineOutput(2, TList::Class()); |
940a5ed1 | 141 | DefineOutput(3, TList::Class()); |
142 | } | |
489fdf79 | 143 | // and for testing open an output file |
144 | // fOutputFile = new TFile("FlowEvents.root","RECREATE"); | |
145 | ||
146 | } | |
147 | ||
1c1d4332 | 148 | //________________________________________________________________________ |
149 | AliAnalysisTaskFlowEvent::~AliAnalysisTaskFlowEvent() | |
150 | { | |
151 | // | |
152 | // Destructor | |
153 | // | |
489fdf79 | 154 | if (fMyTRandom3) delete fMyTRandom3; |
940a5ed1 | 155 | // objects in the output list are deleted |
1c1d4332 | 156 | // by the TSelector dtor (I hope) |
157 | ||
158 | } | |
159 | ||
160 | //________________________________________________________________________ | |
940a5ed1 | 161 | void AliAnalysisTaskFlowEvent::UserCreateOutputObjects() |
1c1d4332 | 162 | { |
163 | // Called at every worker node to initialize | |
164 | cout<<"AliAnalysisTaskFlowEvent::CreateOutputObjects()"<<endl; | |
165 | ||
940a5ed1 | 166 | if (!(fAnalysisType == "AOD" || fAnalysisType == "ESD" || fAnalysisType == "ESDMCkineESD" || fAnalysisType == "ESDMCkineMC" || fAnalysisType == "MC")) |
167 | { | |
77111ee6 | 168 | AliError("WRONG ANALYSIS TYPE! only ESD, ESDMCkineESD, ESDMCkineMC, AOD and MC are allowed."); |
1c1d4332 | 169 | exit(1); |
170 | } | |
1c1d4332 | 171 | } |
172 | ||
173 | //________________________________________________________________________ | |
940a5ed1 | 174 | void AliAnalysisTaskFlowEvent::UserExec(Option_t *) |
1c1d4332 | 175 | { |
176 | // Main loop | |
177 | // Called for each event | |
940a5ed1 | 178 | AliFlowEvent* flowEvent = NULL; |
179 | AliMCEvent* mcEvent = MCEvent(); // from TaskSE | |
180 | AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(InputEvent()); // from TaskSE | |
181 | AliAODEvent* myAOD = dynamic_cast<AliAODEvent*>(InputEvent()); // from TaskSE | |
ef4799a7 | 182 | AliMultiplicity* myTracklets = NULL; |
183 | ||
184 | /*test*/ cout<<"(AliAnalysisTaskFlowEvent::UserExec)fRPType = "<<fRPType<<endl; | |
940a5ed1 | 185 | |
186 | // Make the FlowEvent for MC input | |
187 | if (fAnalysisType == "MC") | |
188 | { | |
1c1d4332 | 189 | // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler |
190 | // This handler can return the current MC event | |
940a5ed1 | 191 | if (!(fCFManager1&&fCFManager2)) |
192 | { | |
77111ee6 | 193 | AliError("ERROR: No pointer to correction framework cuts! "); |
940a5ed1 | 194 | return; |
195 | } | |
196 | if (!mcEvent) | |
197 | { | |
77111ee6 | 198 | AliError("ERROR: Could not retrieve MC event"); |
940a5ed1 | 199 | return; |
200 | } | |
1c1d4332 | 201 | |
6d7734d2 | 202 | fCFManager1->SetMCEventInfo(mcEvent); |
203 | fCFManager2->SetMCEventInfo(mcEvent); | |
940a5ed1 | 204 | |
77111ee6 | 205 | AliInfo(Form("Number of MC particles: %d", mcEvent->GetNumberOfTracks())); |
206 | ||
207 | //check multiplicity | |
208 | if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtGenCuts,mcEvent)) | |
209 | { | |
210 | AliWarning("Event does not pass multiplicity cuts"); return; | |
211 | } | |
212 | //make event | |
940a5ed1 | 213 | flowEvent = new AliFlowEvent(mcEvent,fCFManager1,fCFManager2); |
1c1d4332 | 214 | } |
ef4799a7 | 215 | |
940a5ed1 | 216 | // Make the FlowEvent for ESD input |
217 | else if (fAnalysisType == "ESD") | |
218 | { | |
219 | if (!(fCFManager1&&fCFManager2)) | |
220 | { | |
77111ee6 | 221 | AliError("ERROR: No pointer to correction framework cuts!"); |
940a5ed1 | 222 | return; |
223 | } | |
224 | if (!myESD) | |
225 | { | |
77111ee6 | 226 | AliError("ERROR: ESD not available"); |
940a5ed1 | 227 | return; |
228 | } | |
77111ee6 | 229 | |
b0569f96 | 230 | //check the offline trigger (check if the event has the correct trigger) |
ade93aa4 | 231 | AliInfo(Form("ESD has %d tracks", fInputEvent->GetNumberOfTracks())); |
77111ee6 | 232 | |
233 | //check multiplicity | |
234 | if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtRecCuts,myESD)) | |
235 | { | |
236 | AliWarning("Event does not pass multiplicity cuts"); return; | |
237 | } | |
238 | ||
239 | //make event | |
ef4799a7 | 240 | if (fRPType == "Global") { |
241 | flowEvent = new AliFlowEvent(myESD,fCFManager1,fCFManager2); | |
242 | } | |
243 | else if (fRPType == "Tracklet"){ | |
244 | flowEvent = new AliFlowEvent(myESD,myTracklets,fCFManager2); | |
245 | } | |
246 | // if monte carlo event get reaction plane from monte carlo (depends on generator) | |
247 | if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent); | |
85d2ee8d | 248 | //set reference multiplicity, TODO: maybe move it to the constructor? |
249 | flowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE)); | |
1c1d4332 | 250 | } |
ef4799a7 | 251 | |
940a5ed1 | 252 | // Make the FlowEvent for ESD input combined with MC info |
253 | else if (fAnalysisType == "ESDMCkineESD" || fAnalysisType == "ESDMCkineMC" ) | |
254 | { | |
255 | if (!(fCFManager1&&fCFManager2)) | |
256 | { | |
77111ee6 | 257 | AliError("ERROR: No pointer to correction framework cuts! "); |
940a5ed1 | 258 | return; |
259 | } | |
260 | if (!myESD) | |
261 | { | |
77111ee6 | 262 | AliError("ERROR: ESD not available"); |
940a5ed1 | 263 | return; |
264 | } | |
77111ee6 | 265 | AliInfo(Form("There are %d tracks in this event", fInputEvent->GetNumberOfTracks())); |
940a5ed1 | 266 | |
267 | if (!mcEvent) | |
268 | { | |
77111ee6 | 269 | AliError("ERROR: Could not retrieve MC event"); |
940a5ed1 | 270 | return; |
271 | } | |
1c1d4332 | 272 | |
6d7734d2 | 273 | fCFManager1->SetMCEventInfo(mcEvent); |
274 | fCFManager2->SetMCEventInfo(mcEvent); | |
1c1d4332 | 275 | |
77111ee6 | 276 | //check multiplicity |
277 | if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtRecCuts,myESD)) | |
278 | { | |
279 | AliWarning("Event does not pass multiplicity cuts"); return; | |
280 | } | |
281 | ||
282 | //make event | |
940a5ed1 | 283 | if (fAnalysisType == "ESDMCkineESD") |
284 | { | |
285 | flowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kESDkine, fCFManager1, fCFManager2 ); | |
286 | } | |
287 | else if (fAnalysisType == "ESDMCkineMC") | |
288 | { | |
289 | flowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kMCkine, fCFManager1, fCFManager2 ); | |
1c1d4332 | 290 | } |
85d2ee8d | 291 | // if monte carlo event get reaction plane from monte carlo (depends on generator) |
292 | if (mcEvent && mcEvent->GenEventHeader()) flowEvent->SetMCReactionPlaneAngle(mcEvent); | |
293 | //set reference multiplicity, TODO: maybe move it to the constructor? | |
294 | flowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE)); | |
1c1d4332 | 295 | } |
940a5ed1 | 296 | // Make the FlowEventSimple for AOD input |
297 | else if (fAnalysisType == "AOD") | |
298 | { | |
299 | if (!myAOD) | |
300 | { | |
77111ee6 | 301 | AliError("ERROR: AOD not available"); |
940a5ed1 | 302 | return; |
303 | } | |
ade93aa4 | 304 | AliInfo(Form("AOD has %d tracks", myAOD->GetNumberOfTracks())); |
940a5ed1 | 305 | flowEvent = new AliFlowEvent(myAOD); |
1c1d4332 | 306 | } |
307 | ||
77111ee6 | 308 | //check final event cuts |
940a5ed1 | 309 | Int_t mult = flowEvent->NumberOfTracks(); |
ade93aa4 | 310 | AliInfo(Form("FlowEvent has %i tracks",mult)); |
311 | if (mult<fMinMult || mult>fMaxMult) | |
77111ee6 | 312 | { |
313 | AliWarning("FlowEvent cut on multiplicity"); return; | |
314 | } | |
940a5ed1 | 315 | |
ef4799a7 | 316 | //tag subEvents |
940a5ed1 | 317 | flowEvent->TagSubeventsInEta(fMinA,fMaxA,fMinB,fMaxB); |
318 | ||
46bec39c | 319 | //fListHistos->Print(); |
ef4799a7 | 320 | //fOutputFile->WriteObject(flowEvent,"myFlowEventSimple"); |
940a5ed1 | 321 | PostData(1,flowEvent); |
322 | if (fQA) | |
323 | { | |
65201059 | 324 | PostData(2,fQAInt); |
940a5ed1 | 325 | PostData(3,fQADiff); |
326 | } | |
327 | } | |
1c1d4332 | 328 | |
329 | //________________________________________________________________________ | |
940a5ed1 | 330 | void AliAnalysisTaskFlowEvent::Terminate(Option_t *) |
1c1d4332 | 331 | { |
332 | // Called once at the end of the query -- do not call in case of CAF | |
1c1d4332 | 333 | } |
489fdf79 | 334 | |
335 |