|
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 748 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 755 of file TileCalibTools.py.
755 def __init__(self, db, folder, tag=""):
758 - db : db should be an open database connection
759 - folder: full folder path
760 - tag : The folder tag, e.g. \"000-00\"
763 TileCalibLogger.__init__(self,
"TileBlobReader")
768 self.__folder = self.__db.getFolder(folder)
769 except Exception
as e:
770 self.log().critical( e )
774 validFolderTypes = (
"run-lumi",
"time")
777 if self.__folderType
not in validFolderTypes:
778 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 1078 of file TileCalibTools.py.
1078 def folderIsMultiVersion(self):
1080 Returns true if MultiVersion folder is connected
1082 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 1012 of file TileCalibTools.py.
1012 def getBlobsWithinRange(self, ros, drawer, point1inTime=(0,0), point2inTime=(2147483647,4294967295)):
1014 Returns all blob objects for the given ROS and drawer, within given validity range -- default: [0-Infty)
1015 Note: the blobs don't contain validity range info. Check method getDBobjsWithinRange()
1021 print (
"Validity keys range is %s - %s" % (validityKey1, validityKey2))
1022 self.log().
debug(
"Validity key range is %s - %s", validityKey1,validityKey2)
1024 objs = self.getDBobjsWithinRange(self, ros, drawer, point1inTime, point2inTime)
1029 while objs.goToNext():
1030 obj=objs.currentRef()
1031 sinceCool=obj.since()
1032 if sinceCool < validityKey1:
1033 sinceCool = validityKey1
1034 untilCool=obj.until()
1035 blob = obj.payload()[0]
1036 print (
"[%d,%d)-[%d,%d) - %s" % ((sinceCool>>32),(sinceCool&0xFFFFFFFF),(untilCool>>32),(untilCool&0xFFFFFFFF),blob))
1037 self.log().
debug(
"blob size: %d", blob.size())
1040 while blob.size()==0:
1042 if ros==0
and drawer==0:
1043 raise Exception(
'No default available')
1045 ros,drawer = self.getDefault(ros,drawer)
1047 obj = self.__folder.findObject(sinceCool, chanNum, self.__tag)
1048 blob = obj.payload()[0]
1049 self.log().
debug(
"blob size: 0 --> default: %d", blob.size())
1052 self.__objDict[sinceCool] = obj
1058 if typeName==
'TileCalibDrawerFlt':
1060 self.log().
debug(
"typeName = Flt " )
1061 elif typeName==
'TileCalibDrawerInt':
1063 self.log().
debug(
"typeName = Int " )
1064 elif typeName==
'TileCalibDrawerBch':
1066 self.log().
debug(
"typeName = Bch " )
1067 elif typeName==
'TileCalibDrawerOfc':
1069 self.log().
debug(
"typeName = Ofc " )
1071 raise Exception(
"Invalid blob type requested: %s" % typeName )
1073 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 788 of file TileCalibTools.py.
788 def getComment(self, pointInTime, split=False):
790 Returns the general comment (default if none is set)
795 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
796 self.log().
debug(
"getComment:Fetching from DB: %s", obj)
797 blob = obj.payload()[0]
800 return (cmt.getAuthor(),cmt.getComment(),cmt.getDate())
802 return cmt.getFullComment()
804 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 968 of file TileCalibTools.py.
968 def getDBobjsWithinRange(self, ros, drawer, point1inTime=(0,0), point2inTime=(2147483647,4294967295), printError=
True):
970 Returns all DB objects for the given ROS and drawer, within given validity range -- default: [0-Infty)
971 Check getBlobsWithinRange for an example on how to loop over objects and check validity ranges.
978 self.log().
debug(
"Validity key range is %s - %s", validityKey1,validityKey2)
983 dbChanSel = cool.ChannelSelection(dbChanNum)
985 objs = self.__folder.browseObjects(validityKey1,validityKey2,dbChanSel,self.__tag)
986 except Exception
as e:
988 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 807 of file TileCalibTools.py.
807 def getDefault(self, ros, drawer):
809 Returns a default drawer number (among first 20 COOL channels) for any drawer in any partition
812 if drawer<=4
or drawer==12
or drawer>=20:
818 elif ros==1
or ros==2:
821 OffsetEBA = [ 0, 0, 0, 0, 0, 0, 3, 2,
822 0, 0, 0, 0, 7, 6, 5, 7,
823 7, 6, 6, 7, 0, 0, 0, 2,
824 3, 0, 0, 0, 0, 0, 0, 0,
825 0, 0, 0, 0, 0, 0, 1, 1,
826 1, 1, 2, 3, 0, 0, 0, 0,
827 0, 0, 0, 0, 3, 2, 1, 1,
828 1, 1, 0, 0, 0, 0, 0, 0]
829 drawer1 = 12 + OffsetEBA[drawer]
831 OffsetEBC = [ 0, 0, 0, 0, 0, 0, 3, 2,
832 0, 0, 0, 0, 7, 6, 6, 7,
833 7, 5, 6, 7, 0, 0, 0, 2,
834 3, 0, 0, 3, 4, 0, 3, 4,
835 0, 4, 3, 0, 4, 3, 1, 1,
836 1, 1, 2, 3, 0, 0, 0, 0,
837 0, 0, 0, 0, 3, 2, 1, 1,
838 1, 1, 0, 0, 0, 0, 0, 0]
839 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 908 of file TileCalibTools.py.
908 def getDefaultDrawer(self, ros, drawer, pointInTime, printError=True):
910 Returns a TileCalibDrawer object for the given ROS and drawer.
914 self.log().
debug(
"Validity key is %s", validityKey)
918 key = (ros,drawer,validityKey)
919 obj = self.__objDict.
get(key)
923 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
924 self.log().
debug(
"Fetching from DB: %s", obj)
925 blob = obj.payload()[0]
926 self.log().
debug(
"blob size: %d", blob.size())
928 while blob.size()==0:
930 if ros==0
and drawer==0:
931 raise Exception(
'No default available')
933 ros,drawer = self.getDefault(ros,drawer)
935 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
936 blob = obj.payload()[0]
938 self.__objDict[key] = obj
940 blob = obj.payload()[0]
941 self.log().
debug(
"blob size: %d", blob.size())
947 if typeName==
'TileCalibDrawerFlt':
949 self.log().
debug(
"typeName = Flt " )
950 elif typeName==
'TileCalibDrawerInt':
952 self.log().
debug(
"typeName = Int " )
953 elif typeName==
'TileCalibDrawerBch':
955 self.log().
debug(
"typeName = Bch " )
956 elif typeName==
'TileCalibDrawerOfc':
958 self.log().
debug(
"typeName = Ofc " )
960 raise Exception(
"Invalid blob type requested: %s" % typeName )
962 except Exception
as e:
964 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 846 of file TileCalibTools.py.
846 def getDrawer(self, ros, drawer, pointInTime, printError=True, useDefault=True):
848 Returns a TileCalibDrawer object for the given ROS and drawer.
852 self.log().
debug(
"Validity key is %s", validityKey)
856 key = (ros,drawer,validityKey)
857 obj = self.__objDict.
get(key)
861 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
862 self.log().
debug(
"Fetching from DB: %s", obj)
863 blob = obj.payload()[0]
864 self.log().
debug(
"blob size: %d", blob.size())
866 if not useDefault
and blob.size()==0:
868 while blob.size()==0:
870 if ros==0
and drawer==0:
871 raise Exception(
'No default available')
873 ros,drawer = self.getDefault(ros,drawer)
875 obj = self.__folder.findObject(validityKey, chanNum, self.__tag)
876 blob = obj.payload()[0]
878 self.__objDict[key] = obj
880 blob = obj.payload()[0]
881 self.log().
debug(
"blob size: %d", blob.size())
887 if typeName==
'TileCalibDrawerFlt':
889 self.log().
debug(
"typeName = Flt " )
890 elif typeName==
'TileCalibDrawerInt':
892 self.log().
debug(
"typeName = Int " )
893 elif typeName==
'TileCalibDrawerBch':
895 self.log().
debug(
"typeName = Bch " )
896 elif typeName==
'TileCalibDrawerOfc':
898 self.log().
debug(
"typeName = Ofc " )
900 raise Exception(
"Invalid blob type requested: %s" % typeName )
902 except Exception
as e:
904 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 993 of file TileCalibTools.py.
993 def getIOVsWithinRange(self, ros, drawer, point1inTime=(0,0), point2inTime=(2147483647,4294967295), printError=
True):
995 Returns list of IOVS for the given ROS and drawer, within given validity range -- default: [0-Infty)
998 dbobjs = self.getDBobjsWithinRange(ros,drawer,point1inTime, point2inTime, printError)
1000 log.warning(
"Warning: can not read IOVs for ros %d drawer %d from input DB file", ros,drawer )
1002 while dbobjs.goToNext():
1003 obj = dbobjs.currentRef()
1004 objsince = obj.since()
1005 sinceRun = objsince >> 32
1006 sinceLum = objsince & 0xFFFFFFFF
1007 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.