|
| 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 429 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 436 of file TileCalibCrest.py.
436 def __init__(self, db, folderPath, calibDrawerType, isMultiVersionFolder=True):
439 - db : db should be a database connection
440 - folderPath: full folder path to create or update
444 TileCalibLogger.__init__(self,
"TileBlobWriter")
448 self.__folderPath = folderPath
451 self.__calibDrawerType = calibDrawerType
452 if calibDrawerType
in [
'TileCalibDrawerFlt',
'Flt']:
453 self.__TileCalibDrawer = TileCalibDrawerFlt
454 self.__defVec = cppyy.gbl.std.vector(
'std::vector<float>')()
455 elif calibDrawerType
in [
'TileCalibDrawerBch',
'Bch']:
456 self.__TileCalibDrawer = TileCalibDrawerBch
457 self.__defVec = cppyy.gbl.std.vector(
'std::vector<unsigned int>')()
458 elif calibDrawerType
in [
'TileCalibDrawerInt',
'Int']:
459 self.__TileCalibDrawer = TileCalibDrawerInt
460 self.__defVec = cppyy.gbl.std.vector(
'std::vector<unsigned int>')()
462 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 525 of file TileCalibCrest.py.
525 def getComment(self, split=False):
527 Returns the general comment (default if none is set)
530 comment = self.__drawer.
get(drawerIdx,
None)
533 return (comment.getAuthor(), self.__comment.getComment(), self.__comment.getDate())
535 return comment.getFullComment()
537 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 540 of file TileCalibCrest.py.
540 def getDrawer(self, ros, drawer, calibDrawerTemplate=None):
542 Returns a TileCalibDrawer object of requested type
543 for the given ROS and drawer.
548 calibDrawer = self.__drawer.
get(drawerIdx,
None)
551 calibDrawer = self.__TileCalibDrawer.getInstance(self.__drawerBlob[drawerIdx], self.__defVec,0,0)
552 self.__drawer[drawerIdx] = calibDrawer
555 if calibDrawerTemplate:
556 calibDrawer.clone(calibDrawerTemplate)
560 except Exception
as e:
561 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 468 of file TileCalibCrest.py.
468 def register(self, since=(MINRUN,MINLBK), tag=
""):
470 Registers the folder in the database.
471 - since: lower limit of IOV
472 - tag : The tag to write to
474 The interpretation of the 'since' inputs depends on their type:
475 - tuple(int,int) : run and lbk number
479 for drawerIdx,blob
in self.__drawerBlob.
items():
480 if blob
is None or blob==0:
483 b64string =
str(base64.b64encode(blob.read()),
'ascii')
484 jdata[drawerIdx] = [b64string]
486 (sinceRun, sinceLumi) = since
488 if not self.__db
or (self.__db
and self.__db.endswith(
'.json')):
491 if self.__folderPath
and not (tag.upper().startswith(
'TILE')
or tag.upper().startswith(
'CALO')):
493 fileName = f
"{fullTag}.{sinceRun}.{sinceLumi}.json"
495 fileName = f
'{self.__db[:-5]}.{fileName}'
497 with open(fileName,
'w')
as the_file:
498 json.dump(jdata, the_file)
502 self.log().
info(
'Writting tag "%s"', fullTag)
503 self.log().
info(
'... since : [%s,%s]' , sinceRun, sinceLumi)
504 self.log().
info(
'... with comment field: "%s"', self.getComment())
505 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 508 of file TileCalibCrest.py.
508 def setComment(self, author, comment=None):
510 Sets a general comment in the comment channel.
513 commentBlob = self.__drawer.
get(drawerIdx,
None)
516 self.__drawerBlob[drawerIdx] = commentBlob
518 if isinstance(author, tuple)
and len(author) == 3:
519 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 565 of file TileCalibCrest.py.
565 def zeroBlob(self, ros, drawer):
567 Resets blob size to zero
571 blob = self.__drawerBlob[drawerIdx]
573 except Exception
as e:
574 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: