Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation of 8GeV Signal #1215

Merged
merged 10 commits into from
Oct 11, 2023
2 changes: 2 additions & 0 deletions .github/validation_samples/signal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env.sh
scratch
71 changes: 71 additions & 0 deletions .github/validation_samples/signal/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
from LDMX.Framework import ldmxcfg
p = ldmxcfg.Process('test')

p.maxTriesPerEvent = 10000

from LDMX.Biasing import target
mySim = target.dark_brem(
#A' mass in MeV - set in init.sh to same value in GeV
10.0,
# library path is uniquely determined by arguments given to `dbgen run` in init.sh
# easiest way to find this path out is by running `. init.sh` locally to see what
# is produced
'electron_tungsten_MaxE_8.0_MinE_4.0_RelEStep_0.1_UndecayedAP_mA_0.01_run_1',
'ldmx-det-v14-8gev'
)

p.sequence = [ mySim ]

##################################################################
# Below should be the same for all sim scenarios

import os
import sys

p.maxEvents = int(os.environ['LDMX_NUM_EVENTS'])
p.run = int(os.environ['LDMX_RUN_NUMBER'])

p.histogramFile = f'hist.root'
p.outputFiles = [f'events.root']

import LDMX.Ecal.EcalGeometry
import LDMX.Ecal.ecal_hardcoded_conditions
import LDMX.Hcal.HcalGeometry
import LDMX.Hcal.hcal_hardcoded_conditions
import LDMX.Ecal.digi as ecal_digi
import LDMX.Ecal.vetos as ecal_vetos
import LDMX.Hcal.digi as hcal_digi

from LDMX.TrigScint.trigScint import TrigScintDigiProducer
from LDMX.TrigScint.trigScint import TrigScintClusterProducer
from LDMX.TrigScint.trigScint import trigScintTrack
ts_digis = [
TrigScintDigiProducer.pad1(),
TrigScintDigiProducer.pad2(),
TrigScintDigiProducer.pad3(),
]
for d in ts_digis :
d.randomSeed = 1

from LDMX.Recon.electronCounter import ElectronCounter
from LDMX.Recon.simpleTrigger import TriggerProcessor

count = ElectronCounter(1,'ElectronCounter')
count.input_pass_name = ''

from LDMX.DQM import dqm

p.sequence.extend([
ecal_digi.EcalDigiProducer(),
ecal_digi.EcalRecProducer(),
ecal_vetos.EcalVetoProcessor(),
hcal_digi.HcalDigiProducer(),
hcal_digi.HcalRecProducer(),
*ts_digis,
TrigScintClusterProducer.pad1(),
TrigScintClusterProducer.pad2(),
TrigScintClusterProducer.pad3(),
trigScintTrack,
count, TriggerProcessor('trigger'),
dqm.DarkBremInteraction()
] + dqm.all_dqm)
24 changes: 24 additions & 0 deletions .github/validation_samples/signal/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

###############################################################################
# init.sh
# Pre-validation initializing for dark brem signal samples
#
# We need to produce the dark brem event library.
###############################################################################

start_group Produce Dark Brem Library
wget https://raw.githubusercontent.com/LDMX-Software/dark-brem-lib-gen/main/env.sh
source env.sh
# commented out lines are dbgen's defaults for reference
#dbgen use latest
#dbgen cache ${HOME} <- only matters for apptainer/singularity
#dbgen work /tmp
#dbgen dest $PWD
mkdir scratch
dbgen work scratch
dbgen run \
--run 1 \
--max_energy 8.0 \
--apmass 0.01
end_group
15 changes: 9 additions & 6 deletions Biasing/python/target.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def gamma_mumu( detector, generator ) :

return sim

def dark_brem( ap_mass , lhe, detector ) :
def 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
Expand Down Expand Up @@ -214,26 +214,29 @@ def dark_brem( ap_mass , lhe, detector ) :

sim.description = "One e- fired far upstream with Dark Brem turned on and biased up in target"
sim.setDetector( detector , True )
sim.generators.append( generators.single_4gev_e_upstream_tagger() )
sim.generators.append( generators.single_8gev_e_upstream_tagger() )
sim.beamSpotSmear = [ 20., 80., 0. ] #mm

#Activiate dark bremming with a certain A' mass and LHE library
from LDMX.SimCore import dark_brem
db_model = dark_brem.G4DarkBreMModel(lhe)
db_model.threshold = 2. #GeV - minimum energy electron needs to have to dark brem
db_model.threshold = 4. #GeV - minimum energy electron needs to have to dark brem
db_model.epsilon = 0.01 #decrease epsilon from one to help with Geant4 biasing calculations
sim.dark_brem.activate( ap_mass , db_model )

import math
mass_power = max(math.log10(sim.dark_brem.ap_mass), 2.)

#Biasing dark brem up inside of the target
sim.biasing_operators = [
bias_operators.DarkBrem.target(sim.dark_brem.ap_mass**2 / db_model.epsilon**2)
bias_operators.DarkBrem.target(sim.dark_brem.ap_mass**mass_power / db_model.epsilon**2)
]

sim.actions.extend([
#make sure electron reaches target with 3.5GeV
filters.TaggerVetoFilter(3500.),
filters.TaggerVetoFilter(7000.),
#make sure dark brem occurs in the target where A' has at least 2GeV
filters.TargetDarkBremFilter(2000.),
filters.TargetDarkBremFilter(4000.),
#keep all prodcuts of dark brem(A' and recoil electron)
util.TrackProcessFilter.dark_brem()
])
Expand Down
32 changes: 32 additions & 0 deletions DQM/python/dqm.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,38 @@ def __init__(self,name='sim_dqm',sim_pass='') :
self.sim_pass = sim_pass


class DarkBremInteraction(ldmxcfg.Producer) :
def __init__(self) :
super().__init__('db_kinematics','dqm::DarkBremInteraction','DQM')

self.build1DHistogram('aprime_energy',
'Dark Photon Energy [MeV]',101,0,8080)
self.build1DHistogram('aprime_pt',
'Dark Photon pT [MeV]',100,0,2000)

self.build1DHistogram('recoil_energy',
'Recoil Electron Energy [MeV]',101,0,8080)
self.build1DHistogram('recoil_pt',
'Recoil Electron pT [MeV]',100,0,2000)

self.build1DHistogram('incident_energy',
'Incident Electron Energy [MeV]',101,0,8080)
self.build1DHistogram('incident_pt',
'Incident Electron pT [MeV]',100,0,2000)

# weird binning so we can see the target and trigger pads
self.build1DHistogram('dark_brem_z',
'Z Location of Dark Brem [mm]',
[-5.0, -4.6752, -3.5502, -2.4252, -1.3002, -0.1752, 0.1752, 1.])
# elements are hydrogen and carbon (for trigger pads) and tungsten target
self.build1DHistogram('dark_brem_element',
'Element in which Dark Brem Occurred',
10, 0, 10)
self.build1DHistogram('dark_brem_material',
'Material in which Dark Brem Occurred',
8, 0, 8)


class HCalRawDigi(ldmxcfg.Analyzer) :
def __init__(self, input_name) :
super().__init__('hcal_pedestals','dqm::HCalRawDigi','DQM')
Expand Down
Loading