/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::Framer::FixedWindow Class Reference

List of all members.

Public Member Functions

def __init__
def __call__

Public Attributes

 window_sec

Detailed Description

A fixed window framer.

Definition at line 134 of file Framer.py.


Constructor & Destructor Documentation

def DybEventMgr::Framer::FixedWindow::__init__ (   self,
  window = 300*units.nanosecond 
)
Create a fixed window framer with the given window (def 300ns)

Definition at line 138 of file Framer.py.

00139                                                      :
00140         '''
00141         Create a fixed window framer with the given window (def 300ns)
00142         '''
00143         self.window_sec = window/units.second
00144         return


Member Function Documentation

def DybEventMgr::Framer::FixedWindow::__call__ (   self,
  chunk 
)
Return a frame, removing the selected readout headers from the chunk

Definition at line 145 of file Framer.py.

00146                             :
00147         '''
00148         Return a frame, removing the selected readout headers from the chunk
00149         '''
00150         if not chunk: return []
00151         
00152 
00153         #print 'Framing with %d readouts' % len(chunk)
00154         #for roh in chunk:
00155         #    print '\t%s' % hostr(roh)
00156         first = chunk.pop(0)
00157         start = first.timeStamp() # first one is 
00158         frame = [first]           # guaranteed
00159         detectors = [first.context().GetDetId()]
00160         unused = []
00161         while chunk:
00162             candidate = chunk.pop(0)
00163             unused.append(candidate)
00164 
00165             ts = candidate.timeStamp()
00166             dt = math.fabs(timestamp_diff(ts, start))
00167             if dt > self.window_sec:
00168                 continue           # not in time window, but keep
00169                                    # looking, maybe badly unordered
00170 
00171             detid = candidate.context().GetDetId()
00172             if not detid:
00173                 msg = 'Zero detector ID from context of readout "%s"' % candidate
00174                 print 'ERROR: ' + msg 
00175                 raise ValueError,msg
00176 
00177             if detid in detectors:
00178                 continue        # already got one like you
00179 
00180             #print 'Framer: accepting dt = %f ns: %s based on %s' % (dt*1e9,hostr(candidate),hostr(first))
00181 
00182             detectors.append(detid)
00183             frame.append(unused.pop()) # save to frame
00184             continue
00185 
00186         for roh in unused: chunk.append(roh)
00187         #print 'Returning chunk with %d readouts' % len(chunk)
00188         return frame
00189 
        

Member Data Documentation

Definition at line 140 of file Framer.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