/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Private Attributes
fileTools::FileInfo Class Reference

List of all members.

Public Member Functions

def __init__
def rawDataTree
def firstRawTriggerTime
def lastRawTriggerTime

Private Attributes

 _file
 _rawDataTree

Detailed Description

Helper class for NuWa data files

Definition at line 9 of file fileTools.py.


Constructor & Destructor Documentation

def fileTools::FileInfo::__init__ (   self,
  filename = None 
)
Constructor 

Definition at line 11 of file fileTools.py.

00012                                      :
00013         """ Constructor """
00014         self._file = None
00015         self._rawDataTree = None
00016         if filename:
00017             infile = ROOT.TFile(filename)
00018             if infile.IsOpen():
00019                 self._file = infile
00020             else:
00021                 print 'Error: failed to open filename: "%s"' % filename
00022         return


Member Function Documentation

def fileTools::FileInfo::rawDataTree (   self)
Return raw data tree if it exists in file, else return 'None'

Definition at line 23 of file fileTools.py.

00024                          :
00025         """ Return raw data tree if it exists in file, else return 'None'"""
00026         if not self._rawDataTree:
00027             if not self._file:
00028                 print 'Error: no valid open file'
00029                 return None
00030             tree = self._file.Get("/Event/Readout/ReadoutHeader")
00031             if not tree:
00032                 print 'Error: no valid raw data tree in file'
00033                 return None
00034             self._rawDataTree = tree
00035         return self._rawDataTree

def fileTools::FileInfo::firstRawTriggerTime (   self)
Return the timestamp of the first raw data block in file 

Definition at line 36 of file fileTools.py.

00037                                  :
00038         """ Return the timestamp of the first raw data block in file """
00039         badTime = TimeStamp(0,0)
00040         rawTree = self.rawDataTree()
00041         if not rawTree:
00042             return badTime
00043         nBytes = rawTree.GetEntry(0)
00044         if nBytes < 1:
00045             print 'Error: invalid first entry in tree'
00046             return badTime
00047         secLeaf = rawTree.GetLeaf("context.mTimeStamp.mSec")
00048         if not secLeaf:
00049             print 'Error: failed to get context seconds'
00050             return badTime
00051         nanosecLeaf = rawTree.GetLeaf("context.mTimeStamp.mNanoSec")
00052         if not nanosecLeaf:
00053             print 'Error: failed to get context nanoseconds'
00054             return badTime
00055         trigTime = TimeStamp(int(secLeaf.GetValue()),
00056                              int(nanosecLeaf.GetValue()))
00057         return trigTime

def fileTools::FileInfo::lastRawTriggerTime (   self)
Return the timestamp of the last raw data block in file 

Definition at line 58 of file fileTools.py.

00059                                 :
00060         """ Return the timestamp of the last raw data block in file """
00061         badTime = TimeStamp(0,0)
00062         rawTree = self.rawDataTree()
00063         if not rawTree:
00064             return badTime
00065         lastEntry = rawTree.GetEntries() - 1
00066         nBytes = rawTree.GetEntry(lastEntry)
00067         if nBytes < 1:
00068             print 'Error: invalid first entry in tree'
00069             return badTime
00070         secLeaf = rawTree.GetLeaf("context.mTimeStamp.mSec")
00071         if not secLeaf:
00072             print 'Error: failed to get context seconds'
00073             return badTime
00074         nanosecLeaf = rawTree.GetLeaf("context.mTimeStamp.mNanoSec")
00075         if not nanosecLeaf:
00076             print 'Error: failed to get context nanoseconds'
00077             return badTime
00078         trigTime = TimeStamp(int(secLeaf.GetValue()),
00079                              int(nanosecLeaf.GetValue()))
00080         return trigTime

Member Data Documentation

Definition at line 11 of file fileTools.py.

Definition at line 11 of file fileTools.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:55:35 for ESCalibSPN by doxygen 1.7.4