CMS 3D CMS Logo

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