12def CaloScaleNoiseCfg(flagsIn, absolute=True, mu=60, dt=25, output='cellnoise_data.root', **hvscaleprops):
13
14
15 flags=flagsIn.clone()
16 flags.Calo.Noise.fixedLumiForNoise=1
17 flags.LAr.doHVCorr = False
18 flags.lock()
19 msg = logging.getLogger("CaloScaleNoiseCfg")
20
21 if not absolute:
22
23 noisetag="LARNoiseOflCellNoise-RUN2-UPD1-00"
24 msg.info("Noise rescaling using tag %s", noisetag)
25 else:
26 if (dt!=25):
27 raise RuntimeError("At this point (late run 3), only a dt of 25ns is supported")
28 if mu==0:
29 noisetag="LARNoiseOflCellNoisenoise-mc16-EposA3-ofc25mu0-25ns"
30 elif mu==60:
31 noisetag="LARNoiseOflCellNoisenoise-mc16-EposA3-ofc25mu60-25ns"
32 else:
33 raise RuntimeError("At this point (late run 3), only mu values of 0 and 60 are supported")
34
35
36 msg.info("Absolute noise scaling using tag %s for mu=%i and dt=%i" , noisetag,mu,dt)
37
38 result=ComponentAccumulator()
39 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
40 result.merge(LArGMCfg(flags))
41 from TileGeoModel.TileGMConfig import TileGMCfg
42 result.merge(TileGMCfg(flags))
43 result.merge(CaloNoiseCondAlgCfg(flags,noisetype="totalNoise"))
44 result.merge(CaloNoiseCondAlgCfg(flags,noisetype="electronicNoise"))
45 result.merge(CaloNoiseCondAlgCfg(flags,noisetype="pileupNoise"))
46 if noisetag is not None:
47 result.merge(addOverride(flags,"/LAR/NoiseOfl/CellNoise", noisetag))
48 result.merge(LArHVScaleCfg(flags, **hvscaleprops))
49 result.addEventAlgo(CompFactory.CaloRescaleNoise(absScaling=absolute))
50
51 import os
52 if os.path.exists(output):
53 os.remove(output)
54 result.addService(CompFactory.THistSvc(Output = ["file1 DATAFILE='"+output+"' OPT='RECREATE'"]))
55 result.setAppProperty("HistogramPersistency","ROOT")
56 return result
57
58