A simple class used to fill SQLite db file with parameters for simulation
and/or digitization.
Definition at line 24 of file LArHVMapDbFiller.py.
◆ __init__()
def LArHVMapDbFiller.LArHVMapDbFiller.__init__ |
( |
|
self | ) |
|
◆ dumpDb()
def LArHVMapDbFiller.LArHVMapDbFiller.dumpDb |
( |
|
self, |
|
|
|
dbstring |
|
) |
| |
Definition at line 137 of file LArHVMapDbFiller.py.
137 def dumpDb(self, dbstring):
139 print (
"LArHVMapDbFiller.dumpDb: Dumping database:", dbstring)
141 dbSvc = cool.DatabaseSvcFactory.databaseService()
144 db = dbSvc.openDatabase(dbstring,
False)
145 except Exception
as e:
146 print (
'LArHVMapDbFiller.dumpDb: Problem opening database',e)
150 folders = db.listAllNodes()
155 print (
"LArHVMapDbFiller.dumpDb: Dumping folder " +
str(ff))
167 nobjs = f.countObjects( cool.ValidityKeyMin,
169 cool.ChannelSelection.all())
171 print (
"LArHVMapDbFiller.dumpDb: number of IOV payloads", nobjs)
173 objs = f.browseObjects( cool.ValidityKeyMin,
175 cool.ChannelSelection.all())
177 while objs.goToNext():
178 obj = objs.currentRef()
179 print (
"LArHVMapDbFiller.dumpDb: Payload", i,)
180 print (
"since [r,l]: [", obj.since() ,
']',)
181 print (
"until [r,l]: [", obj.until() ,
']',)
182 print (
"payload", obj.payload(),)
183 print (
"chan",obj.channelId() )
◆ genDb()
def LArHVMapDbFiller.LArHVMapDbFiller.genDb |
( |
|
self | ) |
|
Definition at line 69 of file LArHVMapDbFiller.py.
71 dbFileName =
'HVmap.db'
73 folderPath =
'/LAR/IdentifierOfl/HVLineToElectrodeMap'
75 if self.beginTime
is None:
76 raise LArHVMapDbFillerError (
'Must set begin run number before generating db')
77 if self.endTime
is None:
78 self.endTime = cool.ValidityKeyMax
79 if self.FileName
is None:
80 raise LArHVMapDbFillerError (
'Must give an input file for LArHVToElectrode.data')
81 if self.FolderTag
is None:
82 raise LArHVMapDbFillerError (
'Must give a folder tag')
86 if len(self.Params) == 0:
87 raise LArHVMapDbFillerError (
'No parameters for db ' + dbName)
92 print (
"LArHVMapDbFiller.genDb: Removed db", dbFileName)
97 dbSvc=cool.DatabaseSvcFactory.databaseService()
100 dbstring=
"sqlite://;schema=" + dbFileName +
";dbname=" + dbName
102 db=dbSvc.createDatabase(dbstring)
103 except Exception
as e:
104 print (
'LArHVMapDbFiller.genDb: Problem creating database',e)
106 print (
"LArHVMapDbFiller.genDb: Created database",dbstring)
109 spec=cool.RecordSpecification()
110 for key
in self.Params:
111 spec.extend(key, cool.StorageType.String16M)
114 desc=
'<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type="71" clid="40774348" /></addrHeader><typeName>AthenaAttributeList</typeName>'
119 myfolder=db.createFolder(folderPath, spec, desc, cool.FolderVersioning.MULTI_VERSION,
True)
121 data=cool.Record(spec)
122 for k, v
in six.iteritems (self.Params):
125 print (
"LArHVMapDbFiller.genDb: Recording parameters", data)
128 myfolder.storeObject(self.beginTime, self.endTime, data, 0, self.FolderTag)
129 print (
"LArHVMapDbFiller.genDb: Stored object")
135 self.dumpDb(dbstring)
◆ readFile()
def LArHVMapDbFiller.LArHVMapDbFiller.readFile |
( |
|
self | ) |
|
◆ setBegin()
def LArHVMapDbFiller.LArHVMapDbFiller.setBegin |
( |
|
self, |
|
|
|
run, |
|
|
|
lumi |
|
) |
| |
Definition at line 41 of file LArHVMapDbFiller.py.
41 def setBegin(self,run,lumi):
42 print (
" setBegin run,lumi ",run)
43 self.beginTime = (
int(run) << 32) +
int(lumi)
44 print (
" time ",self.beginTime)
◆ setEnd()
def LArHVMapDbFiller.LArHVMapDbFiller.setEnd |
( |
|
self, |
|
|
|
run, |
|
|
|
lumi |
|
) |
| |
Definition at line 47 of file LArHVMapDbFiller.py.
47 def setEnd(self,run,lumi):
48 print (
"setEnd runmlumi ",run)
49 self.endTime = (
int(run) << 32) +
int(lumi)
50 print (
" time ",self.endTime)
◆ setFileName()
def LArHVMapDbFiller.LArHVMapDbFiller.setFileName |
( |
|
self, |
|
|
|
fileName |
|
) |
| |
Definition at line 53 of file LArHVMapDbFiller.py.
53 def setFileName(self, fileName):
54 self.FileName = fileName
◆ setFolderTag()
def LArHVMapDbFiller.LArHVMapDbFiller.setFolderTag |
( |
|
self, |
|
|
|
folderTag |
|
) |
| |
Definition at line 57 of file LArHVMapDbFiller.py.
57 def setFolderTag(self,folderTag):
58 self.FolderTag = folderTag
◆ beginTime
LArHVMapDbFiller.LArHVMapDbFiller.beginTime |
◆ endTime
LArHVMapDbFiller.LArHVMapDbFiller.endTime |
◆ FileName
LArHVMapDbFiller.LArHVMapDbFiller.FileName |
◆ FolderTag
LArHVMapDbFiller.LArHVMapDbFiller.FolderTag |
◆ Params
LArHVMapDbFiller.LArHVMapDbFiller.Params |
The documentation for this class was generated from the following file: