Go Back to: C++ Manual General Site

LDMX.SimCore package

Submodules

LDMX.SimCore.bias_operators module

Biasing operator templates for use throughout ldmx-sw

Mainly focused on reducing the number of places that certain parameter and class names are hardcoded into the python configuration.

class LDMX.SimCore.bias_operators.APrimeToFCPPair(volume: str, factor: float, threshold: float = 0.0, instance_name: str = 'simcore::biasoperators::APrimeToFCPPair')

Bases: XsecBiasingOperator

Bias A’ -> fcp+ fcp- process

Parameters:
  • volume (str) – name of volume to bias within

  • factor (float) – biasing factor to multiply by

  • threshold (float, optional) – minimum kinetic energy [MeV] to bias tracks

class_name: str = 'simcore::biasoperators::APrimeToFCPPair'
factor: float
instance_name: str = 'simcore::biasoperators::APrimeToFCPPair'
module_name: str = 'SimCore_BiasOperators'
threshold: float = 0.0
volume: str
class LDMX.SimCore.bias_operators.DarkBrem(volume: str, bias_all: bool, factor: float, instance_name: str = 'simcore::biasoperators::DarkBrem')

Bases: XsecBiasingOperator

Bias dark brem process

Parameters:
  • volume (str) – name of volume to bias within

  • bias_all (bool) – Should we bias all electrons or just the primary?

  • factor (float) – biasing factor to multiply by

bias_all: bool
class_name: str = 'simcore::biasoperators::DarkBrem'
static ecal(factor)

Bias dark brem inside of the ecal by the input factor

factor: float
instance_name: str = 'simcore::biasoperators::DarkBrem'
module_name: str = 'SimCore_BiasOperators'
static target(factor)

Bias dark brem inside of the target by the input factor

volume: str
class LDMX.SimCore.bias_operators.ElectroNuclear(volume: str, factor: float, threshold: float = 0.0, instance_name: str = 'simcore::biasoperators::ElectroNuclear')

Bases: XsecBiasingOperator

Bias electro nuclear process

Parameters:
  • volume (str) – name of volume to bias within

  • factor (float) – biasing factor to mutliply by

  • threshold (float, optional) – minimum kinetic energy [MeV] to bias tracks

class_name: str = 'simcore::biasoperators::ElectroNuclear'
factor: float
instance_name: str = 'simcore::biasoperators::ElectroNuclear'
module_name: str = 'SimCore_BiasOperators'
threshold: float = 0.0
volume: str
class LDMX.SimCore.bias_operators.GammaToFCPPair(volume: str, factor: float, threshold: float = 0.0, instance_name: str = 'simcore::biasoperators::GammaToFCPPair')

Bases: XsecBiasingOperator

Bias gamma -> fcp+ fcp- process

Parameters:
  • volume (str) – name of volume to bias within

  • factor (float) – biasing factor to multiply by

  • threshold (float, optional) – minimum kinetic energy [MeV] to bias tracks

class_name: str = 'simcore::biasoperators::GammaToFCPPair'
factor: float
instance_name: str = 'simcore::biasoperators::GammaToFCPPair'
module_name: str = 'SimCore_BiasOperators'
threshold: float = 0.0
volume: str
class LDMX.SimCore.bias_operators.GammaToMuPair(volume: str, factor: float, threshold: float = 0.0, instance_name: str = 'simcore::biasoperators::GammaToMuPair')

Bases: XsecBiasingOperator

Bias gamma -> mu+ mu- process

Parameters:
  • volume (str) – name of volume to bias within

  • factor (float) – biasing factor to multiply by

  • threshold (float, optional) – minimum kinetic energy [MeV] to bias tracks

class_name: str = 'simcore::biasoperators::GammaToMuPair'
factor: float
instance_name: str = 'simcore::biasoperators::GammaToMuPair'
module_name: str = 'SimCore_BiasOperators'
threshold: float = 0.0
volume: str
class LDMX.SimCore.bias_operators.K0LongInelastic(vol, factor, thresh=0.0)

Bases: XsecBiasingOperator

Bias K0 Long inelastic collisions

Parameters
volstr

name of volume to bias within

factorfloat

biasing factor to multiply by

thresholdfloat, optional

minimum kinetic energy [MeV] to bias tracks

class LDMX.SimCore.bias_operators.NeutronInelastic(vol, factor, thresh=0.0)

Bases: XsecBiasingOperator

Bias neutron inelastic collisions

Parameters:
  • vol (str) – name of volume to bias within

  • factor (float) – biasing factor to multiply by

  • threshold (float, optional) – minimum kinetic energy [MeV] to bias tracks

class LDMX.SimCore.bias_operators.PhotoNuclear(volume: str, factor: float, threshold: float = 0.0, down_bias_conv: bool = True, only_children_of_primary: bool = False, instance_name: str = 'simcore::biasoperators::PhotoNuclear')

Bases: XsecBiasingOperator

Bias photo nuclear process

Parameters:
  • vol (str) – name of volume to bias within

  • factor (float) – biasing factor to mutliply by

  • threshold (float, optional) – minimum kinetic energy [MeV] to bias tracks

  • down_bias_conv (bool, optional) – Should we down bias the gamma conversion process?

  • only_children_of_primary (bool, optional) – Should we only bias photons that are children of the primary particle?

class_name: str = 'simcore::biasoperators::PhotoNuclear'
down_bias_conv: bool = True
factor: float
instance_name: str = 'simcore::biasoperators::PhotoNuclear'
module_name: str = 'SimCore_BiasOperators'
only_children_of_primary: bool = False
threshold: float = 0.0
volume: str
class LDMX.SimCore.bias_operators.XsecBiasingOperator

Bases: object

required base class for biasing operators for type-checking

LDMX.SimCore.bias_operators.biasing_operator(class_name, module_name='SimCore_BiasOperators')

LDMX.SimCore.dark_brem module

Configuration module for dark brem simulation

class LDMX.SimCore.dark_brem.DarkBrem(ap_mass: float = 0.0, only_one_per_event: bool = False, enable: bool = False, cache_xsec: bool = True, model: DarkBremModel = <factory>, fcp_enable: bool = False, fcp_mass: float = 0.0, fcp_charge: float = 0.1, fcp_xsec_factor: float = 1.0)

Bases: object

Storage for parameters of dark brem process

ap_mass

Mass of A’ in MeV

Type:

float

enable

Should we use the custom Geant4 dark brem process? (Default: No)

Type:

bool

only_one_per_event

Should we deactivate the process after one dark brem or allow for more than one? (Default: No)

Type:

bool

cache_xsec

Should we cache the xsec’s computed from the model? (Default: yes)

Type:

bool

model

The model that should be use for dark bremming

Type:

DarkBremModel

activate(ap_mass, model=None)

Activate the dark brem process with the input A’ mass [MeV] and dark brem model

If no dark brem model is given, we do not activate the process and only define the A’ mass. This allows for some backwards compatibility by allowing users to use the LHEPrimaryGenerator with A’ particles.

activate_fcp(fcp_mass, fcp_charge=0.1, fcp_xsec_factor=1.0)

Enable A’ -> fcp+ fcp- conversion process

Parameters:
  • fcp_mass (float) – Mass of the fractionally charged particle in MeV

  • fcp_charge (float, optional) – Electric charge of the fcp in units of e (default: 0.1)

  • fcp_xsec_factor (float, optional) – Cross section biasing factor for A’ -> fcp conversion. The physical cross section scales as q^4, so for small charges (e.g., 0.1e) a large factor (e.g., 1e8) may be needed to see conversions in a reasonable number of events (default: 1.0)

ap_mass: float = 0.0
cache_xsec: bool = True
enable: bool = False
fcp_charge: float = 0.1
fcp_enable: bool = False
fcp_mass: float = 0.0
fcp_xsec_factor: float = 1.0
model: DarkBremModel
only_one_per_event: bool = False
class LDMX.SimCore.dark_brem.DarkBremModel

Bases: object

base class for dark brem models for type checking

class LDMX.SimCore.dark_brem.G4DarkBreMModel(library_path: str, method: str = 'forward_only', threshold: float = 2.0, epsilon: float = 0.01, scale_aprime: bool = False, decay_mode: str = 'no_decay', ap_tau: float = -1.0, dist_decay_min: float = 0.0, dist_decay_max: float = 1.0, name: str = 'g4db')

Bases: DarkBremModel

Configuration for the event library dark brem model

This model uses G4DarkBreM’s library model. The library can be a directory of LHE files, gzip-compressed LHE files, a CSV processed by G4DarkBreM, or a gzip-compressed CSV processed by G4DarkBreM.

Parameters:

library_path (str) – Path to library holding the dark brem kinematics

method

Interpretation method for LHE files

Type:

str

threshold

Minimum energy [GeV] that electron should have for dark brem to have nonzero xsec

Type:

float

epsilon

Epsilon for dark brem xsec calculation

Type:

float

ap_tau: float = -1.0
decay_mode: str = 'no_decay'
dist_decay_max: float = 1.0
dist_decay_min: float = 0.0
epsilon: float = 0.01
library_path: str
method: str = 'forward_only'
name: str = 'g4db'
scale_aprime: bool = False
threshold: float = 2.0
class LDMX.SimCore.dark_brem.UndefinedModel(name: str = 'UNDEFINED')

Bases: DarkBremModel

name: str = 'UNDEFINED'
LDMX.SimCore.dark_brem.dark_brem_model(name)

LDMX.SimCore.fcp_physics module

Configuration for FCPPhysics – fractionally charged particle processes

This module is independent of the dark brem configuration. It handles gamma -> fcp+ fcp- conversion on SM photons.

class LDMX.SimCore.fcp_physics.FCPPhysics

Bases: object

Parameters for the FCP physics constructor

enable

Should we enable fcp physics? (Default: No)

Type:

bool

fcp_mass

Mass of the fcp in MeV (Default: 0.)

Type:

float

fcp_charge

Electric charge of the fcp in units of e (Default: 0.1)

Type:

float

fcp_pdg_id

PDG ID for the fcp particles (Default: 17)

Type:

int

activate(fcp_mass, fcp_charge=0.1)

Enable gamma -> fcp+ fcp- conversion process

Parameters:
  • fcp_mass (float) – Mass of the fractionally charged particle in MeV

  • fcp_charge (float, optional) – Electric charge of the fcp in units of e (default: 0.1)

LDMX.SimCore.generators module

Primary Generator templates for use throughout ldmx-sw

class LDMX.SimCore.generators.Genie(energy: float = 8.0, targets: list[int] = <factory>, target_thickness: float = 0.3504, abundances: list[float] = <factory>, time: float = 0.0, position: list[float] = <factory>, beam_size: list[float] = <factory>, direction: list[float] = <factory>, tune: str = 'default', spline_file: str = '', message_threshold_file: str = '/usr/local/GENIE/Generator/config/Messenger.xml', instance_name: str = 'simcore::generators::GenieGenerator', beam_spot_smear: list[Any] = <factory>)

Bases: PrimaryGenerator

Simple GENIE generator

energy

Energy of particle to shoot [GeV]

Type:

float

targets

List of target nuclei PDG codes

Type:

list of int

abundances

List of abundances for target nuclei

Type:

list of float

time

Time to shoot from [ns]

Type:

double

position

Position of interaction from [mm]

Type:

list of double

direction

Unit vector direction of incoming electron

Type:

list of double

tune

Name of GENIE tune to use

Type:

str

target_thickness

Thickness of target [mm] to use for generation

Type:

double

beam_size

uniform beam size width to use

Type:

list of double

Examples

myGenie = genie( name=’myGenie’,

energy = 4.0, targets = [ 1000220480 ], abundances = [ 1.0 ], time = 0.0, position = [0.,0.,0.], direction = [0.,0.,1.], tune=’G18_02a_00_000’)

abundances: list[float]
beam_size: list[float]
beam_spot_smear: list[Any]
class_name: str = 'simcore::generators::GenieGenerator'
direction: list[float]
energy: float = 8.0
instance_name: str = 'simcore::generators::GenieGenerator'
message_threshold_file: str = '/usr/local/GENIE/Generator/config/Messenger.xml'
module_name: str = 'SimCore_Generators'
position: list[float]
spline_file: str = ''
target_thickness: float = 0.3504
targets: list[int]
time: float = 0.0
tune: str = 'default'
class LDMX.SimCore.generators.Gps(init_commands: list[str], instance_name: str = 'simcore::generators::GeneralParticleSource', beam_spot_smear: list[~typing.Any] = <factory>)

Bases: PrimaryGenerator

general particle source

The input initialization commands are run in the order that they are listed.

Parameters:
  • name (str) – name of new primary generator

  • init_commands (list of strings) – List of Geant4 commands to initialize this GeneralParticleSource

Returns:

configured to be a GeneralParticleSource with the passed initialization commands

Return type:

simcfg.PrimaryGenerator

Examples

my_gps = gps( ‘my_gps’ , [

“/gps/particle e-“, “/gps/pos/type Plane”, “/gps/pos/shape Square”, “/gps/pos/centre 0 0 0 mm”, “/gps/pos/halfx 40 mm”, “/gps/pos/halfy 80 mm”, “/gps/ang/type cos”, “/gps/ene/type Lin”, “/gps/ene/min 3 GeV”, “/gps/ene/max 4 GeV”, “/gps/ene/gradient 1”, “/gps/ene/intercept 1” ] )

beam_spot_smear: list[Any]
class_name: str = 'simcore::generators::GeneralParticleSource'
init_commands: list[str]
instance_name: str = 'simcore::generators::GeneralParticleSource'
module_name: str = 'SimCore_Generators'
class LDMX.SimCore.generators.Gun(time: float = 0.0, verbosity: int = 0, particle: str = '', energy: float = 0.0, position: list[float] = <factory>, direction: list[float] = <factory>, instance_name: str = 'simcore::generators::ParticleGun', beam_spot_smear: list[Any] = <factory>)

Bases: PrimaryGenerator

basic particle gun primary generator

time

Time to shoot from [ns]

Type:

float, optional

verbosity

Verbosity flag for this generator

Type:

int, optional

particle

Geant4 particle name to shoot

Type:

str

energy

Energy of particle to shoot [GeV]

Type:

float

position

Position to shoot from [mm]

Type:

list of float

direction

Unit vector direction to shoot from

Type:

list of float

Examples

my_gun = gun(

instance_name = ‘4gev-e-into-target’, particle = ‘e-‘, energy = 4.0, direction = [0., 0., 1.], position = [0., 0., 0.]

)

beam_spot_smear: list[Any]
class_name: str = 'simcore::generators::ParticleGun'
direction: list[float]
energy: float = 0.0
instance_name: str = 'simcore::generators::ParticleGun'
module_name: str = 'SimCore_Generators'
particle: str = ''
position: list[float]
time: float = 0.0
verbosity: int = 0
class LDMX.SimCore.generators.Lhe(file_path: str, vertex: list[float] = <factory>, instance_name: str = 'simcore::generators::LHEPrimaryGenerator', beam_spot_smear: list[Any] = <factory>)

Bases: PrimaryGenerator

LHE file primary generator

Parameters:
  • file_path (str) – path to LHE file containing the primary vertices

  • vertex (list of float, optional) – Vertex position to shoot from [mm]. Defaults to [0.0, 0.0, 0.0]

beam_spot_smear: list[Any]
class_name: str = 'simcore::generators::LHEPrimaryGenerator'
file_path: str
instance_name: str = 'simcore::generators::LHEPrimaryGenerator'
module_name: str = 'SimCore_Generators'
vertex: list[float]
class LDMX.SimCore.generators.Multi(enable_poisson: bool = False, vertex: list[float] = <factory>, momentum: list[float] = <factory>, n_particles: int = 1, pdg_id: int = 0, instance_name: str = 'simcore::generators::MultiParticleGunPrimaryGenerator', beam_spot_smear: list[Any] = <factory>)

Bases: PrimaryGenerator

multi particle gun primary generator

enable_poisson

Poisson-distribute number of particles?

Type:

bool, optional

vertex

Position to shoot particle(s) from [mm]

Type:

list of float

momentum

3-momentum to give particle(s) in [MeV]

Type:

list of float

n_particles

Number of particles to shoot (or average of Poisson distribution)

Type:

int, optional

pdg_id

PDG ID of particle(s) to shoot

Type:

int

beam_spot_smear: list[Any]
class_name: str = 'simcore::generators::MultiParticleGunPrimaryGenerator'
enable_poisson: bool = False
instance_name: str = 'simcore::generators::MultiParticleGunPrimaryGenerator'
module_name: str = 'SimCore_Generators'
momentum: list[float]
n_particles: int = 1
pdg_id: int = 0
vertex: list[float]
class LDMX.SimCore.generators.PrimaryGenerator

Bases: object

Base for all primary generators for type checking

LDMX.SimCore.generators.primary_generator(class_name: str, module_name: str = 'SimCore_Generators')

Label a class as configuration for a primary generator

Parameters:
  • class_name (str) – Name of C++ class that this PrimaryGenerator should be

  • module_name (str, optional) – Name of C++ library that this primary generator is compiled into

LDMX.SimCore.generators.instance_name

Unique name for this particular instance of a PrimaryGenerator

Type:

str

LDMX.SimCore.generators.beam_spot_smear

2 (x,y) or 3 (x,y,z) widths to smear primary vertices from this generator [mm]. If set, this generator will handle its own beam spot smearing instead of using the global simulator beam_spot_smear setting.

Type:

list of float, optional

LDMX.SimCore.generators.single_1pt2gev_e_upstream_tagger()

Configure a particle gun to fire a 8 GeV electron upstream of the tagger tracker.

The position and direction are set such that the electron will be bent by the field and arrive at the target at [0, 0, 0] if it isn’t smeared and doesn’t interact with any material. In reality, it will be smeared and it will interact with some material but we can dream.

Returns:

  • Instance of a particle gun configured to fire a single 8 GeV electron

  • upstream of the entire detector apparatus.

LDMX.SimCore.generators.single_4gev_e_upstream_tagger()

Configure a particle gun to fire a 4 GeV electron upstream of the tagger tracker.

The position and direction are set such that the electron will be bent by the field and arrive at the target at [0, 0, 0] if it isn’t smeared and doesn’t interact with any material. In reality, it will be smeared and it will interact with some material but we can dream.

Returns:

  • Instance of a particle gun configured to fire a single 4 Gev electron

  • upstream of the entire detector apparatus.

LDMX.SimCore.generators.single_4gev_e_upstream_target()

Configure a particle gun to fire a 4 GeV electron upstream of the tagger tracker.

The position and direction are set such that the electron will be bent by the field and arrive at the target at approximately [0, 0, 0] (assuming it’s not smeared).

Returns:

  • Instance of a particle gun configured to fire a single 4 Gev electron

  • directly upstream of the target.

LDMX.SimCore.generators.single_8gev_e_upstream_tagger()

Configure a particle gun to fire a 8 GeV electron upstream of the tagger tracker.

The position and direction are set such that the electron will be bent by the field and arrive at the target at [0, 0, 0] if it isn’t smeared and doesn’t interact with any material. In reality, it will be smeared and it will interact with some material but we can dream.

Returns:

  • Instance of a particle gun configured to fire a single 8 GeV electron

  • upstream of the entire detector apparatus.

LDMX.SimCore.generators.single_backwards_positron(energy: float)

A particle gun configured to shoot positrons backwards (i.e. upstream) from the target at the input energy.

This generator is helpful for studying where electron guns of different energies should be started from if they should end up at the center of the target.

Parameters:

energy (float) – energy in GeV of the positron

Returns:

configured particle gun to shoot positrons backwards at the input energy

Return type:

gun

LDMX.SimCore.generators.single_e_beam_pipe(ene=8.0)

Configure a particle gun to fire an electron of settable energy upstream of the tagger tracker.

The starting position here is well upstream of the analyzing magnet the position/angle of the gun is such that 8 gev electrons arrive at the target z=0 at xy=(0,0). This generator is used to study off-energy beam electrons.

Note that if an energy != 8gev, the trajectory will be different. And many electrons with energies sufficiently lower than 8GeV will just curve into the side of the magnet and not reach the target.

Returns:

  • Instance of a particle gun configured to fire a single 8 GeV electron

  • upstream of the entire detector apparatus.

LDMX.SimCore.genie_reweight module

class LDMX.SimCore.genie_reweight.GenieReweightProducer(instance_name: str = 'GenieReweightProducer', histograms: list[LDMX.Framework._histogram.Histogram] = <factory>, seed: int = 10, n_weights: int = 100, var_types: list[str] = <factory>, message_threshold_file: str = '/usr/local/GENIE/Generator/config/Messenger.xml', event_weights_coll_name: str = 'genieEventWeights', hepmc3_coll_name: str = '', hepmc3_pass_name: str = '')

Bases: Processor

class_name: str = 'simcore::GenieReweightProducer'
event_weights_coll_name: str = 'genieEventWeights'
hepmc3_coll_name: str = ''
hepmc3_pass_name: str = ''
instance_name: str = 'GenieReweightProducer'
message_threshold_file: str = '/usr/local/GENIE/Generator/config/Messenger.xml'
module_name: str = 'SimCore::Reweight'
n_weights: int = 100
seed: int = 10
var_types: list[str]

LDMX.SimCore.kaon_physics module

class LDMX.SimCore.kaon_physics.KaonPhysics(kplus_branching_ratios: list[float] = <factory>, kminus_branching_ratios: list[float] = <factory>, k0l_branching_ratios: list[float] = <factory>, k0s_branching_ratios: list[float] = <factory>, kplus_lifetime_factor: float = 1.0, kminus_lifetime_factor: float = 1.0, k0l_lifetime_factor: float = 1.0, k0s_lifetime_factor: float = 1.0, verbosity: int = 0)

Bases: object

Parameters that determine the physics of kaons in the simulation

Ensure that attempts to set the branching ratios give a total of something close to 1 and that the lifetime factors are positive.

Note that Geant4’s defaults are not exactly equal to one, but something significantly different from one is likely to be a mistake.

Parameters:
  • kplus_branching_ratios (list[float])

  • kminus_branching_ratios (list[float])

  • k0l_branching_ratios (list[float])

  • k0s_branching_ratios (list[float]) –

    List of the desired branching ratios for kaons. The entries correspond go the following processes

    For charged kaons - 0: K -> mu + v - 1: K -> pi + pi0 - 2: K -> 3 pi - 3: K -> pi + 2 pi0 - 4: K -> pi0 + e + v - 5: K -> pi0 + mu + v

    For Klong - 0: K -> 3 pi0 - 1: K -> pi0 + pi+ + pi- - 2: K -> pi- + e+ + v - 3: K -> pi+ + e- + v - 4: K -> pi- + mu+ + v - 5: K -> pi+ + mu- + v

    For Kshort: - 0: K -> pi+ + pi- - 1: K -> 2 pi0

    See the sources for Geant4’s definitions and branching ratios (G4KaonMinus.cc, G4KaonPlus.cc, KaonZeroLong.cc, KaonZeroShort.cc). The default branching ratios correspond to the Geant4 defaults.

  • kplus_lifetime_factor (float)

  • kminus_lifetime_factor (float)

  • k0l_lifetime_factor (float)

  • k0s_lifetime_factor (float) – Multiplicative factor to scale the lifetime of kaons by. Default is to scale by 1 (no scaling)

  • verbosity (int) – If > 0: Dump details about the decay after the update If > 1: Also dump details about the decay before the update to show the difference

k0l_branching_ratios: list[float]
k0l_lifetime_factor: float = 1.0
k0s_branching_ratios: list[float]
k0s_lifetime_factor: float = 1.0
kminus_branching_ratios: list[float]
kminus_lifetime_factor: float = 1.0
kplus_branching_ratios: list[float]
kplus_lifetime_factor: float = 1.0
up_kaons()

Returns a configuration of the kaon physics corresponding to the changes that were made in https://github.com/ldmx-software/geant4/tree/LDMX.upKaons_mod

Reduces the charged kaon lifetimes by a factor 1/50 and forces decays to be into one of the leptonic decay modes.

See https://github.com/LDMX-Software/geant4/commit/25228b8b1fbad913b4933b7c0d3951ebe36d404c

verbosity: int = 0

LDMX.SimCore.photonuclear_models module

Configuration classes for default photonuclear models

class LDMX.SimCore.photonuclear_models.BertiniAtLeastNProductsModel(min_products: int, pdg_ids: list[int] = <factory>, hard_particle_threshold: float = 200.0, zmin: int = 0, emin: float = 2500.0, instance_name: str = 'simcore::BertiniAtLeastNProductsModel')

Bases: PhotoNuclearModel

A photonuclear model producing only topologies with no particles above a certain threshold.

Uses the default Bertini model from Geant4.

class_name: str = 'simcore::BertiniAtLeastNProductsModel'
emin: float = 2500.0
hard_particle_threshold: float = 200.0
instance_name: str = 'simcore::BertiniAtLeastNProductsModel'
kaon(hard_particle_threshold=200.0)
min_products: int
module_name: str = 'SimCore_PhotoNuclearModels'
pdg_ids: list[int]
zmin: int = 0
class LDMX.SimCore.photonuclear_models.BertiniExactlyNProductsModel(n_products: int, pdg_ids: list[int], hard_particle_threshold: float = 200.0, zmin: int = 0, emin: float = 2500.0, check_allmatch: bool = False, instance_name: str = 'simcore::BertiniExactlyNProductsModel')

Bases: PhotoNuclearModel

A photonuclear model producing only topologies with a define number of particles above a certain threshold.

Uses the default Bertini model from Geant4.

check_allmatch: bool = False
class_name: str = 'simcore::BertiniExactlyNProductsModel'
emin: float = 2500.0
hard_particle_threshold: float = 200.0
instance_name: str = 'simcore::BertiniExactlyNProductsModel'
kaon(hard_particle_threshold=200.0)
module_name: str = 'SimCore_PhotoNuclearModels'
n_products: int
neutron(hard_particle_threshold=200.0)
pdg_ids: list[int]
zmin: int = 0
class LDMX.SimCore.photonuclear_models.BertiniModel(instance_name: str = 'simcore::BertiniModel')

Bases: PhotoNuclearModel

The default model for photonuclear interactions.

Keeps the default Bertini model from Geant4.

class_name: str = 'simcore::BertiniModel'
instance_name: str = 'simcore::BertiniModel'
module_name: str = 'SimCore_PhotoNuclearModels'
class LDMX.SimCore.photonuclear_models.BertiniNothingHardModel(count_light_ions: bool = True, hard_particle_threshold: float = 200.0, zmin: int = 74, emin: float = 2500.0, instance_name: str = 'simcore::BertiniNothingHardModel')

Bases: PhotoNuclearModel

A photonuclear model producing only topologies with no particles above a certain threshold.

Uses the default Bertini model from Geant4.

Nothing hard events are unlikely to come from low A nuclei. This can be tested by instrumenting one of the models and checking the typical number of attempts for different nuclei.

If we count light ions and nuclei as potential hard particles and ignore events producing heavy exotic particles, then here are some example results:

Z74 -> ~5000 attempts

While for lighter nuclei, perhaps unsurprsingly Z1 -> 1e5 attempts before giving up Z6 -> 1e5 attempts before giving up Z7 -> 1e5 attempts before giving up Z8 -> 1e5 attempts before giving up Z11 -> 1e5 attempts before giving up Z14 -> 1e5 attempts before giving up Z20 -> 1e5 attempts before giving up Z29 -> 30000 attempts

In a similar manner, we can check how often a photonuclear interaction is with a particular nucleus in an ECal PN sample

|Nucleus | Rate [%] | | H | 4.78 | | C | 9.73 | | N | 0.04 | | O | 7.01 | | Ni | 1.25 | | Al | 0.01 | | Si | 6.23 | | Ca | 1.36 | | Mn | 0.01 | | Fe | 0.67 | | Cu | 12.47 | | W | 56.44 |

So for the purposes of running Nothing hard simulations, it is probably fine to have a high zmin value, either 29 (Cu) or 74 (W). Single hard particle events, however, can come from any kind of nucleus.

class_name: str = 'simcore::BertiniNothingHardModel'
count_light_ions: bool = True
emin: float = 2500.0
hard_particle_threshold: float = 200.0
instance_name: str = 'simcore::BertiniNothingHardModel'
module_name: str = 'SimCore_PhotoNuclearModels'
zmin: int = 74
class LDMX.SimCore.photonuclear_models.BertiniSingleNeutronModel(hard_particle_threshold: float = 200.0, zmin: int = 0, emin: float = 2500.0, count_light_ions: bool = True, instance_name: str = 'simcore::BertiniSingleNeutronModel')

Bases: PhotoNuclearModel

A photonuclear model producing only topologies where only one neutron has kinetic energy above a particular threshold.

Uses the default Bertini model from Geant4.

class_name: str = 'simcore::BertiniSingleNeutronModel'
count_light_ions: bool = True
emin: float = 2500.0
hard_particle_threshold: float = 200.0
instance_name: str = 'simcore::BertiniSingleNeutronModel'
module_name: str = 'SimCore_PhotoNuclearModels'
zmin: int = 0
class LDMX.SimCore.photonuclear_models.NoPhotoNuclearModel(instance_name: str = 'simcore::NoPhotoNuclearModel')

Bases: PhotoNuclearModel

A PhotoNuclear model that disables the photonuclear process entirely.

Make sure that no biasing operators for photonuclear reactions are enabled when using this model.

class_name: str = 'simcore::NoPhotoNuclearModel'
instance_name: str = 'simcore::NoPhotoNuclearModel'
module_name: str = 'SimCore_PhotoNuclearModels'
class LDMX.SimCore.photonuclear_models.PhotoNuclearModel

Bases: object

LDMX.SimCore.photonuclear_models.photo_nuclear_model(class_name: str, module_name: str = 'SimCore_PhotoNuclearModels')

Configuration for a photonuclear model that we want to load

Parameters:
  • class_name (str) – Name of C++ class that this PhotoNuclear model should be

  • module_name (str) – Name of C++ library that this PhotoNuclear model is compiled into

LDMX.SimCore.sensitive_detectors module

Configuration classes for sensitive detectors

class LDMX.SimCore.sensitive_detectors.EcalSD(enable_hit_contribs: bool = True, compress_hit_contribs: bool = True, max_origin_track_id: int = 6, class_name: str = 'simcore::EcalSD', instance_name: str = 'simcore::EcalSD', module_name: str = 'SimCore_SDs')

Bases: SensitiveDetector

SD for the ECal

The two configurable parameters are inherited from a legacy method of merging simulated hit contribs. We have plans to update this hit merging in the future.

Parameters:
  • enable_hit_contribs (bool, optional) – Should the simulation save contributions to Ecal sim hits?

  • compress_hit_contribs (bool, optional) – Should the simulation compress contributions to Ecal sim hits by PDG ID?

class_name: str = 'simcore::EcalSD'
compress_hit_contribs: bool = True
enable_hit_contribs: bool = True
instance_name: str = 'simcore::EcalSD'
max_origin_track_id: int = 6
module_name: str = 'SimCore_SDs'
class LDMX.SimCore.sensitive_detectors.HcalSD(gdml_identifiers: list[str] = <factory>, enable_hit_contribs: bool = True, compress_hit_contribs: bool = True, max_origin_track_id: int = 6, class_name: str = 'simcore::HcalSD', instance_name: str = 'simcore::HcalSD', module_name: str = 'SimCore_SDs')

Bases: SensitiveDetector

SD for the HCal

Separate from the other calorimeters since it includes a Birks law estimate.

Parameters:
  • gdml_identifiers (list[str]) –

    A list of strings used to determine which volumes in the Hcal are considered sensitive. Any volume name containing at least one of these identifiers will have a sensitive detector attached.

    The current defaults match the mainline LDMX Hcal and prototype Hcal (scint_box) scintillator geometries.

  • enable_hit_contribs (bool, optional) – Should the simulation save contributions to Hcal sim hits?

  • compress_hit_contribs (bool, optional) – Should the simulation compress contributions to Hcal sim hits by PDG ID?

class_name: str = 'simcore::HcalSD'
compress_hit_contribs: bool = True
enable_hit_contribs: bool = True
gdml_identifiers: list[str]
instance_name: str = 'simcore::HcalSD'
max_origin_track_id: int = 6
module_name: str = 'SimCore_SDs'
class LDMX.SimCore.sensitive_detectors.ScoringPlaneSD(subsystem: str, class_name: str = 'simcore::ScoringPlaneSD', instance_name: str = 'simcore::ScoringPlaneSD', module_name: str = 'SimCore_SDs')

Bases: SensitiveDetector

Scoring plane SD

Simply collecting tracker-hit equivalent for scoring planes that enclose different subsystems

Parameters:

subsystem (str) – Name of subsystem to store scoring plane hits for Names must match what is in gdml for sp_<subsystem>

class_name: str = 'simcore::ScoringPlaneSD'
collection_name: str
ecal()
hcal()
instance_name: str = 'simcore::ScoringPlaneSD'
magnet()
match_substr: str
module_name: str = 'SimCore_SDs'
subsystem: str
target()
tracker()
trigscint()
class LDMX.SimCore.sensitive_detectors.SensitiveDetector

Bases: object

base class for sensitive detectors

here for type-checking the simulator parameters

class LDMX.SimCore.sensitive_detectors.TrackerSD(subsystem: str, subdet_id: int, class_name: str = 'simcore::TrackerSD', instance_name: str = 'simcore::TrackerSD', module_name: str = 'SimCore_SDs')

Bases: SensitiveDetector

SD for the recoil and tagging trackers

Parameters:
  • subsystem (str) – Recoil or Tagger

  • subdet_id (int) – ID number for the subsystem

class_name: str = 'simcore::TrackerSD'
collection_name: str
instance_name: str = 'simcore::TrackerSD'
module_name: str = 'SimCore_SDs'
recoil()
subdet_id: int
subsystem: str
tagger()
class LDMX.SimCore.sensitive_detectors.TrigScintSD(module_id: int, name: str, volume_name: str, use_birks_law: bool = False, birks_const_one: float = 0.0129, birks_const_two: float = 9.59e-06, class_name: str = 'simcore::TrigScintSD', instance_name: str = 'simcore::TrigScintSD', module_name: str = 'SimCore_SDs')

Bases: SensitiveDetector

Trigger Scintillaotr Sensitive Detector

used for both the trigger pad modules as well as collecting hits within the target itself

Parameters:
  • module (int) – ID number for the module we are collecting hits from

  • name (str) – Short name to be used in building collection name

  • vol (str) – Name of logical volume(s) that this SD should be attached to DEPENDS ON GDML

  • use_birks_law (bool, optional) – Should the simulation use Birks law to estimate energy deposition? Defaults to False.

  • birks_const_one (float, optional) – First Birks constant, defaults to 1.29e-2

  • birks_const_two (float, optional) – Second Birks constant, defaults to 9.59e-6

birks_const_one: float = 0.0129
birks_const_two: float = 9.59e-06
class_name: str = 'simcore::TrigScintSD'
collection_name: str
down()
instance_name: str = 'simcore::TrigScintSD'
module_id: int
module_name: str = 'SimCore_SDs'
name: str
pad1()
pad2()
pad3()
tag()
target()

Target sensitive detector

testbeam()
up()
use_birks_law: bool = False
volume_name: str
LDMX.SimCore.sensitive_detectors.sensitive_detector(class_name: str, module_name: str = 'SimCore_SDs')

Configuration for a sensitive detector we want to load

Parameters:
  • instance_name (str) – Unique name for this particular instance of a PrimaryGenerator

  • class_name (str) – Name of C++ class that this PrimaryGenerator should be

  • module_name (str) – Name of C++ library that this primary generator is compiled into

LDMX.SimCore.simulator module

Package to help configure the simulation

Defines a derived class from ldmxcfg.Producer with several helpful member functions.

class LDMX.SimCore.simulator.ReSimulator(instance_name: str = 'ReSimulator', histograms: list[Histogram] = <factory>, generators: list[PrimaryGenerator] = <factory>, detector: str = '', sensitive_detectors: list[SensitiveDetector] = <factory>, description: str = '', scoring_planes: str = '', time_shift_primaries: bool = True, pre_init_commands: list[str] = <factory>, post_init_commands: list[str] = <factory>, actions: list[UserAction] = <factory>, biasing_operators: list[XsecBiasingOperator] = <factory>, logging_prefix: str = 'GEANT4', root_primary_gen_use_seed: bool = False, validate_detector: bool = False, verbosity: int = 0, dark_brem: DarkBrem = <factory>, photonuclear_model: PhotoNuclearModel = <factory>, kaon_parameters: KaonPhysics = <factory>, fcp_physics: FCPPhysics = <factory>, resimulate_all_events: bool = True, care_about_run: bool = False, events_to_resimulate: list[_EventToReSim] = <factory>)

Bases: Processor

Configuration for resimulating events from an existing file.

Created via Simulator.resimulate() to carry the same configuration as the original simulation plus the re-simulation-specific parameters.

resimulate_all_events

If True, every event in the input file is re-simulated.

Type:

bool

care_about_run

If True, match both run and event number when selecting events.

Type:

bool

events_to_resimulate

Specific events (and optionally runs) to re-simulate when resimulate_all_events is False.

Type:

list of _EventToReSim

actions: list[UserAction]
biasing_operators: list[XsecBiasingOperator]
care_about_run: bool = False
class_name: str = 'simcore::ReSimulator'
dark_brem: DarkBrem
description: str = ''
detector: str = ''
events_to_resimulate: list[_EventToReSim]
fcp_physics: FCPPhysics
generators: list[PrimaryGenerator]
instance_name: str = 'ReSimulator'
kaon_parameters: KaonPhysics
logging_prefix: str = 'GEANT4'
module_name: str = 'SimCore'
photonuclear_model: PhotoNuclearModel
post_init_commands: list[str]
pre_init_commands: list[str]
resimulate_all_events: bool = True
root_primary_gen_use_seed: bool = False
scoring_planes: str = ''
sensitive_detectors: list[SensitiveDetector]
time_shift_primaries: bool = True
validate_detector: bool = False
verbosity: int = 0
class LDMX.SimCore.simulator.Simulator(instance_name: str = 'Simulator', histograms: list[Histogram] = <factory>, generators: list[PrimaryGenerator] = <factory>, detector: str = '', sensitive_detectors: list[SensitiveDetector] = <factory>, description: str = '', scoring_planes: str = '', time_shift_primaries: bool = True, pre_init_commands: list[str] = <factory>, post_init_commands: list[str] = <factory>, actions: list[UserAction] = <factory>, biasing_operators: list[XsecBiasingOperator] = <factory>, logging_prefix: str = 'GEANT4', root_primary_gen_use_seed: bool = False, validate_detector: bool = False, verbosity: int = 0, dark_brem: DarkBrem = <factory>, photonuclear_model: PhotoNuclearModel = <factory>, kaon_parameters: KaonPhysics = <factory>, fcp_physics: FCPPhysics = <factory>)

Bases: Processor

A instance of the simulation configuration

This class is derived from ldmxcfg.Producer and is mainly focused on providing helper functions that can be used instead of accessing the parameters member directly.

The parameters that are lists are initialized as empty lists so that we can append to them later.

Parameters:

instance_name (str) – Name of this instance of the Simulator

generators

Generators to use to make primaries

Type:

list of PrimaryGenerator

detector

Full path to detector description gdml (suggested to use set_detector)

Type:

str

validate_detector

Should we have Geant4 validate that the gdml is correctly formatted?

Type:

bool, optional

sensitive_detectors

List of sensitive detectors to load

Type:

list[SensitiveDetector]

description

Describe this run in a human-readable way

Type:

str

scoringPlanes

Full path to the scoring planes gdml (suggested to use set_detector)

Type:

str, optional

time_shift_primaries

Should we shift the times of primaries so that z=0mm corresponds to t=0ns?

Type:

bool

pre_init_commands

Geant4 commands to run before the run is initialized

Type:

list of str, optional

post_init_commands

Geant4 commands to run after run is initialized (but before run starts)

Type:

list of str, optional

actions

Special User-defined actions to take during the simulation

Type:

list of UserAction, optional

biasing_operators

Operators for biasing specific particles to undergo specific processes

Type:

list of XsecBiasingOperators, optional

dark_brem

Configuration options for dark brem process

Type:

DarkBrem

logging_prefix

Prefix to prepend any Geant4 logging files

Type:

str, optional

rootPrimaryGenUseSeed

Use the seed stored in the EventHeader for random generation

Type:

bool, optional

verbosity

Verbosity level to print

Type:

int, optional

actions: list[UserAction]
biasing_operators: list[XsecBiasingOperator]
class_name: str = 'simcore::Simulator'
dark_brem: DarkBrem
description: str = ''
detector: str = ''
fcp_physics: FCPPhysics
generators: list[PrimaryGenerator]
instance_name: str = 'Simulator'
kaon_parameters: KaonPhysics
logging_prefix: str = 'GEANT4'
module_name: str = 'SimCore'
photonuclear_model: PhotoNuclearModel
post_init_commands: list[str]
pre_init_commands: list[str]
resimulate(which_events=None, which_runs=None)

Create a resimulator based on the simulator configuration.

This is intended to ensure that a resimulator has the same configuration as the simulation that was used to generate the input file. If you require any changes to the simulation configuration, such as loading a modified geometry, you can make those changes after creating the resiulator.

Parameters:
  • which_events (list of event numbers, optional) –

    Which events from the input files to resimulate. If None, resimulate all events.

    Events that are not present in any of the input files will be ignored.

    For multiple input files, if an event number is present within more than one input file all versions will be resimulated unless the which_runs parameters is used to distinguish them.

  • which_runs (list of run numbers, optional) –

    Which runs from the input files to resimulate, ignored if no events are listed. Runs not present in the input files will be ignored.

    If not provided, all runs will be resimulated (i.e. the run number check is ignored). If only one value is provided, all events requested are also required to have that value for their run number to be resimulated. If more than one value is provided, it must be the same length as the number of events requested so that the event/run number pair can be required.

root_primary_gen_use_seed: bool = False
scoring_planes: str = ''
sensitive_detectors: list[SensitiveDetector]
set_detector(det_name, include_scoring_planes_others=False, include_scoring_planes_minimal=False)

Set the detector description with the option to include the scoring planes

Parameters:
  • det_name (str) – name of a detector in the Detectors module

  • include_scoring_planes_minimal (bool) – True if you want to import only target and ecal scoring planes

  • include_scoring_planes_others (bool) – True if you want to import the remaining other scoring planes

See also

LDMX.Detectors.makePath, sensitive_detectors

time_shift_primaries: bool = True
validate_detector: bool = False
verbosity: int = 0

LDMX.SimCore.user_actions module

Internal configuration module for UserActions

class LDMX.SimCore.user_actions.UserAction

Bases: object

LDMX.SimCore.user_actions.user_action(class_name: str, module_name: str = 'SimCore')

Module contents