]>
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" | |
44e060e0 | 33 | #include "TH2F.h" |
489fdf79 | 34 | #include "TRandom3.h" |
35 | #include "TTimeStamp.h" | |
1c1d4332 | 36 | |
7183fe85 | 37 | // ALICE Analysis Framework |
1c1d4332 | 38 | #include "AliAnalysisManager.h" |
fbdb53fa | 39 | #include "AliAnalysisTaskSE.h" |
85d2ee8d | 40 | #include "AliESDtrackCuts.h" |
1c1d4332 | 41 | |
7183fe85 | 42 | // ESD interface |
1c1d4332 | 43 | #include "AliESDEvent.h" |
44 | #include "AliESDInputHandler.h" | |
45 | ||
7183fe85 | 46 | // AOD interface |
1c1d4332 | 47 | #include "AliAODEvent.h" |
48 | #include "AliAODInputHandler.h" | |
49 | ||
7183fe85 | 50 | // Monte Carlo Event |
1c1d4332 | 51 | #include "AliMCEventHandler.h" |
52 | #include "AliMCEvent.h" | |
53 | ||
7183fe85 | 54 | // ALICE Correction Framework |
1c1d4332 | 55 | #include "AliCFManager.h" |
56 | ||
7183fe85 | 57 | // Interface to Event generators to get Reaction Plane Angle |
58 | #include "AliGenCocktailEventHeader.h" | |
59 | #include "AliGenHijingEventHeader.h" | |
48ad51a1 | 60 | #include "AliGenGeVSimEventHeader.h" |
26f120fa | 61 | #include "AliGenEposEventHeader.h" |
7183fe85 | 62 | |
6e214c87 | 63 | // Interface to Load short life particles |
64 | #include "TObjArray.h" | |
65 | #include "AliFlowCandidateTrack.h" | |
66 | ||
7183fe85 | 67 | // Interface to make the Flow Event Simple used in the flow analysis methods |
940a5ed1 | 68 | #include "AliFlowEvent.h" |
daf66719 | 69 | #include "AliFlowTrackCuts.h" |
70 | #include "AliFlowEventCuts.h" | |
d459546b | 71 | #include "AliFlowCommonConstants.h" |
7183fe85 | 72 | #include "AliAnalysisTaskFlowEvent.h" |
73 | ||
77111ee6 | 74 | #include "AliLog.h" |
75 | ||
1c1d4332 | 76 | ClassImp(AliAnalysisTaskFlowEvent) |
940a5ed1 | 77 | |
1c1d4332 | 78 | //________________________________________________________________________ |
940a5ed1 | 79 | AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent() : |
80 | AliAnalysisTaskSE(), | |
46bec39c | 81 | // fOutputFile(NULL), |
12b2b8bc | 82 | fAnalysisType("AUTOMATIC"), |
ef4799a7 | 83 | fRPType("Global"), |
1c1d4332 | 84 | fCFManager1(NULL), |
85 | fCFManager2(NULL), | |
daf66719 | 86 | fCutsEvent(NULL), |
87 | fCutsRP(NULL), | |
88 | fCutsPOI(NULL), | |
499fe731 | 89 | fQAList(NULL), |
fdff44c8 | 90 | fMinMult(0), |
91 | fMaxMult(10000000), | |
7a01f4a7 | 92 | fMinA(-1.0), |
93 | fMaxA(-0.01), | |
94 | fMinB(0.01), | |
95 | fMaxB(1.0), | |
499fe731 | 96 | fQAon(kFALSE), |
6e214c87 | 97 | fLoadCandidates(kFALSE), |
d459546b | 98 | fNbinsMult(10000), |
99 | fNbinsPt(100), | |
100 | fNbinsPhi(100), | |
101 | fNbinsEta(200), | |
102 | fNbinsQ(500), | |
103 | fMultMin(0.), | |
104 | fMultMax(10000.), | |
105 | fPtMin(0.), | |
106 | fPtMax(10.), | |
107 | fPhiMin(0.), | |
108 | fPhiMax(TMath::TwoPi()), | |
109 | fEtaMin(-5.), | |
110 | fEtaMax(5.), | |
111 | fQMin(0.), | |
112 | fQMax(3.), | |
644f1368 | 113 | fHistWeightvsPhiMin(0.), |
114 | fHistWeightvsPhiMax(3.), | |
f6f8c3fc | 115 | fExcludedEtaMin(0.), |
116 | fExcludedEtaMax(0.), | |
117 | fExcludedPhiMin(0.), | |
118 | fExcludedPhiMax(0.), | |
54089829 | 119 | fAfterburnerOn(kFALSE), |
120 | fNonFlowNumberOfTrackClones(0), | |
121 | fV1(0.), | |
122 | fV2(0.), | |
123 | fV3(0.), | |
124 | fV4(0.), | |
1a80f9f6 | 125 | fV5(0.), |
7d27a354 | 126 | fFlowEvent(NULL), |
aab6527a | 127 | fMyTRandom3(NULL) |
1c1d4332 | 128 | { |
129 | // Constructor | |
130 | cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent()"<<endl; | |
131 | } | |
132 | ||
489fdf79 | 133 | //________________________________________________________________________ |
6e214c87 | 134 | AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, TString RPtype, Bool_t on, UInt_t iseed, Bool_t bCandidates) : |
940a5ed1 | 135 | AliAnalysisTaskSE(name), |
136 | // fOutputFile(NULL), | |
12b2b8bc | 137 | fAnalysisType("AUTOMATIC"), |
44e060e0 | 138 | fRPType(RPtype), |
489fdf79 | 139 | fCFManager1(NULL), |
140 | fCFManager2(NULL), | |
daf66719 | 141 | fCutsEvent(NULL), |
142 | fCutsRP(NULL), | |
143 | fCutsPOI(NULL), | |
499fe731 | 144 | fQAList(NULL), |
fdff44c8 | 145 | fMinMult(0), |
146 | fMaxMult(10000000), | |
7a01f4a7 | 147 | fMinA(-1.0), |
148 | fMaxA(-0.01), | |
149 | fMinB(0.01), | |
150 | fMaxB(1.0), | |
499fe731 | 151 | fQAon(on), |
6e214c87 | 152 | fLoadCandidates(bCandidates), |
d459546b | 153 | fNbinsMult(10000), |
154 | fNbinsPt(100), | |
155 | fNbinsPhi(100), | |
156 | fNbinsEta(200), | |
157 | fNbinsQ(500), | |
158 | fMultMin(0.), | |
159 | fMultMax(10000.), | |
160 | fPtMin(0.), | |
161 | fPtMax(10.), | |
162 | fPhiMin(0.), | |
163 | fPhiMax(TMath::TwoPi()), | |
164 | fEtaMin(-5.), | |
165 | fEtaMax(5.), | |
166 | fQMin(0.), | |
167 | fQMax(3.), | |
644f1368 | 168 | fHistWeightvsPhiMin(0.), |
169 | fHistWeightvsPhiMax(3.), | |
f6f8c3fc | 170 | fExcludedEtaMin(0.), |
171 | fExcludedEtaMax(0.), | |
172 | fExcludedPhiMin(0.), | |
173 | fExcludedPhiMax(0.), | |
54089829 | 174 | fAfterburnerOn(kFALSE), |
175 | fNonFlowNumberOfTrackClones(0), | |
176 | fV1(0.), | |
177 | fV2(0.), | |
178 | fV3(0.), | |
179 | fV4(0.), | |
1a80f9f6 | 180 | fV5(0.), |
7d27a354 | 181 | fFlowEvent(NULL), |
aab6527a | 182 | fMyTRandom3(NULL) |
489fdf79 | 183 | { |
184 | // Constructor | |
185 | cout<<"AliAnalysisTaskFlowEvent::AliAnalysisTaskFlowEvent(const char *name, Bool_t on, UInt_t iseed)"<<endl; | |
940a5ed1 | 186 | fMyTRandom3 = new TRandom3(iseed); |
489fdf79 | 187 | gRandom->SetSeed(fMyTRandom3->Integer(65539)); |
65201059 | 188 | |
6e214c87 | 189 | int availableINslot=1; |
44e060e0 | 190 | //FMD input slot |
191 | if (strcmp(RPtype,"FMD")==0) { | |
6e214c87 | 192 | DefineInput(availableINslot++, TList::Class()); |
44e060e0 | 193 | } |
6e214c87 | 194 | //Candidates input slot |
195 | if( fLoadCandidates ) | |
196 | DefineInput(availableINslot, TObjArray::Class()); | |
65201059 | 197 | |
198 | // Define output slots here | |
489fdf79 | 199 | // Define here the flow event output |
940a5ed1 | 200 | DefineOutput(1, AliFlowEventSimple::Class()); |
499fe731 | 201 | DefineOutput(2, TList::Class()); |
6e214c87 | 202 | |
489fdf79 | 203 | // and for testing open an output file |
204 | // fOutputFile = new TFile("FlowEvents.root","RECREATE"); | |
205 | ||
206 | } | |
207 | ||
1c1d4332 | 208 | //________________________________________________________________________ |
209 | AliAnalysisTaskFlowEvent::~AliAnalysisTaskFlowEvent() | |
210 | { | |
211 | // | |
212 | // Destructor | |
213 | // | |
32b846cd | 214 | delete fMyTRandom3; |
f299ea19 | 215 | delete fFlowEvent; |
499fe731 | 216 | delete fCutsEvent; |
217 | delete fCutsRP; | |
218 | delete fCutsPOI; | |
219 | delete fQAList; | |
940a5ed1 | 220 | // objects in the output list are deleted |
1c1d4332 | 221 | // by the TSelector dtor (I hope) |
222 | ||
223 | } | |
224 | ||
32b846cd | 225 | //________________________________________________________________________ |
226 | void AliAnalysisTaskFlowEvent::NotifyRun() | |
227 | { | |
228 | //at the beginning of each new run | |
229 | AliESDEvent* fESD = dynamic_cast<AliESDEvent*> (InputEvent()); | |
2a745a5f | 230 | if (!fESD) return; |
3abf7ecc | 231 | |
232 | Int_t run = fESD->GetRunNumber(); | |
233 | AliInfo(Form("Stariting run #%i",run)); | |
32b846cd | 234 | } |
235 | ||
1c1d4332 | 236 | //________________________________________________________________________ |
940a5ed1 | 237 | void AliAnalysisTaskFlowEvent::UserCreateOutputObjects() |
1c1d4332 | 238 | { |
239 | // Called at every worker node to initialize | |
240 | cout<<"AliAnalysisTaskFlowEvent::CreateOutputObjects()"<<endl; | |
241 | ||
12b2b8bc | 242 | if (!(fAnalysisType == "AOD" || fAnalysisType == "ESD" || fAnalysisType == "ESDMCkineESD" || fAnalysisType == "ESDMCkineMC" || fAnalysisType == "MC" || fAnalysisType == "AUTOMATIC")) |
940a5ed1 | 243 | { |
12b2b8bc | 244 | AliError("WRONG ANALYSIS TYPE! only ESD, ESDMCkineESD, ESDMCkineMC, AOD, MC and AUTOMATIC are allowed."); |
1c1d4332 | 245 | exit(1); |
246 | } | |
d459546b | 247 | |
248 | //set the common constants | |
249 | AliFlowCommonConstants* cc = AliFlowCommonConstants::GetMaster(); | |
250 | cc->SetNbinsMult(fNbinsMult); | |
251 | cc->SetNbinsPt(fNbinsPt); | |
252 | cc->SetNbinsPhi(fNbinsPhi); | |
253 | cc->SetNbinsEta(fNbinsEta); | |
254 | cc->SetNbinsQ(fNbinsQ); | |
255 | cc->SetMultMin(fMultMin); | |
256 | cc->SetMultMax(fMultMax); | |
257 | cc->SetPtMin(fPtMin); | |
258 | cc->SetPtMax(fPtMax); | |
259 | cc->SetPhiMin(fPhiMin); | |
260 | cc->SetPhiMax(fPhiMax); | |
261 | cc->SetEtaMin(fEtaMin); | |
262 | cc->SetEtaMax(fEtaMax); | |
263 | cc->SetQMin(fQMin); | |
264 | cc->SetQMax(fQMax); | |
644f1368 | 265 | cc->SetHistWeightvsPhiMax(fHistWeightvsPhiMax); |
266 | cc->SetHistWeightvsPhiMin(fHistWeightvsPhiMin); | |
d459546b | 267 | |
7d27a354 | 268 | fFlowEvent = new AliFlowEvent(3000); |
269 | ||
499fe731 | 270 | if (fQAon) |
271 | { | |
272 | fQAList=new TList(); | |
a14b8f3c | 273 | fQAList->SetOwner(); |
499fe731 | 274 | fQAList->SetName(Form("%s QA",GetName())); |
cd62a2a8 | 275 | if (fCutsEvent->GetQA()) fQAList->Add(fCutsEvent->GetQA()); //0 |
276 | if (fCutsRP->GetQA()) fQAList->Add(fCutsRP->GetQA()); //1 | |
277 | if (fCutsPOI->GetQA())fQAList->Add(fCutsPOI->GetQA()); //2 | |
278 | fQAList->Add(new TH1F("event plane angle","event plane angle;angle [rad];",100,0.,TMath::TwoPi())); //3 | |
499fe731 | 279 | PostData(2,fQAList); |
280 | } | |
1c1d4332 | 281 | } |
282 | ||
283 | //________________________________________________________________________ | |
940a5ed1 | 284 | void AliAnalysisTaskFlowEvent::UserExec(Option_t *) |
1c1d4332 | 285 | { |
286 | // Main loop | |
287 | // Called for each event | |
7d27a354 | 288 | //delete fFlowEvent; |
940a5ed1 | 289 | AliMCEvent* mcEvent = MCEvent(); // from TaskSE |
290 | AliESDEvent* myESD = dynamic_cast<AliESDEvent*>(InputEvent()); // from TaskSE | |
291 | AliAODEvent* myAOD = dynamic_cast<AliAODEvent*>(InputEvent()); // from TaskSE | |
ef4799a7 | 292 | AliMultiplicity* myTracklets = NULL; |
333ce021 | 293 | AliESDPmdTrack* pmdtracks = NULL;//pmd |
ef4799a7 | 294 | |
6e214c87 | 295 | int availableINslot=1; |
3ca4688a | 296 | |
2a745a5f | 297 | if (!(fCutsRP&&fCutsPOI&&fCutsEvent)) |
298 | { | |
299 | AliError("cuts not set"); | |
300 | return; | |
301 | } | |
302 | ||
7d27a354 | 303 | //DEFAULT - automatically takes care of everything |
12b2b8bc | 304 | if (fAnalysisType == "AUTOMATIC") |
daf66719 | 305 | { |
7d9ab4fb | 306 | //check event cuts |
e56016a0 | 307 | if (InputEvent() && !fCutsEvent->IsSelected(InputEvent())) return; |
7d9ab4fb | 308 | |
03d364db | 309 | //first attach all possible information to the cuts |
441ea1cf | 310 | fCutsRP->SetEvent( InputEvent(), MCEvent() ); //attach event |
311 | fCutsPOI->SetEvent( InputEvent(), MCEvent() ); | |
32b846cd | 312 | |
03d364db | 313 | //then make the event |
7d27a354 | 314 | fFlowEvent->Fill( fCutsRP, fCutsPOI ); |
315 | //fFlowEvent = new AliFlowEvent( fCutsRP, fCutsPOI ); | |
316 | ||
daf66719 | 317 | if (myESD) |
7d27a354 | 318 | fFlowEvent->SetReferenceMultiplicity(fCutsEvent->GetReferenceMultiplicity(InputEvent())); |
319 | if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent); | |
daf66719 | 320 | } |
940a5ed1 | 321 | |
322 | // Make the FlowEvent for MC input | |
a0241c3a | 323 | else if (fAnalysisType == "MC") |
940a5ed1 | 324 | { |
1c1d4332 | 325 | // Process MC truth, therefore we receive the AliAnalysisManager and ask it for the AliMCEventHandler |
326 | // This handler can return the current MC event | |
940a5ed1 | 327 | if (!(fCFManager1&&fCFManager2)) |
328 | { | |
77111ee6 | 329 | AliError("ERROR: No pointer to correction framework cuts! "); |
940a5ed1 | 330 | return; |
331 | } | |
332 | if (!mcEvent) | |
333 | { | |
77111ee6 | 334 | AliError("ERROR: Could not retrieve MC event"); |
940a5ed1 | 335 | return; |
336 | } | |
1c1d4332 | 337 | |
6d7734d2 | 338 | fCFManager1->SetMCEventInfo(mcEvent); |
339 | fCFManager2->SetMCEventInfo(mcEvent); | |
940a5ed1 | 340 | |
77111ee6 | 341 | AliInfo(Form("Number of MC particles: %d", mcEvent->GetNumberOfTracks())); |
342 | ||
343 | //check multiplicity | |
344 | if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtGenCuts,mcEvent)) | |
345 | { | |
346 | AliWarning("Event does not pass multiplicity cuts"); return; | |
347 | } | |
348 | //make event | |
7d27a354 | 349 | fFlowEvent = new AliFlowEvent(mcEvent,fCFManager1,fCFManager2); |
1c1d4332 | 350 | } |
ef4799a7 | 351 | |
940a5ed1 | 352 | // Make the FlowEvent for ESD input |
353 | else if (fAnalysisType == "ESD") | |
354 | { | |
355 | if (!(fCFManager1&&fCFManager2)) | |
356 | { | |
77111ee6 | 357 | AliError("ERROR: No pointer to correction framework cuts!"); |
940a5ed1 | 358 | return; |
359 | } | |
360 | if (!myESD) | |
361 | { | |
77111ee6 | 362 | AliError("ERROR: ESD not available"); |
940a5ed1 | 363 | return; |
364 | } | |
77111ee6 | 365 | |
b0569f96 | 366 | //check the offline trigger (check if the event has the correct trigger) |
ade93aa4 | 367 | AliInfo(Form("ESD has %d tracks", fInputEvent->GetNumberOfTracks())); |
77111ee6 | 368 | |
369 | //check multiplicity | |
370 | if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtRecCuts,myESD)) | |
371 | { | |
372 | AliWarning("Event does not pass multiplicity cuts"); return; | |
373 | } | |
374 | ||
375 | //make event | |
ef4799a7 | 376 | if (fRPType == "Global") { |
7d27a354 | 377 | fFlowEvent = new AliFlowEvent(myESD,fCFManager1,fCFManager2); |
ef4799a7 | 378 | } |
a0241c3a | 379 | else if (fRPType == "TPCOnly") { |
7d27a354 | 380 | fFlowEvent = new AliFlowEvent(myESD,fCFManager2,kFALSE); |
cd755f77 | 381 | } |
a0241c3a | 382 | else if (fRPType == "TPCHybrid") { |
7d27a354 | 383 | fFlowEvent = new AliFlowEvent(myESD,fCFManager2,kTRUE); |
cd755f77 | 384 | } |
ef4799a7 | 385 | else if (fRPType == "Tracklet"){ |
7d27a354 | 386 | fFlowEvent = new AliFlowEvent(myESD,myTracklets,fCFManager2); |
ef4799a7 | 387 | } |
44e060e0 | 388 | else if (fRPType == "FMD"){ |
dd60b476 | 389 | TList* FMDdata = dynamic_cast<TList*>(GetInputData(availableINslot++)); |
390 | if(!FMDdata) { | |
391 | cout<<" No FMDdata "<<endl; | |
392 | return; | |
393 | } | |
394 | TH2F* histFMD = dynamic_cast<TH2F*>(FMDdata->FindObject("dNdetadphiHistogramTrVtx")); | |
395 | if (!histFMD) { | |
396 | cout<< "No histFMD"<<endl; | |
397 | return; | |
398 | } | |
7d27a354 | 399 | fFlowEvent = new AliFlowEvent(myESD,histFMD,fCFManager2); |
44e060e0 | 400 | } |
333ce021 | 401 | else if (fRPType == "PMD"){ |
7d27a354 | 402 | fFlowEvent = new AliFlowEvent(myESD,pmdtracks,fCFManager2); |
333ce021 | 403 | } |
5104aa35 | 404 | else return; |
44e060e0 | 405 | |
ef4799a7 | 406 | // if monte carlo event get reaction plane from monte carlo (depends on generator) |
7d27a354 | 407 | if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent); |
5104aa35 | 408 | //set reference multiplicity, TODO: maybe move it to the constructor? |
7d27a354 | 409 | fFlowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE)); |
1c1d4332 | 410 | } |
ef4799a7 | 411 | |
940a5ed1 | 412 | // Make the FlowEvent for ESD input combined with MC info |
413 | else if (fAnalysisType == "ESDMCkineESD" || fAnalysisType == "ESDMCkineMC" ) | |
414 | { | |
415 | if (!(fCFManager1&&fCFManager2)) | |
416 | { | |
77111ee6 | 417 | AliError("ERROR: No pointer to correction framework cuts! "); |
940a5ed1 | 418 | return; |
419 | } | |
420 | if (!myESD) | |
421 | { | |
77111ee6 | 422 | AliError("ERROR: ESD not available"); |
940a5ed1 | 423 | return; |
424 | } | |
77111ee6 | 425 | AliInfo(Form("There are %d tracks in this event", fInputEvent->GetNumberOfTracks())); |
940a5ed1 | 426 | |
427 | if (!mcEvent) | |
428 | { | |
77111ee6 | 429 | AliError("ERROR: Could not retrieve MC event"); |
940a5ed1 | 430 | return; |
431 | } | |
1c1d4332 | 432 | |
6d7734d2 | 433 | fCFManager1->SetMCEventInfo(mcEvent); |
434 | fCFManager2->SetMCEventInfo(mcEvent); | |
1c1d4332 | 435 | |
77111ee6 | 436 | //check multiplicity |
437 | if (!fCFManager1->CheckEventCuts(AliCFManager::kEvtRecCuts,myESD)) | |
438 | { | |
439 | AliWarning("Event does not pass multiplicity cuts"); return; | |
440 | } | |
441 | ||
442 | //make event | |
940a5ed1 | 443 | if (fAnalysisType == "ESDMCkineESD") |
444 | { | |
7d27a354 | 445 | fFlowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kESDkine, fCFManager1, fCFManager2 ); |
940a5ed1 | 446 | } |
447 | else if (fAnalysisType == "ESDMCkineMC") | |
448 | { | |
7d27a354 | 449 | fFlowEvent = new AliFlowEvent(myESD, mcEvent, AliFlowEvent::kMCkine, fCFManager1, fCFManager2 ); |
1c1d4332 | 450 | } |
7d27a354 | 451 | if (!fFlowEvent) return; |
85d2ee8d | 452 | // if monte carlo event get reaction plane from monte carlo (depends on generator) |
7d27a354 | 453 | if (mcEvent && mcEvent->GenEventHeader()) fFlowEvent->SetMCReactionPlaneAngle(mcEvent); |
85d2ee8d | 454 | //set reference multiplicity, TODO: maybe move it to the constructor? |
7d27a354 | 455 | fFlowEvent->SetReferenceMultiplicity(AliESDtrackCuts::GetReferenceMultiplicity(myESD,kTRUE)); |
1c1d4332 | 456 | } |
940a5ed1 | 457 | // Make the FlowEventSimple for AOD input |
458 | else if (fAnalysisType == "AOD") | |
459 | { | |
460 | if (!myAOD) | |
461 | { | |
77111ee6 | 462 | AliError("ERROR: AOD not available"); |
940a5ed1 | 463 | return; |
464 | } | |
ade93aa4 | 465 | AliInfo(Form("AOD has %d tracks", myAOD->GetNumberOfTracks())); |
7d27a354 | 466 | fFlowEvent = new AliFlowEvent(myAOD); |
1c1d4332 | 467 | } |
468 | ||
6e214c87 | 469 | //inject candidates |
470 | if(fLoadCandidates) { | |
471 | TObjArray* Candidates = dynamic_cast<TObjArray*>(GetInputData(availableINslot++)); | |
41dc4195 | 472 | //if(Candidates->GetEntriesFast()) |
473 | //printf("I received %d candidates\n",Candidates->GetEntriesFast()); | |
422c61c7 | 474 | if (Candidates) |
475 | { | |
41dc4195 | 476 | for(int iCand=0; iCand!=Candidates->GetEntriesFast(); ++iCand ) { |
477 | AliFlowCandidateTrack *cand = dynamic_cast<AliFlowCandidateTrack*>(Candidates->At(iCand)); | |
422c61c7 | 478 | if (!cand) continue; |
41dc4195 | 479 | cand->SetForPOISelection(kTRUE); |
480 | cand->SetForRPSelection(kFALSE); | |
481 | //printf(" Ⱶ Checking at candidate %d with %d daughters\n",iCand,cand->GetNDaughters()); | |
482 | for(int iDau=0; iDau!=cand->GetNDaughters(); ++iDau) { | |
483 | //printf(" Ⱶ Daughter %d with fID %d", iDau, cand->GetIDDaughter(iDau) ); | |
7d27a354 | 484 | for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs ) { |
485 | AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs )); | |
41dc4195 | 486 | if (!iRP) continue; |
487 | if( !iRP->InRPSelection() ) | |
488 | continue; | |
489 | if( cand->GetIDDaughter(iDau) == iRP->GetID() ) { | |
490 | //printf(" was in RP set"); | |
491 | cand->SetDaughter( iDau, iRP ); | |
492 | //temporarily untagging all daugters | |
493 | iRP->SetForRPSelection(kFALSE); | |
494 | } | |
495 | } | |
496 | //printf("\n"); | |
497 | } | |
7d27a354 | 498 | fFlowEvent->AddTrack(cand); |
422c61c7 | 499 | } |
6e214c87 | 500 | } |
501 | } | |
502 | ||
7d27a354 | 503 | if (!fFlowEvent) return; //shuts up coverity |
a0241c3a | 504 | |
77111ee6 | 505 | //check final event cuts |
7d27a354 | 506 | Int_t mult = fFlowEvent->NumberOfTracks(); |
ade93aa4 | 507 | AliInfo(Form("FlowEvent has %i tracks",mult)); |
508 | if (mult<fMinMult || mult>fMaxMult) | |
77111ee6 | 509 | { |
510 | AliWarning("FlowEvent cut on multiplicity"); return; | |
511 | } | |
940a5ed1 | 512 | |
f6f8c3fc | 513 | //define dead zone |
7d27a354 | 514 | fFlowEvent->DefineDeadZone(fExcludedEtaMin, fExcludedEtaMax, fExcludedPhiMin, fExcludedPhiMax ); |
f6f8c3fc | 515 | |
516 | ||
54089829 | 517 | ////////////////////////////////////////////////////////////////////////////// |
518 | ///////////////////////////AFTERBURNER | |
519 | if (fAfterburnerOn) | |
520 | { | |
521 | //if reaction plane not set from elsewhere randomize it before adding flow | |
7d27a354 | 522 | if (!fFlowEvent->IsSetMCReactionPlaneAngle()) |
523 | fFlowEvent->SetMCReactionPlaneAngle(gRandom->Uniform(0.0,TMath::TwoPi())); | |
54089829 | 524 | |
7d27a354 | 525 | fFlowEvent->AddFlow(fV1,fV2,fV3,fV4,fV5); //add flow |
526 | fFlowEvent->CloneTracks(fNonFlowNumberOfTrackClones); //add nonflow by cloning tracks | |
54089829 | 527 | } |
528 | ////////////////////////////////////////////////////////////////////////////// | |
529 | ||
ef4799a7 | 530 | //tag subEvents |
7d27a354 | 531 | fFlowEvent->TagSubeventsInEta(fMinA,fMaxA,fMinB,fMaxB); |
940a5ed1 | 532 | |
cd62a2a8 | 533 | //QA |
534 | if (fQAon) | |
535 | { | |
536 | TH1* h1 = static_cast<TH1*>(fQAList->At(3)); | |
537 | h1->Fill(fFlowEvent->GetMCReactionPlaneAngle()); | |
538 | } | |
539 | ||
46bec39c | 540 | //fListHistos->Print(); |
7d27a354 | 541 | //fOutputFile->WriteObject(fFlowEvent,"myFlowEventSimple"); |
542 | PostData(1,fFlowEvent); | |
940a5ed1 | 543 | } |
1c1d4332 | 544 | |
545 | //________________________________________________________________________ | |
940a5ed1 | 546 | void AliAnalysisTaskFlowEvent::Terminate(Option_t *) |
1c1d4332 | 547 | { |
548 | // Called once at the end of the query -- do not call in case of CAF | |
1c1d4332 | 549 | } |
489fdf79 | 550 |