| # 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.GMPComponent Class Reference
Inheritance diagram for GaudiMP.GMPBase.GMPComponent:
[legend]
Collaboration diagram for GaudiMP.GMPBase.GMPComponent:
[legend]

## Public Member Functions
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
| 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 393 of file GMPBase.py.

## Constructor & Destructor Documentation

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

Definition at line 400 of file GMPBase.py.

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

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

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

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

Definition at line 483 of file GMPBase.py.

483
484 def Engine( self ) :
485 # This will be the method carried out by the Node
486 # Different for all
487 pass

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

Definition at line 624 of file GMPBase.py.

624
625 def Finalize( self ) :
626 start = time.time()
627 self.a.stop()
628 self.a.finalize()
629 self.log.info( '%s-%i Finalized'%(self.nodeType, self.nodeID) )
630 self.finalEvent.set()
631 self.fTime = time.time() - start

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

Definition at line 522 of file GMPBase.py.

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

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

Definition at line 562 of file GMPBase.py.

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

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

Definition at line 608 of file GMPBase.py.

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

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

Definition at line 516 of file GMPBase.py.

516
517 def LoadTES( self, tbufferfile ) :
518 root = gbl.DataObject()
519 setOwnership(root, False)
520 self.evt.setRoot( '/Event', root )
521 self.ts.loadBuffer(tbufferfile)

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

Definition at line 488 of file GMPBase.py.

488
489 def processConfiguration( self ) :
490 # Different for all ; customize Configuration for multicore
491 pass

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

Definition at line 632 of file GMPBase.py.

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

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

Definition at line 492 of file GMPBase.py.

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

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

Definition at line 435 of file GMPBase.py.

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

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

Definition at line 511 of file GMPBase.py.

511
512 def StartGaudiPython( self ) :
513 self.a.initialize()
514 self.a.start()
515 return SUCCESS

## Member Data Documentation

GaudiMP.GMPBase.GMPComponent.a

Definition at line 495 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.app

Definition at line 430 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.cntr

Definition at line 618 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.currentEvent

Definition at line 423 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evcom

Definition at line 443 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evcoms

Definition at line 447 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evt

Definition at line 501 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.finalEvent

Definition at line 414 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.firstEvTime

Definition at line 473 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fq

Definition at line 455 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fsr

Definition at line 503 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fTime

Definition at line 472 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.hq

Definition at line 453 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.hvt

Definition at line 502 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.inc

Definition at line 504 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.iTime

Definition at line 470 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.lastEvent

Definition at line 415 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.log

Definition at line 418 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nIn

Definition at line 459 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nodeID

Definition at line 420 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nodeType

Definition at line 410 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nOut

Definition at line 460 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.num

Definition at line 427 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.pers

Definition at line 505 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.proc

Definition at line 476 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.queues

Definition at line 426 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.rTime

Definition at line 471 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.stat

Definition at line 463 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.subworkers

Definition at line 419 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.ts

Definition at line 506 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.TS

Definition at line 507 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.tTime

Definition at line 474 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