8 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg,chanSelStr
12 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
17 gainStrMap={0:
"HIGH",1:
"MEDIUM",2:
"LOW"}
18 digKey=gainStrMap[flags.LArCalib.Gain]
20 from LArCalibProcessing.utils
import FolderTagResolver
21 FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
22 tagResolver=FolderTagResolver()
23 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
24 caliOFCTag=tagResolver.getFolderTag(flags.LArCalib.OFCCali.Folder)
26 rampTag=tagResolver.getFolderTag(flags.LArCalib.Ramp.Folder)
29 print(
"pedestalTag",pedestalTag)
30 print(
"rampTag",rampTag)
33 from IOVDbSvc.IOVDbSvcConfig
import addFolders
34 result.merge(
addFolders(flags,flags.LArCalib.Pedestal.Folder,detDb=flags.LArCalib.Input.Database, tag=pedestalTag, modifiers=
chanSelStr(flags),
35 className=
"LArPedestalComplete"))
36 result.merge(
addFolders(flags,flags.LArCalib.OFCCali.Folder,detDb=flags.LArCalib.Input.Database2, tag=caliOFCTag, modifiers=
chanSelStr(flags)))
39 if not flags.LArCalib.isSC:
40 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArAccCalibDigitKey=digKey,
41 LArFebHeaderKey=
"LArFebHeader",
42 SubCaloPreselection=flags.LArCalib.Input.SubDet,
43 PosNegPreselection=flags.LArCalib.Preselection.Side,
44 BEPreselection=flags.LArCalib.Preselection.BEC,
45 FTNumPreselection=flags.LArCalib.Preselection.FT))
47 from LArROD.LArFebErrorSummaryMakerConfig
import LArFebErrorSummaryMakerCfg
49 result.getEventAlgo(
"LArFebErrorSummaryMaker").CheckAllFEB=
False
51 if flags.LArCalib.Input.SubDet ==
"EM":
52 from LArCalibProcessing.LArStripsXtalkCorrConfig
import LArStripsXtalkCorrCfg
55 theLArCalibShortCorrector = CompFactory.LArCalibShortCorrector(KeyList = [digKey,])
56 result.addEventAlgo(theLArCalibShortCorrector)
59 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder(
"LArLATOMEDecoder")
60 if flags.LArCalib.Input.isRawData:
61 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey =
"", etCollKey =
"",
62 etIdCollKey =
"", LATOMEDecoder = theLArLATOMEDecoder))
63 result.addEventAlgo(CompFactory.LArDigitsAccumulator(
"LArDigitsAccumulator", KeyList = [digKey],
64 LArAccuDigitContainerName =
"", NTriggersPerStep = 100,
65 isSC = flags.LArCalib.isSC, DropPercentTrig = 0))
70 from LArCabling.LArCablingConfig
import LArCalibIdMappingCfg,LArOnOffIdMappingCfg
74 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccCalibDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
79 bcKey =
"LArBadChannelSC" if flags.LArCalib.isSC
else "LArBadChannel"
82 theLArRampBuilder = CompFactory.LArRampBuilder()
83 theLArRampBuilder.KeyList = [digKey,]
84 theLArRampBuilder.SubtractDac0 =
False
85 if flags.LArCalib.isSC:
86 theLArRampBuilder.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",
"transmissionErrorFibre",]
88 theLArRampBuilder.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short"]
90 theLArRampBuilder.RecoType =
"OF"
91 theLArRampBuilder.PeakOFTool=CompFactory.LArOFPeakRecoTool(UseShape =
False,OutputLevel=2)
93 theLArRampBuilder.DAC0 = 4294967294
94 theLArRampBuilder.StoreRawRamp =
True
95 theLArRampBuilder.StoreRecRamp =
True
96 theLArRampBuilder.Polynom = 1
97 theLArRampBuilder.RampRange = 3600
98 theLArRampBuilder.correctBias =
False
100 theLArRampBuilder.minDAC = 10
101 theLArRampBuilder.KeyOutput =
"LArRamp"
102 theLArRampBuilder.DeadChannelCut = -9999
103 theLArRampBuilder.GroupingType = flags.LArCalib.GroupingType
106 theLArRampBuilder.isSC = flags.LArCalib.isSC
107 theLArRampBuilder.BadChanKey = bcKey
109 if "HEC" in flags.LArCalib.Input.SubDet:
110 theLArRampBuilder.isHEC =
True
111 theLArRampBuilder.HECKey =
"LArHEC_PAmap"
112 result.merge(
addFolders(flags,
'/LAR/ElecCalibOfl/HecPAMap',
'LAR_OFL'))
114 result.addEventAlgo(theLArRampBuilder)
118 if flags.LArCalib.CorrectBadChannels:
119 LArRampPatcher=CompFactory.getComp(
"LArCalibPatchingAlg<LArRampComplete>")
121 theLArRampPatcher.ContainerKey=
"LArRamp"
122 theLArRampPatcher.BadChanKey=bcKey
123 theLArRampPatcher.PatchMethod=
"PhiAverage"
124 theLArRampPatcher.SuperCells=flags.LArCalib.isSC
126 if flags.LArCalib.isSC:
127 theLArRampPatcher.ProblemsToPatch=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",
"transmissionErrorFibre"]
128 theLArRampPatcher.OnOffMap=
"LArOnOffIdMapSC"
129 theLArRampPatcher.CalibLineKey=
"LArCalibIdMapSC"
131 theLArRampPatcher.ProblemsToPatch=[
"deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short"]
132 theLArRampPatcher.UseCorrChannels=
False
133 result.addEventAlgo(theLArRampPatcher)
136 if flags.LArCalib.doValidation:
138 if flags.LArCalib.isSC:
139 fldr=
"/LAR/ElecCalibFlatSC/Ramp"
140 rmpFlt=CompFactory.getComp(
"LArFlatConditionsAlg<LArRampSC>")(
"RampFltVal")
142 fldr=
"/LAR/ElecCalibFlat/Ramp"
143 rmpFlt=CompFactory.getComp(
"LArFlatConditionsAlg<LArRampFlat>")(
"RampFltVal")
144 result.merge(
addFolders(flags,fldr,
"LAR_ONL"))
145 condLoader=result.getCondAlgo(
"CondInputLoader")
146 condLoader.Load.add((
"CondAttrListCollection",fldr))
149 rmpFlt.WriteKey=
"LArRampRef"
150 result.addCondAlgo(rmpFlt)
152 from LArCalibDataQuality.Thresholds
import rampThr, rampThrFEB
155 theRampValidationAlg=CompFactory.LArRampValidationAlg(
"RampVal")
156 theRampValidationAlg.RampTolerance=rampThr
157 theRampValidationAlg.RampToleranceFEB=rampThrFEB
158 if flags.LArCalib.isSC:
159 theRampValidationAlg.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
160 "OffOFCs",
"transmissionErrorFibre"]
162 theRampValidationAlg.ProblemsToMask=[
"deadReadout",
"deadCalib",
"deadPhys",
"almostDead",
163 "highNoiseHG",
"highNoiseMG",
"highNoiseLG"]
164 theRampValidationAlg.KeyList=[
"LArRamp"+digKey,]
165 if flags.LArCalib.isSC:
166 theRampValidationAlg.PatchMissingFEBs =
False
167 theRampValidationAlg.CheckCompletness =
False
169 theRampValidationAlg.PatchMissingFEBs=
True
170 theRampValidationAlg.UseCorrChannels=
False
171 theRampValidationAlg.ValidationKey=
"LArRamp"
172 theRampValidationAlg.ReferenceKey=
"LArRampRef"
174 theRampValidationAlg.MsgLevelForDeviations=WARNING
175 theRampValidationAlg.ListOfDevFEBs=
"rampFebs.txt"
177 theRampValidationAlg.BadChanKey = bcKey
178 theRampValidationAlg.SuperCells = flags.LArCalib.isSC
180 if flags.LArCalib.isSC:
181 theRampValidationAlg.CablingKey =
"LArOnOffIdMapSC"
182 theRampValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
184 result.addEventAlgo(theRampValidationAlg)
187 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
189 outputFile=flags.LArCalib.Output.POOLFile,
190 ObjectList=[
"LArRampComplete#LArRamp#"+flags.LArCalib.Ramp.Folder,],
191 IOVTagList=[rampTag,],
192 Run1=flags.LArCalib.IOVStart,
193 Run2=flags.LArCalib.IOVEnd
197 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
201 rootfile=flags.LArCalib.Output.ROOTFile
204 if flags.LArCalib.isSC:
207 result.addEventAlgo(CompFactory.LArRamps2Ntuple( ContainerKey = [
"LArRamp"+ntupKey],
208 AddFEBTempInfo =
False,
213 SaveAllSamples =
True,
216 isSC = flags.LArCalib.isSC
218 if flags.LArCalib.Output.SaveAverages:
219 result.addEventAlgo(CompFactory.LArAverages2Ntuple(
"LArAverages2Ntuple"+digKey,
220 ContainerKey =
"SC" if flags.LArCalib.isSC
else digKey,
222 isSC = flags.LArCalib.isSC
226 if os.path.exists(rootfile):
228 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
229 result.setAppProperty(
"HistogramPersistency",
"ROOT")
233 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg