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.17 2001/11/26 15:46:35 morsch
19 Set default value for vertex truncation in constructor.
21 Revision 1.16 2001/10/16 08:45:37 morsch
22 All vertex truncation and event vertex moved here.
24 Revision 1.15 2001/07/28 10:43:41 hristov
25 Default argument initialised once
27 Revision 1.14 2001/07/27 17:13:12 morsch
28 - SetTrack, KeepTrack and SetHighWaterMark methods added to delegate to local
29 stack or stack owned by AliRun. (Piotr Skowronski, A.M.)
30 - Changes needed for afterburners (Piotr Skowronski)
32 Revision 1.13 2001/05/16 14:57:22 alibrary
33 New files for folders and Stack
35 Revision 1.12 2001/02/02 11:12:50 morsch
36 Add Vertex() method that allows to get vertex from merging manager, if needed.
38 Revision 1.11 2001/01/26 19:58:48 hristov
39 Major upgrade of AliRoot code
41 Revision 1.10 2000/12/21 15:30:18 fca
42 Correcting coding convention violations
44 Revision 1.9 2000/10/04 10:08:01 fca
45 Correction of minor typing mistakes
47 Revision 1.8 2000/10/02 21:28:14 fca
48 Removal of useless dependecies via forward declarations
50 Revision 1.7 2000/07/12 08:56:25 fca
51 Coding convention correction and warning removal
53 Revision 1.6 2000/07/11 18:24:59 fca
54 Coding convention corrections + few minor bug fixes
56 Revision 1.5 2000/06/08 13:34:50 fca
57 Better control of momentum range in GenBox
59 Revision 1.4 1999/09/29 09:24:29 fca
60 Introduction of the Copyright and cvs Log
64 ///////////////////////////////////////////////////////////////////
66 // Generate the final state of the interaction as the input //
67 // to the MonteCarlo //
71 <img src="picts/AliGeneratorClass.gif">
74 <font size=+2 color=red>
75 <p>The responsible person for this module is
76 <a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
82 ///////////////////////////////////////////////////////////////////
84 #include "AliGenerator.h"
85 #include "TGenerator.h"
87 #include "AliConfig.h"
91 ClassImp(AliGenerator)
93 TGenerator* AliGenerator::fgMCEvGen=0;
95 //____________________________________________________________
96 AliGenerator::AliGenerator()
99 // Default constructor
102 if (gAlice->GetDebug()>0)
103 printf("\n AliGenerator Default Constructor\n\n");
104 gAlice->SetGenerator(this);
107 SetThetaRange(); ResetBit(kThetaRange);
108 SetPhiRange(); ResetBit(kPhiRange);
109 SetMomentumRange(); ResetBit(kMomentumRange);
110 SetPtRange(); ResetBit(kPtRange);
111 SetYRange(); ResetBit(kYRange);
112 SetNumberParticles();
121 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
122 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
123 fVertex[0]=fVertex[1]=fVertex[2]=0;
126 fVMin[0]=fVMin[1]=fVMin[2]=0;
128 fVMax[0]=fVMax[1]=fVMax[2]=10000;
132 //____________________________________________________________
133 AliGenerator::AliGenerator(Int_t npart)
137 // Standard constructor
140 if (gAlice->GetDebug()>0)
141 printf("\n AliGenerator Constructor initializing number of particles \n\n");
142 gAlice->SetGenerator(this);
145 SetThetaRange(); ResetBit(kThetaRange);
146 SetPhiRange(); ResetBit(kPhiRange);
147 SetMomentumRange(); ResetBit(kMomentumRange);
148 SetPtRange(); ResetBit(kPtRange);
149 SetYRange(); ResetBit(kYRange);
157 fOrigin[0]=fOrigin[1]=fOrigin[2]=0;
158 fOsigma[0]=fOsigma[1]=fOsigma[2]=0;
159 fVertex[0]=fVertex[1]=fVertex[2]=0;
162 fVMin[0]=fVMin[1]=fVMin[2]=0;
164 fVMax[0]=fVMax[1]=fVMax[2]=10000;
166 SetNumberParticles(npart);
168 AliConfig::Instance()->Add(this);
172 //____________________________________________________________
173 AliGenerator::AliGenerator(const AliGenerator &gen) : TNamed(" "," ")
181 //____________________________________________________________
182 AliGenerator & AliGenerator::operator=(const AliGenerator &gen)
185 // Assignment operator
191 //____________________________________________________________
192 void AliGenerator::Copy(AliGenerator &/* gen */) const
195 // Copy *this onto gen
197 Fatal("Copy","Not implemented!\n");
200 //____________________________________________________________
201 AliGenerator::~AliGenerator()
214 void AliGenerator::Init()
217 // Dummy initialisation
221 //_______________________________________________________________________
222 void AliGenerator::SetOrigin(Float_t ox, Float_t oy, Float_t oz)
225 // Set the vertex for the generated tracks
232 //_______________________________________________________________________
233 void AliGenerator::SetOrigin(const TLorentzVector &o)
236 // Set the vertex for the generated tracks
243 //_______________________________________________________________________
244 void AliGenerator::SetSigma(Float_t sx, Float_t sy, Float_t sz)
247 // Set the spread of the vertex
254 //_______________________________________________________________________
255 void AliGenerator::SetMomentumRange(Float_t pmin, Float_t pmax)
258 // Set the momentum range for the generated particles
262 SetBit(kMomentumRange);
265 //_______________________________________________________________________
266 void AliGenerator::SetPtRange(Float_t ptmin, Float_t ptmax)
269 // Set the Pt range for the generated particles
276 //_______________________________________________________________________
277 void AliGenerator::SetPhiRange(Float_t phimin, Float_t phimax)
280 // Set the Phi range for the generated particles
282 fPhiMin = TMath::Pi()*phimin/180;
283 fPhiMax = TMath::Pi()*phimax/180;
287 //_______________________________________________________________________
288 void AliGenerator::SetYRange(Float_t ymin, Float_t ymax)
291 // Set the Rapidity range for the generated particles
298 //_______________________________________________________________________
299 void AliGenerator::SetVRange(Float_t vxmin, Float_t vxmax,
300 Float_t vymin, Float_t vymax,
301 Float_t vzmin, Float_t vzmax)
304 // Set the vertex range for the generated particles
306 fVMin[0]=vxmin; fVMin[1]=vymin; fVMin[2]=vzmin;
307 fVMax[0]=vxmax; fVMax[1]=vymax; fVMax[2]=vzmax;
308 SetBit(kVertexRange);
311 //_______________________________________________________________________
312 void AliGenerator::SetThetaRange(Float_t thetamin, Float_t thetamax)
315 // Set the theta range for the generated particles
317 fThetaMin = TMath::Pi()*thetamin/180;
318 fThetaMax = TMath::Pi()*thetamax/180;
322 void AliGenerator::Vertex()
325 // Obtain vertex for current event from external source or calculated (internal)
327 if (fVertexSource == kInternal) {
335 void AliGenerator::VertexExternal()
338 // Obtain vertex from external source
340 // Should be something like fVertex = gAlice->GetVertex()
342 fVertex[0]=fVertex[1]=fVertex[2]=0;
345 void AliGenerator::VertexInternal()
348 // Obtain calculated vertex
349 // Default is gaussian smearing
352 for (Int_t j = 0; j<3 ; j++) {
354 fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
355 TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
359 void AliGenerator::SetTrack(Int_t done, Int_t parent, Int_t pdg,
360 Float_t *pmom, Float_t *vpos, Float_t *polar,
361 Float_t tof, AliMCProcess mech, Int_t &ntr,
366 fStack->SetTrack(done, parent, pdg, pmom, vpos, polar, tof,
369 gAlice->SetTrack(done, parent, pdg, pmom, vpos, polar, tof,
372 void AliGenerator::SetTrack(Int_t done, Int_t parent, Int_t pdg,
373 Double_t px, Double_t py, Double_t pz, Double_t e,
374 Double_t vx, Double_t vy, Double_t vz, Double_t tof,
375 Double_t polx, Double_t poly, Double_t polz,
376 AliMCProcess mech, Int_t &ntr, Float_t weight)
380 fStack->SetTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof,
381 polx, poly, polz, mech, ntr, weight);
383 gAlice->SetTrack(done, parent, pdg, px, py, pz, e, vx, vy, vz, tof,
384 polx, poly, polz, mech, ntr, weight);
388 void AliGenerator:: KeepTrack(Int_t itrack)
391 fStack->KeepTrack(itrack);
393 gAlice->KeepTrack(itrack);
397 void AliGenerator:: SetHighWaterMark(Int_t nt)
400 fStack->SetHighWaterMark(nt);
402 gAlice->SetHighWaterMark(nt);