| The Gaudi Framework v32r1 (f65d50dc)

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__ (self, queues, events, params, subworkers)
def | processConfiguration (self)
def | DumpEvent (self)
def | DoFirstEvent (self)
def | Engine (self)
Public Member Functions inherited from GaudiMP.GMPBase.GMPComponent
def | __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
def | Start (self)
def | SetupGaudiPython (self)
def | StartGaudiPython (self)
def | LoadTES (self, tbufferfile)
def | getEventNumber (self)
def | IdentifyWriters (self)
def | dumpHistograms (self)
def | Initialize (self)
def | Finalize (self)
def | Report (self)

## Public Attributes
| evtMax
| nOut
| app
| currentEvent
| firstEvTime
| stat
| tTime
Public Attributes inherited from GaudiMP.GMPBase.GMPComponent
| nodeType
| finalEvent
| lastEvent
| log
| subworkers
| nodeID
| msgFormat
| 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 670 of file GMPBase.py.

## Constructor & Destructor Documentation

## ◆ __init__()

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

Definition at line 671 of file GMPBase.py.

671 def __init__(self, queues, events, params, subworkers):
672 GMPComponent.__init__(self, 'Reader', -1, queues, events, params,
673 subworkers)
674

## Member Function Documentation

## ◆ DoFirstEvent()

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

Definition at line 695 of file GMPBase.py.

695 def DoFirstEvent(self):
696 # Do First Event ------------------------------------------------------
697 # Check Termination Criteria
698 startFirst = time.time()
699 self.log.info('Reader : First Event')
700 if self.nOut == self.evtMax:
701 self.log.info('evtMax( %i ) reached' % (self.evtMax))
702 self.lastEvent.set()
703 return SUCCESS
704 else:
705 # Continue to read, dump and send event
706 self.a.run(1)
707 if not bool(self.evt['/Event']):
708 self.log.warning('No More Events! (So Far : %i)' % (self.nOut))
709 self.lastEvent.set()
710 return SUCCESS
711 else:
712 # Popluate TESSerializer list and send Event
713 if self.app == "Gauss":
714 lst = self.evt.getHistoNames()
715 else:
716 try:
717 lst = self.evt.getList()
718 if self.app == "DaVinci":
719 daqnode = self.evt.retrieveObject(
720 '/Event/DAQ').registry()
721 setOwnership(daqnode, False)
722 self.evt.getList(daqnode, lst,
723 daqnode.address().par())
724 except:
725 self.log.critical('Reader could not acquire TES List!')
726 self.lastEvent.set()
727 return FAILURE
728 self.log.info('Reader : TES List : %i items' % (len(lst)))
729 for l in lst:
730 self.ts.addItem(l)
731 self.currentEvent = self.getEventNumber()
732 tb = self.TS.Dump()
733 self.log.info('First Event Sent')
734 self.evcom.send((self.currentEvent, tb))
735 self.nOut += 1
736 self.eventLoopSyncer.set()
737 self.evt.clearStore()
738 self.firstEvTime = time.time() - startFirst
739 return SUCCESS
740
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:465
GaudiPluginService.cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:71
GaudiPython.Bindings.setOwnership
setOwnership
Definition: Bindings.py:87

## ◆ DumpEvent()

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

Definition at line 688 of file GMPBase.py.

688 def DumpEvent(self):
689 tb = TBufferFile(TBuffer.kWrite)
690 # print '----Reader dumping Buffer!!!'
691 self.ts.dumpBuffer(tb)
692 # print '\tBuffer Dumped, size : %i'%( tb.Length() )
693 return tb
694

## ◆ Engine()

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

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 741 of file GMPBase.py.

741 def Engine(self):
742 # rename process
743 import os
744 import ctypes
745 libc = ctypes.CDLL('libc.so.6')
746 name = str(self.nodeType) + str(self.nodeID) + '\0'
747 libc.prctl(15, name, 0, 0, 0)
748
749 startEngine = time.time()
750 self.log.name = 'Reader'
751 self.log.info('Reader Process starting')
752
753 self.Initialize()
754
755 # add the Histogram Collection Algorithm
756 self.a.addAlgorithm(CollectHistograms(self))
757
758 self.log.info('Reader Beginning Distribution')
759 sc = self.DoFirstEvent()
760 if sc.isSuccess():
761 self.log.info('Reader First Event OK')
762 else:
763 self.log.critical('Reader Failed on First Event')
764 self.stat = FAILURE
765
766 # Do All Others -------------------------------------------------------
767 while True:
768 # Check Termination Criteria
769 if self.nOut == self.evtMax:
770 self.log.info('evtMax( %i ) reached' % (self.evtMax))
771 break
772 # Check Health
773 if not self.stat.isSuccess():
774 self.log.critical('Reader is Damaged!')
775 break
776 # Continue to read, dump and send event
777 t = time.time()
778 self.a.run(1)
779 self.rTime += (time.time() - t)
780 if not bool(self.evt['/Event']):
781 self.log.warning('No More Events! (So Far : %i)' % (self.nOut))
782 break
783 self.currentEvent = self.getEventNumber()
784 tb = self.TS.Dump()
785 self.evcom.send((self.currentEvent, tb))
786 # clean up
787 self.nOut += 1
788 self.eventLoopSyncer.set()
789 self.evt.clearStore()
790 self.log.info('Setting <Last> Event')
791 self.lastEvent.set()
792
793 # Finalize
794 self.log.info('Reader : Event Distribution complete.')
795 self.evcom.finalize()
796 self.Finalize()
797 self.tTime = time.time() - startEngine
798 self.Report()
799
800
801 # =============================================================================
802
803

## ◆ processConfiguration()

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

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 675 of file GMPBase.py.

675 def processConfiguration(self):
676 # Reader :
677 # No algorithms
678 # No output
679 # No histos
680 self.config['ApplicationMgr'].TopAlg = []
681 self.config['ApplicationMgr'].OutStream = []
682 if "HistogramPersistencySvc" in self.config.keys():
683 self.config['HistogramPersistencySvc'].OutputFile = ''
684 self.config['MessageSvc'].Format = '%-13s ' % '[Reader]' + \
685 self.msgFormat
686 self.evtMax = self.config['ApplicationMgr'].EvtMax
687

## Member Data Documentation

## ◆ app

GaudiMP.GMPBase.Reader.app

Definition at line 713 of file GMPBase.py.

## ◆ currentEvent

GaudiMP.GMPBase.Reader.currentEvent

Definition at line 731 of file GMPBase.py.

## ◆ evtMax

GaudiMP.GMPBase.Reader.evtMax

Definition at line 686 of file GMPBase.py.

## ◆ firstEvTime

GaudiMP.GMPBase.Reader.firstEvTime

Definition at line 738 of file GMPBase.py.

## ◆ nOut

GaudiMP.GMPBase.Reader.nOut

Definition at line 700 of file GMPBase.py.

## ◆ stat

GaudiMP.GMPBase.Reader.stat

Definition at line 764 of file GMPBase.py.

## ◆ tTime

GaudiMP.GMPBase.Reader.tTime

Definition at line 797 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py