ATLAS Offline Software
Loading...
Searching...
No Matches
LArRawChannelBuilderAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2from AthenaConfiguration.ComponentFactory import CompFactory
3from AthenaConfiguration.Enums import LHCPeriod, ProductionStep, Format
4from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg
5from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg
6from LArRecUtils.LArRecUtilsConfig import LArOFCCondAlgCfg
7from LArConfiguration.LArConfigFlags import RawChannelSource
8
9def LArRawChannelBuilderAlgCfg(flags, doDigiTruth=False, **kwargs):
10
11 acc = LArADC2MeVCondAlgCfg(flags)
12
13 if not doDigiTruth:
14 kwargs.setdefault("name", "LArRawChannelBuilder")
15 else:
16 kwargs.setdefault("name", "LArRawChannelBuilder_DigiHSTruth")
17 kwargs.setdefault("firstSample", flags.LAr.ROD.nPreceedingSamples if flags.LAr.ROD.nPreceedingSamples!=0 else flags.LAr.ROD.FirstSample)
18 obj = "AthenaAttributeList"
19 dspkey = 'Run2DSPThresholdsKey'
20 from IOVDbSvc.IOVDbSvcConfig import addFolders
21 if flags.Input.isMC and flags.Input.Format != Format.BS:
22 # need OFC configuration, which includes appropriate ElecCalibDb
23 acc.merge(LArOFCCondAlgCfg(flags))
24
25 if not doDigiTruth:
26 kwargs.setdefault("LArRawChannelKey", "LArRawChannels")
27 else:
28 kwargs.setdefault("LArRawChannelKey", "LArRawChannels_DigiHSTruth")
29
30 kwargs.setdefault("ShapeKey", "LArShapeSym")
31 if flags.GeoModel.Run is LHCPeriod.Run1: # back to flat threshold
32 kwargs.setdefault("useDB", False)
33 dspkey = ''
34 else:
35 fld="/LAR/NoiseOfl/DSPThresholds"
36 sgkey=fld
37 dbString="OFLP200"
38 dbInstance="LAR_OFL"
39 acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString))
40
41 if flags.Common.ProductionStep in [ProductionStep.PileUpPresampling, ProductionStep.PileUpPretracking]:
42 kwargs.setdefault("LArDigitKey", flags.Overlay.BkgPrefix + "LArDigitContainer_MC")
43 elif doDigiTruth:
44 kwargs.setdefault("LArDigitKey", "LArDigitContainer_DigiHSTruth")
45 else:
46 kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC")
47 else:
48 acc.merge(LArElecCalibDBCfg(flags,("OFC","Shape","Pedestal")))
49 if flags.Common.ProductionStep is ProductionStep.MinbiasPreprocessing:
50 kwargs.setdefault("LArDigitKey", f"{flags.Overlay.BkgPrefix}LArDigitContainer_data")
51 kwargs.setdefault("LArRawChannelKey", "LArRawChannels_FromDigits")
52 elif flags.Overlay.DataOverlay:
53 kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC")
54 kwargs.setdefault("LArRawChannelKey", "LArRawChannels")
55 else:
56 kwargs.setdefault("LArRawChannelKey", "LArRawChannels_FromDigits")
57 if 'COMP200' in flags.IOVDb.DatabaseInstance:
58 fld='/LAR/Configuration/DSPThreshold/Thresholds'
59 obj='LArDSPThresholdsComplete'
60 dspkey = 'Run1DSPThresholdsKey'
61 sgkey='LArDSPThresholds'
62 dbString = 'COMP200'
63 else:
64 fld="/LAR/Configuration/DSPThresholdFlat/Thresholds"
65 sgkey=fld
66 dbString="CONDBR2"
67 dbInstance="LAR_ONL"
68 acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString))
69
70 if len (dspkey) > 0:
71 kwargs.setdefault(dspkey, sgkey)
72
73 if flags.LAr.ROD.forceIter or flags.LAr.RawChannelSource is RawChannelSource.Calculated:
74 # iterative OFC procedure
75 kwargs.setdefault('minSample',2)
76 kwargs.setdefault('maxSample',12)
77 kwargs.setdefault('minADCforIterInSigma',4)
78 kwargs.setdefault('minADCforIter',15)
79 kwargs.setdefault('defaultPhase',12)
80 nominalPeakSample=2
81 from LArConditionsCommon.LArRunFormat import getLArFormatForRun
82 larformat=getLArFormatForRun(flags.Input.RunNumbers[0],connstring="COOLONL_LAR/"+flags.IOVDb.DatabaseInstance)
83 if larformat is not None:
84 nominalPeakSample = larformat.firstSample()
85 else:
86 print("WARNING: larformat not found, use nominalPeakSample = 2")
87 nominalPeakSample = 2
88 if (nominalPeakSample > 1) :
89 kwargs.setdefault('DefaultShiftTimeSample',nominalPeakSample-2)
90 else :
91 kwargs.setdefault('DefaultShiftTimeSample',0)
92
93 acc.addEventAlgo(CompFactory.LArRawChannelBuilderIterAlg(**kwargs))
94 else:
95 #fixed OFC, as in DSP
96 acc.addEventAlgo(CompFactory.LArRawChannelBuilderAlg(**kwargs))
97
98 return acc
99
100
101if __name__=="__main__":
102
103 from AthenaConfiguration.AllConfigFlags import initConfigFlags
104 from AthenaCommon.Logging import log
105 from AthenaCommon.Constants import DEBUG
106 log.setLevel(DEBUG)
107
108 from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
109 flags = initConfigFlags()
110 flags.Input.Files = defaultTestFiles.RAW_RUN2
111 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
112 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
113 # in case of testing iterative OFC:
114 #flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data15_1beam/data15_1beam.00260466.physics_L1Calo.merge.RAW._lb1380._SFO-ALL._0001.1']
115 flags.Input.isMC = False
116 flags.Detector.GeometryTile = False
117 flags.lock()
118
119
120 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
121 from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg
122
123 acc=MainServicesCfg(flags)
124 acc.merge(LArRawDataReadingCfg(flags))
125 acc.merge(LArRawChannelBuilderAlgCfg(flags))
126
127 DumpLArRawChannels=CompFactory.DumpLArRawChannels
128 acc.addEventAlgo(DumpLArRawChannels(LArRawChannelContainerName="LArRawChannels_FromDigits",),sequenceName="AthAlgSeq")
129
130 acc.run(3)
void print(char *figname, TCanvas *c1)
LArRawChannelBuilderAlgCfg(flags, doDigiTruth=False, **kwargs)