9 from LArCalibProcessing.LArCalibBaseConfig
import LArCalibBaseCfg,chanSelStr
13 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
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 caliWaveTag=tagResolver.getFolderTag(flags.LArCalib.CaliWave.Folder)
26 caliOFCTag=tagResolver.getFolderTag(flags.LArCalib.OFCCali.Folder)
27 acTag=tagResolver.getFolderTag(flags.LArCalib.AutoCorr.Folder)
30 from IOVDbSvc.IOVDbSvcConfig
import addFolders
31 result.merge(
addFolders(flags,flags.LArCalib.Pedestal.Folder,detDb=flags.LArCalib.Input.Database, tag=pedestalTag, modifiers=
chanSelStr(flags),
32 className=
"LArPedestalComplete"))
33 result.merge(
addFolders(flags,flags.LArCalib.AutoCorr.Folder,detDb=flags.LArCalib.Input.Database, tag=acTag,modifiers=
chanSelStr(flags)))
36 if not flags.LArCalib.isSC:
37 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArAccCalibDigitKey=digKey,
38 LArFebHeaderKey=
"LArFebHeader",
39 SubCaloPreselection=flags.LArCalib.Input.SubDet,
40 PosNegPreselection=flags.LArCalib.Preselection.Side,
41 BEPreselection=flags.LArCalib.Preselection.BEC,
42 FTNumPreselection=flags.LArCalib.Preselection.FT))
44 from LArROD.LArFebErrorSummaryMakerConfig
import LArFebErrorSummaryMakerCfg
46 result.getEventAlgo(
"LArFebErrorSummaryMaker").CheckAllFEB=
False
48 if flags.LArCalib.Input.SubDet ==
"EM":
49 theLArCalibShortCorrector = CompFactory.LArCalibShortCorrector(KeyList = [digKey,])
50 result.addEventAlgo(theLArCalibShortCorrector)
52 from LArCalibProcessing.LArStripsXtalkCorrConfig
import LArStripsXtalkCorrCfg
56 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder(
"LArLATOMEDecoder")
57 if flags.LArCalib.Input.isRawData:
58 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey =
"", etCollKey =
"",
59 etIdCollKey =
"", LATOMEDecoder = theLArLATOMEDecoder))
60 result.addEventAlgo(CompFactory.LArDigitsAccumulator(
"LArDigitsAccumulator", KeyList = [digKey],
61 LArAccuDigitContainerName =
"", NTriggersPerStep = 100,
62 isSC = flags.LArCalib.isSC, DropPercentTrig = 20))
67 from LArCabling.LArCablingConfig
import LArCalibIdMappingCfg,LArOnOffIdMappingCfg
70 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccCalibDigitKey = digKey,
71 CalibCablingKeyLeg=
"LArCalibLineMap",
72 OnOffMapLeg=
"LArOnOffIdMap",
73 LATOMEDecoder = theLArLATOMEDecoder, ))
75 bcKey =
"LArBadChannelSC" if flags.LArCalib.isSC
else "LArBadChannel"
77 theLArCaliWaveBuilder = CompFactory.LArCaliWaveBuilder()
78 theLArCaliWaveBuilder.KeyList= [digKey,]
79 theLArCaliWaveBuilder.KeyOutput=
"LArCaliWave"
80 theLArCaliWaveBuilder.GroupingType = flags.LArCalib.GroupingType
81 theLArCaliWaveBuilder.SubtractPed =
True
82 theLArCaliWaveBuilder.CheckEmptyPhases =
not flags.LArCalib.isSC
83 theLArCaliWaveBuilder.NBaseline = 0
84 theLArCaliWaveBuilder.UseDacAndIsPulsedIndex =
False
85 theLArCaliWaveBuilder.RecAllCells =
False
86 theLArCaliWaveBuilder.isSC = flags.LArCalib.isSC
87 result.addEventAlgo(theLArCaliWaveBuilder)
90 if flags.LArCalib.Input.SubDet ==
"HEC" or flags.LArCalib.Input.SubDet ==
"HECFCAL":
91 theLArCaliWaveBuilder.KeyOutput=
"LArCaliWave_multi"
92 theLArCaliWaveSelector = CompFactory.LArCaliWaveSelector(
"LArCaliWaveSelector")
93 theLArCaliWaveSelector.KeyList = [
"LArCaliWave_multi",]
94 theLArCaliWaveSelector.KeyOutput =
"LArCaliWave"
95 theLArCaliWaveSelector.GroupingType = flags.LArCalib.GroupingType
96 if flags.LArCalib.Gain==0:
97 theLArCaliWaveSelector.SelectionList = [
"HEC/0/0/460",
"HEC/1/0/460",
"HEC/2/0/230",
"HEC/3/0/230" ]
98 theLArCaliWaveSelector.SelectionList += [
"FCAL/0/0/500",
"FCAL/1/0/500",
"FCAL/2/0/500",
"FCAL/3/0/500" ]
100 elif flags.LArCalib.Gain==1:
101 theLArCaliWaveSelector.SelectionList = [
"HEC/0/1/3600",
"HEC/1/1/3600",
"HEC/2/1/1800",
"HEC/3/1/1800"]
102 theLArCaliWaveSelector.SelectionList += [
"FCAL/0/1/5000",
"FCAL/1/1/5000",
"FCAL/2/1/5000",
"FCAL/3/1/5000" ]
104 elif flags.LArCalib.Gain==2:
105 theLArCaliWaveSelector.SelectionList = [
"HEC/0/2/24000",
"HEC/1/2/24000",
"HEC/2/2/18000",
"HEC/3/2/18000" ]
106 theLArCaliWaveSelector.SelectionList += [
"FCAL/0/2/40000",
"FCAL/1/2/40000",
"FCAL/2/2/40000",
"FCAL/3/2/40000" ]
108 result.addEventAlgo(theLArCaliWaveSelector)
111 if flags.LArCalib.CorrectBadChannels:
112 theLArCaliWavePatcher=CompFactory.getComp(
"LArCalibPatchingAlg<LArCaliWaveContainer>")(
"LArCaliWavePatch")
113 theLArCaliWavePatcher.ContainerKey =
"LArCaliWave"
114 theLArCaliWavePatcher.BadChanKey = bcKey
115 theLArCaliWavePatcher.SuperCells = flags.LArCalib.isSC
117 theLArCaliWavePatcher.PatchMethod =
"PhiAverage"
118 if flags.LArCalib.isSC:
119 theLArCaliWavePatcher.ProblemsToPatch = [
120 "deadCalib",
"deadReadout",
"deadPhys",
"maskedOSUM",
"OffOFCs",]
121 theLArCaliWavePatcher.OnOffMap=
"LArOnOffIdMapSC"
122 theLArCaliWavePatcher.CalibLineKey=
"LArCalibIdMapSC"
124 theLArCaliWavePatcher.ProblemsToPatch = [
125 "deadCalib",
"deadReadout",
"deadPhys",
"almostDead",
"short", ]
127 result.addEventAlgo(theLArCaliWavePatcher)
130 if flags.LArCalib.doValidation:
132 result.merge(
addFolders(flags,flags.LArCalib.CaliWave.Folder+
"<key>LArCaliWaveRef</key>",
"LAR_OFL"))
134 from LArCalibDataQuality.Thresholds
import cwAmpThr,cwFWHMThr,cwAmpThrFEB,cwFWHMThrFEB
137 theCaliWaveValidationAlg=CompFactory.LArCaliWaveValidationAlg(
"CaliWaveVal")
138 theCaliWaveValidationAlg.ProblemsToMask=[
"deadReadout",
"deadCalib",
"deadPhys",
"almostDead",
139 "highNoiseHG",
"highNoiseMG",
"highNoiseLG"]
140 theCaliWaveValidationAlg.ValidationKey=
"LArCaliWave"
141 theCaliWaveValidationAlg.ReferenceKey=
"LArCaliWaveRef"
142 theCaliWaveValidationAlg.MsgLevelForDeviations=WARNING
143 theCaliWaveValidationAlg.ListOfDevFEBs=
"caliWaveFebs.txt"
144 theCaliWaveValidationAlg.AmplitudeTolerance=cwAmpThr
145 theCaliWaveValidationAlg.CaliWaveFWHMTolerance=cwFWHMThr
146 theCaliWaveValidationAlg.AmplitudeToleranceFEB=cwAmpThrFEB
147 theCaliWaveValidationAlg.CaliWaveFWHMToleranceFEB=cwFWHMThrFEB
148 theCaliWaveValidationAlg.TimeShiftDetection=
True
149 theCaliWaveValidationAlg.PatchMissingFEBs=
True
150 theCaliWaveValidationAlg.UseCorrChannels=
False
151 theCaliWaveValidationAlg.BadChanKey = bcKey
152 theCaliWaveValidationAlg.SuperCells = flags.LArCalib.isSC
154 if flags.LArCalib.isSC:
155 theCaliWaveValidationAlg.CablingKey =
"LArOnOffIdMapSC"
156 theCaliWaveValidationAlg.CalibLineKey =
"LArCalibIdMapSC"
158 result.addEventAlgo(theCaliWaveValidationAlg)
162 LArCaliOFCAlg = CompFactory.LArOFCAlg(
"LArCaliOFCAlg")
163 LArCaliOFCAlg.ReadCaliWave =
True
164 LArCaliOFCAlg.KeyList = [
"LArCaliWave" ]
165 LArCaliOFCAlg.Nphase = 50
166 LArCaliOFCAlg.Dphase = 1
167 LArCaliOFCAlg.Ndelay = 24
168 LArCaliOFCAlg.Nsample = 5
169 LArCaliOFCAlg.Normalize =
True
170 LArCaliOFCAlg.TimeShift =
False
171 LArCaliOFCAlg.TimeShiftByIndex = -1
172 LArCaliOFCAlg.Verify =
True
173 LArCaliOFCAlg.FillShape =
False
175 LArCaliOFCAlg.GroupingType = flags.LArCalib.GroupingType
176 LArCaliOFCAlg.isSC = flags.LArCalib.isSC
177 LArCaliOFCAlg.DecoderTool=CompFactory.LArAutoCorrDecoderTool(isSC=flags.LArCalib.isSC)
178 result.addEventAlgo(LArCaliOFCAlg)
182 rootfile=flags.LArCalib.Output.ROOTFile
183 rootfile2=flags.LArCalib.Output.ROOTFile2
185 result.addEventAlgo(CompFactory.LArCaliWaves2Ntuple(KeyList = [
"LArCaliWave",],
186 NtupleName =
"CALIWAVE",
187 AddFEBTempInfo =
False,
189 SaveDerivedInfo =
True,
190 ApplyCorrection =
True,
191 isSC = flags.LArCalib.isSC,
199 result.addEventAlgo(CompFactory.LArOFC2Ntuple(ContainerKey =
"LArOFC",
200 AddFEBTempInfo =
False,
207 if os.path.exists(rootfile):
209 result.addService(CompFactory.NTupleSvc(Output = [
"FILE1 DATAFILE='"+rootfile+
"' OPT='NEW'" ]))
210 result.setAppProperty(
"HistogramPersistency",
"ROOT")
214 result.addEventAlgo(CompFactory.LArOFC2Ntuple(ContainerKey =
"LArOFC",
215 AddFEBTempInfo =
False,
216 NtupleFile =
"FILE2",
222 if os.path.exists(rootfile2):
225 result.addService(CompFactory.NTupleSvc(Output = [
"FILE2 DATAFILE='"+rootfile2+
"' OPT='NEW'" ]))
227 result.getService(
"NTupleSvc").Output += [
"FILE2 DATAFILE='"+rootfile2+
"' OPT='NEW'" ]
228 result.setAppProperty(
"HistogramPersistency",
"ROOT")
233 from LArCalibProcessing.utils
import FolderTagResolver
234 tagResolver=FolderTagResolver()
235 caliWaveTag=tagResolver.getFolderTag(flags.LArCalib.CaliWave.Folder)
236 caliOFCTag=tagResolver.getFolderTag(flags.LArCalib.OFCCali.Folder)
241 from RegistrationServices.OutputConditionsAlgConfig
import OutputConditionsAlgCfg
243 outputFile=flags.LArCalib.Output.POOLFile,
244 ObjectList=[
"LArCaliWaveContainer#LArCaliWave#"+flags.LArCalib.CaliWave.Folder,
245 "LArOFCComplete#LArOFC#"+flags.LArCalib.OFCCali.Folder],
246 IOVTagList=[caliWaveTag,caliOFCTag],
247 Run1=flags.LArCalib.IOVStart,
248 Run2=flags.LArCalib.IOVEnd
252 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders =
False))
255 result.getService(
"IOVDbSvc").DBInstance=
""
257 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg