|
def | __init__ (self, db, folder, tag="") |
|
def | getComment (self, pointInTime, split=False) |
|
def | getDefault (self, ros, drawer) |
|
def | getDrawer (self, ros, drawer, pointInTime, printError=True, useDefault=True) |
|
def | getDefaultDrawer (self, ros, drawer, pointInTime, printError=True) |
|
def | getDBobjsWithinRange (self, ros, drawer, point1inTime=(0, 0), point2inTime=(2147483647, 4294967295), printError=True) |
|
def | getIOVsWithinRange (self, ros, drawer, point1inTime=(0, 0), point2inTime=(2147483647, 4294967295), printError=True) |
|
def | getBlobsWithinRange (self, ros, drawer, point1inTime=(0, 0), point2inTime=(2147483647, 4294967295)) |
|
def | folderIsMultiVersion (self) |
|
TileCalibBlobReader is a helper class, managing the details of COOL interactions for
the user of TileCalibBlobs.
Definition at line 754 of file TileCalibTools.py.
◆ __init__()
def python.TileCalibTools.TileBlobReader.__init__ |
( |
|
self, |
|
|
|
db, |
|
|
|
folder, |
|
|
|
tag = "" |
|
) |
| |
Input:
- db : db should be an open database connection
- folder: full folder path
- tag : The folder tag, e.g. \"000-00\"
Definition at line 761 of file TileCalibTools.py.
761 def __init__(self, db, folder, tag=""):
764 - db : db should be an open database connection
765 - folder: full folder path
766 - tag : The folder tag, e.g. \"000-00\"
769 TileCalibLogger.__init__(self,
"TileBlobReader")
774 self.__folder = self.__db.getFolder(folder)
775 except Exception
as e:
776 self.log().critical( e )
780 validFolderTypes = (
"run-lumi",
"time")
783 if self.__folderType
not in validFolderTypes:
784 raise Exception(
"Invalid folder type found: \'%s\'" % self.__folderType)
◆ folderIsMultiVersion()
def python.TileCalibTools.TileBlobReader.folderIsMultiVersion |
( |
|
self | ) |
|
Returns true if MultiVersion folder is connected
Definition at line 1084 of file TileCalibTools.py.
1084 def folderIsMultiVersion(self):
1086 Returns true if MultiVersion folder is connected
1088 if self.__folder.versioningMode()==cool.FolderVersioning.MULTI_VERSION:
◆ getBlobsWithinRange()
def python.TileCalibTools.TileBlobReader.getBlobsWithinRange |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer, |
|
|
|
point1inTime = (0,0) , |
|
|
|
point2inTime = (2147483647,4294967295) |
|
) |
| |
Returns all blob objects for the given ROS and drawer, within given validity range -- default: [0-Infty)
Note: the blobs don't contain validity range info. Check method getDBobjsWithinRange()
Definition at line 1018 of file TileCalibTools.py.
1018 def getBlobsWithinRange(self, ros, drawer, point1inTime=(0,0), point2inTime=(2147483647,4294967295)):
1020 Returns all blob objects for the given ROS and drawer, within given validity range -- default: [0-Infty)
1021 Note: the blobs don't contain validity range info. Check method getDBobjsWithinRange()
1027 print (
"Validity keys range is %s - %s" % (validityKey1, validityKey2))
1028 self.log().
debug(
"Validity key range is %s - %s", validityKey1,validityKey2)
1030 objs = self.getDBobjsWithinRange(self, ros, drawer, point1inTime, point2inTime)
1035 while objs.goToNext():
1036 obj=objs.currentRef()
1037 sinceCool=obj.since()
1038 if sinceCool < validityKey1:
1039 sinceCool = validityKey1
1040 untilCool=obj.until()
1041 blob = obj.payload()[0]
1042 print (
"[%d,%d)-[%d,%d) - %s" % ((sinceCool>>32),(sinceCool&0xFFFFFFFF),(untilCool>>32),(untilCool&0xFFFFFFFF),blob))
1043 self.log().
debug(
"blob size: %d", blob.size())
1046 while blob.size()==0:
1048 if ros==0
and drawer==0:
1049 raise Exception(
'No default available')
1051 ros,drawer = self.getDefault(ros,drawer)
1053 obj = self.__folder.findObject(sinceCool, chanNum, self.__tag)
1054 blob = obj.payload()[0]
1055 self.log().
debug(
"blob size: 0 --> default: %d", blob.size())
1058 self.__objDict[sinceCool] = obj
1064 if typeName==
'TileCalibDrawerFlt':
1066 self.log().
debug(
"typeName = Flt " )
1067 elif typeName==
'TileCalibDrawerInt':
1069 self.log().
debug(
"typeName = Int " )
1070 elif typeName==
'TileCalibDrawerBch':
1072 self.log().
debug(
"typeName = Bch " )
1073 elif typeName==
'TileCalibDrawerOfc':
1075 self.log().
debug(
"typeName = Ofc " )
1077 raise Exception(
"Invalid blob type requested: %s" % typeName )
1079 blobs.append( calibDrawer )
◆ getComment()
def python.TileCalibTools.TileBlobReader.getComment |
( |
|
self, |
|
|
|
pointInTime, |
|
|
|
split = False |
|
) |
| |
Returns the general comment (default if none is set)
Definition at line 794 of file TileCalibTools.py.
794 def getComment(self, pointInTime, split=False):
796 Returns the general comment (default if none is set)
801 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
802 self.log().
debug(
"getComment:Fetching from DB: %s", obj)
803 blob = obj.payload()[0]
806 return (cmt.getAuthor(),cmt.getComment(),cmt.getDate())
808 return cmt.getFullComment()
810 return "<no comment found>"
◆ getDBobjsWithinRange()
def python.TileCalibTools.TileBlobReader.getDBobjsWithinRange |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer, |
|
|
|
point1inTime = (0,0) , |
|
|
|
point2inTime = (2147483647,4294967295) , |
|
|
|
printError = True |
|
) |
| |
Returns all DB objects for the given ROS and drawer, within given validity range -- default: [0-Infty)
Check getBlobsWithinRange for an example on how to loop over objects and check validity ranges.
Definition at line 974 of file TileCalibTools.py.
974 def getDBobjsWithinRange(self, ros, drawer, point1inTime=(0,0), point2inTime=(2147483647,4294967295), printError=
True):
976 Returns all DB objects for the given ROS and drawer, within given validity range -- default: [0-Infty)
977 Check getBlobsWithinRange for an example on how to loop over objects and check validity ranges.
984 self.log().
debug(
"Validity key range is %s - %s", validityKey1,validityKey2)
989 dbChanSel = cool.ChannelSelection(dbChanNum)
991 objs = self.__folder.browseObjects(validityKey1,validityKey2,dbChanSel,self.__tag)
992 except Exception
as e:
994 self.log().
error(
"TileCalibTools.getDBobjsWithinRange(): Fetching of ros=%i, drawer=%i failed with exception %s", ros,drawer,e)
◆ getDefault()
def python.TileCalibTools.TileBlobReader.getDefault |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer |
|
) |
| |
Returns a default drawer number (among first 20 COOL channels) for any drawer in any partition
Definition at line 813 of file TileCalibTools.py.
813 def getDefault(self, ros, drawer):
815 Returns a default drawer number (among first 20 COOL channels) for any drawer in any partition
818 if drawer<=4
or drawer==12
or drawer>=20:
824 elif ros==1
or ros==2:
827 OffsetEBA = [ 0, 0, 0, 0, 0, 0, 3, 2,
828 0, 0, 0, 0, 7, 6, 5, 7,
829 7, 6, 6, 7, 0, 0, 0, 2,
830 3, 0, 0, 0, 0, 0, 0, 0,
831 0, 0, 0, 0, 0, 0, 1, 1,
832 1, 1, 2, 3, 0, 0, 0, 0,
833 0, 0, 0, 0, 3, 2, 1, 1,
834 1, 1, 0, 0, 0, 0, 0, 0]
835 drawer1 = 12 + OffsetEBA[drawer]
837 OffsetEBC = [ 0, 0, 0, 0, 0, 0, 3, 2,
838 0, 0, 0, 0, 7, 6, 6, 7,
839 7, 5, 6, 7, 0, 0, 0, 2,
840 3, 0, 0, 3, 4, 0, 3, 4,
841 0, 4, 3, 0, 4, 3, 1, 1,
842 1, 1, 2, 3, 0, 0, 0, 0,
843 0, 0, 0, 0, 3, 2, 1, 1,
844 1, 1, 0, 0, 0, 0, 0, 0]
845 drawer1 = 12 + OffsetEBC[drawer]
◆ getDefaultDrawer()
def python.TileCalibTools.TileBlobReader.getDefaultDrawer |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer, |
|
|
|
pointInTime, |
|
|
|
printError = True |
|
) |
| |
Returns a TileCalibDrawer object for the given ROS and drawer.
Definition at line 914 of file TileCalibTools.py.
914 def getDefaultDrawer(self, ros, drawer, pointInTime, printError=True):
916 Returns a TileCalibDrawer object for the given ROS and drawer.
920 self.log().
debug(
"Validity key is %s", validityKey)
924 key = (ros,drawer,validityKey)
925 obj = self.__objDict.
get(key)
929 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
930 self.log().
debug(
"Fetching from DB: %s", obj)
931 blob = obj.payload()[0]
932 self.log().
debug(
"blob size: %d", blob.size())
934 while blob.size()==0:
936 if ros==0
and drawer==0:
937 raise Exception(
'No default available')
939 ros,drawer = self.getDefault(ros,drawer)
941 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
942 blob = obj.payload()[0]
944 self.__objDict[key] = obj
946 blob = obj.payload()[0]
947 self.log().
debug(
"blob size: %d", blob.size())
953 if typeName==
'TileCalibDrawerFlt':
955 self.log().
debug(
"typeName = Flt " )
956 elif typeName==
'TileCalibDrawerInt':
958 self.log().
debug(
"typeName = Int " )
959 elif typeName==
'TileCalibDrawerBch':
961 self.log().
debug(
"typeName = Bch " )
962 elif typeName==
'TileCalibDrawerOfc':
964 self.log().
debug(
"typeName = Ofc " )
966 raise Exception(
"Invalid blob type requested: %s" % typeName )
968 except Exception
as e:
970 self.log().
error(
"TileCalibTools.getDefaultDrawer(): Fetching of ros=%i, drawer=%i failed with exception %s", ros,drawer,e)
◆ getDrawer()
def python.TileCalibTools.TileBlobReader.getDrawer |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer, |
|
|
|
pointInTime, |
|
|
|
printError = True , |
|
|
|
useDefault = True |
|
) |
| |
Returns a TileCalibDrawer object for the given ROS and drawer.
Definition at line 852 of file TileCalibTools.py.
852 def getDrawer(self, ros, drawer, pointInTime, printError=True, useDefault=True):
854 Returns a TileCalibDrawer object for the given ROS and drawer.
858 self.log().
debug(
"Validity key is %s", validityKey)
862 key = (ros,drawer,validityKey)
863 obj = self.__objDict.
get(key)
867 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
868 self.log().
debug(
"Fetching from DB: %s", obj)
869 blob = obj.payload()[0]
870 self.log().
debug(
"blob size: %d", blob.size())
872 if not useDefault
and blob.size()==0:
874 while blob.size()==0:
876 if ros==0
and drawer==0:
877 raise Exception(
'No default available')
879 ros,drawer = self.getDefault(ros,drawer)
881 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
882 blob = obj.payload()[0]
884 self.__objDict[key] = obj
886 blob = obj.payload()[0]
887 self.log().
debug(
"blob size: %d", blob.size())
893 if typeName==
'TileCalibDrawerFlt':
895 self.log().
debug(
"typeName = Flt " )
896 elif typeName==
'TileCalibDrawerInt':
898 self.log().
debug(
"typeName = Int " )
899 elif typeName==
'TileCalibDrawerBch':
901 self.log().
debug(
"typeName = Bch " )
902 elif typeName==
'TileCalibDrawerOfc':
904 self.log().
debug(
"typeName = Ofc " )
906 raise Exception(
"Invalid blob type requested: %s" % typeName )
908 except Exception
as e:
910 self.log().
error(
"TileCalibTools.getDrawer(): Fetching of ros=%i, drawer=%i failed with exception %s", ros,drawer,e)
◆ getIOVsWithinRange()
def python.TileCalibTools.TileBlobReader.getIOVsWithinRange |
( |
|
self, |
|
|
|
ros, |
|
|
|
drawer, |
|
|
|
point1inTime = (0,0) , |
|
|
|
point2inTime = (2147483647,4294967295) , |
|
|
|
printError = True |
|
) |
| |
Returns list of IOVS for the given ROS and drawer, within given validity range -- default: [0-Infty)
Definition at line 999 of file TileCalibTools.py.
999 def getIOVsWithinRange(self, ros, drawer, point1inTime=(0,0), point2inTime=(2147483647,4294967295), printError=
True):
1001 Returns list of IOVS for the given ROS and drawer, within given validity range -- default: [0-Infty)
1004 dbobjs = self.getDBobjsWithinRange(ros,drawer,point1inTime, point2inTime, printError)
1005 if (dbobjs
is None):
1006 log.warning(
"Warning: can not read IOVs for ros %d drawer %d from input DB file", ros,drawer )
1008 while dbobjs.goToNext():
1009 obj = dbobjs.currentRef()
1010 objsince = obj.since()
1011 sinceRun = objsince >> 32
1012 sinceLum = objsince & 0xFFFFFFFF
1013 since = (sinceRun, sinceLum)
◆ __db
python.TileCalibTools.TileBlobReader.__db |
|
private |
◆ __folder
python.TileCalibTools.TileBlobReader.__folder |
|
private |
◆ __folderType
python.TileCalibTools.TileBlobReader.__folderType |
|
private |
◆ __objDict
python.TileCalibTools.TileBlobReader.__objDict |
|
private |
◆ __tag
python.TileCalibTools.TileBlobReader.__tag |
|
private |
The documentation for this class was generated from the following file:
static TileCalibDrawerOfc * getInstance(coral::Blob &blob, uint16_t objVersion, uint32_t nSamples, int32_t nPhases, uint16_t nChans, uint16_t nGains, const std::string &author="", const std::string &comment="", uint64_t timeStamp=0)
Returns a pointer to a non-const TileCalibDrawerOfc.