Example #1
0
def EscherCommon(true_online_version, alignment_module):
    import GaudiConf.DstConf
    import Escher.Configuration
    from Configurables import MagneticFieldSvc
    from Configurables import TAlignment
    from TAlignment.VertexSelections import configuredPVSelection
    from Configurables import RunChangeHandlerSvc
    OnlineEnv = importOnline()
    import ConditionsMap

    escher = Escher.Configuration.Escher()
    escher.DataType = '2015'
    escher.DDDBtag = ConditionsMap.DDDBTag
    escher.CondDBtag = ConditionsMap.CondDBTag
    escher.OnlineMode = True
    escher.UseDBSnapshot = True
    escher.DBSnapshotDirectory = "/group/online/hlt/conditions/"

    if hasattr(OnlineEnv, "AlignXmlDir"):
        escher.OnlineAligWorkDir = os.path.join(OnlineEnv.AlignXmlDir,
                                                'running')

    sys.path.insert(2, os.path.dirname(OnlineEnv.ConditionsMapping))
    import Online as OnlineConds
    handlerConditions = OnlineConds.ConditionMap
    # if true_online_version and os.environ['PARTITION_NAME'] == 'TEST':
    #   re_year = re.compile('(201\d)')
    #   for k, v in handlerConditions.items():
    #     handlerConditions[re_year.sub('2014', k)] = v

    conddb = CondDB()
    conddb.RunChangeHandlerConditions = handlerConditions
    conddb.IgnoreHeartBeat = True

    config_module = importlib.import_module('AlignmentConfigurations.' +
                                            alignment_module)
    config_module.configureAlignment()
    return escher
Example #2
0
def patchBrunel(true_online_version):
    """
        Instantiate the options to run Brunel with raw data

        @author M.Frank
  """
    from Configurables import TrackSys, CondDB
    import GaudiConf.DstConf
    import Brunel.Configuration
    import ConditionsMap
    import OnlineEnv

    brunel = Brunel.Configuration.Brunel()
    brunel.OnlineMode = True
    try:
        brunel.DDDBtag = OnlineEnv.DDDBTag
    except:
        print "DDDBTag not found, use default"
    try:
        brunel.CondDBtag = OnlineEnv.CondDBTag
    except:
        print "CondDBTag not found, use default"

    brunel.DataType = "2015"
    brunel.UseDBSnapshot = True  # Try it

    conddb = CondDB()
    conddb.Online = True
    #
    # Adjust to pickup the proper online conditions from ConditionsMap
    #
    conddb.RunChangeHandlerConditions = ConditionsMap.RunChangeHandlerConditions
    conddb.setProp('EnableRunChangeHandler', True)
    #
    # Stops the reconstruction if tracking hits beyond some reasonable limit.
    # Not necessary anymore, since memory leak in Brunel is fixed....
    #### TrackSys().GlobalCuts = { 'Velo': 5000, 'IT': 3000, 'OT': 8000 }
    #
    # Brunel output configuration
    #
    brunel.WriteFSR = False  # This crashes Jaap's stuff
    EventLoopMgr().OutputLevel = MSG_DEBUG  #ERROR
    EventLoopMgr().Warnings = False

    # from Configurables import EventClockSvc
    # EventClockSvc().InitialTime = 1322701200000000000

    if true_online_version:
        # brunel.OutputLevel       = MSG_INFO
        brunel.OutputLevel = MSG_WARNING
        brunel.PrintFreq = -1

    if processingType == 'Reprocessing':
        GaudiConf.DstConf.DstConf._doWriteMDF = packDST
        brunel.PackType = 'MDF'
        brunel.OutputType = 'RDST'
        brunel.WriteLumi = True
        brunel.Histograms = 'Online'
        sys.stdout.flush()
    else:
        global configureBrunelOutput
        brunel.WriteLumi = False
        brunel.Histograms = 'Online'
        Brunel.Configuration.Brunel.configureOutput = dummy
        """
    configureBrunelOutput = Brunel.Configuration.Brunel.configureOutput
    Brunel.Configuration.Brunel.configureOutput = configureOutput
    brunel.setProp( 'DatasetName', 'GaudiSerialize' )
    brunel.OutputType = 'DST'
    brunel.PackType = 'TES'
    """
        """ This does no longer work:
    ##from Configurables import DstConf, Serialisation, ProcessPhase
    print '[WARN]  Running GaudiSerialize!'
    ProcessPhase("Output").DetectorList += [ 'DST' ]
    brunel.setProp( 'DatasetName', 'GaudiSerialize' )
    DstConf().Writer       = 'DstWriter'
    DstConf().DstType      = 'DST'
    DstConf().PackType     = 'NONE'
    Serialisation().Writer = 'Writer'
    ##Serialisation().Explorer = True
    Serialisation()._ConfigurableUser__addPassiveUseOf(DstConf())
    """
    HistogramPersistencySvc().OutputFile = ""
    HistogramPersistencySvc().OutputLevel = MSG_ERROR

    ####print brunel
    return brunel
Example #3
0
def patchBrunel():
    """
        Instantiate the options to run Brunel with raw data

        @author M.Frank
  """
    import GaudiConf.DstConf
    import Brunel.Configuration
    import OnlineEnv

    brunel = Brunel.Configuration.Brunel()
    brunel.OnlineMode = True
    try:
        brunel.DDDBtag = OnlineEnv.DDDBTag
    except:
        print "DDDBTag not found, use default"

    try:
        brunel.CondDBtag = OnlineEnv.CondDBTag
    except:
        print "CondDBTag not found, use default"

    ##print '[ERROR]', OnlineEnv.DDDBTag, OnlineEnv.CondDBTag

    conddb = CondDB()
    conddb.IgnoreHeartBeat = True
    #
    # Adjust to pickup the proper online conditions
    #
    import ConditionsMap
    conddb.setProp('RunChangeHandlerConditions',
                   ConditionsMap.RunChangeHandlerConditions)
    conddb.setProp('EnableRunChangeHandler', True)

    brunel.DataType = "2015"
    brunel.UseDBSnapshot = True  # Try it
    brunel.WriteFSR = False  # This crashes Jaap's stuff

    conddb = CondDB()
    conddb.Online = True
    #
    # Adjust to pickup the proper online conditions from ConditionsMap
    #
    conddb.RunChangeHandlerConditions = ConditionsMap.RunChangeHandlerConditions
    conddb.setProp('EnableRunChangeHandler', True)

    # Enabled data-on-demand
    Gaudi.ApplicationMgr().ExtSvc += ["DataOnDemandSvc"]

    # The sequencer to run all the PID monitoring in
    seq = GaudiSequencer("PIDMoniSeq")

    # Set up PID monitoring sequence
    pidSeq = GaudiSequencer("RichPIDSelections")
    seq.Members += [pidSeq]

    # Set options
    brunel.setOtherProps(RichPIDQCConf(), ['OutputLevel', 'Context'])
    RichPIDQCConf().setProp("CalibSequencer", pidSeq)

    class __MonAdd:
        def __init__(self, s):
            self.seq = s

        def addMonitors(self):
            # Append to processing
            GaudiSequencer("PhysicsSeq").Members += [self.seq]

    mon = __MonAdd(seq)
    Gaudi.appendPostConfigAction(mon.addMonitors)

    EventLoopMgr().OutputLevel = MSG_DEBUG  #ERROR
    EventLoopMgr().Warnings = False

    brunel.UseDBSnapshot = True  # try it
    Brunel.Configuration.Brunel.configureOutput = dummy
    HistogramPersistencySvc().OutputFile = ""
    HistogramPersistencySvc().OutputLevel = MSG_ERROR
    print brunel
    return brunel
Example #4
0
  det = detxml[:detxml.rfind('.xml')]
  det = det.lower()
  dets.append(det)
print "Moving to Offline DB the following detector Data ",dets
ecs = EventClockSvc()
ecs.InitialTime = RunOption.RunStartTime*1000000000
ecs.addTool(FakeEventTime,"EventTimeDecoder")
ecs.EventTimeDecoder.StartTime = ecs.InitialTime
ecs.EventTimeDecoder.TimeStep = 10

#xmlCnvSvc = XmlCnvSvc(AllowGenericConversion = True)
DDDBConf()
#detDataSvc = DetectorDataSvc()
#DetectorPersistencySvc( CnvServices = [ xmlCnvSvc ] )
cdb = CondDB()
cdb.RunChangeHandlerConditions=CondMap.ConditionMap
cdb.EnableRunChangeHandler = True
cdb.EnableRunStampCheck=False
cdb.UseDBSnapshot = True
cdb.Tags = { "DDDB" : RunOption.DDDBTag,
                "LHCBCOND" : RunOption.CondDbTag,
                "ONLINE" : 'fake'}
cdb.IgnoreHeartBeat = True
dbxalg = DBXferAlg()
dbxalg.RunNumber = RunOption.RunNumber
dbxalg.RunStartTime = RunOption.RunStartTime*1000000000
dbxalg.OnlineXmlDir = RunOption.OutputDirectory
wrconf = WriterConf("wconf",dets)#["Velo","IT","TT","OT"])
wrconf.CondFilePrefix = RunOption.OutputDirectory+"/offl/Conditions/Online"
from Configurables import WriteMultiAlignmentConditionsTool
xmlwriter = WriteMultiAlignmentConditionsTool()#"AlignWriterTool")
Example #5
0
def patchBrunel():
    """
        Instantiate the options to run Brunel with raw data

        @author M.Frank
  """
    import GaudiConf.DstConf
    import Brunel.Configuration
    import OnlineEnv

    brunel = Brunel.Configuration.Brunel()
    brunel.OnlineMode = True
    try:
        brunel.DDDBtag = OnlineEnv.DDDBTag
    except:
        print "DDDBTag not found, use default"

    try:
        brunel.CondDBtag = OnlineEnv.CondDBTag
    except:
        print "CondDBTag not found, use default"

    ##print '[ERROR]', OnlineEnv.DDDBTag, OnlineEnv.CondDBTag

    conddb = CondDB()
    conddb.IgnoreHeartBeat = True
    #
    # Adjust to pickup the proper online conditions
    #
    import ConditionsMap
    conddb.setProp('RunChangeHandlerConditions',
                   ConditionsMap.RunChangeHandlerConditions)
    conddb.setProp('EnableRunChangeHandler', True)

    brunel.DataType = "2015"
    brunel.UseDBSnapshot = True  # Try it
    brunel.WriteFSR = False  # This crashes Jaap's stuff

    conddb = CondDB()
    conddb.Online = True
    #
    # Adjust to pickup the proper online conditions from ConditionsMap
    #
    conddb.RunChangeHandlerConditions = ConditionsMap.RunChangeHandlerConditions
    conddb.setProp('EnableRunChangeHandler', True)

    # Enabled data-on-demand
    Gaudi.ApplicationMgr().ExtSvc += ["DataOnDemandSvc"]

    ################################################################################
    #                                                                              #
    # Set up PID monitoring sequence                                               #
    #                                                                              #
    ################################################################################

    # The sequencer to run all the monitoring in
    seq = GaudiSequencer("PIDMoniSeq")

    pidSeq = GaudiSequencer("RichPIDSelections")

    brunel.setOtherProps(RichPIDQCConf(), ['OutputLevel', 'Context'])
    RichPIDQCConf().setProp("CalibSequencer", pidSeq)

    seq.Members += [pidSeq]

    ################################################################################
    #                                                                              #
    # Configure the muon efficiency monitor                                        #
    #                                                                              #
    ################################################################################

    muEffMoni = MuEffMonitor("MuEffMonitor")

    muEffMoni.addTool(TrackMasterExtrapolator, name="MuEffExtrap")
    muEffMoni.Extrapolator = muEffMoni.MuEffExtrap

    muEffMoni.MuEffExtrap.ApplyMultScattCorr = True
    muEffMoni.MuEffExtrap.ApplyEnergyLossCorr = True
    muEffMoni.MuEffExtrap.MaterialLocator = "SimplifiedMaterialLocator"
    muEffMoni.MuEffExtrap.OutputLevel = 6

    muEffMoni.nSigma1X = [11., 8., 7., 7.]
    muEffMoni.nSigma1Y = [6., 5., 5., 5.]
    muEffMoni.nSigmaX = [5., 5., 5., 5.]
    muEffMoni.nSigmaY = [5., 5., 5., 5.]

    muEffMoni.RequiredStations = 4
    muEffMoni.MomentumCut = 3000.0
    muEffMoni.nSigmaFidVol = 3.0

    muEffMoni.UseCalo = True
    muEffMoni.EecalMax = 1500.0
    muEffMoni.EhcalMax = 5000.0
    muEffMoni.EhcalMin = 1000.0

    muEffMoni.Chi2ProbTrMin = 0.01
    muEffMoni.Chi2MuMin = 10.0
    muEffMoni.nSigmaXother = 2.0
    muEffMoni.nSigmaYother = 2.0

    muEffMoni.HistoLevel = "OfflineFull"

    seq.Members += [muEffMoni]

    ################################################################################
    #                                                                              #
    # Configure the muon pid monitor                                               #
    #                                                                              #
    ################################################################################

    from Configurables import MuIDMonitor, CombineParticles
    from Configurables import FilterDesktop
    from StandardParticles import StdNoPIDsPions, StdNoPIDsProtons, StdNoPIDsMuons
    from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

    MuPidMoniSeq_Lambda = GaudiSequencer("MuPidMoniSeq_Lambda")
    MuPidMoniSeq_Jpsi = GaudiSequencer("MuPidMoniSeq_Jpsi")

    #
    # Make pions and protons
    #

    PionsFilter = FilterDesktop("PionsFilter")
    PionsFilter.Code = "(P>3000*MeV) & (PT>100*MeV) & (TRCHI2DOF<2) & (ISLONG) & (MIPCHI2DV(PRIMARY)>9)"
    PionsFilterSel = Selection("PionsFilterSel",
                               Algorithm=PionsFilter,
                               RequiredSelections=[StdNoPIDsPions])

    ProtonsFilter = FilterDesktop("ProtonsFilter")
    ProtonsFilter.Code = "(P>3000*MeV) & (PT>100*MeV) & (TRCHI2DOF<2) & (ISLONG) & (MIPCHI2DV(PRIMARY)>9)"
    ProtonsFilterSel = Selection("ProtonsFilterSel",
                                 Algorithm=ProtonsFilter,
                                 RequiredSelections=[StdNoPIDsProtons])
    #
    # Make Lambda_0
    #

    LambdaMonitor = CombineParticles("LambdaMonitor")
    LambdaMonitor.DecayDescriptor = "[Lambda0 -> p+ pi-]cc"
    LambdaMonitor.CombinationCut = "(ADAMASS('Lambda0')<10*MeV)"
    LambdaMonitor.MotherCut = "(50<BPVVDZ) & (600>BPVVDZ) & (BPVDIRA>0.9999995)  & (CHILDCUT((PT>0.2*GeV),1) | CHILDCUT((PT>0.2*GeV),2)) & (ADWM('KS0', WM('pi+', 'pi-')) > 20*MeV)"

    LambdaMonitorSel = Selection(
        "LambdaMonitorSel",
        Algorithm=LambdaMonitor,
        RequiredSelections=[PionsFilterSel, ProtonsFilterSel])

    LambdaMonitorSeq = SelectionSequence("LambdaMonitorSeq",
                                         TopSelection=LambdaMonitorSel)

    MuPidMoniSeq_Lambda.Members += [LambdaMonitorSeq.sequence()]

    #
    # Make muons and J/psi
    #

    mucocut = '(0.5<PPINFO(LHCb.ProtoParticle.InAccMuon,-1)) & (P>3*GeV) & (PT>800*MeV) & (TRCHI2DOF<3) & (ISLONG)'

    tag1cuts = " (CHILDCUT(ISMUON,1)) & (CHILDCUT((P>6*GeV),1)) & (CHILDCUT((PT>1.5*GeV),1)) "
    tag2cuts = " (CHILDCUT(ISMUON,2)) & (CHILDCUT((P>6*GeV),2)) & (CHILDCUT((PT>1.5*GeV),2)) "

    probe2cuts = " ( (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)<1000*MeV),2)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)<4000*MeV),2)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)>-10*MeV),2)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)>1000*MeV),2)) ) "
    probe1cuts = " ( (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)<1000*MeV),1)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)<4000*MeV),1)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloEcalE,-10000)>-10*MeV),1)) & (CHILDCUT((PPINFO(LHCb.ProtoParticle.CaloHcalE,-10000)>1000*MeV),1)) )  "

    child1cuts = tag1cuts + " & " + probe2cuts

    child2cuts = tag2cuts + " & " + probe1cuts

    MuonsFilter = FilterDesktop("MuonsFilter")
    MuonsFilter.Code = mucocut
    MuonsFilterSel = Selection("MuonsFilterSel",
                               Algorithm=MuonsFilter,
                               RequiredSelections=[StdNoPIDsMuons])

    JpsiMonitor = CombineParticles("JpsiMonitor")
    JpsiMonitor.DecayDescriptor = "J/psi(1S) -> mu+ mu-"
    JpsiMonitor.CombinationCut = "(ADAMASS('J/psi(1S)')<300*MeV)"
    JpsiMonitor.MotherCut = "(VFASPF(VCHI2/VDOF)<20) & ( " + child1cuts + " | " + child2cuts + " ) "

    JpsiMonitor.OutputLevel = 6

    JpsiMonitorSel = Selection("JpsiMonitorSel",
                               Algorithm=JpsiMonitor,
                               RequiredSelections=[MuonsFilterSel])

    JpsiMonitorSeq = SelectionSequence("JpsiMonitorSeq",
                                       TopSelection=JpsiMonitorSel)

    MuPidMoniSeq_Jpsi.Members += [JpsiMonitorSeq.sequence()]

    #
    # Monitoring muon mis-id with Lambda_0
    #

    MuIDLambdaPlot = MuIDMonitor("MuIDLambdaPlot")
    MuIDLambdaPlot.Inputs = [LambdaMonitorSel.outputLocation()]
    MuIDLambdaPlot.OutputLevel = 6

    MuIDLambdaPlot.MassMean = 1115.68
    MuIDLambdaPlot.MassWindow = 20.
    MuIDLambdaPlot.EffMassWin = 2.

    MuIDLambdaPlot.JpsiAnalysis = 0
    MuIDLambdaPlot.LambdaAnalysis = 1
    MuIDLambdaPlot.HitInFoi = 1

    MuIDLambdaPlot.PreSelMomentum = 3000.  # MuonID preselection momentum (MeV/c)
    MuIDLambdaPlot.MomentumCuts = [6000., 10000.
                                   ]  # MuonID momentum cut ranges (MeV/c)

    # MuonID FOI parameters

    MuIDLambdaPlot.FOIfactor = 1.

    MuIDLambdaPlot.XFOIParameter1 = [
        5.5, 4.0, 3.3, 2.8, 5.2, 3.6, 2.4, 2.4, 5.7, 4.4, 2.8, 2.3, 5.1, 3.1,
        2.3, 2.1, 5.8, 3.4, 2.6, 2.8
    ]

    MuIDLambdaPlot.XFOIParameter2 = [
        11., 3., 1., 1., 31., 28., 21., 17., 30., 31., 27., 22., 28., 33., 35.,
        47., 31., 39., 56., 151.
    ]

    MuIDLambdaPlot.XFOIParameter3 = [
        0.20, 0.08, 0.03, 0.1, 0.06, 0.08, 0.10, 0.15, 0.04, 0.06, 0.09, 0.12,
        0.08, 0.15, 0.23, 0.36, 0.07, 0.14, 0.24, 0.49
    ]

    MuIDLambdaPlot.YFOIParameter1 = [
        2.8, 1.7, -153., 1.9, 3.3, 2.1, 1.7, 1.6, 3.6, 2.8, 1.9, 1.8, 4.4, 3.3,
        2.2, 2.2, 4.8, 3.9, 2.6, 2.3
    ]

    MuIDLambdaPlot.YFOIParameter2 = [
        3., 2., 156., 0., 17., 15., 9., 5., 26., 25., 16., 15., 30., 49., 57.,
        92., 32., 55., 96., 166.
    ]

    MuIDLambdaPlot.YFOIParameter3 = [
        0.03, 0.02, 0.00, 0.09, 0.13, 0.19, 0.19, 0.24, 0.11, 0.19, 0.21, 0.32,
        0.10, 0.22, 0.30, 0.52, 0.08, 0.20, 0.34, 0.52
    ]

    #
    # Parameters of the Landau functions
    #

    MuIDLambdaPlot.distMuon = [
        0.311, 1.349, 0.524, 0.0020, 17., 10.6, 0.04, 4.1, 1.64
    ]
    MuIDLambdaPlot.distPion = [
        11., -12., 0.2029, -0.026, 0.06, 0.59, 0.008, -29., 41.
    ]

    MuPidMoniSeq_Lambda.Members += [MuIDLambdaPlot]

    #
    # Monitoring muon id with J/psi
    #

    MuIDJpsiPlot = MuIDMonitor("MuIDJpsiPlot")
    MuIDJpsiPlot.Inputs = [JpsiMonitorSel.outputLocation()]
    MuIDJpsiPlot.OutputLevel = 6

    MuIDJpsiPlot.MassMean = 3096.91
    MuIDJpsiPlot.MassWindow = 300.
    MuIDJpsiPlot.EffMassWin = 20.

    MuIDJpsiPlot.JpsiAnalysis = 1
    MuIDJpsiPlot.LambdaAnalysis = 0
    MuIDJpsiPlot.HitInFoi = 1

    MuIDJpsiPlot.PreSelMomentum = MuIDLambdaPlot.PreSelMomentum
    MuIDJpsiPlot.MomentumCuts = MuIDLambdaPlot.MomentumCuts

    # MuonID FOI parameters

    MuIDJpsiPlot.FOIfactor = MuIDLambdaPlot.FOIfactor
    MuIDJpsiPlot.XFOIParameter1 = MuIDLambdaPlot.XFOIParameter1
    MuIDJpsiPlot.XFOIParameter2 = MuIDLambdaPlot.XFOIParameter2
    MuIDJpsiPlot.XFOIParameter3 = MuIDLambdaPlot.XFOIParameter3
    MuIDJpsiPlot.YFOIParameter1 = MuIDLambdaPlot.YFOIParameter1
    MuIDJpsiPlot.YFOIParameter2 = MuIDLambdaPlot.YFOIParameter2
    MuIDJpsiPlot.YFOIParameter3 = MuIDLambdaPlot.YFOIParameter3

    #
    # Parameters of the Landau functions
    #

    MuIDJpsiPlot.distMuon = MuIDLambdaPlot.distMuon
    MuIDJpsiPlot.distPion = MuIDLambdaPlot.distPion

    MuPidMoniSeq_Jpsi.Members += [MuIDJpsiPlot]
    MuPidMoniSeq_Jpsi.IgnoreFilterPassed = True
    MuPidMoniSeq_Lambda.IgnoreFilterPassed = True

    seq.Members += [MuPidMoniSeq_Lambda, MuPidMoniSeq_Jpsi]

    # set the options

    class __MonAdd:
        def __init__(self, s):
            self.seq = s

        def addMonitors(self):
            # Append to processing
            GaudiSequencer("PhysicsSeq").Members += [self.seq]

    mon = __MonAdd(seq)
    Gaudi.appendPostConfigAction(mon.addMonitors)

    EventLoopMgr().OutputLevel = MSG_DEBUG  #ERROR
    EventLoopMgr().Warnings = False

    brunel.UseDBSnapshot = True  # try it
    Brunel.Configuration.Brunel.configureOutput = dummy
    HistogramPersistencySvc().OutputFile = ""
    HistogramPersistencySvc().OutputLevel = MSG_ERROR
    print brunel
    return brunel
Example #6
0
def configOnline(app, alg, name):
    from Configurables import ApplicationMgr, UpdateAndReset
    appMgr = ApplicationMgr()

    ## Configure saving of histograms
    ur = UpdateAndReset()
    ur.saveHistograms = 1
    appMgr.TopAlg.insert(0, ur)

    from Configurables import LoKiSvc
    LoKiSvc().Welcome = False

    import OnlineEnv
    app.DDDBtag = OnlineEnv.DDDBTag
    app.CondDBtag = OnlineEnv.CondDBTag

    from Configurables import CondDB
    conddb = CondDB()
    conddb.IgnoreHeartBeat = True
    conddb.UseDBSnapshot = True
    conddb.EnableRunChangeHandler = True
    conddb.EnableRunStampCheck = False
    conddb.Tags['ONLINE'] = 'fake'

    import ConditionsMap
    conddb.RunChangeHandlerConditions = ConditionsMap.RunChangeHandlerConditions

    from Gaudi.Configuration import EventLoopMgr
    EventLoopMgr().Warnings = False

    from Configurables import MonitorSvc
    MonitorSvc().disableDimPropServer      = 1
    MonitorSvc().disableDimCmdServer       = 1

    MonitorSvc().ExpandCounterServices = 0;
    MonitorSvc().ExpandNameInfix       = "<part>_x_<program>/";
    MonitorSvc().PartitionName         = OnlineEnv.PartitionName;
    MonitorSvc().ProgramName           = name + "_00";

    # setup the histograms and the monitoring service
    appMgr.ExtSvc.append( 'MonitorSvc' )
    from Configurables import RootHistCnv__PersSvc
    RootHistCnv__PersSvc().OutputEnabled = False

    from Gaudi.Configuration import allConfigurables
    # set up the event selector
    if 'EventSelector' in allConfigurables :
        del allConfigurables['EventSelector']

    input = 'Events'
    mepMgr = OnlineEnv.mepManager(OnlineEnv.PartitionID,OnlineEnv.PartitionName,[input],True)
    mepMgr.ConnectWhen = "start";

    appMgr.Runable = OnlineEnv.evtRunable(mepMgr)
    appMgr.SvcOptMapping.append('LHCb::OnlineEvtSelector/EventSelector')
    appMgr.SvcOptMapping.append('LHCb::FmcMessageSvc/MessageSvc')
    appMgr.ExtSvc.append(mepMgr)

    eventSelector = OnlineEnv.mbmSelector(input = input, type = 'ONE', decode = False, event_type = 2)
    appMgr.ExtSvc.append(eventSelector)
    appMgr.ExtSvc.append(mepMgr)
    appMgr.OutputLevel = 3

    OnlineEnv.evtDataSvc()
    eventSelector.REQ1 = 'EvType=2;TriggerMask=0x0,0x4,0x0,0x0;VetoMask=0,0,0,0x300;MaskType=ANY;UserType=USER;Frequency=PERC;Perc=100.0'
    appMgr.EvtSel = eventSelector

    from Configurables import AuditorSvc
    AuditorSvc().Auditors = []
    configMsgSvc( appMgr )
    OnlineEnv.end_config(False)
Example #7
0
def setup():
    initialTime = long(time.time() * 1e9)

    OTGaudiSeq = GaudiSequencer("OTt0OnlineClbrSeq")
    OTt0OnlineClbrAlg = OTt0OnlineClbr("OTt0OnlineClbrAlg")
    #OTt0OnlineClbrAlg.InputFiles  = [ "/hist/Savesets/2013/LHCb/Brunel/01/20/Brunel-135576-20130120T161302-EOR.root"]

    # OT T0 calibration algorithm
    OTt0OnlineClbrAlg.InputTasks = ["Brunel"]
    OTt0OnlineClbrAlg.Partition = partition
    OTt0OnlineClbrAlg.ReadInitialT0FromDB = False
    OTt0OnlineClbrAlg.SaveFits = False
    OTt0OnlineClbrAlg.RunOnline = True
    OTt0OnlineClbrAlg.CheckDataT0 = True
    OTt0OnlineClbrAlg.PublishedName = "OT/Calib"
    OTt0OnlineClbrAlg.XMLFilePath = "/group/online/alignment/OT/Calib"
    OTt0OnlineClbrAlg.OutputLevel = MSG_INFO
    OTt0OnlineClbrAlg.UseClockPhase = (partition != "FEST")
    OTt0OnlineClbrAlg.InitialTime = initialTime
    OTt0OnlineClbrAlg.Threshold = 0.1
    OTt0OnlineClbrAlg.MaxDifference = 2
    # Keep analysis task going.
    OTt0OnlineClbrAlg.StopAlgSequence = False

    OTGaudiSeq.Members += [OTt0OnlineClbrAlg]
    OTGaudiSeq.IgnoreFilterPassed = True

    ## Configure saving of histograms
    from Configurables import UpdateAndReset
    ur = UpdateAndReset()
    ur.saveHistograms = 1
    ApplicationMgr().TopAlg.insert(0, ur)

    from Configurables import MonitorSvc
    MonitorSvc().disableDimPropServer = 1
    MonitorSvc().disableDimCmdServer = 1

    #import OnlineEnv
    MonitorSvc().ExpandCounterServices = 0
    MonitorSvc().ExpandNameInfix = "<part>_x_<program>/"
    #MonitorSvc().PartitionName         = OnlineEnv.PartitionName;
    MonitorSvc().PartitionName = partition
    MonitorSvc().ProgramName = "OTOnlineCalib_0"

    #setup the histograms and the monitoring service
    #ApplicationMgr().ExtSvc.append( 'MonitorSvc' )
    from Configurables import RootHistCnv__PersSvc
    RootHistCnv__PersSvc().OutputEnabled = False

    ApplicationMgr().TopAlg += [OTGaudiSeq]
    ApplicationMgr().EvtSel = "NONE"
    ApplicationMgr().ExtSvc += [
        "LHCb::PublishSvc", "MonitorSvc", "IncidentSvc"
    ]
    ApplicationMgr().Runable = "LHCb::OnlineRunable/Runable"

    from Configurables import CondDB
    conddb = CondDB()
    conddb.Tags["ONLINE"] = 'fake'
    conddb.IgnoreHeartBeat = True
    conddb.UseDBSnapshot = True
    conddb.DBSnapshotDirectory = "/group/online/hlt/conditions"

    from Configurables import EventClockSvc, FakeEventTime, EventDataSvc
    ecs = EventClockSvc()
    ecs.InitialTime = initialTime
    ecs.addTool(FakeEventTime, "EventTimeDecoder")
    ecs.EventTimeDecoder.StartTime = initialTime
    ecs.EventTimeDecoder.TimeStep = 10
    EventDataSvc().ForceLeaves = True

    # Configure DB tags and per-run conditions to be used to be the same as what
    # the HLT1 reconstruction farm uses. This is done by directly importing the
    # python file to ensure the script can also start when LHCb is running
    # passthrough.
    conddb.EnableRunChangeHandler = True
    conddb.RunChangeHandlerConditions = {
        'LHCb/2015/%d/ot.xml': ["Conditions/Calibration/OT/CalibrationGlobal"]
    }

    from Configurables import LHCbApp
    import ConditionsMap
    LHCbApp().CondDBtag = ConditionsMap.CondDBTag
    LHCbApp().DDDBtag = ConditionsMap.DDDBTag

    # LHCbApp().CondDBtag = 'cond-20150409-2'
    # LHCbApp().DDDBtag   = 'dddb-20150119-3'
    LHCbApp().DataType = '2015'