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