]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenBox.cxx
Correct cmake compilation file, remove old classes
[u/mrichter/AliRoot.git] / EVGEN / AliGenBox.cxx
index 46c3b9781fa25196e75983f1b4013a32fa02c83f..5869d034441d56608529b2ec843d05da36b44480 100644 (file)
@@ -35,7 +35,9 @@ ClassImp(AliGenBox)
 //_____________________________________________________________________________
 AliGenBox::AliGenBox()
     :AliGenerator(), 
-     fIpart(0)
+     fIpart(0),
+     fEtaMin(0),
+     fEtaMax(0)
 {
   //
   // Default constructor
@@ -45,7 +47,9 @@ AliGenBox::AliGenBox()
 //_____________________________________________________________________________
 AliGenBox::AliGenBox(Int_t npart)
     :AliGenerator(npart),
-     fIpart(kProton)
+     fIpart(kProton),
+     fEtaMin(0),
+     fEtaMax(0)
 {
   //
   // Standard constructor
@@ -79,7 +83,15 @@ void AliGenBox::Generate()
 
     for(i=0;i<fNpart;i++) {
        Rndm(random,3);
-       theta=fThetaMin+random[0]*(fThetaMax-fThetaMin);
+       
+       if (TestBit(kThetaRange)) {
+           theta = fThetaMin+random[0]*(fThetaMax-fThetaMin);
+       } else {
+           Float_t eta = fEtaMin+random[0]*(fEtaMax-fEtaMin);
+           theta = 2. * TMath::ATan(TMath::Exp(-eta));
+       }
+           
+           
        if(TestBit(kMomentumRange)) {
            pmom=fPMin+random[1]*(fPMax-fPMin);
            pt=pmom*TMath::Sin(theta);
@@ -88,6 +100,7 @@ void AliGenBox::Generate()
            pt=fPtMin+random[1]*(fPtMax-fPtMin);
            pmom=pt/TMath::Sin(theta);
        }
+
        phi=fPhiMin+random[2]*(fPhiMax-fPhiMin);
        p[0] = pt*TMath::Cos(phi);
        p[1] = pt*TMath::Sin(phi);
@@ -105,7 +118,14 @@ void AliGenBox::Generate()
 
     AliGenEventHeader* header = new AliGenEventHeader("BOX");
     header->SetPrimaryVertex(fVertex);
-    gAlice->SetGenEventHeader(header); 
+    header->SetNProduced(fNpart);
+    
+ // Passes header either to the container or to gAlice
+    if (fContainer) {
+       fContainer->AddHeader(header);
+    } else {
+       gAlice->SetGenEventHeader(header);      
+    }
 }
 
 //_____________________________________________________________________________