def selMuonPParts(name, trackingSeq):
    """
       Make ProtoParticles out of VeloMuon tracks
   """
    veloprotos = ChargedProtoParticleMaker(name + "ProtoPMaker")
    veloprotos.Inputs = ["Rec/VeloMuon/Tracks"]
    veloprotos.Output = "Rec/ProtoP/" + name + "ProtoPMaker/ProtoParticles"
    veloprotos.addTool(DelegatingTrackSelector, name="TrackSelector")
    tracktypes = ["Long"]
    veloprotos.TrackSelector.TrackTypes = tracktypes
    selector = veloprotos.TrackSelector
    for tsname in tracktypes:
        selector.addTool(TrackSelector, name=tsname)
        ts = getattr(selector, tsname)
        # Set Cuts
        ts.TrackTypes = [tsname]

    veloprotoseq = GaudiSequencer(name + "ProtoPSeq")
    veloprotoseq.Members += [veloprotos]

    return GSWrapper(name="WrappedVeloMuonProtoPSeqFor" + name,
                     sequencer=veloprotoseq,
                     output='Rec/ProtoP/' + name +
                     'ProtoPMaker/ProtoParticles',
                     requiredSelections=[trackingSeq])
Пример #2
0
 def MakeVeloTracks(self,prefilter):
     
     if self.__confdict__["DoVeloDecoding"]:
         from DAQSys.Decoders import DecoderDB
         from DAQSys.DecoderClass import decodersForBank
         decs=[]
         vdec=DecoderDB["DecodeVeloRawBuffer/createBothVeloClusters"]
         vdec.Active=True
         DecoderDB["DecodeVeloRawBuffer/createVeloClusters"].Active=False
         DecoderDB["DecodeVeloRawBuffer/createVeloLiteClusters"].Active=False
         decs=decs+[vdec]
         VeloDecoding = GaudiSequencer("RecoDecodingSeq")
         VeloDecoding.Members += [d.setup() for d in decs ]
     
     MyFastVeloTracking = FastVeloTracking("For%sFastVelo"%self.name,OutputTracksName=self.VeloTrackOutputLocation)
     MyFastVeloTracking.OnlyForward = True
     MyFastVeloTracking.ResetUsedFlags = True
     ### prepare for fitting
     preve = TrackStateInitAlg("For%sInitSeedFit"%self.name,TrackLocation = self.VeloTrackOutputLocation)
     preve.StateInitTool.VeloFitterName = "FastVeloFitLHCbIDs"
     copyVelo = TrackContainerCopy( "For%sCopyVelo"%self.name )
     copyVelo.inputLocations = [self.VeloTrackOutputLocation]
     copyVelo.outputLocation = self.FittedVeloTrackOutputLocation
     
     ### fitting
     if self.__confdict__["VeloFitter"] == "ForwardStraightLine":
         MyVeloFit = ConfiguredForwardStraightLineEventFitter(Name="For%sVeloRefitterAlg"%self.name,
                                                              TracksInContainer=self.FittedVeloTrackOutputLocation)
     elif self.__confdict__["VeloFitter"] == "SimplifiedGeometry":
         MyVeloFit = ConfiguredEventFitter(Name="For%sVeloRefitterAlg"%self.name,
                                           TracksInContainer=self.FittedVeloTrackOutputLocation,
                                           SimplifiedGeometry = True)
     else:
         MyVeloFit = ConfiguredEventFitter(Name="For%sVeloRefitterAlg"%self.name,
                                           TracksInContainer=self.FittedVeloTrackOutputLocation)
         
     #### making the proto particles
     MakeVeloProtos = ChargedProtoParticleMaker('For%sVeloProtoMaker'%self.name)
     MakeVeloProtos.Inputs=[self.FittedVeloTrackOutputLocation]
     MakeVeloProtos.Output = self.VeloProtoOutputLocation
     MakeVeloProtos.addTool( DelegatingTrackSelector, name="TrackSelector" )
     MakeVeloProtos.TrackSelector.TrackTypes = [ "Velo" ]
 
     #### the full sequence
     makeparts = GaudiSequencer('For%sMakeVeloTracksGS'%self.name)
     if self.__confdict__["DoVeloDecoding"]:
         makeparts.Members += [ VeloDecoding ] 
     makeparts.Members += [ MyFastVeloTracking ] 
     makeparts.Members += [ preve ] 
     makeparts.Members += [ copyVelo ] 
     makeparts.Members += [ MyVeloFit ] 
     makeparts.Members += [ MakeVeloProtos ] 
 
     #### some python magic to maek this appear like a "Selection"
     return GSWrapper(name="For%sWrappedVeloTrackingFor"%self.name,
                      sequencer=makeparts,
                      output=self.VeloProtoOutputLocation,
                      requiredSelections =  prefilter)
Пример #3
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])
Пример #4
0
 def MakeVeloProtos(self,prefilter):
                 
     #### making the proto particles
     MakeVeloProtos = ChargedProtoParticleMaker('For%sVeloProtoMaker'%self.name())
     MakeVeloProtos.Inputs = [self.VeloTrackInputLocaton] 
     MakeVeloProtos.Output = self.VeloProtoOutputLocation
     MakeVeloProtos.addTool( DelegatingTrackSelector, name="TrackSelector" )
     MakeVeloProtos.TrackSelector.TrackTypes = [ "Velo" ]
 
     #### the full sequence
     makeparts = GaudiSequencer('For%sMakeVeloProtosGS'%self.name())
     makeparts.Members += [ MakeVeloProtos ] 
 
     #### some python magic to maek this appear like a "Selection"
     return GSWrapper(name="For%sWrappedVeloTrackingFor"%self.name(),
                      sequencer=makeparts,
                      output=self.VeloProtoOutputLocation,
                      requiredSelections =  prefilter)
Пример #5
0
def selMuonPParts(name, trackingSeq):
   """
       Make ProtoParticles out of VeloMuon tracks
   """
   unpacker = UnpackTrack(name+"UnpackTrack")
   unpacker.InputName="pRec/VeloMuon/Tracks"
   unpacker.OutputName="Rec/VeloMuon/Tracks"

   veloprotos = ChargedProtoParticleMaker(name+"ProtoPMaker")
   veloprotos.Inputs = ["Rec/VeloMuon/Tracks"]
   veloprotos.Output = "Rec/ProtoP/"+name+"ProtoPMaker/ProtoParticles"
   veloprotos.addTool( DelegatingTrackSelector, name="TrackSelector" )
   tracktypes = [ "Long" ]
   #veloprotos.OutputLevel =0
   #if (trackcont == "Best") :
   #	tracktypes = [ "Long" ]
   veloprotos.TrackSelector.TrackTypes = tracktypes
   selector = veloprotos.TrackSelector
   for tsname in tracktypes:
   	selector.addTool(TrackSelector,name=tsname)
   	ts = getattr(selector,tsname)
   	# Set Cuts
   	ts.TrackTypes = [tsname]

#        
   DataOnDemandSvc().AlgMap.update( {
                "/Event/Rec/VeloMuon/Tracks" : unpacker.getFullName(),
		} )

   veloprotoseq = GaudiSequencer(name+"ProtoPSeq")
   veloprotoseq.Members += [ veloprotos ]

   return GSWrapper(name="WrappedVeloMuonProtoPSeqFor" + name,
                    sequencer=veloprotoseq,
                    output='Rec/ProtoP/' + name +'ProtoPMaker/ProtoParticles',
                    requiredSelections = [ trackingSeq])
Пример #6
0
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()
            })
Пример #7
0
    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)
Пример #8
0
    def applyConf(self):

        if not self.isPropertySet("RecoSequencer") :
            raise RuntimeError("ERROR : PROTO Sequencer not set")
        
        seq = self.getProp("RecoSequencer")
        seq.Context = self.getProp("Context")

        # Charged Proto particles
        from Configurables import ( GaudiSequencer,
                                    ChargedProtoParticleMaker,
                                    ChargedProtoParticleAddRichInfo,
                                    ChargedProtoParticleAddMuonInfo,
                                    ChargedProtoParticleAddEcalInfo,
                                    ChargedProtoParticleAddBremInfo,
                                    ChargedProtoParticleAddHcalInfo,
                                    ChargedProtoParticleAddPrsInfo,
                                    ChargedProtoParticleAddSpdInfo,
                                    ChargedProtoParticleAddVeloInfo,
                                    ChargedProtoCombineDLLsAlg,
                                    DelegatingTrackSelector )
        cseq = GaudiSequencer("ChargedProtoParticles")
        seq.Members += [cseq]
        
        # Make Charged ProtoParticles
        charged = ChargedProtoParticleMaker("ChargedProtoPMaker")
        charged.addTool( DelegatingTrackSelector, name="TrackSelector" )
        tracktypes = self.getProp("TrackTypes")
        charged.TrackSelector.TrackTypes = tracktypes
        for type in tracktypes : self.setupTypeTrackSelector( type, charged.TrackSelector )
        # Add PID information
        rich = ChargedProtoParticleAddRichInfo("ChargedProtoPAddRich")
        muon = ChargedProtoParticleAddMuonInfo("ChargedProtoPAddMuon")
        ecal = ChargedProtoParticleAddEcalInfo("ChargedProtoPAddEcal")
        brem = ChargedProtoParticleAddBremInfo("ChargedProtoPAddBrem")
        hcal = ChargedProtoParticleAddHcalInfo("ChargedProtoPAddHcal")
        velo = ChargedProtoParticleAddVeloInfo("ChargedProtoPAddVeloDEDX")
        # Fill the Combined DLL information in the charged protoparticles
        combine = ChargedProtoCombineDLLsAlg("ChargedProtoPCombDLLs")
        # Fill the sequence
        cseq.Members += [ charged,ecal,brem,hcal]
        if not self.getProp("NoSpdPrs") :
            prs  = ChargedProtoParticleAddPrsInfo("ChargedProtoPAddPrs")
            spd  = ChargedProtoParticleAddSpdInfo("ChargedProtoPAddSpd")
            cseq.Members += [prs,spd ]
        cseq.Members += [ velo, rich,muon,combine ]
        
        # Neutrals
        from Configurables import NeutralProtoPAlg
        nseq = GaudiSequencer("NeutralProtoParticles")
        seq.Members += [nseq]
        neutral = NeutralProtoPAlg("NeutralProtoPMaker")
        nseq.Members += [ neutral ]
        
        # Set output levels
        if self.isPropertySet("OutputLevel"):
            level = self.getProp("OutputLevel")
            charged.OutputLevel = level
            rich.OutputLevel    = level
            muon.OutputLevel    = level
            ecal.OutputLevel    = level
            brem.OutputLevel    = level
            hcal.OutputLevel    = level
            if not self.getProp("NoSpdPrs") :
                prs.OutputLevel     = level
                spd.OutputLevel     = level
            velo.OutputLevel    = level
            combine.OutputLevel = level
            neutral.OutputLevel = level

        # ANN PID
        if self.getProp("AddANNPIDInfo") :
            nnpidseq = GaudiSequencer("ANNGPIDSeq")
            cseq.Members += [nnpidseq]
            annconf = ChargedProtoANNPIDConf()
            self.setOtherProps(annconf,["DataType","OutputLevel","Context"])
            annconf.RecoSequencer = nnpidseq
    def setupPF(self):

        ## set the algorithm
        alg = ParticleFlow(self.name)

        if "Velo" in self.paramDef['TrackSelector'].keys(
        ) and not self.paramDef['UseVelo']:
            self.paramDef['UseVelo'] = True

        # set all params
        for prop, value in self.paramDef.items():
            if prop != 'TrackSelector' and prop != 'TrackVelo' and prop != "scalingANDsmearing":
                setattr(alg, prop, value)
            else:
                self.__dict__[prop] = value

        if (self.name != "PF"):
            alg.PFOutputLocation = "Phys/" + self.name + "/Particles"

        ## List of algorithms to put in the sequencer
        if self.scalingANDsmearing:
            from Configurables import TrackScaleState as SCALER
            scaler = SCALER('PFStateScale')
            self.PFSeq.Members += [scaler]
            if self.MCCor:
                from Configurables import TrackSmearState as SMEAR
                smear = SMEAR('PFStateSmear')
                self.PFSeq.Members += [smear]

        ## Definition of cuts to apply to input tracks for inputselection
        TrackCuts = {}
        if self.paramDef['UseVelo'] and not "Velo" in self.TrackSelector.keys(
        ):
            self.TrackSelector["Velo"] = self.TrackVelo

        for trtype in self.TrackSelector.keys():
            if trtype == "Long":
                TrackCuts[trtype] = {
                    "Chi2Cut": [0, self.TrackSelector[trtype]['Chi2Max']],
                    "MinPtCut": self.TrackSelector[trtype]['PtMin'],
                    "MaxGhostProbCut":
                    self.TrackSelector[trtype]['MaxGhostProb']
                }
            if trtype == "Downstream":
                TrackCuts[trtype] = {
                    "Chi2Cut": [0, self.TrackSelector[trtype]['Chi2Max']],
                    "MinPtCut": self.TrackSelector[trtype]['PtMin'],
                    "MaxGhostProbCut":
                    self.TrackSelector[trtype]['MaxGhostProb']
                }
            if trtype == "Upstream":
                TrackCuts[trtype] = {
                    "Chi2Cut": [0, self.TrackSelector[trtype]['Chi2Max']],
                    "MinPtCut": self.TrackSelector[trtype]['PtMin']
                }
            if trtype == "Velo":
                TrackCuts[trtype] = {
                    "Chi2Cut": [0, self.TrackSelector[trtype]['Chi2Max']]
                }

                protos = ChargedProtoParticleMaker("VeloProtoPMaker")
                protos.Inputs = ["Rec/Track/Best"]
                protos.Output = "Rec/ProtoP/VeloProtoPMaker"
                protos.addTool(DelegatingTrackSelector, name="TrackSelector")
                protos.TrackSelector.TrackTypes = ["Velo"]
                self.setupTypeTrackSelector("Velo", protos.TrackSelector,
                                            TrackCuts["Velo"])
                self.PFSeq.Members += [protos]

        pLocations = []
        pCompLocations = []
        alg.MC_recovery = self.MCCor

        #re set default to false
        alg.UseHCAL = False
        alg.NeutralRecovery = False

        for t in self.InputParticles:
            if t == 'Photons':
                pLocations.append('Phys/StdLooseAllPhotons/Particles')

            elif t == 'NeutralHadrons':
                ## Set the HCAL uses
                alg.UseHCAL = True
                self.setupHCAL()

            elif t == 'Charged':
                ## Track selector
                alg.TrackSelectorType = "DelegatingTrackSelector"
                alg.addTool(DelegatingTrackSelector, name="TrackSelector")
                tracktypes = TrackCuts.keys()
                alg.TrackSelector.TrackTypes = self.TrackSelector.keys()
                for type in tracktypes:
                    self.setupTypeTrackSelector(type, alg.TrackSelector,
                                                TrackCuts)

            elif t == 'Pi0s':
                pLocations.append('Phys/StdLooseResolvedPi0/Particles')
                pLocations.append('Phys/StdLooseMergedPi0/Particles')

            elif t == 'V0s':
                pCompLocations.append("Phys/StdKs2PiPiLL/Particles")
                pCompLocations.append("Phys/StdKs2PiPiDD/Particles")
                pCompLocations.append("Phys/StdLambda2PPiLL/Particles")
                pCompLocations.append("Phys/StdLambda2PPiDD/Particles")

            elif t == 'PFNeutrals':
                alg.NeutralRecovery = True

            else:
                print t, "are not supported!"
                exit(1)

            if len(self.paramDef['CompositeParticleLocations']) > 0.5:
                for t in self.paramDef['CompositeParticleLocations']:
                    pCompLocations.append(t)

        alg.ParticleLocations = pLocations
        alg.CompositeParticleLocations = pCompLocations
        self.PFSeq.Members += [alg]
        self.algorithms.append(self.PFSeq)
    def setupPF(self):
        ## List of algorithms to put in the sequencer

        ## set the algorithm
        alg = ParticleFlow4Jets(self.name)

        ## Definition of cuts to apply to input tracks for inputselection

        TrackCuts = {}
        print '###################################### ', self.TrackType
        if self.UseVelo and not "Velo" in self.TrackType:
            self.TrackType.append("Velo")
        for trtype in self.TrackType:
            if trtype == "Long":
                TrackCuts["Long"] = {
                    "Chi2Cut": [0, self.Chi2MaxLong],
                    "MinPtCut": self.PtMinLong,
                    "CloneDistCut": [5000, 9e+99],
                    "AcceptClones": self.AcceptClone
                }
            if trtype == "Downstream":
                TrackCuts["Downstream"] = {
                    "Chi2Cut": [0, self.Chi2MaxDown],
                    "MinPtCut": self.PtMinDown
                }
            if trtype == "Upstream":
                TrackCuts["Upstream"] = {
                    "Chi2Cut": [0, self.Chi2MaxUp],
                    "MinPtCut": self.PtMinUp
                }
            if trtype == "Velo":
                TrackCuts["Velo"] = {"Chi2Cut": [0, self.Chi2MaxVelo]}
                protos = ChargedProtoParticleMaker("VeloProtoPMaker")
                protos.Inputs = ["Rec/Track/Best"]
                protos.Output = "Rec/ProtoP/VeloProtoPMaker"
                protos.addTool(DelegatingTrackSelector, name="TrackSelector")
                protos.TrackSelector.TrackTypes = ["Velo"]
                self.setupTypeTrackSelector("Velo", protos.TrackSelector,
                                            TrackCuts["Velo"])
                self.algorithms.append(protos)

        ## Neutral related cuts

        pLocations = []

        alg.UseTTrackBanning = True
        alg.CandidateToBanLocation = self.CandidateToBanLocation
        alg.VerticesLocation = self.VerticesLocation
        alg.PFOutputLocation = self.PFOutputLocation
        alg.PFBannedOutputLocation = self.PFBannedOutputLocation
        alg.PFHiddenNeutralOutputLocation = self.PFHiddenNeutralOutputLocation
        alg.PFProtoParticlesOutputLocation = self.PFProtoParticlesOutputLocation
        alg.PFCaloHypoOutputLocation = self.PFCaloHypoOutputLocation

        for t in self.InputParticles:
            if t == 'Photons':
                pLocations.append('Phys/StdLooseAllPhotons/Particles')
                alg.MinPhotonID4Photon = self.MinPhotonID4Photon
                alg.MinPhotonID4PhotonTtrack = self.MinPhotonID4PhotonTtrack

            if t == 'NeutralHadrons':
                ## Set the HCAL uses
                alg.UseHCAL = self.UseHCAL
                self.setupHCAL()
                alg.MinHCALE = self.MinHCALE
                ## Match track and clusters
                alg.MaxMatchHCALLowEValue = self.MaxMatchHCALLowEValue
                alg.MaxMatchHCALHighEValue = self.MaxMatchHCALHighEValue
                alg.MaxMatchHCALTrSmallE = self.MaxMatchHCALTrSmallE
                alg.MaxMatchHCALTrMediumE = self.MaxMatchHCALTrMediumE
                alg.MaxMatchHCALTrLargeE = self.MaxMatchHCALTrLargeE
                alg.MaxMatchHCALTr_T = self.MaxMatchHCALTr_T

            if t == 'Charged':
                ## Track selector
                alg.TrackSelectorType = "DelegatingTrackSelector"
                alg.addTool(DelegatingTrackSelector, name="TrackSelector")
                tracktypes = TrackCuts.keys()
                alg.TrackSelector.TrackTypes = self.TrackType
                for type in tracktypes:
                    self.setupTypeTrackSelector(type, alg.TrackSelector,
                                                TrackCuts)

                ## Track related cuts
                alg.MinInfMomentumCut = self.MinInfMomentumCut
                alg.MaxChi2NoTT = self.MaxChi2NoTT
                alg.UseTTHits = self.UseTTHits
                alg.MaxMatchECALTr = self.MaxMatchECALTr
                alg.MaxMatchECALTr_T = self.MaxMatchECALTr_T
                alg.UsePIDInfo = self.UsePIDInfo

            if t == 'Pi0s':
                pLocations.append('Phys/StdLooseResolvedPi0/Particles')
                pLocations.append('Phys/StdLooseMergedPi0/Particles')
                alg.MinPhotonIDMax4ResolvedPi0 = self.MinPhotonIDMax4ResolvedPi0
                alg.MinPhotonIDMin4ResolvedPi0 = self.MinPhotonIDMin4ResolvedPi0

            if t == 'V0s':
                pLocations.append('Phys/StdLooseKsDD/Particles')
                pLocations.append('Phys/StdLooseKsLL/Particles')
                pLocations.append('Phys/StdLooseLambdaDD/Particles')
                pLocations.append('Phys/StdLooseLambdaLL/Particles')

            if t == 'PFNeutrals':
                alg.NeutralRecovery = True
                alg.UsePIDInfo = True
                alg.CalibECAL_EovP = self.CalibECAL_EovP
                alg.CalibHCAL_EovP = self.CalibHCAL_EovP
                alg.NSigmaForCaloRecovery = self.NSigmaForCaloRecovery

        alg.ParticleLocations = pLocations
        #alg.OutputLevel = 0
        self.algorithms.append(alg)
Пример #11
0
#
# Velo particles
#
##########################################################################

from HltTracking.HltTrackNames import HltSharedTrackLoc, HltDefaultFitSuffix, _baseProtoPLocation, TrackName, Hlt2TrackEffRoot
from HltLine.HltLine import bindMembers
from Configurables import CombinedParticleMaker, ChargedProtoParticleMaker, BestPIDParticleMaker, NoPIDsParticleMaker
from Configurables import DelegatingTrackSelector
from HltTracking.HltSharedTracking import RevivedVelo, FittedVelo

Hlt2VeloProtos = ChargedProtoParticleMaker('Hlt2VeloProtosForTrackEff')
Hlt2VeloProtos.Inputs = [FittedVelo.outputSelection()]
Hlt2VeloProtos.Output = _baseProtoPLocation(
    "Hlt2", Hlt2TrackEffRoot + "/" + TrackName["Velo"])
Hlt2VeloProtos.addTool(DelegatingTrackSelector, name='delTrackSelVelo')
Hlt2VeloProtos.delTrackSelVelo.TrackTypes = ['Velo']

Hlt2VeloPionParts = NoPIDsParticleMaker("Hlt2VeloPionParts")
Hlt2VeloPionParts.Particle = 'pion'
Hlt2VeloPionParts.Input = Hlt2VeloProtos.Output
Hlt2VeloPionParts.Output = Hlt2TrackEffRoot + "/Hlt2VeloPions/Particles"

Hlt2VeloKaonParts = NoPIDsParticleMaker("Hlt2VeloKaonParts")
Hlt2VeloKaonParts.Particle = 'kaon'
Hlt2VeloKaonParts.Input = Hlt2VeloProtos.Output
Hlt2VeloKaonParts.Output = Hlt2TrackEffRoot + "/Hlt2VeloKaons/Particles"

Hlt2GoodVeloKaons = Hlt2Member(
    FilterDesktop,
    "VeloKaons",
Пример #12
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()
            })