]>
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 | ||
16 | /* | |
17 | $Log$ | |
18 | */ | |
19 | ||
20 | /////////////////////////////////////////////////////////////////////////////// | |
21 | // // | |
22 | // Particle generator for the simplescopic TRD simulator // | |
23 | // // | |
24 | /////////////////////////////////////////////////////////////////////////////// | |
25 | ||
26 | #include <stdlib.h> | |
27 | ||
28 | #include <TRandom.h> | |
29 | ||
30 | #include "AliTRDsimpleGen.h" | |
31 | #include "AliTRDsimpleMC.h" | |
32 | ||
33 | ClassImp(AliTRDsimpleGen) | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | AliTRDsimpleGen::AliTRDsimpleGen():TObject() | |
37 | { | |
38 | // | |
39 | // AliTRDsimpleGen default constructor | |
40 | // | |
41 | ||
42 | fPdg = 211; | |
43 | fMomMin = 1.0; | |
44 | fMomMax = 1.0; | |
45 | ||
46 | } | |
47 | ||
48 | //_____________________________________________________________________________ | |
49 | AliTRDsimpleGen::AliTRDsimpleGen(const AliTRDsimpleGen &g) | |
50 | { | |
51 | // | |
52 | // AliTRDsimpleGen copy constructor | |
53 | // | |
54 | ||
55 | ((AliTRDsimpleGen &) g).Copy(*this); | |
56 | ||
57 | } | |
58 | ||
59 | //_____________________________________________________________________________ | |
60 | AliTRDsimpleGen::~AliTRDsimpleGen() | |
61 | { | |
62 | // | |
63 | // AliTRDsimpleGen destructor | |
64 | // | |
65 | ||
66 | } | |
67 | ||
68 | //_____________________________________________________________________________ | |
69 | AliTRDsimpleGen &AliTRDsimpleGen::operator=(const AliTRDsimpleGen &g) | |
70 | { | |
71 | // | |
72 | // Assignment operator | |
73 | // | |
74 | ||
75 | if (this != &g) ((AliTRDsimpleGen &) g).Copy(*this); | |
76 | return *this; | |
77 | ||
78 | } | |
79 | ||
80 | //_____________________________________________________________________________ | |
81 | void AliTRDsimpleGen::Copy(TObject &g) | |
82 | { | |
83 | // | |
84 | // Copy function | |
85 | // | |
86 | ||
87 | ((AliTRDsimpleGen &) g).fPdg = fPdg; | |
88 | ((AliTRDsimpleGen &) g).fMomMin = fMomMin; | |
89 | ((AliTRDsimpleGen &) g).fMomMax = fMomMax; | |
90 | ||
91 | } | |
92 | ||
93 | //_____________________________________________________________________________ | |
94 | void AliTRDsimpleGen::NewParticle(Int_t ievent) | |
95 | { | |
96 | // | |
97 | // Generate a new particle and initialize the MC object | |
98 | // | |
99 | ||
100 | if (ievent == 0) { | |
101 | printf("\n"); | |
102 | printf("<AliTRDsimpleGen> Generate particles with PDG code %d\n",fPdg); | |
103 | if (fMomMax > fMomMin) { | |
104 | printf("<AliTRDsimpleGen> Momentum range = %4.2f - %4.2f GeV/c\n" | |
105 | ,fMomMin,fMomMax); | |
106 | } | |
107 | else { | |
108 | printf("<AliTRDsimpleGen> Fixed momentum = %4.2f GeV/c\n" | |
109 | ,fMomMax); | |
110 | } | |
111 | printf("\n"); | |
112 | } | |
113 | ||
114 | Double_t p = fMomMax; | |
115 | if (fMomMax > fMomMin) { | |
116 | p = (fMomMax - fMomMin) * gRandom->Rndm() + fMomMin; | |
117 | } | |
118 | ||
119 | Double_t px = p; | |
120 | Double_t py = 0.0; | |
121 | Double_t pz = 0.0; | |
122 | ||
123 | ((AliTRDsimpleMC *) gMC)->NewTrack(ievent,fPdg,px,py,pz); | |
124 | ||
125 | } |