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 Revision 1.11 2001/01/26 19:58:48 hristov
19 Major upgrade of AliRoot code
21 Revision 1.10 2000/12/21 15:30:18 fca
22 Correcting coding convention violations
24 Revision 1.9 2000/10/04 10:08:01 fca
25 Correction of minor typing mistakes
27 Revision 1.8 2000/10/02 21:28:14 fca
28 Removal of useless dependecies via forward declarations
30 Revision 1.7 2000/07/12 08:56:25 fca
31 Coding convention correction and warning removal
33 Revision 1.6 2000/07/11 18:24:59 fca
34 Coding convention corrections + few minor bug fixes
36 Revision 1.5 2000/06/08 13:34:50 fca
37 Better control of momentum range in GenBox
39 Revision 1.4 1999/09/29 09:24:29 fca
40 Introduction of the Copyright and cvs Log
44 ///////////////////////////////////////////////////////////////////
46 // Generate the final state of the interaction as the input //
47 // to the MonteCarlo //
51 <img src="picts/AliGeneratorClass.gif">
54 <font size=+2 color=red>
55 <p>The responsible person for this module is
56 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
62 ///////////////////////////////////////////////////////////////////
64 #include "AliGenerator.h"
65 #include "TGenerator.h"
68 ClassImp(AliGenerator)
70 TGenerator* AliGenerator::fgMCEvGen=0;
72 //____________________________________________________________
73 AliGenerator::AliGenerator()
76 // Default constructor
78 if (gAlice->GetDebug()>0)
79 printf("\n AliGenerator Default Constructor\n\n");
81 gAlice->SetGenerator(this);
82 SetThetaRange(); ResetBit(kThetaRange);
83 SetPhiRange(); ResetBit(kPhiRange);
84 SetMomentumRange(); ResetBit(kMomentumRange);
85 SetPtRange(); ResetBit(kPtRange);
86 SetYRange(); ResetBit(kYRange);
94 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
95 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
96 fVertex[0]=fVertex[1]=fVertex[2]=0;
99 fVMin[0]=fVMin[1]=fVMin[2]=0;
101 fVMax[0]=fVMax[1]=fVMax[2]=10000;
104 //____________________________________________________________
105 AliGenerator::AliGenerator(Int_t npart)
109 // Standard constructor
111 if (gAlice->GetDebug()>0)
112 printf("\n AliGenerator Constructor initializing number of particles \n\n");
113 gAlice->SetGenerator(this);
114 SetThetaRange(); ResetBit(kThetaRange);
115 SetPhiRange(); ResetBit(kPhiRange);
116 SetMomentumRange(); ResetBit(kMomentumRange);
117 SetPtRange(); ResetBit(kPtRange);
118 SetYRange(); ResetBit(kYRange);
125 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
126 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
127 fVertex[0]=fVertex[1]=fVertex[2]=0;
130 fVMin[0]=fVMin[1]=fVMin[2]=0;
132 fVMax[0]=fVMax[1]=fVMax[2]=10000;
134 SetNumberParticles(npart);
137 //____________________________________________________________
138 AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ")
146 //____________________________________________________________
147 AliGenerator & AliGenerator::operator=(const AliGenerator &gen)
150 // Assignment operator
156 //____________________________________________________________
157 void AliGenerator::Copy(AliGenerator &/* gen */) const
160 // Copy *this onto gen
162 Fatal("Copy","Not implemented!\n");
165 //____________________________________________________________
166 AliGenerator::~AliGenerator()
176 void AliGenerator::Init()
179 // Dummy initialisation
183 //_______________________________________________________________________
184 void AliGenerator::SetOrigin(Float_t ox, Float_t oy, Float_t oz)
187 // Set the vertex for the generated tracks
194 //_______________________________________________________________________
195 void AliGenerator::SetOrigin(const TLorentzVector &o)
198 // Set the vertex for the generated tracks
205 //_______________________________________________________________________
206 void AliGenerator::SetSigma(Float_t sx, Float_t sy, Float_t sz)
209 // Set the spread of the vertex
216 //_______________________________________________________________________
217 void AliGenerator::SetMomentumRange(Float_t pmin, Float_t pmax)
220 // Set the momentum range for the generated particles
224 SetBit(kMomentumRange);
227 //_______________________________________________________________________
228 void AliGenerator::SetPtRange(Float_t ptmin, Float_t ptmax)
231 // Set the Pt range for the generated particles
238 //_______________________________________________________________________
239 void AliGenerator::SetPhiRange(Float_t phimin, Float_t phimax)
242 // Set the Phi range for the generated particles
244 fPhiMin = TMath::Pi()*phimin/180;
245 fPhiMax = TMath::Pi()*phimax/180; SetBit(kPhiRange);
248 //_______________________________________________________________________
249 void AliGenerator::SetYRange(Float_t ymin, Float_t ymax)
252 // Set the Rapidity range for the generated particles
259 //_______________________________________________________________________
260 void AliGenerator::SetVRange(Float_t vxmin, Float_t vxmax,
261 Float_t vymin, Float_t vymax,
262 Float_t vzmin, Float_t vzmax)
265 // Set the vertex range for the generated particles
267 fVMin[0]=vxmin; fVMin[1]=vymin; fVMin[2]=vzmin;
268 fVMax[0]=vxmax; fVMax[1]=vymax; fVMax[2]=vzmax;
269 SetBit(kVertexRange);
272 //_______________________________________________________________________
273 void AliGenerator::SetThetaRange(Float_t thetamin, Float_t thetamax)
276 // Set the theta range for the generated particles
278 fThetaMin = TMath::Pi()*thetamin/180;
279 fThetaMax = TMath::Pi()*thetamax/180; SetBit(kThetaRange);
282 void AliGenerator::Vertex()
285 // Obtain vertex for current event from external source or calculated (internal)
287 if (fVertexSource == kInternal) {
295 void AliGenerator::VertexExternal()
298 // Obtain vertex from external source
300 // Should be something like fVertex = gAlice->GetVertex()
302 fVertex[0]=fVertex[1]=fVertex[2]=0;
305 void AliGenerator::VertexInternal()
308 // Obtain calculated vertex
309 // Default is gaussian smearing
312 for (Int_t j = 0; j<3 ; j++) {
314 fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
315 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));