示例#1
0
from LDMX.Framework import ldmxcfg
p = ldmxcfg.Process('target_pn')
from LDMX.Biasing import target
from LDMX.SimCore import generators
import LDMX.Ecal.EcalGeometry
p.sequence = [
    target.photo_nuclear( 
        'ldmx-det-v12' , 
        generators.single_4gev_e_upstream_tagger()
        )
    ]
p.maxEvents = 1000
p.outputFiles = [ '/tmp/target_pn.root' ]
示例#2
0
parser = argparse.ArgumentParser(description='')

parser.add_argument('--run_number',
                    type=int,
                    default=1,
                    help='ID number for this run.')
parser.add_argument('--batch_job',
                    type=int,
                    default=1,
                    help='Batch ID Number in the bsub system.')

args = parser.parse_args()

from LDMX.Framework import ldmxcfg

p = ldmxcfg.Process("sim")
p.run = args.run_number
p.maxEvents = 1000 * 1000  #  1M

from LDMX.SimCore import simulator
from LDMX.SimCore import generators
from LDMX.Biasing import target
from LDMX.Biasing import particle_filter
from LDMX.SimCore import bias_operators
from LDMX.Biasing import include as includeBiasing
from LDMX.Biasing import filters
from LDMX.Biasing import util
from LDMX.SimCore import examples

from LDMX.Ecal import EcalGeometry
示例#3
0
import argparse

usage = "ldmx fire %s"%(sys.argv[0])
parser = argparse.ArgumentParser(usage,formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument("run_number",help="Set the random seed for the simulation.",type=int)

arg = parser.parse_args()

# Internal "process ID" for separating run numbers of different samples
pid=2

# We need the ldmx configuration package to construct the processor objects
from LDMX.Framework import ldmxcfg

p = ldmxcfg.Process( 'eat' )
p.maxEvents = 1000000
p.run = int('%d%05d'%(pid,arg.run_number))

from LDMX.Biasing import eat
# Inputs:
#   geometry, bias_factor, bias_threshold, min_nuclear_energy
bias_factor = 200.
bias_threshold = 1500. #MeV
min_nuc_energy = 2500. #MeV
bkgd_sim = eat.midshower_nuclear('ldmx-det-v12',bias_factor,bias_threshold,min_nuc_energy)
p.outputFiles = [ f'nuclear_Nevents_1M_MaxTries_1_BiasFactor_{bias_factor}_BiasThresh_{bias_threshold}_MinNucE_{min_nuc_energy}_run_{arg.run_number:05d}.root']

from LDMX.Ecal import digi, vetos
from LDMX.Ecal import EcalGeometry, ecal_hardcoded_conditions
from LDMX.Hcal import hcal
import os

# We need the ldmx configuration package to construct the processor objects
from LDMX.Framework import ldmxcfg

# Setup producers with default templates
from LDMX.EventProc.ecalDigis import ecalDigis
from LDMX.EventProc.ecalVeto import ecalVeto
from LDMX.EventProc.hcalDigis import hcalDigis
from LDMX.EventProc.hcalVeto import hcalVeto
from LDMX.EventProc.simpleTrigger import simpleTrigger
from LDMX.EventProc.trackerHitKiller import trackerHitKiller

# Define the process, which must have a name which identifies this
# processing pass ("pass name").
p = ldmxcfg.Process("recon")

# Currently, we need to explicitly identify plugin libraries which should be
# loaded.  In future, we do not expect this be necessary
p.libraries.append("libEventProc.so")

# Create a processor to determine how many findable tracks are in an event.
findableTrack = ldmxcfg.Producer("findable", "ldmx::FindableTrackProcessor")

# Create a processor to veto events with that don't have a single track with
# momentum < 1.2 GeV.
trackerVeto = ldmxcfg.Producer("trackerVeto", "ldmx::TrackerVetoProcessor")

# Define the sequence of event processor to be run
p.sequence = [
    ecalDigis, hcalDigis, ecalVeto, hcalVeto, simpleTrigger, trackerHitKiller,
示例#5
0
#!/usr/bin/python

from LDMX.Framework import ldmxcfg

p = ldmxcfg.Process("drop")

p.libraries.append("libEventProc.so")
p.libraries.append("libEcal.so")

from LDMX.EventProc.hcalDigis import hcalDigis
from LDMX.Ecal.ecalDigis import ecalDigis
from LDMX.Ecal.ecalRecon import ecalRecon

p.keep = [
    "drop .*SimHits.*"  #drop all sim hits
    ,
    "keep EcalSimHits.*"  #except the ones in the ECal
]

p.sequence = [hcalDigis, ecalDigis, ecalRecon]

p.inputFiles = ["input.root"]  #CHANGE ME to your actual input file

p.maxEvents = 50

p.outputFiles = ["output.root"]

print p
示例#6
0
#!/usr/bin/python

import sys

# we need the ldmx configuration package to construct the object
from LDMX.Framework import ldmxcfg

# first, we define the process, which must have a name which identifies this
# processing pass ("pass name").
p = ldmxcfg.Process("digi")

# Currently, we need to explicitly identify plugin libraries which should be
# loaded.  In future, we do not expect this be necessary
p.libraries.append("libEventProc.so")

# load the template hcalDigis configuration from its python file
from LDMX.EventProc.hcalDigis import hcalDigis

# change the noise level (for testing)
hcalDigis.parameters["meanNoise"] = 1.5

# load the template ecalDigis configuration from its python file
from LDMX.EventProc.ecalDigis import ecalDigis

# load the template ecalDigis configuration from its python file
from LDMX.EventProc.simpleTrigger import simpleTrigger

# Define the sequence of event processors to be run
p.sequence = [ecalDigis, hcalDigis, simpleTrigger]

# Provide the list of input files to run on
示例#7
0
from LDMX.Framework import ldmxcfg
p = ldmxcfg.Process('ecal_pn')
from LDMX.Biasing import ecal
from LDMX.SimCore import generators
p.sequence = [
    ecal.photo_nuclear('ldmx-det-v12',
                       generators.single_4gev_e_upstream_tagger())
]
p.maxEvents = 1000
p.outputFiles = ['/tmp/ecal_pn.root']
示例#8
0
#!/usr/bin/python

import sys
import os

# we need the ldmx configuration package to construct the object

from LDMX.Framework import ldmxcfg

# first, we define the process, which must have a name which identifies this
# processing pass ("pass name").
#p=ldmxcfg.Process("sim")
p = ldmxcfg.Process("overlay")

#import all processors

p.run = 2

#pull in input file

inputName = sys.argv[1]
p.inputFiles = [inputName]

#from LDMX.EventProc import overlay
from LDMX.EventProc.overlay import OverlayProducer
overlay = OverlayProducer(
    "pileup_run1_1e_upstream_4GeV.root")  #"pileup_1e_upstream_4GeV.root" ) #
#overlay = ldmxcfg.Producer("overlay", "ldmx::OverlayProducer", "EventProc")

overlay.passName = "v12"
overlay.overlayPassName = "pileup"
示例#9
0
from LDMX.Framework import ldmxcfg

# Create a process with pass name "vetoana"
p = ldmxcfg.Process('ecalMultiElecAna')

# Append the library that contains the analyzer below to the list of libraries
# that the framework will load.
# change the next line to point to your own ldmx-sw install directory!
#p.libraries.append("/nfs/slac/g/ldmx/users/vdutta/ldmx-analysis-2.1/install/lib/libAnalysis.so")
# Should now be done automatically when declaring module below

# Create an instance of the ECal veto analyzer.  This analyzer is used to create
# an ntuple out of ECal BDT variables. The analyzer requires that the
# veto collection name be set.
ecal_veto_ana = ldmxcfg.Producer("ecalMulti", "ldmx::ECalMultiElecAnalyzer",
                                 "Analysis")
ecal_veto_ana.ecal_simhit_collection = "EcalSimHits"

from LDMX.DetDescr import EcalHexReadout
ecal_veto_ana.hexReadout = EcalHexReadout.EcalHexReadout()

# Define the order in which the analyzers will be executed.
p.sequence = [ecal_veto_ana]

p.keep = ["keep .*"]

# Specify the list of input files.
p.inputFiles = ["$inputEventFile"]

# Specify the output file.  When creating ntuples or saving histograms, the
# output file name is specified by setting the attribute histogramFile.
from LDMX.Framework import ldmxcfg

# Create a process with pass name "recon"
p = ldmxcfg.Process('vetoana')

# Create an instance of the ECal veto analyzer.  This analyzer is used to create
# an ntuple out of ECal BDT variables. The analyzer requires that the
# veto collection name be set.
from LDMX.Analysis import ecal
ecal_veto_ana = ecal.ECalVetoAnalyzer()
ecal_veto_ana.ecal_veto_collection = "EcalVetoGabriel"

# Create an instance of the HCal veto analyzer. This analyzer is used to create
# an ntuple with results from the HCal veto processor.
from LDMX.Analysis import hcal
hcal_veto_ana = hcal.HCalVetoAnalyzer("hcal")

# Define the order in which the analyzers will be executed.
p.sequence = [ecal_veto_ana, hcal_veto_ana]

# input the file as an argument on the command line
import sys
p.inputFiles = [sys.argv[1]]

# Specify the output file.  When creating ntuples or saving histograms, the
# output file name is specified by setting the attribute histogramFile.
p.histogramFile = 'ntuple_test.root'

# Print out the details of the configured analyzers.
p.pause()
示例#11
0
#!/bin/python3

import os
import sys
import json

from LDMX.Framework import ldmxcfg

p = ldmxcfg.Process("v12")
p.run = 1

from LDMX.SimCore import simulator
import LDMX.Ecal.EcalGeometry
sim = simulator.simulator("mySim")
sim.setDetector('ldmx-det-v12', True)
sim.description = "ECal photo-nuclear, xsec bias 450"
sim.randomSeeds = [2 * p.run, 2 * p.run + 1]
sim.beamSpotSmear = [20., 80., 0]
from LDMX.SimCore import generators
sim.generators = [generators.single_4gev_e_upstream_tagger()]
sim.biasingOn(True)
sim.biasingConfigure('photonNuclear', 'ecal', 2500., 450)
from LDMX.Biasing import filters
sim.actions = [
    filters.TaggerVetoFilter(),
    filters.TargetBremFilter(),
    filters.EcalProcessFilter(),
    filters.TrackProcessFilter.photo_nuclear()
]

from LDMX.TrigScint.trigScint import TrigScintDigiProducer
示例#12
0
#!/usr/bin/python

from LDMX.Framework import ldmxcfg

p = ldmxcfg.Process("plot")

testplot = ldmxcfg.Analyzer("testplot", "ldmx::DummyAnalyzer")

testplot.parameters["caloHitCollection"] = "hcalDigis"

p.sequence = [testplot]
p.inputFiles = ["ldmx_digi_events.root"]
p.maxEvents = 50
p.histogramFile = "histo.root"

p.printMe()
示例#13
0
# We need the ldmx configuration package to construct the processor objects
from LDMX.Framework import ldmxcfg

style_name = ''
style_id = -1
if arg.eat :
    style_name = 'eat'
    style_id = 1
elif arg.old :
    style_name = 'old'
    style_id = 2
elif arg.new :
    style_name = 'new'
    style_id = 3

p = ldmxcfg.Process('signal')
p.maxTriesPerEvent = arg.maxTries
p.maxEvents = arg.numEvents
p.logFrequency = int(arg.numEvents/20)
p.termLogLevel = 1

if arg.verbose :
    p.termLogLevel = 1
    p.logFrequency = 100

# make sure outDir is actually there
if not os.path.isdir( arg.outDir ) :
    os.makedirs( arg.outDir )

# Dark Brem Vertex Library
#  TODO add this process to the model constructor
示例#14
0
#!/usr/bin/python

import sys
import os
from LDMX.Framework import ldmxcfg

ecalSimHitSort = ldmxcfg.Producer("ecalSimHitSort",
                                  "ldmx::SimHitSortProcessor")
ecalSimHitSort.parameters["simHitCollection"] = "EcalSimHits"
ecalSimHitSort.parameters["outputCollection"] = "SortedEcalSimHits"
hcalSimHitSort = ldmxcfg.Producer("hcalSimHitSort",
                                  "ldmx::SimHitSortProcessor")
hcalSimHitSort.parameters["simHitCollection"] = "HcalSimHits"
hcalSimHitSort.parameters["outputCollection"] = "SortedHcalSimHits"

p = ldmxcfg.Process("sort")
p.libraries.append("ldmx-sw-install/lib/libEventProc.so")

p.sequence = [ecalSimHitSort, hcalSimHitSort]

p.inputFiles = [
    "/nfs/slac/g/ldmx/data/mc/v2/4pt0_gev_electrons_ecal_photonuc_v2_fieldmap/4pt0_gev_electrons_ecal_photonuc_v2_fieldmap_10to6_04752.root"
]
p.outputFiles = ["recon_test.root"]
示例#15
0
#!/usr/bin/python

import sys
import os
import json

# we need the ldmx configuration package to construct the object

from LDMX.Framework import ldmxcfg

# first, we define the process, which must have a name which identifies this
# processing pass ("pass name").
p=ldmxcfg.Process("anaTS")

p.inputFiles = [ sys.argv[1] ]

from LDMX.Analysis import ts2

ana=ts2.TSTrackAnalyzer2()
ana.passName="sim"
ana.rechit_collection="trigScintDigisTag" #RecHitsTagger_timeCut"
ana.truth_track_collection="TriggerPadTracks" 
ana.truth_passName="truth"
p.sequence = [ ana ]

p.termLogLevel = 2
#p.fileLogLevel = 0
#p.logFileName = sys.argv[1].replace(".root", ".log")

# set the maximum number of events to process
p.maxEvents=10000
#!/usr/bin/python
import sys
import os

from LDMX.Framework import ldmxcfg

passName = "truth"
p = ldmxcfg.Process(passName)
simPassName = "sim"  #<-- whatever is in the input, if those collections would be used for anything, instead of the pass created here
#maximum number of events to process
nEv = 10000

if len(sys.argv) >= 2:
    inputName = sys.argv[1]  #specify the input name
else:
    #inputName=sys.argv[0]
    print(
        "An input file name has to be specified. Use (positional) argument 2 for it."
    )
    exit(1)
    #inputName="NonRotarun1-eout.root"
print("Using input file name: " + inputName)

if len(sys.argv) >= 3:
    outputName = sys.argv[
        2]  #specify the output name if default is not desired
else:
    outputName = "clustered_truth_" + inputName
print("Using output file name: " + outputName)

#setup a log file