Esempio n. 1
0
def configIso():
    from Configurables import ChargedProtoParticleMaker, DaVinci
    veloprotos = ChargedProtoParticleMaker("ProtoPMaker")
    veloprotos.Inputs = ["Rec/Track/Best"]
    veloprotos.Output = "Rec/ProtoP/myProtoPMaker/ProtoParticles"
    DaVinci().appendToMainSequence( [ veloprotos ])

    from Configurables       import ProtoParticleCALOFilter, CombinedParticleMaker,NoPIDsParticleMaker
    from CommonParticles.Utils import trackSelector, updateDoD
    algorithm = NoPIDsParticleMaker('StdNoPIDsVeloPions',  Particle =
            'pion',  )
    algorithm.Input = "Rec/ProtoP/myProtoPMaker/ProtoParticles"
    selector = trackSelector ( algorithm , trackTypes = ['Velo'] )
    locations = updateDoD ( algorithm )
    DaVinci().appendToMainSequence( [ algorithm ]) 
def muonTracksFORmuonAlignment():

    # this still needs to be worked out
    from Configurables import Escher
    Escher().RecoSequence = [
        "Hlt", "Decoding", "AlignTr", "Vertex", "RICH", "CALO", "MUON", "PROTO"
    ]  # ????
    Escher().MoniSequence = ["Tr", "OT"]

    # if the Escher hlt filter is not set, set it here
    if not hasattr(Escher(), "HltFilterCode") or not Escher().HltFilterCode:
        Escher(
        ).HltFilterCode = "HLT_PASS_RE( 'Hlt1DiMuonHighMass*Decision' )"  # Hlt2-->Hlt1 requirement

    # revive only particles used for trigger
    print 'Hlt lines to be used: '
    print ReviveHltTracks(['Hlt1DiMuonHighMassDecision'])

    # Now create the J/psi candidates
    from Configurables import CombineParticles, FilterDesktop
    from CommonParticles.StdAllLooseMuons import StdAllLooseMuons  # requires IsMuon==1
    from CommonParticles.StdLooseJpsi2MuMu import StdLooseJpsi2MuMu  # requires (ADAMASS('J/psi')<100.*MeV)&(ADOCACHI2CUT(30,'')) && "(VFASPF(VCHI2) < 25.)"

    StdLooseJpsi2MuMu.DaughtersCuts = {"mu-": "( P> 6000*MeV)"}  # momentum cut

    ## tighten the mass window for candidates used in alignment
    AlignJpsi2MuMu = FilterDesktop(
        "AlignJpsi2MuMu",
        Inputs=["Phys/StdLooseJpsi2MuMu"],
        Code="(ADMASS('J/psi(1S)') < 35.*MeV) & (VFASPF(VCHI2) < 10.)"
    )  # tighter requirements

    from Configurables import ChargedProtoParticleMaker, ChargedProtoParticleAddMuonInfo
    #####, ChargedProtoCombineDLLsAlg
    from Configurables import TrackParticleMonitor, GaudiSequencer
    recoJpsiSeq = GaudiSequencer("RecoJpsiSeq")
    recoJpsiSeq.Members = [
        ChargedProtoParticleMaker('ChargedProtoPMaker'),
        ChargedProtoParticleAddMuonInfo('ChargedProtoPAddMuon'),
        ###ChargedProtoCombineDLLsAlg('ChargedProtoPCombDLLs'),
        StdAllLooseMuons,
        StdLooseJpsi2MuMu,
        TrackParticleMonitor(
            'StdLooseJpsi2MuMuMonitor',
            InputLocation='/Event/Phys/StdLooseJpsi2MuMu/Particles',
            MinMass=3000,
            MaxMass=3190),
        AlignJpsi2MuMu,
        TrackParticleMonitor(
            'AlignJpsi2MuMuMonitor',
            InputLocation='/Event/Phys/AlignJpsi2MuMu/Particles',
            MinMass=3000,
            MaxMass=3190),
    ]

    sel = ParticleSelection(Name='MufromJpsiMuMu',
                            Location='/Event/Phys/AlignJpsi2MuMu/Particles',
                            Algorithm=recoJpsiSeq)
    return sel
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])
Esempio n. 4
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)
Esempio n. 5
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])
Esempio n. 6
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)
Esempio n. 7
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])
Esempio n. 8
0
#! /usr/bin/env python

from Configurables import DaVinci
import GaudiPython
import os
from PhysSelPython.Wrappers import DataOnDemand
from Configurables import CombineParticles, ChargedProtoParticleMaker, NoPIDsParticleMaker
from CommonParticles import StdAllNoPIDsPions, StdAllNoPIDsElectrons, StdNoPIDsUpElectrons
from CommonParticles.Utils import *

########################
## make VELO particles by hand
# first make protoparticles (needed for VELO Tracks)
myprotos = ChargedProtoParticleMaker("MyProtoParticles",
                                     Inputs = ["Rec/Track/Best"],
                                     Output = "Rec/ProtoP/MyProtoParticles")
DaVinci().UserAlgorithms +=[myprotos]

#now make the velo particles
algorithm =  NoPIDsParticleMaker ( 'StdNoPIDsVeloElectrons',
                                   DecayDescriptor = 'Electron' ,
                                   Particle = 'electron',
                                   Input = myprotos.Output)

# configure the track selector
selector = trackSelector ( algorithm,trackTypes = [ "Velo" ]  )
locations = updateDoD ( algorithm )
########################

## build all possible combinations of track types
combs = {"LL":"( ANUM( ( TRTYPE == 3 ) &  ( ABSID == 'e-' ) ) == 2 )",
Esempio n. 9
0
hlt1_emu = getattr(relinfo_HLT1, "RelInfoHLT1Emulation")
hlt1_emu.Variables = []
hlt1_emu.nltValue = 16.

DaVinci().appendToMainSequence([relinfo_HLT1])

##############################################################################################
##### PRODUCTION OF THE VELO PARTICLE INPUT CONTAINER FOR THE CHARGED ISOLATION TUPLE TOOL
#############################################################################################

#To produce the Velo particles input container (the gain in performance from adding velo tracks is actually pretty negligible...)

from Configurables import ChargedProtoParticleMaker

name = "Lambdab2Lcmunu"
veloprotos = ChargedProtoParticleMaker(name + "ProtoPMaker")
veloprotos.Inputs = ["Rec/Track/Best"]
veloprotos.Output = "Rec/ProtoP/myProtoPMaker/ProtoParticles"

DaVinci().appendToMainSequence([veloprotos])

from Gaudi.Configuration import *
from Configurables import ProtoParticleCALOFilter, CombinedParticleMaker, NoPIDsParticleMaker
from CommonParticles.Utils import *

algorithm = NoPIDsParticleMaker(
    'StdNoPIDsVeloPions',
    Particle='pion',
)
algorithm.Input = "Rec/ProtoP/myProtoPMaker/ProtoParticles"
selector = trackSelector(algorithm, trackTypes=['Velo'])
Esempio n. 10
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()
            })
Esempio n. 11
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()
            })
Esempio n. 12
0
DaVinci().Lumi = not DaVinci().Simulation

# Debug options
DaVinci().EvtMax = -1


###################################
# Customize DaVinci main sequence #
###################################

from Configurables import ChargedProtoParticleMaker
from Configurables import NoPIDsParticleMaker
from CommonParticles.Utils import trackSelector, updateDoD

# Provide required information for VELO pions.
ms_all_protos = ChargedProtoParticleMaker(name='MyProtoPMaker')
ms_all_protos.Inputs = ['Rec/Track/Best']
ms_all_protos.Output = 'Rec/ProtoP/MyProtoPMaker/ProtoParticles'

# NOTE: The name 'StdNoPIDsVeloPions' is hard-coded in the tuple tool, so the
#       name should not be changed.
ms_velo_pions = NoPIDsParticleMaker('StdNoPIDsVeloPions', Particle='pion')
ms_velo_pions.Input = ms_all_protos.Output

trackSelector(ms_velo_pions, trackTypes=['Velo'])
updateDoD(ms_velo_pions)

DaVinci().appendToMainSequence([ms_all_protos, ms_velo_pions])


#######################
Esempio n. 13
0
Options to run simple ChargedCombineParticleMaker configuraiton test.
Different configuraiton parameter combinaitons should give
cetrain Output, Input values.

Author Juan Palacios [email protected]

"""
from Configurables import (ApplicationMgr, ChargedProtoParticleMaker,
                           MessageSvc)

#MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"

# This should work fine
# Inputs = [Rec/Track/Special0]
# Output = Rec/ChargedPP/ProtoParticles0
cp0 = ChargedProtoParticleMaker('CPP0',
                                Inputs=['Rec/Track/Special0'],
                                Output='Rec/ChargedPP/ProtoParticles0',
                                OutputLevel=1)
ApplicationMgr().TopAlg += [cp0]

# This should work fine
# Inputs = [Rec/Track/Special1]
# Output = Rec/ChargedPP/ProtoParticles1
cp1 = ChargedProtoParticleMaker('CPP1',
                                Inputs=['Rec/Track/Special1'],
                                Output='Rec/ChargedPP/ProtoParticles1',
                                Context='HLT',
                                OutputLevel=1)
ApplicationMgr().TopAlg += [cp1]
Esempio n. 14
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
Esempio n. 15
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)
    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)
Esempio n. 17
0
Hlt2FullDownParts.Input = fulldownProtos.outputSelection()
Hlt2FullDownParts.Output = "Hlt2/Hlt2DownstreamMuons/Particles"

##########################################################################
#
# 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"
def defaultMinBiasD0Selection():

    # this still needs to be worked out
    from Configurables import Escher
    Escher().RecoSequence = ["Decoding", "VELO", "Tr", "Vertex", "RICH"]
    Escher().MoniSequence = ["Tr", "OT"]

    # Tweak a little bit RICH
    MinimalRichSequence()

    # now create the D0->K-Pi+ candidates
    from Configurables import FilterDesktop
    from Configurables import ChargedProtoParticleMaker, ChargedProtoParticleAddRichInfo, ChargedProtoCombineDLLsAlg

    # take as much as possible from CommonParticles
    from CommonParticles.StdAllLooseKaons import StdAllLooseKaons
    from CommonParticles.StdAllLoosePions import StdAllLoosePions
    from CommonParticles.StdLooseKaons import StdLooseKaons
    from CommonParticles.StdLoosePions import StdLoosePions
    from CommonParticles.StdLooseD02HH import StdLooseD02KPi
    # remove cuts that require a PV
    StdLooseD02KPi.MotherCut = "((VFASPF(VCHI2)<10) & (ADMASS('D0')<100*MeV) & (MIPCHI2DV(PRIMARY)<100.0))"
    StdLooseKaons.Code = "((PT>800.*MeV) & (MIPCHI2DV(PRIMARY)>5.0))"
    StdLoosePions.Code = "((PT>800.*MeV) & (MIPCHI2DV(PRIMARY)>5.0))"

    # add tight PID cuts basically to ensure that we don't swap the
    # kaon and pion.
    AlignD02KPiWide = FilterDesktop("AlignD02KPiWide",
                                    Inputs = ["Phys/StdLooseD02KPi"],
                                    Code = "(ADMASS('D0') < 50.*MeV) & (VFASPF(VCHI2) < 9.)" \
    #                                    " & (MINTREE((ABSID=='D0'), VFASPF(VZ))-VFASPF(VZ) > 0.09*mm )" \
                                    " & (MINTREE('K+'==ABSID, PIDK) > 0)" \
                                    " & (MINTREE('pi+'==ABSID, PIDK) < 0)" )

    # tighten the mass window for candidates used in alignment.
    AlignD02KPi = FilterDesktop("AlignD02KPi",
                                Inputs=["Phys/AlignD02KPiWide"],
                                Code="(ADMASS('D0') < 20.*MeV)")

    # create the sequence that we pass to the alignment
    from Configurables import TrackParticleMonitor, GaudiSequencer
    recoD0Seq = GaudiSequencer("RecoD0Seq", IgnoreFilterPassed=True)
    recoD0Seq.Members = [
        ChargedProtoParticleMaker('ChargedProtoPMaker'),
        ChargedProtoParticleAddRichInfo('ChargedProtoPAddRich'),
        ChargedProtoCombineDLLsAlg('ChargedProtoPCombDLLs'),
        TrackParticleMonitor(
            'StdLooseD02KPiMonitor',
            InputLocation='/Event/Phys/StdLooseD02KPi/Particles',
            MinMass=1810,
            MaxMass=1930), AlignD02KPiWide,
        TrackParticleMonitor(
            'AlignD02KPiWideMonitor',
            InputLocation='/Event/Phys/AlignD02KPiWide/Particles',
            MinMass=1810,
            MaxMass=1930), AlignD02KPi,
        TrackParticleMonitor('AlignD02KPiMonitor',
                             InputLocation='/Event/Phys/AlignD02KPi/Particles',
                             MinMass=1810,
                             MaxMass=1930)
    ]

    sel = ParticleSelection(Name='D02KPi',
                            Location='/Event/Phys/AlignD02KPi/Particles',
                            Algorithm=recoD0Seq)
    return sel
def defaultHLTJPsiSelection(lines=[]):

    # this still needs to be worked out
    from Configurables import Escher
    Escher().RecoSequence = [
        "Hlt", "Decoding", "AlignTr", "Vertex", "RICH", "CALO", "MUON", "PROTO"
    ]
    Escher().MoniSequence = ["Tr", "OT"]

    # if the Escher hlt filter is not set, set it here
    if not hasattr(Escher(), "HltFilterCode") or not Escher().HltFilterCode:
        Escher().HltFilterCode = "HLT_PASS_RE( 'Hlt2.*JPsi.*Decision' )"

    # revive only particles used for trigger
    print 'Hlt lines to be used: '
    print ReviveHltTracks(lines if len(lines) else [
        'Hlt2ExpressJPsiDecision', 'Hlt2DiMuonDetachedJPsiDecision',
        'Hlt2DiMuonJPsiDecision', 'Hlt2DiMuonJPsiHighPTDecision'
    ])

    # Now create the J/psi candidates
    from Configurables import CombineParticles, FilterDesktop
    from CommonParticles.StdAllLooseMuons import StdAllLooseMuons
    from CommonParticles.StdLooseJpsi2MuMu import StdLooseJpsi2MuMu
    StdLooseJpsi2MuMu.DaughtersCuts = {
        "mu-": "(PIDmu-PIDK>5.0) & (PIDmu-PIDe>8.0)"
    }

    ## tighten the mass window for candidates used in alignment
    AlignJpsi2MuMu = FilterDesktop(
        "AlignJpsi2MuMu",
        Inputs=["Phys/StdLooseJpsi2MuMu"],
        Code="(ADMASS('J/psi(1S)') < 35.*MeV) & (VFASPF(VCHI2) < 7.)"
    )  # Tight requirements on vchi2 - test 18/5/2012

    from Configurables import ChargedProtoParticleMaker, ChargedProtoParticleAddMuonInfo, ChargedProtoCombineDLLsAlg
    from Configurables import TrackParticleMonitor, GaudiSequencer
    recoJpsiSeq = GaudiSequencer("RecoJpsiSeq")
    recoJpsiSeq.Members = [
        ChargedProtoParticleMaker('ChargedProtoPMaker'),
        ChargedProtoParticleAddMuonInfo('ChargedProtoPAddMuon'),
        ChargedProtoCombineDLLsAlg('ChargedProtoPCombDLLs'),
        StdAllLooseMuons,  # we could also get this from the DoD
        StdLooseJpsi2MuMu,  # we could also get this from the DoD
        TrackParticleMonitor(
            'StdLooseJpsi2MuMuMonitor',
            InputLocation='/Event/Phys/StdLooseJpsi2MuMu/Particles',
            MinMass=3000,
            MaxMass=3190),
        AlignJpsi2MuMu,
        TrackParticleMonitor(
            'AlignJpsi2MuMuMonitor',
            InputLocation='/Event/Phys/AlignJpsi2MuMu/Particles',
            MinMass=3000,
            MaxMass=3190),
    ]

    sel = ParticleSelection(Name='Jpsi2MuMu',
                            Location='/Event/Phys/AlignJpsi2MuMu/Particles',
                            Algorithm=recoJpsiSeq)
    return sel
def defaultHLTDstarSelection():

    # this still needs to be worked out
    from Configurables import Escher
    Escher().RecoSequence = ["Hlt", "Decoding", "AlignTr", "Vertex", "RICH"]
    Escher().MoniSequence = ["Tr", "OT"]

    # if the Escher hlt filter is not set, set it here
    if not hasattr(Escher(), "HltFilterCode") or not Escher().HltFilterCode:
        Escher(
        ).HltFilterCode = "HLT_PASS_RE( 'Hlt2ExpressDStar2D0PiDecision' )"

    # retrieve the trigger lines from the hlt filter code
    print 'Hlt lines to be used: '
    print ReviveHltTracks()

    # Tweak a little bit RICH
    MinimalRichSequence()

    # now create the D0->K-Pi+ candidates
    from Configurables import FilterDesktop
    from Configurables import ChargedProtoParticleMaker, ChargedProtoParticleAddRichInfo, ChargedProtoCombineDLLsAlg

    # take as much as possible from CommonParticles
    from CommonParticles.StdAllLooseKaons import StdAllLooseKaons
    from CommonParticles.StdAllLoosePions import StdAllLoosePions
    from CommonParticles.StdLooseKaons import StdLooseKaons
    from CommonParticles.StdLoosePions import StdLoosePions
    from CommonParticles.StdLooseD02HH import StdLooseD02KPi
    from CommonParticles.StdLooseDstarWithD2HH import StdLooseDstarWithD02KPi
    # remove cuts that require a PV
    StdLooseD02KPi.MotherCut = "((VFASPF(VCHI2)<10) & (ADMASS('D0')<100*MeV))"
    StdLooseKaons.Code = "ALL"
    StdLoosePions.Code = "ALL"

    # add tight PID cuts basically toensure that we don't swap the
    # kaon and pion.
    AlignD02KPiWide = FilterDesktop(
        "AlignD02KPiWide",
        Inputs=["Phys/StdLooseD02KPi"],
        Code="(ADMASS('D0') < 50.*MeV) & (VFASPF(VCHI2) < 9.)")

    # tighten the mass window for candidates used in alignment.
    AlignD02KPi = FilterDesktop("AlignD02KPi",
                                Inputs=["Phys/AlignD02KPiWide"],
                                Code="(ADMASS('D0') < 20.*MeV)")

    # create the sequence that we pass to the alignment
    from Configurables import TrackParticleMonitor, GaudiSequencer
    recoDstarWithD0Seq = GaudiSequencer("RecoDstarWithD0Seq")
    recoDstarWithD0Seq.Members = [
        ChargedProtoParticleMaker('ChargedProtoPMaker'),
        ChargedProtoParticleAddRichInfo('ChargedProtoPAddRich'),
        ChargedProtoCombineDLLsAlg('ChargedProtoPCombDLLs'),
        TrackParticleMonitor(
            'StdLooseD02KPiMonitor',
            InputLocation='/Event/Phys/StdLooseD02KPi/Particles',
            MinMass=1810,
            MaxMass=1930),
        StdLooseDstarWithD02KPi,  #apply Dstar cut
        AlignD02KPiWide,
        TrackParticleMonitor(
            'AlignD02KPiWideMonitor',
            InputLocation='/Event/Phys/AlignD02KPiWide/Particles',
            MinMass=1810,
            MaxMass=1930),
        AlignD02KPi,
        TrackParticleMonitor('AlignD02KPiMonitor',
                             InputLocation='/Event/Phys/AlignD02KPi/Particles',
                             MinMass=1810,
                             MaxMass=1930)
    ]

    sel = ParticleSelection(Name='DstarWithD02KPi',
                            Location='/Event/Phys/AlignD02KPi/Particles',
                            Algorithm=recoDstarWithD0Seq)
    return sel
Esempio n. 21
0
###################################
# Customize DaVinci main sequence #
###################################
# These algorithms are executed before any of the selection algorithms.
#
# algorithms defined here will set up locations that will be available for all
# selection algorithms.

from Configurables import ChargedProtoParticleMaker
from Configurables import NoPIDsParticleMaker
from Configurables import TrackScaleState
from Configurables import TrackSmearState
from CommonParticles.Utils import trackSelector, updateDoD

# Provide required information for VELO pions.
ms_all_protos = ChargedProtoParticleMaker(name='MyProtoPMaker')
ms_all_protos.Inputs = ['Rec/Track/Best']
ms_all_protos.Output = 'Rec/ProtoP/MyProtoPMaker/ProtoParticles'  # This TES location will be accessible for all selection algorithms

# VELO pions for Greg's isolation tool.
# NOTE: The name 'StdNoPIDsVeloPions' is hard-coded in the tuple tool, so the
#       name should not be changed.
ms_velo_pions = NoPIDsParticleMaker('StdNoPIDsVeloPions', Particle='pion')
ms_velo_pions.Input = ms_all_protos.Output

# NOTE: These two lines are needed to select particles in VELO only.
# NOTE: DARK MAGIC.
trackSelector(ms_velo_pions, trackTypes=['Velo'])
updateDoD(ms_velo_pions)

# According to the source code (available in 'Analysis/Phys/DaVinciTrackScaling/src/TrackScaleState.cpp'):
    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)