CMS 3D CMS Logo

customizeHLTforCMSSW.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 # helper fuctions
5 
6 # add one customisation function per PR
7 # - put the PR number into the name of the function
8 # - add a short comment
9 # for example:
10 
11 # CCCTF tuning
12 # def customiseFor12718(process):
13 # for pset in process._Process__psets.values():
14 # if hasattr(pset,'ComponentType'):
15 # if (pset.ComponentType == 'CkfBaseTrajectoryFilter'):
16 # if not hasattr(pset,'minGoodStripCharge'):
17 # pset.minGoodStripCharge = cms.PSet(refToPSet_ = cms.string('HLTSiStripClusterChargeCutNone'))
18 # return process
19 
21 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _seedingThresholdsHB, _thresholdsHB
22 from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHBHE_cfi import _thresholdsHB as _thresholdsHBRec
23 
24 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHCAL_cfi import _thresholdsHEphase1 as _thresholdsHEphase1HCAL
25 from RecoParticleFlow.PFClusterProducer.particleFlowClusterHBHE_cfi import _seedingThresholdsHEphase1, _thresholdsHEphase1
26 from RecoParticleFlow.PFClusterProducer.particleFlowRecHitHBHE_cfi import _thresholdsHEphase1 as _thresholdsHEphase1Rec
27 
28 
29 logWeightDenominatorHCAL2018 = cms.VPSet(
30  cms.PSet(
31  depths = cms.vint32(1, 2, 3, 4),
32  detector = cms.string('HCAL_BARREL1'),
33  logWeightDenominator = _thresholdsHB
34  ),
35  cms.PSet(
36  depths = cms.vint32(
37  1, 2, 3, 4, 5, 6, 7
38  ),
39  detector = cms.string('HCAL_ENDCAP'),
40  logWeightDenominator = _thresholdsHEphase1HCAL
41  )
42 )
43 
44 
46  # this function bring back the Run3 menu to a Run2-2018 like meny, for testing in data 2018
47 
48  #----------------------------------------------------------------------------------------------------------
49  # adapt threshold for HB - in 2018 only one depth
50 
51  for producer in producers_by_type(process, "PFClusterProducer"):
52  if producer.seedFinder.thresholdsByDetector[0].detector.value() == 'HCAL_BARREL1':
53  producer.seedFinder.thresholdsByDetector[0].seedingThreshold = _seedingThresholdsHB
54  producer.initialClusteringStep.thresholdsByDetector[0].gatheringThreshold = _thresholdsHB
55  producer.pfClusterBuilder.recHitEnergyNorms[0].recHitEnergyNorm = _thresholdsHB
56 
57  producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
58  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
59 
60  for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
61  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
62 
63  for producer in producers_by_type(process, "PFRecHitProducer"):
64  if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
65  producer.producers[0].qualityTests[0].cuts[0].threshold = _thresholdsHBRec
66 
67  for producer in producers_by_type(process, "CaloTowersCreator"):
68  producer.HBThreshold1 = cms.double(0.7)
69  producer.HBThreshold2 = cms.double(0.7)
70  producer.HBThreshold = cms.double(0.7)
71 
72  #--------------------------------------------------------
73  # switch on the QI8 processing as in HB-Run2 (in Run3 we have only QIE11)
74  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
75  producer.processQIE8 = cms.bool( True )
76  producer.setNoiseFlagsQIE8 = cms.bool( True )
77  producer.setPulseShapeFlagsQIE8 = cms.bool( True )
78 
79  return process
80 
82  # this function bring forward the sw changes of Run3 to 2018 data starting from a Run2-2018 like menu
83 
84  #-----------------------------------------------------------------------------------------------------------
85  # A) remove collapser from sequence
86  process.hltHbhereco = process.hltHbhePhase1Reco.clone()
87  process.HLTDoLocalHcalSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco )
88  process.HLTStoppedHSCPLocalHcalReco = cms.Sequence( process.hltHcalDigis + process.hltHbhereco )
89  process.HLTDoLocalHcalWithTowerSequence = cms.Sequence( process.hltHcalDigis + process.hltHbhereco + process.hltHfprereco + process.hltHfreco + process.hltHoreco + process.hltTowerMakerForAll )
90 
91 
92  #----------------------------------------------------------------------------------------------------------
93  # B) adapt threshold following removal of the collapser
94  # note this is done only for HE
95 
96  for producer in producers_by_type(process, "PFClusterProducer"):
97  if producer.seedFinder.thresholdsByDetector[1].detector.value() == 'HCAL_ENDCAP':
98  producer.seedFinder.thresholdsByDetector[1].seedingThreshold = _seedingThresholdsHEphase1
99  producer.initialClusteringStep.thresholdsByDetector[1].gatheringThreshold = _thresholdsHEphase1
100  producer.pfClusterBuilder.recHitEnergyNorms[1].recHitEnergyNorm = _thresholdsHEphase1
101 
102  del producer.pfClusterBuilder.positionCalc.logWeightDenominator
103  producer.pfClusterBuilder.positionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
104  del producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominator
105  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
106 
107  for producer in producers_by_type(process, "PFMultiDepthClusterProducer"):
108  del producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominator
109  producer.pfClusterBuilder.allCellsPositionCalc.logWeightDenominatorByDetector = logWeightDenominatorHCAL2018
110 
111  for producer in producers_by_type(process, "PFRecHitProducer"):
112  if producer.producers[0].name.value() == 'PFHBHERecHitCreator':
113  producer.producers[0].qualityTests[0].cuts[1].threshold = _thresholdsHEphase1Rec
114 
115  for producer in producers_by_type(process, "CaloTowersCreator"):
116  producer.HcalPhase = cms.int32(1)
117  producer.HESThreshold1 = cms.double(0.1)
118  producer.HESThreshold = cms.double(0.2)
119  producer.HEDThreshold1 = cms.double(0.1)
120  producer.HEDThreshold = cms.double(0.2)
121 
122  #--------------------------------------------------------
123  # C) add arrival time following PR 26270 (emulate what we will do in Run3 at HLT)
124  # (unused HLT quantity, set to false to save CPU)
125  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
126  producer.algorithm.calculateArrivalTime = cms.bool(False)
127 
128  #--------------------------------------------------------
129  # D) 3->8 pulse fit for PR 25469 (emulate what we will do in Run3 at HLT)
130  for producer in producers_by_type(process, "HBHEPhase1Reconstructor"):
131  producer.use8ts = cms.bool(True)
132  producer.algorithm.dynamicPed = cms.bool(False)
133  producer.algorithm.activeBXs = cms.vint32(-3, -2, -1, 0, 1, 2, 3, 4)
134 
135  return process
136 
137 
139  """Adapt the HLT to run the legacy DT unpacking
140  for pre2018 data/MC workflows as the default"""
141 
142  if hasattr(process,'hltMuonDTDigis'):
143  process.hltMuonDTDigis = cms.EDProducer( "DTUnpackingModule",
144  useStandardFEDid = cms.bool( True ),
145  maxFEDid = cms.untracked.int32( 779 ),
146  inputLabel = cms.InputTag( "rawDataCollector" ),
147  minFEDid = cms.untracked.int32( 770 ),
148  dataType = cms.string( "DDU" ),
149  readOutParameters = cms.PSet(
150  localDAQ = cms.untracked.bool( False ),
151  debug = cms.untracked.bool( False ),
152  rosParameters = cms.PSet(
153  localDAQ = cms.untracked.bool( False ),
154  debug = cms.untracked.bool( False ),
155  writeSC = cms.untracked.bool( True ),
156  readDDUIDfromDDU = cms.untracked.bool( True ),
157  readingDDU = cms.untracked.bool( True ),
158  performDataIntegrityMonitor = cms.untracked.bool( False )
159  ),
160  performDataIntegrityMonitor = cms.untracked.bool( False )
161  ),
162  dqmOnly = cms.bool( False )
163  )
164 
165  return process
166 
167 # CMSSW version specific customizations
168 def customizeHLTforCMSSW(process, menuType="GRun"):
169 
170  # add call to action function in proper order: newest last!
171  # process = customiseFor12718(process)
172 
173  return process
def customizeHLTforCMSSW(process, menuType="GRun")
def customiseFor2017DtUnpacking(process)
def synchronizeHCALHLTofflineRun3on2018data(process)
def producers_by_type(process, types)
Definition: common.py:6
def synchronizeHCALHLTofflineRun2(process)