ATLAS Offline Software
Loading...
Searching...
No Matches
python.LArCalib_RampConfig Namespace Reference

Functions

 LArRampCfg (flags)

Variables

 ConfigFlags = initConfigFlags()
 Dir
 Type
 RunNumbers
 SubDet
 Files
 Database
 POOLFile
 ROOTFile
 DBConnection
 GlobalTag
 AtlasVersion
 cfg = MainServicesCfg(ConfigFlags)
 DBInstance

Function Documentation

◆ LArRampCfg()

python.LArCalib_RampConfig.LArRampCfg ( flags)

Definition at line 7 of file LArCalib_RampConfig.py.

7def LArRampCfg(flags):
8 #Get basic services and cond-algos
9 from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg,chanSelStr
10 result=LArCalibBaseCfg(flags)
11
12 #Add ByteStream reading
13 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
14 result.merge(ByteStreamReadCfg(flags))
15
16 #Calibration runs are taken in fixed gain.
17 #The SG key of the digit-container is name of the gain
18 gainStrMap={0:"HIGH",1:"MEDIUM",2:"LOW"}
19 digKey=gainStrMap[flags.LArCalib.Gain]
20
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)
27 del tagResolver
28 print("rampTag",rampTag)
29
30
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)))
35
36
37 if not flags.LArCalib.isSC:
38 result.addEventAlgo(CompFactory.LArRawCalibDataReadingAlg(LArAccCalibDigitKey=digKey,
39 LArFebHeaderKey="LArFebHeader",
40 SubCaloPreselection=flags.LArCalib.Input.SubDet,
41 PosNegPreselection=flags.LArCalib.Preselection.Side,
42 BEPreselection=flags.LArCalib.Preselection.BEC,
43 FTNumPreselection=flags.LArCalib.Preselection.FT))
44
45 from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg
46 result.merge(LArFebErrorSummaryMakerCfg(flags))
47 result.getEventAlgo("LArFebErrorSummaryMaker").CheckAllFEB=False
48
49 if flags.LArCalib.Input.SubDet == "EM":
50 from LArCalibProcessing.LArStripsXtalkCorrConfig import LArStripsXtalkCorrCfg
51 result.merge(LArStripsXtalkCorrCfg(flags,[digKey,]))
52
53 theLArCalibShortCorrector = CompFactory.LArCalibShortCorrector(KeyList = [digKey,])
54 result.addEventAlgo(theLArCalibShortCorrector)
55 else:
56 digKey="SC"
57 theLArLATOMEDecoder = CompFactory.LArLATOMEDecoder("LArLATOMEDecoder")
58 if flags.LArCalib.Input.isRawData:
59 result.addEventAlgo(CompFactory.LArRawSCDataReadingAlg(adcCollKey = digKey, adcBasCollKey = "", etCollKey = "",
60 etIdCollKey = "", LATOMEDecoder = theLArLATOMEDecoder))
61 from LArCalibProcessing.LArCalib_CalibDigitsMakerConfig import LArCalibDigitsMakerCfg
62 result.merge(LArCalibDigitsMakerCfg(flags,digKey))
63
64 else:
65 # this needs also legacy maps
66 from LArCabling.LArCablingConfig import LArCalibIdMappingCfg,LArOnOffIdMappingCfg
67 result.merge(LArOnOffIdMappingCfg(flags))
68 result.merge(LArCalibIdMappingCfg(flags))
69
70 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccCalibDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
71
72 pass
73
74
75 bcKey = "LArBadChannelSC" if flags.LArCalib.isSC else "LArBadChannel"
76
77
78 theLArRampBuilder = CompFactory.LArRampBuilder()
79 theLArRampBuilder.KeyList = [digKey,]
80 theLArRampBuilder.SubtractDac0 = False
81 if flags.LArCalib.isSC:
82 theLArRampBuilder.ProblemsToMask=["deadCalib","deadReadout","deadPhys","maskedOSUM","OffOFCs","transmissionErrorFibre",]
83 else:
84 theLArRampBuilder.ProblemsToMask=["deadCalib","deadReadout","deadPhys","almostDead","short"]
85
86 theLArRampBuilder.RecoType = "OF"
87 theLArRampBuilder.PeakOFTool=CompFactory.LArOFPeakRecoTool(UseShape = False,OutputLevel=2)
88
89 theLArRampBuilder.DAC0 = 4294967294
90 theLArRampBuilder.StoreRawRamp = True
91 theLArRampBuilder.StoreRecRamp = True
92 theLArRampBuilder.Polynom = 1
93 theLArRampBuilder.RampRange = 3600 # Check on the raw data ADC sample before ped subtraction and pulse reconstruction to include point in fit
94 theLArRampBuilder.correctBias = False
95 #theLArRampBuilder.ConsecutiveADCs = 0
96 theLArRampBuilder.minDAC = 10 # minimum DAC value to use in fit
97 theLArRampBuilder.KeyOutput = "LArRamp"
98 theLArRampBuilder.DeadChannelCut = -9999
99 theLArRampBuilder.GroupingType = flags.LArCalib.GroupingType
100 #theLArRampBuilder.LongNtuple = False
101
102 theLArRampBuilder.isSC = flags.LArCalib.isSC
103 theLArRampBuilder.BadChanKey = bcKey
104
105 if "HEC" in flags.LArCalib.Input.SubDet:
106 theLArRampBuilder.isHEC = True
107 theLArRampBuilder.HECKey = "LArHEC_PAmap"
108 result.merge(addFolders(flags,'/LAR/ElecCalibOfl/HecPAMap',flags.LArCalib.Input.CoolOflP1Replica))
109
110 result.addEventAlgo(theLArRampBuilder)
111
112
113 # Bad-channel patching
114 if flags.LArCalib.CorrectBadChannels:
115 LArRampPatcher=CompFactory.getComp("LArCalibPatchingAlg<LArRampComplete>")
116 theLArRampPatcher=LArRampPatcher("LArRampPatcher")
117 theLArRampPatcher.ContainerKey="LArRamp"
118 theLArRampPatcher.BadChanKey=bcKey
119 theLArRampPatcher.PatchMethod="PhiAverage"
120 theLArRampPatcher.SuperCells=flags.LArCalib.isSC
121
122 if flags.LArCalib.isSC:
123 theLArRampPatcher.ProblemsToPatch=["deadCalib","deadReadout","deadPhys","maskedOSUM","OffOFCs","transmissionErrorFibre"]
124 theLArRampPatcher.OnOffMap="LArOnOffIdMapSC"
125 theLArRampPatcher.CalibLineKey="LArCalibIdMapSC"
126 else:
127 theLArRampPatcher.ProblemsToPatch=["deadCalib","deadReadout","deadPhys","almostDead","short"]
128 theLArRampPatcher.UseCorrChannels=False
129 result.addEventAlgo(theLArRampPatcher)
130
131 # Validation + CB patching
132 if flags.LArCalib.doValidation:
133
134 if flags.LArCalib.isSC:
135 fldr="/LAR/ElecCalibFlatSC/Ramp"
136 rmpFlt=CompFactory.getComp("LArFlatConditionsAlg<LArRampSC>")("RampFltVal")
137 else:
138 fldr="/LAR/ElecCalibFlat/Ramp"
139 rmpFlt=CompFactory.getComp("LArFlatConditionsAlg<LArRampFlat>")("RampFltVal")
140 result.merge(addFolders(flags,fldr,"LAR_ONL"))
141 condLoader=result.getCondAlgo("CondInputLoader")
142 condLoader.Load.add(("CondAttrListCollection",fldr))
143
144 rmpFlt.ReadKey=fldr
145 rmpFlt.WriteKey="LArRampRef"
146 result.addCondAlgo(rmpFlt)
147
148 from LArCalibDataQuality.Thresholds import rampThr, rampThrFEB
149 from AthenaCommon.Constants import WARNING
150
151 theRampValidationAlg=CompFactory.LArRampValidationAlg("RampVal")
152 theRampValidationAlg.RampTolerance=rampThr
153 theRampValidationAlg.RampToleranceFEB=rampThrFEB
154 if flags.LArCalib.isSC:
155 theRampValidationAlg.ProblemsToMask=["deadCalib","deadReadout","deadPhys","maskedOSUM",
156 "OffOFCs","transmissionErrorFibre"]
157 else:
158 theRampValidationAlg.ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
159 "highNoiseHG","highNoiseMG","highNoiseLG"]
160 theRampValidationAlg.KeyList=["LArRamp"+digKey,]
161 if flags.LArCalib.isSC:
162 theRampValidationAlg.PatchMissingFEBs = False
163 theRampValidationAlg.CheckCompletness = False
164 else:
165 theRampValidationAlg.PatchMissingFEBs=True
166 theRampValidationAlg.UseCorrChannels=False
167 theRampValidationAlg.ValidationKey="LArRamp"
168 theRampValidationAlg.ReferenceKey="LArRampRef"
169
170 theRampValidationAlg.MsgLevelForDeviations=WARNING
171 theRampValidationAlg.ListOfDevFEBs="rampFebs.txt"
172
173 theRampValidationAlg.BadChanKey = bcKey
174 theRampValidationAlg.SuperCells = flags.LArCalib.isSC
175
176 if flags.LArCalib.isSC:
177 theRampValidationAlg.CablingKey = "LArOnOffIdMapSC"
178 theRampValidationAlg.CalibLineKey = "LArCalibIdMapSC"
179
180 result.addEventAlgo(theRampValidationAlg)
181
182 #Output (POOL + sqlite) file writing:
183 from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
184 result.merge(OutputConditionsAlgCfg(flags,
185 outputFile=flags.LArCalib.Output.POOLFile,
186 ObjectList=["LArRampComplete#LArRamp#"+flags.LArCalib.Ramp.Folder,],
187 IOVTagList=[rampTag,],
188 Run1=flags.LArCalib.IOVStart,
189 Run2=flags.LArCalib.IOVEnd
190 ))
191
192 #RegistrationSvc
193 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
194
195
196 #ROOT ntuple writing:
197 rootfile=flags.LArCalib.Output.ROOTFile
198
199 ntupKey = digKey
200 if flags.LArCalib.isSC:
201 ntupKey = "HIGH" # Modification to avoid problems in LArRampBuilder
202 if rootfile != "":
203 result.addEventAlgo(CompFactory.LArRamps2Ntuple( ContainerKey = ["LArRamp"+ntupKey], #for RawRamp
204 AddFEBTempInfo = False,
205 RealGeometry = True,
206 OffId = True,
207 AddCalib = True,
208 RawRamp = True,
209 SaveAllSamples = True,
210 BadChanKey = bcKey,
211 ApplyCorr=True,
212 isSC = flags.LArCalib.isSC
213 ))
214 if flags.LArCalib.Output.SaveAverages:
215 result.addEventAlgo(CompFactory.LArAverages2Ntuple( "LArAverages2Ntuple"+digKey,
216 ContainerKey = "SC" if flags.LArCalib.isSC else digKey,
217 BadChanKey = bcKey,
218 isSC = flags.LArCalib.isSC
219 ))
220
221 import os
222 if os.path.exists(rootfile):
223 os.remove(rootfile)
224 result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
225 result.setAppProperty("HistogramPersistency","ROOT")
226 pass # end if ROOT ntuple writing
227
228
229 from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
230 result.merge(PerfMonMTSvcCfg(flags))
231
232 return result
233
234
void print(char *figname, TCanvas *c1)

Variable Documentation

◆ AtlasVersion

python.LArCalib_RampConfig.AtlasVersion

Definition at line 254 of file LArCalib_RampConfig.py.

◆ cfg

python.LArCalib_RampConfig.cfg = MainServicesCfg(ConfigFlags)

Definition at line 263 of file LArCalib_RampConfig.py.

◆ ConfigFlags

python.LArCalib_RampConfig.ConfigFlags = initConfigFlags()

Definition at line 240 of file LArCalib_RampConfig.py.

◆ Database

python.LArCalib_RampConfig.Database

Definition at line 248 of file LArCalib_RampConfig.py.

◆ DBConnection

python.LArCalib_RampConfig.DBConnection

Definition at line 252 of file LArCalib_RampConfig.py.

◆ DBInstance

python.LArCalib_RampConfig.DBInstance

Definition at line 265 of file LArCalib_RampConfig.py.

◆ Dir

python.LArCalib_RampConfig.Dir

Definition at line 243 of file LArCalib_RampConfig.py.

◆ Files

python.LArCalib_RampConfig.Files

Definition at line 247 of file LArCalib_RampConfig.py.

◆ GlobalTag

python.LArCalib_RampConfig.GlobalTag

Definition at line 253 of file LArCalib_RampConfig.py.

◆ POOLFile

python.LArCalib_RampConfig.POOLFile

Definition at line 249 of file LArCalib_RampConfig.py.

◆ ROOTFile

python.LArCalib_RampConfig.ROOTFile

Definition at line 250 of file LArCalib_RampConfig.py.

◆ RunNumbers

python.LArCalib_RampConfig.RunNumbers

Definition at line 245 of file LArCalib_RampConfig.py.

◆ SubDet

python.LArCalib_RampConfig.SubDet

Definition at line 246 of file LArCalib_RampConfig.py.

◆ Type

python.LArCalib_RampConfig.Type

Definition at line 244 of file LArCalib_RampConfig.py.