Moved the random geration to the macro
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 23 Apr 2009 11:51:27 +0000 (11:51 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 23 Apr 2009 11:51:27 +0000 (11:51 +0000)
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.h
PWG2/FLOW/macros/runFlowAnalysis.C

index 6e7abc6..11f6094 100644 (file)
@@ -30,8 +30,6 @@
 #include "AliFlowTrackSimple.h"
 #include "TTree.h"
 #include "TParticle.h"
-#include "TRandom.h"
-#include "TDatime.h"
 #include "AliMCEvent.h"
 #include "AliMCParticle.h"
 #include "AliESDEvent.h"
@@ -50,23 +48,15 @@ AliFlowEventSimpleMaker::AliFlowEventSimpleMaker() :
   fCount(0),
   fNoOfLoops(1),
   fEllipticFlowValue(0.),
-  fMultiplicityOfEvent(1000000000),
-  fRandom(NULL),
-  fUseRandomRP(kFALSE),
-  fSigmaMult(0.),
-  fSigmaFlow(0.)
+  fMultiplicityOfEvent(1000000000)
 {
   //constructor
-  TDatime fTime;
-  fRandom = new TRandom(fTime.GetTime());
 }
 
 //-----------------------------------------------------------------------   
 AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
 {
   //destructor
-
-  delete fRandom;
 }
 
 //-----------------------------------------------------------------------   
@@ -75,7 +65,6 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowT
   //fills the event from a TTree of kinematic.root files
   
   // number of times to use the same particle (trick to introduce nonflow)
-  //  Int_t iLoops = 1;
   
   //flags for particles passing int. and diff. flow cuts
   Bool_t bPassedRPFlowCuts  = kFALSE;
@@ -108,23 +97,12 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowT
   //  Int_t fMultiplicityOfEvent = 576; //multiplicity for chi=1.5
   //  Int_t fMultiplicityOfEvent = 256; //multiplicity for chi=1
   //  Int_t fMultiplicityOfEvent = 164; //multiplicity for chi=0.8
-
-  Int_t fNewMultOfEvent = fRandom->Gaus(fMultiplicityOfEvent,fSigmaMult);
-  //  cout << "new multiplicity: " << fNewMultOfEvent << endl;
-  
-  Double_t fNewFlowValue = fRandom->Gaus(fEllipticFlowValue,fSigmaFlow);
-  //  cout << "new flow value: " << fNewFlowValue << endl;
   
   Int_t iGoodTracks = 0;
   Int_t itrkN = 0;
   Int_t iSelParticlesRP = 0;
   Int_t iSelParticlesPOI = 0;
   
-  // generate some random numbers
-  if (fUseRandomRP) {
-    fMCReactionPlaneAngle = 2.*TMath::Pi()*fRandom->Uniform(1.);
-  }
-
   while (itrkN < iNumberOfInputTracks) {
     anInput->GetEntry(itrkN);   //get input particle
     if (pParticle->IsPrimary()) {
@@ -148,10 +126,10 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowT
        AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
        pTrack->SetPt(pParticle->Pt());
        pTrack->SetEta(pParticle->Eta());
-       pTrack->SetPhi(pParticle->Phi()-fNewFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)));
+       pTrack->SetPhi(pParticle->Phi()-fEllipticFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)));
        
        //marking the particles used for int. flow:
-       if(bPassedRPFlowCuts && iSelParticlesRP < fNewMultOfEvent) {  
+       if(bPassedRPFlowCuts && iSelParticlesRP < fMultiplicityOfEvent) {  
          pTrack->SetForRPSelection(kTRUE);
          iSelParticlesRP++;
        }
index 7027d21..4a805d3 100644 (file)
@@ -14,7 +14,6 @@ class AliCFManager;
 class AliMCEvent;
 class AliESDEvent;
 class AliAODEvent;
-class TRandom;
 
 // AliFlowEventSimpleMaker:
 // Class to fill the AliFlowEventSimple with AliFlowTrackSimple objects
@@ -54,10 +53,6 @@ class AliFlowEventSimpleMaker {
   void SetMultiplicityOfEvent(Int_t multevnt) {this->fMultiplicityOfEvent = multevnt;}
   Int_t GetMultiplicityOfEvent() const {return this->fMultiplicityOfEvent;} 
   
-  void SetSigmaFlow(Double_t sigmav) {this->fSigmaFlow = sigmav;}
-  void SetSigmaMult(Double_t sigmam) {this->fSigmaMult = sigmam;}
-  void UseRandomRP(Bool_t randomRP=kTRUE) {this->fUseRandomRP = randomRP;}
-
  private:
   AliFlowEventSimpleMaker(const AliFlowEventSimpleMaker& anAnalysis);            //copy constructor
   AliFlowEventSimpleMaker& operator=(const AliFlowEventSimpleMaker& anAnalysis); //assignment operator
@@ -67,10 +62,6 @@ class AliFlowEventSimpleMaker {
   Int_t     fNoOfLoops; // number of times to use the same particle (nonflow) 
   Double_t  fEllipticFlowValue; // Add Flow. Must be in range [0,1].
   Int_t     fMultiplicityOfEvent; // Set maximal multiplicity.
-  TRandom   *fRandom;
-  Bool_t    fUseRandomRP;
-  Double_t  fSigmaMult;     
-  Double_t  fSigmaFlow;
      
   ClassDef(AliFlowEventSimpleMaker,0)    // macro for rootcint
 };
index af8a780..88f48b0 100644 (file)
@@ -42,6 +42,13 @@ Double_t phiMaxDiff = 7.5;
 Double_t phiMinDiff = 0.;
 Int_t PIDDiff       = 211;
 //--------------------------------------------------------------------------------------
+// FLOW SETTINGS (R.Rietkerk)
+Int_t nLoops=1;                // Number of times to use the same particle (nonflow).
+Double_t xEllipticFlowValue=0.1;       // Add Elliptic Flow. Must be in range [0,1].
+Int_t nMultiplicityOfEvent=500;// Set Average Multiplicity.
+Double_t xSigmaFlow=0.00;      // Add Elliptic Flow. Must be in range [0,1].
+Int_t nSigmaMult=50;// Set Average Multiplicity.
+//--------------------------------------------------------------------------------------
 
 enum anaModes {mLocal,mLocalSource,mLocalPAR,};
 //mLocal: Analyze data on your computer using aliroot
@@ -50,9 +57,10 @@ enum anaModes {mLocal,mLocalSource,mLocalPAR,};
 
 Int_t offset = 0;
                                           
-int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char* 
+int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 1000, const char* 
                    //                    dir="/data/alice1/kolk/KineOnly3/")
-                   dir="/Users/snelling/alice_data/KineOnly3/")
+                                   dir="/Users/snelling/alice_data/KineOnly3/")
+                   //              dir="/Users/snelling/alice_data/stoomboot/5b/")
 {
   TStopwatch timer;
   timer.Start();
@@ -68,15 +76,14 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char*
   
   LoadLibraries(mode);
 
+  TRandom3 random3Temp; //init for manual settings (R.Rietkerk)
+  TTimeStamp dt;
+  Int_t sseed = dt.GetNanoSec()/1000;
+  random3Temp.SetSeed(sseed);
+
   if (mode == mLocal || mode == mLocalPAR) {
     // AliFlow event in aliroot or with pars
     AliFlowEventSimpleMaker* fEventMaker = new AliFlowEventSimpleMaker();
-    //    fEventMaker->SetNoOfLoops(2);
-    //    fEventMaker->SetEllipticFlowValue(0.05);
-    //    fEventMaker->SetSigmaFlow(0.005);
-    //    fEventMaker->SetMultiplicityOfEvent(250);
-    //    fEventMaker->SetSigmaMult(10.);
-    //    fEventMaker->UseRandomRP();
   }
   else if (mode == mLocalSource) {
     // flow event in source mode
@@ -303,7 +310,8 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char*
          TTree* kTree;
          TIter next(kineEventsList); 
          TKey* key;
-         
+
+         Double_t xRPAngle;      
          //loop over the events
          while( key=(TKey *)next() ) 
            {
@@ -321,6 +329,17 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char*
              
              //-----------------------------------------------------------
              //fill and save the flow event          
+
+             Int_t nNewMultOfEvent = random3Temp.Gaus(nMultiplicityOfEvent,nSigmaMult);
+             cout << "new multiplicity: " << nNewMultOfEvent << endl;
+             Double_t xNewFlowValue = random3Temp.Gaus(xEllipticFlowValue,xSigmaFlow);
+             cout << "new flow value: " << xNewFlowValue << endl;
+             fEventMaker->SetNoOfLoops(nLoops);
+             fEventMaker->SetEllipticFlowValue(xNewFlowValue);
+             fEventMaker->SetMultiplicityOfEvent(nNewMultOfEvent);
+             xRPAngle=TMath::TwoPi()*random3Temp.Rndm();
+             fEventMaker->SetMCReactionPlaneAngle(xRPAngle);
+
              AliFlowEventSimple *fEvent = fEventMaker->FillTracks(kTree, cutsInt, cutsDiff); 
                            
              // do flow analysis for various methods