| The Gaudi Framework v30r0 (c919700c)

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

## Constructor & Destructor Documentation

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

Definition at line 420 of file GMPBase.py.

420 def __init__(self, nodeType, nodeID, queues, events, params, subworkers):
421 # declare a Gaudi MultiProcessing Node
422 # the nodeType is going to be one of Reader, Worker, Writer
423 # qPair is going to be a tuple of ( qin, qout )
424 # for sending and receiving
425 # if nodeType is "Writer", it will be a list of qPairs,
426 # as there's one queue-in from each Worker
427 #
428 # params is a tuple of (nWorkers, config, log)
429
430 self.nodeType = nodeType
431 current_process().name = nodeType
432
433 # Synchronisation Event() objects for keeping track of the system
434 self.initEvent, eventLoopSyncer, self.finalEvent = events
435 self.eventLoopSyncer, self.lastEvent = eventLoopSyncer # unpack tuple
436
437 # necessary for knowledge of the system
438 self.nWorkers, self.sEvent, self.config, self.log = params
439 self.subworkers = subworkers
440 self.nodeID = nodeID
441
442 # describe the state of the node by the current Event Number
443 self.currentEvent = None
444
445 # Unpack the Queues : (events, histos, filerecords)
446 self.queues = queues
447 self.num = 0
448
449 ks = self.config.keys()
450 self.app = None
451 list = ["Brunel", "DaVinci", "Boole", "Gauss"]
452 for k in list:
453 if k in ks:
454 self.app = k
455
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:440
GaudiMP.GMPBase.GMPComponent.__init__
def __init__(self, nodeType, nodeID, queues, events, params, subworkers)
Definition: GMPBase.py:420
GaudiMP.GMPBase.GMPComponent.log
log
Definition: GMPBase.py:438
GaudiMP.GMPBase.GMPComponent.num
num
Definition: GMPBase.py:447
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:430
GaudiMP.GMPBase.GMPComponent.queues
queues
Definition: GMPBase.py:446
GaudiMP.GMPBase.GMPComponent.currentEvent
currentEvent
Definition: GMPBase.py:443
GaudiMP.GMPBase.GMPComponent.app
app
Definition: GMPBase.py:450
GaudiMP.GMPBase.GMPComponent.subworkers
subworkers
Definition: GMPBase.py:439
GaudiMP.GMPBase.GMPComponent.finalEvent
finalEvent
Definition: GMPBase.py:434
GaudiMP.GMPBase.GMPComponent.lastEvent
lastEvent
Definition: GMPBase.py:435

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

605 def dumpHistograms(self):
606 '''
607 Method used by the GaudiPython algorithm CollectHistos
608 to obtain a dictionary of form { path : object }
609 representing the Histogram Store
610 '''
611 nlist = self.hvt.getHistoNames()
612 histDict = {}
613 objects = 0
614 histos = 0
615 if nlist:
616 for n in nlist:
617 o = self.hvt[n]
618 if type(o) in aidatypes:
619 o = aida2root(o)
620 histos += 1
621 else:
622 objects += 1
623 histDict[n] = o
624 else:
625 print 'WARNING : no histograms to recover?'
626 return histDict
627
GaudiMP.GMPBase.GMPComponent.dumpHistograms
def dumpHistograms(self)
Definition: GMPBase.py:605
gaudirun.type
type
Definition: gaudirun.py:133
GaudiMP.GMPBase.GMPComponent.hvt
hvt
Definition: GMPBase.py:520
GaudiMP.GMPBase.aida2root
aida2root
Definition: GMPBase.py:57

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

Definition at line 501 of file GMPBase.py.

501 def Engine(self):
502 # This will be the method carried out by the Node
503 # Different for all
504 pass
505
GaudiMP.GMPBase.GMPComponent.Engine
def Engine(self)
Definition: GMPBase.py:501

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

Definition at line 644 of file GMPBase.py.

644 def Finalize(self):
645 start = time.time()
646 self.a.stop()
647 self.a.finalize()
648 self.log.info('%s-%i Finalized' % (self.nodeType, self.nodeID))
649 self.finalEvent.set()
650 self.fTime = time.time() - start
651
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:440
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:430
GaudiMP.GMPBase.GMPComponent.Finalize
def Finalize(self)
Definition: GMPBase.py:644
GaudiMP.GMPBase.GMPComponent.fTime
fTime
Definition: GMPBase.py:493

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

Definition at line 540 of file GMPBase.py.

540 def getEventNumber(self):
541 if self.app != 'Gauss':
542 # Using getList or getHistoNames can result in the EventSelector
543 # re-initialising connection to RootDBase, which costs a lot of
544 # time... try to build a set of Header paths??
545
546 # First Attempt : Unpacked Event Data
547 lst = ['/Event/Gen/Header',
548 '/Event/Rec/Header']
549 for l in lst:
550 path = l
551 try:
552 n = self.evt[path].evtNumber()
553
554 return n
555 except:
556 # No evt number at this path
557 continue
558
559 # second attepmt : try DAQ/RawEvent data
560 # The Evt Number is in bank type 16, bank 0, data pt 4
561 try:
562 n = self.evt['/Event/DAQ/RawEvent'].banks(16)[0].data()[4]
563
564 return n
565 except:
566 pass
567
568 # Default Action
569 if self.nIn > 0 or self.nOut > 0:
570 pass
571 else:
572 self.log.warning('Could not determine Event Number')
573 return -1
574 else:
575 if self.nodeID == -1:
576 self.num = self.num + 1
577
578 return self.num
579
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:440
GaudiMP.GMPBase.GMPComponent.num
num
Definition: GMPBase.py:447
GaudiMP.GMPBase.GMPComponent.nOut
nOut
Definition: GMPBase.py:481
GaudiMP.GMPBase.GMPComponent.app
app
Definition: GMPBase.py:450
GaudiMP.GMPBase.GMPComponent.getEventNumber
def getEventNumber(self)
Definition: GMPBase.py:540
GaudiMP.GMPBase.GMPComponent.nIn
nIn
Definition: GMPBase.py:480
GaudiMP.GMPBase.GMPComponent.evt
evt
Definition: GMPBase.py:519

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

Definition at line 580 of file GMPBase.py.

580 def IdentifyWriters(self):
581 #
582 # Identify Writers in the Configuration
583 #
584 d = {}
585 keys = ["events", "records", "tuples", "histos"]
586 for k in keys:
587 d[k] = []
588
589 # Identify Writers and Classify
590 wkeys = WRITERTYPES.keys()
591 for v in self.config.values():
592 if v.__class__.__name__ in wkeys:
593 writerType = WRITERTYPES[v.__class__.__name__]
594 d[writerType].append(MiniWriter(v, writerType, self.config))
595 if self.nodeID == 0:
596 self.log.info('Writer Found : %s' % (v.name()))
597
598 # Now Check for the Histogram Service
599 if 'HistogramPersistencySvc' in self.config.keys():
600 hfile = self.config['HistogramPersistencySvc'].getProp(
601 'OutputFile')
602 d["histos"].append(hfile)
603 return d
604
GaudiMP.GMPBase.MiniWriter
Definition: GMPBase.py:84
GaudiMP.GMPBase.GMPComponent.IdentifyWriters
def IdentifyWriters(self)
Definition: GMPBase.py:580

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

Definition at line 628 of file GMPBase.py.

628 def Initialize(self):
629 start = time.time()
630 self.processConfiguration()
631 self.SetupGaudiPython()
632 self.initEvent.set()
633 self.StartGaudiPython()
634
635 if self.app == 'Gauss':
636
637 tool = self.a.tool("ToolSvc.EvtCounter")
638 self.cntr = InterfaceCast(gbl.IEventCounter)(tool.getInterface())
639 else:
640 self.cntr = None
641
642 self.iTime = time.time() - start
643
GaudiMP.GMPBase.GMPComponent.StartGaudiPython
def StartGaudiPython(self)
Definition: GMPBase.py:529
GaudiMP.GMPBase.GMPComponent.app
app
Definition: GMPBase.py:450
GaudiMP.GMPBase.GMPComponent.processConfiguration
def processConfiguration(self)
Definition: GMPBase.py:506
GaudiMP.GMPBase.GMPComponent.cntr
cntr
Definition: GMPBase.py:638
GaudiMP.GMPBase.GMPComponent.Initialize
def Initialize(self)
Definition: GMPBase.py:628
GaudiMP.GMPBase.GMPComponent.iTime
iTime
Definition: GMPBase.py:491
GaudiMP.GMPBase.GMPComponent.SetupGaudiPython
def SetupGaudiPython(self)
Definition: GMPBase.py:510

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

Definition at line 534 of file GMPBase.py.

534 def LoadTES(self, tbufferfile):
535 root = gbl.DataObject()
536 setOwnership(root, False)
537 self.evt.setRoot('/Event', root)
538 self.ts.loadBuffer(tbufferfile)
539
GaudiMP.GMPBase.GMPComponent.LoadTES
def LoadTES(self, tbufferfile)
Definition: GMPBase.py:534
GaudiPython.Bindings.setOwnership
setOwnership
Definition: Bindings.py:84

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

Definition at line 506 of file GMPBase.py.

506 def processConfiguration(self):
507 # Different for all ; customize Configuration for multicore
508 pass
509
GaudiMP.GMPBase.GMPComponent.processConfiguration
def processConfiguration(self)
Definition: GMPBase.py:506

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

Definition at line 652 of file GMPBase.py.

652 def Report(self):
653 self.log.name = "%s-%i Audit" % (self.nodeType, self.nodeID)
654 allTime = "Alive Time : %5.2f" % (self.tTime)
655 initTime = "Init Time : %5.2f" % (self.iTime)
656 frstTime = "1st Event Time : %5.2f" % (self.firstEvTime)
657 runTime = "Run Time : %5.2f" % (self.rTime)
658 finTime = "Finalise Time : %5.2f" % (self.fTime)
659 tup = (allTime, initTime, frstTime, runTime, finTime)
660 for t in tup:
661 self.log.info(t)
662 self.log.name = "%s-%i" % (self.nodeType, self.nodeID)
663 # and report from the TESSerializer
664 self.TS.Report()
665
666 # =============================================================================
667
668
GaudiMP.GMPBase.GMPComponent.tTime
tTime
Definition: GMPBase.py:495
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:440
GaudiMP.GMPBase.GMPComponent.Report
def Report(self)
Definition: GMPBase.py:652
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:430
GaudiMP.GMPBase.GMPComponent.rTime
rTime
Definition: GMPBase.py:492
GaudiMP.GMPBase.GMPComponent.firstEvTime
firstEvTime
Definition: GMPBase.py:494
GaudiMP.GMPBase.GMPComponent.fTime
fTime
Definition: GMPBase.py:493
GaudiMP.GMPBase.GMPComponent.iTime
iTime
Definition: GMPBase.py:491

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

Definition at line 510 of file GMPBase.py.

510 def SetupGaudiPython(self):
511 # This method will initialize the GaudiPython Tools
512 # such as the AppMgr and so on
513 self.a = AppMgr()
514 if SMAPS:
515 from AlgSmapShot import SmapShot
516 smapsLog = self.nodeType + '-' + str(self.nodeID) + '.smp'
517 ss = SmapShot(logname=smapsLog)
518 self.a.addAlgorithm(ss)
519 self.evt = self.a.evtsvc()
520 self.hvt = self.a.histsvc()
521 self.fsr = self.a.filerecordsvc()
522 self.inc = self.a.service('IncidentSvc', 'IIncidentSvc')
523 self.pers = self.a.service('EventPersistencySvc', 'IAddressCreator')
524 self.ts = gbl.GaudiMP.TESSerializer(self.evt._idp, self.pers)
525 self.TS = TESSerializer(self.ts, self.evt,
526 self.nodeType, self.nodeID, self.log)
527 return SUCCESS
528
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:440
GaudiMP.GMPBase.TESSerializer
Definition: GMPBase.py:330
GaudiMP.GMPBase.GMPComponent.fsr
fsr
Definition: GMPBase.py:521
GaudiMP.GMPBase.GMPComponent.log
log
Definition: GMPBase.py:438
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:430
GaudiMP.GMPBase.GMPComponent.pers
pers
Definition: GMPBase.py:523
GaudiMP.GMPBase.GMPComponent.inc
inc
Definition: GMPBase.py:522
GaudiMP.GMPBase.GMPComponent.hvt
hvt
Definition: GMPBase.py:520
GaudiMP.GMPBase.GMPComponent.a
a
Definition: GMPBase.py:513
GaudiMP.GMPBase.GMPComponent.ts
ts
Definition: GMPBase.py:524
GaudiMP.GMPBase.GMPComponent.SetupGaudiPython
def SetupGaudiPython(self)
Definition: GMPBase.py:510
GaudiMP.GMPBase.GMPComponent.evt
evt
Definition: GMPBase.py:519
GaudiMP.GMPBase.GMPComponent.TS
TS
Definition: GMPBase.py:525

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

Definition at line 456 of file GMPBase.py.

456 def Start(self):
457 # define the separate process
458 qPair, histq, fq = self.queues
459
460 # Set up the Queue Mechanisms ( Event Communicators )
461 if self.nodeType == 'Reader' or self.nodeType == 'Worker':
462 # Reader or Worker Node
463 qin, qout = qPair
464 self.evcom = EventCommunicator(self, qin, qout)
465 else:
466 # Writer : many queues in, no queue out
467 assert self.nodeType == 'Writer'
468 self.evcoms = []
469 qsin = qPair[0]
470 for q in qsin:
471 ec = EventCommunicator(self, q, None)
472 self.evcoms.append(ec)
473 # Histogram Queue
474 self.hq = histq
475 # FileRecords Queue
476 self.fq = fq
477
478 # Universal Counters (available to all nodes)
479 # Use sensibly!!!
480 self.nIn = 0
481 self.nOut = 0
482
483 # Status Flag (possibly remove later)
484 self.stat = SUCCESS
485
486 # Set logger name
487 self.log.name = '%s-%i' % (self.nodeType, self.nodeID)
488
489 # Heuristic variables
490 # time for init, run, final, firstEventTime, totalTime
491 self.iTime = 0.0
492 self.rTime = 0.0
493 self.fTime = 0.0
494 self.firstEvTime = 0.0
495 self.tTime = 0.0
496
497 self.proc = Process(target=self.Engine)
498 # Fork and start the separate process
499 self.proc.start()
500
GaudiMP.GMPBase.GMPComponent.tTime
tTime
Definition: GMPBase.py:495
GaudiMP.GMPBase.GMPComponent.nodeID
nodeID
Definition: GMPBase.py:440
GaudiMP.GMPBase.GMPComponent.Engine
def Engine(self)
Definition: GMPBase.py:501
GaudiMP.GMPBase.GMPComponent.nOut
nOut
Definition: GMPBase.py:481
GaudiMP.GMPBase.GMPComponent.nodeType
nodeType
Definition: GMPBase.py:430
GaudiMP.GMPBase.GMPComponent.rTime
rTime
Definition: GMPBase.py:492
GaudiMP.GMPBase.EventCommunicator
Definition: GMPBase.py:237
GaudiMP.GMPBase.GMPComponent.queues
queues
Definition: GMPBase.py:446
GaudiMP.GMPBase.GMPComponent.evcom
evcom
Definition: GMPBase.py:464
GaudiMP.GMPBase.GMPComponent.fq
fq
Definition: GMPBase.py:476
GaudiMP.GMPBase.GMPComponent.proc
proc
Definition: GMPBase.py:497
GaudiMP.GMPBase.GMPComponent.hq
hq
Definition: GMPBase.py:474
GaudiMP.GMPBase.GMPComponent.firstEvTime
firstEvTime
Definition: GMPBase.py:494
GaudiMP.GMPBase.GMPComponent.fTime
fTime
Definition: GMPBase.py:493
GaudiMP.GMPBase.GMPComponent.stat
stat
Definition: GMPBase.py:484
GaudiMP.GMPBase.GMPComponent.nIn
nIn
Definition: GMPBase.py:480
GaudiMP.GMPBase.GMPComponent.Start
def Start(self)
Definition: GMPBase.py:456
GaudiMP.GMPBase.GMPComponent.iTime
iTime
Definition: GMPBase.py:491
GaudiMP.GMPBase.GMPComponent.evcoms
evcoms
Definition: GMPBase.py:468

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

Definition at line 529 of file GMPBase.py.

529 def StartGaudiPython(self):
530 self.a.initialize()
531 self.a.start()
532 return SUCCESS
533
GaudiMP.GMPBase.GMPComponent.StartGaudiPython
def StartGaudiPython(self)
Definition: GMPBase.py:529

## Member Data Documentation

GaudiMP.GMPBase.GMPComponent.a

Definition at line 513 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.app

Definition at line 450 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.cntr

Definition at line 638 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.currentEvent

Definition at line 443 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evcom

Definition at line 464 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evcoms

Definition at line 468 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.evt

Definition at line 519 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.finalEvent

Definition at line 434 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.firstEvTime

Definition at line 494 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fq

Definition at line 476 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fsr

Definition at line 521 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.fTime

Definition at line 493 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.hq

Definition at line 474 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.hvt

Definition at line 520 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.inc

Definition at line 522 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.iTime

Definition at line 491 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.lastEvent

Definition at line 435 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.log

Definition at line 438 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nIn

Definition at line 480 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nodeID

Definition at line 440 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nodeType

Definition at line 430 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.nOut

Definition at line 481 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.num

Definition at line 447 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.pers

Definition at line 523 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.proc

Definition at line 497 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.queues

Definition at line 446 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.rTime

Definition at line 492 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.stat

Definition at line 484 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.subworkers

Definition at line 439 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.ts

Definition at line 524 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.TS

Definition at line 525 of file GMPBase.py.

GaudiMP.GMPBase.GMPComponent.tTime

Definition at line 495 of file GMPBase.py.

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

- GaudiMP/python/GaudiMP/GMPBase.py