|
def | __init__ (self, db, folderPath, calibDrawerType, isMultiVersionFolder=True) |
|
def | register (self, since=(MINRUN, MINLBK), tag="") |
|
def | setComment (self, author, comment=None) |
|
def | getComment (self, split=False) |
|
def | getDrawer (self, ros, drawer, calibDrawerTemplate=None) |
|
def | zeroBlob (self, ros, drawer) |
|
TileBlobWriterCrest is a helper class, managing the details of
CREST interactions for the user of TileCalibBlobs.
Definition at line 365 of file TileCalibCrest.py.
◆ __init__()
def python.TileCalibCrest.TileBlobWriterCrest.__init__ |
( |
|
self, |
|
|
|
db, |
|
|
|
folderPath, |
|
|
|
calibDrawerType, |
|
|
|
isMultiVersionFolder = True |
|
) |
| |
Input:
- db : db should be a database connection
- folderPath: full folder path to create or update
Definition at line 372 of file TileCalibCrest.py.
372 def __init__(self, db, folderPath, calibDrawerType, isMultiVersionFolder=True):
375 - db : db should be a database connection
376 - folderPath: full folder path to create or update
380 TileCalibLogger.__init__(self,
"TileBlobWriter")
384 self.__folderPath = folderPath
387 self.__calibDrawerType = calibDrawerType
388 if calibDrawerType
in [
'TileCalibDrawerFlt',
'Flt']:
389 self.__TileCalibDrawer = TileCalibDrawerFlt
390 self.__defVec = cppyy.gbl.std.vector(
'std::vector<float>')()
391 elif calibDrawerType
in [
'TileCalibDrawerBch',
'Bch']:
392 self.__TileCalibDrawer = TileCalibDrawerBch
393 self.__defVec = cppyy.gbl.std.vector(
'std::vector<unsigned int>')()
394 elif calibDrawerType
in [
'TileCalibDrawerInt',
'Int']:
395 self.__TileCalibDrawer = TileCalibDrawerInt
396 self.__defVec = cppyy.gbl.std.vector(
'std::vector<unsigned int>')()
398 raise Exception(
"Unknown calibDrawerType: %s" % calibDrawerType)
◆ getComment()
def python.TileCalibCrest.TileBlobWriterCrest.getComment |
( |
|
self, |
|
|
|
split = False |
|
) |
| |
Returns the general comment (default if none is set)
Definition at line 458 of file TileCalibCrest.py.
458 def getComment(self, split=False):
460 Returns the general comment (default if none is set)
463 comment = self.__drawer.
get(drawerIdx,
None)
466 return (comment.getAuthor(), self.__comment.getComment(), self.__comment.getDate())
468 return comment.getFullComment()
470 return "<No general comment!>"
◆ getDrawer()
def python.TileCalibCrest.TileBlobWriterCrest.getDrawer |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer, |
|
|
|
calibDrawerTemplate = None |
|
) |
| |
Returns a TileCalibDrawer object of requested type
for the given ROS and drawer.
Definition at line 473 of file TileCalibCrest.py.
473 def getDrawer(self, ros, drawer, calibDrawerTemplate=None):
475 Returns a TileCalibDrawer object of requested type
476 for the given ROS and drawer.
481 calibDrawer = self.__drawer.
get(drawerIdx,
None)
484 calibDrawer = self.__TileCalibDrawer.getInstance(self.__drawerBlob[drawerIdx], self.__defVec,0,0)
485 self.__drawer[drawerIdx] = calibDrawer
488 if calibDrawerTemplate:
489 calibDrawer.clone(calibDrawerTemplate)
493 except Exception
as e:
494 self.log().critical( e )
◆ register()
def python.TileCalibCrest.TileBlobWriterCrest.register |
( |
|
self, |
|
|
|
since = (MINRUN,MINLBK) , |
|
|
|
tag = "" |
|
) |
| |
Registers the folder in the database.
- since: lower limit of IOV
- tag : The tag to write to
The interpretation of the 'since' inputs depends on their type:
- tuple(int,int) : run and lbk number
Definition at line 404 of file TileCalibCrest.py.
404 def register(self, since=(MINRUN,MINLBK), tag=
""):
406 Registers the folder in the database.
407 - since: lower limit of IOV
408 - tag : The tag to write to
410 The interpretation of the 'since' inputs depends on their type:
411 - tuple(int,int) : run and lbk number
415 for drawerIdx,blob
in self.__drawerBlob.
items():
416 b64string =
str(base64.b64encode(blob.read()),
'ascii')
417 jdata[drawerIdx] = [b64string]
419 (sinceRun, sinceLumi) = since
421 if not self.__db
or (self.__db
and self.__db.endswith(
'.json')):
424 if self.__folderPath
and not (tag.startswith(
'Tile')
or tag.startswith(
'Calo')):
426 fileName = f
"{fullTag}.{sinceRun}.{sinceLumi}.json"
428 fileName = f
'{self.__db[:-5]}.{fileName}'
430 with open(fileName,
'w')
as the_file:
431 json.dump(jdata, the_file)
435 self.log().
info(
'Writting tag "%s"', fullTag)
436 self.log().
info(
'... since : [%s,%s]' , sinceRun, sinceLumi)
437 self.log().
info(
'... with comment field: "%s"', self.getComment())
438 self.log().
info(
'... into file : %s' , fileName)
◆ setComment()
def python.TileCalibCrest.TileBlobWriterCrest.setComment |
( |
|
self, |
|
|
|
author, |
|
|
|
comment = None |
|
) |
| |
Sets a general comment in the comment channel.
Definition at line 441 of file TileCalibCrest.py.
441 def setComment(self, author, comment=None):
443 Sets a general comment in the comment channel.
446 commentBlob = self.__drawer.
get(drawerIdx,
None)
449 self.__drawerBlob[drawerIdx] = commentBlob
451 if isinstance(author, tuple)
and len(author) == 3:
452 tm = time.mktime(datetime.datetime.strptime(author[2],
"%a %b %d %H:%M:%S %Y").timetuple())
◆ zeroBlob()
def python.TileCalibCrest.TileBlobWriterCrest.zeroBlob |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer |
|
) |
| |
Resets blob size to zero
Definition at line 498 of file TileCalibCrest.py.
498 def zeroBlob(self, ros, drawer):
500 Resets blob size to zero
504 blob = self.__drawerBlob[drawerIdx]
506 except Exception
as e:
507 self.log().critical( e )
◆ __calibDrawerType
python.TileCalibCrest.TileBlobWriterCrest.__calibDrawerType |
|
private |
◆ __db
python.TileCalibCrest.TileBlobWriterCrest.__db |
|
private |
◆ __defVec
python.TileCalibCrest.TileBlobWriterCrest.__defVec |
|
private |
◆ __drawer
python.TileCalibCrest.TileBlobWriterCrest.__drawer |
|
private |
◆ __drawerBlob
python.TileCalibCrest.TileBlobWriterCrest.__drawerBlob |
|
private |
◆ __folderPath
python.TileCalibCrest.TileBlobWriterCrest.__folderPath |
|
private |
◆ __TileCalibDrawer
python.TileCalibCrest.TileBlobWriterCrest.__TileCalibDrawer |
|
private |
The documentation for this class was generated from the following file: