]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenFLUKAsource.cxx
MC-dependent part of AliRun extracted in AliMC (F.Carminati)
[u/mrichter/AliRoot.git] / EVGEN / AliGenFLUKAsource.cxx
index 06edd2551095ab7819929000f64363b8d6833d67..c99ef8ee3aa5fe7c1265c1b83cc17947a8872b6e 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.15  2001/07/27 17:09:36  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.14  2001/03/21 11:28:20  morsch
-Use enum constants for particle selection.
-
-Revision 1.13  2000/12/21 16:24:06  morsch
-Coding convention clean-up
-
-Revision 1.12  2000/11/30 07:12:50  alibrary
-Introducing new Rndm and QA classes
-
-Revision 1.11  2000/06/14 15:20:40  morsch
-Include clean-up (IH)
-
-Revision 1.10  2000/06/09 20:31:34  morsch
-All coding rule violations except RS3 corrected
-
-Revision 1.9  2000/03/07 13:52:54  morsch
-static Int_t irwn=0;
-
-Revision 1.8  2000/02/14 14:49:38  morsch
-Correct particle type for gamma and neutrons
-More consistent calculation of momentum from kin. energy and mass
-
-Revision 1.7  1999/11/03 17:43:20  fca
-New version from G.Martinez & A.Morsch
-
-Revision 1.6  1999/09/29 09:24:12  fca
-Introduction of the Copyright and cvs Log
-
-*/
-
-
+/* $Id$ */
 
 // Read background particles from a FLUKA boundary source file
 // This is a very special generator that works for background studies for the muon-spectrometer.
@@ -58,17 +21,22 @@ Introduction of the Copyright and cvs Log
 // Files can be chained. 
 // Author: andreas.morsch@cern.ch
 
+#include <RVersion.h>
+#include "TPDGCode.h"
+#include "TDatabasePDG.h"
+#include <TVirtualMC.h>
+
 #include "AliGenFLUKAsource.h"
 #include "AliRun.h"
-#include "AliPDG.h"
 
 
 #include <TFile.h>
 #include <TTree.h>
 #include <TChain.h>
 #include <stdlib.h>
- ClassImp(AliGenFLUKAsource)
-     AliGenFLUKAsource::AliGenFLUKAsource()
+ClassImp(AliGenFLUKAsource)
+
+AliGenFLUKAsource::AliGenFLUKAsource()
         :AliGenerator(-1)
 {
     // Constructor
@@ -122,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);
 }
 
 
@@ -187,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;
@@ -260,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);
 
 
@@ -282,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);
@@ -314,10 +285,16 @@ void AliGenFLUKAsource::Generate()
 AliGenFLUKAsource& AliGenFLUKAsource::operator=(const  AliGenFLUKAsource& rhs)
 {
 // Assignment operator
-    return *this;
+    rhs.Copy(*this);
+    return (*this);
 }
 
 
+void AliGenFLUKAsource::Copy(AliGenFLUKAsource &) const
+{
+    Fatal("Copy","Not implemented!\n");
+}
+