LDMX Software
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
simcore::APrimePhysics Class Reference

Defines basic APrime physics. More...

#include <APrimePhysics.h>

Public Member Functions

 APrimePhysics (const framework::config::Parameters &params)
 Class constructor.
 
virtual ~APrimePhysics ()
 Class destructor.
 
void ConstructParticle ()
 Construct particle.
 
void ConstructProcess ()
 Construct the process.
 

Static Public Attributes

static const std::string NAME = "APrime"
 The name of this physics constructor.
 

Private Attributes

G4double ap_mass_
 the mass of the A' for this run
 
bool enable_
 is dark brem enabled for this run?
 
framework::config::Parameters parameters_
 Dark brem parameters to pass to the process (if enabled)
 
std::unique_ptr< G4DarkBremsstrahlung > process_
 

Detailed Description

Defines basic APrime physics.

It constructs the APrime particle and links the dark brem process to the electron.

See also
G4APrime
G4DarkBremsstrahlung in G4DarkBreM
Note
This class basically does not do anything except register the custom particle (G4APrime) and custom process (G4DarkBremsstrahlung).

Definition at line 35 of file APrimePhysics.h.

Constructor & Destructor Documentation

◆ APrimePhysics()

simcore::APrimePhysics::APrimePhysics ( const framework::config::Parameters params)

Class constructor.

Parameters
paramsParameters to configure the dark brem process

Definition at line 39 of file APrimePhysics.cxx.

40 : G4VPhysicsConstructor(APrimePhysics::NAME),
41 parameters_{params},
42 process_{nullptr} {
43 ap_mass_ = parameters_.getParameter<double>("ap_mass", 0.) * MeV;
44 enable_ = parameters_.getParameter<bool>("enable", false);
45}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
framework::config::Parameters parameters_
Dark brem parameters to pass to the process (if enabled)
G4double ap_mass_
the mass of the A' for this run
static const std::string NAME
The name of this physics constructor.
bool enable_
is dark brem enabled for this run?

References ap_mass_, enable_, framework::config::Parameters::getParameter(), and parameters_.

◆ ~APrimePhysics()

virtual simcore::APrimePhysics::~APrimePhysics ( )
inlinevirtual

Class destructor.

Nothing right now.

Definition at line 58 of file APrimePhysics.h.

58{}

Member Function Documentation

◆ ConstructParticle()

void simcore::APrimePhysics::ConstructParticle ( )

Construct particle.

Insert A' into the Geant4 particle table. Geant4 registers all instances derived from G4ParticleDefinition and deletes them at the end of processing.

Uses the A' mass given by the parameter APrimeMass to inform the G4APrime instance what mass to use.

See also
G4APrime

Insert A-prime into the Geant4 particle table.

Geant4 registers all instances derived from G4ParticleDefinition and deletes them at the end of the run. We configure the A' to have the input mass and the PDG ID number of 622.

Definition at line 47 of file APrimePhysics.cxx.

47 {
49 static const std::map<std::string, G4APrime::DecayMode> decay_lut = {
50 {"no_decay", G4APrime::DecayMode::NoDecay},
51 {"flat_decay", G4APrime::DecayMode::FlatDecay},
52 {"geant_decay", G4APrime::DecayMode::GeantDecay}};
53 auto decay_it{decay_lut.find(
54 model.getParameter<std::string>("decay_mode", "no_decay"))};
55 if (decay_it == decay_lut.end()) {
56 EXCEPTION_RAISE(
57 "BadConf",
58 "Unrecognized decay mode '" +
59 model.getParameter<std::string>("decay_mode") +
60 "',"
61 " options are 'no_decay', 'flat_decay', or 'geant_decay'.");
62 }
63
64 double ap_tau = model.getParameter<double>("ap_tau", -1.0);
65
73 G4APrime::Initialize(ap_mass_, 622, ap_tau, decay_it->second);
74}
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27

References ap_mass_, framework::config::Parameters::getParameter(), and parameters_.

◆ ConstructProcess()

void simcore::APrimePhysics::ConstructProcess ( )

Construct the process.

Links the dark brem processs to the electron through the process manager only if the dark brem process is enabled ('enable' is True).

G4ProcessManager registers and cleans up any created processes, so we can forget about it after creating it.

See also
G4DarkBremsstrahlung in G4DarkBreM

Definition at line 76 of file APrimePhysics.cxx.

76 {
77 // add process to electron if we are enabled
78 if (enable_) {
79 auto model{
81 auto model_name{model.getParameter<std::string>("name")};
82 if (model_name == "vertex_library" or model_name == "g4db") {
83 static const std::map<std::string, g4db::G4DarkBreMModel::ScalingMethod>
84 method_lut = {
85 {"forward_only",
86 g4db::G4DarkBreMModel::ScalingMethod::ForwardOnly},
87 {"cm_scaling", g4db::G4DarkBreMModel::ScalingMethod::CMScaling},
88 {"undefined", g4db::G4DarkBreMModel::ScalingMethod::Undefined}};
89 auto scaling_method_it{
90 method_lut.find(model.getParameter<std::string>("method"))};
91 if (scaling_method_it == method_lut.end()) {
92 EXCEPTION_RAISE(
93 "BadConf",
94 "Unrecognized scaling method '" +
95 model.getParameter<std::string>("method") +
96 "',"
97 " options are 'forward_only', 'cm_scaling', or 'undefined'.");
98 }
99 // Note: The process variable isn't used here, but creating the
100 // G4DarkBremsstahlung object has side-effects
101 process_ = std::make_unique<G4DarkBremsstrahlung>(
102 std::make_shared<g4db::G4DarkBreMModel>(
103 model.getParameter<std::string>("library_path"),
104 false /* dark brem off muons instead of electrons - we
105 always DB off electrons here */
106 ,
107 model.getParameter<double>("threshold"),
108 model.getParameter<double>("epsilon"), scaling_method_it->second,
109 g4db::G4DarkBreMModel::XsecMethod::Auto,
110 model.getParameter<double>("max_R_for_full", 50.0),
111 model.getParameter<int>("aprime_lhe_id", 622),
112 true, // always load the library
113 model.getParameter<bool>("scale_APrime", false),
114 model.getParameter<double>("dist_decay_min", 0.0),
115 model.getParameter<double>("dist_decay_max", 1.0)),
116 parameters_.getParameter<bool>("only_one_per_event"),
117 1., /* global bias - should use bias operator instead */
118 parameters_.getParameter<bool>("cache_xsec"));
119 process_->RegisterStorageMechanism(store_element_z);
120 } else {
121 EXCEPTION_RAISE("BadConf",
122 "Unrecognized model name '" + model_name + "'.");
123 }
124 G4cout << "[ APrimePhysics ] : Initialization of dark brem complete"
125 << G4endl;
126 }
127}

References enable_, framework::config::Parameters::getParameter(), parameters_, and simcore::store_element_z().

Member Data Documentation

◆ ap_mass_

G4double simcore::APrimePhysics::ap_mass_
private

the mass of the A' for this run

Definition at line 89 of file APrimePhysics.h.

Referenced by APrimePhysics(), and ConstructParticle().

◆ enable_

bool simcore::APrimePhysics::enable_
private

is dark brem enabled for this run?

Definition at line 92 of file APrimePhysics.h.

Referenced by APrimePhysics(), and ConstructProcess().

◆ NAME

const std::string simcore::APrimePhysics::NAME = "APrime"
static

The name of this physics constructor.

Passed into Geant4 to register this physics, should not conflict with any other Geant4 physics.

Definition at line 44 of file APrimePhysics.h.

◆ parameters_

framework::config::Parameters simcore::APrimePhysics::parameters_
private

Dark brem parameters to pass to the process (if enabled)

Note
This can't be a reference because we pass it to the process after the configuration step from our POV is done. Thus we need our own copy that won't be destroyed.

Definition at line 101 of file APrimePhysics.h.

Referenced by APrimePhysics(), ConstructParticle(), and ConstructProcess().

◆ process_

std::unique_ptr<G4DarkBremsstrahlung> simcore::APrimePhysics::process_
private

Definition at line 103 of file APrimePhysics.h.


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