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