35 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg
36 result=LArCalibBaseCfg(flags)
39 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
40 result.merge(ByteStreamReadCfg(flags))
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
65 result.merge(LArFebErrorSummaryMakerCfg(flags))
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
87 result.merge(LArOnOffIdMappingCfg(flags))
88 result.merge(LArCalibIdMappingSCCfg(flags))
89 result.merge(LArOnOffIdMappingSCCfg(flags))
90 result.merge(LArCalibIdMappingCfg(flags))
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"]
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(dbname=flags.LArCalib.Input.CoolOflP1Replica)
161 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
162 autocorrTag=tagResolver.getFolderTag(flags.LArCalib.AutoCorr.Folder)
166 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
167 result.merge(OutputConditionsAlgCfg(flags,
168 outputFile=flags.LArCalib.Output.POOLFile,
169 ObjectList=[
"LArPedestalComplete#Pedestal#"+flags.LArCalib.Pedestal.Folder,
170 "LArAutoCorrComplete#LArAutoCorr#"+flags.LArCalib.AutoCorr.Folder],
171 IOVTagList=[pedestalTag,autocorrTag],
172 Run1=flags.LArCalib.IOVStart,
173 Run2=flags.LArCalib.IOVEnd
177 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
180 if flags.LArCalib.doValidation:
181 from IOVDbSvc.IOVDbSvcConfig
import addFolders
183 result.merge(addFolders(flags,
"/LAR/ElecCalibFlat/Pedestal<key>PedestalRefIn</key>",
"LAR_ONL",
"CondAttrListCollection"))
184 LArPedestalCondAlg = CompFactory.getComp(
"LArFlatConditionsAlg<LArPedestalFlat>")
185 result.addCondAlgo(LArPedestalCondAlg(
"LArFlatPedCondAlg",ReadKey=
"PedestalRefIn", WriteKey=
"PedestalRef"))
186 from LArCalibDataQuality.Thresholds
import pedThr,rmsThr, pedThrFEB,rmsThrFEB
189 thePedestalValidationAlg=CompFactory.LArPedestalValidationAlg(
"PedestalVal")
191 thePedestalValidationAlg.UseBadChannelInfo=
False
192 thePedestalValidationAlg.ValidationKey=
"Pedestal"
193 thePedestalValidationAlg.ReferenceKey=
"PedestalRef"
194 thePedestalValidationAlg.PedestalTolerance=pedThr
195 thePedestalValidationAlg.PedestalRMSTolerance=rmsThr
196 thePedestalValidationAlg.PedestalToleranceFEB=pedThrFEB
197 thePedestalValidationAlg.PedestalRMSToleranceFEB=rmsThrFEB
198 thePedestalValidationAlg.MsgLevelForDeviations=WARNING
199 thePedestalValidationAlg.ListOfDevFEBs=
"pedFebs.txt"
200 thePedestalValidationAlg.CheckCompletness=
True
201 thePedestalValidationAlg.PatchMissingFEBs=
True
202 thePedestalValidationAlg.UseCorrChannels=
False
203 if flags.LArCalib.isSC:
204 thePedestalValidationAlg.CablingKey =
"LArOnOffIdMapSC"
205 thePedestalValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
206 thePedestalValidationAlg.BadChanKey = bcKey
207 result.addEventAlgo(thePedestalValidationAlg)
210 theBadPedestal=CompFactory.LArPedestalValidationAlg(
"PedestalFail")
212 theBadPedestal.UseBadChannelInfo=
False
213 theBadPedestal.ValidationKey=
"Pedestal"
214 theBadPedestal.ReferenceKey=
"PedestalRef"
215 theBadPedestal.PedestalTolerance = [
"10,10,10"]
216 theBadPedestal.PedestalRMSTolerance = [
"0.5, 0.5, 0.5"]
217 theBadPedestal.PedestalToleranceFEB = [
"8, 8, 8"]
218 theBadPedestal.PedestalRMSToleranceFEB = [
"1.2, 1.2, 1.2"]
220 theBadPedestal.MsgLevelForDeviations=ERROR
221 theBadPedestal.CheckCompletness=
False
222 theBadPedestal.ListOfDevFEBs=
"Bad_pedFebs.txt"
223 if flags.LArCalib.isSC:
224 theBadPedestal.CablingKey =
"LArOnOffIdMapSC"
225 theBadPedestal.CalibLineKey =
"LArCalibIdMapSC"
226 theBadPedestal.BadChanKey = bcKey
227 result.addEventAlgo(theBadPedestal)
230 result.merge(addFolders(flags,
"/LAR/ElecCalibOfl/AutoCorrs/AutoCorr<key>LArAutoCorrRef</key>",
"LAR_OFL"))
231 from LArCalibDataQuality.Thresholds
import acThr, acThrFEB
232 theAutoCorrValidationAlg=CompFactory.LArAutoCorrValidationAlg(
"AutoCorrVal")
233 theAutoCorrValidationAlg.UseBadChannelInfo=
False
234 theAutoCorrValidationAlg.ValidationKey=
"LArAutoCorr"
235 theAutoCorrValidationAlg.ReferenceKey=
"LArAutoCorrRef"
236 theAutoCorrValidationAlg.AutoCorrTolerance=acThr
237 theAutoCorrValidationAlg.AutoCorrToleranceFEB=acThrFEB
238 theAutoCorrValidationAlg.MsgLevelForDeviations=WARNING
239 theAutoCorrValidationAlg.ListOfDevFEBs=
"ACFebs.txt"
240 theAutoCorrValidationAlg.CheckCompletness=
True
241 theAutoCorrValidationAlg.PatchMissingFEBs=
True
242 theAutoCorrValidationAlg.UseCorrChannels=
False
243 if flags.LArCalib.isSC:
244 theAutoCorrValidationAlg.CablingKey =
"LArOnOffIdMapSC"
245 theAutoCorrValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
246 theAutoCorrValidationAlg.BadChanKey = bcKey
247 result.addEventAlgo(theAutoCorrValidationAlg)
250 theBadAutoCorr=CompFactory.LArAutoCorrValidationAlg(
"AutoCorrFail")
251 theBadAutoCorr.UseBadChannelInfo=
False
252 theBadAutoCorr.ValidationKey=
"LArAutoCorr"
253 theBadAutoCorr.ReferenceKey=
"LArAutoCorrRef"
254 theBadAutoCorr.AutoCorrTolerance = [
"0.15, 0.15, 0.15"]
255 theBadAutoCorr.AutoCorrToleranceFEB = [
"0.15, 0.15, 0.15"]
256 theBadAutoCorr.MsgLevelForDeviations=ERROR
257 theBadAutoCorr.CheckFifthSample=
True
258 theBadAutoCorr.ListOfDevFEBs=
"Bad_ACFebs.txt"
259 theBadAutoCorr.CheckCompletness=
False
260 if flags.LArCalib.isSC:
261 theBadAutoCorr.CablingKey =
"LArOnOffIdMapSC"
262 theBadAutoCorr.CalibLineKey =
"LArCalibIdMapSC"
263 theBadAutoCorr.BadChanKey = bcKey
264 result.addEventAlgo(theBadAutoCorr)
266 result.getService(
"IOVDbSvc").DBInstance=
""
268 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
269 result.merge(PerfMonMTSvcCfg(flags))