Go Back to: C++ Manual General Site
LDMX.Biasing package¶
Submodules¶
LDMX.Biasing.eat module¶
Example configurations for producing biased interactions in the ECal.
This module is built for the ECal as Target (EaT) analysis channel where we are studying the events that have a primary electron reaching the ECal at nearly full energy.
Example
from LDMX.Biasing import eat
- LDMX.Biasing.eat.dark_brem(ap_mass, db_event_lib, detector, generator, scale_APrime=False, decay_mode='no_decay', ap_tau=-1.0, dist_decay_min=0.0, dist_decay_max=1.0)¶
Example configuration for producing dark brem interactions in the ECal.
This configures the simulator to fire a 4 GeV electron upstream of the tagger tracker. The electron is allowed to propagate into the ECal where the dark-photon production cross-section is biased up. Only events that result in a dark-photon being produced in the ECal are kept.
- Parameters:
ap_mass (float) – The mass of the A’ in MeV.
db_event_lib (str) – The path to the reference library to use as vertices of the dark brem.
detector (str) – Path to the detector.
generator (simcfg.PrimaryGenerator) – Beam generator for this simulation which should be a ParticleGun so we can configure the PrimaryToEcalFilter to select events where beam electrons retain 87.5% of their energy.
scale_APrime (bool) – Whether to scale the A’ momentum along with the recoil electron.
decay_mode (str) – The A’ decay mode. Either no_decay, flat_decay, or geant_decay
ap_tau (float) – The A’ decay lifetime in seconds
dist_decay_min (float) – The minimum lab-frame distance at which to decay the A’
dist_decay_max (float) – The maximum lab-frame distance at which to decay the A’
- Return type:
Instance of the simulator configured for dark-brem production in the ECal.
Example
from LDMX.SimCore import generators eat_ap_sim = eat.dark_brem(
1000., ‘path/to/1GeV_mA_library’, ‘ldmx-det-v14’, generators.single_e_4gev_upstream_tagger()
)
- LDMX.Biasing.eat.midshower_dimuon(detector, generator, bias_factor, bias_threshold, min_dimuon_energy)¶
Example configuration for producing mid-shower dimuon interactions in the ECal that fake a missing energy (ME) signal.
In this particular example, 4 GeV electrons are fired upstream of the tagger tracker. Then simulation events are then put through a series of filters.
- Parameters:
detector (str) – Name of the detector
generator (simcfg.PrimaryGenerator) – Beam generator for this simulation which should be a ParticleGun so we can configure the PrimaryToEcalFilter to select events where beam electrons retain 87.5% of their energy.
bias_factor (float) – Factor to multiply GammaToMuPair xsec by within the ECal
bias_threshold (float) – Minium energy [MeV] to bias a photon
min_dimuon_energy (float) – Minium total energy [MeV] that went to muons to keep event
- Returns:
configured for mid-shower dimuon interactions and far-upstream generator
- Return type:
Example
from LDMX.Biasing import eat from LDMX.SimCore import generators eat_dimuon = eat.midshower_dimuon(
‘ldmx-det-v14’, generators.single_e_4gev_upstream_tagger(), 1e4, 500., 1000.
)
- LDMX.Biasing.eat.midshower_nuclear(detector, generator, bias_factor, bias_threshold, min_nuclear_energy)¶
Example configuration for producing mid-shower nuclear interactions in the ECal that fake a missing energy (ME) signal.
In this particular example, 4 GeV electrons are fired upstream of the tagger tracker. Then simulation events are then put through a series of filters.
- Parameters:
detector (str) – Name of the detector
generator (simcfg.PrimaryGenerator) – Beam generator for this simulation which should be a ParticleGun so we can configure the PrimaryToEcalFilter to select events where beam electrons retain 87.5% of their energy.
bias_factor (float) – Factor to multiply EN/PN xsecs by
bias_threshold (float) – Minium energy [MeV] to bias a particle
min_nuclear_energy (float) – Minium total energy [MeV] that went nuclear to keep event
- Returns:
configured for mid-shower nuclear interactions and far-upstream generator
- Return type:
Example
from LDMX.Biasing import eat from LDMX.SimCore import generators eat_dimuon = eat.midshower_nuclear(
‘ldmx-det-v14’, generators.single_e_4gev_upstream_tagger(), 200, 1500., 2500.
)
LDMX.Biasing.ecal module¶
Example configurations for producing biased interactions in the ECal.
Example
from LDMX.Biasing import ecal
- LDMX.Biasing.ecal.deep_photo_nuclear(detector, generator, bias_threshold, processes, ecal_min_Z, require_photon_fromTarget=False)¶
- LDMX.Biasing.ecal.gamma_mumu(detector, generator)¶
Example configuration for biasing gamma to mu+ mu- conversions in the ecal.
In this particular example, 4 GeV elecrons are fired upstream of the tagger tracker. The TargetBremFilter filters out all events that don’t produce a brem in the target with an energy greater than 2.5 GeV.
- Parameters:
detector (str) – Path to the detector
- Return type:
Instance of the sim configured for target gamma to muon conversions.
Example
ecal_mumu_sim = ecal.gamma_mumu(‘ldmx-det-v12’)
- LDMX.Biasing.ecal.nonfiducial_photo_nuclear(detector, generator)¶
- LDMX.Biasing.ecal.photo_nuclear(detector, generator)¶
Example configuration for producing photo-nuclear reactions in the ECal.
In this particular example, 4 GeV electrons are fired upstream of the tagger tracker. The TargetBremFilter filters out all events that don’t produced a brem in the target with an energy greater than 2.5 GeV. The brems are allowed to propagate to the ECal at which point they are checked by the EcalProcessFilter. Only events that see the brem photon undergo a photo-nucler reaction in the ECal are kept.
- Parameters:
detector (str) – Path to the detector
generator (PrimaryGenerator) – generator to use
- Return type:
Instance of the simulator configured for ECal photo-nuclear.
Example
ecal_pn_sim = ecal.photo_nuclear(‘ldmx-det-v12’)
LDMX.Biasing.filters module¶
filters Examples of how each filter is configured for biased MC generation.
The configurations below reflect the nominal values currently being used for large scale production. When debugging, it’s best to create these generators directly.
- class LDMX.Biasing.filters.DeepEcalProcessFilter(bias_threshold, processes, ecal_min_Z, require_photon_fromTarget)¶
Bases:
UserAction
Configuration for keeping events where the pn happens deep in the ECAL.
- Parameters:
bias_threshold (double) – Threshold for minimum energy that the products should have
processes (vector of str) – The allowed processes that can happen deep inside the ECAL, default is conversion (conv) and photoelectron (photo)
ecal_min_Z (double) – Minimum Z location where the deep process should happen
require_photon_fromTarget (bool) – Require that the hard brem photon originates from the target Default is False
- class LDMX.Biasing.filters.EcalDarkBremFilter(minApEnergy)¶
Bases:
UserAction
Configuration for filtering A’ events
- Parameters:
minApEnergy (float) – Minimum A’ energy to keep the event [MeV]
- class LDMX.Biasing.filters.EcalProcessFilter(process='photonNuclear')¶
Bases:
UserAction
Configuration for filtering events that don’t see a hard brem undergo a photo-nuclear reaction in the ECal.
- Parameters:
process (str) – Geant4 process to look for in the ecal
- class LDMX.Biasing.filters.MidShowerDiMuonBkgdFilter(thresh)¶
Bases:
UserAction
Configuration used to reject events that don’t have enough energy given to muon conversion
- Parameters:
thresh (float) – Minimum energy [MeV] that needs to go into creating the muons
- class LDMX.Biasing.filters.MidShowerNuclearBkgdFilter(thresh)¶
Bases:
UserAction
Configuration used to reject events that don’t have enough energy given to the input process.
- Parameters:
thresh (float) – Minimum energy [MeV] that the kinetic energy of the products needs to sum to
- class LDMX.Biasing.filters.NonFiducialFilter(recoil_max_momentum=1500.0, abort_fid_event=True)¶
Bases:
UserAction
Configuration for rejecting events that are fiducial.
- Parameters:
recoil_max_p (float) – Maximum momentum the recoil electron can have [MeV]
abort_fiducial (bool) – If true, aborts fiducial events. Otherwise, the fiducial events will be only tagged
- class LDMX.Biasing.filters.PrimaryToEcalFilter(thresh)¶
Bases:
UserAction
Configuration used to reject events where the primary doesn’t reach the ecal with a mimimum energy
- Parameters:
thresh (float) – Minimum energy [MeV] that primary electron should have when hitting ecal
- class LDMX.Biasing.filters.TaggerHitFilter(layersHit=8)¶
Bases:
UserAction
Configuration used to reject off-energy electrons in the tagger tracker. :param layers_hit: Minimum number of tagger layers with a hit needed to persist the event. :type layers_hit: int
- class LDMX.Biasing.filters.TaggerVetoFilter(thresh=3800.0, reject_events_missing_tagger=True)¶
Bases:
UserAction
Configuration used to reject off-energy electrons in the tagger tracker.
- Parameters:
thresh (float) – Minimum energy [MeV] that electron should have
reject_events_missing_tagger (bool) – Also veto events where the primary particle misses the tagger region
- class LDMX.Biasing.filters.TargetBremFilter(recoil_max_p=1500.0, brem_min_e=2500.0)¶
Bases:
UserAction
Configuration for filtering events that don’t see a hard brem in the target.
An event is vetoed if one of two conditions is satisfied: 1) The recoil electron exits the target area with an energy above 1500 MeV 2) The recoil electorn brems, but the energy of at least one of the brems isn’t above 2500 MeV.
- Parameters:
recoil_max_p (float) – Maximum momentum the recoil electron can have [MeV]
brem_min_e (float) – Minimum energy the brem photon can have [MeV]
- kill_recoil_track¶
Should we kill the recoil electron track for a worst case scenario?
- Type:
bool
- class LDMX.Biasing.filters.TargetDarkBremFilter(minApEnergy)¶
Bases:
UserAction
Configuration for filtering A’ events
- Parameters:
minApEnergy (float) – Minimum A’ energy to keep the event [MeV]
- class LDMX.Biasing.filters.TargetENFilter(recoil_thresh=2500.0)¶
Bases:
UserAction
Configuration for filtering electro-nuclear events in the target.
- Parameters:
recoil_thresh (float) – Maximum energy recoil electron is allowed to have [MeV]
- class LDMX.Biasing.filters.TargetGammaMuMuFilter¶
Bases:
UserAction
Configuration for filtering muon conversion events in the target.
- class LDMX.Biasing.filters.TargetPNFilter¶
Bases:
UserAction
Configuration for filtering photo-nuclear events in the target.
LDMX.Biasing.include module¶
Include the Biasing module
- LDMX.Biasing.include.library()¶
Attach the name of Biasing library to the process
LDMX.Biasing.particle_filter module¶
Example configurations for filtering out PN events by the properties of of the reaction products.
- class LDMX.Biasing.particle_filter.PhotoNuclearProductsFilter(name)¶
Bases:
UserAction
Configuration for keeping events with specific products of PN interactions
- Parameters:
name (str) – Name for this filter
- pdg_ids¶
List of PDG product IDs to look for in PN products
- Type:
list of ints
- kaon()¶
Configuration for filtering photo-nuclear events whose products don’t contain a kaon.
- Return type:
Instance of configured PhotoNuclearProductsFilter
- class LDMX.Biasing.particle_filter.PhotoNuclearTopologyFilter(name, filter_class)¶
Bases:
UserAction
Configuration for keeping events with a PN reaction producing a particular event topology.
- Parameters:
name (str) – Name for this filter
filter_class – Name of the class that implements this filter. Should correspond to the invocation of DECLARE_ACTION in PhotoNuclearTopologyFilters.cxx
- hard_particle_threshold¶
The kinetic energy threshold required to count a particle as “hard”
- Type:
float
- count_light_ions¶
Whether or not light ions (e.g. deutrons) should be considered when applying the filter. Setting this to False can produce misleading results such as classifying events with very high kinetic energy light ions as “Nothing Hard” but it is the current default choice in the PhotoNuclearDQM.
- Type:
bool
- NothingHardFilter()¶
Configuration for keeping photonuclear events no particles received significant kinetic energy.
- Return type:
Instance of configured PhotoNuclearTopologyFilter
- SingleNeutronFilter()¶
Configuration for keeping photonuclear events where a single neutron carries most of the kinetic energy from the interaction
- Return type:
Instance of configured PhotoNuclearTopologyFilter
LDMX.Biasing.target module¶
Example configurations for producing biased interactions in the target.
Example
from LDMX.Biasing import target
- LDMX.Biasing.target.dark_brem(ap_mass, lhe, detector)¶
Example configuration for producing dark brem interactions in the target.
This configures the sim to fire a 4 GeV electron upstream of the tagger tracker. The dark-photon production cross-section is biased up in the target. Only events that result in a dark-photon being produced in the target are kept.
- Parameters:
ap_mass (float) – The mass of the A’ in MeV.
lhe (str) – The path to the directory containing LHE files to use as events of the dark brem.
detector (str) – Name of detector to simulate in
- Return type:
Instance of the sim configured for dark-brem production in the target.
Example
Here we use the example vertex library. This should not be used for large (>50k) event samples.
from LDMX.SimCore import makePath target_ap_sim = target.dark_brem(1000., makePath.makeLHEPath(1000.), ‘ldmx-det-v12’)
In general, the second argument should be the full path to the LHE event library.
target_ap_sim = target.dark_brem(1000, ‘path/to/lhe’, ‘ldmx-det-v12’)
- LDMX.Biasing.target.electro_nuclear(detector, generator)¶
Example configuration for producing electro-nuclear reactions in the target.
In this particular example, 4 GeV electrons are fired upstream of the tagger tracker. TargetENFilter filters out events that don’t see an electro-nuclear reaction take places in the target.
- Parameters:
detector (str) – Path to the detector
- Return type:
Instance of the sim configured for target electro-nuclear.
Example
target_en_sim = target.electro_nuclear(‘ldmx-det-v12’)
- LDMX.Biasing.target.gamma_mumu(detector, generator)¶
Example configuration for biasing gamma to mu+ mu- conversions in the target.
In this particular example, 4 GeV electrons are fired upstream of the tagger tracker. The TargetBremFilter filters out all events that don’t produced a brem in the target with an energy greater than 2.5 GeV.
- Parameters:
detector (str) – Path to the detector
- Return type:
Instance of the sim configured for target gamma to muon conversions.
Example
target_mumu_sim = target.gamma_mumu(‘ldmx-det-v12’)
- LDMX.Biasing.target.photo_nuclear(detector, generator)¶
Example configuration for producing photo-nuclear reactions in the ECal.
In this particular example, 4 GeV electrons are fired upstream of the tagger tracker. The TargetBremFilter filters out all events that don’t produced a brem in the target with an energy greater than 2.5 GeV. TargetBremFilter filters out events that don’t see the brem photon undergo a photo-nuclear reaction in the target.
- Parameters:
detector (str) – Path to the detector
- Return type:
Instance of the sim configured for target photo-nuclear.
Example
target_pn_sim = target.photo_nuclear(‘ldmx-det-v12’)
LDMX.Biasing.util module¶
Utility classes for Simulation
- class LDMX.Biasing.util.BiasingUtilityAction(instance_name, class_name)¶
Bases:
UserAction
Helpful derived class for this submodule, makes sure the library and namespace are set correctly.
- Parameters:
instance_name (str) – name of this instance
class_name (str) – name of the class within this submodule
- class LDMX.Biasing.util.DecayChildrenKeeper(parents)¶
Bases:
BiasingUtilityAction
Configuration used to store children of specific particle decays
- Parameters:
parents (list[int]) – list of PDG ID of particles whose decay products we want to keep
- class LDMX.Biasing.util.PartialEnergySorter(thresh)¶
Bases:
BiasingUtilityAction
Process particles such that all particles above the input threshold are processed first.
- Parameters:
thresh (float) – Minimum energy [MeV] to process a track first
- class LDMX.Biasing.util.StepPrinter(track_id=1, process_name='', depth=0)¶
Bases:
BiasingUtilityAction
Print each step of the input track ID
The default track ID is 1 (the primary particle).
- Parameters:
track_id (int, optional) – Geant4 track ID to print each step of
- class LDMX.Biasing.util.TrackProcessFilter(process_name)¶
Bases:
BiasingUtilityAction
Configuration used to tag all tracks produced via the given process to persist them to the event.
- Parameters:
process_name (str) – The Geant4 process name (e.g. photonNuclear) via which the tracks were produced.
- conversion()¶
Configuration used to tag all electron conversion tracks to persist them to the event.
- Return type:
Instance of TrackProcessFilter configured to tag conversion tracks.
- dark_brem()¶
Configuration used to tag all dark brem tracks to persist them to the event.
- Return type:
Instance of TrackProcessFilter configured to tag dark brem tracks.
- electro_nuclear()¶
Configuration used to tag all electro-nuclear tracks to persist them to the event.
- Return type:
Instance of TrackProcessFilter configured to tag electro-nuclear tracks.
- electron_brem()¶
Configuration used to tag all electron brem tracks to persist them to the event.
- Return type:
Instance of TrackProcessFilter configured to tag eBrem tracks.
- gamma_mumu()¶
Configuration used to tag all gamma –> mu+ mu- tracks to persist them to the event.
- Return type:
Instance of TrackProcessFilter configured to tag gamma –> mu+ mu- tracks.
- photo_nuclear()¶
Configuration used to tag all photo-nuclear tracks to persist them to the event.
- Return type:
Instance of TrackProcessFilter configured to tag photo-nuclear tracks.