/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 | Public Attributes
DybEventMgr::Chunker::ChunkingAlg Class Reference
Inheritance diagram for DybEventMgr::Chunker::ChunkingAlg:
Inheritance graph
[legend]
Collaboration diagram for DybEventMgr::Chunker::ChunkingAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def newChunk
def initialize
def add
def blow_chunks
def check_roh
def execute

Public Attributes

 gap_secs
 readout_location
 chunk_location
 lastTime
 chunk_input_headers

Detailed Description

An algorithm that will collect readouts until a gap is found.

Definition at line 18 of file Chunker.py.


Constructor & Destructor Documentation

def DybEventMgr::Chunker::ChunkingAlg::__init__ (   self,
  gap = 10*units.microsecond,
  readout_location = "/Event/Readout/ReadoutHeader",
  chunk_location = "/Event/EventBuilder/Chunk" 
)
Create a ChunkByGap algorithm, optionally specifying the gap
time in the system of units.

Definition at line 24 of file Chunker.py.

00027                                                               :
00028         '''
00029         Create a ChunkByGap algorithm, optionally specifying the gap
00030         time in the system of units.
00031         '''
00032         DybPythonAlg.__init__(self,'ChunkingAlg')
00033         self.gap_secs = gap/units.second
00034         self.readout_location = readout_location
00035         self.chunk_location = chunk_location
00036         self.lastTime = None
00037         self.chunk_input_headers = []
00038         return


Member Function Documentation

def DybEventMgr::Chunker::ChunkingAlg::newChunk (   self)

Definition at line 39 of file Chunker.py.

00040                       :
00041         'Start building a new chunk'
00042 
00043         self.debug('newChunk, removing %d old ReadoutHeaderObjects' % len(self.chunk_input_headers))
00044         for ho in self.chunk_input_headers:
00045             ho.release()
00046         self.chunk_input_headers = []
00047         self.lastTime = None
00048         return 

def DybEventMgr::Chunker::ChunkingAlg::initialize (   self)

Definition at line 49 of file Chunker.py.

00050                         :
00051         sc = DybPythonAlg.initialize(self)
00052         if sc.isFailure(): return sc
00053         return SUCCESS
    
def DybEventMgr::Chunker::ChunkingAlg::add (   self,
  roh 
)

Definition at line 54 of file Chunker.py.

00055                      :
00056         'Add given ReadoutHeader to the current chunk'
00057 
00058         self.lastTime = roh.timeStamp()
00059         self.chunk_input_headers.append(roh)
00060         roh.addRef()
00061 
00062         return

def DybEventMgr::Chunker::ChunkingAlg::blow_chunks (   self)

Definition at line 63 of file Chunker.py.

00064                          :
00065         'Release the current chunk, start anew' 
00066         tes = self.evtSvc()
00067 
00068         chunk = gbl.DayaBay.HeaderObject()
00069         self.initializeHeader(chunk)
00070         fillInputHeaders(chunk,self.chunk_input_headers)
00071         #self.debug('Made chunk: "%s"' % hostr(chunk))
00072 
00073         tes[self.chunk_location] = chunk
00074 
00075         self.newChunk()
00076         return

def DybEventMgr::Chunker::ChunkingAlg::check_roh (   self,
  roh 
)

Definition at line 77 of file Chunker.py.

00078                            :
00079         'Some sanity checking'
00080         try: 
00081             ts = roh.timeStamp()
00082         except AttributeError:
00083             self.error('ReadoutHeader with no timeStamp method class = %s' % roh.__class__)
00084             tes = self.evtSvc()
00085             self.error('TES object is "%s"' % tes)
00086             self.error('TES object named "%s"' % tes.name())
00087             eds_name = self.getProperty('EventDataService')
00088             self.error('My EventDataService is "%s"' % eds_name)

def DybEventMgr::Chunker::ChunkingAlg::execute (   self)

Definition at line 89 of file Chunker.py.

00090                      :
00091         self.debug('execute')
00092         self.debug('Getting from readout location: "%s"' % self.readout_location)
00093         tes = self.evtSvc()
00094         roh = tes[self.readout_location]
00095         self.check_roh(roh)
00096 
00097         # First one of the job is immediate
00098         if self.lastTime is None:
00099             self.add(roh)
00100             return SUCCESS
00101 
00102         # Mind the gap
00103         ts = roh.timeStamp()
00104         dt = timestamp_diff(ts,self.lastTime)
00105         if dt < self.gap_secs:
00106             self.add(roh)
00107             return SUCCESS            
00108 
00109         # Reached a gap, write the chunk
00110         self.blow_chunks()
00111  
00112         # save  for next time
00113         self.add(roh)
00114 
00115         return SUCCESS


Member Data Documentation

Definition at line 27 of file Chunker.py.

Definition at line 27 of file Chunker.py.

Definition at line 27 of file Chunker.py.

Definition at line 27 of file Chunker.py.

Definition at line 27 of file Chunker.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 10:09:08 for DybEventMgr by doxygen 1.7.4