]>
Commit | Line | Data |
---|---|---|
16bf9884 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
88cb7938 | 16 | /* $Id$ */ |
16bf9884 | 17 | |
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Particle generator for the simplescopic TRD simulator // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <stdlib.h> | |
25 | ||
26 | #include <TRandom.h> | |
ee7e3ede | 27 | #include <TMCProcess.h> |
28 | ||
29 | #include "AliRun.h" | |
16bf9884 | 30 | |
31 | #include "AliTRDsimpleGen.h" | |
32 | #include "AliTRDsimpleMC.h" | |
33 | ||
34 | ClassImp(AliTRDsimpleGen) | |
35 | ||
36 | //_____________________________________________________________________________ | |
37 | AliTRDsimpleGen::AliTRDsimpleGen():TObject() | |
38 | { | |
39 | // | |
40 | // AliTRDsimpleGen default constructor | |
41 | // | |
42 | ||
43 | fPdg = 211; | |
44 | fMomMin = 1.0; | |
45 | fMomMax = 1.0; | |
46 | ||
47 | } | |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliTRDsimpleGen::AliTRDsimpleGen(const AliTRDsimpleGen &g) | |
51 | { | |
52 | // | |
53 | // AliTRDsimpleGen copy constructor | |
54 | // | |
55 | ||
56 | ((AliTRDsimpleGen &) g).Copy(*this); | |
57 | ||
58 | } | |
59 | ||
60 | //_____________________________________________________________________________ | |
61 | AliTRDsimpleGen::~AliTRDsimpleGen() | |
62 | { | |
63 | // | |
64 | // AliTRDsimpleGen destructor | |
65 | // | |
66 | ||
67 | } | |
68 | ||
69 | //_____________________________________________________________________________ | |
70 | AliTRDsimpleGen &AliTRDsimpleGen::operator=(const AliTRDsimpleGen &g) | |
71 | { | |
72 | // | |
73 | // Assignment operator | |
74 | // | |
75 | ||
76 | if (this != &g) ((AliTRDsimpleGen &) g).Copy(*this); | |
77 | return *this; | |
78 | ||
79 | } | |
80 | ||
81 | //_____________________________________________________________________________ | |
82 | void AliTRDsimpleGen::Copy(TObject &g) | |
83 | { | |
84 | // | |
85 | // Copy function | |
86 | // | |
87 | ||
88 | ((AliTRDsimpleGen &) g).fPdg = fPdg; | |
89 | ((AliTRDsimpleGen &) g).fMomMin = fMomMin; | |
90 | ((AliTRDsimpleGen &) g).fMomMax = fMomMax; | |
91 | ||
92 | } | |
93 | ||
94 | //_____________________________________________________________________________ | |
95 | void AliTRDsimpleGen::NewParticle(Int_t ievent) | |
96 | { | |
97 | // | |
98 | // Generate a new particle and initialize the MC object | |
99 | // | |
100 | ||
101 | if (ievent == 0) { | |
102 | printf("\n"); | |
103 | printf("<AliTRDsimpleGen> Generate particles with PDG code %d\n",fPdg); | |
104 | if (fMomMax > fMomMin) { | |
105 | printf("<AliTRDsimpleGen> Momentum range = %4.2f - %4.2f GeV/c\n" | |
106 | ,fMomMin,fMomMax); | |
107 | } | |
108 | else { | |
109 | printf("<AliTRDsimpleGen> Fixed momentum = %4.2f GeV/c\n" | |
110 | ,fMomMax); | |
111 | } | |
112 | printf("\n"); | |
ee7e3ede | 113 | |
114 | // Add one dummy particle to the stack so that AddHit will work | |
115 | Float_t mom[3] = { 0.0 }; | |
116 | Float_t vtx[3] = { 0.0 }; | |
117 | Float_t pol[3] = { 0.0 }; | |
118 | Int_t ntr = 0; | |
642f15cf | 119 | gAlice->PushTrack(0,-1,fPdg,mom,vtx,pol,0.0,kPPrimary,ntr); |
ee7e3ede | 120 | |
16bf9884 | 121 | } |
122 | ||
123 | Double_t p = fMomMax; | |
124 | if (fMomMax > fMomMin) { | |
125 | p = (fMomMax - fMomMin) * gRandom->Rndm() + fMomMin; | |
126 | } | |
127 | ||
128 | Double_t px = p; | |
129 | Double_t py = 0.0; | |
130 | Double_t pz = 0.0; | |
131 | ||
132 | ((AliTRDsimpleMC *) gMC)->NewTrack(ievent,fPdg,px,py,pz); | |
133 | ||
134 | } |