12 raise RuntimeError(
"At this point (early run 3), only a dt of 25ns is supported")
16 flags.Calo.Noise.fixedLumiForNoise=mu*0.17241*50/25
17 flags.LAr.doHVCorr =
False
18 flags.LAr.ROD.NumberOfCollisions = mu
19 flags.LAr.ROD.nSamples = nsamp
22 msg = logging.getLogger(
"CaloComputeNoiseCfg")
26 if flags.LArCalib.isSC:
27 minbiastag=
"LARElecCalibMCSCMinBias-mc16-Epos-A3-s3687"
28 fsampltag=
"LARElecCalibMCSCfSampl-000"
29 shapetag=
"LARElecCalibMCSCShape-000"
32 minbiastag=
"LARElecCalibMCMinBias-mc16-Epos-A3-s3687"
33 fsampltag=
"LARElecCalibMCfSampl-G4101-20371-FTFP_BERT_BIRK_v2"
34 shapetag=
"LARElecCalibMCShapeLArPileupShape-RUN2-2018"
35 hvcorrtag=
"LARElecCalibMCHVScaleCorr-IOVDEP-02"
37 msg.info(
"Noise computing for mu=%i and dt=%i" , mu,dt)
39 result=ComponentAccumulator()
41 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
42 result.merge(LArGMCfg(flags))
43 from TileGeoModel.TileGMConfig
import TileGMCfg
44 result.merge(TileGMCfg(flags))
46 if flags.LArCalib.isSC:
47 from LArRecUtils.LArADC2MeVSCCondAlgConfig
import LArADC2MeVSCCondAlgCfg
48 result.merge(LArADC2MeVSCCondAlgCfg(flags))
49 from LArRecUtils.LArRecUtilsConfig
import LArOFCSCCondAlgCfg
50 result.merge(LArOFCSCCondAlgCfg(flags))
54 from LArRecUtils.LArADC2MeVCondAlgConfig
import LArADC2MeVCondAlgCfg
55 from LArRecUtils.LArRecUtilsConfig
import LArOFCCondAlgCfg
56 from LArCalibUtils.LArHVScaleConfig
import LArHVScaleCfg
57 result.merge(LArADC2MeVCondAlgCfg(flags))
58 result.merge(LArOFCCondAlgCfg(flags))
59 result.merge(LArHVScaleCfg(flags))
62 from IOVDbSvc.IOVDbSvcConfig
import addOverride
63 if flags.LArCalib.isSC:
65 result.getService(
"IOVDbSvc").Folders.append(
"/LAR/ElecCalibMCSC/HVScaleCorr")
66 result.getCondAlgo(
"CondInputLoader").Load.add((
"CondAttrListCollection",
"/LAR/ElecCalibMCSC/HVScaleCorr"))
67 result.addCondAlgo(CompFactory.getComp(
"LArFlatConditionsAlg<LArHVScaleCorrSC>")(ReadKey=
"/LAR/ElecCalibMCSC/HVScaleCorr", WriteKey=
"LArHVScaleCorrSC"))
70 result.merge(addOverride(flags,
"/LAR/ElecCalibMC/MinBias", minbiastag))
71 result.merge(addOverride(flags,
"/LAR/ElecCalibMC/fSampl", fsampltag))
72 result.merge(addOverride(flags,
"/LAR/ElecCalibMC/Shape", shapetag))
73 result.merge(addOverride(flags,
"/LAR/ElecCalibMC/HVScaleCorr", hvcorrtag))
74 result.merge(addOverride(flags,
"/LAR/NoiseOfl/CellNoise",
"LARNoiseOflCellNoise-empty"))
75 result.merge(addOverride(flags,
"/TILE/OFL02/NOISE/CELL",
"TileOfl02NoiseCell-OF2-05-25ns-R2-single-IOV"))
76 result.merge(addOverride(flags,
"/CALO/Ofl/Noise/CellNoise",
"CaloOflNoiseCellnoise-empty"))
82 iovdbsvc=result.getService(
"IOVDbSvc")
84 folder=
"/LAR/ElecCalibMCSC/Pedestal" if flags.LArCalib.isSC
else "/LAR/ElecCalibMC/Pedestal"
85 for i
in range(0,len(iovdbsvc.Folders)):
86 if (iovdbsvc.Folders[i].
find(folder)>=0):
87 del iovdbsvc.Folders[i]
89 condInputLoader=result.getCondAlgo(
"CondInputLoader")
90 for cil_Loadval
in condInputLoader.Load:
91 if folder
in cil_Loadval:
92 condInputLoader.Load.remove(cil_Loadval)
96 dfolder=
"/LAR/ElecCalibFlatSC/Pedestal" if flags.LArCalib.isSC
else "/LAR/ElecCalibFlat/Pedestal"
97 iovdbsvc.Folders.append(dfolder+
"<db>COOLONL_LAR/CONDBR2</db>")
98 condInputLoader.Load.add((
"CondAttrListCollection",dfolder))
99 if flags.LArCalib.isSC:
101 result.getCondAlgo(
"LArFlatConditionsAlg<LArPedestalSC>").ReadKey=dfolder
103 result.addCondAlgo(CompFactory.getComp(
"LArFlatConditionsAlg<LArPedestalFlat>")(ReadKey=dfolder,WriteKey=
"LArPedestal"))
105 if flags.LArCalib.isSC:
106 result.addEventAlgo(CompFactory.CaloNoiseCompCondAlg(NMinBias=flags.Calo.Noise.fixedLumiForNoise,
107 ADC2MeVKey=
"LArADC2MeVSC",PedestalKey=
"LArPedestalSC",
108 AutocorrKey=
"LArAutoCorrSC",OFKey=
"LArOFCSC",
109 ShapeKey=
"LArShapeSC",fSamplKey=
"LArfSamplSC",
110 LArMinBiasKey=
"LArMinBiasSC", SuperCell=
True, DiagnosticHG=
True
113 result.addEventAlgo(CompFactory.CaloNoiseCompCondAlg(NMinBias=flags.Calo.Noise.fixedLumiForNoise))
115 result.addEventAlgo(CompFactory.CaloRescaleNoise(absScaling=
True, SuperCell=flags.LArCalib.isSC,
116 OnlineLArHVScaleCorr=
"LArHVScaleCorrSC" if flags.LArCalib.isSC
else "LArHVScaleCorr",
117 CablingKey=
"LArOnOffIdMapSC" if flags.LArCalib.isSC
else "LArOnOffIdMap",
118 ElecNoiseKey=
"elecNoise",PileupNoiseKey=
"pileupNoise"))
120 result.getCondAlgo(
"LArADC2MeVCondAlg").LArHVScaleCorrKey =
""
123 if os.path.exists(output):
125 result.addService(CompFactory.THistSvc(Output = [
"file1 DATAFILE='"+output+
"' OPT='RECREATE'"]))
126 result.setAppProperty(
"HistogramPersistency",
"ROOT")