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.12 2001/02/02 11:12:50 morsch
19 Add Vertex() method that allows to get vertex from merging manager, if needed.
21 Revision 1.11 2001/01/26 19:58:48 hristov
22 Major upgrade of AliRoot code
24 Revision 1.10 2000/12/21 15:30:18 fca
25 Correcting coding convention violations
27 Revision 1.9 2000/10/04 10:08:01 fca
28 Correction of minor typing mistakes
30 Revision 1.8 2000/10/02 21:28:14 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.7 2000/07/12 08:56:25 fca
34 Coding convention correction and warning removal
36 Revision 1.6 2000/07/11 18:24:59 fca
37 Coding convention corrections + few minor bug fixes
39 Revision 1.5 2000/06/08 13:34:50 fca
40 Better control of momentum range in GenBox
42 Revision 1.4 1999/09/29 09:24:29 fca
43 Introduction of the Copyright and cvs Log
47 ///////////////////////////////////////////////////////////////////
49 // Generate the final state of the interaction as the input //
50 // to the MonteCarlo //
54 <img src="picts/AliGeneratorClass.gif">
57 <font size=+2 color=red>
58 <p>The responsible person for this module is
59 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
65 ///////////////////////////////////////////////////////////////////
67 #include "AliGenerator.h"
68 #include "TGenerator.h"
70 #include "AliConfig.h"
72 ClassImp(AliGenerator)
74 TGenerator* AliGenerator::fgMCEvGen=0;
76 //____________________________________________________________
77 AliGenerator::AliGenerator()
80 // Default constructor
82 if (gAlice->GetDebug()>0)
83 printf("\n AliGenerator Default Constructor\n\n");
85 gAlice->SetGenerator(this);
86 SetThetaRange(); ResetBit(kThetaRange);
87 SetPhiRange(); ResetBit(kPhiRange);
88 SetMomentumRange(); ResetBit(kMomentumRange);
89 SetPtRange(); ResetBit(kPtRange);
90 SetYRange(); ResetBit(kYRange);
98 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
99 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
100 fVertex[0]=fVertex[1]=fVertex[2]=0;
103 fVMin[0]=fVMin[1]=fVMin[2]=0;
105 fVMax[0]=fVMax[1]=fVMax[2]=10000;
108 //____________________________________________________________
109 AliGenerator::AliGenerator(Int_t npart)
113 // Standard constructor
115 if (gAlice->GetDebug()>0)
116 printf("\n AliGenerator Constructor initializing number of particles \n\n");
117 gAlice->SetGenerator(this);
118 SetThetaRange(); ResetBit(kThetaRange);
119 SetPhiRange(); ResetBit(kPhiRange);
120 SetMomentumRange(); ResetBit(kMomentumRange);
121 SetPtRange(); ResetBit(kPtRange);
122 SetYRange(); ResetBit(kYRange);
129 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
130 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
131 fVertex[0]=fVertex[1]=fVertex[2]=0;
134 fVMin[0]=fVMin[1]=fVMin[2]=0;
136 fVMax[0]=fVMax[1]=fVMax[2]=10000;
138 SetNumberParticles(npart);
140 AliConfig::Instance()->Add(this);
143 //____________________________________________________________
144 AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ")
152 //____________________________________________________________
153 AliGenerator & AliGenerator::operator=(const AliGenerator &gen)
156 // Assignment operator
162 //____________________________________________________________
163 void AliGenerator::Copy(AliGenerator &/* gen */) const
166 // Copy *this onto gen
168 Fatal("Copy","Not implemented!\n");
171 //____________________________________________________________
172 AliGenerator::~AliGenerator()
182 void AliGenerator::Init()
185 // Dummy initialisation
189 //_______________________________________________________________________
190 void AliGenerator::SetOrigin(Float_t ox, Float_t oy, Float_t oz)
193 // Set the vertex for the generated tracks
200 //_______________________________________________________________________
201 void AliGenerator::SetOrigin(const TLorentzVector &o)
204 // Set the vertex for the generated tracks
211 //_______________________________________________________________________
212 void AliGenerator::SetSigma(Float_t sx, Float_t sy, Float_t sz)
215 // Set the spread of the vertex
222 //_______________________________________________________________________
223 void AliGenerator::SetMomentumRange(Float_t pmin, Float_t pmax)
226 // Set the momentum range for the generated particles
230 SetBit(kMomentumRange);
233 //_______________________________________________________________________
234 void AliGenerator::SetPtRange(Float_t ptmin, Float_t ptmax)
237 // Set the Pt range for the generated particles
244 //_______________________________________________________________________
245 void AliGenerator::SetPhiRange(Float_t phimin, Float_t phimax)
248 // Set the Phi range for the generated particles
250 fPhiMin = TMath::Pi()*phimin/180;
251 fPhiMax = TMath::Pi()*phimax/180; SetBit(kPhiRange);
254 //_______________________________________________________________________
255 void AliGenerator::SetYRange(Float_t ymin, Float_t ymax)
258 // Set the Rapidity range for the generated particles
265 //_______________________________________________________________________
266 void AliGenerator::SetVRange(Float_t vxmin, Float_t vxmax,
267 Float_t vymin, Float_t vymax,
268 Float_t vzmin, Float_t vzmax)
271 // Set the vertex range for the generated particles
273 fVMin[0]=vxmin; fVMin[1]=vymin; fVMin[2]=vzmin;
274 fVMax[0]=vxmax; fVMax[1]=vymax; fVMax[2]=vzmax;
275 SetBit(kVertexRange);
278 //_______________________________________________________________________
279 void AliGenerator::SetThetaRange(Float_t thetamin, Float_t thetamax)
282 // Set the theta range for the generated particles
284 fThetaMin = TMath::Pi()*thetamin/180;
285 fThetaMax = TMath::Pi()*thetamax/180; SetBit(kThetaRange);
288 void AliGenerator::Vertex()
291 // Obtain vertex for current event from external source or calculated (internal)
293 if (fVertexSource == kInternal) {
301 void AliGenerator::VertexExternal()
304 // Obtain vertex from external source
306 // Should be something like fVertex = gAlice->GetVertex()
308 fVertex[0]=fVertex[1]=fVertex[2]=0;
311 void AliGenerator::VertexInternal()
314 // Obtain calculated vertex
315 // Default is gaussian smearing
318 for (Int_t j = 0; j<3 ; j++) {
320 fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
321 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));