]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx
a few mods how to do the randome numbers
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowCommon / AliFlowEventSimpleMakerOnTheFly.cxx
CommitLineData
93ff27bd 1/*************************************************************************
2* Copyright(c) 1998-2008, 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 * create an event and perform *
18 * flow analysis 'on the fly' *
19 * *
20 * authors: Raimond Snellings *
21 * (snelling@nikhef.nl) *
22 * Ante Bilandzic *
23 * (anteb@nikhef.nl) *
24 *********************************/
25
26#include "Riostream.h"
27#include "TMath.h"
28#include "TF1.h"
29#include "TRandom3.h"
30
31#include "AliFlowEventSimpleMakerOnTheFly.h"
32#include "AliFlowEventSimple.h"
33#include "AliFlowTrackSimple.h"
34
35ClassImp(AliFlowEventSimpleMakerOnTheFly)
36
37
38//========================================================================
39
40
5b8dccde 41AliFlowEventSimpleMakerOnTheFly::AliFlowEventSimpleMakerOnTheFly(UInt_t iseed):
42 fMultiplicityOfRP(0),
43 fMultiplicitySpreadOfRP(0.),
44 fPtFormula(NULL),
45 fPhiFormula(NULL),
46 fMyTRandom3(NULL),
47 fCount(0)
93ff27bd 48 {
49 // constructor
5b8dccde 50 fMyTRandom3 = new TRandom3(iseed);
93ff27bd 51 }
52
53
54//========================================================================
55
56
57AliFlowEventSimpleMakerOnTheFly::~AliFlowEventSimpleMakerOnTheFly()
58{
59 // destructor
60 if (fPtFormula) delete fPtFormula;
61 if (fPhiFormula) delete fPhiFormula;
5b8dccde 62 if (fMyTRandom3) delete fMyTRandom3;
93ff27bd 63}
64
65
66//========================================================================
67
68
69AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly()
70{
71 // method to create event on the fly
72
73 AliFlowEventSimple* pEvent = new AliFlowEventSimple(fMultiplicityOfRP);
74
5b8dccde 75 //reaction plane
76 Double_t fMCReactionPlaneAngle = fMyTRandom3->Uniform(0.,TMath::TwoPi());
93ff27bd 77
78 // pt:
79 Double_t dPtMin = 0.; // to be improved
80 Double_t dPtMax = 10.; // to be improved
81
82 fPtFormula = new TF1("PtFormula","[0]*x*TMath::Exp(-x*x)",dPtMin,dPtMax);
83
84 fPtFormula->SetParName(0,"Multiplicity of RPs");
85 fPtFormula->SetParameter(0,fMultiplicityOfRP);
86
87
88 // phi:
89 Double_t dPhiMin = 0.; // to be improved
90 Double_t dPhiMax = TMath::TwoPi(); // to be improved
91
92 fPhiFormula = new TF1("phiDistribution","(1)*(1+2.*[0]*TMath::Cos(2*x))",dPhiMin,dPhiMax);
93
94 Double_t dV2 = 0.044; // to be improved
95
96 fPhiFormula->SetParName(0,"elliptic flow");
97 fPhiFormula->SetParameter(0,dV2);
98
99
100 // eta:
101 Double_t dEtaMin = -1.; // to be improved
102 Double_t dEtaMax = 1.; // to be improved
93ff27bd 103
93ff27bd 104
105 Int_t iGoodTracks = 0;
106 Int_t iSelParticlesRP = 0;
107 Int_t iSelParticlesPOI = 0;
108 for(Int_t i=0;i<fMultiplicityOfRP;i++) {
109 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
110 pTrack->SetPt(fPtFormula->GetRandom());
5b8dccde 111 pTrack->SetEta(fMyTRandom3->Uniform(dEtaMin,dEtaMax));
112 pTrack->SetPhi(fPhiFormula->GetRandom()+fMCReactionPlaneAngle);
93ff27bd 113 pTrack->SetForRPSelection(kTRUE);
114 iSelParticlesRP++;
115 pTrack->SetForPOISelection(kTRUE);
116 iSelParticlesPOI++;
117
118 pEvent->TrackCollection()->Add(pTrack);
119 iGoodTracks++;
120 }
121
122 pEvent->SetEventNSelTracksRP(iSelParticlesRP);
123 pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for RP or for POI selection
124 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
125
5b8dccde 126 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
127 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
128
129 cout<<" iGoodTracks = "<< iGoodTracks << endl;
130 cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl;
131 cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;
132 cout << "# " << ++fCount << " events processed" << endl;
93ff27bd 133
134 return pEvent;
135
136} // end of CreateEventOnTheFly()
137
138
139