ROOT logo
#if !defined(__CINT__) || defined(__MAKECINT__)
#include <Riostream.h>
#include "TRandom.h"
#include "AliGenerator.h"
#include "AliGenBox.h"
#endif

/// Simple 3D-BOX generator for single muons
/// with a fixed fraction of + and - (50% per default)

class AliGenMuBox : public AliGenBox
{
public:
  
  AliGenMuBox(Float_t plusShare=0.50);

  virtual ~AliGenMuBox() {}
  
  void GenerateN(Int_t ntimes);

  void Generate() { GenerateN(1); }

private:
  Float_t fPlusShare; // Fraction of plus muons
  
  ClassDef(AliGenMuBox,1) // Square box random generator for muons (+ and -)
};

ClassImp(AliGenMuBox)

AliGenMuBox::AliGenMuBox(Float_t plusShare) : AliGenBox(), fPlusShare(plusShare)
{
  if ( fPlusShare <= 0.0 )
  {
    fPlusShare = 0.0;
  }
  if ( fPlusShare > 1.0 )
  {
    fPlusShare = 1.0;
  }
}

void AliGenMuBox::GenerateN(Int_t ntimes)
{
  Int_t ipart = 13;
  
  if ( fPlusShare == 1.0 )
  {
    ipart = -13;
  }
  else
  {
    Float_t x = Rndm();
  
    if ( x < fPlusShare )
    {
      ipart = -13;
    }
  }

  SetPart(ipart);
  
  AliGenBox::GenerateN(ntimes);
}

AliGenerator* GenMuBox()
{
  AliGenBox* generator = new AliGenMuBox;
  
  generator->SetNumberParticles(1);
  
  generator->SetPtRange(VAR_GENMUBOX_PTMIN,VAR_GENMUBOX_PTMAX);
  generator->SetYRange(VAR_GENMUBOX_YMIN,VAR_GENMUBOX_YMAX);
  
  generator->SetPhiRange(0., 360.);
  generator->SetTrackingFlag(1);
  
  return generator;
}
 GenMuBox.C:1
 GenMuBox.C:2
 GenMuBox.C:3
 GenMuBox.C:4
 GenMuBox.C:5
 GenMuBox.C:6
 GenMuBox.C:7
 GenMuBox.C:8
 GenMuBox.C:9
 GenMuBox.C:10
 GenMuBox.C:11
 GenMuBox.C:12
 GenMuBox.C:13
 GenMuBox.C:14
 GenMuBox.C:15
 GenMuBox.C:16
 GenMuBox.C:17
 GenMuBox.C:18
 GenMuBox.C:19
 GenMuBox.C:20
 GenMuBox.C:21
 GenMuBox.C:22
 GenMuBox.C:23
 GenMuBox.C:24
 GenMuBox.C:25
 GenMuBox.C:26
 GenMuBox.C:27
 GenMuBox.C:28
 GenMuBox.C:29
 GenMuBox.C:30
 GenMuBox.C:31
 GenMuBox.C:32
 GenMuBox.C:33
 GenMuBox.C:34
 GenMuBox.C:35
 GenMuBox.C:36
 GenMuBox.C:37
 GenMuBox.C:38
 GenMuBox.C:39
 GenMuBox.C:40
 GenMuBox.C:41
 GenMuBox.C:42
 GenMuBox.C:43
 GenMuBox.C:44
 GenMuBox.C:45
 GenMuBox.C:46
 GenMuBox.C:47
 GenMuBox.C:48
 GenMuBox.C:49
 GenMuBox.C:50
 GenMuBox.C:51
 GenMuBox.C:52
 GenMuBox.C:53
 GenMuBox.C:54
 GenMuBox.C:55
 GenMuBox.C:56
 GenMuBox.C:57
 GenMuBox.C:58
 GenMuBox.C:59
 GenMuBox.C:60
 GenMuBox.C:61
 GenMuBox.C:62
 GenMuBox.C:63
 GenMuBox.C:64
 GenMuBox.C:65
 GenMuBox.C:66
 GenMuBox.C:67
 GenMuBox.C:68
 GenMuBox.C:69
 GenMuBox.C:70
 GenMuBox.C:71
 GenMuBox.C:72
 GenMuBox.C:73
 GenMuBox.C:74
 GenMuBox.C:75
 GenMuBox.C:76
 GenMuBox.C:77
 GenMuBox.C:78
 GenMuBox.C:79
 GenMuBox.C:80