20#include <TDatabasePDG.h>
22#include <TParticlePDG.h>
25#include <TVirtualMC.h>
26#include <TVirtualMCApplication.h>
27#include <TVirtualMCStack.h>
29#include "Ex03PrimaryGenerator.h"
40 fPrimaryType(kDefault),
53 fIsRandom(origin.fIsRandom),
54 fPrimaryType(origin.fPrimaryType),
55 fNofPrimaries(origin.fNofPrimaries)
67 fPrimaryType(kDefault),
97 Int_t pdg = kElectron;
105 Double_t vx = -0.5 * origin.X();
111 Double_t kinEnergy = 0.050;
112 Double_t mass = 0.51099906 * 1e-03;
113 Double_t e = mass + kinEnergy;
117 px = sqrt(e * e - mass * mass);
123 vy = origin.Y() * (gRandom->Rndm() - 0.5);
124 vz = origin.Z() * (gRandom->Rndm() - 0.5);
128 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
129 poly, polz, kPPrimary, ntr, 1., 0);
146 TParticlePDG* particle = TDatabasePDG::Instance()->GetParticle(
"He5");
147 Int_t pdg = particle->PdgCode();
155 Double_t vx = -0.5 * origin.X();
161 Double_t kinEnergy = 0.050;
162 Double_t mass = particle->Mass();
163 Double_t e = mass + kinEnergy;
167 px = sqrt(e * e - mass * mass);
173 vy = origin.Y() * (gRandom->Rndm() - 0.5);
174 vz = origin.Z() * (gRandom->Rndm() - 0.5);
178 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
179 poly, polz, kPPrimary, ntr, 1., 0);
182 particle = TDatabasePDG::Instance()->GetParticle(
"MyIon");
183 pdg = particle->PdgCode();
187 mass = particle->Mass();
188 e = mass + kinEnergy;
190 px = sqrt(e * e - mass * mass);
194 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
195 poly, polz, kPPrimary, ntr, 1., 0);
212 Int_t pdg = kK0Short;
220 Double_t vx = -0.5 * origin.X();
226 Double_t kinEnergy = 0.050;
227 Double_t mass = 0.497614;
228 Double_t e = mass + kinEnergy;
232 px = sqrt(e * e - mass * mass);
238 vy = origin.Y() * (gRandom->Rndm() - 0.5);
239 vz = origin.Z() * (gRandom->Rndm() - 0.5);
243 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
244 poly, polz, kPPrimary, ntr, 1., 0);
259 TParticlePDG* particle =
260 TDatabasePDG::Instance()->GetParticle(
"AntiDeuteron");
261 Int_t pdg = particle->PdgCode();
270 Double_t vx = -0.5 * origin.X();
276 Double_t kinEnergy = 5;
277 Double_t mass = particle->Mass();
278 Double_t e = mass + kinEnergy;
282 px = sqrt(e * e - mass * mass);
288 vy = origin.Y() * (gRandom->Rndm() - 0.5);
289 vz = origin.Z() * (gRandom->Rndm() - 0.5);
293 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
294 poly, polz, kPPrimary, ntr, 1., 0);
297 particle = TDatabasePDG::Instance()->GetParticle(
"AntiTriton");
298 pdg = particle->PdgCode();
299 mass = particle->Mass();
300 e = mass + kinEnergy;
302 px = sqrt(e * e - mass * mass);
306 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
307 poly, polz, kPPrimary, ntr, 1., 0);
310 particle = TDatabasePDG::Instance()->GetParticle(
"AntiAlpha");
311 pdg = particle->PdgCode();
312 mass = particle->Mass();
313 e = mass + kinEnergy;
315 px = sqrt(e * e - mass * mass);
319 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
320 poly, polz, kPPrimary, ntr, 1., 0);
323 particle = TDatabasePDG::Instance()->GetParticle(
"AntiHE3");
324 pdg = particle->PdgCode();
325 mass = particle->Mass();
326 e = mass + kinEnergy;
328 px = sqrt(e * e - mass * mass);
332 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
333 poly, polz, kPPrimary, ntr, 1., 0);
348 Int_t pdg = kMuonPlus;
356 Double_t vx = -0.5 * origin.X();
362 Double_t kinEnergy = 0.1;
363 Double_t mass = 0.1056583715;
364 Double_t e = mass + kinEnergy;
368 px = sqrt(e * e - mass * mass);
374 vy = origin.Y() * (gRandom->Rndm() - 0.5);
375 vz = origin.Z() * (gRandom->Rndm() - 0.5);
379 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
380 poly, polz, kPPrimary, ntr, 1., 0);
395 Int_t pdg = kPiMinus;
403 Double_t vx = -0.5 * origin.X();
409 Double_t kinEnergy = 0.1;
410 Double_t mass = 0.1395701;
411 Double_t e = mass + kinEnergy;
415 px = sqrt(e * e - mass * mass);
421 vy = origin.Y() * (gRandom->Rndm() - 0.5);
422 vz = origin.Z() * (gRandom->Rndm() - 0.5);
426 fStack->PushTrack(toBeDone, -1, pdg, px, py, pz, e, vx, vy, vz, tof, polx,
427 poly, polz, kPPrimary, ntr, 1., 0);
void GeneratePrimary1(const TVector3 &origin)
virtual void GeneratePrimaries(const TVector3 &worldSize)
void GeneratePrimary3(const TVector3 &origin)
TVirtualMCStack * fStack
VMC stack.
virtual ~Ex03PrimaryGenerator()
void GeneratePrimary2(const TVector3 &origin)
void GeneratePrimary6(const TVector3 &origin)
void GeneratePrimary5(const TVector3 &origin)
Int_t fNofPrimaries
Number of primary particles.
void GeneratePrimary4(const TVector3 &origin)
@ 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 fPrimaryType
Primary generator selection.
Bool_t fIsRandom
Switch to random generator.