]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliGenerator.cxx
Major upgrade of AliRoot code
[u/mrichter/AliRoot.git] / STEER / AliGenerator.cxx
CommitLineData
4c039060 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$
2ab0c725 18Revision 1.10 2000/12/21 15:30:18 fca
19Correcting coding convention violations
20
b23a502f 21Revision 1.9 2000/10/04 10:08:01 fca
22Correction of minor typing mistakes
23
ca3a341c 24Revision 1.8 2000/10/02 21:28:14 fca
25Removal of useless dependecies via forward declarations
26
94de3818 27Revision 1.7 2000/07/12 08:56:25 fca
28Coding convention correction and warning removal
29
8918e700 30Revision 1.6 2000/07/11 18:24:59 fca
31Coding convention corrections + few minor bug fixes
32
aee8290b 33Revision 1.5 2000/06/08 13:34:50 fca
34Better control of momentum range in GenBox
35
de6d59e3 36Revision 1.4 1999/09/29 09:24:29 fca
37Introduction of the Copyright and cvs Log
38
4c039060 39*/
40
fe4da5cc 41///////////////////////////////////////////////////////////////////
42// //
43// Generate the final state of the interaction as the input //
44// to the MonteCarlo //
45//
46//Begin_Html
47/*
1439f98e 48<img src="picts/AliGeneratorClass.gif">
fe4da5cc 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"
b23a502f 62#include "TGenerator.h"
fe4da5cc 63#include "AliRun.h"
64
65ClassImp(AliGenerator)
66
67TGenerator* AliGenerator::fgMCEvGen=0;
68
69//____________________________________________________________
70AliGenerator::AliGenerator()
71{
aee8290b 72 //
73 // Default constructor
74 //
2ab0c725 75 if (gAlice->GetDebug()>0)
76 printf("\n AliGenerator Default Constructor\n\n");
4a3ba9d2 77
fe4da5cc 78 gAlice->SetGenerator(this);
de6d59e3 79 SetThetaRange(); ResetBit(kThetaRange);
80 SetPhiRange(); ResetBit(kPhiRange);
81 SetMomentumRange(); ResetBit(kMomentumRange);
82 SetPtRange(); ResetBit(kPtRange);
83 SetYRange(); ResetBit(kYRange);
fe4da5cc 84 SetNumberParticles();
4a3ba9d2 85 SetTrackingFlag();
de6d59e3 86
fe4da5cc 87 fOrigin.Set(3);
88 fOsigma.Set(3);
89 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
90 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
de6d59e3 91 fVMin.Set(3);
92 fVMin[0]=fVMin[1]=fVMin[2]=0;
93 fVMax.Set(3);
94 fVMax[0]=fVMax[1]=fVMax[2]=10000;
fe4da5cc 95}
96
97//____________________________________________________________
98AliGenerator::AliGenerator(Int_t npart)
99 : TNamed(" "," ")
100{
aee8290b 101 //
102 // Standard constructor
103 //
2ab0c725 104 if (gAlice->GetDebug()>0)
105 printf("\n AliGenerator Constructor initializing number of particles \n\n");
fe4da5cc 106 gAlice->SetGenerator(this);
de6d59e3 107 SetThetaRange(); ResetBit(kThetaRange);
108 SetPhiRange(); ResetBit(kPhiRange);
109 SetMomentumRange(); ResetBit(kMomentumRange);
110 SetPtRange(); ResetBit(kPtRange);
111 SetYRange(); ResetBit(kYRange);
4a3ba9d2 112 SetTrackingFlag();
de6d59e3 113
fe4da5cc 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;
de6d59e3 122
123 SetNumberParticles(npart);
fe4da5cc 124}
125
aee8290b 126//____________________________________________________________
127AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ")
128{
129 //
130 // Copy constructor
131 //
132 gen.Copy(*this);
133}
134
135//____________________________________________________________
136AliGenerator & AliGenerator::operator=(const AliGenerator &gen)
137{
138 //
139 // Assignment operator
140 //
141 gen.Copy(*this);
142 return (*this);
143}
144
145//____________________________________________________________
8918e700 146void AliGenerator::Copy(AliGenerator &/* gen */) const
aee8290b 147{
148 //
149 // Copy *this onto gen
150 //
151 Fatal("Copy","Not implemented!\n");
152}
153
fe4da5cc 154//____________________________________________________________
155AliGenerator::~AliGenerator()
156{
aee8290b 157 //
158 // Destructor
159 //
fe4da5cc 160 fOrigin.Set(0);
161 fOsigma.Set(0);
162 delete fgMCEvGen;
163}
164
165void AliGenerator::Init()
166{
aee8290b 167 //
168 // Dummy initialisation
169 //
fe4da5cc 170}
171
94de3818 172//_______________________________________________________________________
173void 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//_______________________________________________________________________
184void 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//_______________________________________________________________________
195void 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//_______________________________________________________________________
206void 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//_______________________________________________________________________
217void 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//_______________________________________________________________________
228void 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//_______________________________________________________________________
ca3a341c 238void AliGenerator::SetYRange(Float_t ymin, Float_t ymax)
94de3818 239{
240 //
241 // Set the Rapidity range for the generated particles
242 //
243 fYMin=ymin;
244 fYMax=ymax;
245 SetBit(kYRange);
246}
247
248//_______________________________________________________________________
249void 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}
fe4da5cc 260
94de3818 261//_______________________________________________________________________
262void 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}