BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
BDSParticleMilli.cc
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2024.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20// Subclass of G4ParticleDefinition for millicharged particles
21
22#include "BDSParticleMilli.hh"
23#include "BDSGlobalConstants.hh"
24
25#include "G4SystemOfUnits.hh"
26#include "G4ParticleTable.hh"
27
28ParticleMilli* ParticleMilli::theInstance = 0;
29
30ParticleMilli* ParticleMilli::Definition()
31{
32 if (theInstance !=0) return theInstance;
33
34 G4String name = BDSGlobalConstants::Instance()->millichargeName();
35 // search in particle table
36 G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
37 G4ParticleDefinition* anInstance = pTable->FindParticle(name);
38
39 if (anInstance ==0)
40 {
41 G4double mass = BDSGlobalConstants::Instance()->millichargeMass();
42 G4double charge = BDSGlobalConstants::Instance()->millichargeCharge();
43 G4int pdgID = BDSGlobalConstants::Instance()->millichargeID();
44
45 // create particle
46 //
47 // Arguments for constructor are as follows
48 // name mass width charge
49 // 2*spin parity C-conjugation
50 // 2*Isospin 2*Isospin3 G-parity
51 // type lepton number baryon number PDG encoding
52 // stable lifetime decay table
53 // shortlived subType anti_encoding
54
55 anInstance = new G4ParticleDefinition(
56 name, mass*MeV, 0.0*MeV, charge*eplus,
57 1, 0, 0,
58 0, 0, 0,
59 "fermion", 0, 0, pdgID,
60 true, -1.0, NULL,
61 false, "none"
62 );
63
64 // mag_moment = 0.5 * g * q * h_bar * spin / m_q
65 //G4double muB = 0.5 * 2.0023 * charge * eplus * CLHEP::hbar_Planck * CLHEP::c_squared/mass*MeV;
66 //anInstance->SetPDGMagneticMoment(muB);
67 }
68 theInstance = reinterpret_cast<ParticleMilli*>(anInstance);
69 return theInstance;
70}
71
72ParticleMilli* ParticleMilli::MillichargeDefinition()
73{
74 return Definition();
75}
76
77ParticleMilli* ParticleMilli::Millicharge()
78{
79 return Definition();
80}
static BDSGlobalConstants * Instance()
Access method.