]> 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 416c5c0dd709dde1922b8b490391e9495dc7a0df..5869d034441d56608529b2ec843d05da36b44480 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.6  2001/07/27 17:09:35  morsch
-Use local SetTrack, KeepTrack and SetHighWaterMark methods
-to delegate either to local stack or to stack owned by AliRun.
-(Piotr Skowronski, A.M.)
-
-Revision 1.5  2000/12/21 16:24:06  morsch
-Coding convention clean-up
-
-Revision 1.4  2000/11/30 07:12:49  alibrary
-Introducing new Rndm and QA classes
-
-Revision 1.3  2000/10/02 21:28:06  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.2  2000/07/11 18:24:55  fca
-Coding convention corrections + few minor bug fixes
-
-Revision 1.1  2000/06/09 20:22:58  morsch
-Same class as previously in AliSimpleGen.cxx
-All coding rule violations except RS3 corrected (AM)
-
-*/
-
+/* $Id$ */
 
 
 // Generator for particles in a preset
 // kinematic range (flat distribution)
 // Note that for a given theta pt and p are not independent 
 // Range for only one variable (pt or p) should be given.
-//
 // Comments and suggestions: andreas.morsch@cern.ch
-//
-//Begin_Html
-/*
-<img src="picts/AliGeneratorClass.gif">
-</pre>
-<br clear=left>
-<font size=+2 color=red>
-<p>The responsible person for this module is
-<a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
-</font>
-<pre>
-*/
-//End_Html
-//                                                               //
-///////////////////////////////////////////////////////////////////
 
+
+#include "TPDGCode.h"
+
+#include "AliConst.h"
 #include "AliGenBox.h"
 #include "AliRun.h"
-#include "AliConst.h"
-#include "AliPDG.h"
+#include "AliGenEventHeader.h"
 
 ClassImp(AliGenBox)
 
 //_____________________________________________________________________________
 AliGenBox::AliGenBox()
-    :AliGenerator()
+    :AliGenerator(), 
+     fIpart(0),
+     fEtaMin(0),
+     fEtaMax(0)
 {
   //
   // Default constructor
   //
-  fIpart=0;
 }
 
 //_____________________________________________________________________________
 AliGenBox::AliGenBox(Int_t npart)
-  :AliGenerator(npart)
+    :AliGenerator(npart),
+     fIpart(kProton),
+     fEtaMin(0),
+     fEtaMax(0)
 {
   //
   // Standard constructor
   //
   fName  = "Box";
   fTitle = "Box particle generator";
-  // Generate Proton by default
-  fIpart=kProton;
 }
 
 //_____________________________________________________________________________
@@ -111,15 +77,21 @@ void AliGenBox::Generate()
   //
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
     if(fVertexSmear==kPerEvent) {
-       Rndm(random,6);
-       for (j=0;j<3;j++) {
-           origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
-               TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
-       }
+       Vertex();
+       for (j=0;j<3;j++) origin[j]=fVertex[j];
     }
+
     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);
@@ -128,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);
@@ -140,7 +113,18 @@ void AliGenBox::Generate()
                    TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
        }
-       SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
+       PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
+    }
+
+    AliGenEventHeader* header = new AliGenEventHeader("BOX");
+    header->SetPrimaryVertex(fVertex);
+    header->SetNProduced(fNpart);
+    
+ // Passes header either to the container or to gAlice
+    if (fContainer) {
+       fContainer->AddHeader(header);
+    } else {
+       gAlice->SetGenEventHeader(header);      
     }
 }