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()
24 pedestalTag=tagResolver.getFolderTag(flags.LArCalib.Pedestal.Folder)
25 caliOFCTag=tagResolver.getFolderTag(flags.LArCalib.OFCCali.Folder)
26
27 rampTag=tagResolver.getFolderTag(flags.LArCalib.Ramp.Folder)
28 del tagResolver
29
30 print("pedestalTag",pedestalTag)
31 print("rampTag",rampTag)
32
33
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)))
38
39
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))
47
48 from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg
49 result.merge(LArFebErrorSummaryMakerCfg(flags))
50 result.getEventAlgo("LArFebErrorSummaryMaker").CheckAllFEB=False
51
52 if flags.LArCalib.Input.SubDet == "EM":
53 from LArCalibProcessing.LArStripsXtalkCorrConfig import LArStripsXtalkCorrCfg
54 result.merge(LArStripsXtalkCorrCfg(flags,[digKey,]))
55
56 theLArCalibShortCorrector = CompFactory.LArCalibShortCorrector(KeyList = [digKey,])
57 result.addEventAlgo(theLArCalibShortCorrector)
58 else:
59 digKey="SC"
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))
66
67 else:
68 # this needs also legacy maps
69 from LArCabling.LArCablingConfig import LArCalibIdMappingCfg,LArOnOffIdMappingCfg
70 result.merge(LArOnOffIdMappingCfg(flags))
71 result.merge(LArCalibIdMappingCfg(flags))
72
73 result.addEventAlgo(CompFactory.LArRawSCCalibDataReadingAlg(LArSCAccCalibDigitKey = digKey, LATOMEDecoder = theLArLATOMEDecoder))
74
75 pass
76
77
78 bcKey = "LArBadChannelSC" if flags.LArCalib.isSC else "LArBadChannel"
79
80
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",]
86 else:
87 theLArRampBuilder.ProblemsToMask=["deadCalib","deadReadout","deadPhys","almostDead","short"]
88
89 theLArRampBuilder.RecoType = "OF"
90 theLArRampBuilder.PeakOFTool=CompFactory.LArOFPeakRecoTool(UseShape = False,OutputLevel=2)
91
92 theLArRampBuilder.DAC0 = 4294967294
93 theLArRampBuilder.StoreRawRamp = True
94 theLArRampBuilder.StoreRecRamp = True
95 theLArRampBuilder.Polynom = 1
96 theLArRampBuilder.RampRange = 3600 # Check on the raw data ADC sample before ped subtraction and pulse reconstruction to include point in fit
97 theLArRampBuilder.correctBias = False
98 #theLArRampBuilder.ConsecutiveADCs = 0
99 theLArRampBuilder.minDAC = 10 # minimum DAC value to use in fit
100 theLArRampBuilder.KeyOutput = "LArRamp"
101 theLArRampBuilder.DeadChannelCut = -9999
102 theLArRampBuilder.GroupingType = flags.LArCalib.GroupingType
103 #theLArRampBuilder.LongNtuple = False
104
105 theLArRampBuilder.isSC = flags.LArCalib.isSC
106 theLArRampBuilder.BadChanKey = bcKey
107
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'))
112
113 result.addEventAlgo(theLArRampBuilder)
114
115
116 # Bad-channel patching
117 if flags.LArCalib.CorrectBadChannels:
118 LArRampPatcher=CompFactory.getComp("LArCalibPatchingAlg<LArRampComplete>")
119 theLArRampPatcher=LArRampPatcher("LArRampPatcher")
120 theLArRampPatcher.ContainerKey="LArRamp"
121 theLArRampPatcher.BadChanKey=bcKey
122 theLArRampPatcher.PatchMethod="PhiAverage"
123 theLArRampPatcher.SuperCells=flags.LArCalib.isSC
124
125 if flags.LArCalib.isSC:
126 theLArRampPatcher.ProblemsToPatch=["deadCalib","deadReadout","deadPhys","maskedOSUM","OffOFCs","transmissionErrorFibre"]
127 theLArRampPatcher.OnOffMap="LArOnOffIdMapSC"
128 theLArRampPatcher.CalibLineKey="LArCalibIdMapSC"
129 else:
130 theLArRampPatcher.ProblemsToPatch=["deadCalib","deadReadout","deadPhys","almostDead","short"]
131 theLArRampPatcher.UseCorrChannels=False
132 result.addEventAlgo(theLArRampPatcher)
133
134 # Validation + CB patching
135 if flags.LArCalib.doValidation:
136
137 if flags.LArCalib.isSC:
138 fldr="/LAR/ElecCalibFlatSC/Ramp"
139 rmpFlt=CompFactory.getComp("LArFlatConditionsAlg<LArRampSC>")("RampFltVal")
140 else:
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))
146
147 rmpFlt.ReadKey=fldr
148 rmpFlt.WriteKey="LArRampRef"
149 result.addCondAlgo(rmpFlt)
150
151 from LArCalibDataQuality.Thresholds import rampThr, rampThrFEB
152 from AthenaCommon.Constants import WARNING
153
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"]
160 else:
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
167 else:
168 theRampValidationAlg.PatchMissingFEBs=True
169 theRampValidationAlg.UseCorrChannels=False
170 theRampValidationAlg.ValidationKey="LArRamp"
171 theRampValidationAlg.ReferenceKey="LArRampRef"
172
173 theRampValidationAlg.MsgLevelForDeviations=WARNING
174 theRampValidationAlg.ListOfDevFEBs="rampFebs.txt"
175
176 theRampValidationAlg.BadChanKey = bcKey
177 theRampValidationAlg.SuperCells = flags.LArCalib.isSC
178
179 if flags.LArCalib.isSC:
180 theRampValidationAlg.CablingKey = "LArOnOffIdMapSC"
181 theRampValidationAlg.CalibLineKey = "LArCalibIdMapSC"
182
183 result.addEventAlgo(theRampValidationAlg)
184
185 #Output (POOL + sqlite) file writing:
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
193 ))
194
195 #RegistrationSvc
196 result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
197
198
199 #ROOT ntuple writing:
200 rootfile=flags.LArCalib.Output.ROOTFile
201
202 ntupKey = digKey
203 if flags.LArCalib.isSC:
204 ntupKey = "HIGH" # Modification to avoid problems in LArRampBuilder
205 if rootfile != "":
206 result.addEventAlgo(CompFactory.LArRamps2Ntuple( ContainerKey = ["LArRamp"+ntupKey], #for RawRamp
207 AddFEBTempInfo = False,
208 RealGeometry = True,
209 OffId = True,
210 AddCalib = True,
211 RawRamp = True,
212 SaveAllSamples = True,
213 BadChanKey = bcKey,
214 ApplyCorr=True,
215 isSC = flags.LArCalib.isSC
216 ))
217 if flags.LArCalib.Output.SaveAverages:
218 result.addEventAlgo(CompFactory.LArAverages2Ntuple( "LArAverages2Ntuple"+digKey,
219 ContainerKey = "SC" if flags.LArCalib.isSC else digKey,
220 BadChanKey = bcKey,
221 isSC = flags.LArCalib.isSC
222 ))
223
224 import os
225 if os.path.exists(rootfile):
226 os.remove(rootfile)
227 result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
228 result.setAppProperty("HistogramPersistency","ROOT")
229 pass # end if ROOT ntuple writing
230
231
232 from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
233 result.merge(PerfMonMTSvcCfg(flags))
234
235 return result
236
237
void print(char *figname, TCanvas *c1)

Variable Documentation

◆ AtlasVersion

python.LArCalib_RampConfig.AtlasVersion

Definition at line 257 of file LArCalib_RampConfig.py.

◆ cfg

python.LArCalib_RampConfig.cfg = MainServicesCfg(ConfigFlags)

Definition at line 266 of file LArCalib_RampConfig.py.

◆ ConfigFlags

python.LArCalib_RampConfig.ConfigFlags = initConfigFlags()

Definition at line 243 of file LArCalib_RampConfig.py.

◆ Database

python.LArCalib_RampConfig.Database

Definition at line 251 of file LArCalib_RampConfig.py.

◆ DBConnection

python.LArCalib_RampConfig.DBConnection

Definition at line 255 of file LArCalib_RampConfig.py.

◆ DBInstance

python.LArCalib_RampConfig.DBInstance

Definition at line 268 of file LArCalib_RampConfig.py.

◆ Dir

python.LArCalib_RampConfig.Dir

Definition at line 246 of file LArCalib_RampConfig.py.

◆ Files

python.LArCalib_RampConfig.Files

Definition at line 250 of file LArCalib_RampConfig.py.

◆ GlobalTag

python.LArCalib_RampConfig.GlobalTag

Definition at line 256 of file LArCalib_RampConfig.py.

◆ POOLFile

python.LArCalib_RampConfig.POOLFile

Definition at line 252 of file LArCalib_RampConfig.py.

◆ ROOTFile

python.LArCalib_RampConfig.ROOTFile

Definition at line 253 of file LArCalib_RampConfig.py.

◆ RunNumbers

python.LArCalib_RampConfig.RunNumbers

Definition at line 248 of file LArCalib_RampConfig.py.

◆ SubDet

python.LArCalib_RampConfig.SubDet

Definition at line 249 of file LArCalib_RampConfig.py.

◆ Type

python.LArCalib_RampConfig.Type

Definition at line 247 of file LArCalib_RampConfig.py.