示例#1
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 ]
    '/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"]
示例#3
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()
示例#4
0
    '/Event/Muon/RawEvent',
    '/Event/Muon',
    '/Event/Rich/RawEvent',
    '/Event/Rich',
    '/Event/Other/RawEvent'
]

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

from Configurables import (TESCheck, EventNodeKiller)
initBoole = GaudiSequencer("InitBooleSeq")
xdigiLoader = TESCheck("XDIGILoader")
xdigiLoader.Inputs = xdigiPaths + extraLoad
xdigiLoader.Stop = False  # If not MC do not expect all of the entries
xdigiLoader.OutputLevel = ERROR
xdigiKiller = EventNodeKiller("XDIGIKiller")
xdigiKiller.Nodes = xdigiPaths
xdigiHandler = GaudiSequencer("XDIGILoverHandler")
xdigiHandler.Members += [xdigiLoader, xdigiKiller]

xdigiHandler.IgnoreFilterPassed = True  # keep going
initBoole.Members += [xdigiHandler]

from GaudiConf import IOHelper


def patch():
    OutputStream("DigiWriter").ItemList += ["/Event/Link/MC#1"]
示例#5
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")