]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowTasks/AliFlowEvent.cxx
removing printouts from previous checkins
[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"
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 "AliFlowTrackSimpleCuts.h"
35#include "AliFlowEventSimple.h"
36#include "AliFlowEvent.h"
77111ee6 37#include "AliLog.h"
7382279b 38
39ClassImp(AliFlowEvent)
40
41//-----------------------------------------------------------------------
42
43AliFlowEvent::AliFlowEvent():
44 AliFlowEventSimple()
45{
46 //ctor
47 cout << "AliFlowEvent: Default constructor to be used only by root for io" << endl;
48}
49
50//-----------------------------------------------------------------------
51
52AliFlowEvent::AliFlowEvent(const AliFlowEvent& event):
53 AliFlowEventSimple(event)
54{
55 //cpy ctor
56}
57
58//-----------------------------------------------------------------------
59
60AliFlowEvent& AliFlowEvent::operator=(const AliFlowEvent& event)
61{
62 //assignment operator
63 AliFlowEventSimple::operator=(event);
64 return *this;
65}
66
67//-----------------------------------------------------------------------
68void AliFlowEvent::SetMCReactionPlaneAngle(const AliMCEvent* mcEvent)
69{
70 //sets the event plane angle from the proper header in the MC
71
72 //COCKTAIL with HIJING
73 if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Cocktail Header")) //returns 0 if matches
74 {
75 AliGenCocktailEventHeader *headerC = dynamic_cast<AliGenCocktailEventHeader *> (mcEvent-> GenEventHeader());
76 if (headerC)
77 {
78 TList *lhd = headerC->GetHeaders();
79 if (lhd)
80 {
81 AliGenHijingEventHeader *hdh = dynamic_cast<AliGenHijingEventHeader *> (lhd->At(0));
82 if (hdh) AliFlowEventSimple::SetMCReactionPlaneAngle( hdh->ReactionPlaneAngle() );
83 }
84 }
85 }
124fb262 86 //GEVSIM
7382279b 87 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"GeVSim header")) //returns 0 if matches
88 {
89 AliGenGeVSimEventHeader* headerG = dynamic_cast<AliGenGeVSimEventHeader*>(mcEvent->GenEventHeader());
90 if (headerG) AliFlowEventSimple::SetMCReactionPlaneAngle( headerG->GetEventPlane() );
91 }
124fb262 92 //HIJING
7382279b 93 else if (!strcmp(mcEvent-> GenEventHeader()->GetName(),"Hijing")) //returns 0 if matches
94 {
95 AliGenHijingEventHeader* headerH = dynamic_cast<AliGenHijingEventHeader*>(mcEvent->GenEventHeader());
96 if (headerH) AliFlowEventSimple::SetMCReactionPlaneAngle( headerH->ReactionPlaneAngle() );
97 }
124fb262 98 //EPOS
7382279b 99 else if (!strcmp(mcEvent->GenEventHeader()->GetName(),"EPOS"))
100 {
101 AliGenEposEventHeader* headerE = dynamic_cast<AliGenEposEventHeader*>(mcEvent->GenEventHeader());
102 if (headerE) AliFlowEventSimple::SetMCReactionPlaneAngle( headerE->ReactionPlaneAngle() );
103 }
104}
105
106//-----------------------------------------------------------------------
107AliFlowEvent::AliFlowEvent( const AliMCEvent* anInput,
108 const AliCFManager* intCFManager,
109 const AliCFManager* diffCFManager):
110 AliFlowEventSimple(20)
111{
112 //Fills the event from the MC kinematic information
113
114 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
115
940a5ed1 116 //loop over tracks
117 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
118 {
119 //get input particle
120 AliMCParticle* pParticle = dynamic_cast<AliMCParticle*>(anInput->GetTrack(itrkN));
121 if (!pParticle) continue;
122
123 //check if pParticle passes the cuts
124 Bool_t rpOK = kTRUE;
125 Bool_t poiOK = kTRUE;
126 if (intCFManager && diffCFManager)
7382279b 127 {
940a5ed1 128 rpOK = intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
129 poiOK = diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pParticle);
130 }
131 if (!(rpOK||poiOK)) continue;
7382279b 132
940a5ed1 133 //TODO maybe make a class AliFlowTrack with a constructor from AliVParticle
134 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
135 pTrack->SetEta(pParticle->Eta());
136 pTrack->SetPhi(pParticle->Phi());
137 pTrack->SetPt(pParticle->Pt());
7382279b 138
940a5ed1 139 if (rpOK && intCFManager)
140 {
141 pTrack->SetForRPSelection(kTRUE);
142 fEventNSelTracksRP++;
143 }
144 if (poiOK && diffCFManager)
145 {
146 pTrack->SetForPOISelection(kTRUE);
147 }
7382279b 148
940a5ed1 149 AddTrack(pTrack) ;
150 }//for all tracks
7382279b 151 SetMCReactionPlaneAngle(anInput);
152}
153
154//-----------------------------------------------------------------------
155AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
156 const AliCFManager* intCFManager,
157 const AliCFManager* diffCFManager ):
158 AliFlowEventSimple(20)
159{
160 //Fills the event from the ESD
161
162 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
163
164 //loop over tracks
165 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
166 {
167 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
168
169 //check if pParticle passes the cuts
170 Bool_t rpOK = kTRUE;
171 Bool_t poiOK = kTRUE;
172 if (intCFManager && diffCFManager)
173 {
174 rpOK = ( intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
175 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
176 poiOK = ( diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
177 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
178 }
179 if (!(rpOK || poiOK)) continue;
180
181 //make new AliFLowTrackSimple
182 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
183 pTrack->SetPt(pParticle->Pt() );
184 pTrack->SetEta(pParticle->Eta() );
185 pTrack->SetPhi(pParticle->Phi() );
186
187 //marking the particles used for int. flow:
124fb262 188 if(rpOK && intCFManager)
7382279b 189 {
190 pTrack->SetForRPSelection(kTRUE);
191 fEventNSelTracksRP++;
192 }
193 //marking the particles used for diff. flow:
124fb262 194 if(poiOK && diffCFManager)
7382279b 195 {
196 pTrack->SetForPOISelection(kTRUE);
197 }
198
199 AddTrack(pTrack);
200 }//end of while (itrkN < iNumberOfInputTracks)
201}
202
203//-----------------------------------------------------------------------
204AliFlowEvent::AliFlowEvent( const AliAODEvent* anInput,
205 const AliCFManager* intCFManager,
206 const AliCFManager* diffCFManager):
207 AliFlowEventSimple(20)
208{
209 //Fills the event from the AOD
210 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
211
940a5ed1 212 //loop over tracks
7382279b 213 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
940a5ed1 214 {
215 AliAODTrack* pParticle = anInput->GetTrack(itrkN); //get input particle
7382279b 216
940a5ed1 217 //check if pParticle passes the cuts
218 Bool_t rpOK = kTRUE;
219 Bool_t poiOK = kTRUE;
220 if (intCFManager && diffCFManager)
221 {
222 rpOK = ( intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
223 intCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
224 poiOK = ( diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle) &&
225 diffCFManager->CheckParticleCuts(AliCFManager::kPartSelCuts,pParticle));
226 }
227 if (!(rpOK || poiOK)) continue;
7382279b 228
940a5ed1 229 //make new AliFlowTrackSimple
230 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
231 pTrack->SetPt(pParticle->Pt() );
232 pTrack->SetEta(pParticle->Eta() );
233 pTrack->SetPhi(pParticle->Phi() );
7382279b 234
940a5ed1 235 if (rpOK && intCFManager)
236 {
237 pTrack->SetForRPSelection(kTRUE);
238 fEventNSelTracksRP++;
7382279b 239 }
940a5ed1 240 if (poiOK && diffCFManager)
241 {
242 pTrack->SetForPOISelection(kTRUE);
243 }
244 AddTrack(pTrack);
245 }
7382279b 246
247 // if (iSelParticlesRP >= fMinMult && iSelParticlesRP <= fMaxMult)
248 // {
249 // if ( (++fCount % 100) == 0)
250 // {
251 // if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
252 // else cout<<" MC Reaction Plane Angle = unknown "<< endl;
253 // cout<<" iGoodTracks = "<<iGoodTracks<<endl;
254 // cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
255 // cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
256 // cout << "# " << fCount << " events processed" << endl;
257 // }
258 // return pEvent;
259 // }
260 // else
261 // {
262 // cout<<"Not enough tracks in the FlowEventSimple"<<endl;
263 // return 0;
264 // }
265 //}
266 //else
267 //{
268 // cout<<"Event does not pass multiplicity cuts"<<endl;
269 // return 0;
270 //}
271
272}
273
274//-----------------------------------------------------------------------
275AliFlowEvent::AliFlowEvent( const AliESDEvent* anInput,
276 const AliMCEvent* anInputMc,
124fb262 277 KineSource anOption,
7382279b 278 const AliCFManager* intCFManager,
279 const AliCFManager* diffCFManager ):
280 AliFlowEventSimple(20)
281{
282 //fills the event with tracks from the ESD and kinematics from the MC info via the track label
124fb262 283 if (anOption==kNoKine)
7382279b 284 {
77111ee6 285 AliFatal("WRONG OPTION IN AliFlowEventMaker::FillTracks(AliESDEvent* anInput, AliMCEvent* anInputMc, KineSource anOption)");
7382279b 286 exit(1);
287 }
288
289 Int_t iNumberOfInputTracks = anInput->GetNumberOfTracks() ;
290
291 Int_t iNumberOfInputTracksMC = anInputMc->GetNumberOfTracks() ;
292 if (iNumberOfInputTracksMC==-1)
293 {
77111ee6 294 AliError("Skipping Event -- No MC information available for this event");
7382279b 295 return;
296 }
297
298 //loop over ESD tracks
299 for (Int_t itrkN=0; itrkN<iNumberOfInputTracks; itrkN++)
940a5ed1 300 {
301 AliESDtrack* pParticle = anInput->GetTrack(itrkN); //get input particle
302 //get Label
303 Int_t iLabel = pParticle->GetLabel();
304 //match to mc particle
305 AliMCParticle* pMcParticle = (AliMCParticle*) anInputMc->GetTrack(TMath::Abs(iLabel));
306
307 //check
77111ee6 308 if (TMath::Abs(pParticle->GetLabel())!=pMcParticle->Label())
309 AliWarning(Form("pParticle->GetLabel()!=pMcParticle->Label(), %i, %i", pParticle->GetLabel(), pMcParticle->Label()));
940a5ed1 310
311 //check if pParticle passes the cuts
312 Bool_t rpOK = kTRUE;
313 Bool_t poiOK = kTRUE;
314 if (intCFManager && diffCFManager)
7382279b 315 {
124fb262 316 if(anOption == kESDkine)
7382279b 317 {
7382279b 318 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts1") &&
319 intCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
320 rpOK=kTRUE;
321 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle,"mcGenCuts2") &&
322 diffCFManager->CheckParticleCuts(AliCFManager::kPartRecCuts,pParticle))
323 poiOK=kTRUE;
324 }
124fb262 325 else if (anOption == kMCkine)
7382279b 326 {
7382279b 327 if (intCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
328 rpOK=kTRUE;
329 if (diffCFManager->CheckParticleCuts(AliCFManager::kPartGenCuts,pMcParticle))
330 poiOK=kTRUE;
331 }
940a5ed1 332 }
7382279b 333
940a5ed1 334 if (!(rpOK || poiOK)) continue;
7382279b 335
940a5ed1 336 //make new AliFlowTrackSimple
337 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
338 if(anOption == kESDkine) //take the PID from the MC & the kinematics from the ESD
339 {
340 pTrack->SetPt(pParticle->Pt() );
341 pTrack->SetEta(pParticle->Eta() );
342 pTrack->SetPhi(pParticle->Phi() );
343 }
344 else if (anOption == kMCkine) //take the PID and kinematics from the MC
345 {
346 pTrack->SetPt(pMcParticle->Pt() );
347 pTrack->SetEta(pMcParticle->Eta() );
348 pTrack->SetPhi(pMcParticle->Phi() );
349 }
7382279b 350
940a5ed1 351 if (rpOK && intCFManager)
352 {
353 fEventNSelTracksRP++;
354 pTrack->SetForRPSelection();
7382279b 355 }
940a5ed1 356 if (poiOK && diffCFManager) pTrack->SetForPOISelection();
357
358 AddTrack(pTrack);
359 }
360 SetMCReactionPlaneAngle(anInputMc);
7382279b 361}
362