1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
16 /*****************************************************************
\r
17 AliFlowEvent: Event container for flow analysis
\r
19 origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
\r
20 *****************************************************************/
\r
22 #include "Riostream.h"
\r
25 #include "AliMCEvent.h"
\r
26 #include "AliMCParticle.h"
\r
27 #include "AliCFManager.h"
\r
28 #include "AliESDtrack.h"
\r
29 #include "AliESDPmdTrack.h"
\r
30 #include "AliESDEvent.h"
\r
31 #include "AliAODEvent.h"
\r
32 #include "AliGenCocktailEventHeader.h"
\r
33 #include "AliGenEposEventHeader.h"
\r
34 #include "AliGenHijingEventHeader.h"
\r
35 #include "AliGenGeVSimEventHeader.h"
\r
36 #include "AliCollisionGeometry.h"
\r
37 #include "AliMultiplicity.h"
\r
38 #include "AliFlowTrackCuts.h"
\r
39 #include "AliFlowEventSimple.h"
\r
40 #include "AliFlowTrack.h"
\r
41 #include "AliFlowEvent.h"
\r
46 ClassImp(AliFlowEvent)
\r
48 //-----------------------------------------------------------------------
\r
49 AliFlowEvent::AliFlowEvent():
\r
50 AliFlowEventSimple()
\r
53 cout << "AliFlowEvent: Default constructor to be used only by root for io" << endl;
\r
56 //-----------------------------------------------------------------------
\r
57 AliFlowEvent::AliFlowEvent(Int_t n):
\r
58 AliFlowEventSimple(n)
\r
63 //-----------------------------------------------------------------------
\r
64 AliFlowEvent::AliFlowEvent(const AliFlowEvent& event):
\r
65 AliFlowEventSimple(event)
\r
70 //-----------------------------------------------------------------------
\r
71 AliFlowEvent& AliFlowEvent::operator=(const AliFlowEvent& event)
\r
73 //assignment operator
\r
74 AliFlowEventSimple::operator=(event);
\r
78 //-----------------------------------------------------------------------
\r
79 AliFlowTrack* AliFlowEvent::GetTrack(Int_t i)
\r
81 //get track i from collection
\r
82 if (i>=fNumberOfTracks) return NULL;
\r
83 AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i)) ;
\r
87 //-----------------------------------------------------------------------
\r
88 void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
\r
90 //sets the event plane angle from the proper header in the MC
\r
92 //COCKTAIL with HIJING
\r
93 if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) //returns 0 if matches
\r
95 AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
\r
98 TList *lhd = headerC->GetHeaders();
\r
101 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
\r
102 if (hdh) AliFlowEventSimple::SetMCReactionPlaneAngle( hdh->ReactionPlaneAngle() );
\r
107 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Therminator")) //returns 0 if matches
\r
109 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
\r
110 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
\r
113 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header")) //returns 0 if matches
\r
115 AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
\r
116 if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
\r
119 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing")) //returns 0 if matches
\r
121 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
\r
122 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
\r
125 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Ampt")) //returns 0 if matches
\r
127 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
\r
128 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
\r
131 else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
\r
133 AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
\r
134 if (headerE) AliFlowEventSimple::SetMCReactionPlaneAngle( headerE->ReactionPlaneAngle() );
\r
139 AliCollisionGeometry* header = dynamic_cast<AliCollisionGeometry*>(mcEvent->GenEventHeader());
\r
140 if (header) AliFlowEventSimple::SetMCReactionPlaneAngle( header->ReactionPlaneAngle() );
\r
144 //-----------------------------------------------------------------------
\r
145 AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
\r
146 const AliCFManager* rpCFManager,
\r
147 const AliCFManager* poiCFManager):
\r
148 AliFlowEventSimple(20)
\r
150 //Fills the event from the MC kinematic information
\r
152 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
155 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
157 //get input particle
\r
158 AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(anInput->GetTrack(itrkN));
\r
159 if (!pParticle) continue;
\r
161 //check if pParticle passes the cuts
\r
162 Bool_t rpOK = kTRUE;
\r
163 Bool_t poiOK = kTRUE;
\r
164 if (rpCFManager && poiCFManager)
\r
166 rpOK = rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
\r
167 poiOK = poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
\r
169 if (!(rpOK||poiOK)) continue;
\r
171 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
172 pTrack->SetSource(AliFlowTrack::kFromMC);
\r
174 if (rpOK && rpCFManager)
\r
176 pTrack->SetForRPSelection(kTRUE);
\r
179 if (poiOK && poiCFManager)
\r
181 pTrack->SetForPOISelection(kTRUE);
\r
187 SetMCReactionPlaneAngle(anInput);
\r
190 //-----------------------------------------------------------------------
\r
191 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
\r
192 const AliCFManager* rpCFManager,
\r
193 const AliCFManager* poiCFManager ):
\r
194 AliFlowEventSimple(20)
\r
196 //Fills the event from the ESD
\r
198 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
201 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
203 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
\r
205 //check if pParticle passes the cuts
\r
206 Bool_t rpOK = kTRUE;
\r
207 Bool_t poiOK = kTRUE;
\r
208 if (rpCFManager && poiCFManager)
\r
210 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
211 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
212 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
213 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
215 if (!(rpOK || poiOK)) continue;
\r
217 //make new AliFLowTrack
\r
218 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
219 pTrack->SetSource(AliFlowTrack::kFromESD);
\r
221 //marking the particles used for int. flow:
\r
222 if(rpOK && rpCFManager)
\r
224 pTrack->SetForRPSelection(kTRUE);
\r
227 //marking the particles used for diff. flow:
\r
228 if(poiOK && poiCFManager)
\r
230 pTrack->SetForPOISelection(kTRUE);
\r
235 }//end of while (itrkN < iNumberOfInputTracks)
\r
238 //-----------------------------------------------------------------------
\r
239 AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
\r
240 const AliCFManager* rpCFManager,
\r
241 const AliCFManager* poiCFManager):
\r
242 AliFlowEventSimple(20)
\r
244 //Fills the event from the AOD
\r
245 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
248 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
250 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
\r
252 //check if pParticle passes the cuts
\r
253 Bool_t rpOK = kTRUE;
\r
254 Bool_t poiOK = kTRUE;
\r
255 if (rpCFManager && poiCFManager)
\r
257 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
258 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
259 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
260 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
262 if (!(rpOK || poiOK)) continue;
\r
264 //make new AliFlowTrack
\r
265 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
266 pTrack->SetSource(AliFlowTrack::kFromAOD);
\r
268 if (rpOK /* && rpCFManager */ ) // to be fixed - with CF managers uncommented only empty events (NULL in header files)
\r
270 pTrack->SetForRPSelection(kTRUE);
\r
273 if (poiOK /* && poiCFManager*/ )
\r
275 pTrack->SetForPOISelection(kTRUE);
\r
281 // if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult)
\r
283 // if ( (++fCount % 100) == 0)
\r
285 // if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
\r
286 // else cout<<" MC Reaction Plane Angle = unknown "<< endl;
\r
287 // cout<<" iGoodTracks = "<<iGoodTracks<<endl;
\r
288 // cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
\r
289 // cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
\r
290 // cout << "# " << fCount << " events processed" << endl;
\r
296 // cout<<"Not enough tracks in the FlowEventSimple"<<endl;
\r
302 // cout<<"Event does not pass multiplicity cuts"<<endl;
\r
308 //-----------------------------------------------------------------------
\r
309 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
\r
310 const AliMCEvent* anInputMc,
\r
311 KineSource anOption,
\r
312 const AliCFManager* rpCFManager,
\r
313 const AliCFManager* poiCFManager ):
\r
314 AliFlowEventSimple(20)
\r
316 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
\r
317 if (anOption==kNoKine)
\r
319 AliFatal("WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)");
\r
323 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
325 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
\r
326 if (iNumberOfInputTracksMC==-1)
\r
328 AliError("Skipping Event -- No MC information available for this event");
\r
332 //loop over ESD tracks
\r
333 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
335 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
\r
337 Int_t iLabel = pParticle->GetLabel();
\r
338 //match to mc particle
\r
339 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
\r
342 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label())
\r
343 AliWarning(Form("pParticle->GetLabel()!=pMcParticle->Label(), %i, %i", pParticle->GetLabel(), pMcParticle->Label()));
\r
345 //check if pParticle passes the cuts
\r
346 Bool_t rpOK = kFALSE;
\r
347 Bool_t poiOK = kFALSE;
\r
348 if (rpCFManager && poiCFManager)
\r
350 if(anOption == kESDkine)
\r
352 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
\r
353 rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
\r
355 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
\r
356 poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
\r
359 else if (anOption == kMCkine)
\r
361 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
\r
363 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
\r
368 if (!(rpOK || poiOK)) continue;
\r
370 //make new AliFlowTrack
\r
371 AliFlowTrack* pTrack = NULL;
\r
372 if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
\r
374 pTrack = new AliFlowTrack(pParticle);
\r
376 else if (anOption == kMCkine) //take the PID and kinematics from the MC
\r
378 pTrack = new AliFlowTrack(pMcParticle);
\r
381 if (rpOK && rpCFManager)
\r
384 pTrack->SetForRPSelection();
\r
386 if (poiOK && poiCFManager)
\r
389 pTrack->SetForPOISelection();
\r
394 SetMCReactionPlaneAngle(anInputMc);
\r
397 //-----------------------------------------------------------------------
\r
398 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
\r
399 const AliMultiplicity* anInputTracklets,
\r
400 const AliCFManager* poiCFManager ):
\r
401 AliFlowEventSimple(20)
\r
404 //Select the particles of interest from the ESD
\r
405 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
408 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
410 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
\r
412 //check if pParticle passes the cuts
\r
413 Bool_t poiOK = kTRUE;
\r
416 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
417 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
419 if (!poiOK) continue;
\r
421 //make new AliFLowTrack
\r
422 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
424 //marking the particles used for the particle of interest (POI) selection:
\r
425 if(poiOK && poiCFManager)
\r
428 pTrack->SetForPOISelection(kTRUE);
\r
429 pTrack->SetSource(AliFlowTrack::kFromESD);
\r
433 }//end of while (itrkN < iNumberOfInputTracks)
\r
435 //Select the reference particles from the SPD tracklets
\r
436 anInputTracklets = anInput->GetMultiplicity();
\r
437 Int_t multSPD = anInputTracklets->GetNumberOfTracklets();
\r
439 //loop over tracklets
\r
440 for (Int_t itracklet=0; itracklet<multSPD; ++itracklet) {
\r
441 Float_t thetaTr= anInputTracklets->GetTheta(itracklet);
\r
442 Float_t phiTr= anInputTracklets->GetPhi(itracklet);
\r
444 Float_t etaTr = -TMath::Log(TMath::Tan(thetaTr/2.));
\r
446 //make new AliFLowTrackSimple
\r
447 AliFlowTrack* pTrack = new AliFlowTrack();
\r
448 pTrack->SetPt(0.0);
\r
449 pTrack->SetEta(etaTr);
\r
450 pTrack->SetPhi(phiTr);
\r
451 //marking the particles used for the reference particle (RP) selection:
\r
453 pTrack->SetForRPSelection(kTRUE);
\r
454 pTrack->SetSource(AliFlowTrack::kFromTracklet);
\r
456 //Add the track to the flowevent
\r
462 //-----------------------------------------------------------------------
\r
463 AliFlowEvent::AliFlowEvent( const AliESDEvent* esd,
\r
464 const AliCFManager* poiCFManager,
\r
466 AliFlowEventSimple(20)
\r
469 //Select the particles of interest from the ESD
\r
470 Int_t iNumberOfInputTracks = esd->GetNumberOfTracks() ;
\r
472 //Double_t gPt = 0.0, gP = 0.0;
\r
473 Double_t dca[2] = {0.0,0.0}, cov[3] = {0.0,0.0,0.0}; //The impact parameters and their covariance.
\r
474 Double_t dca3D = 0.0;
\r
476 AliESDtrack trackTPC;
\r
479 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
482 if (!esd->GetTrack(itrkN)) continue;
\r
484 Bool_t useTPC = kFALSE;
\r
486 AliESDtrack* pParticle = esd->GetTrack(itrkN); //get input particle
\r
488 //check if pParticle passes the cuts
\r
489 Bool_t poiOK = kTRUE;
\r
493 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
494 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
497 if (!(poiOK)) continue;
\r
499 AliExternalTrackParam *tpcTrack = (AliExternalTrackParam *)pParticle->GetTPCInnerParam();
\r
504 // gPt = tpcTrack->Pt();
\r
505 // gP = tpcTrack->P();
\r
509 const AliESDVertex *vertexSPD = esd->GetPrimaryVertexSPD();
\r
510 const AliESDVertex *vertexTPC = esd->GetPrimaryVertexTPC();
\r
513 tpcTrack->PropagateToDCA(vertexSPD,esd->GetMagneticField(),100.,dca,cov);
\r
515 tpcTrack->PropagateToDCA(vertexTPC,esd->GetMagneticField(),100.,dca,cov);
\r
517 dca3D = TMath::Sqrt(TMath::Power(dca[0],2)+TMath::Power(dca[1],2));
\r
521 //make new AliFLowTrack
\r
522 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
524 pTrack->SetSource(AliFlowTrack::kFromESD);
\r
526 //marking the particles used for diff. flow:
\r
527 if(poiOK && poiCFManager)
\r
529 pTrack->SetForPOISelection(kTRUE);
\r
535 pTrack->SetForRPSelection(kTRUE);
\r
541 }//end of while (itrkN < iNumberOfInputTracks)
\r
545 //-----------------------------------------------------------------------
\r
546 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
\r
547 const TH2F* anInputFMDhist,
\r
548 const AliCFManager* poiCFManager ):
\r
549 AliFlowEventSimple(20)
\r
552 //Select the particles of interest from the ESD
\r
553 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
556 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
558 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
\r
560 //check if pParticle passes the cuts
\r
561 Bool_t poiOK = kTRUE;
\r
564 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
565 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
567 if (!poiOK) continue;
\r
569 //make new AliFLowTrack
\r
570 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
572 //marking the particles used for the particle of interest (POI) selection:
\r
573 if(poiOK && poiCFManager)
\r
576 pTrack->SetForPOISelection(kTRUE);
\r
577 pTrack->SetSource(AliFlowTrack::kFromESD);
\r
581 }//end of while (itrkN < iNumberOfInputTracks)
\r
583 //Select the reference particles from the FMD hits
\r
584 //loop over FMD histogram
\r
585 Int_t iBinsEta = anInputFMDhist->GetNbinsX();
\r
586 Int_t iBinsPhi = anInputFMDhist->GetNbinsY();
\r
588 for (Int_t iEta = 1; iEta <= iBinsEta; iEta++){
\r
589 Double_t etaFMD = anInputFMDhist->GetXaxis()->GetBinCenter(iEta);
\r
590 for (Int_t iPhi = 1; iPhi <= iBinsPhi; iPhi++){
\r
591 Double_t phiFMD = anInputFMDhist->GetYaxis()->GetBinCenter(iPhi);
\r
592 Double_t weightFMD = anInputFMDhist->GetBinContent(iEta,iPhi);
\r
594 if (weightFMD > 0.0) { //do not add empty bins
\r
595 //make new AliFLowTrackSimple
\r
596 AliFlowTrack* pTrack = new AliFlowTrack();
\r
597 pTrack->SetPt(0.0);
\r
598 pTrack->SetEta(etaFMD);
\r
599 pTrack->SetPhi(phiFMD);
\r
600 pTrack->SetWeight(weightFMD);
\r
601 //marking the particles used for the reference particle (RP) selection:
\r
604 pTrack->SetSource(AliFlowTrack::kFromFMD);
\r
606 //Add the track to the flowevent
\r
615 //-----------------------------------------------------------------------
\r
616 void AliFlowEvent::Fill( AliFlowTrackCuts* rpCuts,
\r
617 AliFlowTrackCuts* poiCuts )
\r
619 //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
\r
620 //the input data needs to be attached to the cuts
\r
621 //we have two cases, if we're cutting the same collection of tracks
\r
622 //(same param type) then we can have tracks that are both rp and poi
\r
623 //in the other case we want to have two exclusive sets of rps and pois
\r
624 //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
\r
625 //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
\r
630 if (!rpCuts || !poiCuts) return;
\r
631 AliFlowTrackCuts::trackParameterType sourceRP = rpCuts->GetParamType();
\r
632 AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
\r
633 AliFlowTrack* pTrack=NULL;
\r
635 if (sourceRP==sourcePOI)
\r
638 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
\r
640 //get input object (particle)
\r
641 TObject* particle = rpCuts->GetInputObject(i);
\r
643 Bool_t rp = rpCuts->IsSelected(particle,i);
\r
644 Bool_t poi = poiCuts->IsSelected(particle,i);
\r
646 if (!(rp||poi)) continue;
\r
648 //make new AliFLowTrack
\r
651 pTrack = ReuseTrack(fNumberOfTracks);
\r
652 if (!rpCuts->FillFlowTrack(pTrack)) continue;
\r
653 pTrack->TagRP(); fNumberOfRPs++;
\r
654 if (poi) {pTrack->TagPOI(); fNumberOfPOIs++;}
\r
658 pTrack = ReuseTrack(fNumberOfTracks);
\r
659 if (!poiCuts->FillFlowTrack(pTrack)) continue;
\r
660 pTrack->TagPOI(); fNumberOfPOIs++;
\r
663 }//end of while (i < numberOfTracks)
\r
665 else if (sourceRP!=sourcePOI)
\r
667 //here we have two different sources of particles, so we fill
\r
668 //them independently
\r
670 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
\r
672 TObject* particle = rpCuts->GetInputObject(i);
\r
673 Bool_t rp = rpCuts->IsSelected(particle,i);
\r
675 pTrack = ReuseTrack(fNumberOfTracks);
\r
676 if (!rpCuts->FillFlowTrack(pTrack)) continue;
\r
682 for (Int_t i=0; i<poiCuts->GetNumberOfInputObjects(); i++)
\r
684 TObject* particle = poiCuts->GetInputObject(i);
\r
685 Bool_t poi = poiCuts->IsSelected(particle,i);
\r
686 if (!poi) continue;
\r
687 pTrack = ReuseTrack(fNumberOfTracks);
\r
688 if (!poiCuts->FillFlowTrack(pTrack)) continue;
\r
695 //-----------------------------------------------------------------------
\r
696 void AliFlowEvent::InsertTrack(AliFlowTrack *thisTrack) {
\r
697 // adds a flow track at the end of the container
\r
698 AliFlowTrack *pTrack = ReuseTrack( fNumberOfTracks++ );
\r
699 pTrack->SetPt( thisTrack->Pt() );
\r
700 pTrack->SetPhi( thisTrack->Phi() );
\r
701 pTrack->SetEta( thisTrack->Eta() );
\r
702 pTrack->SetWeight( thisTrack->Weight() );
\r
703 pTrack->SetCharge( thisTrack->Charge() );
\r
704 pTrack->SetMass( thisTrack->Mass() );
\r
705 pTrack->SetForRPSelection( thisTrack->InRPSelection() );
\r
706 pTrack->SetForPOISelection( thisTrack->InPOISelection() );
\r
707 if(thisTrack->InSubevent(0)) pTrack->SetForSubevent(0);
\r
708 if(thisTrack->InSubevent(1)) pTrack->SetForSubevent(1);
\r
709 pTrack->SetID( thisTrack->GetID() );
\r
713 //-----------------------------------------------------------------------
\r
714 AliFlowTrack* AliFlowEvent::ReuseTrack(Int_t i)
\r
716 //try to reuse an existing track, if empty, make new one
\r
717 AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i));
\r
724 pTrack = new AliFlowTrack();
\r
725 fTrackCollection->AddAtAndExpand(pTrack,i);
\r
730 //-----------------------------------------------------------------------
\r
731 AliFlowEvent::AliFlowEvent( AliFlowTrackCuts* rpCuts,
\r
732 AliFlowTrackCuts* poiCuts ):
\r
733 AliFlowEventSimple(20)
\r
735 //Fills the event from a vevent: AliESDEvent,AliAODEvent,AliMCEvent
\r
736 //the input data needs to be attached to the cuts
\r
737 //we have two cases, if we're cutting the same collection of tracks
\r
738 //(same param type) then we can have tracks that are both rp and poi
\r
739 //in the other case we want to have two exclusive sets of rps and pois
\r
740 //e.g. one tracklets, the other PMD or global - USER IS RESPOSIBLE
\r
741 //FOR MAKING SURE THEY DONT OVERLAP OR ELSE THE SAME PARTICLE WILL BE
\r
744 if (!rpCuts || !poiCuts) return;
\r
745 AliFlowTrackCuts::trackParameterType sourceRP = rpCuts->GetParamType();
\r
746 AliFlowTrackCuts::trackParameterType sourcePOI = poiCuts->GetParamType();
\r
748 if (sourceRP==sourcePOI)
\r
751 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
\r
753 //get input object (particle)
\r
754 TObject* particle = rpCuts->GetInputObject(i);
\r
756 Bool_t rp = rpCuts->IsSelected(particle,i);
\r
757 Bool_t poi = poiCuts->IsSelected(particle,i);
\r
759 if (!(rp||poi)) continue;
\r
761 //make new AliFLowTrack
\r
762 AliFlowTrack* pTrack = NULL;
\r
765 pTrack = rpCuts->MakeFlowTrack();
\r
766 if (!pTrack) continue;
\r
767 pTrack->TagRP(); fNumberOfRPs++;
\r
768 if (poi) {pTrack->TagPOI(); fNumberOfPOIs++;}
\r
773 pTrack = poiCuts->MakeFlowTrack();
\r
774 if (!pTrack) continue;
\r
775 pTrack->TagPOI(); fNumberOfPOIs++;
\r
778 }//end of while (i < numberOfTracks)
\r
780 else if (sourceRP!=sourcePOI)
\r
782 //here we have two different sources of particles, so we fill
\r
783 //them independently
\r
784 AliFlowTrack* pTrack = NULL;
\r
786 for (Int_t i=0; i<rpCuts->GetNumberOfInputObjects(); i++)
\r
788 TObject* particle = rpCuts->GetInputObject(i);
\r
789 Bool_t rp = rpCuts->IsSelected(particle,i);
\r
791 pTrack = rpCuts->MakeFlowTrack();
\r
792 if (!pTrack) continue;
\r
793 pTrack->TagRP(); fNumberOfRPs++;
\r
797 for (Int_t i=0; i<poiCuts->GetNumberOfInputObjects(); i++)
\r
799 TObject* particle = poiCuts->GetInputObject(i);
\r
800 Bool_t poi = poiCuts->IsSelected(particle,i);
\r
801 if (!poi) continue;
\r
802 pTrack = poiCuts->MakeFlowTrack();
\r
803 if (!pTrack) continue;
\r
804 pTrack->TagPOI(); fNumberOfPOIs++;
\r
810 //-------------------------------------------------------------------//
\r
811 //---- Including PMD tracks as RP --------------------------//
\r
813 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
\r
814 const AliESDPmdTrack *pmdtracks,
\r
815 const AliCFManager* poiCFManager ):
\r
816 AliFlowEventSimple(20)
\r
818 Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos);
\r
819 Float_t GetPmdPhi(Float_t xPos, Float_t yPos);
\r
820 //Select the particles of interest from the ESD
\r
821 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
\r
824 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
\r
826 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
\r
827 //check if pParticle passes the cuts
\r
828 Bool_t poiOK = kTRUE;
\r
831 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
\r
832 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
\r
834 if (!poiOK) continue;
\r
836 //make new AliFLowTrack
\r
837 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
\r
839 //marking the particles used for the particle of interest (POI) selection:
\r
840 if(poiOK && poiCFManager)
\r
843 pTrack->SetForPOISelection(kTRUE);
\r
844 pTrack->SetSource(AliFlowTrack::kFromESD);
\r
848 }//end of while (itrkN < iNumberOfInputTracks)
\r
850 //Select the reference particles from the PMD tracks
\r
851 Int_t npmdcl = anInput->GetNumberOfPmdTracks();
\r
852 printf("======There are %d PMD tracks in this event\n-------",npmdcl);
\r
853 //loop over clusters
\r
854 for(Int_t iclust=0; iclust < npmdcl; iclust++){
\r
855 //AliESDPmdTrack *pmdtr = anInput->GetPmdTrack(iclust);
\r
856 pmdtracks = anInput->GetPmdTrack(iclust);
\r
857 Int_t det = pmdtracks->GetDetector();
\r
858 //Int_t smn = pmdtracks->GetSmn();
\r
859 Float_t clsX = pmdtracks->GetClusterX();
\r
860 Float_t clsY = pmdtracks->GetClusterY();
\r
861 Float_t clsZ = pmdtracks->GetClusterZ();
\r
862 Float_t ncell = pmdtracks->GetClusterCells();
\r
863 Float_t adc = pmdtracks->GetClusterADC();
\r
864 //Float_t pid = pmdtracks->GetClusterPID();
\r
865 Float_t etacls = GetPmdEta(clsX,clsY,clsZ);
\r
866 Float_t phicls = GetPmdPhi(clsX,clsY);
\r
867 //make new AliFLowTrackSimple
\r
868 AliFlowTrack* pTrack = new AliFlowTrack();
\r
869 //if(det == 0){ //selecting preshower plane only
\r
870 if(det == 0 && adc > 270 && ncell > 1){ //selecting preshower plane only
\r
871 //pTrack->SetPt(adc);//cluster adc
\r
872 pTrack->SetPt(0.0);
\r
873 pTrack->SetEta(etacls);
\r
874 pTrack->SetPhi(phicls);
\r
875 //marking the particles used for the reference particle (RP) selection:
\r
877 pTrack->SetForRPSelection(kTRUE);
\r
878 pTrack->SetSource(AliFlowTrack::kFromPMD);
\r
879 //Add the track to the flowevent
\r
884 //----------------------------------------------------------------------------//
\r
885 Float_t GetPmdEta(Float_t xPos, Float_t yPos, Float_t zPos)
\r
887 Float_t rpxpy, theta, eta;
\r
888 rpxpy = TMath::Sqrt(xPos*xPos + yPos*yPos);
\r
889 theta = TMath::ATan2(rpxpy,zPos);
\r
890 eta = -TMath::Log(TMath::Tan(0.5*theta));
\r
893 //--------------------------------------------------------------------------//
\r
894 Float_t GetPmdPhi(Float_t xPos, Float_t yPos)
\r
896 Float_t pybypx, phi = 0., phi1;
\r
899 if(yPos>0) phi = 90.;
\r
900 if(yPos<0) phi = 270.;
\r
904 pybypx = yPos/xPos;
\r
905 if(pybypx < 0) pybypx = - pybypx;
\r
906 phi1 = TMath::ATan(pybypx)*180./3.14159;
\r
908 if(xPos > 0 && yPos > 0) phi = phi1; // 1st Quadrant
\r
909 if(xPos < 0 && yPos > 0) phi = 180 - phi1; // 2nd Quadrant
\r
910 if(xPos < 0 && yPos < 0) phi = 180 + phi1; // 3rd Quadrant
\r
911 if(xPos > 0 && yPos < 0) phi = 360 - phi1; // 4th Quadrant
\r
914 phi = phi*3.14159/180.;
\r
917 //---------------------------------------------------------------//
\r