1 /*************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /**********************************
17 * create an event and perform *
18 * flow analysis 'on the fly' *
20 * authors: Raimond Snellings *
21 * (snelling@nikhef.nl) *
24 *********************************/
26 #include "Riostream.h"
31 #include "AliFlowEventSimpleMakerOnTheFly.h"
32 #include "AliFlowEventSimple.h"
33 #include "AliFlowTrackSimple.h"
35 ClassImp(AliFlowEventSimpleMakerOnTheFly)
38 //========================================================================
41 AliFlowEventSimpleMakerOnTheFly::AliFlowEventSimpleMakerOnTheFly(UInt_t iseed):
43 fMultiplicitySpreadOfRP(0.),
49 fPhiDistribution(NULL),
54 fMyTRandom3 = new TRandom3(iseed);
58 //========================================================================
61 AliFlowEventSimpleMakerOnTheFly::~AliFlowEventSimpleMakerOnTheFly()
64 if (fPtSpectra) delete fPtSpectra;
65 if (fPhiDistribution) delete fPhiDistribution;
66 if (fMyTRandom3) delete fMyTRandom3;
70 //========================================================================
73 AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly()
75 // method to create event on the fly
77 AliFlowEventSimple* pEvent = new AliFlowEventSimple(fMultiplicityOfRP);
80 Double_t fMCReactionPlaneAngle = fMyTRandom3->Uniform(0.,TMath::TwoPi());
83 Double_t dPtMin = 0.; // to be improved
84 Double_t dPtMax = 10.; // to be improved
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 Int_t fNewMultiplicityOfRP = fMyTRandom3->Gaus(fMultiplicityOfRP,fMultiplicitySpreadOfRP);
90 fPtSpectra->SetParameter(0,fNewMultiplicityOfRP);
94 Double_t dPhiMin = 0.; // to be improved
95 Double_t dPhiMax = TMath::TwoPi(); // to be improved
97 fPhiDistribution = new TF1("fPhiDistribution","1+2.*[0]*TMath::Cos(x)+2.*[1]*TMath::Cos(2*x)",dPhiMin,dPhiMax);
100 fPhiDistribution->SetParName(0,"directed flow");
101 Double_t fNewV1RP=0.;
102 if(fV1RP>0.0) {fNewV1RP = fMyTRandom3->Gaus(fV1RP,fV1SpreadRP);}
103 fPhiDistribution->SetParameter(0,fNewV1RP);
106 fPhiDistribution->SetParName(1,"elliptic flow");
107 Double_t fNewV2RP = fMyTRandom3->Gaus(fV2RP,fV2SpreadRP);
108 fPhiDistribution->SetParameter(1,fNewV2RP);
111 Double_t dEtaMin = -1.; // to be improved
112 Double_t dEtaMax = 1.; // to be improved
114 Int_t iGoodTracks = 0;
115 Int_t iSelParticlesRP = 0;
116 Int_t iSelParticlesPOI = 0;
117 for(Int_t i=0;i<fNewMultiplicityOfRP;i++) {
118 AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
119 pTrack->SetPt(fPtSpectra->GetRandom());
120 pTrack->SetEta(fMyTRandom3->Uniform(dEtaMin,dEtaMax));
121 pTrack->SetPhi(fPhiDistribution->GetRandom()+fMCReactionPlaneAngle);
122 pTrack->SetForRPSelection(kTRUE);
124 pTrack->SetForPOISelection(kTRUE);
127 pEvent->TrackCollection()->Add(pTrack);
131 pEvent->SetEventNSelTracksRP(iSelParticlesRP);
132 pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for RP or for POI selection
133 pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle);
135 if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl;
136 else cout<<" MC Reaction Plane Angle = unknown "<< endl;
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;
143 delete fPhiDistribution;
147 } // end of CreateEventOnTheFly()