Belle II Software development
G4mplIonisation.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9// modified from GEANT4 exoticphysics/monopole/*
10
11#include <simulation/monopoles/G4mplIonisation.h>
12#include <simulation/monopoles/G4mplIonisationWithDeltaModel.h>
13
14
15#include <CLHEP/Units/PhysicalConstants.h>
16#include <CLHEP/Units/SystemOfUnits.h>
17#include <G4Electron.hh>
18#include <G4EmParameters.hh>
19
20using namespace std;
21using namespace Belle2;
22using namespace Belle2::Monopoles;
23using namespace CLHEP;
24
25G4mplIonisation::G4mplIonisation(G4double mCharge, const G4String& name)
26 : G4VEnergyLossProcess(name),
27 magneticCharge(mCharge),
28 isInitialised(false)
29{
30 // By default 1e magnetic charge is used
31 if (magneticCharge == 0.0) { magneticCharge = 1.0 * eplus; }
32
33 SetVerboseLevel(0);
34 SetProcessSubType(fIonisation);
35 SetStepFunction(0.2, 1 * mm);
36 SetSecondaryParticle(G4Electron::Electron());
37}
38
40{}
41
42G4bool G4mplIonisation::IsApplicable(const G4ParticleDefinition&)
43{
44 return true;
45}
46
47G4double G4mplIonisation::MinPrimaryEnergy(const G4ParticleDefinition* mpl,
48 const G4Material*,
49 G4double cut)
50{
51 G4double x = 0.5 * cut / electron_mass_c2;
52 G4double mass = mpl->GetPDGMass();
53 G4double ratio = electron_mass_c2 / mass;
54 G4double gam = x * ratio + std::sqrt((1. + x) * (1. + x * ratio * ratio));
55 return mass * (gam - 1.0);
56}
57
58void G4mplIonisation::InitialiseEnergyLossProcess(const G4ParticleDefinition* p,
59 const G4ParticleDefinition*)
60{
61 if (isInitialised) { return; }
62
63 SetBaseParticle(0);
64
65 // monopole model is responsible both for energy loss and fluctuations
66
69
70 ion->SetParticle(p);
71
72 // define size of dedx and range tables
73 G4EmParameters* param = G4EmParameters::Instance();
74 G4double emin = std::min(param->MinKinEnergy(), ion->LowEnergyLimit());
75 G4double emax = std::max(param->MaxKinEnergy(), ion->HighEnergyLimit());
76 G4int bin = G4lrint(param->NumberOfBinsPerDecade() * std::log10(emax / emin));
77 ion->SetLowEnergyLimit(emin);
78 ion->SetHighEnergyLimit(emax);
79 SetMinKinEnergy(emin);
80 SetMaxKinEnergy(emax);
81 SetDEDXBinning(bin);
82
83 SetEmModel(ion);
84 AddEmModel(1, ion, ion);
85
86 isInitialised = true;
87}
void SetParticle(const G4ParticleDefinition *p)
Read definition of the monopole.
G4mplIonisation(G4double mCharge=0.0, const G4String &name="mplIoni")
Constructor.
G4double magneticCharge
Monopole charge, in e+ units.
virtual ~G4mplIonisation()
Destructor.
G4bool isInitialised
Is the process initialised.
virtual void InitialiseEnergyLossProcess(const G4ParticleDefinition *p, const G4ParticleDefinition *) override
G4VEnergyLossProcess::InitialiseEnergyLossProcess() implementation.
virtual G4bool IsApplicable(const G4ParticleDefinition &p) override
Dummy to check if the proccess is is applicable to a certain particle.
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *p, const G4Material *, G4double cut) final
Threshold for zero value.
Abstract base class for different kinds of events.
STL namespace.