a few mods how to do the randome numbers
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Apr 2009 14:05:56 +0000 (14:05 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Apr 2009 14:05:56 +0000 (14:05 +0000)
PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.cxx
PWG2/FLOW/AliFlowCommon/AliFlowEventSimpleMakerOnTheFly.h
PWG2/FLOW/macros/runFlowAnalysisOnTheFly.C

index a5c71fa..6892c98 100644 (file)
@@ -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;i<fMultiplicityOfRP;i++) {
     AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
     pTrack->SetPt(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 = "<<iSelParticlesRP<<endl;
+  cout<<" # of POI selected tracks = "<<iSelParticlesPOI<<endl;  
+  cout << "# " << ++fCount << " events processed" << endl;
 
  return pEvent;  
  
index 3f274af..b8279bb 100644 (file)
@@ -18,6 +18,7 @@
 #define ALIFLOWEVENTSIMPLEMAKERONTHEFLY_H
 
 class TF1;
+class TRandom3;
 
 #include "AliFlowEventSimple.h"  //needed as include
     
@@ -25,7 +26,7 @@ class AliFlowEventSimpleMakerOnTheFly {
 
  public:
 
-  AliFlowEventSimpleMakerOnTheFly();          // constructor
+  AliFlowEventSimpleMakerOnTheFly(UInt_t);    // constructor
   virtual ~AliFlowEventSimpleMakerOnTheFly(); // destructor
 
   AliFlowEventSimple* CreateEventOnTheFly();  // create an event on the fly
@@ -45,7 +46,7 @@ class AliFlowEventSimpleMakerOnTheFly {
   void SetMultiplicitySpreadOfRP(Double_t multSpreadRP) {this->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
 };
  
index a798c33..c8de913 100644 (file)
@@ -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;i<nEvts;i++) {   
    // creating the event with above settings:
-   
-   cout<<endl;
-   cout<<" ---- CREATING EVENT No "<<i+1<<" ---- "<<endl;
-   cout<<endl;   
-   
    AliFlowEventSimple *event = eventMakerOnTheFly->CreateEventOnTheFly(); 
-   cout<<" .... done .... "<<endl;
    
    // analyzing the created event 'on the fly':
-   cout<<endl;
-   cout<<" ---- ANALYZING EVENT No "<<i+1<<" ---- "<<endl;
-   cout<<endl; 
-   
    // do flow analysis for various methods:
    if(MCEP) mcep->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 .... "<<endl;
-   cout<<endl;
-   
    delete event;
  } // end of for(Int_t i=0;i<nEvts;i++)
  //---------------------------------------------------------------------------------------