Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
python.LArCalib_OFPhasePickerConfig Namespace Reference

Functions

def _OFPhasePickerCfg (flags, inputSuffix="4samples3bins17phases", outputSuffix="4samples1phase", keySuffix="", nColl=0, loadInputs=True, storeShape=True, InputSCOFCPhaseDb="", SCOFCPhaseTag="", InputSCOFCWeightDb="", SCOFCWeightTag="")
 
def LArOFPhasePickerCfg (flags, loadInputs=True, InputSCOFCPhaseDb="", SCOFCPhaseTag="", InputSCOFCWeightDb="", SCOFCWeightTag="")
 
def LArCaliOFPhasePickerCfg (flags, loadInputs=True, DefaultPhase=23)
 

Function Documentation

◆ _OFPhasePickerCfg()

def python.LArCalib_OFPhasePickerConfig._OFPhasePickerCfg (   flags,
  inputSuffix = "4samples3bins17phases",
  outputSuffix = "4samples1phase",
  keySuffix = "",
  nColl = 0,
  loadInputs = True,
  storeShape = True,
  InputSCOFCPhaseDb = "",
  SCOFCPhaseTag = "",
  InputSCOFCWeightDb = "",
  SCOFCWeightTag = "" 
)
private

Definition at line 8 of file LArCalib_OFPhasePickerConfig.py.

8 def _OFPhasePickerCfg(flags, inputSuffix="4samples3bins17phases",outputSuffix="4samples1phase",keySuffix="",nColl=0,loadInputs=True, storeShape=True, InputSCOFCPhaseDb = "", SCOFCPhaseTag = "", InputSCOFCWeightDb="", SCOFCWeightTag=""):
9 
10  result=ComponentAccumulator()
11  FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
12  if flags.LArCalib.isSC:
13  FolderTagResolver._defaultSuffix="-UPD3-00"
14  rs=FolderTagResolver(dbname="sqlite://;schema=%s;dbname=CONDBR2"%flags.LArCalib.Input.Database)
15  if nColl > 0:
16  tagstr=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+inputSuffix)
17  tagpref=tagstr[0:tagstr.find(inputSuffix)+len(inputSuffix)]
18  tagpost=tagstr[tagstr.find(inputSuffix)+len(inputSuffix):]
19  nc=int(nColl)
20  if 'mu' not in tagstr:
21  inputOFCTag=f'{tagpref}-mu-{nc}{tagpost}'
22  else:
23  inputOFCTag=tagstr
24  tagstr=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+outputSuffix)
25  tagpref=tagstr[0:tagstr.find(outputSuffix)+len(outputSuffix)]
26  tagpost=tagstr[tagstr.find(outputSuffix)+len(outputSuffix):]
27  outputOFCTag=f'{tagpref}-mu-{nc}{tagpost}'
28  else:
29  inputOFCTag=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+inputSuffix)
30  outputOFCTag=rs.getFolderTag(flags.LArCalib.OFCPhys.Folder+outputSuffix)
31 
32  inputShapeTag=rs.getFolderTag(flags.LArCalib.Shape.Folder+inputSuffix)
33  if flags.LArCalib.OFC.ShapeCorrection:
34  tagstr=rs.getFolderTag(flags.LArCalib.Shape.Folder+outputSuffix)
35  tagpref=tagstr[0:tagstr.find(outputSuffix)+len(outputSuffix)]
36  tagpost=tagstr[tagstr.find(outputSuffix)+len(outputSuffix):]
37  outputShapeTag=f'{tagpref}-corr{tagpost}'
38  else:
39  outputShapeTag=rs.getFolderTag(flags.LArCalib.Shape.Folder+outputSuffix)
40 
41 
42  del rs #Close database
43 
44  from LArCalibProcessing.LArCalibBaseConfig import chanSelStr
45  if loadInputs:
46  result.merge(addFolders(flags,flags.LArCalib.OFCPhys.Folder+inputSuffix,detDb=flags.LArCalib.Input.Database,
47  tag=inputOFCTag, modifiers=chanSelStr(flags)+"<key>LArOFC"+keySuffix+"</key>"))
48  result.merge(addFolders(flags,flags.LArCalib.Shape.Folder+inputSuffix,detDb=flags.LArCalib.Input.Database,
49  tag=inputShapeTag, modifiers=chanSelStr(flags)+"<key>LArShape"+keySuffix+"</key>"))
50 
51  LArOFPhasePick = CompFactory.LArOFPhasePicker("LArOFPhasePicker"+keySuffix)
52  if flags.LArCalib.isSC:
53  LArOFPhasePick.KeyPhase = "LArSCOFCPhase"
54 
55  if InputSCOFCPhaseDb != "" and SCOFCPhaseTag != "": #set up reading of phases from sqlite
56  result.merge(addFolders(flags,"/LAR/ElecCalibOflSC/OFCBin/PhysShift",detDb=InputSCOFCPhaseDb,tag=SCOFCPhaseTag,
57  modifiers="<key>LArSCOFCPhase</key>"))
58  else:
59  result.merge(addFolders(flags,"/LAR/ElecCalibOflSC/OFCBin/PhysShift", detDb="LAR_OFL",modifiers="<key>LArSCOFCPhase</key>"))
60 
61  if InputSCOFCWeightDb != "" and SCOFCWeightTag != "": # set up the weights for OFCPicker
62  result.merge(addFolders(flags,"/LAR/ElecCalibOflSC/OFCFactor",detDb=InputSCOFCWeightDb,tag=SCOFCWeightTag,className="CondAttrListCollection"))
63  LArOFCWeightCondAlg=CompFactory.getComp("LArFlatConditionsAlg<LArOFCweightSC>")
64  result.addCondAlgo(LArOFCWeightCondAlg(ReadKey="/LAR/ElecCalibOflSC/OFCFactor", WriteKey="LArOFCbWSC"))
65  LArOFPhasePick.OFCbWeightKey="LArOFCbWSC"
66 
67  else:
68  LArOFPhasePick.KeyPhase = ""
69 
70  if nColl > 0:
71  muSuffix="_mu"
72  else:
73  muSuffix=""
74 
75  LArOFPhasePick.KeyOFC_new = "LArOFC"+muSuffix
76  LArOFPhasePick.KeyOFC = "LArOFC"+keySuffix
77  if storeShape:
78  LArOFPhasePick.KeyShape_new = "LArShape"+"_uncorr" if flags.LArCalib.OFC.ShapeCorrection else "LArShape"
79  LArOFPhasePick.KeyShape = "LArShape"+keySuffix
80  else:
81  LArOFPhasePick.doShape = False
82  LArOFPhasePick.GroupingType = flags.LArCalib.GroupingType
83  LArOFPhasePick.DefaultPhase = 4
84  LArOFPhasePick.TimeOffsetCorrection = 12
85  LArOFPhasePick.isSC = flags.LArCalib.isSC
86  from AthenaCommon.Constants import DEBUG
87  LArOFPhasePick.OutputLevel=DEBUG
88 
89  result.addEventAlgo(LArOFPhasePick)
90 
91  if flags.LArCalib.OFC.ShapeCorrection and storeShape:
92  result.merge(addFolders(flags,"/LAR/ElecCalibOfl/Shape/Residuals/5samples","LAR_OFL"))
93  resShapeCorr=CompFactory.LArShapeCorrector("LArShapeCorr"+keySuffix)
94  resShapeCorr.KeyShape= "LArShape_uncorr"
95  resShapeCorr.KeyShape_newcorr="LArShape"
96  result.addEventAlgo(resShapeCorr)
97 
98  from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
99  Obj=["LArOFCComplete#LArOFC"+muSuffix+"#"+flags.LArCalib.OFCPhys.Folder+outputSuffix,]
100  Tag=[outputOFCTag,]
101  if storeShape:
102  Obj+=["LArShapeComplete#LArShape#"+flags.LArCalib.Shape.Folder+outputSuffix,]
103  Tag+=[outputShapeTag,]
104  print('Obj: ',Obj)
105  result.merge(OutputConditionsAlgCfg(flags,
106  outputFile=flags.LArCalib.Output.POOLFile,
107  ObjectList=Obj,
108  IOVTagList=Tag,
109  Run1=flags.LArCalib.IOVStart,
110  Run2=flags.LArCalib.IOVEnd
111  ))
112 
113 
114  rootfile=flags.LArCalib.Output.ROOTFile
115  if rootfile != "":
116  bcKey = "LArBadChannelSC" if flags.LArCalib.isSC else "LArBadChannel"
117  OFC2Ntup=CompFactory.LArOFC2Ntuple("LArOFC2Ntuple"+muSuffix)
118  OFC2Ntup.ContainerKey = "LArOFC"+muSuffix
119  OFC2Ntup.NtupleName = "OFC"+muSuffix
120  OFC2Ntup.AddFEBTempInfo = False
121  OFC2Ntup.AddCalib = True
122  OFC2Ntup.isSC = flags.LArCalib.isSC
123  OFC2Ntup.BadChanKey = bcKey
124  result.addEventAlgo(OFC2Ntup)
125 
126  Shape2Ntup=CompFactory.LArShape2Ntuple("LArShape2Ntuple")
127  Shape2Ntup.ContainerKey="LArShape"
128  Shape2Ntup.NtupleName="SHAPE"
129  Shape2Ntup.AddFEBTempInfo = False
130  Shape2Ntup.AddCalib = True
131  Shape2Ntup.isSC = flags.LArCalib.isSC
132  Shape2Ntup.BadChanKey = bcKey
133  result.addEventAlgo(Shape2Ntup)
134 
135 
136  return result
137 

◆ LArCaliOFPhasePickerCfg()

def python.LArCalib_OFPhasePickerConfig.LArCaliOFPhasePickerCfg (   flags,
  loadInputs = True,
  DefaultPhase = 23 
)

Definition at line 184 of file LArCalib_OFPhasePickerConfig.py.

184 def LArCaliOFPhasePickerCfg(flags,loadInputs=True,DefaultPhase=23):
185 
186  #Get basic services and cond-algos
187  from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg
188  result=LArCalibBaseCfg(flags)
189 
190  FolderTagResolver._globalTag=flags.IOVDb.GlobalTag
191  if flags.LArCalib.isSC:
192  FolderTagResolver._defaultSuffix="-UPD3-00"
193  rs=FolderTagResolver(dbname="sqlite://;schema=%s;dbname=CONDBR2"%flags.LArCalib.Input.Database)
194  inputOFCTag=rs.getFolderTag(flags.LArCalib.OFCCali.Folder)
195  outputOFCTag=rs.getFolderTag(flags.LArCalib.OFCCali.Folder+"1phase")
196  del rs #Close database
197 
198  from LArCalibProcessing.LArCalibBaseConfig import chanSelStr
199  if loadInputs:
200  result.merge(addFolders(flags,flags.LArCalib.OFCCali.Folder,detDb=flags.LArCalib.Input.Database,
201  tag=inputOFCTag, modifiers=chanSelStr(flags)))
202 
203  LArOFPhasePick = CompFactory.LArOFPhasePicker("LArCaliOFPhasePicker")
204  LArOFPhasePick.KeyPhase = ""
205  LArOFPhasePick.KeyOFC_new = "LArOFC1phase"
206  LArOFPhasePick.KeyOFC = "LArOFCCali"
207  LArOFPhasePick.doShape = False
208  LArOFPhasePick.GroupingType = flags.LArCalib.GroupingType
209  LArOFPhasePick.DefaultPhase = DefaultPhase
210  LArOFPhasePick.isSC = flags.LArCalib.isSC
211  from AthenaCommon.Constants import DEBUG
212  LArOFPhasePick.OutputLevel=DEBUG
213 
214  result.addEventAlgo(LArOFPhasePick)
215 
216  from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
217  Obj=["LArOFCComplete#LArOFC1phase#"+flags.LArCalib.OFCCali.Folder+"1phase",]
218  Tag=[outputOFCTag,]
219  print('Obj: ',Obj)
220  result.merge(OutputConditionsAlgCfg(flags,
221  outputFile=flags.LArCalib.Output.POOLFile,
222  ObjectList=Obj,
223  IOVTagList=Tag,
224  Run1=flags.LArCalib.IOVStart,
225  Run2=flags.LArCalib.IOVEnd
226  ))
227 
228  rootfile=flags.LArCalib.Output.ROOTFile
229  if rootfile != "":
230  bcKey = "LArBadChannelSC" if flags.LArCalib.isSC else "LArBadChannel"
231  OFC2Ntup=CompFactory.LArOFC2Ntuple("LArCaliOFC2Ntuple")
232  OFC2Ntup.ContainerKey = "LArOFC1phase"
233  OFC2Ntup.NtupleName = "OFC1phase"
234  OFC2Ntup.AddFEBTempInfo = False
235  OFC2Ntup.AddCalib = True
236  OFC2Ntup.isSC = flags.LArCalib.isSC
237  OFC2Ntup.BadChanKey = bcKey
238  result.addEventAlgo(OFC2Ntup)
239  import os
240  if os.path.exists(rootfile):
241  print("Warning, removing existing file: ",rootfile)
242  os.remove(rootfile)
243  result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
244  result.setAppProperty("HistogramPersistency","ROOT")
245  pass # end if ROOT ntuple writing
246 
247 
248  #RegistrationSvc
249  result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
250  result.getService("IOVDbSvc").DBInstance=""
251 
252  #MC Event selector since we have no input data file
253  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
254  result.merge(McEventSelectorCfg(flags,
255  RunNumber = flags.LArCalib.Input.RunNumbers[0],
256  EventsPerRun = 1,
257  FirstEvent = 1,
258  InitialTimeStamp = 0,
259  TimeStampInterval = 1))
260 
261  from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
262  result.merge(PerfMonMTSvcCfg(flags))
263 
264 
265 
266  return result

◆ LArOFPhasePickerCfg()

def python.LArCalib_OFPhasePickerConfig.LArOFPhasePickerCfg (   flags,
  loadInputs = True,
  InputSCOFCPhaseDb = "",
  SCOFCPhaseTag = "",
  InputSCOFCWeightDb = "",
  SCOFCWeightTag = "" 
)

Definition at line 138 of file LArCalib_OFPhasePickerConfig.py.

138 def LArOFPhasePickerCfg(flags,loadInputs=True,InputSCOFCPhaseDb = "",SCOFCPhaseTag="",InputSCOFCWeightDb="",SCOFCWeightTag=""):
139 
140  #Get basic services and cond-algos
141  from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg
142  result=LArCalibBaseCfg(flags)
143 
144  if flags.LArCalib.isSC:
145  result.merge(_OFPhasePickerCfg(flags, inputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples",outputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples1phase",keySuffix="_1ns", nColl=0, loadInputs=loadInputs,InputSCOFCPhaseDb=InputSCOFCPhaseDb,SCOFCPhaseTag=SCOFCPhaseTag,InputSCOFCWeightDb=InputSCOFCWeightDb,SCOFCWeightTag=SCOFCWeightTag))
146  if flags.LArCalib.OFC.Ncoll > 0:
147  result.merge(_OFPhasePickerCfg(flags, inputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples",outputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples1phase",keySuffix="_1ns_mu", nColl=flags.LArCalib.OFC.Ncoll, loadInputs=loadInputs, storeShape=False,InputSCOFCPhaseDb=InputSCOFCPhaseDb,SCOFCPhaseTag=SCOFCPhaseTag,InputSCOFCWeightDb=InputSCOFCWeightDb,SCOFCWeightTag=SCOFCWeightTag))
148  else:
149  result.merge(_OFPhasePickerCfg(flags, inputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples3bins17phases",outputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples1phase",keySuffix="_3ns", nColl=0, loadInputs=loadInputs))
150  if flags.LArCalib.OFC.Ncoll > 0:
151  result.merge(_OFPhasePickerCfg(flags, inputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples3bins17phases",outputSuffix=str(flags.LArCalib.OFC.Nsamples)+"samples1phase",keySuffix="_3ns_mu", nColl=flags.LArCalib.OFC.Ncoll, loadInputs=loadInputs, storeShape=False))
152 
153  #RegistrationSvc
154  result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
155  result.getService("IOVDbSvc").DBInstance=""
156 
157  #Ntuple writing
158  rootfile=flags.LArCalib.Output.ROOTFile
159  if rootfile != "":
160  import os
161  if os.path.exists(rootfile):
162  os.remove(rootfile)
163  result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
164  result.setAppProperty("HistogramPersistency","ROOT")
165  pass # end if ROOT ntuple writing
166 
167 
168  #MC Event selector since we have no input data file
169  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
170  result.merge(McEventSelectorCfg(flags,
171  RunNumber = flags.LArCalib.Input.RunNumbers[0],
172  EventsPerRun = 1,
173  FirstEvent = 1,
174  InitialTimeStamp = 0,
175  TimeStampInterval = 1))
176 
177  from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
178  result.merge(PerfMonMTSvcCfg(flags))
179 
180 
181 
182  return result
183 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.LArCalib_OFPhasePickerConfig._OFPhasePickerCfg
def _OFPhasePickerCfg(flags, inputSuffix="4samples3bins17phases", outputSuffix="4samples1phase", keySuffix="", nColl=0, loadInputs=True, storeShape=True, InputSCOFCPhaseDb="", SCOFCPhaseTag="", InputSCOFCWeightDb="", SCOFCWeightTag="")
Definition: LArCalib_OFPhasePickerConfig.py:8
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
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
Constants
some useful constants -------------------------------------------------—
python.McEventSelectorConfig.McEventSelectorCfg
def McEventSelectorCfg(flags, **kwargs)
Definition: McEventSelectorConfig.py:5
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:81
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.LArCalib_OFPhasePickerConfig.LArCaliOFPhasePickerCfg
def LArCaliOFPhasePickerCfg(flags, loadInputs=True, DefaultPhase=23)
Definition: LArCalib_OFPhasePickerConfig.py:184
python.LArCalibBaseConfig.LArCalibBaseCfg
def LArCalibBaseCfg(flags)
Definition: LArCalibBaseConfig.py:5
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
python.LArCalib_OFPhasePickerConfig.LArOFPhasePickerCfg
def LArOFPhasePickerCfg(flags, loadInputs=True, InputSCOFCPhaseDb="", SCOFCPhaseTag="", InputSCOFCWeightDb="", SCOFCWeightTag="")
Definition: LArCalib_OFPhasePickerConfig.py:138
str
Definition: BTagTrackIpAccessor.cxx:11