forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomizeHLTforCMSSW.py
146 lines (116 loc) · 6.01 KB
/
customizeHLTforCMSSW.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
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
import FWCore.ParameterSet.Config as cms
# helper fuctions
from HLTrigger.Configuration.common import *
# add one customisation function per PR
# - put the PR number into the name of the function
# - add a short comment
# for example:
# CCCTF tuning
# def customiseFor12718(process):
# for pset in process._Process__psets.values():
# if hasattr(pset,'ComponentType'):
# if (pset.ComponentType == 'CkfBaseTrajectoryFilter'):
# if not hasattr(pset,'minGoodStripCharge'):
# pset.minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('HLTSiStripClusterChargeCutNone'))
# return process
def customiseHCALFor2018Input(process):
"""Customise the HLT to run on Run 2 data/MC using the old readout for the HCAL barel"""
for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
# switch on the QI8 processing for 2018 HCAL barrel
producer.processQIE8 = True
# adapt CaloTowers threshold for 2018 HCAL barrel with only one depth
for producer in producers_by_type(process, "CaloTowersCreator"):
producer.HBThreshold1 = 0.7
producer.HBThreshold2 = 0.7
producer.HBThreshold = 0.7
# adapt Particle Flow threshold for 2018 HCAL barrel with only one depth
from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _thresholdsHB, _thresholdsHEphase1, _seedingThresholdsHB
logWeightDenominatorHCAL2018 = cms.VPSet(
cms.PSet(
depths = cms.vint32(1, 2, 3, 4),
detector = cms.string('HCAL_BARREL1'),
logWeightDenominator = _thresholdsHB
),
cms.PSet(
depths = cms.vint32(1, 2, 3, 4, 5, 6, 7),
detector = cms.string('HCAL_ENDCAP'),
logWeightDenominator = _thresholdsHEphase1
)
)
for producer in producers_by_type(process, "PFRecHitProducer"):
if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
producer.producers[0].qualityTests[0].cuts[0].threshold = _thresholdsHB
for producer in producers_by_type(process, "PFClusterProducer"):
if producer.seedFinder.thresholdsByDetector[0].detector.value() == 'HCAL_BARREL1':
producer.seedFinder.thresholdsByDetector[0].seedingThreshold = _seedingThresholdsHB
producer.initialClusteringStep.thresholdsByDetector[0].gatheringThreshold = _thresholdsHB
producer.pfClusterBuilder.recHitEnergyNorms[0].recHitEnergyNorm = _thresholdsHB
producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
# done
return process
def customiseFor2017DtUnpacking(process):
"""Adapt the HLT to run the legacy DT unpacking
for pre2018 data/MC workflows as the default"""
if hasattr(process,'hltMuonDTDigis'):
process.hltMuonDTDigis = cms.EDProducer( "DTUnpackingModule",
useStandardFEDid = cms.bool( True ),
maxFEDid = cms.untracked.int32( 779 ),
inputLabel = cms.InputTag( "rawDataCollector" ),
minFEDid = cms.untracked.int32( 770 ),
dataType = cms.string( "DDU" ),
readOutParameters = cms.PSet(
localDAQ = cms.untracked.bool( False ),
debug = cms.untracked.bool( False ),
rosParameters = cms.PSet(
localDAQ = cms.untracked.bool( False ),
debug = cms.untracked.bool( False ),
writeSC = cms.untracked.bool( True ),
readDDUIDfromDDU = cms.untracked.bool( True ),
readingDDU = cms.untracked.bool( True ),
performDataIntegrityMonitor = cms.untracked.bool( False )
),
performDataIntegrityMonitor = cms.untracked.bool( False )
),
dqmOnly = cms.bool( False )
)
return process
def customisePixelGainForRun2Input(process):
"""Customise the HLT to run on Run 2 data/MC using the old definition of the pixel calibrations
Up to 11.0.x, the pixel calibarations were fully specified in the configuration:
VCaltoElectronGain = 47
VCaltoElectronGain_L1 = 50
VCaltoElectronOffset = -60
VCaltoElectronOffset_L1 = -670
Starting with 11.1.x, the calibrations for Run 3 were moved to the conditions, leaving in the configuration only:
VCaltoElectronGain = 1
VCaltoElectronGain_L1 = 1
VCaltoElectronOffset = 0
VCaltoElectronOffset_L1 = 0
Since the conditions for Run 2 have not been updated to the new scheme, the HLT configuration needs to be reverted.
"""
# revert the Pixel parameters to be compatible with the Run 2 conditions
for producer in producers_by_type(process, "SiPixelClusterProducer"):
producer.VCaltoElectronGain = 47
producer.VCaltoElectronGain_L1 = 50
producer.VCaltoElectronOffset = -60
producer.VCaltoElectronOffset_L1 = -670
return process
def customiseFor2018Input(process):
"""Customise the HLT to run on Run 2 data/MC"""
process = customisePixelGainForRun2Input(process)
process = customiseHCALFor2018Input(process)
return process
def customiseFor34120(process):
"""Ensure TrackerAdditionalParametersPerDetRcd ESProducer is run"""
process.load("Geometry.TrackerGeometryBuilder.TrackerAdditionalParametersPerDet_cfi")
return process
# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):
# add call to action function in proper order: newest last!
# process = customiseFor12718(process)
if menuType in ["GRun","HIon","PIon","PRef"]:
process = customiseFor34120(process)
return process