Esempio n. 1
0
    def configureInput(self, inputType):
        """
        Tune initialisation according to input type
        """

        # By default, Brunel only needs to open one input file at a time
        # Only set to zero if not previously set to something else.
        if not IODataManager().isPropertySet("AgeLimit") : IODataManager().AgeLimit = 0

        if self._isReprocessing(inputType):
            # Kill knowledge of any previous Brunel processing
            from Configurables import ( TESCheck, EventNodeKiller )
            InitReprocSeq = GaudiSequencer( "InitReprocSeq" )
            if ( self.getProp("WithMC") and inputType in ["XDST","DST"] ):
                # Load linkers, to kill them (avoid appending to them later)
                InitReprocSeq.Members.append( "TESCheck" )
                TESCheck().Inputs = ["Link/Rec/Track/Best"]
            killer = EventNodeKiller()
            killer.Nodes += [ "Raw", "Link/Rec" ]
            if self.getProp("SkipTracking"):
                killer.Nodes += [ "pRec/Rich", "pRec/Muon", "pRec/Calo", "pRec/Track/Muon", "pRec/ProtoP" ]
            else:
                killer.Nodes += [ "pRec", "Rec" ]
            InitReprocSeq.Members.append( killer )
            ### see configureOutput to see how the remainder of the juggler is configured
            
        # Get the event time (for CondDb) from ODIN
        from Configurables import EventClockSvc
        EventClockSvc().EventTimeDecoder = "OdinTimeDecoder";
Esempio n. 2
0
    def _unpackProtoParticles(self):

        from Configurables import (GaudiSequencer, UnpackProtoParticle)

        # Neutrals
        # --------

        neutralLoc = "/Event/Rec/ProtoP/Neutrals"
        unpackNeutrals = UnpackProtoParticle(
            name="UnpackNeutralProtos",
            OutputName=neutralLoc,
            InputName="/Event/pRec/ProtoP/Neutrals")
        DataOnDemandSvc().AlgMap[neutralLoc] = unpackNeutrals

        # Charged
        # -------

        chargedLoc = "/Event/Rec/ProtoP/Charged"
        chargedSeq = GaudiSequencer("UnpackChargedProtosSeq")
        DataOnDemandSvc().AlgMap[chargedLoc] = chargedSeq

        # Unpacker
        unpackCharged = UnpackProtoParticle(
            name="UnpackChargedProtos",
            OutputName=chargedLoc,
            InputName="/Event/pRec/ProtoP/Charged")
        chargedSeq.Members += [unpackCharged]

        # Additional processing, not for MDST
        inputtype = self.getProp('DstType').upper()
        if inputtype != 'MDST':

            # PID calibration
            from Configurables import (ChargedProtoParticleAddRichInfo,
                                       ChargedProtoParticleAddMuonInfo,
                                       ChargedProtoCombineDLLsAlg, TESCheck)
            recalib = GaudiSequencer("ProtoParticleCombDLLs")
            recalib.IgnoreFilterPassed = False
            chargedSeq.Members += [recalib]
            # Filter to check in Protos exist
            recalib.Members += [
                TESCheck(name="CheckChargedProtosExist",
                         Inputs=[chargedLoc],
                         OutputLevel=5,
                         Stop=False)
            ]
            # Add Rich and Muon PID results to protoparticles
            recalib.Members += [
                ChargedProtoParticleAddMuonInfo("ChargedProtoPAddMuon")
            ]
            recalib.Members += [
                ChargedProtoParticleAddRichInfo("ChargedProtoPAddRich")
            ]
            # Combined DLLs
            recalib.Members += [
                ChargedProtoCombineDLLsAlg("ChargedProtoPCombDLL")
            ]
Esempio n. 3
0
    def patSeq(self, outputLevel=INFO):
        if not allConfigurables.get("PatSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Pat Sequencer not defined! Defining!"

            patSequencer = GaudiSequencer("PatSeq")
            patSequencer.MeasureTime = True

            from Configurables import (TESCheck, EventNodeKiller)

            patSequencer.Members.append(
                TESCheck(Inputs=["Link/Rec/Track/Best"], Stop=False))
            patSequencer.Members.append(
                EventNodeKiller(Nodes=["Rec", "Raw", "Link/Rec"]))

            patSequencer.Members.append(
                GaudiSequencer("RecoVELOSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoTTSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoITSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoOTSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoTrSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoVertexSeq", MeasureTime=True))

            #importOptions("$TRACKSYSROOT/options/RecoTracking.py")
            #importOptions("$TALIGNMENTROOT/options/PatRecognition.opts")

            from Configurables import TrackRemoveDoubleHits
            if allConfigurables.get("TrackForwardPatSeq"):
                trackFwdPatSeq = GaudiSequencer("TrackForwardPatSeq")
                trackRemoveDoubleHitsFwd = TrackRemoveDoubleHits(
                    "FwdRemoveDoubleHits")
                trackRemoveDoubleHitsFwd.TracksLocation = "Rec/Track/Forward"
                trackFwdPatSeq.Members.append(trackRemoveDoubleHitsFwd)

            if allConfigurables.get("TrackMatchPatSeq"):
                trackMatchPatSeq = GaudiSequencer("TrackMatchPatSeq")
                trackRemoveDoubleHitsMatch = TrackRemoveDoubleHits(
                    "MatchRemoveDoubleHits")
                trackRemoveDoubleHitsMatch.TracksLocation = "Rec/Track/Match"
                trackMatchPatSeq.Members.append(trackRemoveDoubleHitsMatch)

            from Configurables import (PatPVOffline)
            allConfigurables["RecoVertexSeq"].Members.append(PatPVOffline())

            return patSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: Pat Sequencer already defined!"
            return allConfigurables.get("PatSeq")
Esempio n. 4
0
 def redoMCLinks(self,init):
     """
     Redo MC links.
     """
     
     if ( self.getProp("Simulation") ):
         redo = self.getProp("RedoMCLinks")
         if ( redo ):
             from Configurables import (GaudiSequencer,TESCheck,EventNodeKiller,TrackAssociator)
             mcKillSeq = GaudiSequencer("KillMCLinks") # The sequence killing the node of it exists
             tescheck = TESCheck("DaVinciEvtCheck")    # Check for presence of node ...
             tescheck.Inputs = ["Link/Rec/Track/Best"] # 
             tescheck.Stop = False                     # But don't stop
             tescheck.OutputLevel = 5                  # don't print warnings
             evtnodekiller = EventNodeKiller("DaVinciEvtNodeKiller") # kill nodes
             evtnodekiller.Nodes = ["Link/Rec/Track"]        # Kill that
             mcKillSeq.Members = [ tescheck, evtnodekiller, TrackAssociator() ]                  
             mcLinkSeq = GaudiSequencer("RedoMCLinks") # The sequence redoing the links
             mcLinkSeq.IgnoreFilterPassed = True       # Run it always
             mcLinkSeq.Members = [ mcKillSeq, TrackAssociator() ]  
             init.Members += [ mcLinkSeq ]
def doMyAlignChanges():
    from Configurables import TESCheck
    TESCheck().Stop = False
    TESCheck().Enable = False

    TweakFitter('FitDownstream')
    TweakFitter('FitMatch')
    TweakFitter('FitSeed')
    TweakFitter('RefitSeed')
    TweakFitter('FitForward')
    TweakFitter('FitVelo')
    TweakFitter('FitVeloTT')
    TweakFitter('TrackRefitter')
    
    TrackEventFitter('TrackRefitter').Fitter.UpdateTransport = True

    # add a filter on Velo tracks
    from Configurables import TrackListFilter
    GaudiSequencer("RecoVELOSeq").Members += [TrackListFilter("VeloFilter",
                                                              inputLocation = "Rec/Track/Velo")]
    
    from Configurables import Tf__Tsa__Seed, Tf__Tsa__SeedAddHits
    tsaSeed = Tf__Tsa__Seed("TsaSeed")
    tsaSeed.addTool(Tf__Tsa__SeedAddHits(), name="SeedAddHits")
    # tolerance if inside box mm
    tsaSeed.SeedAddHits.tol = 3
    # tolerance window make bigger mmm
    tsaSeed.SeedAddHits.dCut = 2.5
    # chi-sq cut
    tsaSeed.SeedAddHits.outlierCutParabola = 5;

    from Configurables import TrackHitMapMonitor
    GaudiSequencer("MoniTrSeq").Members.append( TrackHitMapMonitor() )

    from Configurables import STOfflinePosition
    itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')
    itClusterPosition.ErrorVec = [0.28, 0.22, 0.35, 0.35]
    itClusterPosition.APE = 0.1
Esempio n. 6
0
    def configureInput(self, inputType):
        """
        Tune initialisation according to input type
        """

        # POOL Persistency, now in LHCbApp
        #importOptions("$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts")

        # By default, Escher only needs to open one input file at a time
        # Only set to zero if not previously set to something else.
        if not IODataManager().isPropertySet("AgeLimit"):
            IODataManager().AgeLimit = 0

        if inputType in ["XDST", "DST", "RDST", "ETC"]:
            # Kill knowledge of any previous Brunel processing
            from Configurables import (TESCheck, EventNodeKiller)
            InitReprocSeq = GaudiSequencer("InitReprocSeq")
            if (self.getProp("WithMC") and inputType in ["XDST", "DST"]):
                # Load linkers, to kill them (avoid appending to them later)
                InitReprocSeq.Members.append("TESCheck")
                TESCheck().Inputs = ["Link/Rec/Track/Best"]
            InitReprocSeq.Members.append("EventNodeKiller")
            EventNodeKiller().Nodes = ["pRec", "Rec", "Raw", "Link/Rec"]

        if inputType == "ETC":
            raise DeprecationWarning, "ETC are no longer supported by LHCb software"
            from Configurables import TagCollectionSvc
            ApplicationMgr().ExtSvc += [TagCollectionSvc("EvtTupleSvc")]
            # Read ETC selection results into TES for writing to DST
            IODataManager().AgeLimit += 1

        #if inputType in [ "MDF", "RDST", "ETC" ]:
        #    # In case raw data resides in MDF file
        #    EventPersistencySvc().CnvServices.append("LHCb::RawDataCnvSvc")
        DecodeRawEvent()

        if self.getProp("UseFileStager"):
            import os, getpass
            from FileStager.Configuration import configureFileStager
            from Configurables import FileStagerSvc
            configureFileStager(keep=True)
            targetdir = '/tmp/' + getpass.getuser() + '/stagedfiles'
            if os.path.isdir('/pool/spool/'):
                targetdir = '/pool/spool/' + getpass.getuser() + '/stagedfiles'
            if not os.path.isdir(targetdir):
                os.makedirs(targetdir)
            FileStagerSvc().Tempdir = targetdir
def doMyAlignChanges():
    from Configurables import TESCheck
    TESCheck().Stop = False
    TESCheck().Enable = False

    TweakFitter('FitDownstream')
    TweakFitter('FitMatch')
    TweakFitter('FitSeed')
    TweakFitter('RefitSeed')
    TweakFitter('FitForward')
    TweakFitter('FitVelo')
    TweakFitter('FitVeloTT')
    TweakFitter('FitBest')
    TweakFitter('TrackRefitter')

    TrackEventFitter('TrackRefitter').Fitter.UpdateTransport = True

    ApplicationMgr().ExtSvc += ["DataOnDemandSvc", "ANNDispatchSvc"]

    # insert a filter get only dimuons
    from Configurables import LoKi__HDRFilter as HDRFilter
    hltfilter = HDRFilter(
        'HLT2JPsi',
        Code="HLT_PASS_RE( 'Hlt2.*Muon.*JPsi.*Decision' )"
        #Code = "HLT_PASS_RE( '.*Decision' )"
        #Code = "HLT_PASS_RE('Hlt2.*Decision')"
        #Code ="HLT_PASS('Hlt2ExpressHLT1PhysicsDecision')"
    )
    hltfilter.Preambulo += ["from LoKiCore.functions import *"]

    from Configurables import HltDecReportsDecoder
    DataOnDemandSvc().AlgMap["Hlt/DecReports"] = HltDecReportsDecoder(
        OutputLevel=4)
    GaudiSequencer('EscherSequencer').Members.insert(1, hltfilter)
    #from Configurables import DecReportDumper
    #GaudiSequencer('EscherSequencer').Members.insert(2,DecReportDumper())

    #from Configurables import LoKi__VoidFilter as LokiFilter
    #stripfilter = LokiFilter ( 'JPsiMuMuFilter' ,
    #                           Code = "0 < CONTAINS ( '/Event/Dimuon/Phys/FullDSTDiMuonJpsi2MuMuLine/Particles' )"
    #                           #,Preambulo = [ "from LoKiTrigger.decorators import *" ]
    #                           )
    #GaudiSequencer('EscherSequencer').Members.insert(2,stripfilter)

    # add a filter on Velo tracks
    from Configurables import TrackListFilter
    GaudiSequencer("RecoVELOSeq").Members += [
        TrackListFilter("VeloFilter", inputLocation="Rec/Track/Velo")
    ]

    from Configurables import TrackMultiplicityFilter
    GaudiSequencer("RecoDecodingSeq").Members += [
        TrackMultiplicityFilter("MultFilter", MaxNumITHits=600)
    ]

    from Configurables import TrackDiMuonMonitor
    TrackDiMuonMonitor().MaxTwoProngVertexChi2 = 4

    from Configurables import TrackHitMapMonitor
    GaudiSequencer("MoniTrSeq").Members.append(TrackHitMapMonitor())

    #from Configurables import STOfflinePosition
    #itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')
    #itClusterPosition.ErrorVec = [0.28, 0.22, 0.35, 0.35]
    #itClusterPosition.APE = 0.1

    from Configurables import ST__STClusterMonitor
    ST__STClusterMonitor('ITClusterMonitor').HitMaps = True
########################################################################
from Gaudi.Configuration import *
from Configurables import GaudiSequencer
from Configurables import DaVinci, PhysConf
########################################################################

DaVinci().EvtMax = 1000  # Number of events
DaVinci().PrintFreq = 100  # Events to skip
DaVinci().DataType = "2012"  # Must be given
DaVinci().HistogramFile = "udst-annpid.root"
DaVinci().InputType = "MDST"

########################################################################

from Configurables import (ANNGlobalPID__ChargedProtoANNPIDMoni, TESCheck,
                           GaudiSequencer)
protoLoc = "/Event/Bhadron/Rec/ProtoP/Charged"
seq = GaudiSequencer("ANNPIDCheckSeq")
seq.Members += [
    TESCheck("CheckProtos", Inputs=[protoLoc], OutputLevel=5, Stop=False),
    ANNGlobalPID__ChargedProtoANNPIDMoni("ANNPIDMoni",
                                         ProtoParticleLocation=protoLoc)
]
DaVinci().UserAlgorithms = [seq]
Esempio n. 9
0
def doMyAlignChanges():
    from Configurables import TESCheck
    TESCheck().Stop = False
    TESCheck().Enable = False

    TweakFitter('FitDownstream')
    TweakFitter('FitMatch')
    TweakFitter('FitSeed')
    TweakFitter('RefitSeed')
    TweakFitter('FitForward')
    TweakFitter('FitVelo')
    TweakFitter('FitVeloTT')
    TweakFitter('FitBest')
    TweakFitter('TrackRefitter')

    TrackEventFitter('TrackRefitter').Fitter.UpdateTransport = True

    # add a filter on Velo tracks
    from Configurables import TrackListFilter
    GaudiSequencer("RecoVELOSeq").Members += [
        TrackListFilter("VeloFilter", inputLocation="Rec/Track/Velo")
    ]

    from Configurables import TrackMultiplicityFilter
    GaudiSequencer("RecoDecodingSeq").Members += [
        TrackMultiplicityFilter("MultFilter", MaxNumITHits=200)
    ]

    from Configurables import PatSeeding, PatSeedingTool
    ps = PatSeeding('PatSeeding')
    ps.PatSeedingTool.CurveTol = 10
    ps.PatSeedingTool.TolCollectIT = 5
    ps.PatSeedingTool.QualityWeights = [0, -0.2]
    ps.PatSeedingTool.MaxRangeIT = 100
    ps.PatSeedingTool.MaxChi2HitIT = 60
    ps.PatSeedingTool.MinXPlanes = 4
    ps.PatSeedingTool.MinTotalPlanes = 8
    ps.PatSeedingTool.MaxMisses = 2
    ps.PatSeedingTool.MaxHoles = 2
    ps.PatSeedingTool.MaxTrackChi2 = 30
    ps.PatSeedingTool.MaxFinalChi2 = 40
    ps.PatSeedingTool.MaxFinalTrackChi2 = 30

    from Configurables import PatForward, PatForwardTool
    pf = PatForward('PatForward')
    pf.PatForwardTool.MinXPlanes = 4
    pf.PatForwardTool.MinPlanes = 7
    pf.PatForwardTool.MaxSpreadX = 2
    pf.PatForwardTool.MinHits = 8

    from Configurables import Tf__Tsa__Seed, Tf__Tsa__SeedAddHits
    tsaSeed = Tf__Tsa__Seed("TsaSeed")
    tsaSeed.addTool(Tf__Tsa__SeedAddHits(), name="SeedAddHits")
    # tolerance if inside box mm
    tsaSeed.SeedAddHits.tol = 3
    # tolerance window make bigger mmm
    tsaSeed.SeedAddHits.dCut = 2.5
    # chi-sq cut
    tsaSeed.SeedAddHits.outlierCutParabola = 5

    from Configurables import TrackHitMapMonitor
    GaudiSequencer("MoniTrSeq").Members.append(TrackHitMapMonitor())

    from Configurables import STOfflinePosition
    itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')
    itClusterPosition.ErrorVec = [0.28, 0.22, 0.35, 0.35]
    itClusterPosition.APE = 0.1

    from Configurables import ST__STClusterMonitor
    ST__STClusterMonitor('ITClusterMonitor').HitMaps = True
Esempio n. 10
0
def doMyAlignChanges():
    from Configurables import TESCheck
    TESCheck().Stop = False
    TESCheck().Enable = False

    # insert a run filter
    from Configurables import LoKi__ODINFilter as ODINFilter
    odinfilter = ODINFilter(
        "OdinRunFilter",
        Code="ODIN_RUN  != ints( [63757,63948,63700,63702,63948] )")
    odinfilter.Preambulo += ["from LoKiCore.functions import *"]
    #~ODIN_RUNNUMBER( uints (  63757,63948,63700,63702,63948  ) )" )
    #badruns = [63757,63948,63700,63702,63948]
    #odincode = ""
    #first = True
    #for i in badruns:
    #    if not first: odincode += "&"
    #    first = False
    #    odincode += "(ODIN_RUNNUMBER!=%d)" % i
    #odinfilter = ODINFilter("OdinRunFilter",
    #                        Code = odincode)
    GaudiSequencer('EscherSequencer').Members.insert(1, odinfilter)

    from Configurables import VeloTrackSelector
    TweakFitter('FitDownstream')
    TweakFitter('FitMatch')
    TweakFitter('FitSeed')
    TweakFitter('RefitSeed')
    TweakFitter('FitForward')
    TweakFitter('FitVelo')
    TweakFitter('FitVeloTT')
    TweakFitter('TrackRefitter')

    #GaudiSequencer("RecoVertexSeq").Members = [ TrackPVFinder(),
    #tweakedV0Finder,
    #                                            TrackV0Finder() ]

    # add a filter on Velo tracks
    from Configurables import TrackListFilter
    GaudiSequencer("RecoVELOSeq").Members += [
        TrackListFilter("VeloFilter", inputLocation="Rec/Track/Velo")
    ]

    from Configurables import TrackMonitor
    TrackMonitor().FullDetail = True

    from Configurables import Tf__Tsa__Seed, Tf__Tsa__SeedAddHits
    tsaSeed = Tf__Tsa__Seed("TsaSeed")
    tsaSeed.addTool(Tf__Tsa__SeedAddHits(), name="SeedAddHits")
    # tolerance if inside box mm
    tsaSeed.SeedAddHits.tol = 3
    # tolerance window make bigger mmm
    tsaSeed.SeedAddHits.dCut = 2.5
    # chi-sq cut
    tsaSeed.SeedAddHits.outlierCutParabola = 5

    from Configurables import TrackHitMapMonitor
    GaudiSequencer("MoniTrSeq").Members.append(TrackHitMapMonitor())

    from Configurables import STOfflinePosition
    itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')
    itClusterPosition.ErrorVec = [0.28, 0.22, 0.35, 0.35]
    itClusterPosition.APE = 0.1
Esempio n. 11
0
    '/Event/pRec/ProtoP/Charged',
    '/Event/pRec/ProtoP/Neutrals',
    '/Event/pRec/ProtoP',
    '/Event/pRec/Vertex/Primary',
    '/Event/pRec/Vertex/V0',
    '/Event/pRec/Vertex'
]

extraLoad = [
    '/Event/Link/MC/Rich/Hits2MCRichOpticalPhotons',
    '/Event/Link/MC/Particles2MCRichTracks'
]

from Configurables import (TESCheck, EventNodeKiller)
initBoole = GaudiSequencer("InitBooleSeq")
xdstLoader = TESCheck("XDSTLoader")
xdstLoader.Inputs = xdstPaths + extraLoad
xdstLoader.Stop = False  # If not MC do not expect all of the entries
xdstLoader.OutputLevel = ERROR
xdstKiller = EventNodeKiller("XDSTKiller")
xdstKiller.Nodes = xdstPaths
xdstHandler = GaudiSequencer("XDSTLoverHandler")
xdstHandler.Members += [xdstLoader, xdstKiller]
xdstHandler.IgnoreFilterPassed = True  # keep going
initBoole.Members += [xdstHandler]

from GaudiConf import IOHelper


def patch():
    OutputStream("DigiWriter").ItemList += ["/Event/Link/MC#1"]
Esempio n. 12
0
prefix = 'PFN:castor:/castor/cern.ch/user/t/truf/data_2009/'
data = [
    '00005727_00000001_00000011_2_nolumi.dst',
    '00005727_00000012_00000026_2_nolumi.dst',
    '00005727_00000027_00000039_2_nolumi.dst',
    '00005727_00000040_00000052_2_nolumi.dst',
    '00005727_00000053_00000057_2_nolumi.dst',
    '00005730_00000001_00000002_2_nolumi.dst',
    '00005731_00000001_00000056_2_nolumi.dst'
]

# copy the files to /pool if it exists
import os
if os.path.isdir('/pool/spool/'):
    if not os.path.exists('/pool/spool/wouter'):
        os.system('mkdir /pool/spool/wouter')
    prefix = 'PFN:/pool/spool/wouter/'
    for d in data:
        if not os.path.exists('/pool/spool/wouter/' + d):
            os.system('rfcp /castor/cern.ch/user/t/truf/data_2009/' + d +
                      ' /pool/spool/wouter/')

EventSelector().Input = []
for d in data:
    name = "DATAFILE='" + prefix + d + "' TYP='POOL_ROOTTREE' OPT='READ'"
    EventSelector().Input.append(name)

from Configurables import TESCheck
TESCheck().Stop = False
Esempio n. 13
0
    def configureReco(self, init):
        """
        Configure Reconstruction to be redone
        """

        ## CaloReco & CaloPIDs on-demand
        clusters = ['Digits', 'Clusters']
        from Configurables import CaloProcessor
        caloProc = CaloProcessor(EnableOnDemand=True,
                                 OutputLevel=self.getProp("OutputLevel"))
        caloProc.RecList = clusters
        # ---
        if self.getProp('DataType') == 'Upgrade':
            caloProc.NoSpdPrs = True

        ## General unpacking
        from Configurables import DstConf
        if self.isPropertySet('EnableUnpack'):
            DstConf().setProp('EnableUnpack', self.getProp('EnableUnpack'))

        ## unpack Calo Hypos ?
        from Configurables import CaloDstUnPackConf
        unpack = CaloDstUnPackConf()
        hypos = ['Photons', 'MergedPi0s', 'SplitPhotons',
                 'Electrons']  # CaloHypos
        if self.isPropertySet(
                'EnableUnpack') and "Reconstruction" in self.getProp(
                    'EnableUnpack'):
            unpack.setProp('Enable', True)
        else:
            caloProc.RecList += hypos  # enable caloHypos onDemand

        # Reprocess explicitely the full calo sequence in the init sequence ?
        inputtype = self.getProp('InputType').upper()
        if (self.getProp("CaloReProcessing") and inputtype != 'MDST'):
            caloProc.RecList = clusters + hypos
            caloSeq = caloProc.sequence(
            )  # apply the CaloProcessor configuration
            cSeq = GaudiSequencer('CaloReProcessing')
            cSeq.Members += [caloSeq]
            init.Members += [cSeq]
            unpack.setProp('Enable', False)
            # update CaloHypo->MC Linker
            if self.getProp('Simulation'):
                log.info(
                    "CaloReprocessing : obsolete CaloHypo2MC Links is updated")
                from Configurables import (TESCheck, EventNodeKiller,
                                           CaloHypoMCTruth)
                caloMCLinks = ["Link/Rec/Calo"]
                caloMCSeq = GaudiSequencer("cleanCaloMCLinks")
                checkCaloMCLinks = TESCheck("checkCaloMCLinks")
                checkCaloMCLinks.Inputs = caloMCLinks
                checkCaloMCLinks.Stop = False
                killCaloMCLinks = EventNodeKiller("killCaloMCLinks")
                killCaloMCLinks.Nodes = caloMCLinks
                caloMCSeq.Members = [checkCaloMCLinks, killCaloMCLinks]
                init.Members += [caloMCSeq]
                update = self.getProp("UpdateCaloMCLinks")
                if update:
                    redoCaloMCLinks = CaloHypoMCTruth("recreteCaloMCLinks")
                    init.Members += [redoCaloMCLinks]
        else:
            caloProc.applyConf()
            if inputtype != 'MDST':
                log.info(
                    "CaloReProcessing cannot be processed on reduced (m)DST data"
                )

        # For backwards compatibility with MC09, we need the following to rerun
        # the Muon Reco on old data. To be removed AS SOON as this backwards compatibility
        # is no longer needed
        if (self.getProp("DataType") == 'MC09' and inputtype != 'MDST'
                and self.getProp("AllowPIDRerunning") and inputtype != 'RDST'):

            from Configurables import DataObjectVersionFilter, MuonRec, TESCheck
            from MuonID import ConfiguredMuonIDs

            rerunPIDSeq = GaudiSequencer("ReRunMuonPID")
            init.Members += [rerunPIDSeq]

            # Check data version, to see if this is needed or not
            rerunPIDSeq.Members += [
                DataObjectVersionFilter(
                    "MuonPIDVersionCheck",
                    DataObjectLocation="/Event/Rec/Muon/MuonPID",
                    MaxVersion=0)
            ]
            # Check raw event is available
            rerunPIDSeq.Members += [
                TESCheck("TESCheckRawEvent",
                         Inputs=["DAQ/RawEvent"],
                         Stop=False)
            ]
            # Run Muon PID
            cm = ConfiguredMuonIDs.ConfiguredMuonIDs(
                data=self.getProp("DataType"))
            rerunPIDSeq.Members += [MuonRec(), cm.getMuonIDSeq()]

            # If muon PID has rerun, need to re make the Combined DLLS...
            from Configurables import (ChargedProtoParticleAddMuonInfo,
                                       ChargedProtoCombineDLLsAlg)
            rerunPIDSeq.Members += [
                ChargedProtoParticleAddMuonInfo("CProtoPAddNewMuon"),
                ChargedProtoCombineDLLsAlg("CProtoPCombDLLNewMuon")
            ]

        # Compatibility with pre-2011 data, where Rec/Summary and Trigger/RawEvent are missing
        import PhysConf.CheckMissingTESData as DataCheck
        DataCheck.checkForMissingData()
Esempio n. 14
0
    def configureInit(self, tae, initDets):
        """
        Set up the initialization sequence
        """
        # Start the DataOnDemandSvc ahead of ToolSvc
        ApplicationMgr().ExtSvc += ["DataOnDemandSvc"]
        ApplicationMgr().ExtSvc += ["ToolSvc"]

        ProcessPhase("Init").DetectorList.insert(
            0, "Boole")  # Always run Boole initialisation first!
        initBoole = GaudiSequencer("InitBooleSeq")
        initBoole.Members += ["BooleInit"]

        # Kept for Dirac backward compatibility
        if self.getProp("NoWarnings"):
            log.warning(
                "Boole().NoWarnings=True property is obsolete and maintained for Dirac compatibility. Please use Boole().ProductionMode=True instead"
            )
            self.setProp("ProductionMode", True)

        # Special settings for production
        if self.getProp("ProductionMode"):
            self.setProp("OutputLevel", ERROR)
            if not LHCbApp().isPropertySet("TimeStamp"):
                LHCbApp().setProp("TimeStamp", True)

        # OutputLevel
        self.setOtherProp(LHCbApp(), "OutputLevel")
        if self.isPropertySet("OutputLevel"):
            level = self.getProp("OutputLevel")
            if level == ERROR or level == WARNING:
                # Suppress known warnings
                importOptions("$BOOLEOPTS/SuppressWarnings.opts")
                # Additional information to be kept
                getConfigurable("BooleInit").OutputLevel = INFO

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

        # Load the spillover branches, then kill those not required to prevent further access
        spillPaths = self.getProp("SpilloverPaths")
        killPaths = []
        if len(spillPaths) == 0:
            spillPaths = self.KnownSpillPaths
            self.setProp("SpilloverPaths", spillPaths)

        if self.getProp("UseSpillover"):
            if tae:
                killPaths = self.KnownSpillPaths
            else:
                self.setOtherProp(SimConf(), "SpilloverPaths")
                # Kill any spillover paths not required
                for spill in self.KnownSpillPaths:
                    if spill not in spillPaths:
                        killPaths.append(spill)
        else:
            # Kill all spillover paths
            killPaths = self.KnownSpillPaths

        from Configurables import EventNodeKiller, TESCheck
        spillLoader = TESCheck("SpilloverLoader")
        spillLoader.Inputs = spillPaths
        spillLoader.Stop = False  # In case no spillover on input file
        spillLoader.OutputLevel = ERROR
        spillKiller = EventNodeKiller("SpilloverKiller")
        spillKiller.Nodes = killPaths
        spillHandler = GaudiSequencer("SpilloverHandler")
        spillHandler.Members += [spillLoader, spillKiller]
        spillHandler.IgnoreFilterPassed = True  # In case no spillover on input file
        initBoole.Members += [spillHandler]

        if "Muon" in initDets:
            # Muon Background
            from Configurables import MuonBackground
            GaudiSequencer("InitMuonSeq").Members += [
                MuonBackground("MuonLowEnergy")
            ]
            importOptions("$MUONBACKGROUNDROOT/options/MuonLowEnergy-G4.opts")
            if not tae:
                flatSpillover = MuonBackground("MuonFlatSpillover")
                GaudiSequencer("InitMuonSeq").Members += [flatSpillover]
                if self.getProp("DataType") == "2010":
                    flatSpillover.NBXFullFull = 344
                if self.getProp("DataType") == "2009":
                    flatSpillover.NBXFullFull = 4
                importOptions(
                    "$MUONBACKGROUNDROOT/options/MuonFlatSpillover-G4.opts")