]>
Commit | Line | Data |
---|---|---|
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 | ||
35 | ClassImp(AliFlowEventSimpleMakerOnTheFly) | |
36 | ||
37 | ||
38 | //======================================================================== | |
39 | ||
40 | ||
5b8dccde | 41 | AliFlowEventSimpleMakerOnTheFly::AliFlowEventSimpleMakerOnTheFly(UInt_t iseed): |
42 | fMultiplicityOfRP(0), | |
43 | fMultiplicitySpreadOfRP(0.), | |
e8c7e66c | 44 | fV1RP(0.), |
45 | fV1SpreadRP(0.), | |
46 | fV2RP(0.), | |
47 | fV2SpreadRP(0.), | |
48 | fPtSpectra(NULL), | |
49 | fPhiDistribution(NULL), | |
5b8dccde | 50 | fMyTRandom3(NULL), |
51 | fCount(0) | |
93ff27bd | 52 | { |
53 | // constructor | |
5b8dccde | 54 | fMyTRandom3 = new TRandom3(iseed); |
93ff27bd | 55 | } |
56 | ||
57 | ||
58 | //======================================================================== | |
59 | ||
60 | ||
61 | AliFlowEventSimpleMakerOnTheFly::~AliFlowEventSimpleMakerOnTheFly() | |
62 | { | |
63 | // destructor | |
e8c7e66c | 64 | if (fPtSpectra) delete fPtSpectra; |
65 | if (fPhiDistribution) delete fPhiDistribution; | |
5b8dccde | 66 | if (fMyTRandom3) delete fMyTRandom3; |
93ff27bd | 67 | } |
68 | ||
69 | ||
70 | //======================================================================== | |
71 | ||
72 | ||
73 | AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly() | |
74 | { | |
75 | // method to create event on the fly | |
76 | ||
77 | AliFlowEventSimple* pEvent = new AliFlowEventSimple(fMultiplicityOfRP); | |
78 | ||
5b8dccde | 79 | //reaction plane |
80 | Double_t fMCReactionPlaneAngle = fMyTRandom3->Uniform(0.,TMath::TwoPi()); | |
93ff27bd | 81 | |
82 | // pt: | |
83 | Double_t dPtMin = 0.; // to be improved | |
84 | Double_t dPtMax = 10.; // to be improved | |
85 | ||
e8c7e66c | 86 | fPtSpectra = new TF1("fPtSpectra","[0]*x*TMath::Exp(-x*x)",dPtMin,dPtMax); |
87 | fPtSpectra->SetParName(0,"Multiplicity of RPs"); | |
88 | // sampling the multiplicity: | |
89 | fMultiplicityOfRP = fMyTRandom3->Gaus(fMultiplicityOfRP,fMultiplicitySpreadOfRP); | |
90 | fPtSpectra->SetParameter(0,fMultiplicityOfRP); | |
91 | ||
93ff27bd | 92 | |
93ff27bd | 93 | |
93ff27bd | 94 | // phi: |
95 | Double_t dPhiMin = 0.; // to be improved | |
96 | Double_t dPhiMax = TMath::TwoPi(); // to be improved | |
97 | ||
e8c7e66c | 98 | fPhiDistribution = new TF1("fPhiDistribution","1+2.*[0]*TMath::Cos(x)+2.*[1]*TMath::Cos(2*x)",dPhiMin,dPhiMax); |
99 | ||
100 | // sampling the V1: | |
101 | fPhiDistribution->SetParName(0,"directed flow"); | |
102 | if(fV1RP>0.0) fV1RP = fMyTRandom3->Gaus(fV1RP,fV1SpreadRP); | |
103 | fPhiDistribution->SetParameter(0,fV1RP); | |
93ff27bd | 104 | |
e8c7e66c | 105 | // sampling the V2: |
106 | fPhiDistribution->SetParName(1,"elliptic flow"); | |
107 | fV2RP = fMyTRandom3->Gaus(fV2RP,fV2SpreadRP); | |
108 | fPhiDistribution->SetParameter(1,fV2RP); | |
109 | ||
93ff27bd | 110 | // eta: |
111 | Double_t dEtaMin = -1.; // to be improved | |
112 | Double_t dEtaMax = 1.; // to be improved | |
e8c7e66c | 113 | |
93ff27bd | 114 | Int_t iGoodTracks = 0; |
115 | Int_t iSelParticlesRP = 0; | |
116 | Int_t iSelParticlesPOI = 0; | |
117 | for(Int_t i=0;i<fMultiplicityOfRP;i++) { | |
118 | AliFlowTrackSimple* pTrack = new AliFlowTrackSimple(); | |
e8c7e66c | 119 | pTrack->SetPt(fPtSpectra->GetRandom()); |
5b8dccde | 120 | pTrack->SetEta(fMyTRandom3->Uniform(dEtaMin,dEtaMax)); |
e8c7e66c | 121 | pTrack->SetPhi(fPhiDistribution->GetRandom()+fMCReactionPlaneAngle); |
93ff27bd | 122 | pTrack->SetForRPSelection(kTRUE); |
123 | iSelParticlesRP++; | |
124 | pTrack->SetForPOISelection(kTRUE); | |
125 | iSelParticlesPOI++; | |
126 | ||
127 | pEvent->TrackCollection()->Add(pTrack); | |
128 | iGoodTracks++; | |
129 | } | |
130 | ||
131 | pEvent->SetEventNSelTracksRP(iSelParticlesRP); | |
132 | pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for RP or for POI selection | |
133 | pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle); | |
134 | ||
5b8dccde | 135 | if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl; |
136 | else cout<<" MC Reaction Plane Angle = unknown "<< endl; | |
137 | ||
138 | cout<<" iGoodTracks = "<< iGoodTracks << endl; | |
139 | cout<<" # of RP selected tracks = "<<iSelParticlesRP<<endl; | |
140 | cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl; | |
141 | cout << "# " << ++fCount << " events processed" << endl; | |
93ff27bd | 142 | |
143 | return pEvent; | |
144 | ||
145 | } // end of CreateEventOnTheFly() | |
146 | ||
147 | ||
148 |