]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenFLUKAsource.cxx
Coding conventions (Annalisa)
[u/mrichter/AliRoot.git] / EVGEN / AliGenFLUKAsource.cxx
index 31abcdfb6d1d2178e60349a98ddbfdb370e02eab..118ac532ce782b325c16bfe774cef59c17df5a7e 100644 (file)
 // Files can be chained. 
 // Author: andreas.morsch@cern.ch
 
-#include "TPDGCode.h"
-
 #include "AliGenFLUKAsource.h"
-#include "AliRun.h"
-
+#include <stdlib.h>
 
+#include <TDatabasePDG.h>
+#include <TPDGCode.h>
+#include <RVersion.h>
+#include <TChain.h>
 #include <TFile.h>
 #include <TTree.h>
-#include <TChain.h>
-#include <stdlib.h>
- ClassImp(AliGenFLUKAsource)
-     AliGenFLUKAsource::AliGenFLUKAsource()
+#include <TVirtualMC.h>
+
+#include "AliRun.h"
+
+ClassImp(AliGenFLUKAsource)
+
+AliGenFLUKAsource::AliGenFLUKAsource()
         :AliGenerator(-1)
 {
     // Constructor
@@ -86,9 +90,11 @@ AliGenFLUKAsource::AliGenFLUKAsource(Int_t npart)
     fSourceId=-1;
 }
 
-AliGenFLUKAsource::AliGenFLUKAsource(const AliGenFLUKAsource & FLUKAsource)
+AliGenFLUKAsource::AliGenFLUKAsource(const AliGenFLUKAsource & FLUKAsource):
+    AliGenerator(FLUKAsource)
 {
-// copy constructor
+// Copy constructor
+    FLUKAsource.Copy(*this);
 }
 
 
@@ -151,9 +157,7 @@ void AliGenFLUKAsource::Generate()
     Float_t prwn;
     Float_t wgt, fwgt;
     Float_t phi;
-    char name[100];
-    Float_t amass, charge, tlife;
-    Int_t itrtyp;
+    Float_t amass;
     Int_t iwgt;
     Int_t i, j, part, nt;
     static Int_t irwn=0;
@@ -224,8 +228,11 @@ void AliGenFLUKAsource::Generate()
        part=kIfluge[int(ifip)-1];      
 //
 // Calculate momentum from kinetic energy and mass of the particle
-       gMC->Gfpart(part, name, itrtyp,  
-                   amass, charge, tlife); 
+#if ROOT_VERSION_CODE > 197895
+        amass = gMC->ParticleMass(part);
+#else
+       amass = (TDatabasePDG::Instance())->GetParticle(part)->Mass();
+#endif
        prwn=fEkin*sqrt(1. + 2.*amass/fEkin);
 
 
@@ -246,7 +253,7 @@ void AliGenFLUKAsource::Generate()
        if (part==1 && iwgt>100) iwgt=100;
        Int_t nstack=0;
        for (j=0; j<iwgt; j++) {
-           SetTrack(fTrackIt,-1,part,p,origin,polar,fAge,kPPrimary,nt);
+           PushTrack(fTrackIt,-1,part,p,origin,polar,fAge,kPPrimary,nt);
            Rndm(random,2);
            phi=2*random[1]*TMath::Pi();
            Float_t pn1=p[0]*TMath::Sin(phi) - p[1]*TMath::Cos(phi);
@@ -278,10 +285,16 @@ void AliGenFLUKAsource::Generate()
 AliGenFLUKAsource& AliGenFLUKAsource::operator=(const  AliGenFLUKAsource& rhs)
 {
 // Assignment operator
-    return *this;
+    rhs.Copy(*this);
+    return (*this);
 }
 
 
+void AliGenFLUKAsource::Copy(TObject &) const
+{
+    Fatal("Copy","Not implemented!\n");
+}
+