From 5b8dccde7ac98165989b0a69f835d22dcd3b6780 Mon Sep 17 00:00:00 2001 From: snelling Date: Wed, 29 Apr 2009 14:05:56 +0000 Subject: [PATCH] a few mods how to do the randome numbers --- .../AliFlowEventSimpleMakerOnTheFly.cxx | 30 ++++++++++++------ .../AliFlowEventSimpleMakerOnTheFly.h | 9 ++++-- PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C | 31 +++++++------------ 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx b/PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx index a5c71fa37ed..6892c98fe1f 100644 --- a/PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx +++ b/PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx @@ -38,13 +38,16 @@ ClassImp(AliFlowEventSimpleMakerOnTheFly) //======================================================================== -AliFlowEventSimpleMakerOnTheFly::AliFlowEventSimpleMakerOnTheFly(): - fMultiplicityOfRP(0), - fMultiplicitySpreadOfRP(0.), - fPtFormula(NULL), - fPhiFormula(NULL) +AliFlowEventSimpleMakerOnTheFly::AliFlowEventSimpleMakerOnTheFly(UInt_t iseed): + fMultiplicityOfRP(0), + fMultiplicitySpreadOfRP(0.), + fPtFormula(NULL), + fPhiFormula(NULL), + fMyTRandom3(NULL), + fCount(0) { // constructor + fMyTRandom3 = new TRandom3(iseed); } @@ -56,6 +59,7 @@ AliFlowEventSimpleMakerOnTheFly::~AliFlowEventSimpleMakerOnTheFly() // destructor if (fPtFormula) delete fPtFormula; if (fPhiFormula) delete fPhiFormula; + if (fMyTRandom3) delete fMyTRandom3; } @@ -68,6 +72,8 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly() AliFlowEventSimple* pEvent = new AliFlowEventSimple(fMultiplicityOfRP); + //reaction plane + Double_t fMCReactionPlaneAngle = fMyTRandom3->Uniform(0.,TMath::TwoPi()); // pt: Double_t dPtMin = 0.; // to be improved @@ -94,10 +100,7 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly() // eta: Double_t dEtaMin = -1.; // to be improved Double_t dEtaMax = 1.; // to be improved - TRandom3 myTRandom3; - //reaction plane - Double_t fMCReactionPlaneAngle = TMath::TwoPi()*myTRandom3.Rndm(); Int_t iGoodTracks = 0; Int_t iSelParticlesRP = 0; @@ -105,8 +108,8 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly() for(Int_t i=0;iSetPt(fPtFormula->GetRandom()); - pTrack->SetEta(myTRandom3.Uniform(dEtaMin,dEtaMax)); - pTrack->SetPhi(fPhiFormula->GetRandom()-fMCReactionPlaneAngle); + pTrack->SetEta(fMyTRandom3->Uniform(dEtaMin,dEtaMax)); + pTrack->SetPhi(fPhiFormula->GetRandom()+fMCReactionPlaneAngle); pTrack->SetForRPSelection(kTRUE); iSelParticlesRP++; pTrack->SetForPOISelection(kTRUE); @@ -120,6 +123,13 @@ AliFlowEventSimple* AliFlowEventSimpleMakerOnTheFly::CreateEventOnTheFly() pEvent->SetNumberOfTracks(iGoodTracks);//tracks used either for RP or for POI selection pEvent->SetMCReactionPlaneAngle(fMCReactionPlaneAngle); + if (!fMCReactionPlaneAngle == 0) cout<<" MC Reaction Plane Angle = "<< fMCReactionPlaneAngle << endl; + else cout<<" MC Reaction Plane Angle = unknown "<< endl; + + cout<<" iGoodTracks = "<< iGoodTracks << endl; + cout<<" # of RP selected tracks = "<fMultiplicitySpreadOfRP = multSpreadRP;} Double_t GetMultiplicitySpreadOfRP() const {return this->fMultiplicitySpreadOfRP;} //................................................................................................ - + private: AliFlowEventSimpleMakerOnTheFly(const AliFlowEventSimpleMakerOnTheFly& anAnalysis); // copy constructor @@ -65,8 +66,12 @@ class AliFlowEventSimpleMakerOnTheFly { // equations for distributions: TF1 *fPtFormula; // transverse momentum distribution TF1 *fPhiFormula; // azimuthal distribution + //................................................................................................ + TRandom3* fMyTRandom3; // our random generator + Int_t fCount; + ClassDef(AliFlowEventSimpleMakerOnTheFly,0) // macro for rootcint }; diff --git a/PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C b/PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C index a798c337bb0..c8de913b0ce 100644 --- a/PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C +++ b/PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C @@ -6,20 +6,20 @@ //-------------------------------------------------------------------------------------- // RUN SETTINGS // flow analysis method can be: (set to kTRUE or kFALSE) -Bool_t SP = kFALSE; -Bool_t LYZ1 = kFALSE; +Bool_t SP = kTRUE; +Bool_t LYZ1 = kTRUE; Bool_t LYZ2 = kFALSE; Bool_t LYZEP = kFALSE; -Bool_t GFC = kFALSE; -Bool_t QC = kFALSE; -Bool_t FQD = kFALSE; +Bool_t GFC = kTRUE; +Bool_t QC = kTRUE; +Bool_t FQD = kTRUE; Bool_t MCEP = kTRUE; //-------------------------------------------------------------------------------------- //................................................................................. // Set the event parameters: -Int_t iMultiplicityOfRP = 4400; // multiplicity of RPs +Int_t iMultiplicityOfRP = 500; // multiplicity of RPs //................................................................................. @@ -52,9 +52,13 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=1) LoadLibraries(mode); + //initialize the random generator + TTimeStamp dt; + UInt_t sseed = dt.GetNanoSec()/1000; + //--------------------------------------------------------------------------------------- // Initialize the flowevent maker - AliFlowEventSimpleMakerOnTheFly* eventMakerOnTheFly = new AliFlowEventSimpleMakerOnTheFly(); + AliFlowEventSimpleMakerOnTheFly* eventMakerOnTheFly = new AliFlowEventSimpleMakerOnTheFly(sseed); //--------------------------------------------------------------------------------------- @@ -163,19 +167,9 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=1) for(Int_t i=0;iCreateEventOnTheFly(); - cout<<" .... done .... "<Make(event); if(QC) qc->Make(event); @@ -186,9 +180,6 @@ int runFlowAnalysisOnTheFly(Int_t mode=mLocal, Int_t nEvts=1) if(LYZEP) lyzep->Make(event,ep); if(SP) sp->Make(event); - cout<<" .... done .... "<