def __call__(self):
        from Configurables import EventClockSvc, FakeEventTime
        clkSvc = EventClockSvc()
        clkSvc.EventTimeDecoder = "FakeEventTime"
        clkSvc.addTool(FakeEventTime, "FakeEventTime")
        clkSvc.FakeEventTime.StartTime = self.__initialTime + 1

        from Configurables import GaudiSequencer, createODIN
        initSeq = GaudiSequencer("InitEscherSeq")
        initSeq.Members.insert(0, createODIN())
Example #2
0
 def defineDB(self):
     # Delegate handling of properties to DDDBConf
     self.setOtherProps(DDDBConf(), ["Simulation", "DataType"])
     # Set CondDB tags if given, otherwise use default defined in DDDBConf
     from Configurables import CondDB
     if hasattr(self, "DDDBtag"):
         CondDB().Tags["DDDB"] = self.getProp("DDDBtag")
     if hasattr(self, "CondDBtag"):
         CondDB().Tags["LHCBCOND"] = self.getProp("CondDBtag")
         CondDB().Tags["SIMCOND"] = self.getProp("CondDBtag")
     if hasattr(self, "DQFLAGStag"):
         CondDB().Tags["DQFLAGS"] = self.getProp("DQFLAGStag")
     # Set up a time decoder for real data (Simulation uses FakeEventTime)
     if not self.getProp("Simulation"):
         from Configurables import EventClockSvc
         ecs = EventClockSvc()
         # do not overwrite already set values
         if not ecs.isPropertySet("EventTimeDecoder"):
             ecs.EventTimeDecoder = "OdinTimeDecoder"
def setupOnline():
    """
        Setup the online environment: Buffer managers, event serialisation, etc.

        @author M.Frank
  """
    from Configurables import LHCb__FILEEvtSelector as es
    from Configurables import LHCb__AlignDrv as Adrv
    from Configurables import EventClockSvc
    Online = importOnline()

    app = Gaudi.ApplicationMgr()
    app.AppName = ''
    app.HistogramPersistency = 'ROOT'
    app.SvcOptMapping.append('LHCb::FILEEvtSelector/EventSelector')
    app.SvcOptMapping.append('LHCb::FmcMessageSvc/MessageSvc')
    #app.EvtMax = 10000
    Online.rawPersistencySvc()
    evtloop = Configs.EventLoopMgr('LHCb::OnlineRunable/EmptyEventLoop')
    evtloop.Warnings = False
    evtloop.EvtSel = "NONE"
    app.EventLoop = evtloop
    app.HistogramPersistency = "NONE"
    #   runable = Configs.Runable
    #  runable.MEPManager        = ""
    app.AuditAlgorithms = False

    Configs.MonitorSvc().OutputLevel = MSG_ERROR
    Configs.MonitorSvc().UniqueServiceNames = 1
    Configs.RootHistCnv__PersSvc("RootHistSvc").OutputLevel = MSG_ERROR
    app.OutputLevel = MSG_INFO

    def __propAtt(att, fr, to, d=None):
        if hasattr(fr, att):
            setattr(to, att, getattr(fr, att))
        elif d:
            setattr(to, att, d)

    from Configurables import AlignOnlineIterator as Aiter
    ad = Adrv("AlignDrv")
    ad.PartitionName = Online.PartitionName
    ad.FitterClass = "AlignOnlineIterator"
    ad.FitterName = "AlIterator"
    __propAtt('RefFileName', Online, ad)

    ## The Alignment driver is the runable
    app.Runable = ad.getType() + "/" + ad.getName()

    ad.addTool(Aiter, ad.FitterName)
    ai = ad.AlIterator
    ai.PartitionName = Online.PartitionName
    ai.ASDFilePattern = "_Escher.out"
    ai.OutputLevel = 3
    ai.MaxIteration = MAX_NITER
    ai.ServiceInfix = ""
    ai.ReferenceRunNr = Online.DeferredRuns[0] if hasattr(
        Online, "DeferredRuns") else -1
    runType = os.environ.get('RUN_TYPE', 'Unknown')
    runType = runType.split('|')[-1].strip() if '|' in runType else runType
    if runType == 'Tracker':
        sds = ['TT', 'IT', 'OT']
        ai.RunType = runType
    elif runType in ('Velo', 'Muon'):
        sds = [runType]
        ai.RunType = runType
    else:
        print 'WARNING: RUN_TYPE is not one of Velo, Tracker or Muon. Will assume all subdetectors'
        sds = ['Velo', 'TT', 'IT', 'OT', 'Muon']
    ai.SubDetectors = sds

    #   for attr, default in [('ASDDir', "/group/online/alignment/EscherOut/"),
    #                         ('OnlineXmlDir', "/group/online/alignment"),
    #                         ('AlignXmlDir', "/group/online/AligWork")]:
    for attr, default in [('ASDDir', "/calib/align/EscherOut/"),
                          ('OnlineXmlDir', "/group/online/alignment"),
                          ('AlignXmlDir', "/group/online/AligWork")]:
        __propAtt(attr, Online, ai, default)

    initialTime = long(time.time() * 1e9)
    clkSvc = EventClockSvc()
    clkSvc.InitialTime = initialTime

    from Configurables import FakeEventTime
    clkSvc.EventTimeDecoder = "FakeEventTime"
    clkSvc.addTool(FakeEventTime, "FakeEventTime")
    clkSvc.FakeEventTime.StartTime = initialTime