ATLAS Offline Software
Loading...
Searching...
No Matches
LArRODBCIDCorrAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentFactory import CompFactory
4from AthenaConfiguration.Enums import ProductionStep
5from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
6from LArRecUtils.LArRecUtilsConfig import LArMCSymCondAlgCfg
7from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg
8from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
9
10
11def LArRODBCIDCorrAlgCfg(flags, name="LArRODBCIDCorrAlg", **kwargs):
12 from IOVDbSvc.IOVDbSvcConfig import addFolderList
13
14 # MC only: the min-bias average is read from /LAR/ElecCalibMC/LArPileupAverage
15 # and the symmetrised MC conditions keys are used throughout.
16 if not flags.Input.isMC:
17 raise RuntimeError(
18 "LArRODBCIDCorrAlgCfg is only supported for MC "
19 "(LAr.ROD.ApplyRODBCIDCorr must be False for data)"
20 )
21
22 acc = LArADC2MeVCondAlgCfg(flags)
23 acc.merge(LArOnOffIdMappingCfg(flags))
24
25 # The pulse shape (LArShapeSym) is the only calibration input besides
26 # ADC2MeV and the min-bias average; no OFCs are needed since the correction
27 # is applied to the ADC samples, before any filtering.
28 acc.merge(LArElecCalibDBCfg(flags, ("Shape",)))
29
30 acc.merge(
31 addFolderList(
32 flags,
33 (("/LAR/ElecCalibMC/LArPileupAverage", "LAR_OFL", "LArMinBiasAverageMC"),),
34 )
35 )
36
37 acc.merge(LArMCSymCondAlgCfg(flags))
38
39 LArMinBiasAverageSymAlg = CompFactory.getComp(
40 "LArSymConditionsAlg<LArMinBiasAverageMC, LArMinBiasAverageSym>"
41 )
42 acc.addCondAlgo(
43 LArMinBiasAverageSymAlg(
44 "LArPileUpAvgSymCondAlg",
45 ReadKey="LArPileupAverage",
46 WriteKey="LArPileupAverageSym",
47 )
48 )
49
50 kwargs.setdefault("ShapeKey", "LArShapeSym")
51 kwargs.setdefault("ADC2MeVKey", "LArADC2MeV")
52 kwargs.setdefault("CablingKey", "LArOnOffIdMap")
53 kwargs.setdefault("MinBiasAvgKey", "LArPileupAverageSym")
54 kwargs.setdefault("EventInfo", "EventInfo")
55
56 # MUST match LArHitEMapToDigitAlg.firstSample (LArDigitizationConfig.py):
57 # it is the shape index seen by digit sample 0, hence negative when
58 # preceding samples are read out. This is NOT the "skip the first N samples"
59 # firstSample used by the raw channel builders.
60 kwargs.setdefault(
61 "firstSample",
62 (
63 -flags.LAr.ROD.nPreceedingSamples
64 if flags.LAr.ROD.nPreceedingSamples != 0
65 else flags.LAr.ROD.FirstSample
66 ),
67 )
68
69 if flags.Common.ProductionStep is ProductionStep.PileUpPresampling:
70 kwargs.setdefault(
71 "LArDigitKey", flags.Overlay.BkgPrefix + "LArDigitContainer_MC"
72 )
73 else:
74 kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC")
75
76 # FIXME: MinBunchCrossing/MaxBunchCrossing are deliberately left at their
77 # defaults, which impose no restriction and so reproduce CaloBCIDCoeffs.
78 # The digitisation only overlays min-bias over a finite bunch crossing
79 # window (-30..+4 for EM, see the PileUpXingFolder ranges in
80 # LArDigitizationConfig.py), so with nPreceedingSamples = 24 the earliest
81 # preceding samples are over-corrected by up to ~78% of the peak pile-up.
82 # See the class documentation in LArRODBCIDCorrAlg.h; this should probably
83 # be addressed, but it is a physics choice rather than a bug.
84
85 kwargs.setdefault("OutputDigitKey", "LArDigitContainer_PileupCorrected")
86
87 kwargs.setdefault("BeamIntensityPattern", flags.Digitization.PU.BeamIntensityPattern)
88
89 acc.addEventAlgo(CompFactory.LArRODBCIDCorrAlg(name, **kwargs))
90
91 return acc
LArRODBCIDCorrAlgCfg(flags, name="LArRODBCIDCorrAlg", **kwargs)