The Gaudi Framework  v36r6 (b1ee9983)
GaudiMP.GMPBase.Reader Class Reference
Inheritance diagram for GaudiMP.GMPBase.Reader:
Collaboration diagram for GaudiMP.GMPBase.Reader:

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 701 of file GMPBase.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 702 of file GMPBase.py.

702  def __init__(self, queues, events, params, subworkers):
703  GMPComponent.__init__(self, "Reader", -1, queues, events, params, subworkers)
704 

Member Function Documentation

◆ DoFirstEvent()

def GaudiMP.GMPBase.Reader.DoFirstEvent (   self)

Definition at line 724 of file GMPBase.py.

724  def DoFirstEvent(self):
725  # Do First Event ------------------------------------------------------
726  # Check Termination Criteria
727  startFirst = time.time()
728  self.log.info("Reader : First Event")
729  if self.nOut == self.evtMax:
730  self.log.info("evtMax( %i ) reached" % (self.evtMax))
731  self.lastEvent.set()
732  return SUCCESS
733  else:
734  # Continue to read, dump and send event
735  self.a.run(1)
736  if not bool(self.evt["/Event"]):
737  self.log.warning("No More Events! (So Far : %i)" % (self.nOut))
738  self.lastEvent.set()
739  return SUCCESS
740  else:
741  # Popluate TESSerializer list and send Event
742  if self.app == "Gauss":
743  lst = self.evt.getHistoNames()
744  else:
745  try:
746  lst = self.evt.getList()
747  if self.app == "DaVinci":
748  daqnode = self.evt.retrieveObject("/Event/DAQ").registry()
749  setOwnership(daqnode, False)
750  self.evt.getList(daqnode, lst, daqnode.address().par())
751  except:
752  self.log.critical("Reader could not acquire TES List!")
753  self.lastEvent.set()
754  return FAILURE
755  self.log.info("Reader : TES List : %i items" % (len(lst)))
756  for l in lst:
757  self.ts.addItem(l)
758  self.currentEvent = self.getEventNumber()
759  tb = self.TS.Dump()
760  self.log.info("First Event Sent")
761  self.evcom.send((self.currentEvent, tb))
762  self.nOut += 1
763  self.eventLoopSyncer.set()
764  self.evt.clearStore()
765  self.firstEvTime = time.time() - startFirst
766  return SUCCESS
767 

◆ DumpEvent()

def GaudiMP.GMPBase.Reader.DumpEvent (   self)

Definition at line 717 of file GMPBase.py.

717  def DumpEvent(self):
718  tb = TBufferFile(TBuffer.kWrite)
719  # print '----Reader dumping Buffer!!!'
720  self.ts.dumpBuffer(tb)
721  # print '\tBuffer Dumped, size : %i'%( tb.Length() )
722  return tb
723 

◆ Engine()

def GaudiMP.GMPBase.Reader.Engine (   self)

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 768 of file GMPBase.py.

768  def Engine(self):
769  # rename process
770  import ctypes
771  import os
772 
773  libc = ctypes.CDLL("libc.so.6")
774  name = str(self.nodeType) + str(self.nodeID) + "\0"
775  libc.prctl(15, name, 0, 0, 0)
776 
777  startEngine = time.time()
778  self.log.name = "Reader"
779  self.log.info("Reader Process starting")
780 
781  self.Initialize()
782 
783  # add the Histogram Collection Algorithm
784  self.a.addAlgorithm(CollectHistograms(self))
785 
786  self.log.info("Reader Beginning Distribution")
787  sc = self.DoFirstEvent()
788  if sc.isSuccess():
789  self.log.info("Reader First Event OK")
790  else:
791  self.log.critical("Reader Failed on First Event")
792  self.stat = FAILURE
793 
794  # Do All Others -------------------------------------------------------
795  while True:
796  # Check Termination Criteria
797  if self.nOut == self.evtMax:
798  self.log.info("evtMax( %i ) reached" % (self.evtMax))
799  break
800  # Check Health
801  if not self.stat.isSuccess():
802  self.log.critical("Reader is Damaged!")
803  break
804  # Continue to read, dump and send event
805  t = time.time()
806  self.a.run(1)
807  self.rTime += time.time() - t
808  if not bool(self.evt["/Event"]):
809  self.log.warning("No More Events! (So Far : %i)" % (self.nOut))
810  break
811  self.currentEvent = self.getEventNumber()
812  tb = self.TS.Dump()
813  self.evcom.send((self.currentEvent, tb))
814  # clean up
815  self.nOut += 1
816  self.eventLoopSyncer.set()
817  self.evt.clearStore()
818  self.log.info("Setting <Last> Event")
819  self.lastEvent.set()
820 
821  # Finalize
822  self.log.info("Reader : Event Distribution complete.")
823  self.evcom.finalize()
824  self.Finalize()
825  self.tTime = time.time() - startEngine
826  self.Report()
827 
828 
829 # =============================================================================
830 
831 

◆ processConfiguration()

def GaudiMP.GMPBase.Reader.processConfiguration (   self)

Reimplemented from GaudiMP.GMPBase.GMPComponent.

Definition at line 705 of file GMPBase.py.

705  def processConfiguration(self):
706  # Reader :
707  # No algorithms
708  # No output
709  # No histos
710  self.config["ApplicationMgr"].TopAlg = []
711  self.config["ApplicationMgr"].OutStream = []
712  if "HistogramPersistencySvc" in self.config.keys():
713  self.config["HistogramPersistencySvc"].OutputFile = ""
714  self.config["MessageSvc"].Format = "%-13s " % "[Reader]" + self.msgFormat
715  self.evtMax = self.config["ApplicationMgr"].EvtMax
716 

Member Data Documentation

◆ app

GaudiMP.GMPBase.Reader.app

Definition at line 742 of file GMPBase.py.

◆ currentEvent

GaudiMP.GMPBase.Reader.currentEvent

Definition at line 758 of file GMPBase.py.

◆ evtMax

GaudiMP.GMPBase.Reader.evtMax

Definition at line 715 of file GMPBase.py.

◆ firstEvTime

GaudiMP.GMPBase.Reader.firstEvTime

Definition at line 765 of file GMPBase.py.

◆ nOut

GaudiMP.GMPBase.Reader.nOut

Definition at line 729 of file GMPBase.py.

◆ stat

GaudiMP.GMPBase.Reader.stat

Definition at line 792 of file GMPBase.py.

◆ tTime

GaudiMP.GMPBase.Reader.tTime

Definition at line 825 of file GMPBase.py.


The documentation for this class was generated from the following file:
GaudiPython.Bindings.setOwnership
setOwnership
Definition: Bindings.py:136
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:483
GaudiPluginService.cpluginsvc.registry
def registry()
Definition: cpluginsvc.py:84
StringKeyEx.keys
list keys
Definition: StringKeyEx.py:67