3 from AthenaConfiguration.ComponentFactory
import CompFactory
8 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg
12 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
18 gainStrMap={0:
"HIGH",1:
"MEDIUM",2:
"LOW"}
20 if not flags.LArCalib.isSC:
21 digKey=gainStrMap[flags.LArCalib.Gain]
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))
30 from LArROD.LArFebErrorSummaryMakerConfig
import LArFebErrorSummaryMakerCfg
32 result.getEventAlgo(
"LArFebErrorSummaryMaker").CheckAllFEB=
False
33 result.addEventAlgo(CompFactory.LArBadEventCatcher(CheckAccCalibDigitCont=
True,
40 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder(
"LArLATOMEDecoder",
41 IgnoreBarrelChannels = flags.LArCalib.SCIgnoreBarrelChannels,
42 IgnoreEndcapChannels = flags.LArCalib.SCIgnoreEndcapChannels)
44 if flags.LArCalib.Input.isRawData:
45 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey =
"", etCollKey =
"",
46 etIdCollKey =
"", LATOMEDecoder = theLArLATOMEDecoder))
47 result.addEventAlgo(CompFactory.LArDigitsAccumulator(
"LArDigitsAccumulator", KeyList = [digKey],
48 LArAccuDigitContainerName =
"", NTriggersPerStep = 100,
49 isSC = flags.LArCalib.isSC, DropPercentTrig = 0))
52 from LArCabling.LArCablingConfig
import LArCalibIdMappingCfg,LArOnOffIdMappingCfg,LArCalibIdMappingSCCfg,LArOnOffIdMappingSCCfg
58 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
60 LArPedACBuilder=CompFactory.LArPedestalAutoCorrBuilder()
61 LArPedACBuilder.KeyList = [digKey,]
62 LArPedACBuilder.PedestalKey =
"Pedestal"
63 LArPedACBuilder.AutoCorrKey =
"LArAutoCorr"
64 LArPedACBuilder.GroupingType = flags.LArCalib.GroupingType
66 result.addEventAlgo(LArPedACBuilder)
69 rootfile=flags.LArCalib.Output.ROOTFile
70 if flags.LArCalib.isSC:
71 bcKey =
"LArBadChannelSC"
73 bcKey =
"LArBadChannel"
76 result.addEventAlgo(CompFactory.LArPedestals2Ntuple(ContainerKey =
"Pedestal",
77 AddFEBTempInfo =
False,
81 isSC = flags.LArCalib.isSC,
86 result.addEventAlgo(CompFactory.LArAutoCorr2Ntuple(ContainerKey =
"LArAutoCorr",
87 AddFEBTempInfo =
False, isSC = flags.LArCalib.isSC,
95 if os.path.exists(rootfile):
97 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
98 result.setAppProperty(
"HistogramPersistency",
"ROOT")
104 from LArCalibProcessing.utils
import FolderTagResolver
105 FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
106 tagResolver=FolderTagResolver()
107 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
108 autocorrTag=tagResolver.getFolderTag(flags.LArCalib.AutoCorr.Folder)
113 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
115 outputFile=flags.LArCalib.Output.POOLFile,
116 ObjectList=[
"LArPedestalComplete#Pedestal#"+flags.LArCalib.Pedestal.Folder,
117 "LArAutoCorrComplete#LArAutoCorr#"+flags.LArCalib.AutoCorr.Folder],
118 IOVTagList=[pedestalTag,autocorrTag],
119 Run1=flags.LArCalib.IOVStart,
120 Run2=flags.LArCalib.IOVEnd
124 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
128 if flags.LArCalib.doValidation:
129 from IOVDbSvc.IOVDbSvcConfig
import addFolders
132 result.merge(
addFolders(flags,
"/LAR/ElecCalibFlat/Pedestal<key>PedestalRefIn</key>",
"LAR_ONL",
"CondAttrListCollection"))
133 LArPedestalCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArPedestalFlat>")
134 result.addCondAlgo(
LArPedestalCondAlg(
"LArFlatPedCondAlg",ReadKey=
"PedestalRefIn", WriteKey=
"PedestalRef"))
135 from LArCalibDataQuality.Thresholds
import pedThr,rmsThr, pedThrFEB,rmsThrFEB
138 thePedestalValidationAlg=CompFactory.LArPedestalValidationAlg(
"PedestalVal")
140 thePedestalValidationAlg.UseBadChannelInfo=
False
141 thePedestalValidationAlg.ValidationKey=
"Pedestal"
142 thePedestalValidationAlg.ReferenceKey=
"PedestalRef"
143 thePedestalValidationAlg.PedestalTolerance=pedThr
144 thePedestalValidationAlg.PedestalRMSTolerance=rmsThr
145 thePedestalValidationAlg.PedestalToleranceFEB=pedThrFEB
146 thePedestalValidationAlg.PedestalRMSToleranceFEB=rmsThrFEB
147 thePedestalValidationAlg.MsgLevelForDeviations=WARNING
148 thePedestalValidationAlg.ListOfDevFEBs=
"pedFebs.txt"
149 thePedestalValidationAlg.CheckCompletness=
True
150 thePedestalValidationAlg.PatchMissingFEBs=
True
151 thePedestalValidationAlg.UseCorrChannels=
False
152 if flags.LArCalib.isSC:
153 thePedestalValidationAlg.CablingKey =
"LArOnOffIdMapSC"
154 thePedestalValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
155 thePedestalValidationAlg.BadChanKey = bcKey
156 result.addEventAlgo(thePedestalValidationAlg)
159 theBadPedestal=CompFactory.LArPedestalValidationAlg(
"PedestalFail")
161 theBadPedestal.UseBadChannelInfo=
False
162 theBadPedestal.ValidationKey=
"Pedestal"
163 theBadPedestal.ReferenceKey=
"PedestalRef"
164 theBadPedestal.PedestalTolerance = [
"10,10,10"]
165 theBadPedestal.PedestalRMSTolerance = [
"0.5, 0.5, 0.5"]
166 theBadPedestal.PedestalToleranceFEB = [
"8, 8, 8"]
167 theBadPedestal.PedestalRMSToleranceFEB = [
"1.2, 1.2, 1.2"]
169 theBadPedestal.MsgLevelForDeviations=ERROR
170 theBadPedestal.CheckCompletness=
False
171 theBadPedestal.ListOfDevFEBs=
"Bad_pedFebs.txt"
172 if flags.LArCalib.isSC:
173 theBadPedestal.CablingKey =
"LArOnOffIdMapSC"
174 theBadPedestal.CalibLineKey =
"LArCalibIdMapSC"
175 theBadPedestal.BadChanKey = bcKey
176 result.addEventAlgo(theBadPedestal)
179 result.merge(
addFolders(flags,
"/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<key>LArAutoCorrRef</key>",
"LAR_OFL"))
180 from LArCalibDataQuality.Thresholds
import acThr, acThrFEB
181 theAutoCorrValidationAlg=CompFactory.LArAutoCorrValidationAlg(
"AutoCorrVal")
182 theAutoCorrValidationAlg.UseBadChannelInfo=
False
183 theAutoCorrValidationAlg.ValidationKey=
"LArAutoCorr"
184 theAutoCorrValidationAlg.ReferenceKey=
"LArAutoCorrRef"
185 theAutoCorrValidationAlg.AutoCorrTolerance=acThr
186 theAutoCorrValidationAlg.AutoCorrToleranceFEB=acThrFEB
187 theAutoCorrValidationAlg.MsgLevelForDeviations=WARNING
188 theAutoCorrValidationAlg.ListOfDevFEBs=
"ACFebs.txt"
189 theAutoCorrValidationAlg.CheckCompletness=
True
190 theAutoCorrValidationAlg.PatchMissingFEBs=
True
191 theAutoCorrValidationAlg.UseCorrChannels=
False
192 if flags.LArCalib.isSC:
193 theAutoCorrValidationAlg.CablingKey =
"LArOnOffIdMapSC"
194 theAutoCorrValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
195 theAutoCorrValidationAlg.BadChanKey = bcKey
196 result.addEventAlgo(theAutoCorrValidationAlg)
199 theBadAutoCorr=CompFactory.LArAutoCorrValidationAlg(
"AutoCorrFail")
200 theBadAutoCorr.UseBadChannelInfo=
False
201 theBadAutoCorr.ValidationKey=
"LArAutoCorr"
202 theBadAutoCorr.ReferenceKey=
"LArAutoCorrRef"
203 theBadAutoCorr.AutoCorrTolerance = [
"0.15, 0.15, 0.15"]
204 theBadAutoCorr.AutoCorrToleranceFEB = [
"0.15, 0.15, 0.15"]
205 theBadAutoCorr.MsgLevelForDeviations=ERROR
206 theBadAutoCorr.CheckFifthSample=
True
207 theBadAutoCorr.ListOfDevFEBs=
"Bad_ACFebs.txt"
208 theBadAutoCorr.CheckCompletness=
False
209 if flags.LArCalib.isSC:
210 theBadAutoCorr.CablingKey =
"LArOnOffIdMapSC"
211 theBadAutoCorr.CalibLineKey =
"LArCalibIdMapSC"
212 theBadAutoCorr.BadChanKey = bcKey
213 result.addEventAlgo(theBadAutoCorr)
215 result.getService(
"IOVDbSvc").DBInstance=
""
217 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
224 if __name__ ==
"__main__":
226 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
227 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
228 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
229 from LArCalibProcessing.LArCalibConfigFlags
import addLArCalibFlags
234 ConfigFlags.LArCalib.Input.Dir =
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/LArCalibProcessing"
236 ConfigFlags.LArCalib.Input.Type=
"calibration_LArElec-Pedestal"
237 ConfigFlags.LArCalib.Input.RunNumbers=[441236,]
239 ConfigFlags.Input.Files=ConfigFlags.LArCalib.Input.Files
241 ConfigFlags.LArCalib.Output.ROOTFile=
"larpededest.root"
242 ConfigFlags.LArCalib.Output.POOLFile=
"larpedestal.pool.root"
243 ConfigFlags.IOVDb.DBConnection=
"sqlite://;schema=output.sqlite;dbname=CONDBR2"
244 ConfigFlags.IOVDb.GlobalTag=
"LARCALIB-RUN2-00"
245 ConfigFlags.IOVDb.DatabaseInstance=
"CONDBR2"
246 ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
248 ConfigFlags.fillFromArgs()
251 from AthenaCommon
import Logging
252 log = Logging.logging.getLogger(
'Athena' )
253 log.info(
"Input files to be processed:")
254 for f
in ConfigFlags.Input.Files:
260 log.info(
"Start running...")
261 sys.exit(cfg.run().isFailure())