コード例 #1
0
    def __apply_configuration__(self):
        DecodeRawEvent()

        # just to make sure we don't forget
        if self.getProp("SimplifiedGeom"):
            TrackSys().ExpertTracking += ['simplifiedGeometry']
        TrackSys().ExpertTracking += ['kalmanSmoother']

        # Set up the database. Normally done from LHCbApp
        self.defineDB()

        # Set up transient store, if not yet done. This is normally done from LHCbApp
        EventDataSvc(ForceLeaves=True, RootCLID=1, EnableFaultHandler=True)

        # this is normally done from RecoTracking.py
        if TrackSys().fieldOff():
            from Configurables import MagneticFieldSvc
            MagneticFieldSvc().UseConstantField = True
            MagneticFieldSvc().UseConditions = False
            MagneticFieldSvc().ScaleFactor = 0

        # this is normally done from Brunel
        importOptions("$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts")

        #from Configurables import ApplicationMgr, HistogramPersistencySvc
        #ApplicationMgr().HistogramPersistency = 'ROOT'
        #HistogramPersistencySvc().OutputFile = 'alignhistos.root'

        self.sequencers()
コード例 #2
0
    def _configureDBSnapshot(self):
        """
        Configure the database to use the online snapshot
        """
        tag = { "DDDB":     self.getProp('DDDBtag')
                , "LHCBCOND": self.getProp('CondDBtag')
                , "SIMCOND" : self.getProp('CondDBtag') 
                , "ONLINE"  : 'fake'
                }

        # https://savannah.cern.ch/bugs/?94454#comment12
        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True

        cdb = CondDB()
        cdb.Tags = tag
        cdb.setProp('IgnoreHeartBeat', True)
        cdb.setProp('EnableRunChangeHandler', True)
        self.setOtherProps( cdb, [ 'UseDBSnapshot',
                                   'DBSnapshotDirectory',
                                   'PartitionName' ])

        if [det for det in ['Rich1', "Rich2", "Rich1Pmt", "Rich2Pmt"] if det in self.getProp("Detectors")]:
            log.warning( "using hack https://savannah.cern.ch/task/index.php?27329#comment45" )
            from Configurables import RichRecSysConf
            rConf = RichRecSysConf("RichOfflineRec")
            rConf.Context = "HLT"
            from Configurables import RichRecQCConf
            rMoni = RichRecQCConf("OfflineRichMoni")
            rMoni.Context = "HLT"
コード例 #3
0
    def _configureDBSnapshot(self):
        from Configurables import CondDB
        conddb = CondDB()
        conddb.EnableRunStampCheck = False
        conddb.Tags["ONLINE"] = 'fake'
        conddb.setProp('IgnoreHeartBeat', self.getProp('IgnoreDBHeartBeat'))
        self.setOtherProps(conddb, [
            'UseDBSnapshot', 'DBSnapshotDirectory', 'EnableRunChangeHandler',
            'RunChangeHandlerConditions'
        ])

        # https://savannah.cern.ch/bugs/?94454#comment12
        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True
コード例 #4
0
    def _setup_rch(self):
        # Setup DB snapshot and RCH
        from Configurables import EventClockSvc
        EventClockSvc().EventTimeDecoder = 'OdinTimeDecoder'

        tag = {
            "DDDB": self._config['DDDBtag'],
            "LHCBCOND": self._config['CondDBtag'],
            "ONLINE": 'fake'
        }

        baseloc = '/group/online/hlt/conditions'
        from Configurables import CondDB
        conddb = CondDB()
        # hack to allow us to chance connectionstrings...
        conddb.Online = True
        # Set alternative connection strings and tags
        # (see Det/DetCond's configurable... )
        dbPartitions = ["DDDB", "LHCBCOND", "ONLINE"]
        for part in dbPartitions:
            if tag[part] is 'default':
                raise KeyError('must specify an explicit %s tag' % part)
            conddb.PartitionConnectionString[
                part] = "sqlite_file:%(dir)s/%(part)s_%(tag)s.db/%(part)s" % {
                    "dir": baseloc,
                    "part": part,
                    "tag": tag[part]
                }
            conddb.Tags[part] = tag[part]

        # Set the location of the Online conditions
        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True

        online_xml = '%s/LHCb/2015/%%d/online.xml' % baseloc
        from Configurables import RunChangeHandlerSvc
        rch = RunChangeHandlerSvc()
        rch.Conditions = {
            "Conditions/Online/LHCb/Magnet/Set": online_xml,
            "Conditions/Online/Velo/MotionSystem": online_xml,
            "Conditions/Online/LHCb/Lumi/LumiSettings": online_xml,
            "Conditions/Online/LHCb/RunParameters": online_xml,
            "Conditions/Online/Rich1/R1HltGasParameters": online_xml,
            "Conditions/Online/Rich2/R2HltGasParameters": online_xml
        }
        ApplicationMgr().ExtSvc.append(rch)
コード例 #5
0
    def configureInit(self, inputType):
        # Init sequence
        if not self.isPropertySet("InitSequence"):
            if self._isReprocessing(inputType):
                self.setProp( "InitSequence", self.DefaultReproInitSequence )
            else:
                self.setProp( "InitSequence", self.DefaultInitSequence )
        from Configurables import ProcessPhase
        ProcessPhase("Init").DetectorList += self.getProp("InitSequence")

        from Configurables import RecInit, MemoryTool
        recInit = RecInit( "BrunelInit",
                           PrintFreq = self.getProp("PrintFreq"))
        GaudiSequencer("InitBrunelSeq").Members += [ recInit ]
        recInit.addTool( MemoryTool(), name = "BrunelMemory" )
        recInit.BrunelMemory.HistoTopDir = "Brunel/"
        recInit.BrunelMemory.HistoDir    = "MemoryTool"
        if not recInit.isPropertySet( "MemoryPurgeLimit" ): recInit.MemoryPurgeLimit = 2000 * 1000 # 2GB

        # count events
        from Configurables import EventCountHisto
        evtC = EventCountHisto("BrunelEventCount")
        evtC.HistoTopDir = "Brunel/"
        GaudiSequencer("InitBrunelSeq").Members += [ evtC ]

        # kill some RAW banks
        banksToKill = []
        if self.isPropertySet( "RawBanksToKill" ):
            banksToKill  = self.getProp( "RawBanksToKill" )
        if ("2009" == self.getProp("DataType")) and (inputType in ["MDF"]) and not self.getProp("Simulation") :
            banksToKill += ["VeloFull", "L0PUFull"]
        if len(banksToKill) > 0 :
            from Configurables import bankKiller
            bkKill = bankKiller("BrunelBankKiller")
            bkKill.BankTypes = banksToKill
            GaudiSequencer("InitBrunelSeq").Members += [ bkKill ]

        # Do not print event number at every event (done already by BrunelInit)
        EventSelector().PrintFreq = -1

        # OutputLevel
        self.setOtherProp(LHCbApp(),"OutputLevel")
        if self.isPropertySet( "OutputLevel" ) :
            level = self.getProp("OutputLevel")
            if level == ERROR or level == WARNING :
                # Suppress known warnings
                importOptions( "$BRUNELOPTS/SuppressWarnings.opts" )
                if not recInit.isPropertySet( "OutputLevel" ): recInit.OutputLevel = INFO
        self.setOtherProps(RecSysConf(), ["OutputLevel","Detectors"])
        self.setOtherProps(RecMoniConf(),["OutputLevel","Detectors"])

        # New NoSPDPRS switches
        noSPDPRS = False
        if [det for det in ['Spd', 'Prs'] if det not in self.getProp("Detectors")]:
            noSPDPRS = True
        # only set properties if no use RecoSequence is defined or if it contains 'PROTO'
        # not that 'PROTO' alone is not sufficient to run the Calo reconstruction, but a requirement
        if ( not self.isPropertySet("RecoSequence") or "PROTO" in self.getProp("RecoSequence") ):
            CaloProcessor().setProp("NoSpdPrs", noSPDPRS)
            GlobalRecoConf().setProp("NoSpdPrs", noSPDPRS)


        # Always print Magnetic Field used
        from Configurables import MagneticFieldSvc
        magSvc = MagneticFieldSvc()
        if not magSvc.isPropertySet("OutputLevel") :
            magSvc.setProp("OutputLevel", INFO)

        # Switch off LoKi banner
        from Configurables import LoKiSvc
        LoKiSvc().Welcome = False
コード例 #6
0
Escher().Kalman = True
Escher().Millepede = False
Escher().EvtMax = 1000
Escher().UseOracle = False
Escher().DatasetName = "Collisions2011"
Escher().PrintFreq = 100
TrackSys().ExpertTracking += ["simplifiedGeometry"]
TrackSys().TrackExtraInfoAlgorithms = ['']
RecSysConf().RecoSequence = [
    "Decoding", "VELO", "TT", "IT", "OT", "Tr", "Vertex", "CALO", "MUON"
]
Escher().MoniSequence = ["Tr", "OT", "ST"]

from Configurables import MagneticFieldSvc
MagneticFieldSvc().OutputLevel = 1

from Configurables import TAlignment
from TAlignment.Alignables import *
from TAlignment.SurveyConstraints import *

elements = Alignables()

elements.Velo("None")
#elements.VeloRight("TxTyTzRxRy")
#elements.VeloLeft("TxTyTzRxRy")
elements.VeloLeft("None")
elements.VeloRight("None")
#elements.VeloModules("TxTyTzRz")
#elements.VeloPhiSensors("TxTy")
#elements.VeloRSensors("None")
コード例 #7
0
###############################################################################
# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      #
#                                                                             #
# This software is distributed under the terms of the GNU General Public      #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
#                                                                             #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization  #
# or submit itself to any jurisdiction.                                       #
###############################################################################
from Gaudi.Configuration import *
import os
from Configurables import MagneticFieldSvc
from Configurables import MultipleMagneticFieldSvc

side = "R"
magnets = ["Q1", "Q2a", "Q2b", "Q3", "D1"]
files = [
    "Q1.MQXA.1R8", "Q2a.MQXB.2R8", "Q2b.MQXB.2R8", "Q3.MQXA.3R8", "D1.MBX.4R8"
]
for magnet, file in zip(magnets, files):
    fieldSvc = MagneticFieldSvc(magnet + side + "FieldSvc")
    fieldSvc.UseConditions = False
    path = os.path.join("$FIELDMAPROOT", "cdf", file + ".3500GeV.cdf")
    fieldSvc.FieldMapFiles = [path]
    svcName = "MagneticFieldSvc/" + magnet + side + "FieldSvc"
    MultipleMagneticFieldSvc().MagneticFieldServices += [svcName]
コード例 #8
0
def RecoTrackingHLT1(exclude=[],
                     simplifiedGeometryFit=True,
                     liteClustersFit=True):
    '''Function that defines the pattern recognition algorithms for the HLT1 sequence of the Run 2 offline tracking'''
    ## Start TransportSvc, needed by track fit
    ApplicationMgr().ExtSvc.append("TransportSvc")

    ## --------------------------------------------------------------------
    ## Pattern Recognition and Fitting
    ## --------------------------------------------------------------------

    # Which algs to run ?
    trackAlgs = TrackSys().getProp("TrackPatRecAlgorithms")

    # Which data type is it?
    dataType = TrackSys().getProp("DataType")

    # Decode the RAW banks
    ExcludedLayers = TrackSys().getProp("ExcludedLayers")
    DecodeTracking(trackAlgs, ExcludedLayers)

    from Configurables import STOfflinePosition
    IT = STOfflinePosition('ITClusterPosition')
    IT.DetType = "IT"
    TT = STOfflinePosition('TTClusterPosition')
    TT.DetType = "TT"

    from STTools import STOfflineConf
    STOfflineConf.DefaultConf().configureTools()

    ## Make sure the default extrapolator and interpolator use simplified material
    from Configurables import TrackMasterExtrapolator, TrackInterpolator, SimplifiedMaterialLocator, DetailedMaterialLocator
    if TrackSys().simplifiedGeometry() and ('SimpleGeom' not in exclude):
        TrackMasterExtrapolator().MaterialLocator = 'SimplifiedMaterialLocator'
        TrackInterpolator().addTool(TrackMasterExtrapolator(
            MaterialLocator='SimplifiedMaterialLocator'),
                                    name='Extrapolator')

    ### This configures public tools to use the new multiple scattering description without the log term
    from Configurables import StateThickMSCorrectionTool
    me = TrackMasterExtrapolator()
    me.addTool(DetailedMaterialLocator(), name="MaterialLocator")
    me.MaterialLocator.addTool(StateThickMSCorrectionTool,
                               name="StateMSCorrectionTool")
    me.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = True

    ti = TrackInterpolator()
    ti.addTool(me)

    from Configurables import TrackStateProvider
    tsp = TrackStateProvider()
    tsp.addTool(TrackInterpolator, name="Interpolator")
    tsp.addTool(TrackMasterExtrapolator, name="Extrapolator")
    tsp.Interpolator.addTool(TrackMasterExtrapolator, name='Extrapolator')
    if simplifiedGeometryFit or (TrackSys().simplifiedGeometry() and
                                 ('SimpleGeom' not in exclude)):
        tsp.Extrapolator.addTool(SimplifiedMaterialLocator,
                                 name="MaterialLocator")
        tsp.Interpolator.Extrapolator.addTool(SimplifiedMaterialLocator,
                                              name="MaterialLocator")
    else:
        tsp.Extrapolator.addTool(DetailedMaterialLocator,
                                 name="MaterialLocator")
        tsp.Interpolator.Extrapolator.addTool(DetailedMaterialLocator,
                                              name="MaterialLocator")
    tsp.Extrapolator.MaterialLocator.addTool(StateThickMSCorrectionTool,
                                             name="StateMSCorrectionTool")
    tsp.Extrapolator.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = True
    tsp.Interpolator.Extrapolator.MaterialLocator.addTool(
        StateThickMSCorrectionTool, name="StateMSCorrectionTool")
    tsp.Interpolator.Extrapolator.MaterialLocator.StateMSCorrectionTool.UseRossiAndGreisen = True
    ###

    ## Velo tracking
    ## Why is Velo not in the tracking sequence?
    if "FastVelo" in trackAlgs:
        from Configurables import FastVeloTracking
        GaudiSequencer("RecoVELOSeq").Members += [
            FastVeloTracking("FastVeloTracking")
        ]
        if TrackSys().timing():
            FastVeloTracking().TimingMeasurement = True

    ## Tracking sequence
    from Configurables import ProcessPhase
    track = ProcessPhase("TrackHLT1")
    GaudiSequencer("RecoTrHLT1Seq").Members += [track]

    from Configurables import MagneticFieldSvc
    if TrackSys().fieldOff():
        MagneticFieldSvc().ForcedSignedCurrentScaling = 0.

    if "noDrifttimes" in TrackSys().getProp("ExpertTracking"):
        from Configurables import (Tf__OTHitCreator)
        Tf__OTHitCreator("OTHitCreator").NoDriftTimes = True

    # Get the fitters
    from TrackFitter.ConfiguredFitters import ConfiguredFit, ConfiguredFitSeed, ConfiguredMasterFitter

    # Clone killer
    tracklists = []

    # Is this standard sequence?
    stdSeq = "fastSequence" not in TrackSys().getProp("ExpertTracking")

    ## Velo-TT pattern
    if "VeloTT" in trackAlgs:
        track.DetectorList += ["VeloTTPat"]
        from Configurables import PatVeloTTHybrid
        GaudiSequencer("TrackHLT1VeloTTPatSeq").Members += [
            PatVeloTTHybrid("PatVeloTTHybrid")
        ]
        from PatVeloTT import PatVeloTTAlgConf
        PatVeloTTAlgConf.PatVeloTTConf().configureAlgRun2HLT1()
        if TrackSys().timing():
            PatVeloTTHybrid("PatVeloTTHybrid").TimingMeasurement = True
        tracklists += ["Rec/Track/VeloTT"]

    ## Forward pattern
    if "ForwardHLT1" in trackAlgs:
        if "VeloTT" not in trackAlgs:
            raise RuntimeError("Cannot run HLT1 forward without VeloTT")

        track.DetectorList += ["ForwardPatHLT1"]
        from Configurables import PatForward, PatForwardTool
        GaudiSequencer("TrackHLT1ForwardPatHLT1Seq").Members += [
            PatForward("PatForwardHLT1")
        ]

        # should be replaced by more 'global' tracking configuration
        from PatAlgorithms import PatAlgConf
        PatAlgConf.ForwardConf().configureAlgRun2HLT1()
        if TrackSys().timing():
            PatForward("PatForwardHLT1").TimingMeasurement = True
        tracklists += ["Rec/Track/ForwardHLT1"]

    ## Fitting all HLT1 tracks
    track.DetectorList += ["FitHLT1"]

    from Configurables import TrackEventFitter, TrackInitFit, TrackStateInitTool, TrackStateInitAlg, TrackMasterExtrapolator, TrackMasterFitter
    from Configurables import SimplifiedMaterialLocator, DetailedMaterialLocator
    from Configurables import TrackContainerCopy

    ######
    ### Fitter for Velo tracks
    ######
    if "FastVelo" in trackAlgs:
        if "VeloForwardKalmanHLT1" in TrackSys().getProp("ExpertTracking"):
            # This is the option for the 2015 early measurements
            veloFitter = TrackEventFitter('VeloOnlyFitterAlg')
            veloFitter.TracksInContainer = "Rec/Track/Velo"
            veloFitter.TracksOutContainer = "Rec/Track/FittedHLT1VeloTracks"
            veloFitter.Fitter = "TrackInitFit/Fit"
            veloFitter.addTool(TrackInitFit, "Fit")
            veloFitter.Fit.Init = "TrackStateInitTool/VeloOnlyStateInit"
            veloFitter.Fit.addTool(TrackStateInitTool, "VeloOnlyStateInit")
            veloFitter.Fit.VeloOnlyStateInit.VeloFitterName = "FastVeloFitLHCbIDs"
            veloFitter.Fit.VeloOnlyStateInit.addTool(TrackMasterExtrapolator,
                                                     "Extrapolator")
            if (simplifiedGeometryFit):
                veloFitter.Fit.VeloOnlyStateInit.Extrapolator.addTool(
                    SimplifiedMaterialLocator, name="MaterialLocator")
            else:
                veloFitter.Fit.VeloOnlyStateInit.Extrapolator.addTool(
                    DetailedMaterialLocator, name="MaterialLocator")

            veloFitter.Fit.Fit = "TrackMasterFitter/Fit"
            veloFitter.Fit.addTool(TrackMasterFitter, name="Fit")

            from TrackFitter.ConfiguredFitters import ConfiguredForwardFitter
            ConfiguredForwardFitter(veloFitter.Fit.Fit,
                                    LiteClusters=liteClustersFit)

            GaudiSequencer("TrackHLT1FitHLT1Seq").Members += [veloFitter]

        else:
            # and this is the option for after the early measurements
            # copy tracks from pat reco output container to a new one
            copyVeloTracks = TrackContainerCopy("CopyVeloTracks")
            copyVeloTracks.inputLocations = ["Rec/Track/Velo"]
            copyVeloTracks.outputLocation = "Rec/Track/FittedHLT1VeloTracks"

            from FastVelo import FastVeloAlgConf
            stateInit = TrackStateInitAlg('VeloOnlyInitAlg')
            FastVeloAlgConf.FastVeloKalmanConf().configureFastKalmanFit(
                init=stateInit)
            GaudiSequencer("TrackHLT1FitHLT1Seq").Members += [
                copyVeloTracks, stateInit
            ]

    ######
    ### Fitter for Forward tracks
    ### Need to be careful: This is all a little fragile, so if you plan to change something, check that everything configures the way you expect
    ### The Extrapolator for the StateInitTool does not use material corrections, so don't need to explicitely add the StateThickMSCorrectionTool
    ######
    if "ForwardHLT1" in trackAlgs:
        fwdFitter = TrackEventFitter('ForwardHLT1FitterAlg')
        fwdFitter.TracksInContainer = "Rec/Track/ForwardHLT1"
        fwdFitter.TracksOutContainer = "Rec/Track/FittedHLT1ForwardTracks"
        # Keep only good tracks, this cut should be aligned with the one in the TrackBestTrackCreator
        fwdFitter.MaxChi2DoF = 4.0
        fwdFitter.Fitter = "TrackInitFit/Fit"
        fwdFitter.addTool(TrackInitFit, "Fit")
        fwdFitter.Fit.Init = "TrackStateInitTool/FwdStateInit"
        fwdFitter.Fit.addTool(TrackStateInitTool, "FwdStateInit")
        fwdFitter.Fit.FwdStateInit.addTool(TrackMasterExtrapolator,
                                           "Extrapolator")
        fwdFitter.Fit.FwdStateInit.UseFastMomentumEstimate = True
        fwdFitter.Fit.FwdStateInit.VeloFitterName = "FastVeloFitLHCbIDs"
        if (simplifiedGeometryFit):
            fwdFitter.Fit.FwdStateInit.Extrapolator.addTool(
                SimplifiedMaterialLocator, name="MaterialLocator")
        else:
            fwdFitter.Fit.FwdStateInit.Extrapolator.addTool(
                DetailedMaterialLocator, name="MaterialLocator")

        fwdFitter.Fit.Fit = "TrackMasterFitter/Fit"
        fwdFitter.Fit.addTool(TrackMasterFitter, name="Fit")

        from TrackFitter.ConfiguredFitters import ConfiguredMasterFitter
        ConfiguredMasterFitter(fwdFitter.Fit.Fit,
                               SimplifiedGeometry=simplifiedGeometryFit,
                               LiteClusters=liteClustersFit,
                               MSRossiAndGreisen=True)

        GaudiSequencer("TrackHLT1FitHLT1Seq").Members += [fwdFitter]
コード例 #9
0
###############################################################################
# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      #
#                                                                             #
# This software is distributed under the terms of the GNU General Public      #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
#                                                                             #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization  #
# or submit itself to any jurisdiction.                                       #
###############################################################################
from Gaudi.Configuration import *
# Options to switch on measured magnetic field

from Configurables import MagneticFieldSvc
import os

MagneticFieldSvc().FieldMapFiles = [
    os.path.join("$FIELDMAPROOT", "cdf", "field048.c1.vp.cdf"),
    os.path.join("$FIELDMAPROOT", "cdf", "field048.c2.vp.cdf"),
    os.path.join("$FIELDMAPROOT", "cdf", "field048.c3.vp.cdf"),
    os.path.join("$FIELDMAPROOT", "cdf", "field048.c4.vp.cdf")
]
コード例 #10
0
def main():

    # Setup the option parser
    usage = "usage: %prog [options] inputfile <inputfile>"
    parser = optparse.OptionParser(usage=usage)
    parser.add_option("-d",
                      "--datatype",
                      action="store",
                      dest="DataType",
                      default="2009",
                      help="DataType to run on.")
    parser.add_option("-n",
                      "--evtmax",
                      type="int",
                      action="store",
                      dest="EvtMax",
                      default=1e4,
                      help="Number of events to run")
    parser.add_option("--dddbtag",
                      action="store",
                      dest="DDDBtag",
                      default='MC09-20090602',
                      help="DDDBTag to use")
    parser.add_option("--conddbtag",
                      action="store",
                      dest="CondDBtag",
                      default='sim-20090402-vc-md100',
                      help="CondDBtag to use")
    parser.add_option("--settings",
                      action="store",
                      dest="ThresholdSettings",
                      default='Physics_10000Vis_1000L0_40Hlt1_Apr09',
                      help="ThresholdSettings to use")
    parser.add_option("-s",
                      "--simulation",
                      action="store_true",
                      dest="Simulation",
                      default=False,
                      help="Run on simulated data")
    parser.add_option("--dbsnapshot",
                      action="store_true",
                      dest="UseDBSnapshot",
                      default=False,
                      help="Use a DB snapshot")
    parser.add_option("--snd",
                      action="store",
                      dest="SnapshotDirectory",
                      default='/user/graven/MOORE/conditions',
                      type="string",
                      help="DB Snapshot directory")
    parser.add_option("--oracle",
                      action="store_true",
                      dest="UseOracle",
                      default=False,
                      help="Use Oracle")
    parser.add_option("-v",
                      "--verbose",
                      action="store_true",
                      dest="Verbose",
                      default=False,
                      help="Verbose output")
    parser.add_option("--acceptslow",
                      action="store_true",
                      dest="AcceptIfSlow",
                      default=False,
                      help="Accept slow events")
    parser.add_option("--hlt1lines",
                      action="store",
                      dest="Hlt1Lines",
                      default="",
                      help="Colon seperated list of additional hlt1 lines")
    parser.add_option("--hlt2lines",
                      action="store",
                      dest="Hlt2Lines",
                      default="",
                      help="Colon seperated list of additional hlt2 lines")
    parser.add_option("--rch",
                      action="store_true",
                      dest="RunChangeHandler",
                      default=False,
                      help="Use the RunChangeHandler")
    parser.add_option("--l0",
                      action="store_true",
                      dest="L0",
                      default=False,
                      help="Rerun L0")
    parser.add_option("--site",
                      action="store",
                      type="string",
                      dest="Site",
                      default="",
                      help="Site at which we run")
    parser.add_option("--tempdir",
                      action="store",
                      type="string",
                      dest="Tempdir",
                      default="/tmpdir",
                      help="Tempdir for the filestager")
    parser.add_option("--tuplefile",
                      action="store",
                      type="string",
                      dest="TupleFile",
                      default="tuples.root",
                      help="NTuple filename")
    parser.add_option("-f",
                      "--filestager",
                      action="store_true",
                      dest="FileStager",
                      default=False,
                      help="Use the filestager")
    parser.add_option(
        "-c",
        "--verbose_classes",
        action="store",
        type="string",
        dest="VerboseClasses",
        default="",
        help="Colon seperated list of classes to be made verbose.")

    # Parse the command line arguments
    (options, args) = parser.parse_args()

    # Put the options into the Moore configurable
    Moore().ThresholdSettings = options.ThresholdSettings

    Moore().Verbose = options.Verbose
    Moore().EvtMax = options.EvtMax

    Moore().UseDBSnapshot = options.UseDBSnapshot
    Moore().DBSnapshotDirectory = options.SnapshotDirectory
    Moore().DDDBtag = options.DDDBtag
    Moore().CondDBtag = options.CondDBtag
    Moore().Simulation = options.Simulation
    Moore().DataType = options.DataType
    Moore().EnableAcceptIfSlow = options.AcceptIfSlow
    Moore().outputFile = ""
    Moore().ForceSingleL0Configuration = False
    Moore().RequireRoutingBits = [0x0, 0x4, 0x0]
    Moore().L0 = options.L0
    Moore().ReplaceL0BanksWithEmulated = options.L0

    if options.UseOracle:
        CondDB().UseOracle = True
        site = 'UNKNOWN'
        try:
            site = os.environ['DIRACSITE']
        except KeyError:
            if len(options.Site):
                site = options.Site
                config = ConfigLFC(site)
                appendPostConfigAction(config.setLFCSite)

    # Inputdata is now handled through separate option files, this is for
    # testing/convenience
    if len(args):
        Moore().inputFiles = args

    try:
        descriptor = EventSelector().Input[0]
        if descriptor.find(".raw") != -1:
            from Configurables import LHCb__RawDataCnvSvc as RawDataCnvSvc
            EventPersistencySvc().CnvServices.append(
                RawDataCnvSvc('RawDataCnvSvc'))
        elif descriptor.find(".dst") != -1:
            importOptions('$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts')
    except IndexError:
        pass

    freq = 0
    if (len(options.VerboseClasses)):
        freq = 1
    else:
        freq = 100
    EventSelector().PrintFreq = freq

    # RunChangeHandler
    if options.RunChangeHandler:
        Moore().EnableRunChangeHandler = True
        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True

    # XMLSummary
    from Configurables import LHCbApp
    LHCbApp().XMLSummary = 'summary.xml'

    # Use the filestager?
    if options.FileStager:
        from FileStager.Configuration import configureFileStager
        configureFileStager()

    # Put the comma separated lists of lines into lists
    hlt1Lines = []
    for line in options.Hlt1Lines.split(";"):
        if (len(line.strip())):
            hlt1Lines.append(line)

    hlt2Lines = []
    for line in options.Hlt2Lines.split(";"):
        if (len(line.strip())):
            hlt2Lines.append(line)

    # parse the specification of the classes to set to verbose
    verboseClasses = []
    for cl in options.VerboseClasses.split(";"):
        cl = cl.strip()
        if (len(cl)):
            verboseClasses.append(cl.replace("::", "__"))

    # Instantiate the class to apply the required configuration
    config = Config(hlt1Lines, hlt2Lines)
    appendPostConfigAction(config.postConfigAction)

    # Set the OutputLevel for requested classed
    if len(verboseClasses):
        configOL = ConfigOutputLevel(verboseClasses, 1)
        appendPostConfigAction(configOL.setOutputLevel)

    # Add the TupleHltDecReports alg to the sequence
    if options.TupleFile:
        tupleAlg = TupleHltDecReports("TupleHltDecReports")
        addTupleAlg = ConfigTupleAlg(filename=options.TupleFile)
        appendPostConfigAction(addTupleAlg.addTupleAlg)

    # Instantiate the AppMgr
    appMgr = AppMgr()

    # Make sure that we have Hlt lines to run
    if not len(Sequence("Hlt1").Members) or not len(Sequence("Hlt2").Members):
        print "error, no lines to run\n"
        return 2

    # Run the required number of events
    sc = appMgr.run(Moore().EvtMax)
    if sc.isFailure(): return 2

    # Done
    sc = appMgr.exit()
    if sc.isFailure():
        return 2
    else:
        return 0
コード例 #11
0
def RecoTracking(exclude=[]):
    '''What used to be in the options file, moved here'''
    ## Start TransportSvc, needed by track fit
    ApplicationMgr().ExtSvc.append("TransportSvc")

    ## --------------------------------------------------------------------
    ## Pattern Recognition and Fitting
    ## --------------------------------------------------------------------

    # Which algs to run ?
    trackAlgs = TrackSys().getProp("TrackPatRecAlgorithms")

    # Which data type is it?
    dataType = TrackSys().getProp("DataType")

    # Decode the RAW banks
    DecodeTracking(trackAlgs)

    from Configurables import STOfflinePosition
    IT = STOfflinePosition('ITClusterPosition')
    IT.DetType = "IT"
    TT = STOfflinePosition('TTClusterPosition')
    TT.DetType = "TT"

    from STTools import STOfflineConf
    STOfflineConf.DefaultConf().configureTools()

    #importOptions( "$STTOOLSROOT/options/Brunel.opts" )

    ## Velo tracking
    if "FastVelo" in trackAlgs:
        from Configurables import FastVeloTracking
        GaudiSequencer("RecoVELOSeq").Members += [FastVeloTracking()]
        if TrackSys().timing():
            FastVeloTracking().TimingMeasurement = True

    if "Velo" in trackAlgs:
        from Configurables import Tf__PatVeloGeneralTracking
        if TrackSys().veloOpen():
            if TrackSys().beamGas():
                from Configurables import Tf__PatVeloGeneric
                GaudiSequencer("RecoVELOSeq").Members += [
                    Tf__PatVeloGeneric("PatVeloGeneric"),
                    Tf__PatVeloGeneralTracking("PatVeloGeneralTracking")
                ]
            else:
                from Configurables import Tf__PatVeloTrackTool
                GaudiSequencer("RecoVELOSeq").Members += [
                    Tf__PatVeloGeneralTracking("PatVeloGeneralTracking")
                ]
                Tf__PatVeloGeneralTracking(
                    "PatVeloGeneralTracking").PointErrorMin = 2 * mm
                Tf__PatVeloGeneralTracking("PatVeloGeneralTracking").addTool(
                    Tf__PatVeloTrackTool("PatVeloTrackTool"))
                Tf__PatVeloTrackTool("PatVeloTrackTool").highChargeFract = 0.5
                if TrackSys().timing():
                    Tf__PatVeloGeneralTracking(
                        "PatVeloGeneralTracking").TimingMeasurement = True
        else:
            from Configurables import (Tf__PatVeloRTracking,
                                       Tf__PatVeloSpaceTool,
                                       Tf__PatVeloSpaceTracking)
            GaudiSequencer("RecoVELOSeq").Members += [
                Tf__PatVeloRTracking("PatVeloRTracking"),
                Tf__PatVeloSpaceTracking("PatVeloSpaceTracking"),
                Tf__PatVeloGeneralTracking("PatVeloGeneralTracking")
            ]
            Tf__PatVeloSpaceTracking("PatVeloSpaceTracking").addTool(
                Tf__PatVeloSpaceTool(), name="PatVeloSpaceTool")
            Tf__PatVeloSpaceTracking("PatVeloSpaceTracking"
                                     ).PatVeloSpaceTool.MarkClustersUsed = True
            if TrackSys().timing():
                Tf__PatVeloSpaceTracking(
                    "PatVeloSpaceTracking").TimingMeasurement = True
                Tf__PatVeloRTracking(
                    "PatVeloRTracking").TimingMeasurement = True
                Tf__PatVeloGeneralTracking(
                    "PatVeloGeneralTracking").TimingMeasurement = True

    ## Make sure the default extrapolator and interpolator use simplified material
    if TrackSys().simplifiedGeometry() and ('SimpleGeom' not in exclude):
        from Configurables import TrackMasterExtrapolator, TrackInterpolator
        TrackMasterExtrapolator().MaterialLocator = 'SimplifiedMaterialLocator'
        TrackInterpolator().addTool(TrackMasterExtrapolator(
            MaterialLocator='SimplifiedMaterialLocator'),
                                    name='Extrapolator')

    ## Tracking sequence
    from Configurables import ProcessPhase
    track = ProcessPhase("Track")
    GaudiSequencer("RecoTrSeq").Members += [track]

    from Configurables import MagneticFieldSvc
    if TrackSys().fieldOff():
        MagneticFieldSvc().ForcedSignedCurrentScaling = 0.

    if "noDrifttimes" in TrackSys().getProp("ExpertTracking"):
        from Configurables import (Tf__OTHitCreator)
        Tf__OTHitCreator("OTHitCreator").NoDriftTimes = True

    # Get the fitters
    from TrackFitter.ConfiguredFitters import ConfiguredFit, ConfiguredFitSeed, ConfiguredMasterFitter

    # Clone killer
    tracklists = []

    # Is this standard sequence?
    stdSeq = "fastSequence" not in TrackSys().getProp("ExpertTracking")

    # TrackMatching not supported anymore, raise error
    if "Match" in trackAlgs:
        raise RuntimeError(
            "TrackMatching not supported anymore. If you think this is wrong, report to [email protected]"
        )

    ## Forward pattern
    if "Forward" in trackAlgs:
        track.DetectorList += ["ForwardPat"]
        from Configurables import PatForward
        GaudiSequencer("TrackForwardPatSeq").Members += [
            PatForward("PatForward")
        ]
        from PatAlgorithms import PatAlgConf
        PatAlgConf.ForwardConf().configureAlg()
        if TrackSys().timing():
            PatForward("PatForward").TimingMeasurement = True
        tracklists += ["Rec/Track/Forward"]

    ## Seed pattern
    if "TsaSeed" in trackAlgs and "PatSeed" in trackAlgs:
        raise RuntimeError("Cannot run both Tsa and Pat Seeding at once")

    if "TsaSeed" in trackAlgs:
        track.DetectorList += ["SeedPat"]
        from Configurables import Tf__Tsa__Seed, Tf__Tsa__SeedTrackCnv
        GaudiSequencer("TrackSeedPatSeq").Members += [
            Tf__Tsa__Seed("TsaSeed"),
            Tf__Tsa__SeedTrackCnv("TsaSeedTrackCnv")
        ]
        from TsaAlgorithms import TsaAlgConf
        TsaAlgConf.TsaSeedConf().configureAlg()
        if TrackSys().timing():
            Tf__Tsa__Seed("TsaSeed").TimingMeasurement = True

    if "PatSeed" in trackAlgs:
        track.DetectorList += ["SeedPat"]
        from Configurables import PatSeeding
        GaudiSequencer("TrackSeedPatSeq").Members += [PatSeeding("PatSeeding")]
        from PatAlgorithms import PatAlgConf
        PatAlgConf.SeedingConf().configureAlg()

        if TrackSys().timing():
            PatSeeding("PatSeeding").TimingMeasurement = True

        if TrackSys().cosmics():
            from PatAlgorithms import PatAlgConf
            PatAlgConf.CosmicConf().configureAlg()

    if "TsaSeed" in trackAlgs or "PatSeed" in trackAlgs:
        tracklists += ["Rec/Track/Seed"]
        # TrackMatching not supported anymore, comment for the moment in case anything breaks
        #if "Match" in trackAlgs :
        # Fit now
        #track.DetectorList += [ "SeedFit" ]
        ## Seed fit initialization
        #from Configurables import TrackStateInitAlg, TrackStateInitTool
        #initSeedFit = TrackStateInitAlg("InitSeedFit",
        #                                TrackLocation = "Rec/Track/Seed")
        #GaudiSequencer("TrackSeedFitSeq").Members += [initSeedFit]
        #if "FastVelo" in trackAlgs :
        #   initSeedFit.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs"
        # Use small ErrorQoP fitter, needed for Match
        #GaudiSequencer("TrackSeedFitSeq").Members += [ConfiguredFitSeed()]

    # TrackMatching not supported anymore, comment for the moment in case anything breaks
    ## Match
    #if "Match" in trackAlgs and "PatMatch" in trackAlgs :
    #   raise RuntimeError("Cannot run both TrackMatching and PatMatch at once")
    #if "Match" in trackAlgs :
    #   track.DetectorList += [ "MatchPat" ]
    #   from Configurables import TrackMatchVeloSeed
    #   GaudiSequencer("TrackMatchPatSeq").Members += [ TrackMatchVeloSeed("TrackMatch") ]
    #   from TrackMatching import TrackMatchConf
    #   TrackMatchConf.MatchingConf().configureAlg()
    #   TrackMatchVeloSeed("TrackMatch").LikCut = -99999.
    #   if TrackSys().timing() :
    #      TrackMatchVeloSeed("TrackMatch").TimingMeasurement = True;

    if "PatMatch" in trackAlgs:
        track.DetectorList += ["MatchPat"]
        from Configurables import PatMatch
        GaudiSequencer("TrackMatchPatSeq").Members += [PatMatch("PatMatch")]
    if "Match" in trackAlgs or "PatMatch" in trackAlgs:
        tracklists += ["Rec/Track/Match"]

    ## Downstream
    if "Downstream" in trackAlgs:
        track.DetectorList += ["DownstreamPat"]
        from Configurables import PatDownstream
        GaudiSequencer("TrackDownstreamPatSeq").Members += [PatDownstream()]
        tracklists += ["Rec/Track/Downstream"]
        from PatAlgorithms import PatAlgConf
        #PatAlgConf.DownstreamConf().configureAlg()
        if TrackSys().timing():
            PatDownstream("PatDownstream").TimingMeasurement = True

    ## Velo-TT pattern
    if "VeloTT" in trackAlgs:
        track.DetectorList += ["VeloTTPat"]
        # from 2015 on, 'VeloTTHybrid' is used (as in the HLT)
        # on python configuration is used
        if dataType is "2015":
            from Configurables import PatVeloTTHybrid
            GaudiSequencer("TrackVeloTTPatSeq").Members += [
                PatVeloTTHybrid("PatVeloTTHybrid")
            ]
            if TrackSys().timing():
                PatVeloTTHybrid("PatVeloTTHybrid").TimingMeasurement = True
        # for everything older, the old 'PatVeloTT' is run
        else:
            from Configurables import PatVeloTT
            GaudiSequencer("TrackVeloTTPatSeq").Members += [
                PatVeloTT("PatVeloTT")
            ]
            from PatVeloTT.PatVeloTTAlgConf import PatVeloTTConf
            PatVeloTTConf().configureAlg()
            if TrackSys().timing():
                PatVeloTT("PatVeloTT").TimingMeasurement = True
        tracklists += ["Rec/Track/VeloTT"]

    ### Clean clone and fit
    track.DetectorList += ["Fit"]
    if TrackSys().getProp("OldCloneKiller"):
        from Configurables import TrackEventCloneKiller, TrackStateInitAlg, TrackContainerCopy
        cloneKiller = TrackEventCloneKiller()
        cloneKiller.TracksInContainers = tracklists
        cloneKiller.TracksOutContainer = "Rec/Track/AllBest"
        GaudiSequencer("TrackFitSeq").Members += [cloneKiller]
        stateInitAlg = TrackStateInitAlg("InitBestFit")
        stateInitAlg.TrackLocation = "Rec/Track/AllBest"
        if "FastVelo" in trackAlgs:
            stateInitAlg.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs"
        GaudiSequencer("TrackFitSeq").Members += [stateInitAlg]

        GaudiSequencer("TrackFitSeq").Members += [
            ConfiguredFit("FitBest", "Rec/Track/AllBest")
        ]
        copyBest = TrackContainerCopy("CopyBest")
        copyBest.inputLocations = ["Rec/Track/AllBest"]
        GaudiSequencer("TrackFitSeq").Members += [copyBest]

        ## Velo fitting
        if "Velo" in trackAlgs or "FastVelo" in trackAlgs:
            ## Prepare the velo tracks for the fit
            track.DetectorList += ["VeloFit"]
            from Configurables import TrackPrepareVelo
            GaudiSequencer("TrackVeloFitSeq").Members += [TrackPrepareVelo()]
            ## Fit the velo tracks
            GaudiSequencer("TrackVeloFitSeq").Members += [
                ConfiguredFit("FitVelo", "Rec/Track/PreparedVelo")
            ]
            ## copy the velo tracks to the "best" container
            copyVelo = TrackContainerCopy("CopyVelo")
            copyVelo.inputLocations = ["Rec/Track/PreparedVelo"]
            GaudiSequencer("TrackVeloFitSeq").Members += [copyVelo]
    else:
        # complete the list of track lists
        if "Velo" in trackAlgs or "FastVelo" in trackAlgs:
            tracklists += ["Rec/Track/Velo"]
        # create the best track creator
        from Configurables import TrackBestTrackCreator
        bestTrackCreator = TrackBestTrackCreator(TracksInContainers=tracklists)
        # configure its fitter and stateinittool
        ConfiguredMasterFitter(bestTrackCreator.Fitter)
        if "FastVelo" in trackAlgs:
            bestTrackCreator.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs"
        # add to the sequence
        GaudiSequencer("TrackFitSeq").Members.append(bestTrackCreator)

    ### Change dEdx correction for simulated data
    if TrackSys().getProp("Simulation"):
        from Configurables import StateDetailedBetheBlochEnergyCorrectionTool, DetailedMaterialLocator
        if TrackSys().getProp("OldCloneKiller"):
            from Configurables import TrackEventFitter, TrackMasterFitter
            fitBest = TrackEventFitter("FitBest")
            fitBest.Fitter.MaterialLocator.addTool(
                StateDetailedBetheBlochEnergyCorrectionTool("GeneralDedxTool"))
            fitBest.Fitter.MaterialLocator.GeneralDedxTool.EnergyLossFactor = 0.76
        else:
            from Configurables import TrackBestTrackCreator
            fitter = TrackBestTrackCreator().Fitter
            fitter.MaterialLocator.addTool(
                StateDetailedBetheBlochEnergyCorrectionTool("GeneralDedxTool"))
            fitter.MaterialLocator.GeneralDedxTool.EnergyLossFactor = 0.76

    ## Extra track information sequence
    extraInfos = TrackSys().getProp("TrackExtraInfoAlgorithms")
    if len(extraInfos) > 0:

        track.DetectorList += ["AddExtraInfo"]

        ## Clone finding and flagging
        if "CloneFlagging" in extraInfos:
            from Configurables import TrackBuildCloneTable, TrackCloneCleaner
            trackClones = GaudiSequencer("TrackClonesSeq")
            GaudiSequencer("TrackAddExtraInfoSeq").Members += [trackClones]
            if TrackSys().timing():
                trackClones.MeasureTime = True
            cloneTable = TrackBuildCloneTable("FindTrackClones")
            cloneTable.maxDz = 500 * mm
            cloneTable.zStates = [0 * mm, 990 * mm, 9450 * mm]
            cloneTable.klCut = 5e3
            cloneCleaner = TrackCloneCleaner("FlagTrackClones")
            cloneCleaner.CloneCut = 5e3
            trackClones.Members += [cloneTable, cloneCleaner]

        ## Add expected hit information
        #if "ExpectedHits" in extraInfos :
        #   GaudiSequencer("TrackAddExtraInfoSeq").Members += [ TrackComputeExpectedHits() ]

        ## Add the likelihood information
        if "TrackLikelihood" in extraInfos and ('TrackLikelihood'
                                                not in exclude):
            from Configurables import TrackAddLikelihood, TrackLikelihood
            trackAddLikelihood = TrackAddLikelihood()
            trackAddLikelihood.addTool(TrackLikelihood,
                                       name="TrackMatching_likTool")
            trackAddLikelihood.TrackMatching_likTool.otEff = 0.9
            GaudiSequencer("TrackAddExtraInfoSeq").Members += [
                trackAddLikelihood
            ]

        ## ghost probability using a Neural Net
        if "GhostProbability" in extraInfos:
            from Configurables import TrackAddNNGhostId, TrackNNGhostId
            nn = TrackAddNNGhostId()
            GaudiSequencer("TrackAddExtraInfoSeq").Members += [nn]

    track.DetectorList += ["EraseExtraInformation"]
    from Configurables import TrackEraseExtraInfo
    GaudiSequencer("TrackEraseExtraInformationSeq").Members += [
        TrackEraseExtraInfo()
    ]

    ## Muon alignment tracks
    if "MuonAlign" in trackAlgs:
        from Configurables import TrackEventFitter, AlignMuonRec
        track.DetectorList += ["MuonRec"]
        GaudiSequencer("TrackMuonRecSeq").Members += [
            AlignMuonRec("AlignMuonRec"),
            TrackEventFitter("MuonTrackFitter")
        ]
        importOptions("$TRACKSYSROOT/options/AlignMuonRec.opts")
        if TrackSys().fieldOff():
            AlignMuonRec("AlignMuonRec").BField = False
            importOptions("$STDOPTS/DstContentMuonAlign.opts")
コード例 #12
0
    def configureDBSnapshot(self):
        """
        Configure the database to use the online snapshot
        """
        tag = {
            "DDDB": self.getProp('DDDBtag'),
            "LHCBCOND": self.getProp('CondDBtag'),
            "SIMCOND": self.getProp('CondDBtag'),
            "ONLINE": 'fake'
        }

        # https://savannah.cern.ch/bugs/?94454#comment12
        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True

        from Configurables import CondDB
        cdb = CondDB()
        cdb.Tags = tag
        cdb.setProp('IgnoreHeartBeat', True)
        self.setOtherProps(
            cdb, ['UseDBSnapshot', 'DBSnapshotDirectory', 'PartitionName'])

        # So, here is the problem: we don't want to run the risk that
        # the CondDB() configurable (which configures /after/ us)
        # overwrites our conditions. Yet, we don't want to miss the
        # default conditions (e.g. velo stepper motor, magnetic field)
        # either. if we add our conditions to its
        # RunChangeHandlerConditions list, then we a) need to fix the
        # path and b) don't know what happens for conditions that
        # appear twice, because we don't control the ordering of the
        # list. So, the hack is:
        # - don't set 'EnableRunChangeHandler'
        # - copy what is hidden behind that flag in CondDB()._configureDBSnapshot
        # - do the test of the RunChangeHandler configuration ourselves:
        cdb.setProp('EnableRunChangeHandler', False)
        from Configurables import RunChangeHandlerSvc
        rch = RunChangeHandlerSvc()
        ApplicationMgr().ExtSvc.append(rch)
        baseloc = self.getProp("DBSnapshotDirectory")
        rch.Conditions = dict(
            (c, '/'.join([baseloc, f]))
            for f, cs in cdb.getProp("RunChangeHandlerConditions").iteritems()
            for c in cs)

        #path = self.getProp('DBSnapshotDirectory') + "/.."*4 + "/group/online/AligWork/current/"
        allconds = {
            'Velo': [
                'Conditions/Alignment/Velo/VeloSystem',
                'Conditions/Alignment/Velo/VeloRight',
                'Conditions/Alignment/Velo/VeloLeft'
            ] +
            ['Conditions/Alignment/Velo/Module%02d' % i
             for i in range(0, 42)] + [
                 'Conditions/Alignment/Velo/Detector%02d-%02d' %
                 (i, (1 + i / 2) % 2) for i in range(0, 42)
             ],
            'IT': [] + ['Conditions/Alignment/IT/ITSystem'] +
            ['Conditions/Alignment/IT/ITT%d' % i for i in range(1, 4)] + [
                'Conditions/Alignment/IT/ITT%d%sBox' % (i, b)
                for i in range(1, 4)
                for b in ['Top', 'Bottom', 'ASide', 'CSide']
            ] + [
                'Conditions/Alignment/IT/ITT%d%sLayer%s' % (i, b, l)
                for i in range(1, 4)
                for b in ['Top', 'Bottom', 'ASide', 'CSide']
                for l in ['X1', 'U', 'V', 'X2']
            ] + [
                'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%d' % (i, b, l, a)
                for i in range(1, 4)
                for b in ['Top', 'Bottom', 'ASide', 'CSide']
                for l in ['X1', 'U', 'V', 'X2'] for a in range(1, 8)
            ],
            #        + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ]
            #        + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor1' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ]
            #        + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor2' % (i,b,l,a) for i in range(1,4) for b in ['ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] ,
            'OT': [] + ['Conditions/Alignment/OT/OTSystem'] +
            ['Conditions/Alignment/OT/T%d' % i for i in range(1, 4)] + [
                'Conditions/Alignment/OT/T%d%s' % (i, l) for i in range(1, 4)
                for l in ['X1', 'U', 'V', 'X2']
            ] + [
                'Conditions/Alignment/OT/T%d%sQ%d' % (i, l, q)
                for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2']
                for q in range(0, 4)
            ] + [
                'Conditions/Alignment/OT/T%d%sQ%dM%d' % (i, l, q, m)
                for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2']
                for q in range(0, 4) for m in range(1, 10)
            ],
            'TT': [] + ['Conditions/Alignment/TT/TTSystem'] +
            ['Conditions/Alignment/TT/TT%s' % i for i in ['a', 'b']] + [
                'Conditions/Alignment/TT/TT%sLayer' % (l)
                for l in ['aX', 'aU', 'bV', 'bX']
            ] + [
                'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w)
                for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX']
                for r in range(1, 4) for m in range(1, 4)
            ] + [
                'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w)
                for w in ['T', 'B'] for l in ['bV', 'bX'] for r in range(1, 4)
                for m in range(4, 6)
            ] + [
                'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w)
                for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX']
                for r in [1, 3] for m in range(6, 7)
            ] + [
                'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w)
                for w in ['T', 'B'] for l in ['aX', 'aU'] for r in [1, 3]
                for m in range(4, 6)
            ],
            'Muon': [] + ['Conditions/Alignment/Muon/MuonSystem'] +
            ['Conditions/Alignment/Muon/M%sStation' % i for i in range(1, 6)] +
            ['Conditions/Alignment/Muon/M%sASide' % i for i in range(1, 6)] +
            ['Conditions/Alignment/Muon/M%sCSide' % i for i in range(1, 6)]
        }

        ## This is a bit dirty, since we're supposed to control TAlignment. We
        ## know that this is set from top level, so let's give it a try anyway
        ta = TAlignment()
        sdToWrite = set(ta.getProp("WriteCondSubDetList"))
        pat = self.getProp("OnlineAligWorkDir") + "/xml/%s.xml"
        conditionmap = dict((pat % sd, f) for (sd, f) in allconds.iteritems()
                            if sd in sdToWrite)

        # add to the existing map
        rch.Conditions = dict(rch.Conditions.items() + dict(
            (c, f) for f, cs in conditionmap.iteritems() for c in cs).items())

        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True
コード例 #13
0
###############################################################################
# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      #
#                                                                             #
# This software is distributed under the terms of the GNU General Public      #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   #
#                                                                             #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization  #
# or submit itself to any jurisdiction.                                       #
###############################################################################
from Gaudi.Configuration import *

from Configurables import MagneticFieldSvc
# MBXW compensator
mbxwh = MagneticFieldSvc("MBXWHFieldSvc")
# MBXWS correctors
mbxwsL = MagneticFieldSvc("MBXWSLFieldSvc")
mbxwsR = MagneticFieldSvc("MBXWSRFieldSvc")

mbxwh.UseConditions = False
mbxwsL.UseConditions = False
mbxwsR.UseConditions = False

mbxwh.FieldMapFiles = ["$FIELDMAPROOT/cdf/compensator.MBXWH.001.cdf"]
mbxwsL.FieldMapFiles = ["$FIELDMAPROOT/cdf/compensator.MBXWS.1L8.001.cdf"]
mbxwsR.FieldMapFiles = ["$FIELDMAPROOT/cdf/compensator.MBXWS.1R8.001.cdf"]

mbxwsL.ForcedSignedCurrentScaling = -1.

from Configurables import MultipleMagneticFieldSvc
MultipleMagneticFieldSvc().MagneticFieldServices += ["MagneticFieldSvc/MBXWHFieldSvc", \