1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // Particle generator for the simplescopic TRD simulator //
22 ///////////////////////////////////////////////////////////////////////////////
27 #include <TMCProcess.h>
31 #include "AliTRDsimpleGen.h"
32 #include "AliTRDsimpleMC.h"
35 ClassImp(AliTRDsimpleGen)
37 //_____________________________________________________________________________
38 AliTRDsimpleGen::AliTRDsimpleGen():TObject()
41 // AliTRDsimpleGen default constructor
50 //_____________________________________________________________________________
51 AliTRDsimpleGen::AliTRDsimpleGen(const AliTRDsimpleGen &g):TObject(g)
54 // AliTRDsimpleGen copy constructor
57 ((AliTRDsimpleGen &) g).Copy(*this);
61 //_____________________________________________________________________________
62 AliTRDsimpleGen::~AliTRDsimpleGen()
65 // AliTRDsimpleGen destructor
70 //_____________________________________________________________________________
71 AliTRDsimpleGen &AliTRDsimpleGen::operator=(const AliTRDsimpleGen &g)
74 // Assignment operator
77 if (this != &g) ((AliTRDsimpleGen &) g).Copy(*this);
82 //_____________________________________________________________________________
83 void AliTRDsimpleGen::Copy(TObject &g)
89 ((AliTRDsimpleGen &) g).fPdg = fPdg;
90 ((AliTRDsimpleGen &) g).fMomMin = fMomMin;
91 ((AliTRDsimpleGen &) g).fMomMax = fMomMax;
95 //_____________________________________________________________________________
96 void AliTRDsimpleGen::NewParticle(Int_t ievent)
99 // Generate a new particle and initialize the MC object
104 printf("<AliTRDsimpleGen> Generate particles with PDG code %d\n",fPdg);
105 if (fMomMax > fMomMin) {
106 printf("<AliTRDsimpleGen> Momentum range = %4.2f - %4.2f GeV/c\n"
110 printf("<AliTRDsimpleGen> Fixed momentum = %4.2f GeV/c\n"
115 // Add one dummy particle to the stack so that AddHit will work
116 Float_t mom[3] = { 0.0 };
117 Float_t vtx[3] = { 0.0 };
118 Float_t pol[3] = { 0.0 };
120 gAlice->GetMCApp()->PushTrack(0,-1,fPdg,mom,vtx,pol,0.0,kPPrimary,ntr);
124 Double_t p = fMomMax;
125 if (fMomMax > fMomMin) {
126 p = (fMomMax - fMomMin) * gRandom->Rndm() + fMomMin;
133 ((AliTRDsimpleMC *) gMC)->NewTrack(ievent,fPdg,px,py,pz);