]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommon/AliFlowEventSimple.cxx
Forgotten commit - removing obsolete class
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFlowEventSimple.cxx
CommitLineData
f1d945a1 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
929098e4 16/*****************************************************************
17 AliFlowEventSimple: A simple event
18 for flow analysis
19
20 origin: Naomi van der Kolk (kolk@nikhef.nl)
21 Ante Bilandzic (anteb@nikhef.nl)
22 Raimond Snellings (Raimond.Snellings@nikhef.nl)
23 mods: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch)
24*****************************************************************/
25
f1d945a1 26#include "Riostream.h"
27#include "TObjArray.h"
26c4cbb9 28#include "TFile.h"
03a02aca 29#include "TList.h"
929098e4 30#include "TTree.h"
31#include "TParticle.h"
f1d945a1 32#include "TMath.h"
26c4cbb9 33#include "TH1F.h"
34#include "TH1D.h"
bc231a12 35#include "TF1.h"
26c4cbb9 36#include "TProfile.h"
929098e4 37#include "TParameter.h"
c076fda8 38#include "TBrowser.h"
f1d945a1 39#include "AliFlowVector.h"
40#include "AliFlowTrackSimple.h"
929098e4 41#include "AliFlowTrackSimpleCuts.h"
701f71c1 42#include "AliFlowEventSimple.h"
7382279b 43#include "TRandom.h"
f1d945a1 44
f1d945a1 45ClassImp(AliFlowEventSimple)
46
47//-----------------------------------------------------------------------
46bec39c 48AliFlowEventSimple::AliFlowEventSimple():
49 fTrackCollection(NULL),
85d2ee8d 50 fReferenceMultiplicity(0),
46bec39c 51 fNumberOfTracks(0),
bc231a12 52 fNumberOfRPs(0),
7183fe85 53 fMCReactionPlaneAngle(0.),
929098e4 54 fMCReactionPlaneAngleIsSet(kFALSE),
bc231a12 55 fAfterBurnerPrecision(0.001),
9fa64edc 56 fUserModified(kFALSE),
c076fda8 57 fNumberOfTracksWrap(NULL),
bc231a12 58 fNumberOfRPsWrap(NULL),
a12990bb 59 fMCReactionPlaneAngleWrap(NULL)
46bec39c 60{
61 cout << "AliFlowEventSimple: Default constructor to be used only by root for io" << endl;
62}
63
64//-----------------------------------------------------------------------
9fa64edc 65AliFlowEventSimple::AliFlowEventSimple( Int_t n,
66 ConstructionMethod method,
bc231a12 67 TF1* ptDist,
68 Double_t phiMin,
69 Double_t phiMax,
70 Double_t etaMin,
71 Double_t etaMax):
9fa64edc 72 fTrackCollection(new TObjArray(n)),
a1c43d26 73 fReferenceMultiplicity(0),
bc231a12 74 fNumberOfTracks(0),
75 fNumberOfRPs(0),
76 fMCReactionPlaneAngle(0.),
77 fMCReactionPlaneAngleIsSet(kFALSE),
78 fAfterBurnerPrecision(0.001),
9fa64edc 79 fUserModified(kFALSE),
bc231a12 80 fNumberOfTracksWrap(NULL),
81 fNumberOfRPsWrap(NULL),
82 fMCReactionPlaneAngleWrap(NULL)
83{
9fa64edc 84 //ctor
85 // if second argument is set to AliFlowEventSimple::kGenerate
86 // it generates n random tracks with given Pt distribution
87 // (a sane default is provided), phi and eta are uniform
88
89 if (method==kGenerate)
90 Generate(n,ptDist,phiMin,phiMax,etaMin,etaMax);
f1d945a1 91}
92
93//-----------------------------------------------------------------------
e35ddff0 94AliFlowEventSimple::AliFlowEventSimple(const AliFlowEventSimple& anEvent):
bc231a12 95 TObject(anEvent),
96 fTrackCollection((TObjArray*)(anEvent.fTrackCollection)->Clone()),
85d2ee8d 97 fReferenceMultiplicity(anEvent.fReferenceMultiplicity),
e35ddff0 98 fNumberOfTracks(anEvent.fNumberOfTracks),
bc231a12 99 fNumberOfRPs(anEvent.fNumberOfRPs),
a12990bb 100 fMCReactionPlaneAngle(anEvent.fMCReactionPlaneAngle),
929098e4 101 fMCReactionPlaneAngleIsSet(anEvent.fMCReactionPlaneAngleIsSet),
bc231a12 102 fAfterBurnerPrecision(anEvent.fAfterBurnerPrecision),
9fa64edc 103 fUserModified(anEvent.fUserModified),
c076fda8 104 fNumberOfTracksWrap(anEvent.fNumberOfTracksWrap),
bc231a12 105 fNumberOfRPsWrap(anEvent.fNumberOfRPsWrap),
a12990bb 106 fMCReactionPlaneAngleWrap(anEvent.fMCReactionPlaneAngleWrap)
f1d945a1 107{
929098e4 108 //copy constructor
f1d945a1 109}
110
111//-----------------------------------------------------------------------
e35ddff0 112AliFlowEventSimple& AliFlowEventSimple::operator=(const AliFlowEventSimple& anEvent)
f1d945a1 113{
124fb262 114 //assignment operator
701f71c1 115 if (fTrackCollection) fTrackCollection->Delete();
124fb262 116 delete fTrackCollection;
bc231a12 117 fTrackCollection = (TObjArray*)(anEvent.fTrackCollection)->Clone(); //deep copy
85d2ee8d 118 fReferenceMultiplicity = anEvent.fReferenceMultiplicity;
e35ddff0 119 fNumberOfTracks = anEvent.fNumberOfTracks;
bc231a12 120 fNumberOfRPs = anEvent.fNumberOfRPs;
a12990bb 121 fMCReactionPlaneAngle = anEvent.fMCReactionPlaneAngle;
929098e4 122 fMCReactionPlaneAngleIsSet = anEvent.fMCReactionPlaneAngleIsSet;
bc231a12 123 fAfterBurnerPrecision = anEvent.fAfterBurnerPrecision;
9fa64edc 124 fUserModified=anEvent.fUserModified;
929098e4 125 fNumberOfTracksWrap = anEvent.fNumberOfTracksWrap;
bc231a12 126 fNumberOfRPsWrap = anEvent.fNumberOfRPsWrap;
a12990bb 127 fMCReactionPlaneAngleWrap=anEvent.fMCReactionPlaneAngleWrap;
f1d945a1 128 return *this;
f1d945a1 129}
130
929098e4 131//-----------------------------------------------------------------------
f1d945a1 132AliFlowEventSimple::~AliFlowEventSimple()
133{
134 //destructor
929098e4 135 if (fTrackCollection) fTrackCollection->Delete();
136 delete fTrackCollection;
c076fda8 137 if (fNumberOfTracksWrap) delete fNumberOfTracksWrap;
bc231a12 138 if (fNumberOfRPsWrap) delete fNumberOfRPsWrap;
a12990bb 139 if (fMCReactionPlaneAngleWrap) delete fMCReactionPlaneAngleWrap;
f1d945a1 140}
141
bc231a12 142//-----------------------------------------------------------------------
143void AliFlowEventSimple::Generate(Int_t nParticles,
6e027e29 144 TF1* ptDist,
145 Double_t phiMin,
146 Double_t phiMax,
147 Double_t etaMin,
148 Double_t etaMax)
bc231a12 149{
150 //generate nParticles random tracks uniform in phi and eta
151 //according to the specified pt distribution
6e027e29 152 if (!ptDist)
153 {
154 static TF1 ptdistribution("ptSpectra","x*TMath::Exp(-pow(0.13957*0.13957+x*x,0.5)/0.4)",0.1,10.);
155 ptDist=&ptdistribution;
156 }
9fa64edc 157
bc231a12 158 for (Int_t i=0; i<nParticles; i++)
159 {
701f71c1 160 AliFlowTrackSimple* track = new AliFlowTrackSimple();
161 track->SetPhi( gRandom->Uniform(phiMin,phiMax) );
162 track->SetEta( gRandom->Uniform(etaMin,etaMax) );
163 track->SetPt( ptDist->GetRandom() );
164 track->SetCharge( (gRandom->Uniform()-0.5<0)?-1:1 );
165 AddTrack(track);
bc231a12 166 }
6e027e29 167 fMCReactionPlaneAngle=gRandom->Uniform(0.0,TMath::TwoPi());
9fa64edc 168 fMCReactionPlaneAngleIsSet=kTRUE;
169 SetUserModified();
bc231a12 170}
171
929098e4 172//-----------------------------------------------------------------------
f1d945a1 173AliFlowTrackSimple* AliFlowEventSimple::GetTrack(Int_t i)
174{
175 //get track i from collection
7382279b 176 if (i>=fNumberOfTracks) return NULL;
124fb262 177 AliFlowTrackSimple* pTrack = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i)) ;
e35ddff0 178 return pTrack;
f1d945a1 179}
180
7382279b 181//-----------------------------------------------------------------------
182void AliFlowEventSimple::AddTrack( AliFlowTrackSimple* track )
183{
184 //add a track
7382279b 185 fTrackCollection->AddLast(track);
186 fNumberOfTracks++;
187}
188
929098e4 189//-----------------------------------------------------------------------
190AliFlowVector AliFlowEventSimple::GetQ(Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
f1d945a1 191{
929098e4 192 // calculate Q-vector in harmonic n without weights (default harmonic n=2)
e35ddff0 193 Double_t dQX = 0.;
194 Double_t dQY = 0.;
195 AliFlowVector vQ;
196 vQ.Set(0.,0.);
929098e4 197
9825d4a9 198 Int_t iOrder = n;
ae733b3b 199 Double_t iUsedTracks = 0;
44e060e0 200 Double_t dPhi = 0.;
201 Double_t dPt = 0.;
202 Double_t dEta = 0.;
203 Double_t dWeight = 1.;
929098e4 204
26c4cbb9 205 AliFlowTrackSimple* pTrack = NULL;
929098e4 206
44e060e0 207 Int_t nBinsPhi = 0;
208 Double_t dBinWidthPt = 0.;
209 Double_t dPtMin = 0.;
210 Double_t dBinWidthEta = 0.;
211 Double_t dEtaMin = 0.;
929098e4 212
44e060e0 213 Double_t wPhi = 1.; // weight Phi
214 Double_t wPt = 1.; // weight Pt
215 Double_t wEta = 1.; // weight Eta
929098e4 216
03a02aca 217 TH1F *phiWeights = NULL;
ae733b3b 218 TH1D *ptWeights = NULL;
03a02aca 219 TH1D *etaWeights = NULL;
929098e4 220
03a02aca 221 if(weightsList)
26c4cbb9 222 {
929098e4 223 if(usePhiWeights)
224 {
225 phiWeights = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights"));
226 if(phiWeights) nBinsPhi = phiWeights->GetNbinsX();
227 }
228 if(usePtWeights)
03a02aca 229 {
929098e4 230 ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
231 if(ptWeights)
232 {
233 dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
234 dPtMin = (ptWeights->GetXaxis())->GetXmin();
235 }
236 }
237 if(useEtaWeights)
03a02aca 238 {
929098e4 239 etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
240 if(etaWeights)
241 {
242 dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
243 dEtaMin = (etaWeights->GetXaxis())->GetXmin();
244 }
245 }
03a02aca 246 } // end of if(weightsList)
929098e4 247
248 // loop over tracks
249 for(Int_t i=0; i<fNumberOfTracks; i++)
26c4cbb9 250 {
124fb262 251 pTrack = (AliFlowTrackSimple*)fTrackCollection->At(i);
929098e4 252 if(pTrack)
f1d945a1 253 {
929098e4 254 if(pTrack->InRPSelection())
255 {
256 dPhi = pTrack->Phi();
257 dPt = pTrack->Pt();
258 dEta = pTrack->Eta();
701f71c1 259 dWeight = pTrack->Weight();
929098e4 260
261 // determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
262 if(phiWeights && nBinsPhi)
263 {
264 wPhi = phiWeights->GetBinContent(1+(Int_t)(TMath::Floor(dPhi*nBinsPhi/TMath::TwoPi())));
265 }
266 // determine v'(pt) weight:
267 if(ptWeights && dBinWidthPt)
268 {
269 wPt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
270 }
271 // determine v'(eta) weight:
272 if(etaWeights && dBinWidthEta)
273 {
274 wEta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
275 }
276
277 // building up the weighted Q-vector:
44e060e0 278 dQX += dWeight*wPhi*wPt*wEta*TMath::Cos(iOrder*dPhi);
279 dQY += dWeight*wPhi*wPt*wEta*TMath::Sin(iOrder*dPhi);
929098e4 280
281 // weighted multiplicity:
44e060e0 282 iUsedTracks += dWeight*wPhi*wPt*wEta;
929098e4 283
284 } // end of if (pTrack->InRPSelection())
285 } // end of if (pTrack)
286 else
287 {
288 cerr << "no particle!!!"<<endl;
289 }
ae733b3b 290 } // loop over particles
929098e4 291
e35ddff0 292 vQ.Set(dQX,dQY);
293 vQ.SetMult(iUsedTracks);
929098e4 294
e35ddff0 295 return vQ;
929098e4 296
5fef318d 297}
298
929098e4 299//-----------------------------------------------------------------------
300void AliFlowEventSimple::Get2Qsub(AliFlowVector* Qarray, Int_t n, TList *weightsList, Bool_t usePhiWeights, Bool_t usePtWeights, Bool_t useEtaWeights)
395fadba 301{
929098e4 302
303 // calculate Q-vector in harmonic n without weights (default harmonic n=2)
395fadba 304 Double_t dQX = 0.;
305 Double_t dQY = 0.;
929098e4 306
395fadba 307 Int_t iOrder = n;
308 Double_t iUsedTracks = 0;
309 Double_t dPhi = 0.;
310 Double_t dPt = 0.;
311 Double_t dEta = 0.;
44e060e0 312 Double_t dWeight = 1.;
929098e4 313
395fadba 314 AliFlowTrackSimple* pTrack = NULL;
929098e4 315
44e060e0 316 Int_t iNbinsPhiSub0 = 0;
317 Int_t iNbinsPhiSub1 = 0;
395fadba 318 Double_t dBinWidthPt = 0.;
319 Double_t dPtMin = 0.;
320 Double_t dBinWidthEta= 0.;
321 Double_t dEtaMin = 0.;
929098e4 322
323 Double_t dWphi = 1.; // weight Phi
324 Double_t dWpt = 1.; // weight Pt
325 Double_t dWeta = 1.; // weight Eta
326
44e060e0 327 TH1F* phiWeightsSub0 = NULL;
328 TH1F* phiWeightsSub1 = NULL;
29195b69 329 TH1D* ptWeights = NULL;
330 TH1D* etaWeights = NULL;
929098e4 331
332 if(weightsList)
333 {
334 if(usePhiWeights)
335 {
44e060e0 336 phiWeightsSub0 = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights_sub0"));
44e060e0 337 if(phiWeightsSub0) {
13ff9ccd 338 iNbinsPhiSub0 = phiWeightsSub0->GetNbinsX();
44e060e0 339 }
13ff9ccd 340 phiWeightsSub1 = dynamic_cast<TH1F *>(weightsList->FindObject("phi_weights_sub1"));
44e060e0 341 if(phiWeightsSub1) {
13ff9ccd 342 iNbinsPhiSub1 = phiWeightsSub1->GetNbinsX();
29195b69 343 }
929098e4 344 }
345 if(usePtWeights)
346 {
29195b69 347 ptWeights = dynamic_cast<TH1D *>(weightsList->FindObject("pt_weights"));
929098e4 348 if(ptWeights)
349 {
350 dBinWidthPt = ptWeights->GetBinWidth(1); // assuming that all bins have the same width
351 dPtMin = (ptWeights->GetXaxis())->GetXmin();
352 }
353 }
354 if(useEtaWeights)
355 {
356 etaWeights = dynamic_cast<TH1D *>(weightsList->FindObject("eta_weights"));
357 if(etaWeights)
358 {
359 dBinWidthEta = etaWeights->GetBinWidth(1); // assuming that all bins have the same width
360 dEtaMin = (etaWeights->GetXaxis())->GetXmin();
361 }
362 }
395fadba 363 } // end of if(weightsList)
929098e4 364
b125a454 365 //loop over the two subevents
929098e4 366 for (Int_t s=0; s<2; s++)
367 {
368 // loop over tracks
369 for(Int_t i=0; i<fNumberOfTracks; i++)
370 {
124fb262 371 pTrack = (AliFlowTrackSimple*)fTrackCollection->At(i);
929098e4 372 if(pTrack)
373 {
374 if(pTrack->InRPSelection())
375 {
376 if (pTrack->InSubevent(s))
377 {
44e060e0 378 dPhi = pTrack->Phi();
379 dPt = pTrack->Pt();
380 dEta = pTrack->Eta();
381 dWeight = pTrack->Weight();
929098e4 382
383 // determine Phi weight: (to be improved, I should here only access it + the treatment of gaps in the if statement)
13ff9ccd 384 //subevent 0
385 if(s == 0) {
386 if(phiWeightsSub0 && iNbinsPhiSub0) {
387 Int_t phiBin = 1+(Int_t)(TMath::Floor(dPhi*iNbinsPhiSub0/TMath::TwoPi()));
388 //use the phi value at the center of the bin
389 dPhi = phiWeightsSub0->GetBinCenter(phiBin);
390 dWphi = phiWeightsSub0->GetBinContent(phiBin);
391 }
392 }
393 //subevent 1
394 else if (s == 1) {
395 if(phiWeightsSub1 && iNbinsPhiSub1) {
396 Int_t phiBin = 1+(Int_t)(TMath::Floor(dPhi*iNbinsPhiSub1/TMath::TwoPi()));
397 //use the phi value at the center of the bin
398 dPhi = phiWeightsSub1->GetBinCenter(phiBin);
399 dWphi = phiWeightsSub1->GetBinContent(phiBin);
44e060e0 400 }
401 }
13ff9ccd 402
929098e4 403 // determine v'(pt) weight:
404 if(ptWeights && dBinWidthPt)
405 {
406 dWpt=ptWeights->GetBinContent(1+(Int_t)(TMath::Floor((dPt-dPtMin)/dBinWidthPt)));
407 }
44e060e0 408
929098e4 409 // determine v'(eta) weight:
410 if(etaWeights && dBinWidthEta)
411 {
412 dWeta=etaWeights->GetBinContent(1+(Int_t)(TMath::Floor((dEta-dEtaMin)/dBinWidthEta)));
413 }
414
415 // building up the weighted Q-vector:
44e060e0 416 dQX += dWeight*dWphi*dWpt*dWeta*TMath::Cos(iOrder*dPhi);
417 dQY += dWeight*dWphi*dWpt*dWeta*TMath::Sin(iOrder*dPhi);
929098e4 418
419 // weighted multiplicity:
44e060e0 420 iUsedTracks+=dWeight*dWphi*dWpt*dWeta;
929098e4 421
422 } // end of subevent
423 } // end of if (pTrack->InRPSelection())
29195b69 424 } // end of if (pTrack)
929098e4 425 else
426 {
427 cerr << "no particle!!!"<<endl;
428 }
29195b69 429 } // loop over particles
430 Qarray[s].Set(dQX,dQY);
431 Qarray[s].SetMult(iUsedTracks);
432 //reset
433 iUsedTracks = 0;
434 dQX = 0.;
435 dQY = 0.;
436 }
929098e4 437
395fadba 438}
439
440
929098e4 441//-----------------------------------------------------------------------
c076fda8 442void AliFlowEventSimple::Print(Option_t *option) const
443{
444 // -*-*-*-*-*Print some global quantities for this histogram collection class *-*-*-*-*-*-*-*
445 // ===============================================
446 // printf( "TH1.Print Name = %s, Entries= %d, Total sum= %g\n",GetName(),Int_t(fEntries),GetSumOfWeights());
f873707d 447 printf( "Class.Print Name = %s, #tracks= %d, Number of RPs= %d, MC EventPlaneAngle= %f\n",
bc231a12 448 GetName(),fNumberOfTracks, fNumberOfRPs, fMCReactionPlaneAngle );
c076fda8 449
b4dba88d 450 TString optionstr(option);
451 if (!optionstr.Contains("all")) return;
929098e4 452 if (fTrackCollection)
453 {
c076fda8 454 fTrackCollection->Print(option);
455 }
929098e4 456 else
457 {
c076fda8 458 printf( "Empty track collection \n");
459 }
460}
461
929098e4 462//-----------------------------------------------------------------------
463void AliFlowEventSimple::Browse(TBrowser *b)
c076fda8 464{
465 if (!b) return;
929098e4 466 if (!fNumberOfTracksWrap)
467 {
c076fda8 468 fNumberOfTracksWrap = new TParameter<int>("fNumberOfTracks", fNumberOfTracks);
469 b->Add(fNumberOfTracksWrap);
470 }
bc231a12 471 if (!fNumberOfRPsWrap)
929098e4 472 {
bc231a12 473 fNumberOfRPsWrap = new TParameter<int>("fNumberOfRPs", fNumberOfRPs);
474 b->Add(fNumberOfRPsWrap);
c076fda8 475 }
929098e4 476 if (!fMCReactionPlaneAngleWrap)
477 {
7183fe85 478 fMCReactionPlaneAngleWrap = new TParameter<double>(" fMCReactionPlaneAngle", fMCReactionPlaneAngle);
a12990bb 479 b->Add( fMCReactionPlaneAngleWrap);
480 }
c076fda8 481 if (fTrackCollection) b->Add(fTrackCollection,"AliFlowTracksSimple");
482}
483
929098e4 484//-----------------------------------------------------------------------
485AliFlowEventSimple::AliFlowEventSimple( TTree* inputTree,
486 const AliFlowTrackSimpleCuts* rpCuts,
487 const AliFlowTrackSimpleCuts* poiCuts):
488 fTrackCollection(NULL),
85d2ee8d 489 fReferenceMultiplicity(0),
929098e4 490 fNumberOfTracks(0),
bc231a12 491 fNumberOfRPs(0),
929098e4 492 fMCReactionPlaneAngle(0.),
493 fMCReactionPlaneAngleIsSet(kFALSE),
bc231a12 494 fAfterBurnerPrecision(0.001),
9fa64edc 495 fUserModified(kFALSE),
929098e4 496 fNumberOfTracksWrap(NULL),
bc231a12 497 fNumberOfRPsWrap(NULL),
929098e4 498 fMCReactionPlaneAngleWrap(NULL)
499{
500 //constructor, fills the event from a TTree of kinematic.root files
501 //applies RP and POI cuts, tags the tracks
502
503 Int_t numberOfInputTracks = inputTree->GetEntries() ;
504 fTrackCollection = new TObjArray(numberOfInputTracks/2);
505
506 TParticle* pParticle = new TParticle();
507 inputTree->SetBranchAddress("Particles",&pParticle);
508
509 Int_t iSelParticlesPOI = 0;
510
511 for (Int_t i=0; i<numberOfInputTracks; i++)
512 {
513 inputTree->GetEntry(i); //get input particle
514
515 if (!pParticle) continue; //no particle
516 if (!pParticle->IsPrimary()) continue;
517
7382279b 518 Bool_t rpOK = rpCuts->PassesCuts(pParticle);
519 Bool_t poiOK = poiCuts->PassesCuts(pParticle);
929098e4 520
7382279b 521 if (rpOK || poiOK)
929098e4 522 {
523 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple(pParticle);
524
525 //marking the particles used for int. flow:
7382279b 526 if(rpOK)
929098e4 527 {
528 pTrack->SetForRPSelection(kTRUE);
bc231a12 529 fNumberOfRPs++;
929098e4 530 }
531 //marking the particles used for diff. flow:
7382279b 532 if(poiOK)
929098e4 533 {
534 pTrack->SetForPOISelection(kTRUE);
535 iSelParticlesPOI++;
536 }
537 //adding a particles which were used either for int. or diff. flow to the list
124fb262 538 AddTrack(pTrack);
929098e4 539 }
540 }//for i
541 delete pParticle;
542}
543
544//_____________________________________________________________________________
545void AliFlowEventSimple::CloneTracks(Int_t n)
546{
547 //clone every track n times to add non-flow
34b15925 548 if (n<=0) return; //no use to clone stuff zero or less times
bc231a12 549 Int_t ntracks = fNumberOfTracks;
550 fTrackCollection->Expand((n+1)*fNumberOfTracks);
551 for (Int_t i=0; i<n; i++)
929098e4 552 {
bc231a12 553 for (Int_t itrack=0; itrack<ntracks; itrack++)
929098e4 554 {
555 AliFlowTrackSimple* track = dynamic_cast<AliFlowTrackSimple*>(fTrackCollection->At(itrack));
556 if (!track) continue;
bc231a12 557 AddTrack(static_cast<AliFlowTrackSimple*>(track->Clone()));
929098e4 558 }
559 }
9fa64edc 560 SetUserModified();
929098e4 561}
7382279b 562
563//_____________________________________________________________________________
564void AliFlowEventSimple::ResolutionPt(Double_t res)
565{
566 //smear pt of all tracks by gaussian with sigma=res
567 for (Int_t i=0; i<fNumberOfTracks; i++)
568 {
569 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
124fb262 570 if (track) track->ResolutionPt(res);
7382279b 571 }
9fa64edc 572 SetUserModified();
7382279b 573}
124fb262 574
575//_____________________________________________________________________________
34b15925 576void AliFlowEventSimple::TagSubeventsInEta( Double_t etaMinA,
577 Double_t etaMaxA,
578 Double_t etaMinB,
579 Double_t etaMaxB )
124fb262 580{
581 //Flag two subevents in given eta ranges
582 for (Int_t i=0; i<fNumberOfTracks; i++)
583 {
584 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
3ca4688a 585 if (!track) continue;
586 track->ResetSubEventTags();
124fb262 587 Double_t eta=track->Eta();
588 if (eta >= etaMinA && eta <= etaMaxA) track->SetForSubevent(0);
589 if (eta >= etaMinB && eta <= etaMaxB) track->SetForSubevent(1);
590 }
591}
592
076df7bf 593//_____________________________________________________________________________
594void AliFlowEventSimple::TagSubeventsByCharge()
595{
596 //Flag two subevents in given eta ranges
597 for (Int_t i=0; i<fNumberOfTracks; i++)
598 {
599 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
3ca4688a 600 if (!track) continue;
601 track->ResetSubEventTags();
076df7bf 602 Int_t charge=track->Charge();
603 if (charge<0) track->SetForSubevent(0);
604 if (charge>0) track->SetForSubevent(1);
605 }
606}
607
bc231a12 608//_____________________________________________________________________________
34b15925 609void AliFlowEventSimple::AddV1( Double_t v1 )
bc231a12 610{
611 //add v2 to all tracks wrt the reaction plane angle
612 for (Int_t i=0; i<fNumberOfTracks; i++)
613 {
614 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
615 if (track) track->AddV1(v1, fMCReactionPlaneAngle, fAfterBurnerPrecision);
616 }
9fa64edc 617 SetUserModified();
bc231a12 618}
619
124fb262 620//_____________________________________________________________________________
34b15925 621void AliFlowEventSimple::AddV2( Double_t v2 )
124fb262 622{
244c607a 623 //add v2 to all tracks wrt the reaction plane angle
124fb262 624 for (Int_t i=0; i<fNumberOfTracks; i++)
625 {
626 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
bc231a12 627 if (track) track->AddV2(v2, fMCReactionPlaneAngle, fAfterBurnerPrecision);
628 }
9fa64edc 629 SetUserModified();
bc231a12 630}
631
632//_____________________________________________________________________________
54089829 633void AliFlowEventSimple::AddV3( Double_t v3 )
634{
635 //add v3 to all tracks wrt the reaction plane angle
636 for (Int_t i=0; i<fNumberOfTracks; i++)
637 {
638 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
639 if (track) track->AddV3(v3, fMCReactionPlaneAngle, fAfterBurnerPrecision);
640 }
641 SetUserModified();
642}
643
644//_____________________________________________________________________________
34b15925 645void AliFlowEventSimple::AddV4( Double_t v4 )
bc231a12 646{
647 //add v4 to all tracks wrt the reaction plane angle
648 for (Int_t i=0; i<fNumberOfTracks; i++)
649 {
650 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
651 if (track) track->AddV4(v4, fMCReactionPlaneAngle, fAfterBurnerPrecision);
652 }
9fa64edc 653 SetUserModified();
bc231a12 654}
655
656//_____________________________________________________________________________
1a80f9f6 657void AliFlowEventSimple::AddV5( Double_t v5 )
658{
659 //add v4 to all tracks wrt the reaction plane angle
660 for (Int_t i=0; i<fNumberOfTracks; i++)
661 {
662 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
663 if (track) track->AddV5(v5, fMCReactionPlaneAngle, fAfterBurnerPrecision);
664 }
665 SetUserModified();
666}
667
668//_____________________________________________________________________________
669void AliFlowEventSimple::AddFlow( Double_t v1, Double_t v2, Double_t v3, Double_t v4, Double_t v5,
670 Double_t rp1, Double_t rp2, Double_t rp3, Double_t rp4, Double_t rp5 )
671{
672 //add flow to all tracks wrt the reaction plane angle, for all harmonic separate angle
673 for (Int_t i=0; i<fNumberOfTracks; i++)
674 {
675 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
676 if (track) track->AddFlow(v1,v2,v3,v4,v5,rp1,rp2,rp3,rp4,rp5,fAfterBurnerPrecision);
677 }
678 SetUserModified();
679}
680
681//_____________________________________________________________________________
682void AliFlowEventSimple::AddFlow( Double_t v1, Double_t v2, Double_t v3, Double_t v4, Double_t v5 )
bc231a12 683{
684 //add flow to all tracks wrt the reaction plane angle
685 for (Int_t i=0; i<fNumberOfTracks; i++)
686 {
687 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
1a80f9f6 688 if (track) track->AddFlow(v1,v2,v3,v4,v5,fMCReactionPlaneAngle, fAfterBurnerPrecision);
124fb262 689 }
9fa64edc 690 SetUserModified();
124fb262 691}
692
99ff691b 693//_____________________________________________________________________________
694void AliFlowEventSimple::AddV2( TF1* ptDepV2 )
695{
696 //add v2 to all tracks wrt the reaction plane angle
697 for (Int_t i=0; i<fNumberOfTracks; i++)
698 {
699 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
2a745a5f 700 if (!track) continue;
99ff691b 701 Double_t v2 = ptDepV2->Eval(track->Pt());
2a745a5f 702 track->AddV2(v2, fMCReactionPlaneAngle, fAfterBurnerPrecision);
99ff691b 703 }
704 SetUserModified();
705}
706
dd91b595 707//_____________________________________________________________________________
34b15925 708void AliFlowEventSimple::TagRP( AliFlowTrackSimpleCuts* cuts )
dd91b595 709{
710 //tag tracks as reference particles (RPs)
711 for (Int_t i=0; i<fNumberOfTracks; i++)
712 {
713 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
714 if (!track) continue;
701f71c1 715 Bool_t pass=cuts->PassesCuts(track);
e0da66a2 716 Bool_t rpTrack=track->InRPSelection();
701f71c1 717 if (pass)
e0da66a2 718 {
719 if (!rpTrack) fNumberOfRPs++; //only increase if not already tagged
720 }
701f71c1 721 else
e0da66a2 722 {
723 if (rpTrack) fNumberOfRPs--; //only decrease if detagging
724 }
725 track->SetForRPSelection(pass);
dd91b595 726 }
727}
728
729//_____________________________________________________________________________
34b15925 730void AliFlowEventSimple::TagPOI( AliFlowTrackSimpleCuts* cuts )
dd91b595 731{
732 //tag tracks as particles of interest (POIs)
733 for (Int_t i=0; i<fNumberOfTracks; i++)
734 {
735 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
736 if (!track) continue;
701f71c1 737 Bool_t pass=cuts->PassesCuts(track);
738 track->SetForPOISelection(pass);
dd91b595 739 }
740}
741
34b15925 742//_____________________________________________________________________________
743void AliFlowEventSimple::DefineDeadZone( Double_t etaMin,
744 Double_t etaMax,
745 Double_t phiMin,
746 Double_t phiMax )
747{
748 //mark tracks in given eta-phi region as dead
749 //by resetting the flow bits
750 for (Int_t i=0; i<fNumberOfTracks; i++)
751 {
752 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
753 Double_t eta = track->Eta();
754 Double_t phi = track->Phi();
755 if (eta>etaMin && eta<etaMax && phi>phiMin && phi<phiMax)
1a43aca9 756 {
757 if (track->InRPSelection()) fNumberOfRPs--;
34b15925 758 track->ResetFlowTags();
1a43aca9 759 }
34b15925 760 }
761}
762
763//_____________________________________________________________________________
764Int_t AliFlowEventSimple::CleanUpDeadTracks()
765{
766 //remove tracks that have no flow tags set and cleanup the container
65ef7d1a 767 //returns number of cleaned tracks
768 Int_t ncleaned=0;
34b15925 769 for (Int_t i=0; i<fNumberOfTracks; i++)
770 {
771 AliFlowTrackSimple* track = static_cast<AliFlowTrackSimple*>(fTrackCollection->At(i));
65ef7d1a 772 if (track->IsDead()) {delete track;ncleaned++;}
34b15925 773 }
774 fTrackCollection->Compress(); //clean up empty slots
65ef7d1a 775 return ncleaned;
34b15925 776}
99ff691b 777
778//_____________________________________________________________________________
779TF1* AliFlowEventSimple::SimplePtDepV2()
780{
781 //return a standard pt dependent v2 formula, user has to clean up!
782 return new TF1("StandardPtDepV2","((x<1.0)*(0.05/1.0)*x+(x>=1.0)*0.05)");
783}
784
785//_____________________________________________________________________________
786TF1* AliFlowEventSimple::SimplePtSpectrum()
787{
788 //return a standard pt spectrum, user has to clean up!
789 return new TF1("StandardPtSpectrum","x*TMath::Exp(-pow(0.13957*0.13957+x*x,0.5)/0.4)",0.1,10.);
790}