Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-01 05:02:19

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 from SimCalorimetry.HGCalSimProducers.hgcROCParameters_cfi import hgcROCSettings
0004 from SimCalorimetry.HGCalSimAlgos.hgcSensorOpParams_cfi import hgcSiSensorIleak,hgcSiSensorCCE
0005 
0006 # Base configurations for HGCal digitizers
0007 eV_per_eh_pair = 3.62
0008 fC_per_ele     = 1.6020506e-4
0009 nonAgedCCEs    = [1.0, 1.0, 1.0]
0010 nonAgedNoises  = [2100.0,2100.0,1600.0] #100,200,300 um (in electrons)
0011 nonAgedNoises_v9 = [2000.0,2400.0,2000.0] # 120,200,300 um (in electrons)
0012 thresholdTracksMIP = True
0013 
0014 HGCAL_ileakParam_toUse    = cms.PSet(
0015     ileakParam = cms.vdouble( hgcSiSensorIleak('TDR_600V') )
0016 )
0017 
0018 HGCAL_cceParams_toUse = cms.PSet(
0019     cceParamFine  = cms.vdouble(hgcSiSensorCCE(120,'TDR_600V')),
0020     cceParamThin  = cms.vdouble(hgcSiSensorCCE(200,'TDR_600V')),
0021     cceParamThick = cms.vdouble(hgcSiSensorCCE(300,'TDR_600V')),
0022     )
0023 
0024 HGCAL_noise_fC = cms.PSet(
0025     scaleByDose = cms.bool(False),
0026     scaleByDoseAlgo = cms.uint32(0),
0027     scaleByDoseFactor = cms.double(1),
0028     doseMap = cms.string(""),
0029     values = cms.vdouble( [x*fC_per_ele for x in nonAgedNoises] ), #100,200,300 um
0030     )
0031 
0032 HFNose_noise_fC = HGCAL_noise_fC.clone()
0033 
0034 HGCAL_noise_heback = cms.PSet(
0035     scaleByDose = cms.bool(False),
0036     scaleByDoseAlgo = cms.uint32(0),
0037     scaleByDoseFactor = cms.double(1),
0038     doseMap = cms.string(""), #empty dose map at begin-of-life
0039     sipmMap = cms.string(""), #if empty will prompt to use geometry-based definition
0040     referenceIdark = cms.double(-1),
0041     referenceXtalk = cms.double(-1),
0042     noise_MIP = cms.double(1./100.) #this is to be deprecated
0043 )
0044 
0045 HGCAL_chargeCollectionEfficiencies = cms.PSet(
0046     values = cms.vdouble( nonAgedCCEs )
0047     )
0048 
0049 HGCAL_noises = cms.PSet(
0050     values = cms.vdouble([x for x in nonAgedNoises])
0051     )
0052 
0053 # ECAL
0054 hgceeDigitizer = cms.PSet(
0055     accumulatorType   = cms.string("HGCDigiProducer"),
0056     digitizer         = cms.string("HGCEEDigitizer"),
0057     hitsProducer      = cms.string("g4SimHits"),
0058     hitCollection     = cms.string("HGCHitsEE"),
0059     digiCollection    = cms.string("HGCDigisEE"),
0060     NoiseGeneration_Method = cms.bool(True),
0061     maxSimHitsAccTime = cms.uint32(100),
0062     bxTime            = cms.double(25),
0063     eVPerEleHolePair = cms.double(eV_per_eh_pair),
0064     tofDelay          = cms.double(-9),
0065     digitizationType  = cms.uint32(0),
0066     makeDigiSimLinks  = cms.bool(False),
0067     premixStage1      = cms.bool(False),
0068     premixStage1MinCharge = cms.double(0),
0069     premixStage1MaxCharge = cms.double(1e6),
0070     useAllChannels    = cms.bool(True),
0071     verbosity         = cms.untracked.uint32(0),
0072     digiCfg = cms.PSet(
0073         keV2fC           = cms.double(0.044259), #1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
0074         ileakParam       = cms.PSet(refToPSet_ = cms.string("HGCAL_ileakParam_toUse")),
0075         cceParams        = cms.PSet(refToPSet_ = cms.string("HGCAL_cceParams_toUse")),
0076         chargeCollectionEfficiencies = cms.PSet(refToPSet_ = cms.string("HGCAL_chargeCollectionEfficiencies")),
0077         noise_fC         = cms.PSet(refToPSet_ = cms.string("HGCAL_noise_fC")),
0078         doTimeSamples    = cms.bool(False),
0079         thresholdFollowsMIP = cms.bool(thresholdTracksMIP),
0080         feCfg   = hgcROCSettings.clone()
0081         )
0082     )
0083 
0084 # HCAL front
0085 hgchefrontDigitizer = cms.PSet(
0086     accumulatorType   = cms.string("HGCDigiProducer"),
0087     digitizer         = cms.string("HGCHEfrontDigitizer"),
0088     hitsProducer      = cms.string("g4SimHits"),
0089     hitCollection     = cms.string("HGCHitsHEfront"),
0090     digiCollection    = cms.string("HGCDigisHEfront"),
0091     NoiseGeneration_Method = cms.bool(True),
0092     maxSimHitsAccTime = cms.uint32(100),
0093     bxTime            = cms.double(25),
0094     tofDelay          = cms.double(-11),
0095     digitizationType  = cms.uint32(0),
0096     makeDigiSimLinks  = cms.bool(False),
0097     premixStage1      = cms.bool(False),
0098     premixStage1MinCharge = cms.double(0),
0099     premixStage1MaxCharge = cms.double(1e6),
0100     useAllChannels    = cms.bool(True),
0101     verbosity         = cms.untracked.uint32(0),
0102     digiCfg = cms.PSet(
0103         keV2fC           = cms.double(0.044259), #1000 eV / 3.62 (eV per e) / 6.24150934e3 (e per fC)
0104         ileakParam       = cms.PSet(refToPSet_ = cms.string("HGCAL_ileakParam_toUse")),
0105         cceParams        = cms.PSet(refToPSet_ = cms.string("HGCAL_cceParams_toUse")),
0106         chargeCollectionEfficiencies = cms.PSet(refToPSet_ = cms.string("HGCAL_chargeCollectionEfficiencies")),
0107         noise_fC         = cms.PSet(refToPSet_ = cms.string("HGCAL_noise_fC")),
0108         doTimeSamples    = cms.bool(False),
0109         thresholdFollowsMIP        = cms.bool(thresholdTracksMIP),
0110         feCfg   = hgcROCSettings.clone()
0111     )
0112 )
0113 
0114 # HCAL back
0115 hgchebackDigitizer = cms.PSet(
0116     accumulatorType   = cms.string("HGCDigiProducer"),
0117     digitizer         = cms.string("HGCHEbackDigitizer"),
0118     hitsProducer      = cms.string("g4SimHits"),
0119     hitCollection     = cms.string("HGCHitsHEback"),
0120     digiCollection    = cms.string("HGCDigisHEback"),
0121     NoiseGeneration_Method = cms.bool(True),
0122     maxSimHitsAccTime = cms.uint32(100),
0123     bxTime            = cms.double(25),
0124     tofDelay          = cms.double(-14),
0125     digitizationType  = cms.uint32(1),
0126     makeDigiSimLinks  = cms.bool(False),
0127     premixStage1      = cms.bool(False),
0128     premixStage1MinCharge = cms.double(0),
0129     premixStage1MaxCharge = cms.double(1e6),
0130     useAllChannels    = cms.bool(True),
0131     verbosity         = cms.untracked.uint32(0),
0132     digiCfg = cms.PSet(
0133         #0 empty digitizer, 1 calice digitizer, 2 realistic digitizer
0134         algo          = cms.uint32(2),        
0135         noise         = cms.PSet(refToPSet_ = cms.string("HGCAL_noise_heback")), #scales both for scint raddam and sipm dark current
0136         keV2MIP       = cms.double(1./675.0),
0137         doTimeSamples = cms.bool(False),
0138         nPEperMIP = cms.double(21.0),
0139         nTotalPE  = cms.double(7500),        
0140         sdPixels  = cms.double(1e-6), # this is additional photostatistics noise (as implemented), not sure why it's here...
0141         thresholdFollowsMIP = cms.bool(thresholdTracksMIP),
0142         feCfg = hgcROCSettings.clone(
0143             adcNbits        = 10,      # standard ROC operations (was 2 bits more up to 11_0_0_pre12)
0144             adcSaturation_fC = 68.75,  # keep the adc LSB the same (i.e. set saturation one quarter value of pre12)
0145             tdcSaturation_fC  = 1000,  # allow up to 1000 MIPs as a max range, including ToA mode
0146             targetMIPvalue_ADC   = 15, # to be used for HGCROC gain proposal
0147             adcThreshold_fC = 0.5,     # unchanged with respect to pre12
0148             tdcOnset_fC       = 55,    # turn on TDC when 80% of the ADC range is reached (one quarter of pre12
0149             #                                        indicative at this point)
0150             tdcForToAOnset_fC = cms.vdouble(12.,12.,12.),  #turn ToA for 20% of the TDC threshold (indicative at this point)
0151         )
0152     )
0153 )
0154 
0155 # HFNose
0156 hfnoseDigitizer = cms.PSet(
0157     accumulatorType   = cms.string("HGCDigiProducer"),
0158     digitizer         = cms.string("HFNoseDigitizer"),
0159     hitsProducer      = cms.string("g4SimHits"),
0160     hitCollection     = cms.string("HFNoseHits"),
0161     digiCollection    = cms.string("HFNoseDigis"),
0162     NoiseGeneration_Method = cms.bool(True),
0163     maxSimHitsAccTime = cms.uint32(100),
0164     bxTime            = cms.double(25),
0165     eVPerEleHolePair = cms.double(eV_per_eh_pair),
0166     tofDelay          = cms.double(-33),
0167     digitizationType  = cms.uint32(0),
0168     makeDigiSimLinks  = cms.bool(False),
0169     premixStage1      = cms.bool(False),
0170     premixStage1MinCharge = cms.double(0),
0171     premixStage1MaxCharge = cms.double(1e6),
0172     useAllChannels    = cms.bool(True),
0173     verbosity         = cms.untracked.uint32(0),
0174     digiCfg = cms.PSet(
0175         keV2fC           = cms.double(0.044259), #1000 eV/3.62 (eV per e) / 6.24150934e3 (e per fC)
0176         ileakParam       = cms.PSet(refToPSet_ = cms.string("HGCAL_ileakParam_toUse")),
0177         cceParams        = cms.PSet(refToPSet_ = cms.string("HGCAL_cceParams_toUse")),
0178         chargeCollectionEfficiencies = cms.PSet(refToPSet_ = cms.string("HGCAL_chargeCollectionEfficiencies")),
0179         noise_fC         = cms.PSet(refToPSet_ = cms.string("HFNose_noise_fC")),
0180         doTimeSamples    = cms.bool(False),
0181         thresholdFollowsMIP        = cms.bool(thresholdTracksMIP),
0182         feCfg   = hgcROCSettings.clone()
0183         )
0184     )
0185 
0186 # this bypasses the noise simulation
0187 from Configuration.ProcessModifiers.premix_stage1_cff import premix_stage1
0188 for _m in [hgceeDigitizer, hgchefrontDigitizer, hgchebackDigitizer, hfnoseDigitizer]:
0189     premix_stage1.toModify(_m, premixStage1 = True)
0190 
0191 #function to set noise to aged HGCal
0192 endOfLifeCCEs = [0.5, 0.5, 0.7] # this is to be deprecated
0193 endOfLifeNoises = [2400.0,2250.0,1750.0]  #this is to be deprecated
0194 def HGCal_setEndOfLifeNoise(process,byDose=True,byDoseAlgo=0,byDoseAlgoSci=2,byDoseFactor=1):
0195     """
0196     includes all effects from radiation and gain choice
0197     (see also notes in HGCal_setRealisticStartupNoise)    
0198     """
0199 
0200     process=HGCal_setRealisticNoiseSi(process,byDose=byDose,byDoseAlgo=byDoseAlgo,byDoseFactor=byDoseFactor)
0201     process=HGCal_setRealisticNoiseSci(process,
0202                                        byDose=byDose,
0203                                        byDoseAlgo=byDoseAlgoSci,
0204                                        byDoseFactor=byDoseFactor,
0205                                        referenceIdark=0.25)
0206     return process
0207 
0208 def HGCal_setEndOfLifeNoise_4000(process):
0209     process.HGCAL_cceParams_toUse = cms.PSet(
0210         cceParamFine  = cms.vdouble(hgcSiSensorCCE(120,'TDR_800V')),
0211         cceParamThin  = cms.vdouble(hgcSiSensorCCE(200,'TDR_800V')),
0212         cceParamThick = cms.vdouble(hgcSiSensorCCE(300,'TDR_800V')),
0213     )
0214     process.HGCAL_ileakParam_toUse    = cms.PSet(
0215         ileakParam = cms.vdouble(hgcSiSensorIleak('TDR_800V'))
0216     )
0217     return HGCal_setEndOfLifeNoise(process,byDoseFactor=1.333)
0218 
0219 def HGCal_setEndOfLifeNoise_1500(process):
0220     process.HGCAL_cceParams_toUse = cms.PSet(
0221         cceParamFine  = cms.vdouble(hgcSiSensorCCE(120,'TDR_600V')),
0222         cceParamThin  = cms.vdouble(hgcSiSensorCCE(200,'TDR_600V')),
0223         cceParamThick = cms.vdouble(hgcSiSensorCCE(300,'TDR_600V')),
0224     )
0225     process.HGCAL_ileakParam_toUse    = cms.PSet(
0226         ileakParam = cms.vdouble(hgcSiSensorIleak('TDR_800V'))
0227     )
0228     return HGCal_setEndOfLifeNoise(process,byDoseFactor=0.5)
0229 
0230 def HGCal_setRealisticStartupNoise(process):
0231     """ 
0232     include all effects except:
0233     * fluence impact on leakage current, CCE and SiPM dark current
0234     * dose impact on tile light yield
0235     dark current on SiPMs adjusted for a S/N ~ 7
0236     Notes
0237     * byDoseAlgo is used as a collection of bits to toggle: 
0238        * Si: FLUENCE, CCE, NOISE, PULSEPERGAIN, CACHEDOP (from lsb to Msb)
0239        * Sci: IGNORE_SIPMAREA, OVERRIDE_SIPMAREA, IGNORE_TILEAREA, IGNORE_DOSESCALE, IGNORE_FLUENCESCALE, IGNORE_NOISE, IGNORE_TILETYPE (from lsb to Msb)
0240       (for instance turning on the 0th  bit turns off the impact of fluence in Si)
0241     """
0242     process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=1)
0243     process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2+16+32,byDoseFactor=0,referenceIdark=0.125,referenceXtalk=0.01)
0244     return process
0245 
0246 def HGCal_setRealisticStartupNoise_fixedSiPMTileAreasAndSN(process,targetSN=7,referenceXtalk=-1,ignorePedestal=False):
0247     """ 
0248     similar to HGCal_setRealisticStartupNoise but tile and SiPM areas are fixed
0249     as 4mm2 assumed use Idark=0.25 so that S/N ~ 7
0250     by changing the target S/N different the reference Idark will be scaled accordingly
0251     """
0252     process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=1)
0253     
0254     #scale dark current on the SiPM so that it corresponds to the target S/N
0255     idark=0.25/(targetSN/6.97)**2
0256     print('[HGCal_setRealisticStartupNoise_fixedSiPMTileAreasAndSN] for a target S/N={:3.2f} setting idark={:3.3f}nA'.format(targetSN,idark))
0257     process=HGCal_setRealisticNoiseSci(process,byDose=True,
0258                                        byDoseAlgo=2+4+8+16+64+128*ignorePedestal,
0259                                        byDoseSipmMap=cms.string("SimCalorimetry/HGCalSimProducers/data/sipmParams_all4mm2.txt"),
0260                                        referenceIdark=idark,
0261                                        referenceXtalk=referenceXtalk)
0262     return process
0263 
0264 
0265 def HGCal_ignoreFluence(process):
0266     """
0267     include all effects except fluence impact on leakage current and CCE and SiPM dark current
0268     and dose impact on tile light yield
0269     (see also notes in HGCal_setRealisticStartupNoise)    
0270     """
0271     process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=1)
0272     process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2+8+16)
0273     return process
0274 
0275 def HGCal_ignoreNoise(process):
0276     """
0277     include all effects except noise impact on leakage current and CCE, and scint
0278     (see also notes in HGCal_setRealisticStartupNoise)
0279     """
0280     process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=4)
0281     process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2+32)
0282     return process
0283 
0284 def HGCal_ignorePulsePerGain(process):
0285     """
0286     include all effects except the per-gain pulse emulation
0287     for the moment this only done for Si
0288     (see also notes in HGCal_setRealisticStartupNoise)   
0289     """
0290     process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=8)
0291     process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2)
0292     return process
0293 
0294 def HGCal_useCaching(process):
0295     """
0296     include all effects except cachine of siop parameters (gain cpu time)
0297     for the moment this only done for Si
0298     (see also notes in HGCal_setRealisticStartupNoise)        
0299     """    
0300     process=HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=16)
0301     process=HGCal_setRealisticNoiseSci(process,byDose=True,byDoseAlgo=2)
0302     return process
0303 
0304 doseMap = cms.string("SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka-3.7.20.txt")
0305 
0306 def HGCal_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap,byDoseFactor=1):
0307     process.HGCAL_noise_fC = cms.PSet(
0308         scaleByDose = cms.bool(byDose),
0309         scaleByDoseAlgo = cms.uint32(byDoseAlgo),
0310         scaleByDoseFactor = cms.double(byDoseFactor),
0311         doseMap = byDoseMap,
0312         values = cms.vdouble( [x*fC_per_ele for x in endOfLifeNoises] ), #100,200,300 um, to be deprecated
0313         )
0314 
0315     #this is to be deprecated
0316     process.HGCAL_chargeCollectionEfficiencies = cms.PSet(  
0317         values = cms.vdouble(endOfLifeCCEs)
0318         )
0319     
0320     #this is to be deprecated
0321     process.HGCAL_noises = cms.PSet(
0322         values = cms.vdouble([x for x in endOfLifeNoises])  
0323         )
0324 
0325     return process
0326 
0327 
0328 def HFNose_setRealisticNoiseSi(process,byDose=True,byDoseAlgo=0,byDoseMap=doseMap,byDoseFactor=1):
0329     process.HFNose_noise_fC = cms.PSet(
0330         scaleByDose = cms.bool(byDose),
0331         scaleByDoseAlgo = cms.uint32(byDoseAlgo),
0332         scaleByDoseFactor = cms.double(byDoseFactor),
0333         doseMap = byDoseMap,
0334         values = cms.vdouble( [x*fC_per_ele for x in endOfLifeNoises] ), #100,200,300 um
0335         )
0336     return process
0337 
0338 
0339 def HGCal_setRealisticNoiseSci(process,
0340                                byDose=True,
0341                                byDoseAlgo=2,
0342                                byDoseMap=doseMap,
0343                                byDoseSipmMap=cms.string("SimCalorimetry/HGCalSimProducers/data/sipmParams_geom-10.txt"),
0344                                byDoseFactor=1,
0345                                referenceIdark=0.25,
0346                                referenceXtalk=-1):
0347     process.HGCAL_noise_heback = cms.PSet(
0348         scaleByDose = cms.bool(byDose),
0349         scaleByDoseAlgo = cms.uint32(byDoseAlgo),
0350         scaleByDoseFactor = cms.double(byDoseFactor),
0351         doseMap = byDoseMap,
0352         sipmMap = byDoseSipmMap,
0353         referenceIdark = cms.double(referenceIdark),
0354         referenceXtalk = cms.double(referenceXtalk),
0355         noise_MIP = cms.double(1./5.), #this is to be deprecated (still needed for vanilla for the moment)
0356         )
0357     return process
0358 
0359 def HGCal_disableNoise(process):
0360     process.HGCAL_noise_fC = cms.PSet(
0361         scaleByDose = cms.bool(False),
0362         scaleByDoseAlgo = cms.uint32(0),
0363         scaleByDoseFactor = cms.double(1),
0364         doseMap = cms.string(""),
0365         values = cms.vdouble(0,0,0), #100,200,300 um
0366     )
0367     process.HGCAL_noise_heback = cms.PSet(
0368         scaleByDose = cms.bool(False),
0369         scaleByDoseAlgo = cms.uint32(0),
0370         scaleByDoseFactor = cms.double(1),
0371         doseMap = cms.string(""),
0372         referenceIdark = cms.double(0.),
0373         referenceXtalk = cms.double(-1),
0374         noise_MIP = cms.double(0.), #zero noise (this is to be deprecated)
0375         )
0376     process.HGCAL_noises = cms.PSet(
0377         values = cms.vdouble(0,0,0)
0378     )
0379     return process
0380 
0381 from Configuration.Eras.Modifier_phase2_hgcalV10_cff import phase2_hgcalV10
0382 
0383 phase2_hgcalV10.toModify(HGCAL_noise_fC, values = [x*fC_per_ele for x in nonAgedNoises_v9])
0384 phase2_hgcalV10.toModify(HGCAL_noises, values = [x for x in nonAgedNoises_v9])
0385 
0386 def HFNose_setEndOfLifeNoise(process,byDose=True,byDoseAlgo=0,byDoseFactor=1):
0387     """includes all effects from radiation and gain choice"""
0388     # byDoseAlgo is used as a collection of bits to toggle: FLUENCE, CCE, NOISE, PULSEPERGAIN, CACHEDOP (from lsb to Msb)
0389     process=HFNose_setRealisticNoiseSi(process,byDose=byDose,byDoseAlgo=byDoseAlgo,byDoseMap=doseMapNose,byDoseFactor=byDoseFactor)
0390     return process
0391 
0392 doseMapNose = cms.string("SimCalorimetry/HGCalSimProducers/data/doseParams_3000fb_fluka_HFNose_3.7.20.12_Eta2.4.txt")