]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenSlowNucleons.cxx
bug 87732: memory leak fixed
[u/mrichter/AliRoot.git] / EVGEN / AliGenSlowNucleons.cxx
index 15419b10c10ec4e0a4e02c8d59a5a2c4cf9a4dd3..569f5f2a5012d209fb0eb7a4a1cf43c751e6dac8 100644 (file)
 #include "AliGenSlowNucleons.h"
 #include "AliSlowNucleonModel.h"
 
- ClassImp(AliGenSlowNucleons)
+ClassImp(AliGenSlowNucleons)
+
     
- AliGenSlowNucleons::AliGenSlowNucleons():AliGenerator(-1)
+AliGenSlowNucleons::AliGenSlowNucleons()
+    :AliGenerator(-1),
+     fCMS(0.),
+     fMomentum(0.),
+     fBeta(0.),
+     fPmax (0.),
+     fATarget (0.),
+     fZTarget (0.),
+     fCharge(0),
+     fProtonDirection(1.),
+     fTemperatureG(0.), 
+     fBetaSourceG(0.),
+     fTemperatureB(0.),
+     fBetaSourceB(0.),
+     fNgp(0),
+     fNgn(0),
+     fNbp(0),
+     fNbn(0),
+     fDebug(0),
+     fDebugHist1(0),
+     fDebugHist2(0),
+     fThetaDistribution(),
+     fCosThetaGrayHist(),
+     fCosTheta(),
+     fSlowNucleonModel(0)
 {
 // Default constructor
-    fSlowNucleonModel = 0;
     fCollisionGeometry = 0;
 }
 
 AliGenSlowNucleons::AliGenSlowNucleons(Int_t npart)
-    :AliGenerator(npart)
+    :AliGenerator(npart),
+     fCMS(14000.),
+     fMomentum(0.),
+     fBeta(0.),
+     fPmax (10.),
+     fATarget (208.),
+     fZTarget (82.),
+     fCharge(1),
+     fProtonDirection(1.),
+     fTemperatureG(0.04), 
+     fBetaSourceG(0.05),
+     fTemperatureB(0.004),
+     fBetaSourceB(0.),
+     fNgp(0),
+     fNgn(0),
+     fNbp(0),
+     fNbn(0),
+     fDebug(0),
+     fDebugHist1(0),
+     fDebugHist2(0),
+     fThetaDistribution(),
+     fCosThetaGrayHist(),
+     fCosTheta(),
+     fSlowNucleonModel(new AliSlowNucleonModel())
 {
 // Constructor
     fName  = "SlowNucleons";
     fTitle = "Generator for gray particles in pA collisions";
-    SetPmax();
-    SetTarget();
-    SetNominalCmsEnergy();
-    SetCharge();
-    SetTemperature();
-    SetBetaSource();
-    fSlowNucleonModel = new AliSlowNucleonModel();
     fCollisionGeometry = 0;
-    fDebug = 0;
-}
-
-//____________________________________________________________
-AliGenSlowNucleons::AliGenSlowNucleons(const AliGenSlowNucleons & sn):
-    AliGenerator(sn)
-{
-// Copy constructor
-    sn.Copy(*this);
 }
 
 //____________________________________________________________
@@ -149,6 +180,7 @@ void AliGenSlowNucleons::Generate()
    //
     Float_t p[3], theta=0;
     Float_t origin[3] = {0., 0., 0.};
+    Float_t time = 0.;
     Float_t polar [3] = {0., 0., 0.};    
     Int_t nt, i, j;
     Int_t kf;
@@ -156,6 +188,7 @@ void AliGenSlowNucleons::Generate()
     if(fVertexSmear == kPerEvent) {
        Vertex();
        for (j=0; j < 3; j++) origin[j] = fVertex[j];
+       time = fTime;
     } // if kPerEvent
 //
 //  Gray protons
@@ -166,7 +199,7 @@ void AliGenSlowNucleons::Generate()
        GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p, theta);
        if (fDebug) fCosThetaGrayHist->Fill(TMath::Cos(theta));
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 //
@@ -178,7 +211,7 @@ void AliGenSlowNucleons::Generate()
        GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p, theta);
        if (fDebug) fCosThetaGrayHist->Fill(TMath::Cos(theta));
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 //
@@ -189,7 +222,7 @@ void AliGenSlowNucleons::Generate()
     for(i = 0; i < fNbp; i++) {
        GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p, theta);
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 //
@@ -200,7 +233,7 @@ void AliGenSlowNucleons::Generate()
     for(i = 0; i < fNbn; i++) {
        GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p, theta);
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 }
@@ -279,30 +312,7 @@ void AliGenSlowNucleons::Lorentz(Double_t m, Double_t beta, Float_t* q)
 {
 /* Lorentz transform in the direction of q[2] */
  
-    Double_t gamma  = 1/sqrt(1-beta*beta); 
+    Double_t gamma  = 1./sqrt((1.-beta)*(1.+beta)); 
     Double_t energy = sqrt(m*m + q[0]*q[0] + q[1]*q[1] + q[2]*q[2]);
     q[2] = gamma * (q[2] + beta*energy);
 }
-
-         
-AliGenSlowNucleons& AliGenSlowNucleons::operator=(const  AliGenSlowNucleons& rhs)
-{
-// Assignment operator
-    rhs.Copy(*this);
-    return *this;
-}
-
-void AliGenSlowNucleons::Copy(TObject&) const
-{
-    //
-    // Copy 
-    //
-    Fatal("Copy","Not implemented!\n");
-}
-
-
-
-
-
-
-