|
def | __init__ (self) |
|
def | setBeginRun (self, beginRun) |
|
def | setEndRun (self, endRun) |
|
def | addSimParam (self, name, value) |
|
def | addDigitParam (self, name, value) |
|
def | addDigitParam64 (self, name, value) |
|
def | genSimDb (self, dbFileName=None) |
|
def | genDigitDb (self, dbFileName=None) |
|
def | genDb (self, dbFileName, dbName, params, folderPath, params64={}) |
|
def | dumpDb (self, dbstring) |
|
A simple class used to fill SQLite db file with parameters for simulation
and/or digitization.
Definition at line 26 of file ParameterDbFiller.py.
◆ __init__()
def python.ParameterDbFiller.ParameterDbFiller.__init__ |
( |
|
self | ) |
|
Definition at line 32 of file ParameterDbFiller.py.
37 self.simParams = collections.OrderedDict()
38 self.digitParams = collections.OrderedDict()
39 self.digitParams64 = collections.OrderedDict()
◆ addDigitParam()
def python.ParameterDbFiller.ParameterDbFiller.addDigitParam |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| |
Definition at line 55 of file ParameterDbFiller.py.
55 def addDigitParam(self, name, value):
56 self.digitParams[name] = value
◆ addDigitParam64()
def python.ParameterDbFiller.ParameterDbFiller.addDigitParam64 |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| |
Definition at line 59 of file ParameterDbFiller.py.
59 def addDigitParam64(self, name, value):
60 self.digitParams64[name] = value
◆ addSimParam()
def python.ParameterDbFiller.ParameterDbFiller.addSimParam |
( |
|
self, |
|
|
|
name, |
|
|
|
value |
|
) |
| |
Definition at line 51 of file ParameterDbFiller.py.
51 def addSimParam(self, name, value):
52 self.simParams[name] = value
◆ dumpDb()
def python.ParameterDbFiller.ParameterDbFiller.dumpDb |
( |
|
self, |
|
|
|
dbstring |
|
) |
| |
Definition at line 150 of file ParameterDbFiller.py.
150 def dumpDb(self, dbstring):
152 print (
"ParameterDbFiller.dumpDb: Dumping database:", dbstring)
154 dbSvc = cool.DatabaseSvcFactory.databaseService()
157 db = dbSvc.openDatabase(dbstring,
False)
158 except Exception
as e:
159 print (
'ParameterDbFiller.dumpDb: Problem opening database',e)
163 folders = db.listAllNodes()
166 if (
not db.existsFolder(ff)):
170 print (
"ParameterDbFiller.dumpDb: Dumping folder " +
str(ff))
182 nobjs = f.countObjects( cool.ValidityKeyMin,
184 cool.ChannelSelection.all())
186 print (
"ParameterDbFiller.dumpDb: number of IOV payloads", nobjs)
188 objs = f.browseObjects( cool.ValidityKeyMin,
190 cool.ChannelSelection.all())
192 while objs.goToNext():
193 obj = objs.currentRef()
194 print (
"ParameterDbFiller.dumpDb: Payload", i, end=
'')
195 print (
"since [r,l]: [", obj.since() >> 32,
',',obj.since()%0x100000000,
']', end=
'')
196 print (
"until [r,l]: [", obj.until() >> 32,
',',obj.until()%0x100000000,
']', end=
'')
197 print (
"payload", obj.payload(), end=
'')
198 print (
"chan",obj.channelId() )
◆ genDb()
def python.ParameterDbFiller.ParameterDbFiller.genDb |
( |
|
self, |
|
|
|
dbFileName, |
|
|
|
dbName, |
|
|
|
params, |
|
|
|
folderPath, |
|
|
|
params64 = {} |
|
) |
| |
Definition at line 83 of file ParameterDbFiller.py.
83 def genDb(self, dbFileName, dbName, params, folderPath, params64 = {}):
86 if self.beginRun
is None:
87 raise ParameterDbFillerError (
'Must set begin run number before generating db')
88 if self.endRun
is None:
89 raise ParameterDbFillerError (
'Must set end run number before generating db')
91 raise ParameterDbFillerError (
'No parameters for db ' + dbName)
96 print (
"ParameterDbFiller.genDb: Removed db", dbFileName)
101 dbSvc=cool.DatabaseSvcFactory.databaseService()
104 dbstring=
"sqlite://;schema=" + dbFileName +
";dbname=" + dbName
106 db=dbSvc.createDatabase(dbstring)
107 except Exception
as e:
108 print (
'ParameterDbFiller.genDb: Problem creating database',e)
110 print (
"ParameterDbFiller.genDb: Created database",dbstring)
113 spec=cool.RecordSpecification()
115 spec.extend(key, cool.StorageType.String4k)
119 spec.extend(key, cool.StorageType.String64k)
122 desc =
'<timeStamp>run-event</timeStamp><addrHeader><address_header service_type="71" clid="40774348" /></addrHeader><typeName>AthenaAttributeList</typeName>'
128 folderSpec = cool.FolderSpecification(cool.FolderVersioning.SINGLE_VERSION, spec)
129 myfolder = db.createFolder(folderPath, folderSpec, desc,
True)
132 data = cool.Record(spec)
133 for k, v
in six.iteritems(params):
135 for k, v
in six.iteritems(params64):
138 print (
"ParameterDbFiller.genDb: Recording parameters", data)
141 myfolder.storeObject(self.beginRun, self.endRun, data, 0)
142 print (
"ParameterDbFiller.genDb: Stored object")
148 self.dumpDb(dbstring)
◆ genDigitDb()
def python.ParameterDbFiller.ParameterDbFiller.genDigitDb |
( |
|
self, |
|
|
|
dbFileName = None |
|
) |
| |
Definition at line 73 of file ParameterDbFiller.py.
73 def genDigitDb(self, dbFileName = None):
75 if dbFileName
is None:
77 dbFileName =
"DigitParams.db"
80 self.genDb(dbFileName,
'DIGPARAM', self.digitParams,
'/Digitization/Parameters', self.digitParams64)
◆ genSimDb()
def python.ParameterDbFiller.ParameterDbFiller.genSimDb |
( |
|
self, |
|
|
|
dbFileName = None |
|
) |
| |
Definition at line 63 of file ParameterDbFiller.py.
63 def genSimDb(self, dbFileName = None):
65 if dbFileName
is None:
67 dbFileName =
"SimParams.db"
70 self.genDb(dbFileName,
'SIMPARAM', self.simParams,
'/Simulation/Parameters')
◆ setBeginRun()
def python.ParameterDbFiller.ParameterDbFiller.setBeginRun |
( |
|
self, |
|
|
|
beginRun |
|
) |
| |
Definition at line 43 of file ParameterDbFiller.py.
43 def setBeginRun(self, beginRun):
44 self.beginRun = beginRun << 32
◆ setEndRun()
def python.ParameterDbFiller.ParameterDbFiller.setEndRun |
( |
|
self, |
|
|
|
endRun |
|
) |
| |
Definition at line 47 of file ParameterDbFiller.py.
47 def setEndRun(self, endRun):
48 self.endRun = endRun << 32
◆ beginRun
python.ParameterDbFiller.ParameterDbFiller.beginRun |
◆ digitParams
python.ParameterDbFiller.ParameterDbFiller.digitParams |
◆ digitParams64
python.ParameterDbFiller.ParameterDbFiller.digitParams64 |
◆ endRun
python.ParameterDbFiller.ParameterDbFiller.endRun |
◆ simParams
python.ParameterDbFiller.ParameterDbFiller.simParams |
The documentation for this class was generated from the following file: