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"
24 #include "AliMCEvent.h"
25 #include "AliMCParticle.h"
26 #include "AliCFManager.h"
27 #include "AliESDtrack.h"
28 #include "AliESDEvent.h"
29 #include "AliAODEvent.h"
30 #include "AliGenCocktailEventHeader.h"
31 #include "AliGenEposEventHeader.h"
32 #include "AliGenHijingEventHeader.h"
33 #include "AliGenGeVSimEventHeader.h"
34 #include "AliMultiplicity.h"
35 #include "AliFlowTrackSimpleCuts.h"
36 #include "AliFlowEventSimple.h"
37 #include "AliFlowTrack.h"
38 #include "AliFlowEvent.h"
41 ClassImp(AliFlowEvent)
43 //-----------------------------------------------------------------------
45 AliFlowEvent::AliFlowEvent():
49 cout << "AliFlowEvent: Default constructor to be used only by root for io" << endl;
52 //-----------------------------------------------------------------------
53 AliFlowEvent::AliFlowEvent(const AliFlowEvent& event):
54 AliFlowEventSimple(event)
59 //-----------------------------------------------------------------------
60 AliFlowEvent& AliFlowEvent::operator=(const AliFlowEvent& event)
63 AliFlowEventSimple::operator=(event);
67 //-----------------------------------------------------------------------
68 AliFlowTrack* AliFlowEvent::GetTrack(Int_t i)
70 //get track i from collection
71 if (i>=fNumberOfTracks) return NULL;
72 AliFlowTrack* pTrack = static_cast<AliFlowTrack*>(fTrackCollection->At(i)) ;
76 //-----------------------------------------------------------------------
77 void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
79 //sets the event plane angle from the proper header in the MC
81 //COCKTAIL with HIJING
82 if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) //returns 0 if matches
84 AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
87 TList *lhd = headerC->GetHeaders();
90 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
91 if (hdh) AliFlowEventSimple::SetMCReactionPlaneAngle( hdh->ReactionPlaneAngle() );
96 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header")) //returns 0 if matches
98 AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
99 if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
102 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing")) //returns 0 if matches
104 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
105 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
108 else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
110 AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
111 if (headerE) AliFlowEventSimple::SetMCReactionPlaneAngle( headerE->ReactionPlaneAngle() );
115 //-----------------------------------------------------------------------
116 AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
117 const AliCFManager* rpCFManager,
118 const AliCFManager* poiCFManager):
119 AliFlowEventSimple(20)
121 //Fills the event from the MC kinematic information
123 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
126 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
129 AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(anInput->GetTrack(itrkN));
130 if (!pParticle) continue;
132 //check if pParticle passes the cuts
134 Bool_t poiOK = kTRUE;
135 if (rpCFManager && poiCFManager)
137 rpOK = rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
138 poiOK = poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
140 if (!(rpOK||poiOK)) continue;
142 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
143 pTrack->SetSource(AliFlowTrack::kFromMC);
145 if (rpOK && rpCFManager)
147 pTrack->SetForRPSelection(kTRUE);
150 if (poiOK && poiCFManager)
152 pTrack->SetForPOISelection(kTRUE);
157 SetMCReactionPlaneAngle(anInput);
160 //-----------------------------------------------------------------------
161 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
162 const AliCFManager* rpCFManager,
163 const AliCFManager* poiCFManager ):
164 AliFlowEventSimple(20)
166 //Fills the event from the ESD
168 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
171 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
173 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
175 //check if pParticle passes the cuts
177 Bool_t poiOK = kTRUE;
178 if (rpCFManager && poiCFManager)
180 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
181 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
182 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
183 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
185 if (!(rpOK || poiOK)) continue;
187 //make new AliFLowTrack
188 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
189 pTrack->SetSource(AliFlowTrack::kFromESD);
191 //marking the particles used for int. flow:
192 if(rpOK && rpCFManager)
194 pTrack->SetForRPSelection(kTRUE);
197 //marking the particles used for diff. flow:
198 if(poiOK && poiCFManager)
200 pTrack->SetForPOISelection(kTRUE);
204 }//end of while (itrkN < iNumberOfInputTracks)
207 //-----------------------------------------------------------------------
208 AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
209 const AliCFManager* rpCFManager,
210 const AliCFManager* poiCFManager):
211 AliFlowEventSimple(20)
213 //Fills the event from the AOD
214 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
217 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
219 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
221 //check if pParticle passes the cuts
223 Bool_t poiOK = kTRUE;
224 if (rpCFManager && poiCFManager)
226 rpOK = ( rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
227 rpCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
228 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
229 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
231 if (!(rpOK || poiOK)) continue;
233 //make new AliFlowTrack
234 AliFlowTrack* pTrack = new AliFlowTrack(pParticle);
235 pTrack->SetSource(AliFlowTrack::kFromAOD);
237 if (rpOK && rpCFManager)
239 pTrack->SetForRPSelection(kTRUE);
242 if (poiOK && poiCFManager)
244 pTrack->SetForPOISelection(kTRUE);
249 // if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult)
251 // if ( (++fCount % 100) == 0)
253 // if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
254 // else cout<<" MC Reaction Plane Angle = unknown "<< endl;
255 // cout<<" iGoodTracks = "<<iGoodTracks<<endl;
256 // cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
257 // cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
258 // cout << "# " << fCount << " events processed" << endl;
264 // cout<<"Not enough tracks in the FlowEventSimple"<<endl;
270 // cout<<"Event does not pass multiplicity cuts"<<endl;
276 //-----------------------------------------------------------------------
277 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
278 const AliMCEvent* anInputMc,
280 const AliCFManager* rpCFManager,
281 const AliCFManager* poiCFManager ):
282 AliFlowEventSimple(20)
284 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
285 if (anOption==kNoKine)
287 AliFatal("WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)");
291 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
293 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
294 if (iNumberOfInputTracksMC==-1)
296 AliError("Skipping Event -- No MC information available for this event");
300 //loop over ESD tracks
301 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
303 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
305 Int_t iLabel = pParticle->GetLabel();
306 //match to mc particle
307 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
310 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label())
311 AliWarning(Form("pParticle->GetLabel()!=pMcParticle->Label(), %i, %i", pParticle->GetLabel(), pMcParticle->Label()));
313 //check if pParticle passes the cuts
315 Bool_t poiOK = kTRUE;
316 if (rpCFManager && poiCFManager)
318 if(anOption == kESDkine)
320 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
321 rpCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
323 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
324 poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
327 else if (anOption == kMCkine)
329 if (rpCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
331 if (poiCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
336 if (!(rpOK || poiOK)) continue;
338 //make new AliFlowTrack
339 AliFlowTrack* pTrack = new AliFlowTrack();
340 if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
342 pTrack->SetPt(pParticle->Pt() );
343 pTrack->SetEta(pParticle->Eta() );
344 pTrack->SetPhi(pParticle->Phi() );
346 else if (anOption == kMCkine) //take the PID and kinematics from the MC
348 pTrack->SetPt(pMcParticle->Pt() );
349 pTrack->SetEta(pMcParticle->Eta() );
350 pTrack->SetPhi(pMcParticle->Phi() );
353 if (rpOK && rpCFManager)
356 pTrack->SetForRPSelection();
358 if (poiOK && poiCFManager) pTrack->SetForPOISelection();
362 SetMCReactionPlaneAngle(anInputMc);
365 //-----------------------------------------------------------------------
366 AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
367 const AliMultiplicity* anInputTracklets,
368 const AliCFManager* poiCFManager ):
369 AliFlowEventSimple(20)
372 //Select the particles of interest from the ESD
373 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
376 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
378 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
380 //check if pParticle passes the cuts
381 Bool_t poiOK = kTRUE;
384 poiOK = ( poiCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
385 poiCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
387 if (!poiOK) continue;
389 //make new AliFLowTrack
390 AliFlowTrack* pTrack = new AliFlowTrack();
391 pTrack->SetPt(pParticle->Pt() );
392 pTrack->SetEta(pParticle->Eta() );
393 pTrack->SetPhi(pParticle->Phi() );
395 //marking the particles used for the particle of interest (POI) selection:
396 if(poiOK && poiCFManager)
398 pTrack->SetForPOISelection(kTRUE);
399 pTrack->SetSource(AliFlowTrack::kFromESD);
403 }//end of while (itrkN < iNumberOfInputTracks)
405 //Select the reference particles from the SPD tracklets
406 anInputTracklets = anInput->GetMultiplicity();
407 Int_t multSPD = anInputTracklets->GetNumberOfTracklets();
409 cout << "N tracklets: " << multSPD << endl; //for testing
411 //loop over tracklets
412 for (Int_t itracklet=0; itracklet<multSPD; ++itracklet) {
413 Float_t thetaTr= anInputTracklets->GetTheta(itracklet);
414 Float_t phiTr= anInputTracklets->GetPhi(itracklet);
416 Float_t etaTr = -TMath::Log(TMath::Tan(thetaTr/2.));
418 //make new AliFLowTrackSimple
419 AliFlowTrack* pTrack = new AliFlowTrack();
421 pTrack->SetEta(etaTr);
422 pTrack->SetPhi(phiTr);
423 //marking the particles used for the reference particle (RP) selection:
425 pTrack->SetForRPSelection(kTRUE);
426 pTrack->SetSource(AliFlowTrack::kFromTracklet);
428 //Add the track to the flowevent