ATLAS Offline Software
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="/afs/cern.ch/user/p/pavol/w0/public/DB_update_22/fillDB/SCOFCPhase.db", SCOFCPhaseTag="LARElecCalibOflSCOFCBinPhysShift-07", 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  # FIXME: this should be taken from the COOL
55  print("InputSCOFCPhaseDb: ",InputSCOFCPhaseDb)
56  result.merge(addFolders(flags,"/LAR/ElecCalibOflSC/OFCBin/PhysShift",detDb=InputSCOFCPhaseDb,tag=SCOFCPhaseTag,
57  modifiers="<key>LArSCOFCPhase</key>"))
58  if InputSCOFCWeightDb != "" and SCOFCWeightTag != "": # set up the weights for OFCPicker
59  result.merge(addFolders(flags,"/LAR/ElecCalibOflSC/OFCFactor",detDb=InputSCOFCWeightDb,tag=SCOFCWeightTag,className="CondAttrListCollection"))
60  LArOFCWeightCondAlg=CompFactory.getComp("LArFlatConditionsAlg<LArOFCweightSC>")
61  result.addCondAlgo(LArOFCWeightCondAlg(ReadKey="/LAR/ElecCalibOflSC/OFCFactor", WriteKey="LArOFCbWSC"))
62  LArOFPhasePick.OFCbWeightKey="LArOFCbWSC"
63 
64  else:
65  LArOFPhasePick.KeyPhase = ""
66 
67  if nColl > 0:
68  muSuffix="_mu"
69  else:
70  muSuffix=""
71 
72  LArOFPhasePick.KeyOFC_new = "LArOFC"+muSuffix
73  LArOFPhasePick.KeyOFC = "LArOFC"+keySuffix
74  if storeShape:
75  LArOFPhasePick.KeyShape_new = "LArShape"+"_uncorr" if flags.LArCalib.OFC.ShapeCorrection else "LArShape"
76  LArOFPhasePick.KeyShape = "LArShape"+keySuffix
77  else:
78  LArOFPhasePick.doShape = False
79  LArOFPhasePick.GroupingType = flags.LArCalib.GroupingType
80  LArOFPhasePick.DefaultPhase = 4
81  LArOFPhasePick.TimeOffsetCorrection = 12
82  LArOFPhasePick.isSC = flags.LArCalib.isSC
83  from AthenaCommon.Constants import DEBUG
84  LArOFPhasePick.OutputLevel=DEBUG
85 
86  result.addEventAlgo(LArOFPhasePick)
87 
88  if flags.LArCalib.OFC.ShapeCorrection and storeShape:
89  result.merge(addFolders(flags,"/LAR/ElecCalibOfl/Shape/Residuals/5samples","LAR_OFL"))
90  resShapeCorr=CompFactory.LArShapeCorrector("LArShapeCorr"+keySuffix)
91  resShapeCorr.KeyShape= "LArShape_uncorr"
92  resShapeCorr.KeyShape_newcorr="LArShape"
93  result.addEventAlgo(resShapeCorr)
94 
95  from RegistrationServices.OutputConditionsAlgConfig import OutputConditionsAlgCfg
96  Obj=["LArOFCComplete#LArOFC"+muSuffix+"#"+flags.LArCalib.OFCPhys.Folder+outputSuffix,]
97  Tag=[outputOFCTag,]
98  if storeShape:
99  Obj+=["LArShapeComplete#LArShape#"+flags.LArCalib.Shape.Folder+outputSuffix,]
100  Tag+=[outputShapeTag,]
101  print('Obj: ',Obj)
102  result.merge(OutputConditionsAlgCfg(flags,
103  outputFile=flags.LArCalib.Output.POOLFile,
104  ObjectList=Obj,
105  IOVTagList=Tag,
106  Run1=flags.LArCalib.IOVStart,
107  Run2=flags.LArCalib.IOVEnd
108  ))
109 
110 
111  rootfile=flags.LArCalib.Output.ROOTFile
112  if rootfile != "":
113  bcKey = "LArBadChannelSC" if flags.LArCalib.isSC else "LArBadChannel"
114  OFC2Ntup=CompFactory.LArOFC2Ntuple("LArOFC2Ntuple"+muSuffix)
115  OFC2Ntup.ContainerKey = "LArOFC"+muSuffix
116  OFC2Ntup.NtupleName = "OFC"+muSuffix
117  OFC2Ntup.AddFEBTempInfo = False
118  OFC2Ntup.AddCalib = True
119  OFC2Ntup.isSC = flags.LArCalib.isSC
120  OFC2Ntup.BadChanKey = bcKey
121  result.addEventAlgo(OFC2Ntup)
122 
123  Shape2Ntup=CompFactory.LArShape2Ntuple("LArShape2Ntuple")
124  Shape2Ntup.ContainerKey="LArShape"
125  Shape2Ntup.NtupleName="SHAPE"
126  Shape2Ntup.AddFEBTempInfo = False
127  Shape2Ntup.AddCalib = True
128  Shape2Ntup.isSC = flags.LArCalib.isSC
129  Shape2Ntup.BadChanKey = bcKey
130  result.addEventAlgo(Shape2Ntup)
131 
132 
133  return result
134 

◆ LArCaliOFPhasePickerCfg()

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

Definition at line 181 of file LArCalib_OFPhasePickerConfig.py.

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

◆ LArOFPhasePickerCfg()

def python.LArCalib_OFPhasePickerConfig.LArOFPhasePickerCfg (   flags,
  loadInputs = True,
  InputSCOFCPhaseDb = "/afs/cern.ch/user/p/pavol/w0/public/DB_update_22/fillDB/SCOFCPhase.db",
  SCOFCPhaseTag = "LARElecCalibOflSCOFCBinPhysShift-07",
  InputSCOFCWeightDb = "",
  SCOFCWeightTag = "" 
)

Definition at line 135 of file LArCalib_OFPhasePickerConfig.py.

135 def LArOFPhasePickerCfg(flags,loadInputs=True,InputSCOFCPhaseDb = "/afs/cern.ch/user/p/pavol/w0/public/DB_update_22/fillDB/SCOFCPhase.db",SCOFCPhaseTag="LARElecCalibOflSCOFCBinPhysShift-07",InputSCOFCWeightDb="",SCOFCWeightTag=""):
136 
137  #Get basic services and cond-algos
138  from LArCalibProcessing.LArCalibBaseConfig import LArCalibBaseCfg
139  result=LArCalibBaseCfg(flags)
140 
141  if flags.LArCalib.isSC:
142  result.merge(_OFPhasePickerCfg(flags, inputSuffix="4samples",outputSuffix="4samples1phase",keySuffix="_1ns", nColl=0, loadInputs=loadInputs,InputSCOFCPhaseDb=InputSCOFCPhaseDb,SCOFCPhaseTag=SCOFCPhaseTag,InputSCOFCWeightDb=InputSCOFCWeightDb,SCOFCWeightTag=SCOFCWeightTag))
143  if flags.LArCalib.OFC.Ncoll > 0:
144  result.merge(_OFPhasePickerCfg(flags, inputSuffix="4samples",outputSuffix="4samples1phase",keySuffix="_1ns_mu", nColl=flags.LArCalib.OFC.Ncoll, loadInputs=loadInputs, storeShape=False,InputSCOFCPhaseDb=InputSCOFCPhaseDb,SCOFCPhaseTag=SCOFCPhaseTag,InputSCOFCWeightDb=InputSCOFCWeightDb,SCOFCWeightTag=SCOFCWeightTag))
145  else:
146  result.merge(_OFPhasePickerCfg(flags, inputSuffix="4samples3bins17phases",outputSuffix="4samples1phase",keySuffix="_3ns", nColl=0, loadInputs=loadInputs))
147  if flags.LArCalib.OFC.Ncoll > 0:
148  result.merge(_OFPhasePickerCfg(flags, inputSuffix="4samples3bins17phases",outputSuffix="4samples1phase",keySuffix="_3ns_mu", nColl=flags.LArCalib.OFC.Ncoll, loadInputs=loadInputs, storeShape=False))
149 
150  #RegistrationSvc
151  result.addService(CompFactory.IOVRegistrationSvc(RecreateFolders = False))
152  result.getService("IOVDbSvc").DBInstance=""
153 
154  #Ntuple writing
155  rootfile=flags.LArCalib.Output.ROOTFile
156  if rootfile != "":
157  import os
158  if os.path.exists(rootfile):
159  os.remove(rootfile)
160  result.addService(CompFactory.NTupleSvc(Output = [ "FILE1 DATAFILE='"+rootfile+"' OPT='NEW'" ]))
161  result.setAppProperty("HistogramPersistency","ROOT")
162  pass # end if ROOT ntuple writing
163 
164 
165  #MC Event selector since we have no input data file
166  from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
167  result.merge(McEventSelectorCfg(flags,
168  RunNumber = flags.LArCalib.Input.RunNumbers[0],
169  EventsPerRun = 1,
170  FirstEvent = 1,
171  InitialTimeStamp = 0,
172  TimeStampInterval = 1))
173 
174  from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
175  result.merge(PerfMonMTSvcCfg(flags))
176 
177 
178 
179  return result
180 
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
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
OutputConditionsAlgConfig.OutputConditionsAlgCfg
def OutputConditionsAlgCfg(flags, name="OutputConditionsAlg", outputFile='condobjs.root', **kwargs)
Definition: OutputConditionsAlgConfig.py:5
python.LArCalib_OFPhasePickerConfig.LArOFPhasePickerCfg
def LArOFPhasePickerCfg(flags, loadInputs=True, InputSCOFCPhaseDb="/afs/cern.ch/user/p/pavol/w0/public/DB_update_22/fillDB/SCOFCPhase.db", SCOFCPhaseTag="LARElecCalibOflSCOFCBinPhysShift-07", InputSCOFCWeightDb="", SCOFCWeightTag="")
Definition: LArCalib_OFPhasePickerConfig.py:135
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:72
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:181
python.LArCalibBaseConfig.LArCalibBaseCfg
def LArCalibBaseCfg(flags)
Definition: LArCalibBaseConfig.py:5