9 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg,chanSelStr
10 result=LArCalibBaseCfg(flags)
13 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
14 result.merge(ByteStreamReadCfg(flags))
18 gainStrMap={0:
"HIGH",1:
"MEDIUM",2:
"LOW"}
19 digKey=gainStrMap[flags.LArCalib.Gain]
21 from LArCalibProcessing.utils
import FolderTagResolver
22 FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
23 tagResolver=FolderTagResolver(flags.LArCalib.Input.CoolOflP1Replica)
24 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
25 caliOFCTag=tagResolver.getFolderTag(flags.LArCalib.OFCCali.Folder)
26 rampTag=tagResolver.getFolderTag(flags.LArCalib.Ramp.Folder)
28 print(
"rampTag",rampTag)
31 from IOVDbSvc.IOVDbSvcConfig
import addFolders
32 result.merge(addFolders(flags,flags.LArCalib.Pedestal.Folder,detDb=flags.LArCalib.Input.Database, tag=pedestalTag, modifiers=chanSelStr(flags),
33 className=
"LArPedestalComplete"))
34 result.merge(addFolders(flags,flags.LArCalib.OFCCali.Folder,detDb=flags.LArCalib.Input.Database2, tag=caliOFCTag, modifiers=chanSelStr(flags)))
37 if not flags.LArCalib.isSC:
38 if flags.LArCalib.Input.isRawData:
39 result.addEventAlgo(CompFactory.LArRawDataReadingAlg(LArRawChannelKey=
"", LArDigitKey=digKey, LArFebHeaderKey=
"LArFebHeader",
41 SubCaloPreselection=flags.LArCalib.Input.SubDet,
42 PosNegPreselection=flags.LArCalib.Preselection.Side,
43 BEPreselection=flags.LArCalib.Preselection.BEC,
44 FTNumPreselection=flags.LArCalib.Preselection.FT))
45 from LArCalibProcessing.LArCalib_CalibDigitsMakerConfig
import LArCalibDigitsMakerCfg
46 result.merge(LArCalibDigitsMakerCfg(flags,DigitsKey=digKey,ntrigg=flags.LArCalib.OFC.Ncoll))
48 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArAccCalibDigitKey=digKey,
49 LArFebHeaderKey=
"LArFebHeader",
51 SubCaloPreselection=flags.LArCalib.Input.SubDet,
52 PosNegPreselection=flags.LArCalib.Preselection.Side,
53 BEPreselection=flags.LArCalib.Preselection.BEC,
54 FTNumPreselection=flags.LArCalib.Preselection.FT))
56 from LArROD.LArFebErrorSummaryMakerConfig
import LArFebErrorSummaryMakerCfg
57 result.merge(LArFebErrorSummaryMakerCfg(flags))
58 result.getEventAlgo(
"LArFebErrorSummaryMaker").CheckAllFEB=
False
60 if flags.LArCalib.Input.SubDet ==
"EM":
61 from LArCalibProcessing.LArStripsXtalkCorrConfig
import LArStripsXtalkCorrCfg
62 result.merge(LArStripsXtalkCorrCfg(flags,[digKey,]))
64 theLArCalibShortCorrector = CompFactory.LArCalibShortCorrector(KeyList = [digKey,])
65 result.addEventAlgo(theLArCalibShortCorrector)
68 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder(
"LArLATOMEDecoder")
69 if flags.LArCalib.Input.isRawData:
70 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey =
"", etCollKey =
"",
71 etIdCollKey =
"", LATOMEDecoder = theLArLATOMEDecoder))
72 from LArCalibProcessing.LArCalib_CalibDigitsMakerConfig
import LArCalibDigitsMakerCfg
73 result.merge(LArCalibDigitsMakerCfg(flags,digKey))
77 from LArCabling.LArCablingConfig
import LArCalibIdMappingCfg,LArOnOffIdMappingCfg
78 result.merge(LArOnOffIdMappingCfg(flags))
79 result.merge(LArCalibIdMappingCfg(flags))
81 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccCalibDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
86 bcKey =
"LArBadChannelSC" if flags.LArCalib.isSC
else "LArBadChannel"
89 theLArRampBuilder = CompFactory.LArRampBuilder()
90 theLArRampBuilder.KeyList = [digKey,]
91 theLArRampBuilder.SubtractDac0 =
False
92 if flags.LArCalib.isSC:
93 theLArRampBuilder.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",
"transmissionErrorFibre",]
95 theLArRampBuilder.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short"]
97 theLArRampBuilder.RecoType =
"OF"
98 theLArRampBuilder.PeakOFTool=CompFactory.LArOFPeakRecoTool(UseShape =
False,OutputLevel=2)
100 theLArRampBuilder.DAC0 = 4294967294
101 theLArRampBuilder.StoreRawRamp =
True
102 theLArRampBuilder.StoreRecRamp =
True
103 theLArRampBuilder.Polynom = 1
104 theLArRampBuilder.RampRange = 3600
105 theLArRampBuilder.correctBias =
False
107 theLArRampBuilder.minDAC = 10
108 theLArRampBuilder.KeyOutput =
"LArRamp"
109 theLArRampBuilder.DeadChannelCut = -9999
110 theLArRampBuilder.GroupingType = flags.LArCalib.GroupingType
113 theLArRampBuilder.isSC = flags.LArCalib.isSC
114 theLArRampBuilder.BadChanKey = bcKey
116 if "HEC" in flags.LArCalib.Input.SubDet:
117 theLArRampBuilder.isHEC =
True
118 theLArRampBuilder.HECKey =
"LArHEC_PAmap"
119 result.merge(addFolders(flags,
'/LAR/ElecCalibOfl/HecPAMap',flags.LArCalib.Input.CoolOflP1Replica))
121 result.addEventAlgo(theLArRampBuilder)
125 if flags.LArCalib.CorrectBadChannels:
126 LArRampPatcher=CompFactory.getComp(
"LArCalibPatchingAlg<LArRampComplete>")
128 theLArRampPatcher.ContainerKey=
"LArRamp"
129 theLArRampPatcher.BadChanKey=bcKey
130 theLArRampPatcher.PatchMethod=
"PhiAverage"
131 theLArRampPatcher.SuperCells=flags.LArCalib.isSC
133 if flags.LArCalib.isSC:
134 theLArRampPatcher.ProblemsToPatch=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",
"transmissionErrorFibre"]
135 theLArRampPatcher.OnOffMap=
"LArOnOffIdMapSC"
136 theLArRampPatcher.CalibLineKey=
"LArCalibIdMapSC"
138 theLArRampPatcher.ProblemsToPatch=[
"deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short"]
139 theLArRampPatcher.UseCorrChannels=
False
140 result.addEventAlgo(theLArRampPatcher)
143 if flags.LArCalib.doValidation:
145 if flags.LArCalib.isSC:
146 fldr=
"/LAR/ElecCalibFlatSC/Ramp"
147 rmpFlt=CompFactory.getComp(
"LArFlatConditionsAlg<LArRampSC>")(
"RampFltVal")
149 fldr=
"/LAR/ElecCalibFlat/Ramp"
150 rmpFlt=CompFactory.getComp(
"LArFlatConditionsAlg<LArRampFlat>")(
"RampFltVal")
151 result.merge(addFolders(flags,fldr,
"LAR_ONL"))
152 condLoader=result.getCondAlgo(
"CondInputLoader")
153 condLoader.Load.add((
"CondAttrListCollection",fldr))
156 rmpFlt.WriteKey=
"LArRampRef"
157 result.addCondAlgo(rmpFlt)
159 from LArCalibDataQuality.Thresholds
import rampThr, rampThrFEB
162 theRampValidationAlg=CompFactory.LArRampValidationAlg(
"RampVal")
163 theRampValidationAlg.RampTolerance=rampThr
164 theRampValidationAlg.RampToleranceFEB=rampThrFEB
165 if flags.LArCalib.isSC:
166 theRampValidationAlg.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
167 "OffOFCs",
"transmissionErrorFibre"]
169 theRampValidationAlg.ProblemsToMask=[
"deadReadout",
"deadCalib",
"deadPhys",
"almostDead",
170 "highNoiseHG",
"highNoiseMG",
"highNoiseLG"]
171 theRampValidationAlg.KeyList=[
"LArRamp"+digKey,]
172 if flags.LArCalib.isSC:
173 theRampValidationAlg.PatchMissingFEBs =
False
174 theRampValidationAlg.CheckCompletness =
False
176 theRampValidationAlg.PatchMissingFEBs=
True
177 theRampValidationAlg.UseCorrChannels=
False
178 theRampValidationAlg.ValidationKey=
"LArRamp"
179 theRampValidationAlg.ReferenceKey=
"LArRampRef"
181 theRampValidationAlg.MsgLevelForDeviations=WARNING
182 theRampValidationAlg.ListOfDevFEBs=
"rampFebs.txt"
184 theRampValidationAlg.BadChanKey = bcKey
185 theRampValidationAlg.SuperCells = flags.LArCalib.isSC
187 if flags.LArCalib.isSC:
188 theRampValidationAlg.CablingKey =
"LArOnOffIdMapSC"
189 theRampValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
191 result.addEventAlgo(theRampValidationAlg)
194 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
195 result.merge(OutputConditionsAlgCfg(flags,
196 outputFile=flags.LArCalib.Output.POOLFile,
197 ObjectList=[
"LArRampComplete#LArRamp#"+flags.LArCalib.Ramp.Folder,],
198 IOVTagList=[rampTag,],
199 Run1=flags.LArCalib.IOVStart,
200 Run2=flags.LArCalib.IOVEnd
204 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
208 rootfile=flags.LArCalib.Output.ROOTFile
211 if flags.LArCalib.isSC:
214 result.addEventAlgo(CompFactory.LArRamps2Ntuple( ContainerKey = [
"LArRamp"+ntupKey],
215 AddFEBTempInfo =
False,
220 SaveAllSamples =
True,
223 isSC = flags.LArCalib.isSC
225 if flags.LArCalib.Output.SaveAverages:
226 result.addEventAlgo(CompFactory.LArAverages2Ntuple(
"LArAverages2Ntuple"+digKey,
227 ContainerKey =
"SC" if flags.LArCalib.isSC
else digKey,
229 isSC = flags.LArCalib.isSC
233 if os.path.exists(rootfile):
235 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
236 result.setAppProperty(
"HistogramPersistency",
"ROOT")
240 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
241 result.merge(PerfMonMTSvcCfg(flags))