Exemplo n.º 1
0
    def add_mc_unbiased_sequence(self, decayDesc, arrow = '==>',
                                 toolList = ["TupleToolPropertime",
                                             "TupleToolKinematic",
                                             "TupleToolGeometry",
                                             "TupleToolEventInfo",
                                             "TupleToolPrimaries",
                                             "TupleToolPid",
                                             "TupleToolANNPID",
                                             "TupleToolTrackInfo",
                                             "TupleToolRecoStats",],
                                 mcToolList = ['TupleToolMCTruth',
                                               'TupleToolMCBackgroundInfo',
                                               'MCTupleToolPrompt'],
                                 L0List = [],
                                 HLT1List = [],
                                 HLT2List = [],
                                 strippingList = []) :
        decayDescCC = decayDesc.copy()
        decayDescCC.cc = True

        sel = build_mc_unbiased_selection(decayDesc, arrow)
        selseq = SelectionSequence(decayDesc.get_full_alias() + '_MCSeq',
                                   TopSelection = sel)
        seq = selseq.sequence()
        seq.Members.insert(0, CheckPV())
        dtt = DecayTreeTuple(decayDesc.get_full_alias() + '_MCTuple',
                             Decay = decayDesc.to_string(carets = True),
                             Inputs = [sel.outputLocation()], 
                             ToolList = [])
        dtt.addBranches(decayDesc.branches())
        headBranch = getattr(dtt, decayDesc.get_alias())

        dtt.configure_tools(toolList = toolList,
                            mcToolList = mcToolList,
                            L0List = L0List,
                            HLT1List = HLT1List,
                            HLT2List = HLT2List,
                            strippingList = strippingList,
                            headBranch = headBranch)

        lokituple = headBranch.addTupleTool('LoKi::Hybrid::TupleTool')
        lokituple.Preambulo = ['from LoKiPhysMC.decorators import *',
                               'from LoKiPhysMC.functions import mcMatch']
        mcmatch = 'switch(mcMatch({0!r}), 1, 0)'.format(decayDescCC.to_string(carets = False,
                                                                              arrow = '==>'))
        lokituple.Variables = {'mcMatch' : mcmatch}


        seq.Members.append(dtt)
        self.UserAlgorithms.append(seq)

        mcdtt = MCDecayTreeTuple(decayDesc.get_full_alias() + '_MCDecayTreeTuple')
        mcdtt.addBranches(decayDesc.branches())
        mcdtt.Decay = decayDescCC.to_string(arrow = arrow, carets = True)
        mcdtt.ToolList += filter(lambda t : t.startswith('MC'), mcToolList)
        self.UserAlgorithms.append(mcdtt)

        return seq
Exemplo n.º 2
0
    def add_mc_unbiased_sequence(self, decayDesc, arrow = '==>',
                                 toolList = ["TupleToolPropertime",
                                             "TupleToolKinematic",
                                             "TupleToolGeometry",
                                             "TupleToolEventInfo",
                                             "TupleToolPrimaries",
                                             "TupleToolPid",
                                             "TupleToolANNPID",
                                             "TupleToolTrackInfo",
                                             "TupleToolRecoStats",],
                                 mcToolList = ['TupleToolMCTruth',
                                               'TupleToolMCBackgroundInfo',
                                               'MCTupleToolPrompt'],
                                 L0List = [],
                                 HLT1List = [],
                                 HLT2List = [],
                                 strippingList = []) :
        sel = build_mc_unbiased_selection(decayDesc, arrow)
        selseq = SelectionSequence(decayDesc.get_full_alias() + '_MCSeq',
                                   TopSelection = sel)
        seq = selseq.sequence()
        seq.Members.insert(0, CheckPV())
        dtt = DecayTreeTuple(decayDesc.get_full_alias() + '_MCTuple',
                             Decay = decayDesc.to_string(carets = True),
                             Inputs = [sel.outputLocation()], 
                             ToolList = [])
        dtt.addBranches(decayDesc.branches())
        headBranch = getattr(dtt, decayDesc.get_alias())

        dtt.configure_tools(toolList = toolList,
                            mcToolList = mcToolList,
                            L0List = L0List,
                            HLT1List = HLT1List,
                            HLT2List = HLT2List,
                            strippingList = strippingList,
                            headBranch = headBranch)

        lokituple = headBranch.addTupleTool('LoKi::Hybrid::TupleTool')
        lokituple.Preambulo = ['from LoKiPhysMC.decorators import *',
                               'from LoKiPhysMC.functions import mcMatch']
        mcmatch = 'switch(mcMatch({0!r}), 1, 0)'.format(decayDesc.to_string(carets = False,
                                                                            arrow = '==>'))
        lokituple.Variables = {'mcMatch' : mcmatch}


        seq.Members.append(dtt)
        self.UserAlgorithms.append(seq)

        mcdtt = MCDecayTreeTuple(decayDesc.get_full_alias() + '_MCDecayTreeTuple')
        mcdtt.Decay = decayDesc.to_string(arrow = arrow, carets = True)
        self.UserAlgorithms.append(mcdtt)

        return seq
Exemplo n.º 3
0
def addMCTuple(name, decayDescriptor):
    '''
    Given name and decay descriptor, add MCTuple to the main DaVinci Sequence
    '''
     # MC    
    mcTuple = MCDecayTreeTuple('MCTuple'+name) # I can put as an argument a name if I use more than a MCDecayTreeTuple
    mcTuple.Decay = decayDescriptor #'[phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)]CC'
    mcTuple.ToolList = ['MCTupleToolKinematic',
                        'TupleToolEventInfo',
                        'MCTupleToolHierarchy',
                        "TupleToolMCBackgroundInfo",
                      ]
    DaVinci().UserAlgorithms += [mcTuple]
Exemplo n.º 4
0
def mc_decay_tree_tuple(name, decay, mothers, daughters):
    """Return a configured MCDecayTreeTuple instance.

    A MCDecayTreeTuple is configured with the given decay descriptor.
    The mothers dictionary is used to give exclusive tools to vertices, and it
    should be, as daughters, a dictionary of tuple branch names to branch
    descriptors.
    A typical method call might look like
        mc_decay_tree_tuple(
            'MCTupleDstToD0pi_D0ToKpi',
            '[D*(2010) => ^(D0 => ^K- ^pi+) ^pi+]CC',
            {
                'Dst': '[D*(2010) => (D0 => K- pi+) pi+]CC',
                'D0': '[D*(2010) => ^(D0 => K- pi+) pi+]CC'
            },
            {
                'D0_K': '[D*(2010) => (D0 => ^K- pi+) pi+]CC',
                'D0_pi': '[D*(2010) => (D0 => K- ^pi+) pi+]CC',
                'Dst_pi': '[D*(2010) => (D0 => K- pi+) ^pi+]CC'
            }
        )
    Keyword arguments:
    name -- TDirectory the DecayTreeTuple TTree will be saved in
    decay -- Decay descriptor
    mothers -- Branch descriptors to be added to the tuple as mothers;
               decaying particles
    daughters -- Branch descriptors to be added to the tuple as daughters;
                 final state particles
    """
    t = MCDecayTreeTuple(name)
    t.Decay = decay
    t.addBranches(dict(mothers.items() + daughters.items()))
    t.ToolList = [
        'MCTupleToolPID', 'MCTupleToolKinematic', 'MCTupleToolReconstructed',
        'MCTupleToolHierarchy', 'TupleToolPrimaries'
    ]
    # Verbose reconstruction information
    t.addTupleTool('TupleToolRecoStats').Verbose = True
    # Add MCTupleToolPrompt to all mothers
    for mother in mothers:
        branch = getattr(t, mother)
        # Does the particle ancestry contain a particle with a lifetime
        # above 1e-7 ns? Record the secondaries info if so
        branch.addTupleTool('MCTupleToolPrompt')
    return t
Exemplo n.º 5
0
## @file DVTrueKs.py
#
#  See DecayTreeTuple documentation
#
#  @author P. Koppenburg
#  @date 2009-01-22
#
########################################################################
#
# The MC truth Tuple
#
from Configurables import MCDecayTreeTuple
mcTuple = MCDecayTreeTuple("MCTuple")
mcTuple.Decay = "[KS0 -> ^pi+ ^pi- {, gamma}{, gamma}]cc"
mcTuple.ToolList = [
    "MCTupleToolKinematic", "TupleToolEventInfo", "MCTupleToolReconstructed",
    "MCTupleToolAngles"
]
#mcTuple.OutputLevel = 1
########################################################################
#
# The reconstructed tuple
#
from Configurables import DecayTreeTuple
tuple = DecayTreeTuple("Tuple")
tuple.ToolList += [
    "TupleToolMCTruth", "TupleToolMCBackgroundInfo", "TupleToolAngles",
    "TupleToolPrimaries", "TupleToolGeometry", "TupleToolKinematic",
    "TupleToolEventInfo", "TupleToolTrackInfo"
]
tuple.InputLocations = ["StdLooseKsLL", "StdLooseKsDD"]
Exemplo n.º 6
0
#
from Configurables import EventTuple, TupleToolTrigger

evtTuple = EventTuple()
evtTuple.ToolList = ["TupleToolEventInfo", "TupleToolGeneration"]
evtTuple.addTool(TupleToolTrigger())
evtTuple.TupleToolTrigger.VerboseHlt1 = True
evtTuple.TupleToolTrigger.VerboseHlt2 = True
# evtTuple.OutputLevel = 1
########################################################################
#
# The MC truth Tuple
#
from Configurables import MCDecayTreeTuple

mcTuple = MCDecayTreeTuple("MCTuple")
mcTuple.Decay = "( [ [B0]nos => ^( J/psi(1S) => ^mu+ ^mu- ) ^( KS0 => ^pi+ ^pi- ) ]CC ) || ( [ [B0]os -> ^( J/psi(1S) => ^mu+ ^mu- ) ^( KS0 => ^pi+ ^pi- ) ]CC )"
mcTuple.ToolList = [
    "MCTupleToolKinematic", "TupleToolEventInfo", "MCTupleToolReconstructed"
]
from Configurables import MCTupleToolReconstructed, MCReconstructed
#ToolSvc().addTool(MCReconstructed)
#ToolSvc().MCReconstructed.OutputLevel = 1

#mcTuple.OutputLevel = 1

from Configurables import PrintMCTree

pmc = PrintMCTree()
pmc.ParticleNames = ["B0", "B~0"]
########################################################################
        'atan2(PY,PX)',
        'RAPIDITY':
        '0.5 * log( (sqrt(P*P+M*M)+PZ)/(sqrt(P*P+M*M)-PZ) )',
        'TIP':
        '1e3 * (PX * (VFASPF(VY)-BPV(VY)) - PY * (VFASPF(VX)-BPV(VX))) / sqrt(PX*PX + PY*PY)'
    }

    # refit PVs with exclusion of our tracks of interest
    tup.ReFitPVs = True

    # add ntuple to the list of running algorithms
    DaVinci().UserAlgorithms += [tup]

# MCParticle ntuple
from Configurables import MCDecayTreeTuple
mctuple = MCDecayTreeTuple('mctuple_Lc2pKpi')
mctuple.Decay = '[Lambda_c+ => ^p+ ^K- ^pi+]CC'
mctuple.Branches = {
    'lcplus': '[Lambda_c+ => p+ K- pi+]CC',
    'pplus': '[Lambda_c+ => ^p+ K- pi+]CC',
    'kminus': '[Lambda_c+ => p+ ^K- pi+]CC',
    'piplus': '[Lambda_c+ => p+ K- ^pi+]CC'
}
#mctuple.ToolList = ["MCTupleToolKinematic"]
DaVinci().UserAlgorithms += [mctuple]

# Filter events for faster processing
#from PhysConf.Filters import LoKi_Filters
#if (restripversion == "" and Turbo == False) :
#  fltrs = LoKi_Filters (
#      STRIP_Code = "HLT_PASS_RE('Stripping{0}Decision')".format(lines[0]) # note: only for one line!
Exemplo n.º 8
0
# We want to save all of the generated events for each mode.
#########################################################################################################
from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, MCTupleToolHierarchy, LoKi__Hybrid__MCTupleTool

# LoKi variables
LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos")
LoKi_Photos.Variables = {
    "nPhotons": "MCNINTREE ( ('gamma'==MCABSID) )",
    "MC_PT": "MCPT",
    "MC_THETA": "MCTHETA",
    "MC_ETA": "MCETA",
    "MC_PHI": "MCPHI",
    "MC_ABSID": "MCABSID"
}

mctuple_B2Kmumu = MCDecayTreeTuple('MCTuple_B2Kmumu')
mctuple_B2Kmumu.Decay = "[ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+ ^mu- ...) ^K+ ... ]CC"
mctuple_B2Kmumu.Branches = {
    'B':
    "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  K+  ... ]CC",
    'Kplus':
    "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...) ^K+  ... ]CC",
    'psi':
    "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  K+  ... ]CC",
    'muplus':
    "[ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+  mu- ...)  K+  ... ]CC",
    'muminus':
    "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+ ^mu- ...)  K+  ... ]CC",
}

# List of the mc tuples
Exemplo n.º 9
0
        MCTupleToolReconstructed,
        MCTupleToolAngles,
        TupleToolMCBackgroundInfo,
    )

    tuple.addTupleTool("TupleToolMCTruth/MCTruth")
    tuple.MCTruth.ToolList = [
        "MCTupleToolKinematic",
        "MCTupleToolHierarchy",
        "MCTupleToolReconstructed",
        "MCTupleToolAngles",
    ]
    tuple.JPsi.addTupleTool("TupleToolMCBackgroundInfo")

    mcTuple = MCDecayTreeTuple(
        "MCTupleJPsi2KsKs"
    )  # I can put as an argument a name if I use more than a MCDecayTreeTuple
    mcTuple.Decay = "[J/psi(1S) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)]CC"
    mcTuple.Branches = {
        "JPsi": "[J/psi(1S) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)]CC",
        "Ks1": "[J/psi(1S) -> ^(KS0 -> pi+ pi-) (KS0 -> pi+ pi-)]CC",
        "Ks2": "[J/psi(1S) -> (KS0 -> pi+ pi-) ^(KS0 -> pi+ pi-)]CC",
        "pi1": "[J/psi(1S) -> (KS0 -> ^pi+ pi-) (KS0 -> pi+ pi-)]CC",
        "pi2": "[J/psi(1S) -> (KS0 -> pi+ ^pi-) (KS0 -> pi+ pi-)]CC",
        "pi3": "[J/psi(1S) -> (KS0 -> pi+ pi-) (KS0 -> ^pi+ pi-)]CC",
        "pi4": "[J/psi(1S) -> (KS0 -> pi+ pi-) (KS0 -> pi+ ^pi-)]CC",
    }

    mcTuple.addBranches(mcTuple.Branches)
    mcTuple.ToolList = [
        "MCTupleToolKinematic",
Exemplo n.º 10
0
tuple.Kaon.ToolList += ["TupleToolL0Calo/KaonL0Calo"]
tuple.Kaon.KaonL0Calo.WhichCalo="HCAL"

tuple.piplus.addTool(TupleToolL0Calo,name="piplusL0Calo")
tuple.piplus.ToolList += ["TupleToolL0Calo/piplusL0Calo"]
tuple.piplus.piplusL0Calo.WhichCalo="HCAL"

tuple.piminus.addTool(TupleToolL0Calo,name="piminusL0Calo")
tuple.piminus.ToolList += ["TupleToolL0Calo/piminusL0Calo"]
tuple.piminus.piminusL0Calo.WhichCalo="HCAL"

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]

from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[[B+]cc -> ^K+ ^(eta_prime -> ^(rho(770)0 -> ^pi+ ^pi-) ^gamma)]CC"



Gseq=GaudiSequencer('MyTupleSeq')
Gseq.Members += [BuKFilteredSel_Seq.sequence()]
Gseq.Members.append(etuple)
Gseq.Members += [tuple]
Gseq.Members.append(mctuple)
#DaVinci().EventPreFilters = fltrs.filters ('Filters')
DaVinci().InputType='DST'
#DaVinci().appendToMainSequence([Gseq])
DaVinci().UserAlgorithms+=[Gseq]
#tuple.Decay = "[D*(2010)+ -> ^(K*(892)0 -> ^K+ ^pi-) ^pi+]CC"

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

from TeslaTools import TeslaTruthUtils
seq = TeslaTruthUtils.associateSequence("Tesla",False)
relations = TeslaTruthUtils.getRelLoc("Tesla")
TeslaTruthUtils.makeTruth(tuple, relations, [ "MCTupleToolKinematic" , "MCTupleToolHierarchy" , "MCTupleToolPID" ])

tuple2 = MCDecayTreeTuple("MCTeslaTuple")
tuple2.Inputs = ['/Event/Tesla/Particles']
tuple2.Decay = tuple.Decay

from Configurables import DataOnDemandSvc, L0SelReportsMaker, L0DecReportsMaker
DataOnDemandSvc().AlgMap["HltLikeL0/DecReports"] = L0DecReportsMaker()
DataOnDemandSvc().AlgMap["HltLikeL0/SelReports"] = L0SelReportsMaker()
from Configurables import L0Conf
L0Conf().FullL0MuonDecoding = True
L0Conf().EnableL0DecodingOnDemand = True
L0Conf().EnsureKnownTCK=False

tuple3 = DecayTreeTuple("StrippingTuple")
tuple3.Inputs = ['/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles']
tuple3.Decay = tuple.Decay
tuple3.ToolList = tuple.ToolList
                    "Hlt2Topo3BodyBBDTDecision",
                    "Hlt2Topo4BodyBBDTDecision",
                    "Hlt2RadiativeTopoTrackTOSDecision",
                    "Hlt2RadiativeTopoPhotonL0Decision",
                    "Hlt2TopoRad2BodyBBDTDecision",
                    "Hlt2TopoRad2plus1BodyBBDTDecision",
                    "Hlt2Topo2BodySimpleDecision",
                    "Hlt2Topo3BodySimpleDecision",
                    "Hlt2Topo4BodySimpleDecision"]

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]


from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[Lambda_b0 -> ^(p+) ^(K-) ^(eta_prime -> ^pi- ^pi+ ^gamma)]CC"

MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2012'
DaVinci().EvtMax=-1
DaVinci().PrintFreq=1000
Exemplo n.º 13
0
                       'Phi' : '[ D+ => ( ^(phi(1020) => K+ K- ) ) pi+  ]CC',
                       'KPlus' : '[ D+ => ( (phi(1020) => ^K+ K- ) ) pi+  ]CC',
                       'KMinus' : '[ D+ => ( (phi(1020) => K+ ^K- ) ) pi+  ]CC',
                       'X' : '[ D+ => ( (phi(1020) => K+ K- ) ) ^pi+  ]CC'}
        numbers_phi_X = [2,1]
    else:
        MC_DecayDescriptor = '[ Xc => ( ^(phi(1020) => ^K+ ^K- ) ) ^X+ ^X0]CC'
        MC_branches = {'Head' : '[ Xc => ( (phi(1020) => K+ K- ) ) X+ X0]CC',
                       'Phi' : '[ Xc => ( ^(phi(1020) => K+ K- ) ) X+ X0]CC',
                       'KPlus' : '[ Xc => ( (phi(1020) => ^K+ K- ) ) X+ X0]CC',
                       'KMinus' : '[ Xc => ( (phi(1020) => K+ ^K- ) ) X+ X0]CC',
                       'X' : '[ Xc => ( (phi(1020) => K+ K- ) ) ^X+ X0]CC',
                       'X0' : '[ Xc => ( (phi(1020) => K+ K- ) ) X+ ^X0]CC'}
        numbers_phi_X = [2,1]
        
    mcTuple = MCDecayTreeTuple() # I can put as an argument a name if I use more than a MCDecayTreeTuple
    mcTuple.Decay = MC_DecayDescriptor
    mcTuple.ToolList = ['MCTupleToolKinematic',
                        'TupleToolEventInfo',
                        'MCTupleToolHierarchy',
                      ]

    mcTuple.addTupleTool("LoKi::Hybrid::MCTupleTool/LoKi_All")
    mcTuple.LoKi_All.Variables =  {
        'TRUEID' : 'MCID'
        }
    
    mcTuple.addBranches(MC_branches)

    mcTuple.Head.addTupleTool("LoKi::Hybrid::MCTupleTool/LoKi_Head")
    mcTuple.Head.LoKi_Head.Preambulo = [
tuple.piplus.ToolList += ["TupleToolL0Calo/piplusL0Calo"]
tuple.piplus.piplusL0Calo.WhichCalo="HCAL"

tuple.piminus.addTool(TupleToolL0Calo,name="piminusL0Calo")
tuple.piminus.ToolList += ["TupleToolL0Calo/piminusL0Calo"]
tuple.piminus.piminusL0Calo.WhichCalo="HCAL"

tuple.Proton.addTool(TupleToolL0Calo,name="ProtonL0Calo")
tuple.Proton.ToolList += ["TupleToolL0Calo/ProtonL0Calo"]
tuple.Proton.ProtonL0Calo.WhichCalo="HCAL"

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]

from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[Lambda_b0 -> ^p+ ^K- ^(eta_prime -> ^pi+ ^pi- ^gamma)]CC"


MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2011'
DaVinci().EvtMax=-1
Exemplo n.º 15
0
# decay = "[B0 => ^(Lambda_c~- ==> ^p~- ^K+ ^pi-) ^p+ ^pi- ^pi+]CC"
# decay = "[[B_s0]os => ^(J/psi(1S) ==> ^mu+ ^mu-) ^(phi(1020) ==> ^K+ ^K-)]CC"
decay = "[B_s0 => ^(J/psi(1S) ==> ^mu+ ^mu-) ^(phi(1020) ==> ^K+ ^K-)]CC"
decay_heads = ["B_s0", "B_s~0"]

dir = "/Disk/speyside8/lhcb/gcowan1/generation/Bs2JpsiPhi/"
datafiles = glob.glob(dir + "/*1000ev*xgen")
# datafiles = [datafiles[-1]]
print datafiles
year = 2012

# For a quick and dirty check, you don't need to edit anything below here.
##########################################################################

# Create an MC DTT containing any candidates matching the decay descriptor
mctuple = MCDecayTreeTuple("MCDecayTreeTuple")
mctuple.Decay = decay
mctuple.ToolList = ["MCTupleToolHierarchy", "LoKi::Hybrid::MCTupleTool/LoKi_Photos"]
# Add a 'number of photons' branch
# mctuple.addTupleTool("MCTupleToolReconstructed").Associate = False
# mctuple.MCTupleToolReconstructed.FillPID = False
mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True
mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = {"nPhotos": "MCNINTREE(('gamma' == MCABSID))"}
mctuple.addTupleTool("MCTupleToolP2VV").Calculator = "MCBs2JpsiPhiAngleCalculator"

# Print the decay tree for any particle in decay_heads
printMC = PrintMCTree()
printMC.ParticleNames = decay_heads

# Name of the .xgen file produced by Gauss
EventSelector().Input = ["DATAFILE='{0}' TYP='POOL_ROOTTREE' Opt='READ'".format(datafile) for datafile in datafiles]
Exemplo n.º 16
0
                    "Hlt2Topo3BodyBBDTDecision",
                    "Hlt2Topo4BodyBBDTDecision",
                    "Hlt2RadiativeTopoTrackTOSDecision",
                    "Hlt2RadiativeTopoPhotonL0Decision",
                    "Hlt2TopoRad2BodyBBDTDecision",
                    "Hlt2TopoRad2plus1BodyBBDTDecision",
                    "Hlt2Topo2BodySimpleDecision",
                    "Hlt2Topo3BodySimpleDecision",
                    "Hlt2Topo4BodySimpleDecision"]

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]


from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[B0 -> ^(K*(892)0 -> ^K+ ^pi-) ^(eta_prime -> ^pi- ^pi+ ^(eta -> ^gamma ^gamma))]CC"

MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2011'
DaVinci().EvtMax=-1
DaVinci().PrintFreq=1000
Exemplo n.º 17
0
from os import environ
from GaudiKernel.SystemOfUnits import *
from Gaudi.Configuration import *
from Configurables import GaudiSequencer, CombineParticles
from Configurables import DecayTreeTuple, EventTuple, TupleToolTrigger, TupleToolTISTOS,FilterDesktop, MCDecayTreeTuple,PrintMCTree
from Configurables import BackgroundCategory, TupleToolDecay, TupleToolVtxIsoln,TupleToolPid,EventCountHisto,TupleToolRecoStats
from Configurables import LoKi__Hybrid__TupleTool, TupleToolVeto
# Unit
SeqPhys = GaudiSequencer("SeqPhys")

mct = MCDecayTreeTuple('mct')
mct.Decay = "[beauty => K- pi+ ^(pi0 -> ^gamma ^gamma)]CC"
#mct.Branches = { }
#mct = MCDecayTreeTuple('mct')
#mct.Decay = "[Lambda_c+ => ^p+ ^K- ^pi+]CC"
#mct.Branches = {
#        "Lc" :"[Lambda_c+ => p+ K- pi+ ]CC" ,
#        "Lcp":"[Lambda_c+ => ^p+ K- pi+]CC" ,
#        "LcK":"[Lambda_c+ => p+ ^K- pi+]CC" ,
#        "LcH":"[Lambda_c+ => p+ K- ^pi+]CC" ,
#        }
#mct = MCDecayTreeTuple('mct')
#mct.Decay = "[D0 => ^K- ^pi+]CC"
#mct.Branches = {
#        "Lc" :"[D0 => K- pi+]CC" ,
#        "LcK":"[D0 => ^K- pi+]CC" ,
#        "LcH":"[D0 => K- ^pi+]CC" ,
#        }
def doIt():
    """
    specific post-config action for (x)GEN-files 
Exemplo n.º 18
0
#########################################################################################################
from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, MCTupleToolHierarchy, LoKi__Hybrid__MCTupleTool

# LoKi variables
LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos")
LoKi_Photos.Variables = {
    "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )",
    "MC_PT"    : "MCPT",
    "MC_THETA" : "MCTHETA",
    "MC_ETA"   : "MCETA",
    "MC_PHI"   : "MCPHI",
    "MC_ABSID" : "MCABSID"
	}

# mctuple_B2Kmumu = MCDecayTreeTuple( 'MCTuple_B2Kmumu' )
mctuple_B2psiomega = MCDecayTreeTuple( 'MCTuple_B2psiomega' )
mctuple_B2psiomega.Decay = "[ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+ ^mu- ...) ^(omega(782) -> ^pi+ ^pi- ^pi0 ) ]CC"
mctuple_B2psiomega.Branches = {
        'B'       : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  pi0 ) ]CC",
        'Jpsi'    : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  pi0 ) ]CC",
        'omega'   : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...) ^(omega(782) ->  pi+  pi-  pi0 ) ]CC",
        'muplus'  : "[ (Beauty & LongLived) -->  (J/psi(1S) -> ^mu+  mu- ...)  (omega(782) ->  pi+  pi-  pi0 ) ]CC",
        'muminus' : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+ ^mu- ...)  (omega(782) ->  pi+  pi-  pi0 ) ]CC",
        'piplus'  : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) -> ^pi+  pi-  pi0 ) ]CC",
        'piminus' : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+ ^pi-  pi0 ) ]CC",
        'pizero'  : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi- ^pi0 ) ]CC",
		}
        # 'B'       : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  K+  ... ]CC",
        # 'Kplus'   : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...) ^K+  ... ]CC",
        # 'psi'     : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  K+  ... ]CC",
        # 'muplus'  : "[ (Beauty & LongLived) -->  (J/psi(1S) -> ^mu+  mu- ...)  K+  ... ]CC",
#    "MCTupleToolDecayType",
 #   "MCTupleToolReconstructed",
  #  "MCTupleToolPID",
   # "MCTupleToolP2VV",
#    "MCTupleToolAngles",
#    "MCTupleToolInteractions",
 #   "MCTupleToolPrimaries",
  #  "MCTupleToolPrompt"
    ]

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]


from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[[B0]cc => ^(K*(892)0 => ^K+ ^pi-) ^(eta => ^pi- ^pi+ ^(pi0=> ^gamma ^gamma))]CC"

MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2012'
DaVinci().EvtMax=-1
DaVinci().PrintFreq=1000
Exemplo n.º 20
0
                    "Hlt2Topo3BodyBBDTDecision",
                    "Hlt2Topo4BodyBBDTDecision",
                    "Hlt2RadiativeTopoTrackTOSDecision",
                    "Hlt2RadiativeTopoPhotonL0Decision",
                    "Hlt2TopoRad2BodyBBDTDecision",
                    "Hlt2TopoRad2plus1BodyBBDTDecision",
                    "Hlt2Topo2BodySimpleDecision",
                    "Hlt2Topo3BodySimpleDecision",
                    "Hlt2Topo4BodySimpleDecision"]

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]


from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[B0 -> ^(K*(892)0 -> ^K+ ^pi-) ^(eta_prime -> ^rho(770)0 ^gamma)]CC"

MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2012'
DaVinci().EvtMax=1000
DaVinci().PrintFreq=1000
Exemplo n.º 21
0
#########################################################################################################
from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, MCTupleToolHierarchy, LoKi__Hybrid__MCTupleTool

# LoKi variables
LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos")
LoKi_Photos.Variables = {
    "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )",
    "MC_PT"    : "MCPT",
    "MC_THETA" : "MCTHETA",
    "MC_ETA"   : "MCETA",
    "MC_PHI"   : "MCPHI",
    "MC_ABSID" : "MCABSID"
	}

# mctuple_B2Kmumu = MCDecayTreeTuple( 'MCTuple_B2Kmumu' )
mctuple_B2psiomega = MCDecayTreeTuple( 'MCTuple_B2psiomega' )
# mctuple_B2psiomega.Decay = "[ [ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+ ^mu- ...) ^(omega(782) -> ^pi+ ^pi- ^(pi0 -> ^gamma ^gamma) ) ]CC"
mctuple_B2psiomega.Decay = "[ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+ ^mu- ...) ^(omega(782) -> ^pi+ ^pi- ^pi0 ) ]CC"
mctuple_B2psiomega.Branches = {
        # 'B'       : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'Jpsi'    : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'muplus'  : "[ (Beauty & LongLived) -->  (J/psi(1S) -> ^mu+  mu- ...)  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'muminus' : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+ ^mu- ...)  (omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'omega'   : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...) ^(omega(782) ->  pi+  pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'piplus'  : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) -> ^pi+  pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'piminus' : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+ ^pi-  (pi0 ->  gamma  gamma ) ) ]CC",
        # 'pizero'  : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi- ^(pi0 ->  gamma  gamma ) ) ]CC",
        # 'gamma1'  : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  (pi0 -> ^gamma  gamma ) ) ]CC",
        # 'gamma2'  : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  (pi0 ->  gamma ^gamma ) ) ]CC",
        #
        'B'       : "[ (Beauty & LongLived) -->  (J/psi(1S) ->  mu+  mu- ...)  (omega(782) ->  pi+  pi-  pi0 ) ]CC",
Exemplo n.º 22
0
################
#Change this to the information in the relevant DecFile
#EventType = '23103020'
EventType = '23113020'
DecayDescriptor = '[(D_s+ -> ^mu+ ^mu- ^pi+)]CC'
DecayHeader = 'D_s+'

################
import sys, os
from DaVinci.Configuration import *
from Gaudi.Configuration import *

from Configurables import DaVinci, PrintMCTree
from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, MCTupleToolHierarchy, LoKi__Hybrid__MCTupleTool

mctuple = MCDecayTreeTuple( 'MCDecayTreeTuple' )
mctuple.Decay = DecayDescriptor
mctuple.ToolList = [ "MCTupleToolHierarchy"
                                          , "MCTupleToolKinematic"
                                          , "LoKi::Hybrid::MCTupleTool/LoKi_Photos"
                                          ]

mctuple.addTool(MCTupleToolKinematic())
mctuple.MCTupleToolKinematic.Verbose=True

# LoKi variables
LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos")
LoKi_Photos.Variables = {
    "nPhotos"  : "MCNINTREE ( ('gamma'==MCABSID) )"
        }
mctuple.addTool(LoKi_Photos)
Exemplo n.º 23
0
from DecayTreeTuple.Configuration import *
year = 2012
decay = "[KS0 ==> ^pi+ ^pi- ^e+ ^e-]CC"

import sys
# HOME = "/afs/cern.ch/work/j/jcidvida/tmp/xgen_emu/"
# #if len(sys.argv)==1: datafile = HOME+"proba_40112030_mA_2_tA_0.gen"
# if len(sys.argv)==1: datafile = "/tmp/jcidvida/proba.gen"
# else: datafile = HOME+filter(lambda x: sys.argv[1] in x,os.listdir(HOME))[0]

# For a quick and dirty check, you don't need to edit anything below here.
##########################################################################

# Create an MC DTT containing any candidates matching the decay descriptor
mctuple = MCDecayTreeTuple("MCDecayTreeTuple")
mctuple.Decay = decay
mctuple.addBranches({
    "KSO": "[KS0 ==> pi+ pi-  e+ e-]CC",
    "e+": "[KS0 ==> pi+ pi-  ^e+ e-]CC",
    "e-": "[KS0 ==> pi+ pi-  e+ ^e-]CC",
    "pi+": "[KS0 ==> ^pi+ pi-  e+ e-]CC",
    "pi-": "[KS0 ==> pi+ ^pi-  e+ e-]CC"
})

mctuple.ToolList = [
    "MCTupleToolHierarchy", "LoKi::Hybrid::MCTupleTool/LoKi_Photos"
]
# Add a 'number of photons' branch
mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True
mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = {
tuple.addTool(TupleToolTrigger, name="TupleToolTrigger")
tuple.addTool(TupleToolTISTOS, name="TupleToolTISTOS")
# Get trigger info
tuple.TupleToolTrigger.Verbose = True
tuple.TupleToolTrigger.TriggerList = tlist
tuple.TupleToolTISTOS.Verbose = True
tuple.TupleToolTISTOS.TriggerList = tlist

from TeslaTools import TeslaTruthUtils
seq = TeslaTruthUtils.associateSequence("Tesla", False)
relations = TeslaTruthUtils.getRelLoc("Tesla")
TeslaTruthUtils.makeTruth(
    tuple, relations,
    ["MCTupleToolKinematic", "MCTupleToolHierarchy", "MCTupleToolPID"])

tuple2 = MCDecayTreeTuple("MCTeslaTuple")
tuple2.Inputs = ['/Event/Tesla/Particles']
tuple2.Decay = tuple.Decay

from Configurables import DataOnDemandSvc, L0SelReportsMaker, L0DecReportsMaker
DataOnDemandSvc().AlgMap["HltLikeL0/DecReports"] = L0DecReportsMaker()
DataOnDemandSvc().AlgMap["HltLikeL0/SelReports"] = L0SelReportsMaker()
from Configurables import L0Conf
L0Conf().FullL0MuonDecoding = True
L0Conf().EnableL0DecodingOnDemand = True
L0Conf().EnsureKnownTCK = False

tuple3 = DecayTreeTuple("StrippingTuple")
tuple3.Inputs = [
    '/Event/AllStreams/Phys/FullDSTDiMuonJpsi2MuMuDetachedLine/Particles'
]
Exemplo n.º 25
0
from Configurables import GaudiSequencer, CombineParticles
from Configurables import DecayTreeTuple, EventTuple, TupleToolTrigger, TupleToolTISTOS,FilterDesktop, MCDecayTreeTuple,PrintMCTree
from Configurables import BackgroundCategory, TupleToolDecay, TupleToolVtxIsoln,TupleToolPid,EventCountHisto,TupleToolRecoStats
from Configurables import LoKi__Hybrid__TupleTool, TupleToolVeto
# Unit
SeqPhys = GaudiSequencer("SeqPhys")

#mct = MCDecayTreeTuple('mct')
#mct.Decay = "gamma"
#mct.Decay = "[Beauty -> ^K*(892)0 ^gamma]CC"
#mct.Branches = {
#        "gamma" :"[Beauty -> K*(892)0 ^gamma]CC" ,
#        "Beauty" :"[Beauty -> K*(892)0 gamma]CC" ,
#        "Kst" :"[Beauty -> ^K*(892)0 gamma]CC" ,
#	}
mct = MCDecayTreeTuple('mct')
# B0 -> K+pi-pi0
#mct.Decay = "[Beauty -> ^K+ ^pi- ^(pi0 -> ^gamma ^gamma)]CC"
#mct.Branches = {
#        "gamma1" :"[Beauty -> K+ pi- (pi0 -> gamma ^gamma)]CC" ,
#        "gamma2" :"[Beauty -> K+ pi- (pi0 -> ^gamma gamma)]CC" ,
#        "B" :"[Beauty -> K+ pi- (pi0 -> gamma gamma)]CC" ,
#        "K" :"[Beauty -> ^K+ pi- (pi0 -> gamma gamma)]CC" ,
#        "Pi" :"[Beauty -> K+ ^pi- (pi0 -> gamma gamma)]CC" ,
#	}
# B+ -> K+pi0
mct.Decay = "[Beauty -> ^K+ ^(pi0 -> ^gamma ^gamma)]CC"
mct.Branches = {
        "gamma1" :"[Beauty -> K+ (pi0 -> gamma ^gamma)]CC" ,
        "gamma2" :"[Beauty -> K+ (pi0 -> ^gamma gamma)]CC" ,
        "B" :"[Beauty -> K+ (pi0 -> gamma gamma)]CC" ,
Exemplo n.º 26
0
from os import environ
from GaudiKernel.SystemOfUnits import *
from Gaudi.Configuration import *
from Configurables import GaudiSequencer, CombineParticles
from Configurables import DecayTreeTuple, EventTuple, TupleToolTrigger, TupleToolTISTOS,FilterDesktop, MCDecayTreeTuple,PrintMCTree
from Configurables import BackgroundCategory, TupleToolDecay, TupleToolVtxIsoln,TupleToolPid,EventCountHisto,TupleToolRecoStats
from Configurables import LoKi__Hybrid__TupleTool, TupleToolVeto
# Unit
SeqPhys = GaudiSequencer("SeqPhys")

mct = MCDecayTreeTuple('mct')
mct.Decay = "gamma"
mct.Branches = {
        "gamma" :"gamma" ,
	}
mctB = MCDecayTreeTuple('mctB')
mctB.Decay = "[B0]CC"
mctB.Branches = {
        "B0" :"[B0]CC" ,
        }
#mct = MCDecayTreeTuple('mct')
#mct.Decay = "[Lambda_c+ => ^p+ ^K- ^pi+]CC"
#mct.Branches = {
#        "Lc" :"[Lambda_c+ => p+ K- pi+ ]CC" ,
#        "Lcp":"[Lambda_c+ => ^p+ K- pi+]CC" ,
#        "LcK":"[Lambda_c+ => p+ ^K- pi+]CC" ,
#        "LcH":"[Lambda_c+ => p+ K- ^pi+]CC" ,
#        }
#mct = MCDecayTreeTuple('mct')
#mct.Decay = "[D0 => ^K- ^pi+]CC"
#mct.Branches = {
tuple.piplus.ToolList += ["TupleToolL0Calo/piplusL0Calo"]
tuple.piplus.piplusL0Calo.WhichCalo="HCAL"

tuple.piminus.addTool(TupleToolL0Calo,name="piminusL0Calo")
tuple.piminus.ToolList += ["TupleToolL0Calo/piminusL0Calo"]
tuple.piminus.piminusL0Calo.WhichCalo="HCAL"

tuple.Proton.addTool(TupleToolL0Calo,name="ProtonL0Calo")
tuple.Proton.ToolList += ["TupleToolL0Calo/ProtonL0Calo"]
tuple.Proton.ProtonL0Calo.WhichCalo="HCAL"

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]

from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[Lambda_b0 ==>  ^K- ^(eta_prime =>  ^(rho(770)0 => ^pi+ ^pi-) ^gamma) ^p+ ]CC"

MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2011'
DaVinci().EvtMax=-1
DaVinci().PrintFreq=1000
Exemplo n.º 28
0
from Configurables import ( DaVinci
#                          , EventSelector # Uncomment when running locally
                          , MCDecayTreeTuple
                          , LHCbApp
                          )
from DecayTreeTuple.Configuration import *
LHCbApp().XMLSummary='summary.xml'

# Create an MC DTT containing any candidates matching the decay descriptor
mctuple = MCDecayTreeTuple()
mctuple.Decay = "[B_s0 => ^(phi(1020) ==> ^K+ ^K-) ^(phi(1020) ==> ^K+ ^K-)]CC"
mctuple.addBranches({
   "KK" : " [B_s0 => (phi(1020) ==> K+ K-) ^(phi(1020) ==> K+ K-)]CC "
})
mctuple.ToolList = []
mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True


# Name of the .xgen file produced by Gauss
#ev = EventSelector()
#ev.Input = ["DATAFILE='Gauss-13104013-100000ev-20160407.xgen' TYP='POOL_ROOTTREE' Opt='READ'"]

# Configure DaVinci
dv = DaVinci( HistogramFile = "histo.root"
            , TupleFile = "DVntuple.root"
            , UserAlgorithms = [mctuple]
            , Simulation = True
            , Lumi = False
            , DataType = "2012"
            , EvtMax = -1
            )
tuple.piplus.ToolList += ["TupleToolL0Calo/piplusL0Calo"]
tuple.piplus.piplusL0Calo.WhichCalo="HCAL"

tuple.piminus.addTool(TupleToolL0Calo,name="piminusL0Calo")
tuple.piminus.ToolList += ["TupleToolL0Calo/piminusL0Calo"]
tuple.piminus.piminusL0Calo.WhichCalo="HCAL"

tuple.proton.addTool(TupleToolL0Calo,name="protonL0Calo")
tuple.proton.ToolList += ["TupleToolL0Calo/protonL0Calo"]
tuple.proton.protonL0Calo.WhichCalo="HCAL"

etuple=EventTuple()
etuple.ToolList=["TupleToolEventInfo"]

from Configurables import MCDecayTreeTuple
mctuple=MCDecayTreeTuple("mctuple")
mctuple.ToolList+=["MCTupleToolKinematic","MCTupleToolReconstructed","MCTupleToolHierarchy","MCTupleToolDecayType","MCTupleToolPID"]

mctuple.Decay="[Lambda_b0 -> ^p+ ^K- ^(eta -> ^pi+ ^pi- ^(pi0 -> ^gamma ^gamma))]CC"


MySequencer.Members.append(etuple)
MySequencer.Members.append(tuple)
MySequencer.Members.append(mctuple)

DaVinci().InputType='DST'
DaVinci().UserAlgorithms+=[MySequencer]
DaVinci().TupleFile="Output.root"
DaVinci().HistogramFile="histos.root"
DaVinci().DataType='2012'
DaVinci().EvtMax=-1
Exemplo n.º 30
0
from GaudiConf import IOHelper
from Configurables import DaVinci, DecayTreeTuple
from DecayTreeTuple.Configuration import *
from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, MCTupleToolHierarchy, LoKi__Hybrid__MCTupleTool, LoKi__Hybrid__EvtTupleTool, TupleToolEventInfo
#############################################################################################
#                                                                                           #
#                                  Create The DecayTree                                     #
#                                                                                           #
#############################################################################################
Trees = []

# Bs -> K Mu Nu
DecayTree = MCDecayTreeTuple('TupleBs2KMuNu')
DecayTree.Decay = '([ [B_s0]nos -> ^K- ^mu+ ... ]CC || [ [B_s~0]os -> ^K- ^mu+ ... ]CC)'
Trees.append(DecayTree)

# Bs -> K* Mu Nu
DecayTree = MCDecayTreeTuple('TupleBs2KstarMuNu')
DecayTree.Decay = '([ [B_s0]nos -> ^( K*(892)- => ^k- ^pi0 ) ^mu+ ... ]CC || [ [B_s~0]os -> ^( K*(892)- => ^k- ^pi0 ) ^mu+ ... ]CC)'
Trees.append(DecayTree)

#Ds Decays
DecayTree = MCDecayTreeTuple('TupleBs2DsMuNu')
DecayTree.Decay = '( [ [B_s0]nos -> ^( D_s- => ^K+ ^K- ^pi- ) ^mu+ ... ]CC ) || ([ [B_s~0]os -> ^( D_s- => ^K+ ^K- ^pi- ) ^mu+ ... ]CC )'
Trees.append(DecayTree)

#DsStar Decays
DecayTree = MCDecayTreeTuple('TupleBs2DsStarMuNu_pi0')
DecayTree.Decay = '( [ [B_s0]nos -> ^(  D*_s- => ^( D_s- => ^K+ ^K- ^pi- ) ^pi0 ) ^mu+ ... ]CC ) || ([ [B_s~0]os -> ^(  D*_s- => ^( D_s- => ^K+ ^K- ^pi- ) ^pi0 ) ^mu+ ... ]CC )'
Trees.append(DecayTree)
Exemplo n.º 31
0


                
if isMC:
  from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, TupleToolMCTruth, MCTupleToolHierarchy, MCTupleToolReconstructed, MCTupleToolAngles, TupleToolMCBackgroundInfo
  tuple.addTupleTool('TupleToolMCTruth/MCTruth')
  tuple.MCTruth.ToolList = ['MCTupleToolKinematic',
                                      'MCTupleToolHierarchy',
                                      'MCTupleToolReconstructed',
                                      'MCTupleToolAngles',
                                      ]
  tuple.phi.addTupleTool("TupleToolMCBackgroundInfo")


  mcTuple = MCDecayTreeTuple("MCTuplePhi2KsKs") # I can put as an argument a name if I use more than a MCDecayTreeTuple
  mcTuple.Decay = '[D_s+ -> ^(phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)) ^pi+]CC'
  mcTuple.Branches = {'Ds' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'phi' : '[D_s+ -> ^(phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'Ks1' : '[D_s+ -> (phi(1020) -> ^(KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'Ks2' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) ^(KS0 -> pi+ pi-)) pi+]CC',
                                        'pi1' : '[D_s+ -> (phi(1020) -> (KS0 -> ^pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'pi2' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ ^pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'pi3' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> ^pi+ pi-)) pi+]CC',
                                        'pi4' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ ^pi-)) pi+]CC',
                                        'pis' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) ^pi+]CC',
                                          }

  mcTuple.addBranches(mcTuple.Branches)
  mcTuple.ToolList = ['MCTupleToolKinematic',
                        'TupleToolEventInfo',
Exemplo n.º 32
0
#decay = "[B0 => ^(Lambda_c~- ==> ^p~- ^K+ ^pi-) ^p+ ^pi- ^pi+]CC"
#decay = "[[B_s0]os => ^(J/psi(1S) ==> ^mu+ ^mu-) ^(phi(1020) ==> ^K+ ^K-)]CC"
decay = "[B_s0 => ^(J/psi(1S) ==> ^mu+ ^mu-) ^(phi(1020) ==> ^K+ ^K-)]CC"
decay_heads = ["B_s0", "B_s~0"]

dir = "/Disk/speyside8/lhcb/gcowan1/generation/Bs2JpsiPhi/"
datafiles = glob.glob(dir+"/*1000ev*xgen")
#datafiles = [datafiles[-1]]
print datafiles
year = 2012

# For a quick and dirty check, you don't need to edit anything below here.
##########################################################################

# Create an MC DTT containing any candidates matching the decay descriptor
mctuple = MCDecayTreeTuple("MCDecayTreeTuple")
mctuple.Decay = decay
mctuple.ToolList = [
    "MCTupleToolHierarchy",
    "LoKi::Hybrid::MCTupleTool/LoKi_Photos"
]
# Add a 'number of photons' branch
#mctuple.addTupleTool("MCTupleToolReconstructed").Associate = False
#mctuple.MCTupleToolReconstructed.FillPID = False
mctuple.addTupleTool("MCTupleToolKinematic").Verbose = True
mctuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Photos").Variables = {
    "nPhotos": "MCNINTREE(('gamma' == MCABSID))"
}
mctuple.addTupleTool("MCTupleToolP2VV").Calculator = 'MCBs2JpsiPhiAngleCalculator'

# Print the decay tree for any particle in decay_heads
Exemplo n.º 33
0
# We want to save all of the generated events for each mode.
#########################################################################################################
from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, MCTupleToolHierarchy, LoKi__Hybrid__MCTupleTool

# LoKi variables
LoKi_Photos = LoKi__Hybrid__MCTupleTool("LoKi_Photos")
LoKi_Photos.Variables = {
    "nPhotons" : "MCNINTREE ( ('gamma'==MCABSID) )",
    "MC_PT"    : "MCPT",
    "MC_THETA" : "MCTHETA",
    "MC_ETA"   : "MCETA",
    "MC_PHI"   : "MCPHI",
    "MC_ABSID" : "MCABSID"
    }

mctuple_B2Kmumu = MCDecayTreeTuple( 'MCTuple_B2Kmumu' )
mctuple_B2Kmumu.Decay = "[ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+ ^mu- ...) ^K+ ... ]CC"
mctuple_B2Kmumu.Branches = {
        'B'       : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  K+  ... ]CC",
        'Kplus'   : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...) ^K+  ... ]CC",
        'psi'     : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+  mu- ...)  K+  ... ]CC",
        'muplus'  : "[ (Beauty & LongLived) --> ^(J/psi(1S) -> ^mu+  mu- ...)  K+  ... ]CC",
        'muminus' : "[ (Beauty & LongLived) --> ^(J/psi(1S) ->  mu+ ^mu- ...)  K+  ... ]CC",
        }

# List of the mc tuples
mctuples = [
        mctuple_B2Kmumu
    ]

for tup in mctuples:
Exemplo n.º 34
0
from Gaudi.Configuration import *
from GaudiKernel.SystemOfUnits import *

#####################################################################
#
# Define template MCtuple
#
######################################################################

from Configurables import MCDecayTreeTuple
MCTupTmp = MCDecayTreeTuple()

MCTupTmp.ToolList += ["MCTupleToolHierarchy"]
MCTupTmp.ToolList += ["MCTupleToolKinematic"]
MCTupTmp.ToolList += ["MCTupleToolPID"]

######################################################################

from Configurables import LoKi__Hybrid__EvtTupleTool
MCTupTmp.addTool(LoKi__Hybrid__EvtTupleTool, name="LoKiHybrid")
MCTupTmp.ToolList += ["LoKi::Hybrid::EvtTupleTool/LoKiHybrid"]
MCTupTmp.LoKiHybrid.Preambulo = ["from LoKiCore.basic import LHCb"]
MCTupTmp.LoKiHybrid.VOID_Variables = {
    "nSPDHits":
    "RECSUMMARY( LHCb.RecSummary.nSPDhits, -1, '/Event/Rec/Summary', False )"
}