CMS 3D CMS Logo

hgcalDigitizer_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 from SimCalorimetry.HGCalSimProducers.hgcROCParameters_cfi import hgcROCSettings
4 from SimCalorimetry.HGCalSimAlgos.hgcSensorOpParams_cfi import hgcSiSensorIleak,hgcSiSensorCCE
5 
6 # Base configurations for HGCal digitizers
7 eV_per_eh_pair = 3.62
8 fC_per_ele = 1.6020506e-4
9 nonAgedCCEs = [1.0, 1.0, 1.0]
10 nonAgedNoises = [2100.0,2100.0,1600.0] #100,200,300 um (in electrons)
11 nonAgedNoises_v9 = [2000.0,2400.0,2000.0] # 120,200,300 um (in electrons)
12 thresholdTracksMIP = True
13 
14 HGCAL_ileakParam_toUse = cms.PSet(
15  ileakParam = cms.vdouble( hgcSiSensorIleak('TDR_600V') )
16 )
17 
18 HGCAL_cceParams_toUse = cms.PSet(
19  cceParamFine = cms.vdouble(hgcSiSensorCCE(120,'TDR_600V')),
20  cceParamThin = cms.vdouble(hgcSiSensorCCE(200,'TDR_600V')),
21  cceParamThick = cms.vdouble(hgcSiSensorCCE(300,'TDR_600V')),
22  )
23 
24 HGCAL_noise_fC = cms.PSet(
25  scaleByDose = cms.bool(False),
26  scaleByDoseAlgo = cms.uint32(0),
27  scaleByDoseFactor = cms.double(1),
28  doseMap = cms.string(""),
29  values = cms.vdouble( [x*fC_per_ele for x in nonAgedNoises] ), #100,200,300 um
30  )
31 
32 HFNose_noise_fC = HGCAL_noise_fC.clone()
33 
34 HGCAL_noise_heback = cms.PSet(
35  scaleByDose = cms.bool(False),
36  scaleByDoseAlgo = cms.uint32(0),
37  scaleByDoseFactor = cms.double(1),
38  doseMap = cms.string(""), #empty dose map at begin-of-life
39  sipmMap = cms.string(""), #if empty will prompt to use geometry-based definition
40  referenceIdark = cms.double(-1),
41  referenceXtalk = cms.double(-1),
42  noise_MIP = cms.double(1./100.) #this is to be deprecated
43 )
44 
45 HGCAL_chargeCollectionEfficiencies = cms.PSet(
46  values = cms.vdouble( nonAgedCCEs )
47  )
48 
49 HGCAL_noises = cms.PSet(
50  values = cms.vdouble([x for x in nonAgedNoises])
51  )
52 
53 # ECAL
54 hgceeDigitizer = cms.PSet(
55  accumulatorType = cms.string("HGCDigiProducer"),
56  digitizer = cms.string("HGCEEDigitizer"),
57  hitsProducer = cms.string("g4SimHits"),
58  hitCollection = cms.string("HGCHitsEE"),
59  digiCollection = cms.string("HGCDigisEE"),
60  NoiseGeneration_Method = cms.bool(True),
61  maxSimHitsAccTime = cms.uint32(100),
62  bxTime = cms.double(25),
63  eVPerEleHolePair = cms.double(eV_per_eh_pair),
64  tofDelay = cms.double(-9),
65  digitizationType = cms.uint32(0),
66  makeDigiSimLinks = cms.bool(False),
67  premixStage1 = cms.bool(False),
68  premixStage1MinCharge = cms.double(0),
69  premixStage1MaxCharge = cms.double(1e6),
70  useAllChannels = cms.bool(True),
71  verbosity = cms.untracked.uint32(0),
72  digiCfg = cms.PSet(
73  keV2fC = cms.double(0.044259), #1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
74  ileakParam = cms.PSet(refToPSet_ = cms.string("HGCAL_ileakParam_toUse")),
75  cceParams = cms.PSet(refToPSet_ = cms.string("HGCAL_cceParams_toUse")),
76  chargeCollectionEfficiencies = cms.PSet(refToPSet_ = cms.string("HGCAL_chargeCollectionEfficiencies")),
77  noise_fC = cms.PSet(refToPSet_ = cms.string("HGCAL_noise_fC")),
78  doTimeSamples = cms.bool(False),
79  thresholdFollowsMIP = cms.bool(thresholdTracksMIP),
80  feCfg = hgcROCSettings.clone()
81  )
82  )
83 
84 # HCAL front
85 hgchefrontDigitizer = cms.PSet(
86  accumulatorType = cms.string("HGCDigiProducer"),
87  digitizer = cms.string("HGCHEfrontDigitizer"),
88  hitsProducer = cms.string("g4SimHits"),
89  hitCollection = cms.string("HGCHitsHEfront"),
90  digiCollection = cms.string("HGCDigisHEfront"),
91  NoiseGeneration_Method = cms.bool(True),
92  maxSimHitsAccTime = cms.uint32(100),
93  bxTime = cms.double(25),
94  tofDelay = cms.double(-11),
95  digitizationType = cms.uint32(0),
96  makeDigiSimLinks = cms.bool(False),
97  premixStage1 = cms.bool(False),
98  premixStage1MinCharge = cms.double(0),
99  premixStage1MaxCharge = cms.double(1e6),
100  useAllChannels = cms.bool(True),
101  verbosity = cms.untracked.uint32(0),
102  digiCfg = cms.PSet(
103  keV2fC = cms.double(0.044259), #1000 eV / 3.62 (eV per e) / 6.24150934e3 (e per fC)
104  ileakParam = cms.PSet(refToPSet_ = cms.string("HGCAL_ileakParam_toUse")),
105  cceParams = cms.PSet(refToPSet_ = cms.string("HGCAL_cceParams_toUse")),
106  chargeCollectionEfficiencies = cms.PSet(refToPSet_ = cms.string("HGCAL_chargeCollectionEfficiencies")),
107  noise_fC = cms.PSet(refToPSet_ = cms.string("HGCAL_noise_fC")),
108  doTimeSamples = cms.bool(False),
109  thresholdFollowsMIP = cms.bool(thresholdTracksMIP),
110  feCfg = hgcROCSettings.clone()
111  )
112 )
113 
114 # HCAL back
115 hgchebackDigitizer = cms.PSet(
116  accumulatorType = cms.string("HGCDigiProducer"),
117  digitizer = cms.string("HGCHEbackDigitizer"),
118  hitsProducer = cms.string("g4SimHits"),
119  hitCollection = cms.string("HGCHitsHEback"),
120  digiCollection = cms.string("HGCDigisHEback"),
121  NoiseGeneration_Method = cms.bool(True),
122  maxSimHitsAccTime = cms.uint32(100),
123  bxTime = cms.double(25),
124  tofDelay = cms.double(-14),
125  digitizationType = cms.uint32(1),
126  makeDigiSimLinks = cms.bool(False),
127  premixStage1 = cms.bool(False),
128  premixStage1MinCharge = cms.double(0),
129  premixStage1MaxCharge = cms.double(1e6),
130  useAllChannels = cms.bool(True),
131  verbosity = cms.untracked.uint32(0),
132  digiCfg = cms.PSet(
133  #0 empty digitizer, 1 calice digitizer, 2 realistic digitizer
134  algo = cms.uint32(2),
135  noise = cms.PSet(refToPSet_ = cms.string("HGCAL_noise_heback")), #scales both for scint raddam and sipm dark current
136  keV2MIP = cms.double(1./675.0),
137  doTimeSamples = cms.bool(False),
138  nPEperMIP = cms.double(21.0),
139  nTotalPE = cms.double(7500),
140  sdPixels = cms.double(1e-6), # this is additional photostatistics noise (as implemented), not sure why it's here...
141  thresholdFollowsMIP = cms.bool(thresholdTracksMIP),
142  feCfg = hgcROCSettings.clone(
143  adcNbits = 10, # standard ROC operations (was 2 bits more up to 11_0_0_pre12)
144  adcSaturation_fC = 68.75, # keep the adc LSB the same (i.e. set saturation one quarter value of pre12)
145  tdcSaturation_fC = 1000, # allow up to 1000 MIPs as a max range, including ToA mode
146  targetMIPvalue_ADC = 15, # to be used for HGCROC gain proposal
147  adcThreshold_fC = 0.5, # unchanged with respect to pre12
148  tdcOnset_fC = 55, # turn on TDC when 80% of the ADC range is reached (one quarter of pre12
149  # indicative at this point)
150  tdcForToAOnset_fC = cms.vdouble(12.,12.,12.), #turn ToA for 20% of the TDC threshold (indicative at this point)
151  )
152  )
153 )
154 
155 # HFNose
156 hfnoseDigitizer = cms.PSet(
157  accumulatorType = cms.string("HGCDigiProducer"),
158  digitizer = cms.string("HFNoseDigitizer"),
159  hitsProducer = cms.string("g4SimHits"),
160  hitCollection = cms.string("HFNoseHits"),
161  digiCollection = cms.string("HFNoseDigis"),
162  NoiseGeneration_Method = cms.bool(True),
163  maxSimHitsAccTime = cms.uint32(100),
164  bxTime = cms.double(25),
165  eVPerEleHolePair = cms.double(eV_per_eh_pair),
166  tofDelay = cms.double(-33),
167  digitizationType = cms.uint32(0),
168  makeDigiSimLinks = cms.bool(False),
169  premixStage1 = cms.bool(False),
170  premixStage1MinCharge = cms.double(0),
171  premixStage1MaxCharge = cms.double(1e6),
172  useAllChannels = cms.bool(True),
173  verbosity = cms.untracked.uint32(0),
174  digiCfg = cms.PSet(
175  keV2fC = cms.double(0.044259), #1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
176  ileakParam = cms.PSet(refToPSet_ = cms.string("HGCAL_ileakParam_toUse")),
177  cceParams = cms.PSet(refToPSet_ = cms.string("HGCAL_cceParams_toUse")),
178  chargeCollectionEfficiencies = cms.PSet(refToPSet_ = cms.string("HGCAL_chargeCollectionEfficiencies")),
179  noise_fC = cms.PSet(refToPSet_ = cms.string("HFNose_noise_fC")),
180  doTimeSamples = cms.bool(False),
181  thresholdFollowsMIP = cms.bool(thresholdTracksMIP),
182  feCfg = hgcROCSettings.clone()
183  )
184  )
185 
186 # this bypasses the noise simulation
187 from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1
188 for _m in [hgceeDigitizer, hgchefrontDigitizer, hgchebackDigitizer, hfnoseDigitizer]:
189  premix_stage1.toModify(_m, premixStage1 = True)
190 
191 #function to set noise to aged HGCal
192 endOfLifeCCEs = [0.5, 0.5, 0.7] # this is to be deprecated
193 endOfLifeNoises = [2400.0,2250.0,1750.0] #this is to be deprecated
194 def HGCal_setEndOfLifeNoise(process,byDose=True,byDoseAlgo=0,byDoseAlgoSci=2,byDoseFactor=1):
195  """
196  includes all effects from radiation and gain choice
197  (see also notes in HGCal_setRealisticStartupNoise)
198  """
199 
200  process=HGCal_setRealisticNoiseSi(process,byDose=byDose,byDoseAlgo=byDoseAlgo,byDoseFactor=byDoseFactor)
201  process=HGCal_setRealisticNoiseSci(process,
202  byDose=byDose,
203  byDoseAlgo=byDoseAlgoSci,
204  byDoseFactor=byDoseFactor,
205  referenceIdark=0.25)
206  return process
207 
209  process.HGCAL_cceParams_toUse = cms.PSet(
210  cceParamFine = cms.vdouble(hgcSiSensorCCE(120,'TDR_800V')),
211  cceParamThin = cms.vdouble(hgcSiSensorCCE(200,'TDR_800V')),
212  cceParamThick = cms.vdouble(hgcSiSensorCCE(300,'TDR_800V')),
213  )
214  process.HGCAL_ileakParam_toUse = cms.PSet(
215  ileakParam = cms.vdouble(hgcSiSensorIleak('TDR_800V'))
216  )
217  return HGCal_setEndOfLifeNoise(process,byDoseFactor=1.333)
218 
220  process.HGCAL_cceParams_toUse = cms.PSet(
221  cceParamFine = cms.vdouble(hgcSiSensorCCE(120,'TDR_600V')),
222  cceParamThin = cms.vdouble(hgcSiSensorCCE(200,'TDR_600V')),
223  cceParamThick = cms.vdouble(hgcSiSensorCCE(300,'TDR_600V')),
224  )
225  process.HGCAL_ileakParam_toUse = cms.PSet(
226  ileakParam = cms.vdouble(hgcSiSensorIleak('TDR_800V'))
227  )
228  return HGCal_setEndOfLifeNoise(process,byDoseFactor=0.5)
229 
231  """
232  include all effects except:
233  * fluence impact on leakage current, CCE and SiPM dark current
234  * dose impact on tile light yield
235  dark current on SiPMs adjusted for a S/N ~ 7
236  Notes
237  * byDoseAlgo is used as a collection of bits to toggle:
238  * Si: FLUENCE, CCE, NOISE, PULSEPERGAIN, CACHEDOP (from lsb to Msb)
239  * Sci: IGNORE_SIPMAREA, OVERRIDE_SIPMAREA, IGNORE_TILEAREA, IGNORE_DOSESCALE, IGNORE_FLUENCESCALE, IGNORE_NOISE, IGNORE_TILETYPE (from lsb to Msb)
240  (for instance turning on the 0th bit turns off the impact of fluence in Si)
241  """
242  process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=1)
243  process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2+8+16,referenceIdark=0.125,referenceXtalk=0.01)
244  return process
245 
246 def HGCal_setRealisticStartupNoise_fixedSiPMTileAreasAndSN(process,targetSN=7,referenceXtalk=-1,ignorePedestal=False):
247  """
248  similar to HGCal_setRealisticStartupNoise but tile and SiPM areas are fixed
249  as 4mm2 assumed use Idark=0.25 so that S/N ~ 7
250  by changing the target S/N different the reference Idark will be scaled accordingly
251  """
252  process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=1)
253 
254  #scale dark current on the SiPM so that it corresponds to the target S/N
255  idark=0.25/(targetSN/6.97)**2
256  print('[HGCal_setRealisticStartupNoise_fixedSiPMTileAreasAndSN] for a target S/N={:3.2f} setting idark={:3.3f}nA'.format(targetSN,idark))
257  process=HGCal_setRealisticNoiseSci(process,byDose=True,
258  byDoseAlgo=2+4+8+16+64+128*ignorePedestal,
259  byDoseSipmMap=cms.string("SimCalorimetry/HGCalSimProducers/data/sipmParams_all4mm2.txt"),
260  referenceIdark=idark,
261  referenceXtalk=referenceXtalk)
262  return process
263 
264 
265 def HGCal_ignoreFluence(process):
266  """
267  include all effects except fluence impact on leakage current and CCE and SiPM dark current
268  and dose impact on tile light yield
269  (see also notes in HGCal_setRealisticStartupNoise)
270  """
271  process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=1)
272  process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2+8+16)
273  return process
274 
275 def HGCal_ignoreNoise(process):
276  """
277  include all effects except noise impact on leakage current and CCE, and scint
278  (see also notes in HGCal_setRealisticStartupNoise)
279  """
280  process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=4)
281  process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2+32)
282  return process
283 
285  """
286  include all effects except the per-gain pulse emulation
287  for the moment this only done for Si
288  (see also notes in HGCal_setRealisticStartupNoise)
289  """
290  process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=8)
291  process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2)
292  return process
293 
294 def HGCal_useCaching(process):
295  """
296  include all effects except cachine of siop parameters (gain cpu time)
297  for the moment this only done for Si
298  (see also notes in HGCal_setRealisticStartupNoise)
299  """
300  process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=16)
301  process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2)
302  return process
303 
304 doseMap = cms.string("SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.7.20.txt")
305 
306 def HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap,byDoseFactor=1):
307  process.HGCAL_noise_fC = cms.PSet(
308  scaleByDose = cms.bool(byDose),
309  scaleByDoseAlgo = cms.uint32(byDoseAlgo),
310  scaleByDoseFactor = cms.double(byDoseFactor),
311  doseMap = byDoseMap,
312  values = cms.vdouble( [x*fC_per_ele for x in endOfLifeNoises] ), #100,200,300 um, to be deprecated
313  )
314 
315  #this is to be deprecated
316  process.HGCAL_chargeCollectionEfficiencies = cms.PSet(
317  values = cms.vdouble(endOfLifeCCEs)
318  )
319 
320  #this is to be deprecated
321  process.HGCAL_noises = cms.PSet(
322  values = cms.vdouble([x for x in endOfLifeNoises])
323  )
324 
325  return process
326 
327 
328 def HFNose_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap,byDoseFactor=1):
329  process.HFNose_noise_fC = cms.PSet(
330  scaleByDose = cms.bool(byDose),
331  scaleByDoseAlgo = cms.uint32(byDoseAlgo),
332  scaleByDoseFactor = cms.double(byDoseFactor),
333  doseMap = byDoseMap,
334  values = cms.vdouble( [x*fC_per_ele for x in endOfLifeNoises] ), #100,200,300 um
335  )
336  return process
337 
338 
339 def HGCal_setRealisticNoiseSci(process,
340  byDose=True,
341  byDoseAlgo=2,
342  byDoseMap=doseMap,
343  byDoseSipmMap=cms.string("SimCalorimetry/HGCalSimProducers/data/sipmParams_geom-10.txt"),
344  byDoseFactor=1,
345  referenceIdark=0.25,
346  referenceXtalk=-1):
347  process.HGCAL_noise_heback = cms.PSet(
348  scaleByDose = cms.bool(byDose),
349  scaleByDoseAlgo = cms.uint32(byDoseAlgo),
350  scaleByDoseFactor = cms.double(byDoseFactor),
351  doseMap = byDoseMap,
352  sipmMap = byDoseSipmMap,
353  referenceIdark = cms.double(referenceIdark),
354  referenceXtalk = cms.double(referenceXtalk),
355  noise_MIP = cms.double(1./5.), #this is to be deprecated (still needed for vanilla for the moment)
356  )
357  return process
358 
359 def HGCal_disableNoise(process):
360  process.HGCAL_noise_fC = cms.PSet(
361  scaleByDose = cms.bool(False),
362  scaleByDoseAlgo = cms.uint32(0),
363  scaleByDoseFactor = cms.double(1),
364  doseMap = cms.string(""),
365  values = cms.vdouble(0,0,0), #100,200,300 um
366  )
367  process.HGCAL_noise_heback = cms.PSet(
368  scaleByDose = cms.bool(False),
369  scaleByDoseAlgo = cms.uint32(0),
370  scaleByDoseFactor = cms.double(1),
371  doseMap = cms.string(""),
372  referenceIdark = cms.double(0.),
373  referenceXtalk = cms.double(-1),
374  noise_MIP = cms.double(0.), #zero noise (this is to be deprecated)
375  )
376  process.HGCAL_noises = cms.PSet(
377  values = cms.vdouble(0,0,0)
378  )
379  return process
380 
381 from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10
382 
383 phase2_hgcalV10.toModify(HGCAL_noise_fC, values = [x*fC_per_ele for x in nonAgedNoises_v9])
384 phase2_hgcalV10.toModify(HGCAL_noises, values = [x for x in nonAgedNoises_v9])
385 
386 def HFNose_setEndOfLifeNoise(process,byDose=True,byDoseAlgo=0,byDoseFactor=1):
387  """includes all effects from radiation and gain choice"""
388  # byDoseAlgo is used as a collection of bits to toggle: FLUENCE, CCE, NOISE, PULSEPERGAIN, CACHEDOP (from lsb to Msb)
389  process=HFNose_setRealisticNoiseSi(process,byDose=byDose,byDoseAlgo=byDoseAlgo,byDoseMap=doseMapNose,byDoseFactor=byDoseFactor)
390  return process
391 
392 doseMapNose = cms.string("SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka_HFNose_3.7.20.12_Eta2.4.txt")
def HFNose_setEndOfLifeNoise(process, byDose=True, byDoseAlgo=0, byDoseFactor=1)
def HGCal_setEndOfLifeNoise_4000(process)
def HGCal_ignoreFluence(process)
def HGCal_disableNoise(process)
def hgcSiSensorCCE(sensor, version)
def HGCal_ignoreNoise(process)
def HGCal_setRealisticNoiseSci(process, byDose=True, byDoseAlgo=2, byDoseMap=doseMap, byDoseSipmMap=cms.string("SimCalorimetry/HGCalSimProducers/data/sipmParams_geom-10.txt"), byDoseFactor=1, referenceIdark=0.25, referenceXtalk=-1)
def HGCal_useCaching(process)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def HGCal_setEndOfLifeNoise_1500(process)
def HFNose_setRealisticNoiseSi(process, byDose=True, byDoseAlgo=0, byDoseMap=doseMap, byDoseFactor=1)
def HGCal_setRealisticNoiseSi(process, byDose=True, byDoseAlgo=0, byDoseMap=doseMap, byDoseFactor=1)
def HGCal_setRealisticStartupNoise_fixedSiPMTileAreasAndSN(process, targetSN=7, referenceXtalk=-1, ignorePedestal=False)
def HGCal_ignorePulsePerGain(process)
def HGCal_setRealisticStartupNoise(process)
def HGCal_setEndOfLifeNoise(process, byDose=True, byDoseAlgo=0, byDoseAlgoSci=2, byDoseFactor=1)