VMC Examples Version 6.6
Loading...
Searching...
No Matches
Ex03PrimaryGenerator Class Reference

The primary generator. More...

#include <Ex03PrimaryGenerator.h>

Inheritance diagram for Ex03PrimaryGenerator:

Public Types

enum  Type {
  kDefault , kUser , kUserDecay , kAnti ,
  kTestField , kPion , kDefault , kUser ,
  kUserDecay , kAnti , kTestField , kPion ,
  kDefault , kUser , kUserDecay , kAnti ,
  kTestField , kPion
}
 Predefined primary generators. More...
 
enum  Type {
  kDefault , kUser , kUserDecay , kAnti ,
  kTestField , kPion , kDefault , kUser ,
  kUserDecay , kAnti , kTestField , kPion ,
  kDefault , kUser , kUserDecay , kAnti ,
  kTestField , kPion
}
 Predefined primary generators. More...
 
enum  Type {
  kDefault , kUser , kUserDecay , kAnti ,
  kTestField , kPion , kDefault , kUser ,
  kUserDecay , kAnti , kTestField , kPion ,
  kDefault , kUser , kUserDecay , kAnti ,
  kTestField , kPion
}
 Predefined primary generators. More...
 

Public Member Functions

 Ex03PrimaryGenerator (TVirtualMCStack *stack)
 
 Ex03PrimaryGenerator (const Ex03PrimaryGenerator &origin, TVirtualMCStack *stack)
 
 Ex03PrimaryGenerator ()
 
virtual ~Ex03PrimaryGenerator ()
 
virtual void GeneratePrimaries (const TVector3 &worldSize)
 
void SetIsRandom (Bool_t isRandomGenerator)
 
void SetPrimaryType (Type primaryType)
 
void SetNofPrimaries (Int_t nofPrimaries)
 
Bool_t GetUserDecay () const
 Return true if particle with user decay is activated.
 
 Ex03PrimaryGenerator (TVirtualMCStack *stack)
 
 Ex03PrimaryGenerator (const Ex03PrimaryGenerator &origin, TVirtualMCStack *stack)
 
 Ex03PrimaryGenerator ()
 
virtual ~Ex03PrimaryGenerator ()
 
virtual void GeneratePrimaries (const TVector3 &worldSize)
 
void SetIsRandom (Bool_t isRandomGenerator)
 
void SetPrimaryType (Type primaryType)
 
void SetNofPrimaries (Int_t nofPrimaries)
 
Bool_t GetUserDecay () const
 
 Ex03PrimaryGenerator (TVirtualMCStack *stack)
 
 Ex03PrimaryGenerator (const Ex03PrimaryGenerator &origin, TVirtualMCStack *stack)
 
 Ex03PrimaryGenerator ()
 
virtual ~Ex03PrimaryGenerator ()
 
virtual void GeneratePrimaries (const TVector3 &worldSize)
 
void SetIsRandom (Bool_t isRandomGenerator)
 
void SetPrimaryType (Type primaryType)
 
void SetNofPrimaries (Int_t nofPrimaries)
 
Bool_t GetUserDecay () const
 

Private Member Functions

void GeneratePrimary1 (const TVector3 &origin)
 
void GeneratePrimary2 (const TVector3 &origin)
 
void GeneratePrimary3 (const TVector3 &origin)
 
void GeneratePrimary4 (const TVector3 &origin)
 
void GeneratePrimary5 (const TVector3 &origin)
 
void GeneratePrimary6 (const TVector3 &origin)
 
void GeneratePrimary1 (const TVector3 &origin)
 
void GeneratePrimary2 (const TVector3 &origin)
 
void GeneratePrimary3 (const TVector3 &origin)
 
void GeneratePrimary4 (const TVector3 &origin)
 
void GeneratePrimary5 (const TVector3 &origin)
 
void GeneratePrimary6 (const TVector3 &origin)
 
void GeneratePrimary1 (const TVector3 &origin)
 
void GeneratePrimary2 (const TVector3 &origin)
 
void GeneratePrimary3 (const TVector3 &origin)
 
void GeneratePrimary4 (const TVector3 &origin)
 
void GeneratePrimary5 (const TVector3 &origin)
 
void GeneratePrimary6 (const TVector3 &origin)
 

Private Attributes

TVirtualMCStackfStack
 VMC stack.
 
Bool_t fIsRandom
 Switch to random generator.
 
Type fPrimaryType
 Primary generator selection.
 
Int_t fNofPrimaries
 Number of primary particles.
 

Detailed Description

The primary generator.

Date
06/03/2003
Author
I. Hrivnacova; IPN, Orsay

Definition at line 33 of file Ex03PrimaryGenerator.h.

Member Enumeration Documentation

◆ Type [1/3]

Predefined primary generators.

Enumerator
kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

Definition at line 37 of file Ex03PrimaryGenerator.h.

38 {
39 kDefault, ///< default (e-)
40 kUser, ///< user defined particle and ion
41 kUserDecay, ///< particle with user defined decay (K0Short)
42 kAnti, ///< light anti-nuclei (with Geant4 only)
43 kTestField, ///< mu+ with a suitable energy to test magnetic field
44 kPion ///< pi- ith a suitable energy to test biasing
45 };
@ kTestField
mu+ with a suitable energy to test magnetic field
@ kUserDecay
particle with user defined decay (K0Short)
@ kUser
user defined particle and ion
@ kAnti
light anti-nuclei (with Geant4 only)
@ kPion
pi- ith a suitable energy to test biasing

◆ Type [2/3]

Predefined primary generators.

Enumerator
kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

Definition at line 37 of file Ex03PrimaryGenerator.h.

38 {
39 kDefault, ///< default (e-)
40 kUser, ///< user defined particle and ion
41 kUserDecay, ///< particle with user defined decay (K0Short)
42 kAnti, ///< light anti-nuclei (with Geant4 only)
43 kTestField, ///< mu+ with a suitable energy to test magnetic field
44 kPion ///< pi- ith a suitable energy to test biasing
45 };

◆ Type [3/3]

Predefined primary generators.

Enumerator
kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

kDefault 

default (e-)

kUser 

user defined particle and ion

kUserDecay 

particle with user defined decay (K0Short)

kAnti 

light anti-nuclei (with Geant4 only)

kTestField 

mu+ with a suitable energy to test magnetic field

kPion 

pi- ith a suitable energy to test biasing

Definition at line 37 of file Ex03PrimaryGenerator.h.

38 {
39 kDefault, ///< default (e-)
40 kUser, ///< user defined particle and ion
41 kUserDecay, ///< particle with user defined decay (K0Short)
42 kAnti, ///< light anti-nuclei (with Geant4 only)
43 kTestField, ///< mu+ with a suitable energy to test magnetic field
44 kPion ///< pi- ith a suitable energy to test biasing
45 };

Constructor & Destructor Documentation

◆ Ex03PrimaryGenerator() [1/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( TVirtualMCStack * stack)

Standard constructor

Parameters
stackThe VMC stack

Definition at line 36 of file Ex03PrimaryGenerator.cxx.

37 : TObject(),
38 fStack(stack),
39 fIsRandom(false),
42
43{
44 /// Standard constructor
45 /// \param stack The VMC stack
46}
TVirtualMCStack * fStack
VMC stack.
Int_t fNofPrimaries
Number of primary particles.
Type fPrimaryType
Primary generator selection.
Bool_t fIsRandom
Switch to random generator.

◆ Ex03PrimaryGenerator() [2/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( const Ex03PrimaryGenerator & origin,
TVirtualMCStack * stack )

Copy constructor (for clonig on worker thread in MT mode).

Parameters
originThe source object (on master).
stackThe VMC stack

Definition at line 49 of file Ex03PrimaryGenerator.cxx.

51 : TObject(origin),
52 fStack(stack),
53 fIsRandom(origin.fIsRandom),
56{
57 /// Copy constructor (for clonig on worker thread in MT mode).
58 /// \param origin The source object (on master).
59 /// \param stack The VMC stack
60}

◆ Ex03PrimaryGenerator() [3/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( )

Default constructor

Definition at line 63 of file Ex03PrimaryGenerator.cxx.

64 : TObject(),
65 fStack(0),
66 fIsRandom(false),
69{
70 /// Default constructor
71}

◆ ~Ex03PrimaryGenerator() [1/3]

Ex03PrimaryGenerator::~Ex03PrimaryGenerator ( )
virtual

Destructor

Definition at line 74 of file Ex03PrimaryGenerator.cxx.

75{
76 /// Destructor
77}

◆ Ex03PrimaryGenerator() [4/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( TVirtualMCStack * stack)

◆ Ex03PrimaryGenerator() [5/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( const Ex03PrimaryGenerator & origin,
TVirtualMCStack * stack )

◆ Ex03PrimaryGenerator() [6/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( )

◆ ~Ex03PrimaryGenerator() [2/3]

virtual Ex03PrimaryGenerator::~Ex03PrimaryGenerator ( )
virtual

◆ Ex03PrimaryGenerator() [7/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( TVirtualMCStack * stack)

◆ Ex03PrimaryGenerator() [8/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( const Ex03PrimaryGenerator & origin,
TVirtualMCStack * stack )

◆ Ex03PrimaryGenerator() [9/9]

Ex03PrimaryGenerator::Ex03PrimaryGenerator ( )

◆ ~Ex03PrimaryGenerator() [3/3]

virtual Ex03PrimaryGenerator::~Ex03PrimaryGenerator ( )
virtual

Member Function Documentation

◆ GeneratePrimaries() [1/3]

void Ex03PrimaryGenerator::GeneratePrimaries ( const TVector3 & worldSize)
virtual

Fill the user stack (derived from TVirtualMCStack) with primary particles.

Definition at line 435 of file Ex03PrimaryGenerator.cxx.

436{
437 /// Fill the user stack (derived from TVirtualMCStack) with primary particles.
438
439 switch (fPrimaryType) {
440
441 case kDefault:
442 for (Int_t i = 0; i < fNofPrimaries; i++) GeneratePrimary1(origin);
443 return;
444
445 case kUser:
446 if (fNofPrimaries < 2) fNofPrimaries = 2;
447 for (Int_t i = 0; i < fNofPrimaries / 2; i++) GeneratePrimary2(origin);
448 return;
449
450 case kUserDecay:
451 for (Int_t i = 0; i < fNofPrimaries; i++) GeneratePrimary3(origin);
452 return;
453
454 case kAnti:
455 if (fNofPrimaries < 4) fNofPrimaries = 4;
456 for (Int_t i = 0; i < fNofPrimaries / 4; i++) GeneratePrimary4(origin);
457 return;
458
459 case kTestField:
460 for (Int_t i = 0; i < fNofPrimaries; i++) GeneratePrimary5(origin);
461 return;
462
463 case kPion:
464 for (Int_t i = 0; i < fNofPrimaries; i++) GeneratePrimary6(origin);
465 return;
466
467 default:
468 return;
469 }
470}
void GeneratePrimary1(const TVector3 &origin)
void GeneratePrimary3(const TVector3 &origin)
void GeneratePrimary2(const TVector3 &origin)
void GeneratePrimary6(const TVector3 &origin)
void GeneratePrimary5(const TVector3 &origin)
void GeneratePrimary4(const TVector3 &origin)

◆ SetIsRandom() [1/3]

void Ex03PrimaryGenerator::SetIsRandom ( Bool_t isRandom)
inline

Switch on/off the random generator

Parameters
isRandomIf true, the position is randomized

Definition at line 87 of file Ex03PrimaryGenerator.h.

88{
89 fIsRandom = isRandom;
90}

◆ SetPrimaryType() [1/3]

void Ex03PrimaryGenerator::SetPrimaryType ( Ex03PrimaryGenerator::Type primaryType)
inline

Set the primary particle type to be generated

Parameters
primaryTypeThe primary particle type
See also
Ex03Primary

Definition at line 94 of file Ex03PrimaryGenerator.h.

96{
97 fPrimaryType = primaryType;
98}

◆ SetNofPrimaries() [1/3]

void Ex03PrimaryGenerator::SetNofPrimaries ( Int_t nofPrimaries)
inline

Set the number of particles to be generated

Parameters
nofPrimariesThe number of particles to be generated

Definition at line 102 of file Ex03PrimaryGenerator.h.

103{
104 fNofPrimaries = nofPrimaries;
105}

◆ GetUserDecay() [1/3]

Bool_t Ex03PrimaryGenerator::GetUserDecay ( ) const
inline

Return true if particle with user decay is activated.

Definition at line 108 of file Ex03PrimaryGenerator.h.

◆ GeneratePrimary1() [1/3]

void Ex03PrimaryGenerator::GeneratePrimary1 ( const TVector3 & origin)
private

Add one primary particle (kElectron) to the user stack (derived from TVirtualMCStack).

Parameters
originThe track position

Definition at line 84 of file Ex03PrimaryGenerator.cxx.

85{
86 /// Add one primary particle (kElectron) to the user stack
87 /// (derived from TVirtualMCStack).
88 /// \param origin The track position
89
90 // Track ID (filled by stack)
91 Int_t ntr;
92
93 // Option: to be tracked
94 Int_t toBeDone = 1;
95
96 // PDG
97 Int_t pdg = kElectron;
98
99 // Polarization
100 Double_t polx = 0.;
101 Double_t poly = 0.;
102 Double_t polz = 0.;
103
104 // Position
105 Double_t vx = -0.5 * origin.X();
106 Double_t vy = 0.;
107 Double_t vz = 0.;
108 Double_t tof = 0.;
109
110 // Energy (in GeV)
111 Double_t kinEnergy = 0.050;
112 Double_t mass = 0.51099906 * 1e-03;
113 Double_t e = mass + kinEnergy;
114
115 // Particle momentum
116 Double_t px, py, pz;
117 px = sqrt(e * e - mass * mass);
118 py = 0.;
119 pz = 0.;
120
121 // Randomize position
122 if (fIsRandom) {
123 vy = origin.Y() * (gRandom->Rndm() - 0.5);
124 vz = origin.Z() * (gRandom->Rndm() - 0.5);
125 }
126
127 // Add particle to stack
128 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
129 poly, polz, kPPrimary, ntr, 1., 0);
130}

◆ GeneratePrimary2() [1/3]

void Ex03PrimaryGenerator::GeneratePrimary2 ( const TVector3 & origin)
private

Add user defined particle and ion as primaries to the user stack (derived from TVirtualMCStack).

Parameters
originThe track position

Definition at line 133 of file Ex03PrimaryGenerator.cxx.

134{
135 /// Add user defined particle and ion as primaries to the user stack
136 /// (derived from TVirtualMCStack).
137 /// \param origin The track position
138
139 // Track ID (filled by stack)
140 Int_t ntr;
141
142 // Option: to be tracked
143 Int_t toBeDone = 1;
144
145 // User defined particle
146 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle("He5");
147 Int_t pdg = particle->PdgCode();
148
149 // Polarization
150 Double_t polx = 0.;
151 Double_t poly = 0.;
152 Double_t polz = 0.;
153
154 // Position
155 Double_t vx = -0.5 * origin.X();
156 Double_t vy = 0.;
157 Double_t vz = 0.;
158 Double_t tof = 0.;
159
160 // Energy (in GeV)
161 Double_t kinEnergy = 0.050;
162 Double_t mass = particle->Mass();
163 Double_t e = mass + kinEnergy;
164
165 // Particle momentum
166 Double_t px, py, pz;
167 px = sqrt(e * e - mass * mass);
168 py = 0.;
169 pz = 0.;
170
171 // Randomize position
172 if (fIsRandom) {
173 vy = origin.Y() * (gRandom->Rndm() - 0.5);
174 vz = origin.Z() * (gRandom->Rndm() - 0.5);
175 }
176
177 // Add particle to stack
178 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
179 poly, polz, kPPrimary, ntr, 1., 0);
180
181 // User defined ion
182 particle = TDatabasePDG::Instance()->GetParticle("MyIon");
183 pdg = particle->PdgCode();
184
185 // Energy (in GeV)
186 kinEnergy = 1.050;
187 mass = particle->Mass();
188 e = mass + kinEnergy;
189
190 px = sqrt(e * e - mass * mass);
191 py = 0.;
192 pz = 0.;
193
194 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
195 poly, polz, kPPrimary, ntr, 1., 0);
196}

◆ GeneratePrimary3() [1/3]

void Ex03PrimaryGenerator::GeneratePrimary3 ( const TVector3 & origin)
private

Add one primary particle (kK0Short) to the user stack (derived from TVirtualMCStack).

Parameters
originThe track position

Definition at line 199 of file Ex03PrimaryGenerator.cxx.

200{
201 /// Add one primary particle (kK0Short) to the user stack
202 /// (derived from TVirtualMCStack).
203 /// \param origin The track position
204
205 // Track ID (filled by stack)
206 Int_t ntr;
207
208 // Option: to be tracked
209 Int_t toBeDone = 1;
210
211 // PDG
212 Int_t pdg = kK0Short; // 310
213
214 // Polarization
215 Double_t polx = 0.;
216 Double_t poly = 0.;
217 Double_t polz = 0.;
218
219 // Position
220 Double_t vx = -0.5 * origin.X();
221 Double_t vy = 0.;
222 Double_t vz = 0.;
223 Double_t tof = 0.;
224
225 // Energy (in GeV)
226 Double_t kinEnergy = 0.050;
227 Double_t mass = 0.497614;
228 Double_t e = mass + kinEnergy;
229
230 // Particle momentum
231 Double_t px, py, pz;
232 px = sqrt(e * e - mass * mass);
233 py = 0.;
234 pz = 0.;
235
236 // Randomize position
237 if (fIsRandom) {
238 vy = origin.Y() * (gRandom->Rndm() - 0.5);
239 vz = origin.Z() * (gRandom->Rndm() - 0.5);
240 }
241
242 // Add particle to stack
243 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
244 poly, polz, kPPrimary, ntr, 1., 0);
245}

◆ GeneratePrimary4() [1/3]

void Ex03PrimaryGenerator::GeneratePrimary4 ( const TVector3 & origin)
private

Add light anti-ions:

Definition at line 248 of file Ex03PrimaryGenerator.cxx.

249{
250 /// Add light anti-ions:
251
252 // Track ID (filled by stack)
253 Int_t ntr;
254
255 // Option: to be tracked
256 Int_t toBeDone = 1;
257
258 // PDG
259 TParticlePDG* particle =
260 TDatabasePDG::Instance()->GetParticle("AntiDeuteron");
261 Int_t pdg = particle->PdgCode();
262 ;
263
264 // Polarization
265 Double_t polx = 0.;
266 Double_t poly = 0.;
267 Double_t polz = 0.;
268
269 // Position
270 Double_t vx = -0.5 * origin.X();
271 Double_t vy = 0.;
272 Double_t vz = 0.;
273 Double_t tof = 0.;
274
275 // Energy (in GeV)
276 Double_t kinEnergy = 5;
277 Double_t mass = particle->Mass();
278 Double_t e = mass + kinEnergy;
279
280 // Particle momentum
281 Double_t px, py, pz;
282 px = sqrt(e * e - mass * mass);
283 py = 0.;
284 pz = 0.;
285
286 // Randomize position
287 if (fIsRandom) {
288 vy = origin.Y() * (gRandom->Rndm() - 0.5);
289 vz = origin.Z() * (gRandom->Rndm() - 0.5);
290 }
291
292 // Add particle to stack
293 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
294 poly, polz, kPPrimary, ntr, 1., 0);
295
296 // anti_triton
297 particle = TDatabasePDG::Instance()->GetParticle("AntiTriton");
298 pdg = particle->PdgCode();
299 mass = particle->Mass();
300 e = mass + kinEnergy;
301
302 px = sqrt(e * e - mass * mass);
303 py = 0.;
304 pz = 0.;
305
306 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
307 poly, polz, kPPrimary, ntr, 1., 0);
308
309 // anti_alpha
310 particle = TDatabasePDG::Instance()->GetParticle("AntiAlpha");
311 pdg = particle->PdgCode();
312 mass = particle->Mass();
313 e = mass + kinEnergy;
314
315 px = sqrt(e * e - mass * mass);
316 py = 0.;
317 pz = 0.;
318
319 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
320 poly, polz, kPPrimary, ntr, 1., 0);
321
322 // anti_He3
323 particle = TDatabasePDG::Instance()->GetParticle("AntiHE3");
324 pdg = particle->PdgCode();
325 mass = particle->Mass();
326 e = mass + kinEnergy;
327
328 px = sqrt(e * e - mass * mass);
329 py = 0.;
330 pz = 0.;
331
332 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
333 poly, polz, kPPrimary, ntr, 1., 0);
334}

◆ GeneratePrimary5() [1/3]

void Ex03PrimaryGenerator::GeneratePrimary5 ( const TVector3 & origin)
private

Add one primary particle (kMuonPlus) to the user stack

Definition at line 337 of file Ex03PrimaryGenerator.cxx.

338{
339 /// Add one primary particle (kMuonPlus) to the user stack
340
341 // Track ID (filled by stack)
342 Int_t ntr;
343
344 // Option: to be tracked
345 Int_t toBeDone = 1;
346
347 // PDG
348 Int_t pdg = kMuonPlus;
349
350 // Polarization
351 Double_t polx = 0.;
352 Double_t poly = 0.;
353 Double_t polz = 0.;
354
355 // Position
356 Double_t vx = -0.5 * origin.X();
357 Double_t vy = 0.;
358 Double_t vz = 0.;
359 Double_t tof = 0.;
360
361 // Energy (in GeV)
362 Double_t kinEnergy = 0.1;
363 Double_t mass = 0.1056583715;
364 Double_t e = mass + kinEnergy;
365
366 // Particle momentum
367 Double_t px, py, pz;
368 px = sqrt(e * e - mass * mass);
369 py = 0.;
370 pz = 0.;
371
372 // Randomize position
373 if (fIsRandom) {
374 vy = origin.Y() * (gRandom->Rndm() - 0.5);
375 vz = origin.Z() * (gRandom->Rndm() - 0.5);
376 }
377
378 // Add particle to stack
379 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
380 poly, polz, kPPrimary, ntr, 1., 0);
381}

◆ GeneratePrimary6() [1/3]

void Ex03PrimaryGenerator::GeneratePrimary6 ( const TVector3 & origin)
private

Add one primary particle (kPiMinus) to the user stack

Definition at line 384 of file Ex03PrimaryGenerator.cxx.

385{
386 /// Add one primary particle (kPiMinus) to the user stack
387
388 // Track ID (filled by stack)
389 Int_t ntr;
390
391 // Option: to be tracked
392 Int_t toBeDone = 1;
393
394 // PDG
395 Int_t pdg = kPiMinus;
396
397 // Polarization
398 Double_t polx = 0.;
399 Double_t poly = 0.;
400 Double_t polz = 0.;
401
402 // Position
403 Double_t vx = -0.5 * origin.X();
404 Double_t vy = 0.;
405 Double_t vz = 0.;
406 Double_t tof = 0.;
407
408 // Energy (in GeV)
409 Double_t kinEnergy = 0.1;
410 Double_t mass = 0.1395701;
411 Double_t e = mass + kinEnergy;
412
413 // Particle momentum
414 Double_t px, py, pz;
415 px = sqrt(e * e - mass * mass);
416 py = 0.;
417 pz = 0.;
418
419 // Randomize position
420 if (fIsRandom) {
421 vy = origin.Y() * (gRandom->Rndm() - 0.5);
422 vz = origin.Z() * (gRandom->Rndm() - 0.5);
423 }
424
425 // Add particle to stack
426 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
427 poly, polz, kPPrimary, ntr, 1., 0);
428}

◆ GeneratePrimaries() [2/3]

virtual void Ex03PrimaryGenerator::GeneratePrimaries ( const TVector3 & worldSize)
virtual

◆ SetIsRandom() [2/3]

void Ex03PrimaryGenerator::SetIsRandom ( Bool_t isRandomGenerator)

◆ SetPrimaryType() [2/3]

void Ex03PrimaryGenerator::SetPrimaryType ( Type primaryType)

◆ SetNofPrimaries() [2/3]

void Ex03PrimaryGenerator::SetNofPrimaries ( Int_t nofPrimaries)

◆ GetUserDecay() [2/3]

Bool_t Ex03PrimaryGenerator::GetUserDecay ( ) const

◆ GeneratePrimary1() [2/3]

void Ex03PrimaryGenerator::GeneratePrimary1 ( const TVector3 & origin)
private

◆ GeneratePrimary2() [2/3]

void Ex03PrimaryGenerator::GeneratePrimary2 ( const TVector3 & origin)
private

◆ GeneratePrimary3() [2/3]

void Ex03PrimaryGenerator::GeneratePrimary3 ( const TVector3 & origin)
private

◆ GeneratePrimary4() [2/3]

void Ex03PrimaryGenerator::GeneratePrimary4 ( const TVector3 & origin)
private

◆ GeneratePrimary5() [2/3]

void Ex03PrimaryGenerator::GeneratePrimary5 ( const TVector3 & origin)
private

◆ GeneratePrimary6() [2/3]

void Ex03PrimaryGenerator::GeneratePrimary6 ( const TVector3 & origin)
private

◆ GeneratePrimaries() [3/3]

virtual void Ex03PrimaryGenerator::GeneratePrimaries ( const TVector3 & worldSize)
virtual

◆ SetIsRandom() [3/3]

void Ex03PrimaryGenerator::SetIsRandom ( Bool_t isRandomGenerator)

◆ SetPrimaryType() [3/3]

void Ex03PrimaryGenerator::SetPrimaryType ( Type primaryType)

◆ SetNofPrimaries() [3/3]

void Ex03PrimaryGenerator::SetNofPrimaries ( Int_t nofPrimaries)

◆ GetUserDecay() [3/3]

Bool_t Ex03PrimaryGenerator::GetUserDecay ( ) const

◆ GeneratePrimary1() [3/3]

void Ex03PrimaryGenerator::GeneratePrimary1 ( const TVector3 & origin)
private

◆ GeneratePrimary2() [3/3]

void Ex03PrimaryGenerator::GeneratePrimary2 ( const TVector3 & origin)
private

◆ GeneratePrimary3() [3/3]

void Ex03PrimaryGenerator::GeneratePrimary3 ( const TVector3 & origin)
private

◆ GeneratePrimary4() [3/3]

void Ex03PrimaryGenerator::GeneratePrimary4 ( const TVector3 & origin)
private

◆ GeneratePrimary5() [3/3]

void Ex03PrimaryGenerator::GeneratePrimary5 ( const TVector3 & origin)
private

◆ GeneratePrimary6() [3/3]

void Ex03PrimaryGenerator::GeneratePrimary6 ( const TVector3 & origin)
private

Member Data Documentation

◆ fStack

TVirtualMCStack * Ex03PrimaryGenerator::fStack
private

VMC stack.

Definition at line 75 of file Ex03PrimaryGenerator.h.

◆ fIsRandom

Bool_t Ex03PrimaryGenerator::fIsRandom
private

Switch to random generator.

Definition at line 76 of file Ex03PrimaryGenerator.h.

◆ fPrimaryType

Type Ex03PrimaryGenerator::fPrimaryType
private

Primary generator selection.

Definition at line 77 of file Ex03PrimaryGenerator.h.

◆ fNofPrimaries

Int_t Ex03PrimaryGenerator::fNofPrimaries
private

Number of primary particles.

Definition at line 78 of file Ex03PrimaryGenerator.h.


The documentation for this class was generated from the following files: