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