Ejemplo n.º 1
0
 def _configureTruth(self,assocpp) :
     tesROOT="/Event/"+self.base
     protocont = self.base + "Protos"
     trackcont = self.base + "Tracks"
     assoctr = TrackAssociator("TurboAssocTr")
     assoctr.OutputLevel = self.getProp('OutputLevel')
     assoctr.TracksInContainer = trackcont
     assocpp.TrackLocations += [ trackcont ]
     assocpp.InputData += [ protocont ]
     # Add it to a sequence
     seq = GaudiSequencer('TurboSeqT2MC')
     seq.Members += [assoctr]
     return seq
Ejemplo n.º 2
0
 def redoMCLinks(self,init):
     """
     Redo MC links.
     """
     
     if ( self.getProp("Simulation") ):
         redo = self.getProp("RedoMCLinks")
         if ( redo ):
             from Configurables import (GaudiSequencer,TESCheck,EventNodeKiller,TrackAssociator)
             mcKillSeq = GaudiSequencer("KillMCLinks") # The sequence killing the node of it exists
             tescheck = TESCheck("DaVinciEvtCheck")    # Check for presence of node ...
             tescheck.Inputs = ["Link/Rec/Track/Best"] # 
             tescheck.Stop = False                     # But don't stop
             tescheck.OutputLevel = 5                  # don't print warnings
             evtnodekiller = EventNodeKiller("DaVinciEvtNodeKiller") # kill nodes
             evtnodekiller.Nodes = ["Link/Rec/Track"]        # Kill that
             mcKillSeq.Members = [ tescheck, evtnodekiller, TrackAssociator() ]                  
             mcLinkSeq = GaudiSequencer("RedoMCLinks") # The sequence redoing the links
             mcLinkSeq.IgnoreFilterPassed = True       # Run it always
             mcLinkSeq.Members = [ mcKillSeq, TrackAssociator() ]  
             init.Members += [ mcLinkSeq ]
Ejemplo n.º 3
0
def associateSequence(prefix,debug):
    from Gaudi.Configuration import GaudiSequencer 
    from Configurables import TrackAssociator, ChargedPP2MC
    base = "/Event/Turbo/"
    protos = prefix + "Protos"
    tracks = prefix + "Tracks"
    protocont = base + protos
    trackcont = base + tracks
    relloc = "Relations/Turbo/" + protos
    assoctr = TrackAssociator(prefix+"AssocTr")
    assoctr.TracksInContainer = trackcont
    assocpp=ChargedPP2MC(prefix+"ProtoAssocPP")
    assocpp.RootInTES=base
    assocpp.TrackLocations = [ trackcont ]
    assocpp.InputData = [ protocont ]
    assocpp.OutputTable = relloc
    if debug == True:
        assocpp.OutputLevel = 2
        assoctr.OutputLevel = 2
    # Add it to a selection sequence
    seq = GaudiSequencer(prefix+'SeqP2MC')
    seq.Members += [assoctr,assocpp]
    return seq
Ejemplo n.º 4
0
def doIt():
    GaudiSequencer("TrackHLT2SeedPatSeq").Members += [
        TrackAssociator("AssocSeed", TracksInContainer="Rec/Track/Seed")
    ]
    GaudiSequencer("MCLinksUnpackSeq").Members = []
    #   from Configurables import PatChecker
    from Configurables import PrChecker
    from Configurables import PatLHCbID2MCParticle
    from Configurables import PatCheckerNTuple

    #GaudiSequencer("CheckPatSeq").Members = []

    PatCheckerNTuple().InputTracks = "Rec/Track/Downstream"

    GaudiSequencer("CheckPatSeq").Members += [
        PrChecker("PrChecker", Upgrade=False)
    ]

    GaudiSequencer("CheckPatSeq").Members += [
        PatLHCbID2MCParticle(), PatCheckerNTuple()
    ]
Ejemplo n.º 5
0
def PatChecking():

    GaudiSequencer("CheckPatSeq").Members += [
        PatLHCbID2MCParticle("PatLHCbID2MCParticle")
    ]

    ## Define the associators and track efficiency checkers according to the Pattern algorithms

    trackAlgs = TrackSys().getProp("TrackPatRecAlgorithms")

    if "Truth" in trackAlgs:
        GaudiSequencer("RecoTruthSeq").Members += [
            UnpackMCParticle(),
            UnpackMCVertex(),
            PatLHCbID2MCParticle()
        ]

    if not TrackSys().veloOpen() and "FastVelo" not in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [
            TrackAssociator("AssocVeloRZ")
        ]
        GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("VeloRZ")]
        TrackAssociator("AssocVeloRZ").TracksInContainer = "Rec/Track/RZVelo"
        TrackEffChecker(
            "VeloRZ").GhostClassification = "VeloRGhostClassification"

    if "Velo" in trackAlgs or "FastVelo" in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [TrackAssociator("AssocVelo")]
        GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("Velo")]
        TrackAssociator("AssocVelo").TracksInContainer = "Rec/Track/Velo"
        TrackEffChecker("Velo").GhostClassification = "VeloGhostClassification"

    if "VeloTT" in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [
            TrackAssociator("AssocVeloTT")
        ]
        GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("VeloTT")]
        TrackAssociator("AssocVeloTT").TracksInContainer = "Rec/Track/VeloTT"
        TrackEffChecker(
            "Velo").GhostClassification = "UpstreamGhostClassification"

    if "Forward" in trackAlgs or "ForwardHLT2" in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [
            TrackAssociator("AssocForward")
        ]
        GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("Forward")]
        TrackAssociator("AssocForward").TracksInContainer = "Rec/Track/Forward"
        TrackEffChecker(
            "Forward").GhostClassification = "LongGhostClassification"

    if "TsaSeed" in trackAlgs or "PatSeed" in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [
            TrackAssociator("AssocTTrack")
        ]
        GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("TTrack")]
        TrackAssociator("AssocTTrack").TracksInContainer = "Rec/Track/Seed"
        TrackEffChecker(
            "TTrack").GhostClassification = "TTrackGhostClassification"

    if "Match" in trackAlgs or "PatMatch" in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [
            TrackAssociator("AssocMatch")
        ]
        GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("Match")]
        TrackAssociator("AssocMatch").TracksInContainer = "Rec/Track/Match"
        TrackEffChecker(
            "Match").GhostClassification = "LongGhostClassification"

    if "Downstream" in trackAlgs or "PatLongLivedTracking" in trackAlgs:
        GaudiSequencer("CheckPatSeq").Members += [
            TrackAssociator("AssocDownstream")
        ]
        GaudiSequencer("CheckPatSeq").Members += [
            TrackEffChecker("Downstream")
        ]
        TrackAssociator(
            "AssocDownstream").TracksInContainer = "Rec/Track/Downstream"
        TrackEffChecker(
            "Downstream").GhostClassification = "DownstreamGhostClassification"

    GaudiSequencer("CheckPatSeq").Members += [TrackAssociator("AssocBest")]
    GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("BestTracks")]
    TrackAssociator("AssocBest").TracksInContainer = "Rec/Track/Best"
    TrackEffChecker(
        "BestTracks").GhostClassification = "AllTrackGhostClassification"

    GaudiSequencer("CheckPatSeq").Members += [DebugTrackingLosses()]

    GaudiSequencer("CheckPatSeq").Members += [
        TrackResChecker("TrackResChecker")
    ]
    TrackResChecker("TrackResChecker").SplitByType = True
    ConfigureEffCheckTools(TrackResChecker("TrackResChecker"))

    TrackEffChecker("BestTracks").TracksInContainer = "Rec/Track/Best"
    TrackEffChecker("BestTracks").SelectionCriteria = "ChargedLong"
    TrackEffChecker("BestTracks").RequireLongTrack = True
    ConfigureEffCheckTools(TrackEffChecker("BestTracks"))

    TrackEffChecker("VeloRZ").TracksInContainer = "Rec/Track/RZVelo"
    TrackEffChecker("VeloRZ").SelectionCriteria = "ChargedLong"
    ConfigureEffCheckTools(TrackEffChecker("VeloRZ"))

    TrackEffChecker("Velo").TracksInContainer = "Rec/Track/Velo"
    TrackEffChecker("Velo").SelectionCriteria = "ChargedLong"
    ConfigureEffCheckTools(TrackEffChecker("Velo"))

    TrackEffChecker("VeloTT").TracksInContainer = "Rec/Track/VeloTT"
    TrackEffChecker("VeloTT").SelectionCriteria = "ChargedLong"
    ConfigureEffCheckTools(TrackEffChecker("VeloTT"))

    TrackEffChecker("Forward").TracksInContainer = "Rec/Track/Forward"
    TrackEffChecker("Forward").SelectionCriteria = "ChargedLong"
    ConfigureEffCheckTools(TrackEffChecker("Forward"))

    TrackEffChecker("TTrack").TracksInContainer = "Rec/Track/Seed"
    TrackEffChecker("TTrack").SelectionCriteria = "ChargedLong"
    ConfigureEffCheckTools(TrackEffChecker("TTrack"))

    TrackEffChecker("Match").TracksInContainer = "Rec/Track/Match"
    TrackEffChecker("Match").SelectionCriteria = "ChargedLong"
    ConfigureEffCheckTools(TrackEffChecker("Match"))

    TrackEffChecker("Downstream").TracksInContainer = "Rec/Track/Downstream"
    TrackEffChecker("Downstream").SelectionCriteria = "ChargedDownstream"
    ConfigureEffCheckTools(TrackEffChecker("Downstream"))

    GaudiSequencer("CheckPatSeq").Members += [
        TrackOccupChecker("OccupancyCheck")
    ]
Ejemplo n.º 6
0
#makeMyKaons("SmrdLooseKaons", "Best", "kaon")
#makeAllParticles("SmrdNoPIDPions", "Best", "pion")
#makeAllParticles("SmrdNoPIDKaons", "Best", "kaon")

from Configurables import TrackSmeared
output = "Smeared" #/Rec/Track/Smeared
TrackSmeared("TrackSmearing").OutputLocation = output
TrackSmeared("TrackSmearing").smear = True
TrackSmeared("TrackSmearing").makePlots = True
TrackSmeared("TrackSmearing").OutputLevel = 2
TrackSmeared("TrackSmearing").smearProto = True
TrackSmearingSeq = GaudiSequencer("TrackSmearingSeq")

#Preserve MC
from Configurables import TrackToDST, ChargedPP2MC, TrackAssociator
assoctr = TrackAssociator(output+"AssocTr")
assoctr.TracksInContainer = "Rec/Track/"+output
assocpp=ChargedPP2MC(output+"AssocPP")
assocpp.TrackLocations = [ "Rec/Track/"+output ]
assocpp.InputData = [ "Rec/ProtoP/"+output+"ProtoPMaker" ]
assocpp.OutputTable = "Relations/Rec/ProtoP/"+output+"ProtoPMaker"

TrackSmearingSeq.Members = [ TrackSmeared("TrackSmearing") , assoctr, assocpp ]
from Configurables       import CombinedParticleMaker
from CommonParticles.Utils import *
from Configurables       import ProtoParticleCALOFilter
## create the algorithm 
algorithm =  CombinedParticleMaker ( 'SmrdLoosePions'  ,
                                     Particle =  'pion'  )

# configure the track selector
Ejemplo n.º 7
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()
            })
Ejemplo n.º 8
0
from Configurables import (GaudiSequencer, DecodeVeloRawBuffer,
                           TrackAssociator, Tf__PatVeloRTracking,
                           Tf__PatVeloSpaceTool, Tf__PatVeloSpaceTracking,
                           Tf__PatVeloGeneralTracking, NewVeloSpaceTool,
                           UnpackMCParticle, UnpackMCVertex,
                           MCParticleSelector)

GaudiSequencer("RecoVELOSeq").Members = [
    DecodeVeloRawBuffer(),
    Tf__PatVeloRTracking("PatVeloRTracking"),
    Tf__PatVeloSpaceTracking("PatVeloSpaceTracking"),
    Tf__PatVeloGeneralTracking("PatVeloGeneralTracking"),
    UnpackMCParticle(),
    UnpackMCVertex(),
    TrackAssociator("AssocVeloRZ"),
    TrackAssociator("AssocVelo")
]
from Configurables import (FwdFitParams, SeedFitParams, KsFitParams)

GaudiSequencer("CheckFitSeq").Members += [
    FwdFitParams(), SeedFitParams(),
    KsFitParams()
]

KsFitParams().zMagnetParams = [5372.42, -3372.25, 370.484]
KsFitParams().momentumParams = [1226.32, 479.859, 2859.75]

SeedFitParams().InitialArrowParams = [4.21826e-09, -8.93796e-08, 0.372981]
SeedFitParams().MomentumScaleParams = [40.3751, 1163.24, -682850]
SeedFitParams().zMagnetParams = [5373.86, -3283.82, 379.141]
Ejemplo n.º 9
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()
            })
Ejemplo n.º 10
0
def execute(simulation=True,
            turbo=True,
            decay_descriptor="J/psi(1S) -> mu- mu+"):
    # Configure all the unpacking, algorithms, tags and input files
    appConf = ApplicationMgr()
    appConf.ExtSvc += ['ToolSvc', 'DataOnDemandSvc', LoKiSvc()]

    ConfigTarFileAccessSvc().File = 'config.tar'

    dv = DaVinci()
    dv.DataType = "2012"

    lhcbApp = LHCbApp()
    lhcbApp.Simulation = simulation
    CondDB().Upgrade = False

    dtt = DecayTreeTuple("Early2015")
    if turbo:
        tesla_prefix = "Hlt2DiMuonJPsi"
        dtt.Inputs = ["/Event/" + tesla_prefix + "/Particles"]
        dtt.InputPrimaryVertices = "/Event/" + tesla_prefix + "/Primary"
        dtt.WriteP2PVRelations = False

    else:
        LHCbApp().DDDBtag = "dddb-20140729"
        polarity = "u"
        LHCbApp().CondDBtag = "sim-20140730-vc-m%s100" % polarity
        muons = AutomaticData(Location="Phys/StdAllLooseMuons/Particles")

        jpsi = CombineParticles('MyJPsi')
        jpsi.DecayDescriptors = [decay_descriptor]
        jpsi.CombinationCut = "(AM < 7100.0 *GeV)"
        jpsi.DaughtersCuts = {"": "ALL", "mu+": "ALL", "mu-": "ALL"}
        jpsi.MotherCut = "(VFASPF(VCHI2/VDOF) < 999999.0)"

        code = """
('J/psi(1S)' == ID) &
in_range(2.990*GeV, M, 3.210*GeV) &
DECTREE('%s') &
CHILDCUT(1, HASMUON & ISMUON) &
CHILDCUT(2, HASMUON & ISMUON) &
(MINTREE('mu+' == ABSID, PT) > 700*MeV) &
(MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF) < 5) &
(MINTREE(ISBASIC & HASTRACK, CLONEDIST) > 5000) &
(VFASPF(VPCHI2) > 0.5/100) &
(abs(BPV(VZ)) <  0.5*meter) &
(BPV(vrho2) < (10*mm)**2)
""" % (decay_descriptor)
        # similar to the HLT2 line
        code = """
(ADMASS('J/psi(1S)')< 120*MeV) &
DECTREE('%s') &
(PT>0*MeV) &
(MAXTREE('mu-'==ABSID,TRCHI2DOF) < 4) &
(MINTREE('mu-'==ABSID,PT)> 0*MeV) &
(VFASPF(VCHI2PDOF)< 25)
""" % (decay_descriptor)
        filter_jpsi = FilterDesktop(
            "MyFilterJPsi",
            Code=code,
            Preambulo=["vrho2 = VX**2 + VY**2"],
            ReFitPVs=True,
            #IgnoreP2PVFromInputLocations=True,
            #WriteP2PVRelations=True
        )

        jpsi_sel = Selection("SelMyJPsi",
                             Algorithm=jpsi,
                             RequiredSelections=[muons])
        filter_jpsi_sel = Selection("SelFilterMyJPsi",
                                    Algorithm=filter_jpsi,
                                    RequiredSelections=[jpsi_sel])
        jpsi_seq = SelectionSequence("SeqMyJPsi", TopSelection=filter_jpsi_sel)
        dtt.Inputs = [jpsi_seq.outputLocation()]

    # Overwriting default list of TupleTools
    dtt.ToolList = [
        "TupleToolKinematic",
        "TupleToolPid",
        "TupleToolEventInfo",
        "TupleToolMCBackgroundInfo",
        "TupleToolMCTruth",
        #"MCTupleToolHierarchy",
        #"MCTupleToolPID",
        "TupleToolGeometry",
        "TupleToolTISTOS",
        # with turbo this crashes
        #"TupleToolTrackInfo",
        "TupleToolTrigger",
    ]
    tlist = [
        "L0HadronDecision",
        "L0MuonDecision",
        "L0DiMuonDecision",
        "L0ElectronDecision",
        "L0PhotonDecision",
        "Hlt1DiMuonHighMassDecision",
        "Hlt1DiMuonLowMassDecision",
        "Hlt1TrackMuonDecision",
        "Hlt1TrackAllL0Decision",
        "Hlt2DiMuonJPsiDecision",
        "Hlt2SingleMuonDecision",
    ]

    dtt.addTool(TupleToolTrigger, name="TupleToolTrigger")
    dtt.addTool(TupleToolTISTOS, name="TupleToolTISTOS")
    # Get trigger info
    dtt.TupleToolTrigger.Verbose = True
    dtt.TupleToolTrigger.TriggerList = tlist
    dtt.TupleToolTISTOS.Verbose = True
    dtt.TupleToolTISTOS.TriggerList = tlist

    from Configurables import TupleToolMCTruth, MCTupleToolHierarchy
    dtt.addTool(TupleToolMCBackgroundInfo, name="TupleToolMCBackgroundInfo")
    dtt.TupleToolMCBackgroundInfo.Verbose = True
    dtt.addTool(MCTupleToolHierarchy, name="MCTupleToolHierarchy")
    dtt.MCTupleToolHierarchy.Verbose = True
    dtt.addTool(TupleToolMCTruth, name="TupleToolMCTruth")
    dtt.TupleToolMCTruth.Verbose = True

    if turbo:
        assoc_seq = TeslaTruthUtils.associateSequence(tesla_prefix, False)
        ChargedPP2MC(tesla_prefix + "ProtoAssocPP").OutputLevel = 1

        assoc_seq.Members.insert(0, PatLHCbID2MCParticle())

        from Configurables import MuonCoord2MCParticleLink
        muon_coords = MuonCoord2MCParticleLink("TeslaMuonCoordLinker")
        assoc_seq.Members.insert(1, muon_coords)

        TrackAssociator("TeslaAssocTr").DecideUsingMuons = True

        relations = TeslaTruthUtils.getRelLoc(tesla_prefix)

    else:
        relations = "Relations/Rec/ProtoP/Charged"

    TeslaTruthUtils.makeTruth(dtt, relations, [
        "MCTupleToolKinematic",
        "MCTupleToolHierarchy",
        "MCTupleToolPID",
    ])

    dtt.Decay = mark(2, mark(3, decay_descriptor))  #"J/psi(1S) -> ^mu- ^mu+"

    dtt.addBranches({
        "X": "^(%s)" % (decay_descriptor),
        "muplus": mark(3, decay_descriptor),  #"J/psi(1S) -> mu- ^mu+",
        "muminus": mark(2, decay_descriptor),  #"J/psi(1S) -> ^mu- mu+",
    })

    x_preamble = [
        "DZ = VFASPF(VZ) - BPV(VZ)",
    ]
    x_vars = {
        "ETA": "ETA",
        "Y": "Y",
        "PHI": "PHI",
        "VPCHI2": "VFASPF(VPCHI2)",
        "DELTAZ": "DZ",
        # DZ * M / PZ / c with c in units of mm/s
        # XXX should this be the PDG mass or measured mass?
        #"TZ": "DZ*M / PZ / 299792458000.0", #seconds
        "TZ": "DZ*3096.916 / PZ/299792458000.0*(10**12)",  #ps
        "minpt": "MINTREE('mu+' == ABSID, PT)",
        "minclonedist": "MINTREE(ISBASIC & HASTRACK, CLONEDIST)",
        "maxtrchi2dof": "MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF)",
    }
    muon_vars = {
        "ETA": "ETA",
        "Y": "Y",
        "PHI": "PHI",
        "CHARGE": "Q",
        "CLONEDIST": "CLONEDIST",
        "TRCHI2DOF": "TRCHI2DOF",
    }

    loki_X = dtt.X.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_X")
    loki_X.Variables = x_vars
    loki_X.Preambulo = x_preamble

    loki_mup = dtt.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuPlus")
    loki_mup.Variables = muon_vars
    #dtt.muplus.addTupleTool("TupleToolGeometry")

    loki_mum = dtt.muminus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuMinus")
    loki_mum.Variables = muon_vars
    #dtt.muminus.addTupleTool("TupleToolGeometry")

    dv.TupleFile = "DVNtuples.root"
    if turbo:
        dv.UserAlgorithms = [assoc_seq, dtt]

    else:
        assocpp = ChargedPP2MC("TimsChargedPP2MC")
        assocpp.OutputLevel = 1
        dv.UserAlgorithms = [jpsi_seq.sequence(), assocpp, dtt]