00001
00002
00003 class Configure:
00004 '''
00005 Configure Stages for "pull mode" simulation.
00006
00007 '''
00008
00009 def __init__(self,stages=[]):
00010 '''
00011 Configure given stages.
00012
00013 Resulting object will have one data member named after each
00014 Stage that holds the configurable for that stage. Each stage
00015 will be configured with a GaudiSequencer named with the stage
00016 name prepended to "Sequence". The sequencer is also available
00017 as a data member. If "ordered" is True, then connect up the
00018 stages in the order given in "stages".
00019 '''
00020
00021 self.stages = []
00022 self.addStages(stages)
00023 return
00024
00025 def addStages(self,stages):
00026
00027 from StageConf import Stage
00028 from GaudiAlg.GaudiAlgConf import GaudiSequencer
00029
00030 from Gaudi.Configuration import ToolSvc
00031 toolSvc = ToolSvc()
00032
00033 for cnf in stages:
00034 if type(cnf) == str:
00035 cnf = Stage(cnf)
00036
00037 stage = cnf.name()
00038 toolSvc += cnf
00039 seqName = stage + 'Sequence'
00040 if seqName.find("ToolSvc.") != -1:
00041 seqName = seqName.replace ( 'ToolSvc.', '' )
00042 seq = GaudiSequencer(seqName)
00043 cnf.Sequencer = seqName
00044 print 'Adding stage named',cnf.name(),'seq named',seq.name()
00045 self.__dict__[stage] = cnf
00046 self.__dict__[seqName] = seq
00047 continue
00048
00049 self.stages += stages
00050 return
00051
00052
00053 pass