]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Possibility to have fixed number of pile-up events (A. Toia)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Sep 2009 12:13:30 +0000 (12:13 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Sep 2009 12:13:30 +0000 (12:13 +0000)
Corresponds to savannah report
 #56045

EVGEN/AliGenPileup.cxx
EVGEN/AliGenPileup.h

index 0d973159bebe5c7a4fb7e44e43717ba577e18382..10461d8406f5d4a535c87f6c9436d60e4795c6c5 100644 (file)
@@ -61,7 +61,8 @@ ClassImp(AliGenPileup)
 AliGenPileup::AliGenPileup():
   AliGenCocktail(),
   fBCMask("bcm","3564H"),
-  fGenTrig(kFALSE)
+  fGenTrig(kFALSE),
+  fFlag(kFALSE)
 {
 // Constructor
 // The pileup time window is by default
@@ -77,7 +78,7 @@ AliGenPileup::~AliGenPileup()
 // Destructor
 }
 
-void AliGenPileup::SetGenerator(AliGenerator *generator, Float_t rate)
+void AliGenPileup::SetGenerator(AliGenerator *generator, Float_t rate, Bool_t flag)
 {
   // The method sets the geenrator to be used
   // for pileup simulation.
@@ -91,6 +92,7 @@ void AliGenPileup::SetGenerator(AliGenerator *generator, Float_t rate)
     }
   }
   AddGenerator(generator,"pileup generator",rate);
+  fFlag = flag;
 }
 
 void AliGenPileup::AddGenerator(AliGenerator *Generator,
@@ -155,7 +157,13 @@ void AliGenPileup::Generate()
 
       if (!fBCMask.GetMask(iBC)) continue;
 
-      Int_t nInteractions = gRandom->Poisson(rate);
+      //      Int_t nInteractions = gRandom->Poisson(rate);
+      Int_t nInteractions;
+      if (!fFlag) 
+       nInteractions = gRandom->Poisson(rate);
+      else 
+       nInteractions = TMath::Nint(rate) + 1;
+
       if (nInteractions == 0) continue;
 
       nIntBC[nTotBC] = nInteractions;
index d8a46f8e3c178b758416ee8eb62b089a4218f8c0..006da967801d4d1414c112e8f98943d0e66431e5 100644 (file)
@@ -50,7 +50,8 @@ class AliGenPileup : public AliGenCocktail
     virtual void SetRandomise(Bool_t flag);
     virtual void UsePerEventRates();
            
-    void         SetGenerator(AliGenerator *generator, Float_t rate);
+    void         SetGenerator(AliGenerator *generator, Float_t rate, Bool_t flag = kFALSE);
+    //void         SetGenerator(AliGenerator *generator, Float_t rate);
     Bool_t       SetBCMask(const char *mask);
     void         GenerateTrigInteraction(Bool_t flag) {fGenTrig = flag;}
 
@@ -60,6 +61,7 @@ class AliGenPileup : public AliGenCocktail
 
     AliTriggerBCMask fBCMask;    // Mask used to tag the active bunch-crossings within an orbit
     Bool_t           fGenTrig;   // Generate or not the trigger interaction
+    Bool_t           fFlag;      // fixed interaction rate (integer)
 
  private:
     AliGenPileup(const AliGenPileup &gen);