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"]
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"]
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  theRampValidationAlg.ProblemsToMask=["deadReadout","deadCalib","deadPhys","almostDead",
159  "highNoiseHG","highNoiseMG","highNoiseLG"]
160  theRampValidationAlg.KeyList=[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  result.getService("IOVDbSvc").DBInstance=""
195 
196 
197  #ROOT ntuple writing:
198  rootfile=flags.LArCalib.Output.ROOTFile
199 
200  ntupKey = digKey
201  if flags.LArCalib.isSC:
202  ntupKey = "HIGH" # Modification to avoid problems in LArRampBuilder
203  if rootfile != "":
204  result.addEventAlgo(CompFactory.LArRamps2Ntuple( ContainerKey = ["LArRamp"+ntupKey], #for RawRamp
205  AddFEBTempInfo = False,
206  RealGeometry = True,
207  OffId = True,
208  AddCalib = True,
209  RawRamp = True,
210  SaveAllSamples = True,
211  BadChanKey = bcKey,
212  ApplyCorr=True,
213  isSC = flags.LArCalib.isSC
214  ))
215 
216  import os
217  if os.path.exists(rootfile):
218  os.remove(rootfile)
219  result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
220  result.setAppProperty("HistogramPersistency","ROOT")
221  pass # end if ROOT ntuple writing
222 
223 
224  from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
225  result.merge(PerfMonMTSvcCfg(flags))
226 
227  return result
228 
229 

Variable Documentation

◆ AtlasVersion

python.LArCalib_RampConfig.AtlasVersion

Definition at line 249 of file LArCalib_RampConfig.py.

◆ cfg

python.LArCalib_RampConfig.cfg = MainServicesCfg(ConfigFlags)

Definition at line 258 of file LArCalib_RampConfig.py.

◆ ConfigFlags

python.LArCalib_RampConfig.ConfigFlags = initConfigFlags()

Definition at line 235 of file LArCalib_RampConfig.py.

◆ Database

python.LArCalib_RampConfig.Database

Definition at line 243 of file LArCalib_RampConfig.py.

◆ DBConnection

python.LArCalib_RampConfig.DBConnection

Definition at line 247 of file LArCalib_RampConfig.py.

◆ Dir

python.LArCalib_RampConfig.Dir

Definition at line 238 of file LArCalib_RampConfig.py.

◆ Files

python.LArCalib_RampConfig.Files

Definition at line 242 of file LArCalib_RampConfig.py.

◆ GlobalTag

python.LArCalib_RampConfig.GlobalTag

Definition at line 248 of file LArCalib_RampConfig.py.

◆ POOLFile

python.LArCalib_RampConfig.POOLFile

Definition at line 244 of file LArCalib_RampConfig.py.

◆ ROOTFile

python.LArCalib_RampConfig.ROOTFile

Definition at line 245 of file LArCalib_RampConfig.py.

◆ RunNumbers

python.LArCalib_RampConfig.RunNumbers

Definition at line 240 of file LArCalib_RampConfig.py.

◆ SubDet

python.LArCalib_RampConfig.SubDet

Definition at line 241 of file LArCalib_RampConfig.py.

◆ Type

python.LArCalib_RampConfig.Type

Definition at line 239 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
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
LArCablingConfig.LArCalibIdMappingCfg
def LArCalibIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:83