forked from awhitbeck/LDMX_TS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrunClusteringAndTracking.py
105 lines (70 loc) · 3.29 KB
/
runClusteringAndTracking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/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").
# it's pretty arbitrary but you will see it in the final collection names.
p=ldmxcfg.Process("digi")
#load the template trigger scintillator clustering and tracking configuration files
from LDMX.TrigScint.trigScint import TrigScintClusterProducer
from LDMX.TrigScint.trigScint import trigScintTrack
#clustering: seeding threshold
tagSeed = 30.
upSeed= 30.
downSeed = upSeed
#cluster width (upper limit on nHits/cluster)
tagWidth = 2 # can be up to 3 (default)
#cluster threshold: hits below this PE count are neglected
tagClThr = 5. # default: 1. here use something >> typical electronics noise, which is 1 (sometimes 2) PE
#tracking: max distance between cluster candidate position and seed cluster position
maxDelta = 1.25
clusteringVerbosity=0
trackingVerbosity=0
#maximum number of events to process
nEv = 10000
if len(sys.argv) < 1 :
print("The number of beam electrons has to be specified. Use (positional) argument 1 for it.")
exit(1)
else :
nPart=sys.argv[1] #number of beam electrons to use
runNb = nPart # "run number"; for file name uniqueness when there are multiple runs -- uses multiplicity as default
if len(sys.argv) > 2 :
inputName=sys.argv[2] #specify the input name if default is not desired
else:
inputName="ldmx_upstreamElectron_run%i_%se_%sevents.root" %( runNb, nPart, nEv)
print("Using input file name: "+inputName)
if len(sys.argv) > 3 :
outputName=sys.argv[3] #specify the output name if default is not desired
else:
outputName="clustered_"+inputName
print("Using output file name: "+outputName)
# ------------------- all set; propagate these settings in detail, and run ---------------
# Define the sequence of event processors to be run
# --- clustering ---
clTag=TrigScintClusterProducer.tagger()
clUp=TrigScintClusterProducer.up()
clDown=TrigScintClusterProducer.down()
clTag.verbosity = clusteringVerbosity
clUp.verbosity = clusteringVerbosity
clDown.verbosity = clusteringVerbosity
# here the seeds etc could also be set
clTag.max_cluster_width = tagWidth
clTag.clustering_threshold = tagClThr
clTag.seed_threshold = tagSeed
clUp.seed_threshold = upSeed
clDown.seed_threshold = downSeed
# --- tracking ---
trigScintTrack.verbosity = trackingVerbosity
trigScintTrack.delta_max = maxDelta
p.maxEvents=nEv
p.sequence = [ clTag, clUp, clDown , trigScintTrack ]
# Provide the list of input files to run on
#p.inputFiles=["~/raid/LDMX/trigger_pad_sim/test.root"]
p.inputFiles=[ inputName ] #"ldmx_sim_events.root"]
# Provide the list of output files to produce, either one to contain
# the results of all input files or one output file name per input file name
#p.outputFiles=["ldmx_digi_events.root"]
p.outputFiles=[outputName]
# Utility function to interpret and print out the configuration to the screen
print(p)