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