Newer
Older
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
from Gaudi.Configuration import *
from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
from GaudiKernel import SystemOfUnits as units
detector_name = "topside"
if "DETECTOR_CONFIG" in os.environ :
detector_name = str(os.environ["DETECTOR_CONFIG"])
detector_path = ""
if "DETECTOR_PATH" in os.environ :
detector_path = str(os.environ["DETECTOR_PATH"])
detector_version = 'default'
if "DETECTOR_VERSION" in os.environ:
env_version = str(os.environ["DETECTOR_VERSION"])
# todo add checks
input_sim_file = str(os.environ["JUGGLER_SIM_FILE"])
input_bkg_file = str(os.environ["JUGGLER_BKG_FILE"])
output_rec_file = str(os.environ["JUGGLER_REC_FILE"])
n_events = str(os.environ["JUGGLER_N_EVENTS"])
## note: old version of material map is called material-maps.XXX, new version is materials-map.XXX
## these names are somewhat inconsistent, and should probably all be renamed to 'material-map.XXX'
## FIXME
geo_service = GeoSvc("GeoSvc",
detectors=["{}/{}.xml".format(detector_path,detector_name)],
materials="calibrations/materials-map.cbor",
OutputLevel=WARNING)
podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING)
from Configurables import PodioInput
from Configurables import Jug__Digi__SimTrackerHitsCollector as SimTrackerHitsCollector
from Configurables import Jug__Digi__SiliconTrackerDigi as TrackerDigi
from Configurables import Jug__Reco__TrackerHitReconstruction as TrackerHitReconstruction
from Configurables import Jug__Reco__TrackingHitsCollector2 as TrackingHitsCollector
from Configurables import Jug__Reco__TrackerSourceLinker as TrackerSourceLinker
from Configurables import Jug__Reco__TrackParamTruthInit as TrackParamTruthInit
from Configurables import Jug__Reco__TrackParamClusterInit as TrackParamClusterInit
from Configurables import Jug__Reco__TrackParamVertexClusterInit as TrackParamVertexClusterInit
from Configurables import Jug__Reco__TrackFindingAlgorithm as TrackFindingAlgorithm
from Configurables import Jug__Reco__ParticlesFromTrackFit as ParticlesFromTrackFit
from Configurables import Jug__Reco__TrackProjector as TrackProjector
from Configurables import Jug__Reco__SimpleClustering as SimpleClustering
algorithms = [ ]
tracker_endcap_collections = [
'TrackerEndcapHits1',
'TrackerEndcapHits2',
'TrackerEndcapHits3',
'TrackerEndcapHits4',
'TrackerEndcapHits5',
'TrackerEndcapHits6'
]
tracker_barrel_collections = [
'TrackerBarrelHits'
]
vertex_barrel_collections = [
'VertexBarrelHits'
]
gem_endcap_collections = [
'GEMTrackerEndcapHits1',
'GEMTrackerEndcapHits2',
'GEMTrackerEndcapHits3'
]
vertex_endcap_collections = [
'VertexEndcapHits'
]
mpgd_barrel_collections = [
'MPGDTrackerBarrelHits1',
'MPGDTrackerBarrelHits2'
]
input_collections = ['MCParticles'] + tracker_endcap_collections + tracker_barrel_collections + vertex_barrel_collections + gem_endcap_collections
input_collections += mpgd_barrel_collections
podioinput = PodioInput("PodioReader",
collections=input_collections)
algorithms.append( podioinput )
# use the pileuptool to specify the number of pileup
from Configurables import ConstPileUp
pileuptool = ConstPileUp("MyPileupTool", numPileUpEvents=10)
# edm data from simulation: hits and positioned hits
from Configurables import PileupHitMergeTool_edm4hep__SimTrackerHitCollection_ as PileupTrackHitMergeTool
trackhitsmergetool = PileupTrackHitMergeTool("MyTrackHitMergeTool")
# branchnames for the pileup
trackhitsmergetool.pileupHitsBranch = "hits"
# branchnames for the signal
trackhitsmergetool.signalHits = "hits"
# branchnames for the output
trackhitsmergetool.mergedHits = "overlaidTrackHits"
# algorithm for the overlay
from Configurables import PileupOverlayAlg
overlay = PileupOverlayAlg()
overlay.pileupFilenames = [input_bkg_file]
overlay.randomizePileup = False
overlay.mergeTools = ["PileupTrackHitMergeTool/MyTrackHitMergeTool"]
overlay.PileUpTool = pileuptool
overlay.OutputLevel = DEBUG
trk_b_coll = SimTrackerHitsCollector("trk_b_coll",
inputSimTrackerHits = tracker_barrel_collections,
outputSimTrackerHits = "TrackerBarrelAllHits")
algorithms.append( trk_b_coll )
trk_b_digi = TrackerDigi("trk_b_digi",
inputHitCollection = trk_b_coll.outputSimTrackerHits,
outputHitCollection = "TrackerBarrelRawHits",
timeResolution=8)
algorithms.append( trk_b_digi )
vtx_b_coll = SimTrackerHitsCollector("vtx_b_coll",
inputSimTrackerHits = vertex_barrel_collections,
outputSimTrackerHits = "VertexBarrelAllHits")
algorithms.append( vtx_b_coll )
vtx_b_digi = TrackerDigi("vtx_b_digi",
inputHitCollection = vtx_b_coll.outputSimTrackerHits,
outputHitCollection = "VertexBarrelRawHits",
timeResolution=8)
algorithms.append( vtx_b_digi )
mm_b_coll = SimTrackerHitsCollector("mm_b_coll",
inputSimTrackerHits = mpgd_barrel_collections,
outputSimTrackerHits = "MPGDTrackerBarrelAllHits")
algorithms.append( mm_b_coll )
mm_b_digi = TrackerDigi("mm_b_digi",
inputHitCollection = mm_b_coll.outputSimTrackerHits,
outputHitCollection = "MPGDTrackerBarrelRawHits",
timeResolution=8)
algorithms.append( mm_b_digi )
# Tracker and vertex reconstruction
trk_b_reco = TrackerHitReconstruction("trk_b_reco",
inputHitCollection = trk_b_digi.outputHitCollection,
outputHitCollection="TrackerBarrelRecHits")
algorithms.append( trk_b_reco )
vtx_b_reco = TrackerHitReconstruction("vtx_b_reco",
inputHitCollection = vtx_b_digi.outputHitCollection,
outputHitCollection="VertexBarrelRecHits")
algorithms.append( vtx_b_reco )
mm_b_reco = TrackerHitReconstruction("mm_b_reco",
inputHitCollection = mm_b_digi.outputHitCollection,
outputHitCollection="MPGDTrackerBarrelRecHits")
algorithms.append( mm_b_reco )
input_tracking_hits = [
str(trk_b_reco.outputHitCollection),
str(vtx_b_reco.outputHitCollection),
]
input_tracking_hits.append(str(mm_b_reco.outputHitCollection))
trk_hit_col = TrackingHitsCollector("trk_hit_col",
inputTrackingHits=input_tracking_hits,
trackingHits="trackingHits")
algorithms.append( trk_hit_col )
# Hit Source linker
sourcelinker = TrackerSourceLinker("sourcelinker",
inputHitCollection=trk_hit_col.trackingHits,
outputSourceLinks="TrackSourceLinks",
outputMeasurements="TrackMeasurements")
algorithms.append( sourcelinker )
## Track param init
truth_trk_init = TrackParamTruthInit("truth_trk_init",
inputMCParticles="MCParticles",
outputInitialTrackParameters="InitTrackParams")
algorithms.append( truth_trk_init )
# Tracking algorithms
trk_find_alg = TrackFindingAlgorithm("trk_find_alg",
inputSourceLinks = sourcelinker.outputSourceLinks,
inputMeasurements = sourcelinker.outputMeasurements,
inputInitialTrackParameters = "InitTrackParams",
outputTrajectories = "trajectories")
algorithms.append( trk_find_alg )
parts_from_fit = ParticlesFromTrackFit("parts_from_fit",
inputTrajectories = "trajectories",
outputParticles = "ReconstructedParticles",
outputTrackParameters = "outputTrackParameters")
algorithms.append( parts_from_fit )
trk_proj = TrackProjector("trajs_from_fit",
inputTrajectories = trk_find_alg.outputTrajectories,
outputTrackSegments = "outputTrackSegments")
algorithms.append( trk_proj )
out = PodioOutput("out", filename=output_rec_file)
out.outputCommands = ["keep *",
"drop BarrelTrackSourceLinks",
"drop InitTrackParams",
"drop trajectories",
"drop outputSourceLinks",
"drop outputInitialTrackParameters",
"keep MCParticles"
]
algorithms.append(out)
ApplicationMgr(
TopAlg = algorithms,
EvtSel = 'NONE',
EvtMax = n_events,
ExtSvc = [podioevent,geo_service],
OutputLevel=WARNING
)