]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliGenerator.cxx
Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / STEER / AliGenerator.cxx
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 Revision 1.10  2000/12/21 15:30:18  fca
19 Correcting coding convention violations
20
21 Revision 1.9  2000/10/04 10:08:01  fca
22 Correction of minor typing mistakes
23
24 Revision 1.8  2000/10/02 21:28:14  fca
25 Removal of useless dependecies via forward declarations
26
27 Revision 1.7  2000/07/12 08:56:25  fca
28 Coding convention correction and warning removal
29
30 Revision 1.6  2000/07/11 18:24:59  fca
31 Coding convention corrections + few minor bug fixes
32
33 Revision 1.5  2000/06/08 13:34:50  fca
34 Better control of momentum range in GenBox
35
36 Revision 1.4  1999/09/29 09:24:29  fca
37 Introduction of the Copyright and cvs Log
38
39 */
40
41 ///////////////////////////////////////////////////////////////////
42 //                                                               //
43 //    Generate the final state of the interaction as the input   //
44 //    to the MonteCarlo                                          //
45 //
46 //Begin_Html
47 /*
48 <img src="picts/AliGeneratorClass.gif">
49 </pre>
50 <br clear=left>
51 <font size=+2 color=red>
52 <p>The responsible person for this module is
53 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
54 </font>
55 <pre>
56 */
57 //End_Html
58 //                                                               //
59 ///////////////////////////////////////////////////////////////////
60
61 #include "AliGenerator.h"
62 #include "TGenerator.h"
63 #include "AliRun.h"
64
65 ClassImp(AliGenerator)
66
67 TGenerator* AliGenerator::fgMCEvGen=0;
68
69 //____________________________________________________________
70 AliGenerator::AliGenerator()
71 {
72   //
73   // Default constructor
74   //
75     if (gAlice->GetDebug()>0)
76         printf("\n AliGenerator Default Constructor\n\n");
77     
78     gAlice->SetGenerator(this);
79     SetThetaRange(); ResetBit(kThetaRange);
80     SetPhiRange(); ResetBit(kPhiRange);
81     SetMomentumRange(); ResetBit(kMomentumRange);
82     SetPtRange(); ResetBit(kPtRange);
83     SetYRange(); ResetBit(kYRange);
84     SetNumberParticles();
85     SetTrackingFlag();
86
87     fOrigin.Set(3);
88     fOsigma.Set(3);
89     fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
90     fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
91     fVMin.Set(3);
92     fVMin[0]=fVMin[1]=fVMin[2]=0;
93     fVMax.Set(3);
94     fVMax[0]=fVMax[1]=fVMax[2]=10000;
95 }
96
97 //____________________________________________________________
98 AliGenerator::AliGenerator(Int_t npart)
99     : TNamed(" "," ")
100 {
101   //
102   // Standard constructor
103   //
104     if (gAlice->GetDebug()>0)
105         printf("\n AliGenerator Constructor initializing number of particles \n\n");
106     gAlice->SetGenerator(this);
107     SetThetaRange(); ResetBit(kThetaRange);
108     SetPhiRange(); ResetBit(kPhiRange);
109     SetMomentumRange(); ResetBit(kMomentumRange);
110     SetPtRange(); ResetBit(kPtRange);
111     SetYRange(); ResetBit(kYRange);
112     SetTrackingFlag();
113
114     fOrigin.Set(3);
115     fOsigma.Set(3);
116     fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
117     fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
118     fVMin.Set(3);
119     fVMin[0]=fVMin[1]=fVMin[2]=0;
120     fVMax.Set(3);
121     fVMax[0]=fVMax[1]=fVMax[2]=10000;
122
123     SetNumberParticles(npart);
124 }
125
126 //____________________________________________________________
127 AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ")
128 {
129   //
130   // Copy constructor
131   //
132   gen.Copy(*this);
133 }
134
135 //____________________________________________________________
136 AliGenerator & AliGenerator::operator=(const AliGenerator &gen)
137 {
138   //
139   // Assignment operator
140   //
141   gen.Copy(*this);
142   return (*this);
143 }
144
145 //____________________________________________________________
146 void AliGenerator::Copy(AliGenerator &/* gen */) const
147 {
148   //
149   // Copy *this onto gen
150   //
151   Fatal("Copy","Not implemented!\n");
152 }
153
154 //____________________________________________________________
155 AliGenerator::~AliGenerator()
156 {
157   //
158   // Destructor
159   //
160   fOrigin.Set(0);
161   fOsigma.Set(0);
162   delete fgMCEvGen;
163 }
164
165 void AliGenerator::Init()
166 {   
167   //
168   // Dummy initialisation
169   //
170 }
171
172 //_______________________________________________________________________
173 void AliGenerator::SetOrigin(Float_t ox, Float_t oy, Float_t oz)
174 {
175   //
176   // Set the vertex for the generated tracks
177   //
178   fOrigin[0]=ox;
179   fOrigin[1]=oy;
180   fOrigin[2]=oz;
181 }
182
183 //_______________________________________________________________________
184 void AliGenerator::SetOrigin(const TLorentzVector &o)
185 {
186   //
187   // Set the vertex for the generated tracks
188   //
189   fOrigin[0]=o[0];
190   fOrigin[1]=o[1];
191   fOrigin[2]=o[2];
192 }
193
194 //_______________________________________________________________________
195 void AliGenerator::SetSigma(Float_t sx, Float_t sy, Float_t sz)
196 {
197   //
198   // Set the spread of the vertex
199   //
200   fOsigma[0]=sx;
201   fOsigma[1]=sy;
202   fOsigma[2]=sz;
203 }
204
205 //_______________________________________________________________________
206 void AliGenerator::SetMomentumRange(Float_t pmin, Float_t pmax)
207 {
208   //
209   // Set the momentum range for the generated particles
210   //
211   fPMin = pmin;
212   fPMax = pmax;
213   SetBit(kMomentumRange);
214 }
215
216 //_______________________________________________________________________
217 void AliGenerator::SetPtRange(Float_t ptmin, Float_t ptmax)
218 {
219   //
220   // Set the Pt range for the generated particles
221   //
222   fPtMin = ptmin;
223   fPtMax = ptmax;
224   SetBit(kPtRange);
225 }
226
227 //_______________________________________________________________________
228 void AliGenerator::SetPhiRange(Float_t phimin, Float_t phimax)
229 {
230   //
231   // Set the Phi range for the generated particles
232   //
233   fPhiMin = TMath::Pi()*phimin/180;
234   fPhiMax = TMath::Pi()*phimax/180; SetBit(kPhiRange);
235 }
236
237 //_______________________________________________________________________
238 void AliGenerator::SetYRange(Float_t ymin, Float_t ymax)
239 {
240   //
241   // Set the Rapidity range for the generated particles
242   //
243   fYMin=ymin;
244   fYMax=ymax;
245   SetBit(kYRange);
246 }
247
248 //_______________________________________________________________________
249 void AliGenerator::SetVRange(Float_t vxmin, Float_t vxmax,
250                              Float_t vymin, Float_t vymax,
251                              Float_t vzmin, Float_t vzmax)
252 {
253   //
254   // Set the vertex range for the generated particles
255   //
256   fVMin[0]=vxmin; fVMin[1]=vymin; fVMin[2]=vzmin;
257   fVMax[0]=vxmax; fVMax[1]=vymax; fVMax[2]=vzmax;
258   SetBit(kVertexRange);
259 }
260
261 //_______________________________________________________________________
262 void AliGenerator::SetThetaRange(Float_t thetamin, Float_t thetamax)
263 {
264   //
265   // Set the theta range for the generated particles
266   //
267   fThetaMin = TMath::Pi()*thetamin/180;
268   fThetaMax = TMath::Pi()*thetamax/180; SetBit(kThetaRange);
269 }