3 from AthenaConfiguration.ComponentFactory
import CompFactory
4 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
8 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArDigitKey=digKey,
9 LArFebHeaderKey=
"LArFebHeader",
10 FailOnCorruption=
False,
11 SubCaloPreselection=flags.LArCalib.Input.SubDet,
12 PosNegPreselection=flags.LArCalib.Preselection.Side,
13 BEPreselection=flags.LArCalib.Preselection.BEC,
14 FTNumPreselection=flags.LArCalib.Preselection.FT))
15 result.addEventAlgo(CompFactory.LArDigitsAccumulator(
"LArDigitsAccumulator", KeyList = [digKey],
16 LArAccuDigitContainerName =
"", NTriggersPerStep = 100,
17 isSC = flags.LArCalib.isSC, DropPercentTrig = 0))
22 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArAccDigitKey=digKey,
23 LArFebHeaderKey=
"LArFebHeader",
24 FailOnCorruption=
False,
25 SubCaloPreselection=flags.LArCalib.Input.SubDet,
26 PosNegPreselection=flags.LArCalib.Preselection.Side,
27 BEPreselection=flags.LArCalib.Preselection.BEC,
28 FTNumPreselection=flags.LArCalib.Preselection.FT))
35 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg
39 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
45 gainStrMap={0:
"HIGH",1:
"MEDIUM",2:
"LOW"}
47 if not flags.LArCalib.isSC:
48 digKey=gainStrMap[flags.LArCalib.Gain]
49 if flags.LArCalib.Input.isRawData:
50 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArDigitKey=digKey,
51 LArFebHeaderKey=
"LArFebHeader",
52 FailOnCorruption=
False,
53 SubCaloPreselection=flags.LArCalib.Input.SubDet,
54 PosNegPreselection=flags.LArCalib.Preselection.Side,
55 BEPreselection=flags.LArCalib.Preselection.BEC,
56 FTNumPreselection=flags.LArCalib.Preselection.FT))
58 result.addEventAlgo(CompFactory.LArDigitsAccumulator(
"LArDigitsAccumulator", KeyList = [digKey],
59 LArAccuDigitContainerName =
"", NTriggersPerStep = 100,
60 isSC = flags.LArCalib.isSC, DropPercentTrig = 0))
64 from LArROD.LArFebErrorSummaryMakerConfig
import LArFebErrorSummaryMakerCfg
66 result.getEventAlgo(
"LArFebErrorSummaryMaker").CheckAllFEB=
False
67 result.addEventAlgo(CompFactory.LArBadEventCatcher(CheckAccCalibDigitCont=
True,
74 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder(
"LArLATOMEDecoder",
75 IgnoreBarrelChannels = flags.LArCalib.SCIgnoreBarrelChannels,
76 IgnoreEndcapChannels = flags.LArCalib.SCIgnoreEndcapChannels)
78 if flags.LArCalib.Input.isRawData:
79 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey =
"", etCollKey =
"",
80 etIdCollKey =
"", LATOMEDecoder = theLArLATOMEDecoder))
81 result.addEventAlgo(CompFactory.LArDigitsAccumulator(
"LArDigitsAccumulator", KeyList = [digKey],
82 LArAccuDigitContainerName =
"", NTriggersPerStep = 100,
83 isSC = flags.LArCalib.isSC, DropPercentTrig = 0))
86 from LArCabling.LArCablingConfig
import LArCalibIdMappingCfg,LArOnOffIdMappingCfg,LArCalibIdMappingSCCfg,LArOnOffIdMappingSCCfg
92 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
94 LArPedACBuilder=CompFactory.LArPedestalAutoCorrBuilder()
95 LArPedACBuilder.KeyList = [digKey,]
96 LArPedACBuilder.PedestalKey =
"Pedestal"
97 LArPedACBuilder.AutoCorrKey =
"LArAutoCorr"
98 LArPedACBuilder.GroupingType = flags.LArCalib.GroupingType
100 result.addEventAlgo(LArPedACBuilder)
102 if flags.LArCalib.isSC:
103 bcKey =
"LArBadChannelSC"
105 bcKey =
"LArBadChannel"
107 if flags.LArCalib.CorrectBadChannels:
108 theLArAcorrPatcher=CompFactory.getComp(
"LArCalibPatchingAlg<LArAutoCorrComplete>")(
"LArAcorrPatch")
109 theLArAcorrPatcher.ContainerKey =
"LArAutoCorr"
110 theLArAcorrPatcher.BadChanKey = bcKey
111 theLArAcorrPatcher.SuperCells = flags.LArCalib.isSC
112 theLArAcorrPatcher.PatchMethod=
"FEBNeighbor"
114 if flags.LArCalib.isSC:
115 theLArAcorrPatcher.ProblemsToPatch = [
"problematicForUnknownReason",
"transmissionErrorFibre",
"badAutoCorr",]
116 theLArAcorrPatcher.OnOffMap=
"LArOnOffIdMapSC"
117 theLArAcorrPatcher.CalibLineKey=
"LArCalibIdMapSC"
119 theLArAcorrPatcher.ProblemsToPatch = [
"badAutoCorr", ]
121 theLArAcorrPatcher.UseCorrChannels=
False
122 result.addEventAlgo(theLArAcorrPatcher)
126 rootfile=flags.LArCalib.Output.ROOTFile
128 result.addEventAlgo(CompFactory.LArPedestals2Ntuple(ContainerKey =
"Pedestal",
129 AddFEBTempInfo =
False,
133 isSC = flags.LArCalib.isSC,
138 result.addEventAlgo(CompFactory.LArAutoCorr2Ntuple(ContainerKey =
"LArAutoCorr",
139 AddFEBTempInfo =
False, isSC = flags.LArCalib.isSC,
142 ApplyCorrection =
True,
149 if os.path.exists(rootfile):
151 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
152 result.setAppProperty(
"HistogramPersistency",
"ROOT")
158 from LArCalibProcessing.utils
import FolderTagResolver
159 FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
160 tagResolver=FolderTagResolver()
161 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
162 autocorrTag=tagResolver.getFolderTag(flags.LArCalib.AutoCorr.Folder)
167 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
169 outputFile=flags.LArCalib.Output.POOLFile,
170 ObjectList=[
"LArPedestalComplete#Pedestal#"+flags.LArCalib.Pedestal.Folder,
171 "LArAutoCorrComplete#LArAutoCorr#"+flags.LArCalib.AutoCorr.Folder],
172 IOVTagList=[pedestalTag,autocorrTag],
173 Run1=flags.LArCalib.IOVStart,
174 Run2=flags.LArCalib.IOVEnd
178 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
181 if flags.LArCalib.doValidation:
182 from IOVDbSvc.IOVDbSvcConfig
import addFolders
185 result.merge(
addFolders(flags,
"/LAR/ElecCalibFlat/Pedestal<key>PedestalRefIn</key>",
"LAR_ONL",
"CondAttrListCollection"))
186 LArPedestalCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArPedestalFlat>")
187 result.addCondAlgo(
LArPedestalCondAlg(
"LArFlatPedCondAlg",ReadKey=
"PedestalRefIn", WriteKey=
"PedestalRef"))
188 from LArCalibDataQuality.Thresholds
import pedThr,rmsThr, pedThrFEB,rmsThrFEB
191 thePedestalValidationAlg=CompFactory.LArPedestalValidationAlg(
"PedestalVal")
193 thePedestalValidationAlg.UseBadChannelInfo=
False
194 thePedestalValidationAlg.ValidationKey=
"Pedestal"
195 thePedestalValidationAlg.ReferenceKey=
"PedestalRef"
196 thePedestalValidationAlg.PedestalTolerance=pedThr
197 thePedestalValidationAlg.PedestalRMSTolerance=rmsThr
198 thePedestalValidationAlg.PedestalToleranceFEB=pedThrFEB
199 thePedestalValidationAlg.PedestalRMSToleranceFEB=rmsThrFEB
200 thePedestalValidationAlg.MsgLevelForDeviations=WARNING
201 thePedestalValidationAlg.ListOfDevFEBs=
"pedFebs.txt"
202 thePedestalValidationAlg.CheckCompletness=
True
203 thePedestalValidationAlg.PatchMissingFEBs=
True
204 thePedestalValidationAlg.UseCorrChannels=
False
205 if flags.LArCalib.isSC:
206 thePedestalValidationAlg.CablingKey =
"LArOnOffIdMapSC"
207 thePedestalValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
208 thePedestalValidationAlg.BadChanKey = bcKey
209 result.addEventAlgo(thePedestalValidationAlg)
212 theBadPedestal=CompFactory.LArPedestalValidationAlg(
"PedestalFail")
214 theBadPedestal.UseBadChannelInfo=
False
215 theBadPedestal.ValidationKey=
"Pedestal"
216 theBadPedestal.ReferenceKey=
"PedestalRef"
217 theBadPedestal.PedestalTolerance = [
"10,10,10"]
218 theBadPedestal.PedestalRMSTolerance = [
"0.5, 0.5, 0.5"]
219 theBadPedestal.PedestalToleranceFEB = [
"8, 8, 8"]
220 theBadPedestal.PedestalRMSToleranceFEB = [
"1.2, 1.2, 1.2"]
222 theBadPedestal.MsgLevelForDeviations=ERROR
223 theBadPedestal.CheckCompletness=
False
224 theBadPedestal.ListOfDevFEBs=
"Bad_pedFebs.txt"
225 if flags.LArCalib.isSC:
226 theBadPedestal.CablingKey =
"LArOnOffIdMapSC"
227 theBadPedestal.CalibLineKey =
"LArCalibIdMapSC"
228 theBadPedestal.BadChanKey = bcKey
229 result.addEventAlgo(theBadPedestal)
232 result.merge(
addFolders(flags,
"/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<key>LArAutoCorrRef</key>",
"LAR_OFL"))
233 from LArCalibDataQuality.Thresholds
import acThr, acThrFEB
234 theAutoCorrValidationAlg=CompFactory.LArAutoCorrValidationAlg(
"AutoCorrVal")
235 theAutoCorrValidationAlg.UseBadChannelInfo=
False
236 theAutoCorrValidationAlg.ValidationKey=
"LArAutoCorr"
237 theAutoCorrValidationAlg.ReferenceKey=
"LArAutoCorrRef"
238 theAutoCorrValidationAlg.AutoCorrTolerance=acThr
239 theAutoCorrValidationAlg.AutoCorrToleranceFEB=acThrFEB
240 theAutoCorrValidationAlg.MsgLevelForDeviations=WARNING
241 theAutoCorrValidationAlg.ListOfDevFEBs=
"ACFebs.txt"
242 theAutoCorrValidationAlg.CheckCompletness=
True
243 theAutoCorrValidationAlg.PatchMissingFEBs=
True
244 theAutoCorrValidationAlg.UseCorrChannels=
False
245 if flags.LArCalib.isSC:
246 theAutoCorrValidationAlg.CablingKey =
"LArOnOffIdMapSC"
247 theAutoCorrValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
248 theAutoCorrValidationAlg.BadChanKey = bcKey
249 result.addEventAlgo(theAutoCorrValidationAlg)
252 theBadAutoCorr=CompFactory.LArAutoCorrValidationAlg(
"AutoCorrFail")
253 theBadAutoCorr.UseBadChannelInfo=
False
254 theBadAutoCorr.ValidationKey=
"LArAutoCorr"
255 theBadAutoCorr.ReferenceKey=
"LArAutoCorrRef"
256 theBadAutoCorr.AutoCorrTolerance = [
"0.15, 0.15, 0.15"]
257 theBadAutoCorr.AutoCorrToleranceFEB = [
"0.15, 0.15, 0.15"]
258 theBadAutoCorr.MsgLevelForDeviations=ERROR
259 theBadAutoCorr.CheckFifthSample=
True
260 theBadAutoCorr.ListOfDevFEBs=
"Bad_ACFebs.txt"
261 theBadAutoCorr.CheckCompletness=
False
262 if flags.LArCalib.isSC:
263 theBadAutoCorr.CablingKey =
"LArOnOffIdMapSC"
264 theBadAutoCorr.CalibLineKey =
"LArCalibIdMapSC"
265 theBadAutoCorr.BadChanKey = bcKey
266 result.addEventAlgo(theBadAutoCorr)
268 result.getService(
"IOVDbSvc").DBInstance=
""
270 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
277 if __name__ ==
"__main__":
279 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
280 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
281 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
282 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
287 ConfigFlags.LArCalib.Input.Dir =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/LArCalibProcessing"
289 ConfigFlags.LArCalib.Input.Type=
"calibration_LArElec-Pedestal"
290 ConfigFlags.LArCalib.Input.RunNumbers=[441236,]
292 ConfigFlags.Input.Files=ConfigFlags.LArCalib.Input.Files
294 ConfigFlags.LArCalib.Output.ROOTFile=
"larpededest.root"
295 ConfigFlags.LArCalib.Output.POOLFile=
"larpedestal.pool.root"
296 ConfigFlags.IOVDb.DBConnection=
"sqlite://;schema=output.sqlite;dbname=CONDBR2"
297 ConfigFlags.IOVDb.GlobalTag=
"LARCALIB-RUN2-00"
298 ConfigFlags.IOVDb.DatabaseInstance=
"CONDBR2"
299 ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
301 ConfigFlags.fillFromArgs()
304 from AthenaCommon
import Logging
305 log = Logging.logging.getLogger(
'Athena' )
306 log.info(
"Input files to be processed:")
307 for f
in ConfigFlags.Input.Files:
313 log.info(
"Start running...")
314 sys.exit(cfg.run().isFailure())