4 from PyCool
import cool
7 onlineOFCFolder=
"/LAR/ElecCalibFlat/OFC"
9 offlineOFCFolders=[
"/LAR/ElecCalibOfl/OFC/PhysWave/RTM/5samples1phase",
"/LAR/ElecCalibOfl/OFC/PhysWave/RTM/4samples1phase"]
12 dbSvc = cool.DatabaseSvcFactory.databaseService()
14 db= dbSvc.openDatabase(
"COOLONL_LAR/CONDBR2")
15 except Exception
as e:
16 print (
"ERROR: Problems connecting to database:",e)
19 if db.existsFolder(onlineOFCFolder):
21 pFldr=db.getFolder(onlineOFCFolder)
22 currObj=pFldr.findObject(cool.ValidityKeyMax-1,0)
24 curr_nsamples=pl[
"nSamples"]
25 except Exception
as e:
26 print (
"Failed to extract data from online OFC folder")
31 print (
"ERROR: Folder",onlineOFCFolder,
"doesn't exist!")
39 db=dbSvc.openDatabase(
"COOLOFL_LAR/CONDBR2")
43 for offlineOFCFolder
in offlineOFCFolders:
44 if db.existsFolder(offlineOFCFolder):
46 pFldr=db.getFolder(offlineOFCFolder)
47 ofctaglist=pFldr.listTags()
48 except Exception
as e:
49 print (
"Failed to extract data from offline database")
54 if t.find(
"UPD3")!=-1:
55 OFCOptions+=[(offlineOFCFolder,t),]
57 if curr_nsamples
is not None:
58 if offlineOFCFolder.endswith(
"%isamples1phase" % curr_nsamples):
60 currentOFCOption=(offlineOFCFolder,pFldr.resolveTag(
"LARCALIB-RUN2-00"))
62 print (
"Could not resolve global tag in folder ",offlineOFCFolder)
68 print (
"Folder",offlineOFCFolder,
"does not exist")
73 print (
"Current number of samples:", curr_nsamples)
75 print (
"OFC flavor for production [%s]: " % currentOFCOption[1])
77 if "mu" in currentOFCOption[1]:
86 if __name__==
"__main__":
89 if ofcForOnline
is None:
90 print (
"Failed to get OFC/Shapes for online database")
93 print (
"Mu: ",ofcForOnline)