1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /*****************************************************************
17 AliFlowEvent: Event container for flow analysis
19 origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
20 *****************************************************************/
22 #include "Riostream.h"
25 #include "AliMCEvent.h"
26 #include "AliMCParticle.h"
27 #include "AliCFManager.h"
28 #include "AliESDtrack.h"
29 #include "AliESDPmdTrack.h"
30 #include "AliESDEvent.h"
31 #include "AliAODEvent.h"
32 #include "AliGenCocktailEventHeader.h"
33 #include "AliGenEposEventHeader.h"
34 #include "AliGenHijingEventHeader.h"
35 #include "AliGenGeVSimEventHeader.h"
36 #include "AliCollisionGeometry.h"
37 #include "AliMultiplicity.h"
38 #include "AliFlowTrackCuts.h"
39 #include "AliFlowEventSimple.h"
40 #include "AliFlowTrack.h"
41 #include "AliFlowEvent.h"
44 ClassImp(AliFlowEvent)
46 //-----------------------------------------------------------------------
47 AliFlowEvent::AliFlowEvent():
51 cout << "AliFlowEvent: Default constructor to be used only by root for io" << endl;
54 //-----------------------------------------------------------------------
55 AliFlowEvent::AliFlowEvent(Int_t n):
61 //-----------------------------------------------------------------------
62 AliFlowEvent::AliFlowEvent(const AliFlowEvent& event):
63 AliFlowEventSimple(event)
68 //-----------------------------------------------------------------------
69 AliFlowEvent& AliFlowEvent::operator=(const AliFlowEvent& event)
72 AliFlowEventSimple::operator=(event);
76 //-----------------------------------------------------------------------
77 AliFlowTrack* AliFlowEvent::GetTrack(Int_t i)
79 //get track i from collection
80 if (i>=fNumberOfTracks) return NULL;
81 AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i)) ;
85 //-----------------------------------------------------------------------
86 void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
88 //sets the event plane angle from the proper header in the MC
90 //COCKTAIL with HIJING
91 if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) //returns 0 if matches
93 AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
96 TList *lhd = headerC->GetHeaders();
99 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
100 if (hdh) AliFlowEventSimple::SetMCReactionPlaneAngle( hdh->ReactionPlaneAngle() );
105 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Therminator")) //returns 0 if matches
107 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
108 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
111 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header")) //returns 0 if matches
113 AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
114 if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
117 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing")) //returns 0 if matches
119 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
120 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
123 else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
125 AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
126 if (headerE) AliFlowEventSimple::SetMCReactionPlaneAngle( headerE->ReactionPlaneAngle() );
131 AliCollisionGeometry* header = dynamic_cast<AliCollisionGeometry*>(mcEvent->GenEventHeader());
132 if (header) AliFlowEventSimple::SetMCReactionPlaneAngle( header->ReactionPlaneAngle() );
136 //-----------------------------------------------------------------------
137 AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
138 const AliCFManager* rpCFManager,
139 const AliCFManager* poiCFManager):
140 AliFlowEventSimple(20)
142 //Fills the event from the MC kinematic information
144 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
147 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
150 AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(anInput->GetTrack(itrkN));
151 if (!pParticle) continue;
153 //check if pParticle passes the cuts
155 Bool_t poiOK = kTRUE;
156 if (rpCFManager && poiCFManager)
158 rpOK = rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
159 poiOK = poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
161 if (!(rpOK||poiOK)) continue;
163 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
164 pTrack->SetSource(AliFlowTrack::kFromMC);
166 if (rpOK && rpCFManager)
168 pTrack->SetForRPSelection(kTRUE);
171 if (poiOK && poiCFManager)
173 pTrack->SetForPOISelection(kTRUE);
178 SetMCReactionPlaneAngle(anInput);
181 //-----------------------------------------------------------------------
182 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
183 const AliCFManager* rpCFManager,
184 const AliCFManager* poiCFManager ):
185 AliFlowEventSimple(20)
187 //Fills the event from the ESD
189 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
192 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
194 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
196 //check if pParticle passes the cuts
198 Bool_t poiOK = kTRUE;
199 if (rpCFManager && poiCFManager)
201 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
202 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
203 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
204 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
206 if (!(rpOK || poiOK)) continue;
208 //make new AliFLowTrack
209 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
210 pTrack->SetSource(AliFlowTrack::kFromESD);
212 //marking the particles used for int. flow:
213 if(rpOK && rpCFManager)
215 pTrack->SetForRPSelection(kTRUE);
218 //marking the particles used for diff. flow:
219 if(poiOK && poiCFManager)
221 pTrack->SetForPOISelection(kTRUE);
225 }//end of while (itrkN < iNumberOfInputTracks)
228 //-----------------------------------------------------------------------
229 AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
230 const AliCFManager* rpCFManager,
231 const AliCFManager* poiCFManager):
232 AliFlowEventSimple(20)
234 //Fills the event from the AOD
235 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
238 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
240 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
242 //check if pParticle passes the cuts
244 Bool_t poiOK = kTRUE;
245 if (rpCFManager && poiCFManager)
247 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
248 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
249 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
250 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
252 if (!(rpOK || poiOK)) continue;
254 //make new AliFlowTrack
255 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
256 pTrack->SetSource(AliFlowTrack::kFromAOD);
258 if (rpOK /* && rpCFManager */ ) // to be fixed - with CF managers uncommented only empty events (NULL in header files)
260 pTrack->SetForRPSelection(kTRUE);
263 if (poiOK /* && poiCFManager*/ )
265 pTrack->SetForPOISelection(kTRUE);
270 // if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult)
272 // if ( (++fCount % 100) == 0)
274 // if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
275 // else cout<<" MC Reaction Plane Angle = unknown "<< endl;
276 // cout<<" iGoodTracks = "<<iGoodTracks<<endl;
277 // cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
278 // cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
279 // cout << "# " << fCount << " events processed" << endl;
285 // cout<<"Not enough tracks in the FlowEventSimple"<<endl;
291 // cout<<"Event does not pass multiplicity cuts"<<endl;
297 //-----------------------------------------------------------------------
298 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
299 const AliMCEvent* anInputMc,
301 const AliCFManager* rpCFManager,
302 const AliCFManager* poiCFManager ):
303 AliFlowEventSimple(20)
305 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
306 if (anOption==kNoKine)
308 AliFatal("WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)");
312 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
314 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
315 if (iNumberOfInputTracksMC==-1)
317 AliError("Skipping Event -- No MC information available for this event");
321 //loop over ESD tracks
322 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
324 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
326 Int_t iLabel = pParticle->GetLabel();
327 //match to mc particle
328 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
331 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label())
332 AliWarning(Form("pParticle->GetLabel()!=pMcParticle->Label(), %i, %i", pParticle->GetLabel(), pMcParticle->Label()));
334 //check if pParticle passes the cuts
335 Bool_t rpOK = kFALSE;
336 Bool_t poiOK = kFALSE;
337 if (rpCFManager && poiCFManager)
339 if(anOption == kESDkine)
341 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
342 rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
344 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
345 poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
348 else if (anOption == kMCkine)
350 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
352 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
357 if (!(rpOK || poiOK)) continue;
359 //make new AliFlowTrack
360 AliFlowTrack* pTrack = NULL;
361 if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
363 pTrack = new AliFlowTrack(pParticle);
365 else if (anOption == kMCkine) //take the PID and kinematics from the MC
367 pTrack = new AliFlowTrack(pMcParticle);
370 if (rpOK && rpCFManager)
373 pTrack->SetForRPSelection();
375 if (poiOK && poiCFManager) pTrack->SetForPOISelection();
379 SetMCReactionPlaneAngle(anInputMc);
382 //-----------------------------------------------------------------------
383 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
384 const AliMultiplicity* anInputTracklets,
385 const AliCFManager* poiCFManager ):
386 AliFlowEventSimple(20)
389 //Select the particles of interest from the ESD
390 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
393 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
395 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
397 //check if pParticle passes the cuts
398 Bool_t poiOK = kTRUE;
401 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
402 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
404 if (!poiOK) continue;
406 //make new AliFLowTrack
407 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
409 //marking the particles used for the particle of interest (POI) selection:
410 if(poiOK && poiCFManager)
412 pTrack->SetForPOISelection(kTRUE);
413 pTrack->SetSource(AliFlowTrack::kFromESD);
417 }//end of while (itrkN < iNumberOfInputTracks)
419 //Select the reference particles from the SPD tracklets
420 anInputTracklets = anInput->GetMultiplicity();
421 Int_t multSPD = anInputTracklets->GetNumberOfTracklets();
423 //loop over tracklets
424 for (Int_t itracklet=0; itracklet<multSPD; ++itracklet) {
425 Float_t thetaTr= anInputTracklets->GetTheta(itracklet);
426 Float_t phiTr= anInputTracklets->GetPhi(itracklet);
428 Float_t etaTr = -TMath::Log(TMath::Tan(thetaTr/2.));
430 //make new AliFLowTrackSimple
431 AliFlowTrack* pTrack = new AliFlowTrack();
433 pTrack->SetEta(etaTr);
434 pTrack->SetPhi(phiTr);
435 //marking the particles used for the reference particle (RP) selection:
437 pTrack->SetForRPSelection(kTRUE);
438 pTrack->SetSource(AliFlowTrack::kFromTracklet);
440 //Add the track to the flowevent
446 //-----------------------------------------------------------------------
447 AliFlowEvent::AliFlowEvent( const AliESDEvent* esd,
448 const AliCFManager* poiCFManager,
450 AliFlowEventSimple(20)
453 //Select the particles of interest from the ESD
454 Int_t iNumberOfInputTracks = esd->GetNumberOfTracks() ;
456 //Double_t gPt = 0.0, gP = 0.0;
457 Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0}; //The impact parameters and their covariance.
458 Double_t dca3D = 0.0;
460 AliESDtrack trackTPC;
463 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
466 if (!esd->GetTrack(itrkN)) continue;
468 Bool_t useTPC = kFALSE;
470 AliESDtrack* pParticle = esd->GetTrack(itrkN); //get input particle
472 //check if pParticle passes the cuts
473 Bool_t poiOK = kTRUE;
477 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
478 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
481 if (!(poiOK)) continue;
483 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)pParticle->GetTPCInnerParam();
488 // gPt = tpcTrack->Pt();
489 // gP = tpcTrack->P();
493 const AliESDVertex *vertexSPD = esd->GetPrimaryVertexSPD();
494 const AliESDVertex *vertexTPC = esd->GetPrimaryVertexTPC();
497 tpcTrack->PropagateToDCA(vertexSPD,esd->GetMagneticField(),100.,dca,cov);
499 tpcTrack->PropagateToDCA(vertexTPC,esd->GetMagneticField(),100.,dca,cov);
501 dca3D = TMath::Sqrt(TMath::Power(dca[0],2)+TMath::Power(dca[1],2));
505 //make new AliFLowTrack
506 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
508 pTrack->SetSource(AliFlowTrack::kFromESD);
510 //marking the particles used for diff. flow:
511 if(poiOK && poiCFManager)
513 pTrack->SetForPOISelection(kTRUE);
518 pTrack->SetForRPSelection(kTRUE);
524 }//end of while (itrkN < iNumberOfInputTracks)
528 //-----------------------------------------------------------------------
529 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
530 const TH2F* anInputFMDhist,
531 const AliCFManager* poiCFManager ):
532 AliFlowEventSimple(20)
535 //Select the particles of interest from the ESD
536 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
539 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
541 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
543 //check if pParticle passes the cuts
544 Bool_t poiOK = kTRUE;
547 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
548 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
550 if (!poiOK) continue;
552 //make new AliFLowTrack
553 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
555 //marking the particles used for the particle of interest (POI) selection:
556 if(poiOK && poiCFManager)
558 pTrack->SetForPOISelection(kTRUE);
559 pTrack->SetSource(AliFlowTrack::kFromESD);
563 }//end of while (itrkN < iNumberOfInputTracks)
565 //Select the reference particles from the FMD hits
566 //loop over FMD histogram
567 Int_t iBinsEta = anInputFMDhist->GetNbinsX();
568 Int_t iBinsPhi = anInputFMDhist->GetNbinsY();
570 for (Int_t iEta = 1; iEta <= iBinsEta; iEta++){
571 Double_t etaFMD = anInputFMDhist->GetXaxis()->GetBinCenter(iEta);
572 for (Int_t iPhi = 1; iPhi <= iBinsPhi; iPhi++){
573 Double_t phiFMD = anInputFMDhist->GetYaxis()->GetBinCenter(iPhi);
574 Double_t weightFMD = anInputFMDhist->GetBinContent(iEta,iPhi);
576 if (weightFMD > 0.0) { //do not add empty bins
577 //make new AliFLowTrackSimple
578 AliFlowTrack* pTrack = new AliFlowTrack();
580 pTrack->SetEta(etaFMD);
581 pTrack->SetPhi(phiFMD);
582 pTrack->SetWeight(weightFMD);
583 //marking the particles used for the reference particle (RP) selection:
586 pTrack->SetSource(AliFlowTrack::kFromFMD);
588 //Add the track to the flowevent
597 //-----------------------------------------------------------------------
598 void AliFlowEvent::Fill( AliFlowTrackCuts* rpCuts,
599 AliFlowTrackCuts* poiCuts )
601 //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
602 //the input data needs to be attached to the cuts
603 //we have two cases, if we're cutting the same collection of tracks
604 //(same param type) then we can have tracks that are both rp and poi
605 //in the other case we want to have two exclusive sets of rps and pois
606 //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
607 //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
612 if (!rpCuts || !poiCuts) return;
613 AliFlowTrackCuts::trackParameterType sourceRP = rpCuts->GetParamType();
614 AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
615 AliFlowTrack* pTrack=NULL;
617 if (sourceRP==sourcePOI)
620 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
622 //get input object (particle)
623 TObject* particle = rpCuts->GetInputObject(i);
625 Bool_t rp = rpCuts->IsSelected(particle,i);
626 Bool_t poi = poiCuts->IsSelected(particle,i);
628 if (!(rp||poi)) continue;
630 //make new AliFLowTrack
633 pTrack = ReuseTrack(fNumberOfTracks);
634 if (!rpCuts->FillFlowTrack(pTrack)) continue;
635 pTrack->TagRP(); fNumberOfRPs++;
636 if (poi) pTrack->TagPOI();
640 pTrack = ReuseTrack(fNumberOfTracks);
641 if (!poiCuts->FillFlowTrack(pTrack)) continue;
645 }//end of while (i < numberOfTracks)
647 else if (sourceRP!=sourcePOI)
649 //here we have two different sources of particles, so we fill
652 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
654 TObject* particle = rpCuts->GetInputObject(i);
655 Bool_t rp = rpCuts->IsSelected(particle,i);
657 pTrack = ReuseTrack(fNumberOfTracks);
658 if (!rpCuts->FillFlowTrack(pTrack)) continue;
664 for (Int_t i=0; i<poiCuts->GetNumberOfInputObjects(); i++)
666 TObject* particle = poiCuts->GetInputObject(i);
667 Bool_t poi = poiCuts->IsSelected(particle,i);
669 pTrack = ReuseTrack(fNumberOfTracks);
670 if (!poiCuts->FillFlowTrack(pTrack)) continue;
677 //-----------------------------------------------------------------------
678 AliFlowTrack* AliFlowEvent::ReuseTrack(Int_t i)
680 //try to reuse an existing track, if empty, make new one
681 AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i));
688 pTrack = new AliFlowTrack();
689 fTrackCollection->AddAtAndExpand(pTrack,i);
694 //-----------------------------------------------------------------------
695 AliFlowEvent::AliFlowEvent( AliFlowTrackCuts* rpCuts,
696 AliFlowTrackCuts* poiCuts ):
697 AliFlowEventSimple(20)
699 //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
700 //the input data needs to be attached to the cuts
701 //we have two cases, if we're cutting the same collection of tracks
702 //(same param type) then we can have tracks that are both rp and poi
703 //in the other case we want to have two exclusive sets of rps and pois
704 //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
705 //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
708 if (!rpCuts || !poiCuts) return;
709 AliFlowTrackCuts::trackParameterType sourceRP = rpCuts->GetParamType();
710 AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
712 if (sourceRP==sourcePOI)
715 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
717 //get input object (particle)
718 TObject* particle = rpCuts->GetInputObject(i);
720 Bool_t rp = rpCuts->IsSelected(particle,i);
721 Bool_t poi = poiCuts->IsSelected(particle,i);
723 if (!(rp||poi)) continue;
725 //make new AliFLowTrack
726 AliFlowTrack* pTrack = NULL;
729 pTrack = rpCuts->MakeFlowTrack();
730 if (!pTrack) continue;
731 pTrack->TagRP(); fNumberOfRPs++;
732 if (poi) pTrack->TagPOI();
737 pTrack = poiCuts->MakeFlowTrack();
738 if (!pTrack) continue;
742 }//end of while (i < numberOfTracks)
744 else if (sourceRP!=sourcePOI)
746 //here we have two different sources of particles, so we fill
748 AliFlowTrack* pTrack = NULL;
750 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
752 TObject* particle = rpCuts->GetInputObject(i);
753 Bool_t rp = rpCuts->IsSelected(particle,i);
755 pTrack = rpCuts->MakeFlowTrack();
756 if (!pTrack) continue;
757 pTrack->TagRP(); fNumberOfRPs++;
761 for (Int_t i=0; i<poiCuts->GetNumberOfInputObjects(); i++)
763 TObject* particle = poiCuts->GetInputObject(i);
764 Bool_t poi = poiCuts->IsSelected(particle,i);
766 pTrack = poiCuts->MakeFlowTrack();
767 if (!pTrack) continue;
774 //-------------------------------------------------------------------//
775 //---- Including PMD tracks as RP --------------------------//
777 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
778 const AliESDPmdTrack *pmdtracks,
779 const AliCFManager* poiCFManager ):
780 AliFlowEventSimple(20)
782 Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos);
783 Float_t GetPmdPhi(Float_t xPos, Float_t yPos);
784 //Select the particles of interest from the ESD
785 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
788 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
790 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
791 //check if pParticle passes the cuts
792 Bool_t poiOK = kTRUE;
795 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
796 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
798 if (!poiOK) continue;
800 //make new AliFLowTrack
801 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
803 //marking the particles used for the particle of interest (POI) selection:
804 if(poiOK && poiCFManager)
806 pTrack->SetForPOISelection(kTRUE);
807 pTrack->SetSource(AliFlowTrack::kFromESD);
811 }//end of while (itrkN < iNumberOfInputTracks)
813 //Select the reference particles from the PMD tracks
814 Int_t npmdcl = anInput->GetNumberOfPmdTracks();
815 printf("======There are %d PMD tracks in this event\n-------",npmdcl);
817 for(Int_t iclust=0; iclust < npmdcl; iclust++){
818 //AliESDPmdTrack *pmdtr = anInput->GetPmdTrack(iclust);
819 pmdtracks = anInput->GetPmdTrack(iclust);
820 Int_t det = pmdtracks->GetDetector();
821 //Int_t smn = pmdtracks->GetSmn();
822 Float_t clsX = pmdtracks->GetClusterX();
823 Float_t clsY = pmdtracks->GetClusterY();
824 Float_t clsZ = pmdtracks->GetClusterZ();
825 Float_t ncell = pmdtracks->GetClusterCells();
826 Float_t adc = pmdtracks->GetClusterADC();
827 //Float_t pid = pmdtracks->GetClusterPID();
828 Float_t etacls = GetPmdEta(clsX,clsY,clsZ);
829 Float_t phicls = GetPmdPhi(clsX,clsY);
830 //make new AliFLowTrackSimple
831 AliFlowTrack* pTrack = new AliFlowTrack();
832 //if(det == 0){ //selecting preshower plane only
833 if(det == 0 && adc > 270 && ncell > 1){ //selecting preshower plane only
834 //pTrack->SetPt(adc);//cluster adc
836 pTrack->SetEta(etacls);
837 pTrack->SetPhi(phicls);
838 //marking the particles used for the reference particle (RP) selection:
840 pTrack->SetForRPSelection(kTRUE);
841 pTrack->SetSource(AliFlowTrack::kFromPMD);
842 //Add the track to the flowevent
847 //----------------------------------------------------------------------------//
848 Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos)
850 Float_t rpxpy, theta, eta;
851 rpxpy = TMath::Sqrt(xPos*xPos + yPos*yPos);
852 theta = TMath::ATan2(rpxpy,zPos);
853 eta = -TMath::Log(TMath::Tan(0.5*theta));
856 //--------------------------------------------------------------------------//
857 Float_t GetPmdPhi(Float_t xPos, Float_t yPos)
859 Float_t pybypx, phi = 0., phi1;
862 if(yPos>0) phi = 90.;
863 if(yPos<0) phi = 270.;
868 if(pybypx < 0) pybypx = - pybypx;
869 phi1 = TMath::ATan(pybypx)*180./3.14159;
871 if(xPos > 0 && yPos > 0) phi = phi1; // 1st Quadrant
872 if(xPos < 0 && yPos > 0) phi = 180 - phi1; // 2nd Quadrant
873 if(xPos < 0 && yPos < 0) phi = 180 + phi1; // 3rd Quadrant
874 if(xPos > 0 && yPos < 0) phi = 360 - phi1; // 4th Quadrant
877 phi = phi*3.14159/180.;
880 //---------------------------------------------------------------//