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