]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenThetaSlice.cxx
Overlaps corrected, new shape of sectors
[u/mrichter/AliRoot.git] / EVGEN / AliGenThetaSlice.cxx
index d23cbe339d802794403c99ff6c2c9e9dd1b9ff8c..7adff4bec0624f1f3148d222cfc8e78c523e31c4 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.1.4.1  2003/04/14 17:33:50  hristov
-Merging with v3-09-08 (part1)
+/* $Id$ */
 
-Revision 1.2  2003/01/14 10:50:19  alibrary
-Cleanup of STEER coding conventions
 
-Revision 1.1  2002/03/11 10:56:06  morsch
-AliGenThetaSlice, first commit. (Jiri Chudoba)
-
-*/
-////////////////////////////////////////////////////////////////////////
-//
-// generates n particles with in the same phi angle, varies theta
+// Generates n particles with in the same phi angle, varies theta
 // in equidistant intervals
 // This class is intended to use for studies of TPC response
 // via merging with background event.
-// 
 // Note that for a given theta pt and p are not independent 
 // Range for only one variable (pt or p) should be given.
 // Based on the AliGenBox class written by andreas.morsch@cern.ch
 //
 // Comments and suggestions: Jiri.Chudoba@cern.ch
-//
-////////////////////////////////////////////////////////////////////////
+
 
 #include <TPDGCode.h>
 
@@ -50,25 +37,24 @@ ClassImp(AliGenThetaSlice)
 
 //_____________________________________________________________________________
 AliGenThetaSlice::AliGenThetaSlice()
-    :AliGenerator()
+    :AliGenerator(),
+     fIpart(0)
 {
   //
   // Default constructor
   //
-  fIpart=0;
 }
 
 //_____________________________________________________________________________
 AliGenThetaSlice::AliGenThetaSlice(Int_t npart)
-  :AliGenerator(npart)
+    :AliGenerator(npart),
+     fIpart(kProton)
 {
   //
   // Standard constructor
   //
   fName  = "ThetaSlice";
   fTitle = "Particle generator - const. phi, slices in theta";
-  // Generate Proton by default
-  fIpart=kProton;
 }
 
 //_____________________________________________________________________________
@@ -81,6 +67,7 @@ void AliGenThetaSlice::Generate()
   
     Float_t polar[3]= {0,0,0};
     Float_t origin[3];
+    Float_t time;
     Float_t p[3];
     Int_t i, j, nt;
     Double_t pmom, theta, phi, pt;
@@ -89,12 +76,17 @@ void AliGenThetaSlice::Generate()
     if (fNpart == 0) return;
 
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
     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]));
        }
+       Rndm(random,2);
+       time += fOsigma[2]/TMath::Ccgs()*
+         TMath::Cos(2*random[0]*TMath::Pi())*
+         TMath::Sqrt(-2*TMath::Log(random[1]));
     }
     Float_t thetaInterval = 0.;
     if (fNpart > 1) {
@@ -122,8 +114,12 @@ void AliGenThetaSlice::Generate()
                origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                    TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
+           Rndm(random,2);
+           time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+             TMath::Cos(2*random[0]*TMath::Pi())*
+             TMath::Sqrt(-2*TMath::Log(random[1]));
        }
-       SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
+       PushTrack(fTrackIt,-1,fIpart,p,origin,polar,time,kPPrimary,nt);
     }
 }