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()
            })
Exemple #2
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()
            })