示例#1
0
def dark_brem( ap_mass , lhe, detector ) :
    """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.
    lhe : str
        The path to the LHE file to use as vertices of the dark brem. 
    detector : str
        Path to the detector.

    Return
    ------
    Instance of the simulator configured for dark-brem production in the ECal.

    Example
    -------

        ecal_ap_sim = ecal.dark_brem(1000, 'path/to/lhe', 'ldmx-det-v12')


    """
    
    sim = simulator.simulator( "darkBrem_%sMeV" % str(massAPrime) )
    
    sim.description = "One e- fired far upstream with Dark Brem turned on and biased up in ECal"
    sim.setDetector( detector , True )
    sim.generators.append( generators.single_4gev_e_upstream_tagger() )
    
    # Bias the electron dark brem process inside of the ECal
    # These commands allow us to restrict the dark brem process to a given 
    # volume.
    sim.biasingOn()
    sim.biasingConfigure( 'eDBrem' , 'ecal' , 0. , 100000 )
    
    sim.darkBremOn( massAPrime #MeV
            , lheFile 
            , 1 ) #Forward Only
    
    # the following filters are in a library that needs to be included
    includeBiasing.library()

    # Then give the UserAction to the simulation so that it knows to use it
    sim.actions().extend([ 
            # Only keep events when a dark brem happens in the target
            filters.DarkBremFilter('ecal') , 
            # Keep all of the dark brem daughters. 
            filters.TrackProcessFilter.dark_brem()
    ])
    
    return sim
示例#2
0
def 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 

    Returns
    -------
    Instance of the sim configured for target electro-nuclear.

    Example
    -------

        target_en_sim = target.electro_nuclear('ldmx-det-v12')

    """

    # Instantiate the sim.
    sim = simulator.simulator("target_electronNuclear")

    # Set the path to the detector to use.
    #   Also tell the simulator to include scoring planes
    sim.setDetector(detector, True)

    # Set run parameters
    sim.runNumber = 0
    sim.description = "Target electron-nuclear, xsec bias 1e8"
    sim.beamSpotSmear = [20., 80., 0.]  #mm

    sim.generators.append(generator)

    # Enable and configure the biasing
    sim.biasingOn()
    sim.biasingConfigure('electronNuclear', 'target', 0., int(1e8))

    # the following filters are in a library that needs to be included
    includeBiasing.library()

    # Configure the sequence in which user actions should be called.
    sim.actions.extend([
        filters.TaggerVetoFilter(),
        filters.TargetENFilter(2500.),
        filters.TrackProcessFilter.electro_nuclear()
    ])

    return sim
示例#3
0
) > 2:  # "run number"; mostly for guaranteeing uniqueness -- uses multiplicity as default
    runNb = int(sys.argv[2])
else:
    runNb = int(nPart)

if len(sys.argv) > 3:
    outputName = sys.argv[
        3]  #specify the output name if default is not desired
else:
    outputName = "ldmx_upstreamElectron"

doPoisson = False  #set to true to get poisson varied number of beam electrons instead of fixed

# ------------------- all set; setup in detail, and run with these settings ---------------

mySim = simulator.simulator("mySim")
mySim.runNumber = runNb
mySim.description = "Upstream 4 GeV " + nPart + "-electron beam"
mySim.beamSpotSmear = [20., 80., 0]  #mm

# get the path to the installed detector description

from LDMX.Detectors.makePath import *

mySim.setDetector('ldmx-det-v12',
                  True)  #the true should tell it to include scoring planes
mySim.scoringPlanes = makeScoringPlanesPath('ldmx-det-v12')

mpgGen = gen.multi(
    "mgpGen")  # this is the line that actually creates the generator
mpgGen.vertex = [-27.926, 0., -700]  # mm
示例#4
0
def 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 

    Returns
    -------
    Instance of the sim configured for target photo-nuclear.

    Example
    -------

        target_pn_sim = target.photo_nuclear('ldmx-det-v12')

    """

    # Instantiate the sim.
    sim = simulator.simulator("target_photonNuclear")

    # Set the path to the detector to use.
    #   Also tell the simulator to include scoring planes
    sim.setDetector(detector, True)

    # Set run parameters
    sim.runNumber = 0
    sim.description = "ECal photo-nuclear, xsec bias 450"
    sim.beamSpotSmear = [20., 80., 0.]

    sim.generators.append(generator)

    # Enable and configure the biasing
    sim.biasingOn()
    sim.biasingConfigure(
        'photonNuclear'  #process
        ,
        'target'  #volume
        ,
        2500.  #threshold in MeV
        ,
        450  #factor
    )

    # the following filters are in a library that needs to be included
    includeBiasing.library()

    # Configure the sequence in which user actions should be called.
    sim.actions.extend([
        filters.TaggerVetoFilter(),
        # Only consider events where a hard brem occurs
        filters.TargetBremFilter(),
        filters.TargetPNFilter(),
        # Tag all photo-nuclear tracks to persist them to the event.
        filters.TrackProcessFilter.photo_nuclear()
    ])

    return sim
示例#5
0
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 
    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 LHE file to use as vertices of the dark brem. 
    detector : str
        Name of detector to simulate in

    Return
    ------
    Instance of the sim configured for dark-brem production in the target.

    Example
    -------

        target_ap_sim = target.dark_brem(1000, 'path/to/lhe', 'ldmx-det-v12')


    """
    sim = simulator.simulator("darkBrem_" + str(massAPrime) + "_MeV")

    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())

    # Bias the electron dark brem process inside of the target
    # These commands allow us to restrict the dark brem process to a given
    # volume.
    sim.biasingOn()
    sim.biasingConfigure(
        'eDBrem'  #process
        ,
        'target'  #volume
        ,
        0.  #threshold
        ,
        1000000  #factor
    )

    sim.darkBremOn(
        massAPrime  #MeV
        ,
        lheFile,
        1  #Forward Only
    )

    # the following filters are in a library that needs to be included
    includeBiasing.library()

    # Then give the UserAction to the simulation so that it knows to use it
    sim.actions.extend(
        [filters.DarkBremFilter(),
         filters.TrackProcessFilter.dark_brem()])

    return sim
示例#6
0
geom = HcalGeometry.HcalGeometryProvider.getInstance()
import LDMX.Hcal.hcal_hardcoded_conditions

from LDMX.Ecal import digi as ecal_digi
from LDMX.Hcal import digi as hcal_digi

kaon_filter = particle_filter.PhotoNuclearProductsFilter("kaons_filter")
kaon_filter.pdg_ids = [
    130,  # K_L^0                                                                                                                                                                                                                                             
    310,  # K_S^0                                                                                                                                                                                                                                             
    311,  # K^0                                                                                                                                                                                                                                               
    321  # K^+                                                                                                                                                                                                                                               
]

sim = simulator.simulator("target_photonNuclear")
sim.setDetector('ldmx-det-v12', True)
sim.runNumber = 0
sim.description = "Target photo-nuclear, xsec bias 1.1e9"
sim.beamSpotSmear = [20., 80., 0.]
sim.generators.append(generators.single_4gev_e_upstream_tagger())

allids = kaon_filter.pdg_ids
allids.append(-321)

sim.biasing_operators = [
    bias_operators.PhotoNuclear('target_region',
                                1.1e9,
                                2500.,
                                only_children_of_primary=True)
]
示例#7
0
if arg.outDir == '.' :
    full_out_dir = os.path.realpath('.')
else :
    full_out_dir = os.path.join(os.path.realpath(arg.outDir),str(int(ap_mass)))

if not os.path.exists(full_out_dir) :
    os.makedirs(full_out_dir)

p.outputFiles = [ os.path.join( full_out_dir , out_file_name ) ]
p.run = int('%d%04d%04d'%(style_id,int(ap_mass),run_num))

# set up simulation
sim = None #declare simulator object
if arg.old :
    from LDMX.SimCore import simulator
    sim = simulator.simulator( '%s_signal_sim'%style_name )
    sim.setDetector( 'ldmx-det-v12' , True )

    import glob
    possible_lhes = glob.glob( db_event_lib_path+'/*IncidentE_4.0*.lhe' )

    if len(possible_lhes) == 1 :
        the_lhe = possible_lhes[0].strip()
    else :
        raise Exception("Not exactly one LHE file simulated for 4GeV Beam and input mass")

    # count number of events in the LHE so we don't go over accidentally
    num_events = 0
    with open(the_lhe,'r') as lhef :
        for line in lhef :
            num_events += line.count('/event')
示例#8
0
def 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

    Returns
    -------
    Instance of the simulator configured for ECal photo-nuclear.

    Example
    -------

        ecal_pn_sim = ecal.photo_nuclear('ldmx-det-v12')

    """


    # Instantiate the simulator. 
    sim = simulator.simulator("photo-nuclear")
    
    # Set the path to the detector to use.
    #   the second parameter says we want to include scoring planes
    sim.setDetector( detector , True )
    
    # Set run parameters
    sim.runNumber = 0
    sim.description = "ECal photo-nuclear, xsec bias 450"
    sim.beamSpotSmear = [20., 80., 0.] #mm
    
    sim.generators.append( generator )
    
    # Enable and configure the biasing
    sim.biasingOn()
    sim.biasingConfigure( 'photonNuclear' , 'ecal' , 2500. , 450 )

    # the following filters are in a library that needs to be included
    includeBiasing.library()

    # Configure the sequence in which user actions should be called.
    sim.actions.extend([
            filters.TaggerVetoFilter(),
            # Only consider events where a hard brem occurs
            filters.TargetBremFilter(),
            # Only consider events where a PN reaction happnes in the ECal
            filters.EcalProcessFilter(),     
            # Tag all photo-nuclear tracks to persist them to the event.
            filters.TrackProcessFilter.photo_nuclear()
    ])

    return sim