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()
24 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
25 caliOFCTag=tagResolver.getFolderTag(flags.LArCalib.OFCCali.Folder)
27 rampTag=tagResolver.getFolderTag(flags.LArCalib.Ramp.Folder)
30 print(
"pedestalTag",pedestalTag)
31 print(
"rampTag",rampTag)
34 from IOVDbSvc.IOVDbSvcConfig
import addFolders
35 result.merge(addFolders(flags,flags.LArCalib.Pedestal.Folder,detDb=flags.LArCalib.Input.Database, tag=pedestalTag, modifiers=chanSelStr(flags),
36 className=
"LArPedestalComplete"))
37 result.merge(addFolders(flags,flags.LArCalib.OFCCali.Folder,detDb=flags.LArCalib.Input.Database2, tag=caliOFCTag, modifiers=chanSelStr(flags)))
40 if not flags.LArCalib.isSC:
41 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArAccCalibDigitKey=digKey,
42 LArFebHeaderKey=
"LArFebHeader",
43 SubCaloPreselection=flags.LArCalib.Input.SubDet,
44 PosNegPreselection=flags.LArCalib.Preselection.Side,
45 BEPreselection=flags.LArCalib.Preselection.BEC,
46 FTNumPreselection=flags.LArCalib.Preselection.FT))
48 from LArROD.LArFebErrorSummaryMakerConfig
import LArFebErrorSummaryMakerCfg
49 result.merge(LArFebErrorSummaryMakerCfg(flags))
50 result.getEventAlgo(
"LArFebErrorSummaryMaker").CheckAllFEB=
False
52 if flags.LArCalib.Input.SubDet ==
"EM":
53 from LArCalibProcessing.LArStripsXtalkCorrConfig
import LArStripsXtalkCorrCfg
54 result.merge(LArStripsXtalkCorrCfg(flags,[digKey,]))
56 theLArCalibShortCorrector = CompFactory.LArCalibShortCorrector(KeyList = [digKey,])
57 result.addEventAlgo(theLArCalibShortCorrector)
60 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder(
"LArLATOMEDecoder")
61 if flags.LArCalib.Input.isRawData:
62 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey =
"", etCollKey =
"",
63 etIdCollKey =
"", LATOMEDecoder = theLArLATOMEDecoder))
64 from LArCalibProcessing.LArCalib_CalibDigitsMakerConfig
import LArCalibDigitsMakerCfg
65 result.merge(LArCalibDigitsMakerCfg(flags,digKey))
69 from LArCabling.LArCablingConfig
import LArCalibIdMappingCfg,LArOnOffIdMappingCfg
70 result.merge(LArOnOffIdMappingCfg(flags))
71 result.merge(LArCalibIdMappingCfg(flags))
73 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccCalibDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
78 bcKey =
"LArBadChannelSC" if flags.LArCalib.isSC
else "LArBadChannel"
81 theLArRampBuilder = CompFactory.LArRampBuilder()
82 theLArRampBuilder.KeyList = [digKey,]
83 theLArRampBuilder.SubtractDac0 =
False
84 if flags.LArCalib.isSC:
85 theLArRampBuilder.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",
"transmissionErrorFibre",]
87 theLArRampBuilder.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short"]
89 theLArRampBuilder.RecoType =
"OF"
90 theLArRampBuilder.PeakOFTool=CompFactory.LArOFPeakRecoTool(UseShape =
False,OutputLevel=2)
92 theLArRampBuilder.DAC0 = 4294967294
93 theLArRampBuilder.StoreRawRamp =
True
94 theLArRampBuilder.StoreRecRamp =
True
95 theLArRampBuilder.Polynom = 1
96 theLArRampBuilder.RampRange = 3600
97 theLArRampBuilder.correctBias =
False
99 theLArRampBuilder.minDAC = 10
100 theLArRampBuilder.KeyOutput =
"LArRamp"
101 theLArRampBuilder.DeadChannelCut = -9999
102 theLArRampBuilder.GroupingType = flags.LArCalib.GroupingType
105 theLArRampBuilder.isSC = flags.LArCalib.isSC
106 theLArRampBuilder.BadChanKey = bcKey
108 if "HEC" in flags.LArCalib.Input.SubDet:
109 theLArRampBuilder.isHEC =
True
110 theLArRampBuilder.HECKey =
"LArHEC_PAmap"
111 result.merge(addFolders(flags,
'/LAR/ElecCalibOfl/HecPAMap',
'LAR_OFL'))
113 result.addEventAlgo(theLArRampBuilder)
117 if flags.LArCalib.CorrectBadChannels:
118 LArRampPatcher=CompFactory.getComp(
"LArCalibPatchingAlg<LArRampComplete>")
120 theLArRampPatcher.ContainerKey=
"LArRamp"
121 theLArRampPatcher.BadChanKey=bcKey
122 theLArRampPatcher.PatchMethod=
"PhiAverage"
123 theLArRampPatcher.SuperCells=flags.LArCalib.isSC
125 if flags.LArCalib.isSC:
126 theLArRampPatcher.ProblemsToPatch=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",
"transmissionErrorFibre"]
127 theLArRampPatcher.OnOffMap=
"LArOnOffIdMapSC"
128 theLArRampPatcher.CalibLineKey=
"LArCalibIdMapSC"
130 theLArRampPatcher.ProblemsToPatch=[
"deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short"]
131 theLArRampPatcher.UseCorrChannels=
False
132 result.addEventAlgo(theLArRampPatcher)
135 if flags.LArCalib.doValidation:
137 if flags.LArCalib.isSC:
138 fldr=
"/LAR/ElecCalibFlatSC/Ramp"
139 rmpFlt=CompFactory.getComp(
"LArFlatConditionsAlg<LArRampSC>")(
"RampFltVal")
141 fldr=
"/LAR/ElecCalibFlat/Ramp"
142 rmpFlt=CompFactory.getComp(
"LArFlatConditionsAlg<LArRampFlat>")(
"RampFltVal")
143 result.merge(addFolders(flags,fldr,
"LAR_ONL"))
144 condLoader=result.getCondAlgo(
"CondInputLoader")
145 condLoader.Load.add((
"CondAttrListCollection",fldr))
148 rmpFlt.WriteKey=
"LArRampRef"
149 result.addCondAlgo(rmpFlt)
151 from LArCalibDataQuality.Thresholds
import rampThr, rampThrFEB
154 theRampValidationAlg=CompFactory.LArRampValidationAlg(
"RampVal")
155 theRampValidationAlg.RampTolerance=rampThr
156 theRampValidationAlg.RampToleranceFEB=rampThrFEB
157 if flags.LArCalib.isSC:
158 theRampValidationAlg.ProblemsToMask=[
"deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
159 "OffOFCs",
"transmissionErrorFibre"]
161 theRampValidationAlg.ProblemsToMask=[
"deadReadout",
"deadCalib",
"deadPhys",
"almostDead",
162 "highNoiseHG",
"highNoiseMG",
"highNoiseLG"]
163 theRampValidationAlg.KeyList=[
"LArRamp"+digKey,]
164 if flags.LArCalib.isSC:
165 theRampValidationAlg.PatchMissingFEBs =
False
166 theRampValidationAlg.CheckCompletness =
False
168 theRampValidationAlg.PatchMissingFEBs=
True
169 theRampValidationAlg.UseCorrChannels=
False
170 theRampValidationAlg.ValidationKey=
"LArRamp"
171 theRampValidationAlg.ReferenceKey=
"LArRampRef"
173 theRampValidationAlg.MsgLevelForDeviations=WARNING
174 theRampValidationAlg.ListOfDevFEBs=
"rampFebs.txt"
176 theRampValidationAlg.BadChanKey = bcKey
177 theRampValidationAlg.SuperCells = flags.LArCalib.isSC
179 if flags.LArCalib.isSC:
180 theRampValidationAlg.CablingKey =
"LArOnOffIdMapSC"
181 theRampValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
183 result.addEventAlgo(theRampValidationAlg)
186 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
187 result.merge(OutputConditionsAlgCfg(flags,
188 outputFile=flags.LArCalib.Output.POOLFile,
189 ObjectList=[
"LArRampComplete#LArRamp#"+flags.LArCalib.Ramp.Folder,],
190 IOVTagList=[rampTag,],
191 Run1=flags.LArCalib.IOVStart,
192 Run2=flags.LArCalib.IOVEnd
196 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
200 rootfile=flags.LArCalib.Output.ROOTFile
203 if flags.LArCalib.isSC:
206 result.addEventAlgo(CompFactory.LArRamps2Ntuple( ContainerKey = [
"LArRamp"+ntupKey],
207 AddFEBTempInfo =
False,
212 SaveAllSamples =
True,
215 isSC = flags.LArCalib.isSC
217 if flags.LArCalib.Output.SaveAverages:
218 result.addEventAlgo(CompFactory.LArAverages2Ntuple(
"LArAverages2Ntuple"+digKey,
219 ContainerKey =
"SC" if flags.LArCalib.isSC
else digKey,
221 isSC = flags.LArCalib.isSC
225 if os.path.exists(rootfile):
227 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
228 result.setAppProperty(
"HistogramPersistency",
"ROOT")
232 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
233 result.merge(PerfMonMTSvcCfg(flags))