| The Gaudi Framework v28r2p1 (f1a77ff4)

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

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

Public Member Functions | Public Attributes | List of all members
GaudiMP.GMPBase.GMPComponent Class Reference
Inheritance diagram for GaudiMP.GMPBase.GMPComponent:
[legend]
Collaboration diagram for GaudiMP.GMPBase.GMPComponent:
[legend]

## Public Member Functions
def | __init__ (self, nodeType, nodeID, queues, events, params, subworkers)
def | Start (self)
def | Engine (self)
def | processConfiguration (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
| 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 392 of file GMPBase.py.

## Constructor & Destructor Documentation

def GaudiMP.GMPBase.GMPComponent.__init__ | ( |  | self,
|  |  | nodeType,
|  |  | nodeID,
|  |  | queues,
|  |  | events,
|  |  | params,
|  |  | subworkers
| ) |  |

Definition at line 399 of file GMPBase.py.

399 def __init__( self, nodeType, nodeID, queues, events, params, subworkers ) :
400 # declare a Gaudi MultiProcessing Node
401 # the nodeType is going to be one of Reader, Worker, Writer
402 # qPair is going to be a tuple of ( qin, qout )
403 # for sending and receiving
404 # if nodeType is "Writer", it will be a list of qPairs,
405 # as there's one queue-in from each Worker
406 #
407 # params is a tuple of (nWorkers, config, log)
408
409 self.nodeType = nodeType
410 current_process().name = nodeType
411
412 # Synchronisation Event() objects for keeping track of the system
413 self.initEvent, eventLoopSyncer, self.finalEvent = events
414 self.eventLoopSyncer, self.lastEvent = eventLoopSyncer # unpack tuple
415
416 # necessary for knowledge of the system
417 self.nWorkers, self.sEvent, self.config, self.log = params
418 self.subworkers = subworkers
419 self.nodeID = nodeID
420
421 # describe the state of the node by the current Event Number
422 self.currentEvent = None
423
424 # Unpack the Queues : (events, histos, filerecords)
425 self.queues = queues
426 self.num = 0
427
428 ks = self.config.keys()
429 self.app = None
430 list = ["Brunel", "DaVinci", "Boole", "Gauss"]
431 for k in list:
432 if k in ks: self.app = k
433
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.GMPComponent.__init__
def __init__(self, nodeType, nodeID, queues, events, params, subworkers)
Definition: GMPBase.py:399
GaudiMP.GMPBase.GMPComponent.log
log
Definition: GMPBase.py:417
GaudiMP.GMPBase.GMPComponent.num
num
Definition: GMPBase.py:426
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:409
GaudiMP.GMPBase.GMPComponent.queues
queues
Definition: GMPBase.py:425
GaudiMP.GMPBase.GMPComponent.currentEvent
currentEvent
Definition: GMPBase.py:422
GaudiMP.GMPBase.GMPComponent.app
app
Definition: GMPBase.py:429
GaudiMP.GMPBase.GMPComponent.subworkers
subworkers
Definition: GMPBase.py:418
GaudiMP.GMPBase.GMPComponent.finalEvent
finalEvent
Definition: GMPBase.py:413
GaudiMP.GMPBase.GMPComponent.lastEvent
lastEvent
Definition: GMPBase.py:414

## Member Function Documentation

def GaudiMP.GMPBase.GMPComponent.dumpHistograms | ( |  | self | ) |

    Method used by the GaudiPython algorithm CollectHistos
    to obtain a dictionary of form { path : object }
    representing the Histogram Store

Definition at line 585 of file GMPBase.py.

585 def dumpHistograms( self ) :
586 '''
587 Method used by the GaudiPython algorithm CollectHistos
588 to obtain a dictionary of form { path : object }
589 representing the Histogram Store
590 '''
591 nlist = self.hvt.getHistoNames( )
592 histDict = {}
593 objects = 0 ; histos = 0
594 if nlist :
595 for n in nlist :
596 o = self.hvt[ n ]
597 if type(o) in aidatypes :
598 o = aida2root(o)
599 histos += 1
600 else :
601 objects += 1
602 histDict[ n ] = o
603 else :
604 print 'WARNING : no histograms to recover?'
605 return histDict
606
GaudiMP.GMPBase.GMPComponent.dumpHistograms
def dumpHistograms(self)
Definition: GMPBase.py:585
gaudirun.type
type
Definition: gaudirun.py:125
GaudiMP.GMPBase.GMPComponent.hvt
hvt
Definition: GMPBase.py:501
GaudiMP.GMPBase.aida2root
aida2root
Definition: GMPBase.py:55

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

Definition at line 482 of file GMPBase.py.

482 def Engine( self ) :
483 # This will be the method carried out by the Node
484 # Different for all
485 pass
486
GaudiMP.GMPBase.GMPComponent.Engine
def Engine(self)
Definition: GMPBase.py:482

def GaudiMP.GMPBase.GMPComponent.Finalize | ( |  | self | ) |

Definition at line 623 of file GMPBase.py.

623 def Finalize( self ) :
624 start = time.time()
625 self.a.stop()
626 self.a.finalize()
627 self.log.info( '%s-%i Finalized'%(self.nodeType, self.nodeID) )
628 self.finalEvent.set()
629 self.fTime = time.time() - start
630
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:409
GaudiMP.GMPBase.GMPComponent.Finalize
def Finalize(self)
Definition: GMPBase.py:623
GaudiMP.GMPBase.GMPComponent.fTime
fTime
Definition: GMPBase.py:471

def GaudiMP.GMPBase.GMPComponent.getEventNumber | ( |  | self | ) |

Definition at line 521 of file GMPBase.py.

521 def getEventNumber( self ) :
522 if self.app != 'Gauss':
523 # Using getList or getHistoNames can result in the EventSelector
524 # re-initialising connection to RootDBase, which costs a lot of
525 # time... try to build a set of Header paths??
526
527 # First Attempt : Unpacked Event Data
528 lst = [ '/Event/Gen/Header',
529 '/Event/Rec/Header' ]
530 for l in lst :
531 path = l
532 try :
533 n = self.evt[path].evtNumber()
534
535 return n
536 except :
537 # No evt number at this path
538 continue
539
540 # second attepmt : try DAQ/RawEvent data
541 # The Evt Number is in bank type 16, bank 0, data pt 4
542 try :
543 n = self.evt['/Event/DAQ/RawEvent'].banks(16)[0].data()[4]
544
545 return n
546 except :
547 pass
548
549 # Default Action
550 if self.nIn > 0 or self.nOut > 0 :
551 pass
552 else :
553 self.log.warning('Could not determine Event Number')
554 return -1
555 else:
556 if self.nodeID == -1:
557 self.num = self.num + 1
558
559 return self.num
560
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.GMPComponent.num
num
Definition: GMPBase.py:426
GaudiMP.GMPBase.GMPComponent.nOut
nOut
Definition: GMPBase.py:459
GaudiMP.GMPBase.GMPComponent.app
app
Definition: GMPBase.py:429
GaudiMP.GMPBase.GMPComponent.getEventNumber
def getEventNumber(self)
Definition: GMPBase.py:521
GaudiMP.GMPBase.GMPComponent.nIn
nIn
Definition: GMPBase.py:458
GaudiMP.GMPBase.GMPComponent.evt
evt
Definition: GMPBase.py:500

def GaudiMP.GMPBase.GMPComponent.IdentifyWriters | ( |  | self | ) |

Definition at line 561 of file GMPBase.py.

561 def IdentifyWriters( self ) :
562 #
563 # Identify Writers in the Configuration
564 #
565 d = {}
566 keys = [ "events", "records", "tuples", "histos" ]
567 for k in keys :
568 d[k] = []
569
570 # Identify Writers and Classify
571 wkeys = WRITERTYPES.keys()
572 for v in self.config.values() :
573 if v.__class__.__name__ in wkeys :
574 writerType = WRITERTYPES[ v.__class__.__name__ ]
575 d[writerType].append( MiniWriter(v, writerType, self.config) )
576 if self.nodeID == 0 :
577 self.log.info('Writer Found : %s'%(v.name()))
578
579 # Now Check for the Histogram Service
580 if 'HistogramPersistencySvc' in self.config.keys() :
581 hfile =self.config['HistogramPersistencySvc'].getProp('OutputFile')
582 d[ "histos" ].append( hfile )
583 return d
584
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.MiniWriter
Definition: GMPBase.py:81
GaudiMP.GMPBase.GMPComponent.IdentifyWriters
def IdentifyWriters(self)
Definition: GMPBase.py:561

def GaudiMP.GMPBase.GMPComponent.Initialize | ( |  | self | ) |

Definition at line 607 of file GMPBase.py.

607 def Initialize( self ) :
608 start = time.time()
609 self.processConfiguration( )
610 self.SetupGaudiPython( )
611 self.initEvent.set()
612 self.StartGaudiPython( )
613
614 if self.app == 'Gauss':
615
616 tool = self.a.tool( "ToolSvc.EvtCounter" )
617 self.cntr = InterfaceCast( gbl.IEventCounter )( tool.getInterface() )
618 else:
619 self.cntr = None
620
621 self.iTime = time.time() - start
622
GaudiMP.GMPBase.GMPComponent.StartGaudiPython
def StartGaudiPython(self)
Definition: GMPBase.py:510
GaudiMP.GMPBase.GMPComponent.app
app
Definition: GMPBase.py:429
GaudiMP.GMPBase.GMPComponent.processConfiguration
def processConfiguration(self)
Definition: GMPBase.py:487
GaudiMP.GMPBase.GMPComponent.cntr
cntr
Definition: GMPBase.py:617
GaudiMP.GMPBase.GMPComponent.Initialize
def Initialize(self)
Definition: GMPBase.py:607
GaudiMP.GMPBase.GMPComponent.iTime
iTime
Definition: GMPBase.py:469
GaudiMP.GMPBase.GMPComponent.SetupGaudiPython
def SetupGaudiPython(self)
Definition: GMPBase.py:491

def GaudiMP.GMPBase.GMPComponent.LoadTES | ( |  | self,
|  |  | tbufferfile
| ) |  |

Definition at line 515 of file GMPBase.py.

515 def LoadTES( self, tbufferfile ) :
516 root = gbl.DataObject()
517 setOwnership(root, False)
518 self.evt.setRoot( '/Event', root )
519 self.ts.loadBuffer(tbufferfile)
520
GaudiMP.GMPBase.GMPComponent.LoadTES
def LoadTES(self, tbufferfile)
Definition: GMPBase.py:515
GaudiPython.Bindings.setOwnership
setOwnership
Definition: Bindings.py:80

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

Definition at line 487 of file GMPBase.py.

487 def processConfiguration( self ) :
488 # Different for all ; customize Configuration for multicore
489 pass
490
GaudiMP.GMPBase.GMPComponent.processConfiguration
def processConfiguration(self)
Definition: GMPBase.py:487

def GaudiMP.GMPBase.GMPComponent.Report | ( |  | self | ) |

Definition at line 631 of file GMPBase.py.

631 def Report( self ) :
632 self.log.name = "%s-%i Audit"%(self.nodeType, self.nodeID)
633 allTime = "Alive Time : %5.2f"%(self.tTime)
634 initTime = "Init Time : %5.2f"%(self.iTime)
635 frstTime = "1st Event Time : %5.2f"%(self.firstEvTime)
636 runTime = "Run Time : %5.2f"%(self.rTime)
637 finTime = "Finalise Time : %5.2f"%(self.fTime)
638 tup = ( allTime, initTime, frstTime, runTime, finTime )
639 for t in tup :
640 self.log.info( t )
641 self.log.name = "%s-%i"%(self.nodeType, self.nodeID)
642 # and report from the TESSerializer
643 self.TS.Report()
644
645 # =============================================================================
646
GaudiMP.GMPBase.GMPComponent.tTime
tTime
Definition: GMPBase.py:473
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.GMPComponent.Report
def Report(self)
Definition: GMPBase.py:631
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:409
GaudiMP.GMPBase.GMPComponent.rTime
rTime
Definition: GMPBase.py:470
GaudiMP.GMPBase.GMPComponent.firstEvTime
firstEvTime
Definition: GMPBase.py:472
GaudiMP.GMPBase.GMPComponent.fTime
fTime
Definition: GMPBase.py:471
GaudiMP.GMPBase.GMPComponent.iTime
iTime
Definition: GMPBase.py:469

def GaudiMP.GMPBase.GMPComponent.SetupGaudiPython | ( |  | self | ) |

Definition at line 491 of file GMPBase.py.

491 def SetupGaudiPython( self ) :
492 # This method will initialize the GaudiPython Tools
493 # such as the AppMgr and so on
494 self.a = AppMgr()
495 if SMAPS :
496 from AlgSmapShot import SmapShot
497 smapsLog = self.nodeType+'-'+str(self.nodeID)+'.smp'
498 ss = SmapShot( logname=smapsLog )
499 self.a.addAlgorithm( ss )
500 self.evt = self.a.evtsvc()
501 self.hvt = self.a.histsvc()
502 self.fsr = self.a.filerecordsvc()
503 self.inc = self.a.service('IncidentSvc','IIncidentSvc')
504 self.pers = self.a.service( 'EventPersistencySvc', 'IAddressCreator' )
505 self.ts = gbl.GaudiMP.TESSerializer( self.evt._idp, self.pers )
506 self.TS = TESSerializer( self.ts, self.evt,
507 self.nodeType, self.nodeID, self.log )
508 return SUCCESS
509
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.TESSerializer
Definition: GMPBase.py:313
GaudiMP.GMPBase.GMPComponent.fsr
fsr
Definition: GMPBase.py:502
GaudiMP.GMPBase.GMPComponent.log
log
Definition: GMPBase.py:417
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:409
GaudiMP.GMPBase.GMPComponent.pers
pers
Definition: GMPBase.py:504
GaudiMP.GMPBase.GMPComponent.inc
inc
Definition: GMPBase.py:503
GaudiMP.GMPBase.GMPComponent.hvt
hvt
Definition: GMPBase.py:501
GaudiMP.GMPBase.GMPComponent.a
a
Definition: GMPBase.py:494
GaudiMP.GMPBase.GMPComponent.ts
ts
Definition: GMPBase.py:505
GaudiMP.GMPBase.GMPComponent.SetupGaudiPython
def SetupGaudiPython(self)
Definition: GMPBase.py:491
GaudiMP.GMPBase.GMPComponent.evt
evt
Definition: GMPBase.py:500
GaudiMP.GMPBase.GMPComponent.TS
TS
Definition: GMPBase.py:506

def GaudiMP.GMPBase.GMPComponent.Start | ( |  | self | ) |

Definition at line 434 of file GMPBase.py.

434 def Start( self ) :
435 # define the separate process
436 qPair, histq, fq = self.queues
437
438 # Set up the Queue Mechanisms ( Event Communicators )
439 if self.nodeType == 'Reader' or self.nodeType == 'Worker' :
440 # Reader or Worker Node
441 qin, qout = qPair
442 self.evcom = EventCommunicator( self, qin, qout )
443 else :
444 # Writer : many queues in, no queue out
445 assert self.nodeType == 'Writer'
446 self.evcoms = []
447 qsin = qPair[0]
448 for q in qsin :
449 ec = EventCommunicator( self, q, None )
450 self.evcoms.append( ec )
451 # Histogram Queue
452 self.hq = histq
453 # FileRecords Queue
454 self.fq = fq
455
456 # Universal Counters (available to all nodes)
457 # Use sensibly!!!
458 self.nIn = 0
459 self.nOut = 0
460
461 # Status Flag (possibly remove later)
462 self.stat = SUCCESS
463
464 # Set logger name
465 self.log.name = '%s-%i'%(self.nodeType, self.nodeID)
466
467 # Heuristic variables
468 # time for init, run, final, firstEventTime, totalTime
469 self.iTime = 0.0
470 self.rTime = 0.0
471 self.fTime = 0.0
472 self.firstEvTime = 0.0
473 self.tTime = 0.0
474
475 self.proc = Process( target=self.Engine )
476 # Fork and start the separate process
477 self.proc.start()
478
479
480
481
GaudiMP.GMPBase.GMPComponent.tTime
tTime
Definition: GMPBase.py:473
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:419
GaudiMP.GMPBase.GMPComponent.Engine
def Engine(self)
Definition: GMPBase.py:482
GaudiMP.GMPBase.GMPComponent.nOut
nOut
Definition: GMPBase.py:459
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:409
GaudiMP.GMPBase.GMPComponent.rTime
rTime
Definition: GMPBase.py:470
GaudiMP.GMPBase.EventCommunicator
Definition: GMPBase.py:227
GaudiMP.GMPBase.GMPComponent.queues
queues
Definition: GMPBase.py:425
GaudiMP.GMPBase.GMPComponent.evcom
evcom
Definition: GMPBase.py:442
GaudiMP.GMPBase.GMPComponent.fq
fq
Definition: GMPBase.py:454
GaudiMP.GMPBase.GMPComponent.proc
proc
Definition: GMPBase.py:475
GaudiMP.GMPBase.GMPComponent.hq
hq
Definition: GMPBase.py:452
GaudiMP.GMPBase.GMPComponent.firstEvTime
firstEvTime
Definition: GMPBase.py:472
GaudiMP.GMPBase.GMPComponent.fTime
fTime
Definition: GMPBase.py:471
GaudiMP.GMPBase.GMPComponent.stat
stat
Definition: GMPBase.py:462
GaudiMP.GMPBase.GMPComponent.nIn
nIn
Definition: GMPBase.py:458
GaudiMP.GMPBase.GMPComponent.Start
def Start(self)
Definition: GMPBase.py:434
GaudiMP.GMPBase.GMPComponent.iTime
iTime
Definition: GMPBase.py:469
GaudiMP.GMPBase.GMPComponent.evcoms
evcoms
Definition: GMPBase.py:446

def GaudiMP.GMPBase.GMPComponent.StartGaudiPython | ( |  | self | ) |

Definition at line 510 of file GMPBase.py.

510 def StartGaudiPython( self ) :
511 self.a.initialize()
512 self.a.start()
513 return SUCCESS
514
GaudiMP.GMPBase.GMPComponent.StartGaudiPython
def StartGaudiPython(self)
Definition: GMPBase.py:510

## Member Data Documentation

GaudiMP.GMPBase.GMPComponent.a

Definition at line 494 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.app

Definition at line 429 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.cntr

Definition at line 617 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.currentEvent

Definition at line 422 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evcom

Definition at line 442 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evcoms

Definition at line 446 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evt

Definition at line 500 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.finalEvent

Definition at line 413 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.firstEvTime

Definition at line 472 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fq

Definition at line 454 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fsr

Definition at line 502 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fTime

Definition at line 471 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.hq

Definition at line 452 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.hvt

Definition at line 501 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.inc

Definition at line 503 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.iTime

Definition at line 469 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.lastEvent

Definition at line 414 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.log

Definition at line 417 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nIn

Definition at line 458 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nodeID

Definition at line 419 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nodeType

Definition at line 409 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nOut

Definition at line 459 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.num

Definition at line 426 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.pers

Definition at line 504 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.proc

Definition at line 475 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.queues

Definition at line 425 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.rTime

Definition at line 470 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.stat

Definition at line 462 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.subworkers

Definition at line 418 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.ts

Definition at line 505 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.TS

Definition at line 506 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.tTime

Definition at line 473 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py