CMS 3D CMS Logo

HCalCustoms.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 def customise_HcalPhase0(process):
4  process.load("CalibCalorimetry/HcalPlugins/Hcal_Conditions_forGlobalTag_cff")
5 
6  if hasattr(process,'mix') and hasattr(process.mix,'digitizers') and hasattr(process.mix.digitizers,'hcal'):
7  process.mix.digitizers.hcal.TestNumbering=True
8 
9  process.es_hardcode.HEreCalibCutoff = cms.double(20.) #for aging
10 
11  process.es_hardcode.toGet = cms.untracked.vstring(
12  'GainWidths',
13  'RespCorrs'
14  )
15 
16 
17  if hasattr(process,'g4SimHits'):
18  process=customise_Sim(process)
19  if hasattr(process,'validation_step'):
20  process=customise_Validation(process)
21 
22  return process
23 
24 #common stuff
25 def load_HcalHardcode(process):
26  process.load("CalibCalorimetry/HcalPlugins/Hcal_Conditions_forGlobalTag_cff")
27  process.es_hardcode.toGet = cms.untracked.vstring(
28  'GainWidths',
29  'MCParams',
30  'RecoParams',
31  'RespCorrs',
32  'QIEData',
33  'QIETypes',
34  'Gains',
35  'Pedestals',
36  'PedestalWidths',
37  'ChannelQuality',
38  'ZSThresholds',
39  'TimeCorrs',
40  'LUTCorrs',
41  'LutMetadata',
42  'L1TriggerObjects',
43  'PFCorrs',
44  'ElectronicsMap',
45  'FrontEndMap',
46  'CovarianceMatrices',
47  'SiPMParameters',
48  'SiPMCharacteristics',
49  'TPChannelParameters',
50  'TPParameters',
51  'FlagHFDigiTimeParams',
52  )
53 
54  # Special Upgrade trick (if absent - regular case assumed)
55  process.es_hardcode.GainWidthsForTrigPrims = cms.bool(True)
56 
57  return process
58 
59 #intermediate customization (HF 2016 upgrades)
60 def customise_Hcal2016(process):
61  process=load_HcalHardcode(process)
62 
63  #for now, use HE run1 conditions - SiPM/QIE11 not ready
64  process.es_hardcode.testHFQIE10 = cms.bool(True)
65 
66  # to get reco to run
67  if hasattr(process,'reconstruction_step'):
68  process.hbheprereco.setNoiseFlags = cms.bool(False)
69 
70  return process
71 
72 #intermediate customization (HCAL 2017, HE and HF upgrades - no SiPMs or QIE11)
73 def customise_Hcal2017(process):
74  process=load_HcalHardcode(process)
75 
76  #for now, use HE run1 conditions - SiPM/QIE11 not ready
77  process.es_hardcode.useHFUpgrade = cms.bool(True)
78 
79  # to get reco to run
80  if hasattr(process,'DigiToRaw'):
81  process=customise_DigiToRaw(process)
82  if hasattr(process,'RawToDigi'):
83  process=customise_RawToDigi(process)
84  if hasattr(process,'reconstruction_step'):
85  process.hbheprereco.digiLabelQIE8 = cms.InputTag("simHcalDigis")
86  process.hbheprereco.digiLabelQIE11 = cms.InputTag("simHcalDigis","HBHEQIE11DigiCollection")
87  # process.hbheprereco.puCorrMethod = cms.int32(0)
88  process.horeco.digiLabel = cms.InputTag("simHcalDigis")
89  process.zdcreco.digiLabel = cms.InputTag("simHcalUnsuppressedDigis")
90  process.zdcreco.digiLabelhcal = cms.InputTag("simHcalUnsuppressedDigis")
91  process.hcalnoise.digiCollName = cms.string('simHcalDigis')
92  process.hfprereco.digiLabel = cms.InputTag("simHcalDigis", "HFQIE10DigiCollection")
93  if hasattr(process,'datamixing_step'):
94  process=customise_mixing(process)
95  if hasattr(process,'simHcalTriggerPrimitiveDigis'):
96  process.simHcalTriggerPrimitiveDigis.upgradeHF = cms.bool(True)
97  if hasattr(process,'dqmoffline_step'):
98  process.digiTask.tagHBHE = cms.untracked.InputTag("simHcalDigis")
99  process.digiTask.tagHF = cms.untracked.InputTag("simHcalDigis")
100  process.digiTask.tagHO = cms.untracked.InputTag("simHcalDigis")
101 
102  #add phase1 digi task
103  process.load('DQM.HcalTasks.DigiPhase1Task')
104  process.dqmoffline_step += process.digiPhase1Task
105  process.digiPhase1Task.tagHBHE = cms.untracked.InputTag("simHcalDigis","HBHEQIE11DigiCollection")
106  process.digiPhase1Task.tagHO = cms.untracked.InputTag("simHcalDigis")
107  process.digiPhase1Task.tagHF = cms.untracked.InputTag("simHcalDigis","HFQIE10DigiCollection")
108 
109  if hasattr(process,'validation_step'):
110  process.AllHcalDigisValidation.digiLabel = cms.string("simHcalDigis")
111 
112  return process
113 
114 #customization for Plan1
116  process = customise_Hcal2017(process)
117  process.es_hardcode.testHEPlan1 = cms.bool(True)
118  return process
119 
120 #intermediate customization (HCAL 2017, HE and HF upgrades - w/ SiPMs & QIE11)
122  process=customise_Hcal2017(process)
123 
124  #use HE phase1 conditions - test SiPM/QIE11
125  process.es_hardcode.useHEUpgrade = cms.bool(True)
126 
127  if hasattr(process,'reconstruction_step'):
128  # Customise HB/HE reco
129  from RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi import hbheprereco
130  process.globalReplace("hbheprereco", hbheprereco)
131  process.hbheprereco.saveInfos = cms.bool(True)
132  process.hbheprereco.digiLabelQIE8 = cms.InputTag("simHcalDigis")
133  process.hbheprereco.digiLabelQIE11 = cms.InputTag("simHcalDigis", "HBHEQIE11DigiCollection")
134 
135  if hasattr(process,'simHcalTriggerPrimitiveDigis'):
136  process.simHcalTriggerPrimitiveDigis.upgradeHE = cms.bool(True)
137 
138  return process
139 
140 def customise_HcalPhase1(process):
141  process=load_HcalHardcode(process)
142 
143  process.es_hardcode.HEreCalibCutoff = cms.double(100.) #for aging
144  process.es_hardcode.useHBUpgrade = cms.bool(True)
145  process.es_hardcode.useHEUpgrade = cms.bool(True)
146  process.es_hardcode.useHFUpgrade = cms.bool(True)
147 
148  if hasattr(process,'g4SimHits'):
149  process=customise_Sim(process)
150  if hasattr(process,'DigiToRaw'):
151  process=customise_DigiToRaw(process)
152  if hasattr(process,'RawToDigi'):
153  process=customise_RawToDigi(process)
154  if hasattr(process,'digitisation_step'):
155  process=customise_Digi(process)
156  if hasattr(process,'reconstruction_step'):
157  process=customise_Reco(process)
158  if hasattr(process,'dqmoffline_step'):
159  process=customise_DQM(process)
160  if hasattr(process,'dqmHarvesting'):
161  process=customise_harvesting(process)
162  if hasattr(process,'validation_step'):
163  process=customise_Validation(process)
164  if hasattr(process,'simHcalTriggerPrimitiveDigis'):
165  process.simHcalTriggerPrimitiveDigis.upgradeHF = cms.bool(True)
166  process.simHcalTriggerPrimitiveDigis.upgradeHE = cms.bool(True)
167  process.simHcalTriggerPrimitiveDigis.upgradeHB = cms.bool(True)
168  process=customise_condOverRides(process)
169  return process
170 
171 
172 def customise_Sim(process):
173  process.g4SimHits.HCalSD.TestNumberingScheme = True
174 
175  return process
176 
177 def customise_DigiToRaw(process):
178  process.digi2raw_step.remove(process.hcalRawData)
179 
180  return process
181 
182 def customise_RawToDigi(process):
183  process.raw2digi_step.remove(process.hcalDigis)
184 
185  return process
186 
187 def customise_Digi(process):
188  if hasattr(process,'mix'):
189  process.mix.digitizers.hcal.HBHEUpgradeQIE = True
190  process.mix.digitizers.hcal.hb.photoelectronsToAnalog = cms.vdouble([10.]*16)
191  process.mix.digitizers.hcal.hb.pixels = cms.int32(4500*4*2)
192  process.mix.digitizers.hcal.he.photoelectronsToAnalog = cms.vdouble([10.]*16)
193  process.mix.digitizers.hcal.he.pixels = cms.int32(4500*4*2)
194  process.mix.digitizers.hcal.HFUpgradeQIE = True
195  process.mix.digitizers.hcal.TestNumbering = True
196 
197  if hasattr(process,'simHcalDigis'):
198  process.simHcalDigis.useConfigZSvalues=cms.int32(1)
199  process.simHcalDigis.HBlevel=cms.int32(16)
200  process.simHcalDigis.HElevel=cms.int32(16)
201  process.simHcalDigis.HOlevel=cms.int32(16)
202  process.simHcalDigis.HFlevel=cms.int32(16)
203 
204  process.digitisation_step.remove(process.simHcalTriggerPrimitiveDigis)
205  process.digitisation_step.remove(process.simHcalTTPDigis)
206 
207  return process
208 
209 def customise_Reco(process):
210  # not sure why these are missing - but need to investigate later
211  process.reconstruction_step.remove(process.castorreco)
212  process.reconstruction_step.remove(process.CastorTowerReco)
213  process.reconstruction_step.remove(process.ak7CastorJets)
214  process.reconstruction_step.remove(process.ak7CastorJetID)
215  return process
216 
217 def customise_DQM(process):
218  process.dqmoffline_step.remove(process.hcalDigiMonitor)
219  process.dqmoffline_step.remove(process.hcalDeadCellMonitor)
220  process.dqmoffline_step.remove(process.hcalBeamMonitor)
221  process.dqmoffline_step.remove(process.hcalRecHitMonitor)
222  process.dqmoffline_step.remove(process.hcalDetDiagNoiseMonitor)
223  process.dqmoffline_step.remove(process.hcalNoiseMonitor)
224  process.dqmoffline_step.remove(process.RecHitsDQMOffline)
225  process.dqmoffline_step.remove(process.zdcMonitor)
226  process.dqmoffline_step.remove(process.hcalMonitor)
227  process.dqmoffline_step.remove(process.hcalHotCellMonitor)
228  process.dqmoffline_step.remove(process.hcalRawDataMonitor)
229  return process
230 
231 def customise_harvesting(process):
232  return process
233 
234 def customise_Validation(process):
235  process.validation_step.remove(process.AllHcalDigisValidation)
236  process.validation_step.remove(process.RecHitsValidation)
237  process.validation_step.remove(process.globalhitsanalyze)
238  return process
239 
241  return process
242 
243 def customise_mixing(process):
244  process.mixData.HBHEPileInputTag = cms.InputTag("simHcalUnsuppressedDigis")
245  process.mixData.HOPileInputTag = cms.InputTag("simHcalUnsuppressedDigis")
246  process.mixData.HFPileInputTag = cms.InputTag("simHcalUnsuppressedDigis")
247  process.mixData.QIE10PileInputTag = cms.InputTag("simHcalUnsuppressedDigis","HFQIE10DigiCollection")
248  process.mixData.QIE11PileInputTag = cms.InputTag("simHcalUnsuppressedDigis","HBHEQIE11DigiCollection")
249  return process
def load_HcalHardcode(process)
Definition: HCalCustoms.py:25
def customise_mixing(process)
Definition: HCalCustoms.py:243
def customise_Hcal2017Full(process)
Definition: HCalCustoms.py:121
def customise_DQM(process)
Definition: HCalCustoms.py:217
def customise_Digi(process)
Definition: HCalCustoms.py:187
def customise_condOverRides(process)
Definition: HCalCustoms.py:240
def customise_Sim(process)
Definition: HCalCustoms.py:172
def customise_Reco(process)
Definition: HCalCustoms.py:209
def customise_harvesting(process)
Definition: HCalCustoms.py:231
def customise_Hcal2016(process)
Definition: HCalCustoms.py:60
def customise_Hcal2017Plan1(process)
Definition: HCalCustoms.py:115
def customise_DigiToRaw(process)
Definition: HCalCustoms.py:177
def customise_Validation(process)
Definition: HCalCustoms.py:234
def customise_HcalPhase0(process)
Definition: HCalCustoms.py:3
def customise_RawToDigi(process)
Definition: HCalCustoms.py:182
def customise_HcalPhase1(process)
Definition: HCalCustoms.py:140
def customise_Hcal2017(process)
Definition: HCalCustoms.py:73