]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx
Fix XML list creation from tag cuts - reset list counter for each file tag
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowTasks / AliFlowEvent.cxx
CommitLineData
7382279b 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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 *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*****************************************************************
17 AliFlowEvent: Event container for flow analysis
18
19 origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
20*****************************************************************/
21
22#include "Riostream.h"
23#include "TList.h"
44e060e0 24#include "TH2F.h"
7382279b 25#include "AliMCEvent.h"
26#include "AliMCParticle.h"
27#include "AliCFManager.h"
28#include "AliESDtrack.h"
333ce021 29#include "AliESDPmdTrack.h"
7382279b 30#include "AliESDEvent.h"
31#include "AliAODEvent.h"
32#include "AliGenCocktailEventHeader.h"
33#include "AliGenEposEventHeader.h"
34#include "AliGenHijingEventHeader.h"
35#include "AliGenGeVSimEventHeader.h"
244c607a 36#include "AliMultiplicity.h"
daf66719 37#include "AliFlowTrackCuts.h"
7382279b 38#include "AliFlowEventSimple.h"
244c607a 39#include "AliFlowTrack.h"
7382279b 40#include "AliFlowEvent.h"
77111ee6 41#include "AliLog.h"
7382279b 42
43ClassImp(AliFlowEvent)
44
45//-----------------------------------------------------------------------
46
47AliFlowEvent::AliFlowEvent():
48 AliFlowEventSimple()
49{
50 //ctor
51 cout << "AliFlowEvent: Default constructor to be used only by root for io" << endl;
52}
53
54//-----------------------------------------------------------------------
7382279b 55AliFlowEvent::AliFlowEvent(const AliFlowEvent& event):
56 AliFlowEventSimple(event)
57{
58 //cpy ctor
59}
60
61//-----------------------------------------------------------------------
7382279b 62AliFlowEvent& AliFlowEvent::operator=(const AliFlowEvent& event)
63{
64 //assignment operator
65 AliFlowEventSimple::operator=(event);
66 return *this;
67}
68
bc231a12 69//-----------------------------------------------------------------------
70AliFlowTrack* AliFlowEvent::GetTrack(Int_t i)
71{
72 //get track i from collection
73 if (i>=fNumberOfTracks) return NULL;
74 AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i)) ;
75 return pTrack;
76}
77
7382279b 78//-----------------------------------------------------------------------
79void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
80{
81 //sets the event plane angle from the proper header in the MC
82
83 //COCKTAIL with HIJING
84 if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) //returns 0 if matches
85 {
86 AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
87 if (headerC)
88 {
89 TList *lhd = headerC->GetHeaders();
90 if (lhd)
91 {
92 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
93 if (hdh) AliFlowEventSimple::SetMCReactionPlaneAngle( hdh->ReactionPlaneAngle() );
94 }
95 }
96 }
f85aa8b5 97 //THERMINATOR
98 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Therminator")) //returns 0 if matches
99 {
100 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
101 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
102 }
124fb262 103 //GEVSIM
7382279b 104 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header")) //returns 0 if matches
105 {
106 AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
107 if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
108 }
124fb262 109 //HIJING
7382279b 110 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing")) //returns 0 if matches
111 {
112 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
113 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
114 }
124fb262 115 //EPOS
7382279b 116 else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
117 {
118 AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
119 if (headerE) AliFlowEventSimple::SetMCReactionPlaneAngle( headerE->ReactionPlaneAngle() );
120 }
121}
122
123//-----------------------------------------------------------------------
124AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
244c607a 125 const AliCFManager* rpCFManager,
126 const AliCFManager* poiCFManager):
7382279b 127 AliFlowEventSimple(20)
128{
129 //Fills the event from the MC kinematic information
130
131 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
132
940a5ed1 133 //loop over tracks
134 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
135 {
136 //get input particle
137 AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(anInput->GetTrack(itrkN));
138 if (!pParticle) continue;
139
140 //check if pParticle passes the cuts
141 Bool_t rpOK = kTRUE;
142 Bool_t poiOK = kTRUE;
244c607a 143 if (rpCFManager && poiCFManager)
7382279b 144 {
244c607a 145 rpOK = rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
146 poiOK = poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
940a5ed1 147 }
148 if (!(rpOK||poiOK)) continue;
7382279b 149
bc231a12 150 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
151 pTrack->SetSource(AliFlowTrack::kFromMC);
7382279b 152
244c607a 153 if (rpOK && rpCFManager)
940a5ed1 154 {
155 pTrack->SetForRPSelection(kTRUE);
bc231a12 156 fNumberOfRPs++;
940a5ed1 157 }
244c607a 158 if (poiOK && poiCFManager)
940a5ed1 159 {
160 pTrack->SetForPOISelection(kTRUE);
161 }
7382279b 162
940a5ed1 163 AddTrack(pTrack) ;
164 }//for all tracks
7382279b 165 SetMCReactionPlaneAngle(anInput);
166}
167
168//-----------------------------------------------------------------------
169AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
244c607a 170 const AliCFManager* rpCFManager,
171 const AliCFManager* poiCFManager ):
7382279b 172 AliFlowEventSimple(20)
173{
174 //Fills the event from the ESD
175
176 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
177
178 //loop over tracks
179 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
180 {
181 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
182
183 //check if pParticle passes the cuts
184 Bool_t rpOK = kTRUE;
185 Bool_t poiOK = kTRUE;
244c607a 186 if (rpCFManager && poiCFManager)
7382279b 187 {
244c607a 188 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
189 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
190 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
191 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
7382279b 192 }
193 if (!(rpOK || poiOK)) continue;
194
bc231a12 195 //make new AliFLowTrack
196 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
197 pTrack->SetSource(AliFlowTrack::kFromESD);
7382279b 198
199 //marking the particles used for int. flow:
244c607a 200 if(rpOK && rpCFManager)
7382279b 201 {
202 pTrack->SetForRPSelection(kTRUE);
bc231a12 203 fNumberOfRPs++;
7382279b 204 }
205 //marking the particles used for diff. flow:
244c607a 206 if(poiOK && poiCFManager)
7382279b 207 {
208 pTrack->SetForPOISelection(kTRUE);
209 }
210
211 AddTrack(pTrack);
212 }//end of while (itrkN < iNumberOfInputTracks)
213}
214
215//-----------------------------------------------------------------------
216AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
244c607a 217 const AliCFManager* rpCFManager,
218 const AliCFManager* poiCFManager):
7382279b 219 AliFlowEventSimple(20)
220{
221 //Fills the event from the AOD
222 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
223
940a5ed1 224 //loop over tracks
7382279b 225 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
940a5ed1 226 {
227 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
7382279b 228
940a5ed1 229 //check if pParticle passes the cuts
230 Bool_t rpOK = kTRUE;
231 Bool_t poiOK = kTRUE;
244c607a 232 if (rpCFManager && poiCFManager)
940a5ed1 233 {
244c607a 234 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
235 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
236 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
237 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
940a5ed1 238 }
239 if (!(rpOK || poiOK)) continue;
7382279b 240
bc231a12 241 //make new AliFlowTrack
242 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
243 pTrack->SetSource(AliFlowTrack::kFromAOD);
7382279b 244
cd755f77 245 if (rpOK /* && rpCFManager */ ) // to be fixed - with CF managers uncommented only empty events (NULL in header files)
940a5ed1 246 {
247 pTrack->SetForRPSelection(kTRUE);
bc231a12 248 fNumberOfRPs++;
7382279b 249 }
cd755f77 250 if (poiOK /* && poiCFManager*/ )
940a5ed1 251 {
252 pTrack->SetForPOISelection(kTRUE);
253 }
254 AddTrack(pTrack);
255 }
7382279b 256
257 // if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult)
258 // {
259 // if ( (++fCount % 100) == 0)
260 // {
261 // if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
262 // else cout<<" MC Reaction Plane Angle = unknown "<< endl;
263 // cout<<" iGoodTracks = "<<iGoodTracks<<endl;
264 // cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
265 // cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
266 // cout << "# " << fCount << " events processed" << endl;
267 // }
268 // return pEvent;
269 // }
270 // else
271 // {
272 // cout<<"Not enough tracks in the FlowEventSimple"<<endl;
273 // return 0;
274 // }
275 //}
276 //else
277 //{
278 // cout<<"Event does not pass multiplicity cuts"<<endl;
279 // return 0;
280 //}
281
282}
283
284//-----------------------------------------------------------------------
285AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
286 const AliMCEvent* anInputMc,
124fb262 287 KineSource anOption,
244c607a 288 const AliCFManager* rpCFManager,
289 const AliCFManager* poiCFManager ):
7382279b 290 AliFlowEventSimple(20)
291{
292 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
124fb262 293 if (anOption==kNoKine)
7382279b 294 {
77111ee6 295 AliFatal("WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)");
7382279b 296 exit(1);
297 }
298
299 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
300
301 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
302 if (iNumberOfInputTracksMC==-1)
303 {
77111ee6 304 AliError("Skipping Event -- No MC information available for this event");
7382279b 305 return;
306 }
307
308 //loop over ESD tracks
309 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
940a5ed1 310 {
311 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
312 //get Label
313 Int_t iLabel = pParticle->GetLabel();
314 //match to mc particle
315 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
316
317 //check
77111ee6 318 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label())
319 AliWarning(Form("pParticle->GetLabel()!=pMcParticle->Label(), %i, %i", pParticle->GetLabel(), pMcParticle->Label()));
940a5ed1 320
321 //check if pParticle passes the cuts
322 Bool_t rpOK = kTRUE;
323 Bool_t poiOK = kTRUE;
244c607a 324 if (rpCFManager && poiCFManager)
7382279b 325 {
124fb262 326 if(anOption == kESDkine)
7382279b 327 {
244c607a 328 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
329 rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
7382279b 330 rpOK=kTRUE;
244c607a 331 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
332 poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
7382279b 333 poiOK=kTRUE;
334 }
124fb262 335 else if (anOption == kMCkine)
7382279b 336 {
244c607a 337 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
7382279b 338 rpOK=kTRUE;
244c607a 339 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
7382279b 340 poiOK=kTRUE;
341 }
940a5ed1 342 }
7382279b 343
940a5ed1 344 if (!(rpOK || poiOK)) continue;
7382279b 345
bc231a12 346 //make new AliFlowTrack
701f71c1 347 AliFlowTrack* pTrack = NULL;
940a5ed1 348 if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
349 {
701f71c1 350 pTrack = new AliFlowTrack(pParticle);
940a5ed1 351 }
352 else if (anOption == kMCkine) //take the PID and kinematics from the MC
353 {
701f71c1 354 pTrack = new AliFlowTrack(pMcParticle);
940a5ed1 355 }
7382279b 356
244c607a 357 if (rpOK && rpCFManager)
940a5ed1 358 {
bc231a12 359 fNumberOfRPs++;
940a5ed1 360 pTrack->SetForRPSelection();
7382279b 361 }
244c607a 362 if (poiOK && poiCFManager) pTrack->SetForPOISelection();
940a5ed1 363
364 AddTrack(pTrack);
365 }
366 SetMCReactionPlaneAngle(anInputMc);
7382279b 367}
368
ef4799a7 369//-----------------------------------------------------------------------
370AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
44e060e0 371 const AliMultiplicity* anInputTracklets,
372 const AliCFManager* poiCFManager ):
ef4799a7 373 AliFlowEventSimple(20)
374{
375
376 //Select the particles of interest from the ESD
377 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
378
379 //loop over tracks
380 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
381 {
382 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
383
384 //check if pParticle passes the cuts
385 Bool_t poiOK = kTRUE;
386 if (poiCFManager)
387 {
388 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
389 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
390 }
391 if (!poiOK) continue;
392
393 //make new AliFLowTrack
701f71c1 394 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
ef4799a7 395
396 //marking the particles used for the particle of interest (POI) selection:
397 if(poiOK && poiCFManager)
398 {
399 pTrack->SetForPOISelection(kTRUE);
400 pTrack->SetSource(AliFlowTrack::kFromESD);
401 }
402
403 AddTrack(pTrack);
404 }//end of while (itrkN < iNumberOfInputTracks)
405
406 //Select the reference particles from the SPD tracklets
407 anInputTracklets = anInput->GetMultiplicity();
408 Int_t multSPD = anInputTracklets->GetNumberOfTracklets();
44e060e0 409
ef4799a7 410 //loop over tracklets
411 for (Int_t itracklet=0; itracklet<multSPD; ++itracklet) {
412 Float_t thetaTr= anInputTracklets->GetTheta(itracklet);
413 Float_t phiTr= anInputTracklets->GetPhi(itracklet);
414 // calculate eta
415 Float_t etaTr = -TMath::Log(TMath::Tan(thetaTr/2.));
416
417 //make new AliFLowTrackSimple
418 AliFlowTrack* pTrack = new AliFlowTrack();
419 pTrack->SetPt(0.0);
420 pTrack->SetEta(etaTr);
421 pTrack->SetPhi(phiTr);
422 //marking the particles used for the reference particle (RP) selection:
423 fNumberOfRPs++;
424 pTrack->SetForRPSelection(kTRUE);
425 pTrack->SetSource(AliFlowTrack::kFromTracklet);
426
427 //Add the track to the flowevent
428 AddTrack(pTrack);
429 }
430
431}
432
cd755f77 433//-----------------------------------------------------------------------
434AliFlowEvent::AliFlowEvent( const AliESDEvent* esd,
435 const AliCFManager* poiCFManager,
436 Bool_t hybrid):
437 AliFlowEventSimple(20)
438{
439
440 //Select the particles of interest from the ESD
441 Int_t iNumberOfInputTracks = esd->GetNumberOfTracks() ;
442
443 //Double_t gPt = 0.0, gP = 0.0;
444 Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0}; //The impact parameters and their covariance.
445 Double_t dca3D = 0.0;
446
447 AliESDtrack trackTPC;
448
449 //loop over tracks
450 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
451 {
452
453 if (!esd->GetTrack(itrkN)) continue;
454
455 Bool_t useTPC = kFALSE;
456
457 AliESDtrack* pParticle = esd->GetTrack(itrkN); //get input particle
458
459 //check if pParticle passes the cuts
460 Bool_t poiOK = kTRUE;
461
462 if (poiCFManager)
463 {
464 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
465 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
466 }
467
468 if (!(poiOK)) continue;
469
470 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)pParticle->GetTPCInnerParam();
471
472 if (tpcTrack)
473 {
474
475// gPt = tpcTrack->Pt();
476// gP = tpcTrack->P();
477
478 useTPC = kTRUE;
479
480 const AliESDVertex *vertexSPD = esd->GetPrimaryVertexSPD();
481 const AliESDVertex *vertexTPC = esd->GetPrimaryVertexTPC();
482
483 if(hybrid)
484 tpcTrack->PropagateToDCA(vertexSPD,esd->GetMagneticField(),100.,dca,cov);
485 else
486 tpcTrack->PropagateToDCA(vertexTPC,esd->GetMagneticField(),100.,dca,cov);
487
488 dca3D = TMath::Sqrt(TMath::Power(dca[0],2)+TMath::Power(dca[1],2));
489
490 }
491
492 //make new AliFLowTrack
493 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
494
495 pTrack->SetSource(AliFlowTrack::kFromESD);
496
497 //marking the particles used for diff. flow:
498 if(poiOK && poiCFManager)
499 {
500 pTrack->SetForPOISelection(kTRUE);
501 }
502
503 if(useTPC)
504 {
505 pTrack->SetForRPSelection(kTRUE);
506 fNumberOfRPs++;
507 }
508
509 AddTrack(pTrack);
510
511 }//end of while (itrkN < iNumberOfInputTracks)
512
513}
ef4799a7 514
44e060e0 515//-----------------------------------------------------------------------
516AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
517 const TH2F* anInputFMDhist,
518 const AliCFManager* poiCFManager ):
519 AliFlowEventSimple(20)
520{
521
522 //Select the particles of interest from the ESD
523 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
524
525 //loop over tracks
526 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
527 {
528 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
529
530 //check if pParticle passes the cuts
531 Bool_t poiOK = kTRUE;
532 if (poiCFManager)
533 {
534 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
535 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
536 }
537 if (!poiOK) continue;
538
539 //make new AliFLowTrack
701f71c1 540 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
44e060e0 541
542 //marking the particles used for the particle of interest (POI) selection:
543 if(poiOK && poiCFManager)
544 {
545 pTrack->SetForPOISelection(kTRUE);
546 pTrack->SetSource(AliFlowTrack::kFromESD);
547 }
548
549 AddTrack(pTrack);
550 }//end of while (itrkN < iNumberOfInputTracks)
551
552 //Select the reference particles from the FMD hits
553 //loop over FMD histogram
554 Int_t iBinsEta = anInputFMDhist->GetNbinsX();
555 Int_t iBinsPhi = anInputFMDhist->GetNbinsY();
556
557 for (Int_t iEta = 1; iEta <= iBinsEta; iEta++){
558 Double_t etaFMD = anInputFMDhist->GetXaxis()->GetBinCenter(iEta);
559 for (Int_t iPhi = 1; iPhi <= iBinsPhi; iPhi++){
560 Double_t phiFMD = anInputFMDhist->GetYaxis()->GetBinCenter(iPhi);
561 Double_t weightFMD = anInputFMDhist->GetBinContent(iEta,iPhi);
562
563 if (weightFMD > 0.0) { //do not add empty bins
564 //make new AliFLowTrackSimple
565 AliFlowTrack* pTrack = new AliFlowTrack();
566 pTrack->SetPt(0.0);
567 pTrack->SetEta(etaFMD);
568 pTrack->SetPhi(phiFMD);
569 pTrack->SetWeight(weightFMD);
570 //marking the particles used for the reference particle (RP) selection:
333ce021 571 pTrack->TagRP();
44e060e0 572 fNumberOfRPs++;
333ce021 573 pTrack->SetSource(AliFlowTrack::kFromFMD);
44e060e0 574
575 //Add the track to the flowevent
576 AddTrack(pTrack);
577
578 }
579 }
580 }
581
582}
583
daf66719 584//-----------------------------------------------------------------------
12b2b8bc 585AliFlowEvent::AliFlowEvent( AliVEvent* inputEvent,
daf66719 586 AliFlowTrackCuts* rpCuts,
587 AliFlowTrackCuts* poiCuts ):
588 AliFlowEventSimple(20)
589{
590 //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
591
592 if (!rpCuts || !poiCuts) return;
593
12b2b8bc 594 AliFlowTrackCuts::trackParameterType sourceRP = rpCuts->GetParamType();
595 AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
daf66719 596
12b2b8bc 597 //MC case is special: handle it
598 //if input event empty do MC analysis
599 AliVEvent* eventRP = inputEvent;
600 AliVEvent* eventPOI = inputEvent;
601 if (!inputEvent)
daf66719 602 {
12b2b8bc 603 eventRP = rpCuts->GetMCevent();
604 eventPOI = poiCuts->GetMCevent();
605 }
606 if (sourceRP==AliFlowTrackCuts::kMC) eventRP = rpCuts->GetMCevent();
607 if (sourcePOI==AliFlowTrackCuts::kMC) eventPOI = poiCuts->GetMCevent();
608
609 //if we dont have input data return
610 if (!eventRP || !eventPOI) return;
611
612 //check if we want to use tracklets, TODO: const_casts to be somehow removed!
613 AliESDEvent* esdEvent = NULL;
614 AliMultiplicity* trackletsRP=NULL;
615 AliMultiplicity* trackletsPOI=NULL;
616 if (sourceRP==AliFlowTrackCuts::kESD_SPDtracklet)
617 {
618 esdEvent = dynamic_cast<AliESDEvent*>(eventRP);
619 if (!esdEvent) return;
620 trackletsRP=const_cast<AliMultiplicity*>(esdEvent->GetMultiplicity());
621 }
622 if (sourcePOI==AliFlowTrackCuts::kESD_SPDtracklet)
623 {
624 esdEvent = dynamic_cast<AliESDEvent*>(eventPOI);
625 if (!esdEvent) return;
626 trackletsPOI=const_cast<AliMultiplicity*>(esdEvent->GetMultiplicity());
627 }
daf66719 628
12b2b8bc 629 //we have two cases, if we're cutting the same collection of tracks
630 //(same param type) then we can have tracks that are both rp and poi
631 //in the other case we want to have two exclusive sets of rps and pois
632 //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
633 //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
634 //TAKEN TWICE
635 if (sourceRP==sourcePOI)
636 {
637 //loop over tracks
638 //check the number of particles first
639 Int_t numberOfTracks = 0;
640 if (trackletsRP) numberOfTracks = trackletsRP->GetNumberOfTracklets();
641 else numberOfTracks = eventRP->GetNumberOfTracks();
daf66719 642
12b2b8bc 643 for (Int_t i=0; i<numberOfTracks; i++)
daf66719 644 {
12b2b8bc 645 //get input object (particle)
646 TObject* particle = NULL;
647 if (trackletsRP) particle = trackletsRP;
648 else particle = eventRP->GetTrack(i);
649
650 Bool_t rp = rpCuts->IsSelected(particle,i);
651 Bool_t poi = poiCuts->IsSelected(particle,i);
652
653 if (!(rp||poi)) continue;
654
655 //make new AliFLowTrack
656 AliFlowTrack* pTrack = NULL;
12b2b8bc 657 if (rp)
658 {
659 pTrack = rpCuts->MakeFlowTrack();
9a0783cc 660 if (!pTrack) continue;
12b2b8bc 661 pTrack->TagRP(); fNumberOfRPs++;
924b02b0 662 if (poi) pTrack->TagPOI();
12b2b8bc 663 }
664 else
665 if (poi)
666 {
667 pTrack = poiCuts->MakeFlowTrack();
9a0783cc 668 if (!pTrack) continue;
12b2b8bc 669 pTrack->TagPOI();
670 }
671
672 AddTrack(pTrack);
673 }//end of while (i < numberOfTracks)
674 }
675 else if (sourceRP!=sourcePOI)
676 {
677 //here we have two different sources of particles, so we fill
678 //them independently
924b02b0 679 AliFlowTrack* pTrack = NULL;
12b2b8bc 680 //RP
681 Int_t numberOfRPs = 0;
682 if (trackletsRP) numberOfRPs = trackletsRP->GetNumberOfTracklets();
683 else numberOfRPs = eventRP->GetNumberOfTracks();
684 for (Int_t i=0; i<numberOfRPs; i++)
daf66719 685 {
12b2b8bc 686 TObject* particle = NULL;
687 if (trackletsRP) particle = trackletsRP;
688 else particle = eventRP->GetTrack(i);
689 Bool_t rp = rpCuts->IsSelected(particle,i);
690 if (!rp) continue;
924b02b0 691 pTrack = rpCuts->MakeFlowTrack();
9a0783cc 692 if (!pTrack) continue;
59dab33a 693 pTrack->TagRP(); fNumberOfRPs++;
924b02b0 694 AddTrack(pTrack);
daf66719 695 }
12b2b8bc 696 //POI
697 Int_t numberOfPOIs = 0;
698 if (trackletsPOI) numberOfPOIs = trackletsPOI->GetNumberOfTracklets();
699 else numberOfPOIs = eventPOI->GetNumberOfTracks();
700 for (Int_t i=0; i<numberOfPOIs; i++)
daf66719 701 {
12b2b8bc 702 TObject* particle = NULL;
703 if (trackletsPOI) particle = trackletsPOI;
704 else particle = eventPOI->GetTrack(i);
705 Bool_t poi = poiCuts->IsSelected(particle,i);
706 if (!poi) continue;
924b02b0 707 pTrack = poiCuts->MakeFlowTrack();
9a0783cc 708 if (!pTrack) continue;
daf66719 709 pTrack->TagPOI();
924b02b0 710 AddTrack(pTrack);
daf66719 711 }
12b2b8bc 712 }
daf66719 713}
714
333ce021 715//-------------------------------------------------------------------//
716//---- Including PMD tracks as RP --------------------------//
717
718AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
719 const AliESDPmdTrack *pmdtracks,
720 const AliCFManager* poiCFManager ):
721 AliFlowEventSimple(20)
722{
723 Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos);
724 Float_t GetPmdPhi(Float_t xPos, Float_t yPos);
725 //Select the particles of interest from the ESD
726 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
727
728 //loop over tracks
729 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
730 {
731 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
732 //check if pParticle passes the cuts
733 Bool_t poiOK = kTRUE;
734 if (poiCFManager)
735 {
736 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
737 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
738 }
739 if (!poiOK) continue;
740
741 //make new AliFLowTrack
742 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
743
744 //marking the particles used for the particle of interest (POI) selection:
745 if(poiOK && poiCFManager)
746 {
747 pTrack->SetForPOISelection(kTRUE);
748 pTrack->SetSource(AliFlowTrack::kFromESD);
749 }
750
751 AddTrack(pTrack);
752 }//end of while (itrkN < iNumberOfInputTracks)
753
754 //Select the reference particles from the PMD tracks
755 Int_t npmdcl = anInput->GetNumberOfPmdTracks();
756 printf("======There are %d PMD tracks in this event\n-------",npmdcl);
757 //loop over clusters
758 for(Int_t iclust=0; iclust < npmdcl; iclust++){
759 //AliESDPmdTrack *pmdtr = anInput->GetPmdTrack(iclust);
760 pmdtracks = anInput->GetPmdTrack(iclust);
761 Int_t det = pmdtracks->GetDetector();
762 //Int_t smn = pmdtracks->GetSmn();
763 Float_t clsX = pmdtracks->GetClusterX();
764 Float_t clsY = pmdtracks->GetClusterY();
765 Float_t clsZ = pmdtracks->GetClusterZ();
766 Float_t ncell = pmdtracks->GetClusterCells();
767 Float_t adc = pmdtracks->GetClusterADC();
768 //Float_t pid = pmdtracks->GetClusterPID();
769 Float_t etacls = GetPmdEta(clsX,clsY,clsZ);
770 Float_t phicls = GetPmdPhi(clsX,clsY);
771 //make new AliFLowTrackSimple
772 AliFlowTrack* pTrack = new AliFlowTrack();
773 //if(det == 0){ //selecting preshower plane only
774 if(det == 0 && adc > 270 && ncell > 1){ //selecting preshower plane only
775 //pTrack->SetPt(adc);//cluster adc
776 pTrack->SetPt(0.0);
777 pTrack->SetEta(etacls);
778 pTrack->SetPhi(phicls);
779 //marking the particles used for the reference particle (RP) selection:
780 fNumberOfRPs++;
781 pTrack->SetForRPSelection(kTRUE);
782 pTrack->SetSource(AliFlowTrack::kFromPMD);
783 //Add the track to the flowevent
784 AddTrack(pTrack);
785 }//if det
786 }
787}
788//----------------------------------------------------------------------------//
789Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos)
790{
791 Float_t rpxpy, theta, eta;
792 rpxpy = TMath::Sqrt(xPos*xPos + yPos*yPos);
793 theta = TMath::ATan2(rpxpy,zPos);
794 eta = -TMath::Log(TMath::Tan(0.5*theta));
795 return eta;
796}
797//--------------------------------------------------------------------------//
798Float_t GetPmdPhi(Float_t xPos, Float_t yPos)
799{
800 Float_t pybypx, phi = 0., phi1;
801 if(xPos==0)
802 {
803 if(yPos>0) phi = 90.;
804 if(yPos<0) phi = 270.;
805 }
806 if(xPos != 0)
807 {
808 pybypx = yPos/xPos;
809 if(pybypx < 0) pybypx = - pybypx;
810 phi1 = TMath::ATan(pybypx)*180./3.14159;
811
812 if(xPos > 0 && yPos > 0) phi = phi1; // 1st Quadrant
813 if(xPos < 0 && yPos > 0) phi = 180 - phi1; // 2nd Quadrant
814 if(xPos < 0 && yPos < 0) phi = 180 + phi1; // 3rd Quadrant
815 if(xPos > 0 && yPos < 0) phi = 360 - phi1; // 4th Quadrant
816
817 }
818 phi = phi*3.14159/180.;
819 return phi;
820}
821//---------------------------------------------------------------//
822
823