Beispiel #1
0
def selMuonPParts(name, DataType, downstreamSeq):
   """
       Make ProtoParticles out of Downstream tracks
   """
   unpacker = UnpackTrack(name+"UnpackTrack")  # do we need this or is it here for historical reason ?
   unpacker.InputName="pRec/Downstream/FittedTracks"
   unpacker.OutputName="Rec/Downstream/FittedTracks"

   idalg = MuonIDAlg(name+"IDalg")
   cm=ConfiguredMuonIDs.ConfiguredMuonIDs( DataType ) #data=DaVinci().getProp("DataType"))
   cm.configureMuonIDAlg(idalg)
   idalg.TrackLocation = "Rec/Downstream/FittedTracks"
   idalg.MuonIDLocation = "Rec/Muon/MuonPID/Downstream"
   idalg.MuonTrackLocation = "Rec/Track/MuonForDownstream" # I would call it FromDownstream …but just to be »Klugscheißer«

   downprotoseq = GaudiSequencer(name+"ProtoPSeq")
   downprotos = ChargedProtoParticleMaker(name+"ProtoPMaker")
   downprotos.Inputs = ["Rec/Downstream/FittedTracks"]
   downprotos.Output = "Rec/ProtoP/"+name+"ProtoPMaker/ProtoParticles"
   downprotos.addTool( DelegatingTrackSelector, name="TrackSelector" )
   #tracktypes = [ "Long","Upstream","Downstream","Ttrack","Velo","VeloR" ] # only downstream needed …
   tracktypes = ["Downstream"]
   #if (trackcont == "Best") :
   #	tracktypes = [ "Long" ]
   downprotos.TrackSelector.TrackTypes = tracktypes
   selector = downprotos.TrackSelector
   for tsname in tracktypes:
   	selector.addTool(TrackSelector,name=tsname)
   	ts = getattr(selector,tsname)
   	# Set Cuts
   	ts.TrackTypes = [tsname]
#	ts.MinNDoF = 1 
	ts.MaxChi2Cut = 10

   addmuonpid = ChargedProtoParticleAddMuonInfo(name+"addmuoninfo")
   addmuonpid.InputMuonPIDLocation = "Rec/Muon/MuonPID/Downstream"
   addmuonpid.ProtoParticleLocation = "Rec/ProtoP/"+name+"ProtoPMaker/ProtoParticles"
   #addmuonpid.OutputLevel = 0
   combinedll = ChargedProtoCombineDLLsAlg(name+"CombineDLL")
   combinedll.ProtoParticleLocation = "Rec/ProtoP/"+name+"ProtoPMaker/ProtoParticles"
   #combinedll.OutputLevel = 0
   # DST post treatment
   #TrackToDST(name+"TrackToDST").TracksInContainer = "Rec/Downstream/Tracks"
   #downprotoseq.Members += [ TrackToDST(name+"TrackToDST"), downprotos, addmuonpid, combinedll ]
   downprotoseq.Members += [ downprotos, addmuonpid, combinedll ]
#        
   DataOnDemandSvc().AlgMap.update( {
                "/Event/Rec/Downstream/Tracks" : unpacker.getFullName(),
                "/Event/Rec/Muon/MuonPID/Downstream" : idalg.getFullName(),
#                "/Event/Rec/ProtoP/"+name+"ProtoPMaker" : downprotoseq.getFullName()
		} )

   return GSWrapper(name="WrappedDownMuonProtoPSeqFor"+name,
                    sequencer=downprotoseq,
                    output='Rec/ProtoP/' + name +'ProtoPMaker/ProtoParticles',
                    requiredSelections = [ downstreamSeq])
def makeMyProtoP(trackcont):
    unpacker = UnpackTrack(trackcont + "UnpackTrack")
    unpacker.InputName = "pRec/Track/" + trackcont
    unpacker.OutputName = "Rec/Track/" + trackcont
    refitter = TrackSmeared(trackcont + "TrackSmeared")
    refitter.InputLocation = "Rec/Track/" + trackcont
    refitter.OutputLocation = "Refit"
    refitter.smear = 1
    #refitter.makePlots = 1
    #refitter.OutputLevel = 2
    #idalg = MuonIDAlg("BestIDalg")
    #idalg.OutputLevel = 0
    #cm=ConfiguredMuonIDs.ConfiguredMuonIDs(data=DaVinci().getProp("DataType"))
    #cm.configureMuonIDAlg(idalg)
    #idalg.TrackLocation = "Rec/Track/Refit"
    #idalg.MuonIDLocation = "Rec/Muon/MuonPID/Refit"
    downprotoseq = GaudiSequencer(trackcont + "ProtoPSeq")
    downprotos = ChargedProtoParticleMaker(trackcont + "ProtoPMaker")
    downprotos.InputTrackLocation = ["Rec/Track/Refit"]
    downprotos.OutputProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"
    downprotos.addTool(DelegatingTrackSelector, name="TrackSelector")
    #downprotos.OutputLevel = 0
    tracktypes = ["Long", "Upstream", "Downstream", "Ttrack", "Velo", "VeloR"]
    downprotos.TrackSelector.TrackTypes = tracktypes
    selector = downprotos.TrackSelector
    for tsname in tracktypes:
        selector.addTool(TrackSelector, name=tsname)
        ts = getattr(selector, tsname)
        # Set Cuts
        ts.TrackTypes = [tsname]
    #set up associators
    #addmuonpid = ChargedProtoParticleAddMuonInfo("Bestaddmuoninfo")
    #addmuonpid.InputMuonPIDLocation = "Rec/Muon/MuonPID/Refit"
    #addmuonpid.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #addmuonpid.OutputLevel = 0
    addrichpid = ChargedProtoParticleAddRichInfo("Bestaddrichinfo")
    addrichpid.InputRichPIDLocation = "Rec/Rich/Refit"
    #addrichpid.InputRichPIDLocation = "Rec/Rich/"+trackcont
    addrichpid.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"
    #addcalopid = ChargedProtoParticleAddCaloInfo("Bestaddcaloinfo")
    #addcalopid.InputRichCALOLocation = "Rec/Rich/Refit"
    #addcalopid.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    combinedll = ChargedProtoCombineDLLsAlg("BestCombineDLL")
    combinedll.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"
    assoctr = TrackAssociator(trackcont + "AssocTr")
    #assoctr.TracksInContainer = "Rec/Track/"+trackcont
    assoctr.TracksInContainer = "Rec/Track/Refit"
    assocpp = ChargedPP2MC(trackcont + "AssocPP")
    #assocpp.TrackLocations = [ "Rec/Track/"+trackcont ]
    assocpp.TrackLocations = ["Rec/Track/Refit"]
    assocpp.InputData = ["Rec/ProtoP/" + trackcont + "ProtoPMaker"]
    #assocpp.InputData = [ "Rec/ProtoP/Refit" ]
    assocpp.OutputTable = "Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker"
    # DST post treatment
    TrackToDST(trackcont +
               "TrackToDST").TracksInContainer = "Rec/Track/" + trackcont
    #downprotoseq.Members += [ TrackToDST(trackcont+"TrackToDST"), assoctr, downprotos, assocpp,addrichpid,combinedll ]

    if not DaVinci().Simulation:
        downprotoseq.Members += [
            TrackToDST(trackcont + "TrackToDST"), downprotos, addrichpid,
            combinedll
        ]
        DataOnDemandSvc().AlgMap.update({
            "/Event/Rec/Track/" + trackcont:
            unpacker.getFullName(),
            "/Event/Rec/Track/Refit":
            refitter.getFullName(),
            "/Event/Rec/Rich/Refit":
            downprotoseq.getFullName(),
            "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker":
            downprotoseq.getFullName(),
            "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker":
            downprotoseq.getFullName()
        })
    else:
        if (DaVinci().Simulation):
            downprotoseq.Members += [
                TrackToDST(trackcont + "TrackToDST"), assoctr, downprotos,
                addrichpid, combinedll, assocpp
            ]
            DataOnDemandSvc().AlgMap.update({
                "/Event/Rec/Track/" + trackcont:
                unpacker.getFullName(),
                "/Event/Rec/Track/Refit":
                refitter.getFullName(),
                "/Event/Rec/Rich/Refit":
                downprotoseq.getFullName(),
                "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker":
                downprotoseq.getFullName(),
                "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker":
                downprotoseq.getFullName()
            })
    def __apply_configuration__(self):
        """
        HLT Afterburner configuration
        """
        from HltTracking.Hlt2TrackingConfigurations import Hlt2BiKalmanFittedForwardTracking
        from HltTracking.Hlt2TrackingConfigurations import Hlt2BiKalmanFittedDownstreamTracking

        Afterburner = self.getProp("Sequence") if self.isPropertySet(
            "Sequence") else None
        if not Afterburner:
            return
        AfterburnerFilterSeq = Sequence("HltAfterburnerFilterSequence")
        Afterburner.Members += [AfterburnerFilterSeq]
        if self.getProp("Hlt2Filter"):
            from DAQSys.Decoders import DecoderDB
            decoder = DecoderDB["HltDecReportsDecoder/Hlt2DecReportsDecoder"]
            from Configurables import LoKi__HDRFilter as HDRFilter
            hlt2Filter = HDRFilter('HltAfterburnerHlt2Filter',
                                   Code=self.getProp("Hlt2Filter"),
                                   Location=decoder.listOutputs()[0])
            AfterburnerFilterSeq.Members += [hlt2Filter]
        AfterburnerSeq = Sequence("HltAfterburnerSequence",
                                  IgnoreFilterPassed=True)
        AfterburnerFilterSeq.Members += [AfterburnerSeq]
        if self.getProp("EnableHltRecSummary"):
            from Configurables import RecSummaryAlg
            seq = Sequence("RecSummarySequence")

            tracks = Hlt2BiKalmanFittedForwardTracking().hlt2PrepareTracks()
            tracksDown = Hlt2BiKalmanFittedDownstreamTracking(
            ).hlt2PrepareTracks()
            muonID = Hlt2BiKalmanFittedForwardTracking().hlt2MuonID()

            from HltLine.HltDecodeRaw import DecodeVELO, DecodeIT, DecodeTT, DecodeSPD, DecodeMUON
            decoders = {
                "Velo": (DecodeVELO, "VeloLiteClustersLocation"),
                "TT": (DecodeTT, "clusterLocation"),
                "IT": (DecodeIT, "clusterLocation"),
                "SPD": (DecodeSPD, "DigitsContainer"),
                'Muon': (DecodeMUON, "OutputLocation"),
                'MuonTr': (muonID, "MuonTrackLocation")
            }
            decoders = {
                k: (bm.members(), bm.members()[-1].getProp(loc))
                for (k, (bm, loc)) in decoders.iteritems()
            }

            from HltTracking.HltPVs import PV3D
            PVs = PV3D("Hlt2")
            from HltTracking.HltTrackNames import Hlt2TrackLoc
            recSeq = Sequence("RecSummaryRecoSequence",
                              IgnoreFilterPassed=True)
            from itertools import chain
            from Hlt2Lines.Utilities.Utilities import uniqueEverseen
            recSeq.Members = list(
                uniqueEverseen(
                    chain.from_iterable(
                        [dec[0] for dec in decoders.itervalues()] +
                        [tracks, tracksDown, muonID, PVs])))
            summary = RecSummaryAlg(
                'Hlt2RecSummary',
                SummaryLocation=self.getProp("RecSummaryLocation"),
                HltSplitTracks=True,
                SplitLongTracksLocation=tracks.outputSelection(),
                SplitDownTracksLocation=tracksDown.outputSelection(),
                PVsLocation=PVs.output,
                VeloClustersLocation=decoders['Velo'][1],
                ITClustersLocation=decoders['IT'][1],
                TTClustersLocation=decoders['TT'][1],
                SpdDigitsLocation=decoders['SPD'][1],
                MuonCoordsLocation=decoders['Muon'][1],
                MuonTracksLocation=decoders['MuonTr'][1])
            seq.Members = [recSeq, summary]
            AfterburnerSeq.Members += [seq]

        if self.getProp("AddAdditionalTrackInfos"):
            from GaudiKernel.SystemOfUnits import mm
            from Configurables import LoKi__VoidFilter as Filter
            trackLocations = [
                Hlt2BiKalmanFittedForwardTracking().hlt2PrepareTracks(
                ).outputSelection(),
                Hlt2BiKalmanFittedDownstreamTracking().hlt2PrepareTracks().
                outputSelection()
            ]
            infoSeq = Sequence("TrackInfoSequence", IgnoreFilterPassed=True)
            # I don't want to pull in reconstruction if not run before, then there should be also no candidates needing this information
            # This is anyhow done by the RecSummary above
            members = [
                Hlt2BiKalmanFittedForwardTracking().hlt2PrepareTracks(
                ).members() + Hlt2BiKalmanFittedDownstreamTracking().
                hlt2PrepareTracks().members()
            ]
            infoSeq.Members += list(
                uniqueEverseen(chain.from_iterable(members)))
            prefix = "Hlt2"
            trackClones = Sequence(prefix + "TrackClonesSeq")
            #checkTracks =  Filter(prefix+"CheckTrackLoc",Code = "EXISTS('%(trackLocLong)s') & EXISTS('%(trackLocDown)s')" % {"trackLocLong" : trackLocations[0], "trackLocDown" : trackLocations[1]})
            #trackClones.Members += [checkTracks]
            from Configurables import TrackBuildCloneTable, TrackCloneCleaner
            cloneTable = TrackBuildCloneTable(prefix + "FindTrackClones")
            cloneTable.maxDz = 500 * mm
            cloneTable.zStates = [0 * mm, 990 * mm, 9450 * mm]
            cloneTable.klCut = 5e3
            cloneTable.inputLocations = trackLocations
            cloneTable.outputLocation = trackLocations[
                0] + "Downstream" + "Clones"
            cloneCleaner = TrackCloneCleaner(prefix + "FlagTrackClones")
            cloneCleaner.CloneCut = 5e3
            cloneCleaner.inputLocations = trackLocations
            cloneCleaner.linkerLocation = cloneTable.outputLocation
            trackClones.Members += [cloneTable, cloneCleaner]

            infoSeq.Members += [trackClones]

            AfterburnerSeq.Members += [infoSeq]

            # Add VeloCharge to protoparticles for dedx
            veloChargeSeq = Sequence("VeloChargeSequence")
            from Configurables import ChargedProtoParticleAddVeloInfo
            protoLocation = Hlt2BiKalmanFittedForwardTracking(
            ).hlt2ChargedAllPIDsProtos().outputSelection()
            checkProto = Filter("CheckProtoParticles",
                                Code="EXISTS('%(protoLoc)s')" %
                                {"protoLoc": protoLocation})
            addVeloCharge = ChargedProtoParticleAddVeloInfo(
                "Hlt2AddVeloCharge")
            addVeloCharge.ProtoParticleLocation = protoLocation
            decodeVeloFullClusters = DecoderDB[
                "DecodeVeloRawBuffer/createVeloClusters"].setup()
            veloChargeSeq.Members += [
                checkProto, decodeVeloFullClusters, addVeloCharge
            ]
            AfterburnerSeq.Members += [veloChargeSeq]

        persistRecoLines = self._persistRecoLines()
        if self.getProp("AddPIDToDownstream") and (
                len(persistRecoLines) > 0
                or len(self.getProp("Hlt2DownstreamFilter")) > 0):
            from Configurables import LoKi__HDRFilter as HDRFilter
            if (len(persistRecoLines) > 0
                    and len(self.getProp("Hlt2DownstreamFilter")) > 0):
                code = self._persistRecoFilterCode(
                    persistRecoLines) + " | " + self._filterCode(
                        self.getProp("Hlt2DownstreamFilter"))
            elif len(persistRecoLines) > 0:
                code = self._persistRecoFilterCode(persistRecoLines)
            elif len(self.getProp("Hlt2DownstreamFilter")) > 0:
                code = self._filterCode(self.getProp("Hlt2DownstreamFilter"))
            # Activate Downstream RICH for all PersistReco lines
            from DAQSys.Decoders import DecoderDB
            decoder = DecoderDB["HltDecReportsDecoder/Hlt2DecReportsDecoder"]
            hlt2DownstreamFilter = HDRFilter('DownstreamHlt2Filter',
                                             Code=code,
                                             Location=decoder.listOutputs()[0])
            downstreamPIDSequence = Sequence("Hlt2AfterburnerDownstreamPIDSeq")
            downstreamPIDSequence.Members += [hlt2DownstreamFilter]
            downstreamTracking = Hlt2BiKalmanFittedDownstreamTracking()
            tracksDown = downstreamTracking.hlt2PrepareTracks()
            protosDown = downstreamTracking.hlt2ChargedNoPIDsProtos()
            chargedProtosOutputLocation = protosDown.outputSelection()
            richPid = downstreamTracking.hlt2RICHID()
            downstreamPIDSequence.Members += list(
                uniqueEverseen(
                    chain.from_iterable([tracksDown, protosDown, richPid])))
            from Configurables import ChargedProtoParticleAddRichInfo, ChargedProtoParticleAddMuonInfo
            downstreamRichDLL_name = "Hlt2AfterburnerDownstreamProtoPAddRich"
            downstreamRichDLL = ChargedProtoParticleAddRichInfo(
                downstreamRichDLL_name)
            downstreamRichDLL.InputRichPIDLocation = richPid.outputSelection()
            downstreamRichDLL.ProtoParticleLocation = chargedProtosOutputLocation
            # Add the muon info to the DLL
            downstreamMuon_name = "Hlt2AfterburnerDownstreamProtoPAddMuon"
            downstreamMuon = ChargedProtoParticleAddMuonInfo(
                downstreamMuon_name)
            downstreamMuon.ProtoParticleLocation = chargedProtosOutputLocation
            downstreamMuon.InputMuonPIDLocation = downstreamTracking.hlt2MuonID(
            ).outputSelection()
            # Add the Calo info to the DLL
            #
            from Configurables import (ChargedProtoParticleAddEcalInfo,
                                       ChargedProtoParticleAddBremInfo,
                                       ChargedProtoParticleAddHcalInfo,
                                       ChargedProtoParticleAddPrsInfo,
                                       ChargedProtoParticleAddSpdInfo)
            caloPidLocation = downstreamTracking.hlt2CALOID().outputSelection()
            downstreamEcal = ChargedProtoParticleAddEcalInfo(
                "HltAfterburnerDownstreamProtoPAddEcal")
            downstreamBrem = ChargedProtoParticleAddBremInfo(
                "HltAfterburnerDownstreamProtoPAddBrem")
            downstreamHcal = ChargedProtoParticleAddHcalInfo(
                "HltAfterburnerDownstreamProtoPAddHcal")
            downstreamPrs = ChargedProtoParticleAddPrsInfo(
                "HltAfterburnerDownstreamProtoPAddPrs")
            downstreamSpd = ChargedProtoParticleAddSpdInfo(
                "HltAfterburnerDownstreamProtoPAddSpd")
            for alg in (downstreamEcal, downstreamBrem, downstreamHcal,
                        downstreamPrs, downstreamSpd):
                alg.setProp("ProtoParticleLocation",
                            chargedProtosOutputLocation)
                alg.setProp("Context", caloPidLocation)
                downstreamPIDSequence.Members += [alg]

            from Configurables import ChargedProtoCombineDLLsAlg, ChargedProtoANNPIDConf
            downstreamCombine_name = "Hlt2AfterburnerDownstreamRichCombDLLs"
            downstreamCombine = ChargedProtoCombineDLLsAlg(
                downstreamCombine_name)
            downstreamCombine.ProtoParticleLocation = downstreamTracking.hlt2ChargedNoPIDsProtos(
            ).outputSelection()
            from Hlt2Lines.Utilities.Utilities import uniqueEverseen
            downstreamPIDSequence.Members += [
                downstreamMuon, downstreamRichDLL, downstreamCombine
            ]
            probNNDownSeqName = self._instanceName(ChargedProtoANNPIDConf)

            probNNDownSeq = GaudiSequencer(probNNDownSeqName + "Seq")
            annconfDown = ChargedProtoANNPIDConf(probNNDownSeqName)
            annconfDown.DataType = downstreamTracking.DataType
            annconfDown.TrackTypes = ["Downstream"]
            annconfDown.RecoSequencer = probNNDownSeq
            annconfDown.ProtoParticlesLocation = downstreamTracking.hlt2ChargedNoPIDsProtos(
            ).outputSelection()
            downstreamPIDSequence.Members += [probNNDownSeq]
            AfterburnerSeq.Members += [downstreamPIDSequence]

        # Configure and add the persist reco
        AfterburnerSeq.Members += [self._persistRecoSeq()]
    def __hlt2ProbeMuonProtos(self):
        """
        Charged muon protoparticles
        Requires chargedProtos and muon ID
        """
        from Configurables import (ChargedProtoParticleAddMuonInfo,
                                   ChargedProtoCombineDLLsAlg, MuonIDAlg,
                                   ChargedProtoParticleMaker,
                                   DelegatingTrackSelector)
        from MuonID import ConfiguredMuonIDs

        ProbeMuonProtosOutputLocation = _baseProtoPLocation(
            "Hlt2",
            HltDefaultFitSuffix + "/" + TrackEffNames[self.trackType()])

        Hlt2ProbeMuonProtoMaker = ChargedProtoParticleMaker(
            self.__pidAlgosAndToolsPrefix() + 'ProbeProtoPAlg')

        if (self.trackType() == "MuonTT"):
            # create the protos
            bm_members = [self.__hlt2MuonTTTracking()]
            Hlt2ProbeMuonProtoMaker.Inputs = [
                self.__hlt2MuonTTTracking().outputSelection()
            ]
            Hlt2ProbeMuonProtoMaker.addTool(DelegatingTrackSelector)
            Hlt2ProbeMuonProtoMaker.Output = ProbeMuonProtosOutputLocation
            Hlt2ProbeMuonProtoMaker.DelegatingTrackSelector.TrackTypes = [
                "Long"
            ]
            bm_members += [Hlt2ProbeMuonProtoMaker]

        elif (self.trackType() == "VeloMuon"):
            #build protos out of tracks
            bm_members = [self.__hlt2VeloMuonTracking()]
            Hlt2ProbeMuonProtoMaker.Inputs = [
                self.__hlt2VeloMuonTracking().outputSelection()
            ]
            Hlt2ProbeMuonProtoMaker.Output = ProbeMuonProtosOutputLocation
            Hlt2ProbeMuonProtoMaker.addTool(DelegatingTrackSelector,
                                            name='delTrackSel')
            Hlt2ProbeMuonProtoMaker.delTrackSel.TrackTypes = ['Long']
            bm_members += [Hlt2ProbeMuonProtoMaker]

        elif (self.trackType() == "FullDownstream"):
            # add muon ID
            bm_members = [self.__hlt2FullDownstreamTracking()]
            idalgname = self.__pidAlgosAndToolsPrefix() + "IDalg"
            cm = ConfiguredMuonIDs.ConfiguredMuonIDs(
                data=self.getProp("DataType"))
            idalg = cm.configureMuonIDAlgLite(idalgname)
            idalg.TracksLocations = [
                self.__hlt2FullDownstreamTracking().outputSelection()
            ]
            idalg.MuonIDLocation = Hlt2TrackRoot + HltDefaultFitSuffix + "/" + HltSharedPIDPrefix + "/" + HltMuonIDSuffix
            idalg.MuonTrackLocation = Hlt2TrackRoot + HltDefaultFitSuffix + "/" + HltSharedPIDPrefix + "/" + HltMuonTracksName

            # Configure moun ID tools explicitly, would be better if the ConfiguredMuonIDs class
            # provided a comprehensive method. All tools are public, but should configure
            # everywhere, where they are used to be safe.
            import Configurables
            for tool, fun in (("CommonMuonTool",
                               "IsMuonTool"), ("DLLMuonTool", "DLLMuonTool"),
                              ("MakeMuonTool", "MakeMuonTool")):
                tool = getattr(Configurables, tool)()
                getattr(cm, "configure" + fun)(tool)

            # make protos
            Hlt2ProbeMuonProtoMaker.Inputs = [
                self.__hlt2FullDownstreamTracking().outputSelection()
            ]
            Hlt2ProbeMuonProtoMaker.Output = ProbeMuonProtosOutputLocation
            Hlt2ProbeMuonProtoMaker.addTool(DelegatingTrackSelector,
                                            name="TrackSelector")
            tracktypes = ["Downstream"]
            Hlt2ProbeMuonProtoMaker.TrackSelector.TrackTypes = tracktypes
            addmuonpid = ChargedProtoParticleAddMuonInfo("addmuonpid")
            addmuonpid.InputMuonPIDLocation = idalg.MuonIDLocation
            addmuonpid.ProtoParticleLocation = Hlt2ProbeMuonProtoMaker.Output
            combinedll = ChargedProtoCombineDLLsAlg("combineDLL")
            combinedll.ProtoParticleLocation = Hlt2ProbeMuonProtoMaker.Output
            bm_members += [
                idalg, Hlt2ProbeMuonProtoMaker, addmuonpid, combinedll
            ]

        from HltLine.HltLine import bindMembers
        # Build the bindMembers

        bm_name = self.__pidAlgosAndToolsPrefix() + "ProbeMuonProtosSeq"
        bm_output = ProbeMuonProtosOutputLocation

        return bindMembers(bm_name, bm_members).setOutputSelection(bm_output)
Beispiel #5
0
def makeMyProtoP(trackcont):
    unpacker = UnpackTrack(trackcont + "UnpackTrack")
    unpacker.InputName = "pRec/Track/" + trackcont
    unpacker.OutputName = "Rec/Track/" + trackcont
    smeartracks = TrackSmeared(trackcont + "TrackSmeared")
    smeartracks.InputLocation = "Rec/Track/" + trackcont
    outputLocation = "Smeared"
    smeartracks.OutputLocation = outputLocation
    smeartracks.smearCopied = True
    smeartracks.smear = 1
    #smeartracks.makePlots = 1
    #smeartracks.OutputLevel = 2
    protoseq = GaudiSequencer(trackcont + "ProtoPSeq")
    protos = ChargedProtoParticleMaker(trackcont + "ProtoPMaker")
    protos.InputTrackLocation = ["Rec/Track/" + outputLocation]
    protos.OutputProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"
    protos.addTool(DelegatingTrackSelector, name="TrackSelector")
    #protos.OutputLevel = 0
    tracktypes = ["Long", "Upstream", "Downstream", "Ttrack", "Velo", "VeloR"]
    protos.TrackSelector.TrackTypes = tracktypes
    selector = protos.TrackSelector
    for tsname in tracktypes:
        selector.addTool(TrackSelector, name=tsname)
        ts = getattr(selector, tsname)
        # Set Cuts
        ts.TrackTypes = [tsname]

# Add PID information
    idalg = MuonIDAlg("BestIDalg")
    #idalg.OutputLevel = 5
    cm = ConfiguredMuonIDs.ConfiguredMuonIDs(
        data=DaVinci().getProp("DataType"))
    cm.configureMuonIDAlg(idalg)
    idalg.TrackLocation = "Rec/Track/" + outputLocation
    idalg.MuonIDLocation = "Rec/Muon/MuonPID/" + outputLocation

    from Configurables import (
        ChargedProtoParticleAddRichInfo, ChargedProtoParticleAddMuonInfo,
        ChargedProtoParticleAddEcalInfo, ChargedProtoParticleAddBremInfo,
        ChargedProtoParticleAddHcalInfo, ChargedProtoParticleAddPrsInfo,
        ChargedProtoParticleAddSpdInfo, ChargedProtoParticleAddVeloInfo,
        ChargedProtoCombineDLLsAlg)
    addmuonpid = ChargedProtoParticleAddMuonInfo("Bestaddmuoninfo")
    addmuonpid.InputMuonPIDLocation = "Rec/Muon/MuonPID/" + outputLocation
    addmuonpid.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"
    addrichpid = ChargedProtoParticleAddRichInfo("Bestaddrichinfo")
    addrichpid.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"
    # The rich pid is added to the track in TrackSmeared, thus only kaon pion pid is consistent
    # the others are not implemented. The modes smearBest and smearProto don't have the problems
    #addcalopid = ChargedProtoParticleAddCaloInfo("Bestaddcaloinfo")
    #addcalopid.InputRichCALOLocation = "Rec/Rich/"+outputLocation
    #addcalopid.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #ecal = ChargedProtoParticleAddEcalInfo("ChargedProtoPAddEcal")
    #ecal.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #brem = ChargedProtoParticleAddBremInfo("ChargedProtoPAddBrem")
    #brem.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #hcal = ChargedProtoParticleAddHcalInfo("ChargedProtoPAddHcal")
    #hcal.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #prs  = ChargedProtoParticleAddPrsInfo("ChargedProtoPAddPrs")
    #prs.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #spd  = ChargedProtoParticleAddSpdInfo("ChargedProtoPAddSpd")
    #spd.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    #velo = ChargedProtoParticleAddVeloInfo("ChargedProtoPAddVeloDEDX")
    #velo.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker"
    combinedll = ChargedProtoCombineDLLsAlg("BestCombineDLL")
    combinedll.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker"

    #set up associators
    assoctr = TrackAssociator(trackcont + "AssocTr")
    assoctr.TracksInContainer = "Rec/Track/" + outputLocation
    assocpp = ChargedPP2MC(trackcont + "AssocPP")
    assocpp.TrackLocations = ["Rec/Track/" + outputLocation]
    assocpp.InputData = ["Rec/ProtoP/" + trackcont + "ProtoPMaker"]
    assocpp.OutputTable = "Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker"
    # DST post treatment
    TrackToDST(trackcont +
               "TrackToDST").TracksInContainer = "Rec/Track/" + trackcont
    if not DaVinci().Simulation:
        protoseq.Members += [TrackToDST(trackcont + "TrackToDST"), protos]
        protoseq.Members += [
            ecal, brem, hcal, prs, spd, velo, addrichpid, addmuonpid,
            combinedll
        ]
        DataOnDemandSvc().AlgMap.update({
            "/Event/Rec/Track/" + trackcont:
            unpacker.getFullName(),
            "/Event/Rec/Track/" + outputLocation:
            smeartracks.getFullName(),
            "/Event/Rec/Rich/" + outputLocation:
            protoseq.getFullName(),
            "/Event/Rec/Muon/MuonPID/" + outputLocation:
            idalg.getFullName(),
            "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker":
            protoseq.getFullName(),
            "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker":
            protoseq.getFullName()
        })
    else:
        if (DaVinci().Simulation):
            protoseq.Members += [
                TrackToDST(trackcont + "TrackToDST"), assoctr, protos
            ]
            #protoseq.Members += [ ecal,brem,hcal,prs,spd,velo,addrichpid,addmuonpid,combinedll,assocpp ]
            protoseq.Members += [
                idalg, addmuonpid, addrichpid, combinedll, assocpp
            ]
            DataOnDemandSvc().AlgMap.update({
                "/Event/Rec/Track/" + trackcont:
                unpacker.getFullName(),
                "/Event/Rec/Track/" + outputLocation:
                smeartracks.getFullName(),
                "/Event/Rec/Rich/" + outputLocation:
                protoseq.getFullName(),
                "/Event/Rec/Muon/MuonPID/" + outputLocation:
                idalg.getFullName(),
                "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker":
                protoseq.getFullName(),
                "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker":
                protoseq.getFullName()
            })