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