| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
GaudiMP.GMPBase.Reader Class Reference
Inheritance diagram for GaudiMP.GMPBase.Reader:
[legend]
Collaboration diagram for GaudiMP.GMPBase.Reader:
[legend]

## Public Member Functions
def | __init__
def | processConfiguration
def | DumpEvent
def | DoFirstEvent
def | Engine
Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
def | __init__
def | Start
def | Engine
def | processConfiguration
def | SetupGaudiPython
def | StartGaudiPython
def | LoadTES
def | getEventNumber
def | IdentifyWriters
def | dumpHistograms
def | Initialize
def | Finalize
def | Report

## Public Attributes
| evtMax
| nOut
| app
| currentEvent
| firstEvTime
| stat
| tTime
Public Attributes inherited from GaudiMP.GMPBase.GMPComponent
| nodeType
| finalEvent
| lastEvent
| log
| subworkers
| nodeID
| currentEvent
| queues
| num
| app
| evcom
| evcoms
| hq
| fq
| nIn
| nOut
| stat
| iTime
| rTime
| fTime
| firstEvTime
| tTime
| proc
| a
| evt
| hvt
| fsr
| inc
| pers
| ts
| TS
| cntr

## Detailed Description

Definition at line 648 of file GMPBase.py.

## Constructor & Destructor Documentation

def GaudiMP.GMPBase.Reader.__init__ | ( |  | self,
|  |  | queues,
|  |  | events,
|  |  | params,
|  |  | subworkers
| ) |  |

Definition at line 649 of file GMPBase.py.

649
650 def __init__( self, queues, events, params, subworkers ) :
651 GMPComponent.__init__(self, 'Reader', -1, queues, events, params, subworkers )

## Member Function Documentation

def GaudiMP.GMPBase.Reader.DoFirstEvent | ( |  | self | ) |

Definition at line 671 of file GMPBase.py.

671
672 def DoFirstEvent( self ) :
673 # Do First Event ------------------------------------------------------
674 # Check Termination Criteria
675 startFirst = time.time()
676 self.log.info('Reader : First Event')
677 if self.nOut == self.evtMax :
678 self.log.info('evtMax( %i ) reached'%(self.evtMax))
679 self.lastEvent.set()
680 return SUCCESS
681 else :
682 # Continue to read, dump and send event
683 self.a.run(1)
684 if not bool(self.evt['/Event']) :
685 self.log.warning('No More Events! (So Far : %i)'%(self.nOut))
686 self.lastEvent.set()
687 return SUCCESS
688 else :
689 # Popluate TESSerializer list and send Event
690 if self.app == "Gauss":
691 lst = self.evt.getHistoNames()
692 else:
693 try :
694 lst = self.evt.getList()
695 if self.app == "DaVinci":
696 daqnode = self.evt.retrieveObject( '/Event/DAQ' ).registry()
697 setOwnership( daqnode, False )
698 self.evt.getList( daqnode, lst, daqnode.address().par() )
699 except :
700 self.log.critical('Reader could not acquire TES List!')
701 self.lastEvent.set()
702 return FAILURE
703 self.log.info('Reader : TES List : %i items'%(len(lst)))
704 for l in lst :
705 self.ts.addItem(l)
706 self.currentEvent = self.getEventNumber( )
707 tb = self.TS.Dump( )
708 self.log.info('First Event Sent')
709 self.evcom.send( (self.currentEvent, tb) )
710 self.nOut += 1
711 self.eventLoopSyncer.set()
712 self.evt.clearStore( )
713 self.firstEvTime = time.time()-startFirst
714 return SUCCESS

def GaudiMP.GMPBase.Reader.DumpEvent | ( |  | self | ) |

Definition at line 664 of file GMPBase.py.

664
665 def DumpEvent( self ) :
666 tb = TBufferFile( TBuffer.kWrite )
667 # print '----Reader dumping Buffer!!!'
668 self.ts.dumpBuffer( tb )
669 # print '\tBuffer Dumped, size : %i'%( tb.Length() )
670 return tb

def GaudiMP.GMPBase.Reader.Engine | ( |  | self | ) |

Definition at line 715 of file GMPBase.py.

715
716 def Engine( self ) :
717 # rename process
718 import os
719 import ctypes
720 libc = ctypes.CDLL('libc.so.6')
721 name = str(self.nodeType) + str(self.nodeID) + '\0'
722 libc.prctl(15,name,0,0,0)
723
724
725 startEngine = time.time()
726 self.log.name = 'Reader'
727 self.log.info('Reader Process starting')
728
729 self.Initialize()
730
731 # add the Histogram Collection Algorithm
732 self.a.addAlgorithm( CollectHistograms(self) )
733
734 self.log.info('Reader Beginning Distribution')
735 sc = self.DoFirstEvent( )
736 if sc.isSuccess() :
737 self.log.info('Reader First Event OK')
738 else :
739 self.log.critical('Reader Failed on First Event')
740 self.stat = FAILURE
741
742 # Do All Others -------------------------------------------------------
743 while True :
744 # Check Termination Criteria
745 if self.nOut == self.evtMax :
746 self.log.info('evtMax( %i ) reached'%(self.evtMax))
747 break
748 # Check Health
749 if not self.stat.isSuccess() :
750 self.log.critical( 'Reader is Damaged!' )
751 break
752 # Continue to read, dump and send event
753 t = time.time()
754 self.a.run(1)
755 self.rTime += (time.time()-t)
756 if not bool(self.evt['/Event']) :
757 self.log.warning('No More Events! (So Far : %i)'%(self.nOut))
758 break
759 self.currentEvent = self.getEventNumber( )
760 tb = self.TS.Dump( )
761 self.evcom.send( (self.currentEvent, tb) )
762 # clean up
763 self.nOut += 1
764 self.eventLoopSyncer.set()
765 self.evt.clearStore( )
766 self.log.info('Setting <Last> Event')
767 self.lastEvent.set()
768
769 # Finalize
770 self.log.info( 'Reader : Event Distribution complete.' )
771 self.evcom.finalize()
772 self.Finalize()
773 self.tTime = time.time() - startEngine
774 self.Report()
775
# =============================================================================

def GaudiMP.GMPBase.Reader.processConfiguration | ( |  | self | ) |

Definition at line 652 of file GMPBase.py.

652
653 def processConfiguration( self ) :
654 # Reader :
655 # No algorithms
656 # No output
657 # No histos
658 self.config[ 'ApplicationMgr' ].TopAlg = []
659 self.config[ 'ApplicationMgr' ].OutStream = []
660 if "HistogramPersistencySvc" in self.config.keys() :
661 self.config[ 'HistogramPersistencySvc' ].OutputFile = ''
662 self.config['MessageSvc'].Format = '[Reader]% F%18W%S%7W%R%T %0W%M'
663 self.evtMax = self.config[ 'ApplicationMgr' ].EvtMax

## Member Data Documentation

GaudiMP.GMPBase.Reader.app

Definition at line 689 of file GMPBase.py.

GaudiMP.GMPBase.Reader.currentEvent

Definition at line 705 of file GMPBase.py.

GaudiMP.GMPBase.Reader.evtMax

Definition at line 662 of file GMPBase.py.

GaudiMP.GMPBase.Reader.firstEvTime

Definition at line 712 of file GMPBase.py.

GaudiMP.GMPBase.Reader.nOut

Definition at line 676 of file GMPBase.py.

GaudiMP.GMPBase.Reader.stat

Definition at line 739 of file GMPBase.py.

GaudiMP.GMPBase.Reader.tTime

Definition at line 772 of file GMPBase.py.

The documentation for this class was generated from the following file:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiMP/python/GaudiMP/GMPBase.py