ATLAS Offline Software
Functions | Variables
python.LArCalib_RampConfig Namespace Reference

Functions

def LArRampCfg (flags)
 

Variables

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

Function Documentation

◆ LArRampCfg()

def python.LArCalib_RampConfig.LArRampCfg (   flags)

Definition at line 6 of file LArCalib_RampConfig.py.

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

Variable Documentation

◆ AtlasVersion

python.LArCalib_RampConfig.AtlasVersion

Definition at line 258 of file LArCalib_RampConfig.py.

◆ cfg

python.LArCalib_RampConfig.cfg = MainServicesCfg(ConfigFlags)

Definition at line 267 of file LArCalib_RampConfig.py.

◆ ConfigFlags

python.LArCalib_RampConfig.ConfigFlags = initConfigFlags()

Definition at line 244 of file LArCalib_RampConfig.py.

◆ Database

python.LArCalib_RampConfig.Database

Definition at line 252 of file LArCalib_RampConfig.py.

◆ DBConnection

python.LArCalib_RampConfig.DBConnection

Definition at line 256 of file LArCalib_RampConfig.py.

◆ Dir

python.LArCalib_RampConfig.Dir

Definition at line 247 of file LArCalib_RampConfig.py.

◆ Files

python.LArCalib_RampConfig.Files

Definition at line 251 of file LArCalib_RampConfig.py.

◆ GlobalTag

python.LArCalib_RampConfig.GlobalTag

Definition at line 257 of file LArCalib_RampConfig.py.

◆ POOLFile

python.LArCalib_RampConfig.POOLFile

Definition at line 253 of file LArCalib_RampConfig.py.

◆ ROOTFile

python.LArCalib_RampConfig.ROOTFile

Definition at line 254 of file LArCalib_RampConfig.py.

◆ RunNumbers

python.LArCalib_RampConfig.RunNumbers

Definition at line 249 of file LArCalib_RampConfig.py.

◆ SubDet

python.LArCalib_RampConfig.SubDet

Definition at line 250 of file LArCalib_RampConfig.py.

◆ Type

python.LArCalib_RampConfig.Type

Definition at line 248 of file LArCalib_RampConfig.py.

OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
LArCalibPatchingAlg
Definition: LArCalibPatchingAlg.h:52
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
python.PerfMonCompsConfig.PerfMonMTSvcCfg
def PerfMonMTSvcCfg(flags, **kwargs)
A minimal new-style configuration for PerfMonMTSvc.
Definition: PerfMonCompsConfig.py:10
python.LArCalibBaseConfig.chanSelStr
def chanSelStr(flags)
Definition: LArCalibBaseConfig.py:33
python.LArCalib_RampConfig.LArRampCfg
def LArRampCfg(flags)
Definition: LArCalib_RampConfig.py:6
python.LArFebErrorSummaryMakerConfig.LArFebErrorSummaryMakerCfg
def LArFebErrorSummaryMakerCfg(flags)
Definition: LArFebErrorSummaryMakerConfig.py:7
python.LArStripsXtalkCorrConfig.LArStripsXtalkCorrCfg
def LArStripsXtalkCorrCfg(flags, KeyList)
Definition: LArStripsXtalkCorrConfig.py:6
Constants
some useful constants -------------------------------------------------—
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
python.LArCalibBaseConfig.LArCalibBaseCfg
def LArCalibBaseCfg(flags)
Definition: LArCalibBaseConfig.py:5
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70
LArCablingConfig.LArCalibIdMappingCfg
def LArCalibIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:83