12from svd
import add_svd_create_recodigits
14from geometry
import check_components
15from analysisDQM
import add_analysis_dqm, add_mirabelle_dqm
19def add_common_dqm(path, components=None, dqm_environment="expressreco", dqm_mode="dont_care", create_hlt_unit_histograms=False):
21 This function adds DQMs which are common for Cosmic runs
and Collion runs
23 @param components: A list of the detector components which are available
in this
25 @param dqm_environment: The environment the DQM modules are running
in
26 "expressreco" (default)
if running on the ExpressReco system
27 "hlt" if running on the HLT online reconstructon nodes
28 If running on the hlt, you may want to output less
or other DQM plots
29 due to the limited bandwidth of the HLT nodes.
30 @param dqm_mode: How to split up the path
for online/HLT.
31 For dqm_mode ==
"dont_care" all the DQM modules should be added.
32 For dqm_mode ==
"all_events" only the DQM modules which should run on all events
33 (filtered
and dismissed) should be added
34 For dqm_mode ==
"before_reco" only the DQM modules which should run before
36 For dqm_mode ==
"filtered" only the DQM modules which should run on filtered
37 events should be added
38 @param create_hlt_unit_histograms: Parameter
for SoftwareTiggerHLTDQMModule.
39 Should be
True only when running on the HLT servers
41 assert dqm_mode
in [
"dont_care",
"all_events",
"filtered",
"before_filter"]
43 check_components(components)
45 if dqm_mode
in [
"dont_care",
"filtered"]:
47 path.add_module(
'TTDDQM')
49 if dqm_environment ==
"expressreco" and (dqm_mode
in [
"dont_care"]):
51 if components
is None or 'PXD' in components:
52 path.add_module(
'PXDDAQDQM', histogramDirectoryName=
'PXDDAQ')
53 path.add_module(
'PXDROIDQM', histogramDirectoryName=
'PXDROI')
54 path.add_module(
'PXDDQMExpressReco', histogramDirectoryName=
'PXDER')
55 path.add_module(
'SetupGenfitExtrapolation')
56 path.add_module(
'PXDROIFinder',
57 recoTrackListName=
'RecoTracks',
58 PXDInterceptListName=
'PXDIntercepts')
61 path.add_module(
'PXDTrackClusterDQM', histogramDirectoryName=
'PXDER')
62 path.add_module(
'PXDInjectionDQM', histogramDirectoryName=
'PXDINJ', eachModule=
True)
64 if components
is None or 'SVD' in components:
66 add_svd_create_recodigits(path)
69 svdunpackerdqm = b2.register_module(
'SVDUnpackerDQM')
70 path.add_module(svdunpackerdqm)
73 'SVDZeroSuppressionEmulator',
75 ShaperDigits=
'SVDShaperDigits',
76 ShaperDigitsIN=
'SVDShaperDigitsZS5',
79 path.add_module(
'SVDDQMInjection', ShaperDigits=
'SVDShaperDigitsZS5')
81 path.add_module(
'SVDDQMExpressReco',
82 offlineZSShaperDigits=
'SVDShaperDigitsZS5')
84 path.add_module(
'SVDDQMHitTime')
86 path.add_module(
'SetupGenfitExtrapolation')
87 path.add_module(
'SVDROIFinder',
88 recoTrackListName=
'RecoTracks',
89 SVDInterceptListName=
'SVDIntercepts')
90 path.add_module(
'SVDDQMEfficiency')
92 path.add_module(
'SVDDQMClustersOnTrack')
94 add_svd_dqm_dose(path,
'SVDShaperDigitsZS5')
97 if components
is None or 'CDC' in components
or 'ECL' in components
or 'TOP' in components:
98 eventT0DQMmodule = b2.register_module(
'EventT0DQM')
99 path.add_module(eventT0DQMmodule)
101 if dqm_environment ==
"hlt" and (dqm_mode
in [
"dont_care",
"before_filter"]):
103 "SoftwareTriggerHLTDQM",
104 createHLTUnitHistograms=create_hlt_unit_histograms,
105 createTotalResultHistograms=
False,
106 createExpRunEventHistograms=
False,
107 createErrorFlagHistograms=
True,
108 cutResultIdentifiers={},
109 histogramDirectoryName=
"softwaretrigger_before_filter",
110 pathLocation=
"before filter",
111 ).set_name(
"SoftwareTriggerHLTDQM_before_filter")
115 histogramDirectoryName=
"TrackingAbort_before_filter",
116 ).set_name(
"TrackingAbortDQM_before_filter")
118 path.add_module(
"DetectorOccupanciesDQM", histogramDirectoryName=
"DetectorOccupancies_before_filter").set_name(
119 "DetectorOccupanciesDQM_before_filter")
121 path.add_module(
"StatisticsTimingHLTDQM",
122 createHLTUnitHistograms=create_hlt_unit_histograms,
125 if dqm_environment ==
"hlt" and (dqm_mode
in [
"dont_care",
"filtered"]):
127 hlt_trigger_lines_in_plot = []
128 hlt_skim_lines_in_plot = []
130 hlt_trigger_lines_per_unit_in_plot = [
131 "ge3_loose_tracks_inc_1_tight_not_ee2leg",
132 "Elab_gt_0.5_plus_2_others_with_Elab_gt_0.18_plus_no_clust_with_Ecms_gt_2.0",
134 "Estargt2_GeV_cluster",
136 cutResultIdentifiers = {}
138 from softwaretrigger
import filter_categories, skim_categories
140 filter_cat = [method
for method
in dir(filter_categories)
if method.startswith(
'__')
is False if method !=
'RESULTS']
141 skim_cat = [method
for method
in dir(skim_categories)
if method.startswith(
'__')
is False]
143 def read_lines(category):
144 return [i.split(
" ", 1)[1].replace(
" ",
"_")
for i
in category]
147 cutResultIdentifiers[i] = {
"filter": read_lines(getattr(filter_categories, i))}
148 hlt_trigger_lines_in_plot += read_lines(getattr(filter_categories, i))
151 cutResultIdentifiers[i] = {
"skim": read_lines(getattr(skim_categories, i))}
152 hlt_skim_lines_in_plot += read_lines(getattr(skim_categories, i))
154 cutResultIdentifiers[
"skim"] = {
"skim": hlt_skim_lines_in_plot}
155 cutResultIdentifiers[
"filter"] = {
"filter": hlt_trigger_lines_in_plot}
157 additionalL1Identifiers = [
192 "SoftwareTriggerHLTDQM",
193 cutResultIdentifiers=cutResultIdentifiers,
194 l1Identifiers=[
"fff",
"ffo",
"lml0",
"ffb",
"fp",
"passive_veto"],
195 additionalL1Identifiers=additionalL1Identifiers,
196 createHLTUnitHistograms=create_hlt_unit_histograms,
197 cutResultIdentifiersPerUnit=hlt_trigger_lines_per_unit_in_plot,
198 pathLocation=
"after filter",
201 path.add_module(
"StatisticsTimingHLTDQM",
202 histogramDirectoryName=
"timing_statistics_after_filter"
203 ).set_name(
"StatisticsTimingHLTDQM_after_filter")
205 path.add_module(
"TrackingAbortDQM")
207 path.add_module(
"DetectorOccupanciesDQM")
211 "SoftwareTriggerHLTDQM",
212 cutResultIdentifiers={
213 "skim": {
"skim": hlt_skim_lines_in_plot},
215 cutResultIdentifiersIgnored={
220 createTotalResultHistograms=
False,
221 createExpRunEventHistograms=
False,
222 histogramDirectoryName=
"softwaretrigger_skim_nobhabha",
223 ).set_name(
"SoftwareTriggerHLTDQM_skim_nobhabha")
225 if dqm_environment ==
"hlt" and (dqm_mode
in [
"dont_care",
"filtered"]):
227 if components
is None or 'SVD' in components:
228 svdunpackerdqm = b2.register_module(
'SVDUnpackerDQM')
229 path.add_module(svdunpackerdqm)
232 if (components
is None or 'CDC' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
233 cdcdqm = b2.register_module(
'cdcDQM7')
234 path.add_module(cdcdqm)
236 module_names = [m.name()
for m
in path.modules()]
237 if (
'SoftwareTrigger' in module_names):
238 cdcdedxdqm = b2.register_module(
'CDCDedxDQM')
239 path.add_module(cdcdedxdqm)
241 if dqm_environment ==
"expressreco":
242 path.add_module(
'CDCDQM')
245 if (components
is None or 'ECL' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
246 ecldqm = b2.register_module(
'ECLDQM')
247 path.add_module(ecldqm)
248 ecldqmext = b2.register_module(
'ECLDQMEXTENDED')
249 path.add_module(ecldqmext)
250 path.add_module(
'ECLDQMOutOfTimeDigits')
251 path.add_module(
'ECLDQMConnectedRegions')
253 if dqm_environment ==
"expressreco":
254 path.add_module(
'ECLDQMInjection', histogramDirectoryName=
'ECLINJ')
257 if (components
is None or 'TOP' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
258 topdqm = b2.register_module(
'TOPDQM')
259 path.add_module(topdqm)
262 if (components
is None or 'KLM' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
263 klmdqm = b2.register_module(
"KLMDQM")
264 path.add_module(klmdqm)
267 if (components
is None or 'TRG' in components)
and (dqm_mode
in [
"dont_care",
"before_filter"]):
269 trgecldqm = b2.register_module(
'TRGECLDQM')
270 path.add_module(trgecldqm)
271 trgecltimingdqm = b2.register_module(
'TRGECLEventTimingDQM')
272 path.add_module(trgecltimingdqm)
274 trggdldqm = b2.register_module(
'TRGGDLDQM')
275 trggdldqm.param(
'skim', 0)
276 path.add_module(trggdldqm)
278 trggrldqm = b2.register_module(
'TRGGRLDQM')
279 path.add_module(trggrldqm)
281 nmod_tsf = [0, 1, 2, 3, 4, 5, 6]
282 for mod_tsf
in nmod_tsf:
283 path.add_module(
'TRGCDCTSFDQM', TSFMOD=mod_tsf)
285 trgcdct2ddqm = b2.register_module(
'TRGCDCT2DDQM')
286 path.add_module(trgcdct2ddqm)
288 nmod_t3d = [0, 1, 2, 3]
289 for mod_t3d
in nmod_t3d:
290 path.add_module(
'TRGCDCT3DConverter',
291 hitCollectionName=
'FirmCDCTriggerSegmentHits' + str(mod_t3d),
292 addTSToDatastore=
True,
293 EventTimeName=
'FirmBinnedEventT0' + str(mod_t3d),
294 addEventTimeToDatastore=
True,
295 inputCollectionName=
'FirmTRGCDC2DFinderTracks' + str(mod_t3d),
296 add2DFinderToDatastore=
True,
297 outputCollectionName=
'FirmTRGCDC3DFitterTracks' + str(mod_t3d),
298 add3DToDatastore=
True,
300 firmwareResultCollectionName=
'TRGCDCT3DUnpackerStore' + str(mod_t3d),
302 path.add_module(
'TRGCDCT3DDQM', T3DMOD=mod_t3d)
304 if dqm_environment !=
"expressreco":
306 path.add_module(
'CDCTriggerNeuroDQMOnline', histogramDirectoryName=
"TRGCDCTNN2", useRecoTracks=
False)
307 path.add_module(
'CDCTriggerNeuroDQM')
310 if dqm_environment ==
"expressreco" and (components
is None or 'TRG' in components)
and (dqm_mode
in [
"dont_care"]):
313 path.add_module(
'CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.hwneurotracks,
314 hitCollectionName=neurotrigger.hwneuroinputsegmenthits, axialOnly=
True)
315 path.add_module(
'CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.hwsimneurotracks,
316 hitCollectionName=neurotrigger.hwneuroinputsegmenthits, axialOnly=
True)
317 path.add_module(
'CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.hwneuroinput2dfindertracks,
318 hitCollectionName=neurotrigger.hwneuroinputsegmenthits, axialOnly=
True)
319 path.add_module(
'CDCTriggerNeuroDQMOnline', histogramDirectoryName=
"TRGCDCTNN2", useRecoTracks=
True)
322 if (components
is None or 'TRG' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
324 trggdldqm_skim = b2.register_module(
'TRGGDLDQM')
325 trggdldqm_skim.param(
'skim', 1)
326 path.add_module(trggdldqm_skim)
327 trgeffdqm = b2.register_module(
"TRGEFFDQM")
328 path.add_module(trgeffdqm)
331 if (components
is None or 'SVD' in components
or 'PXD' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
332 if (dqm_environment ==
"hlt"):
333 path.add_module(
'TrackingHLTDQM')
335 path.add_module(
'ParallelTrackFilter', min_d0=-0.5, max_d0=0.5, min_z0=-1, max_z0=1,
336 inputArrayName=
"", outputINArrayName=
"TracksFromIP", outputOUTArrayName=
"TracksNotFromIP")
337 path.add_module(
'TrackingExpressRecoDQM', histogramDirectoryName=
"TrackingERDQM_FromIP",
338 tracksStoreArrayName=
"TracksFromIP", histogramTitleSuffix=
" - Tracks from IP") \
339 .set_name(
"TrackingExpressRecoDQM_FromIP")
340 path.add_module(
'TrackingExpressRecoDQM', histogramDirectoryName=
"TrackingERDQM_NotFromIP",
341 tracksStoreArrayName=
"TracksNotFromIP", histogramTitleSuffix=
" - Tracks not from IP",
342 produce1Dresiduals=
False, produce2Dresiduals=
False, produceTRClusterPlots=
False) \
343 .set_name(
"TrackingExpressRecoDQM_NotFromIP")
346 if (components
is None or 'ARICH' in components)
and (dqm_mode
in [
"dont_care",
"filtered"]):
347 path.add_module(
'ARICHDQM')
349 if dqm_mode
in [
"dont_care",
"filtered"]:
351 add_analysis_dqm(path)
352 if dqm_environment ==
"expressreco" and (dqm_mode
in [
"dont_care"]):
353 add_mirabelle_dqm(path)
356 if (components
is None or (
'KLM' in components
and 'CDC' in components))
and (dqm_mode
in [
"dont_care",
"filtered"]):
357 path.add_module(
"KLMDQM2", MuonListName=
'mu+:KLMDQM',
358 MinimalMatchingDigits=12,
359 MinimalMatchingDigitsOuterLayers=0,
360 MinimalMomentumNoOuterLayers=4.0,
361 SoftwareTriggerName=
"")
364 if dqm_mode
in [
"dont_care",
"all_events"]:
366 path.add_module(
'DAQMonitor')
def add_neurotrigger_hw(path, nntweightfile=None, debug_level=4, debugout=False, **kwargs)