added methods to simulate fluctuations in multiplicity and flow
authorsnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Apr 2009 12:27:34 +0000 (12:27 +0000)
committersnelling <snelling@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Apr 2009 12:27:34 +0000 (12:27 +0000)
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.cxx
PWG2/FLOW/AliFlowTasks/AliFlowEventSimpleMaker.h
PWG2/FLOW/macros/runFlowAnalysis.C

index 3166f30..6e7abc6 100644 (file)
@@ -30,6 +30,8 @@
 #include "AliFlowTrackSimple.h"
 #include "TTree.h"
 #include "TParticle.h"
+#include "TRandom.h"
+#include "TDatime.h"
 #include "AliMCEvent.h"
 #include "AliMCParticle.h"
 #include "AliESDEvent.h"
@@ -48,15 +50,23 @@ AliFlowEventSimpleMaker::AliFlowEventSimpleMaker() :
   fCount(0),
   fNoOfLoops(1),
   fEllipticFlowValue(0.),
-  fMultiplicityOfEvent(1000000000)
+  fMultiplicityOfEvent(1000000000),
+  fRandom(NULL),
+  fUseRandomRP(kFALSE),
+  fSigmaMult(0.),
+  fSigmaFlow(0.)
 {
   //constructor
+  TDatime fTime;
+  fRandom = new TRandom(fTime.GetTime());
 }
 
 //-----------------------------------------------------------------------   
 AliFlowEventSimpleMaker::~AliFlowEventSimpleMaker()
 {
   //destructor
+
+  delete fRandom;
 }
 
 //-----------------------------------------------------------------------   
@@ -98,13 +108,23 @@ 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()) {
@@ -128,10 +148,10 @@ AliFlowEventSimple* AliFlowEventSimpleMaker::FillTracks(TTree* anInput, AliFlowT
        AliFlowTrackSimple* pTrack = new AliFlowTrackSimple();
        pTrack->SetPt(pParticle->Pt());
        pTrack->SetEta(pParticle->Eta());
-       pTrack->SetPhi(pParticle->Phi()-fEllipticFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)));
+       pTrack->SetPhi(pParticle->Phi()-fNewFlowValue*TMath::Sin(2*(pParticle->Phi()-fMCReactionPlaneAngle)));
        
        //marking the particles used for int. flow:
-       if(bPassedRPFlowCuts && iSelParticlesRP < fMultiplicityOfEvent) {  
+       if(bPassedRPFlowCuts && iSelParticlesRP < fNewMultOfEvent) {  
          pTrack->SetForRPSelection(kTRUE);
          iSelParticlesRP++;
        }
index a1478bf..7027d21 100644 (file)
@@ -14,6 +14,7 @@ class AliCFManager;
 class AliMCEvent;
 class AliESDEvent;
 class AliAODEvent;
+class TRandom;
 
 // AliFlowEventSimpleMaker:
 // Class to fill the AliFlowEventSimple with AliFlowTrackSimple objects
@@ -53,7 +54,10 @@ 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
@@ -63,7 +67,11 @@ 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 1657e1e..af8a780 100644 (file)
@@ -13,7 +13,7 @@ Bool_t LYZEP = kFALSE;
 Bool_t GFC   = kTRUE;
 Bool_t QC    = kTRUE;
 Bool_t FQD   = kTRUE;
-Bool_t MCEP  = kFALSE; //does not work yet 24/12/08
+Bool_t MCEP  = kTRUE; //does not work yet 24/12/08
 //--------------------------------------------------------------------------------------
 
 // Weights 
@@ -48,8 +48,6 @@ enum anaModes {mLocal,mLocalSource,mLocalPAR,};
 //mLocalPAR: Analyze data on your computer using root + PAR files
 //mLocalSource: Analyze data on your computer using root + source files
 
-
-
 Int_t offset = 0;
                                           
 int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char* 
@@ -73,6 +71,12 @@ int runFlowAnalysis(Int_t mode=mLocal, Int_t aRuns = 100, const char*
   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