Exemple #1
0
    DecayTreeTuple,
)
from DecayTreeTuple.Configuration import *

# Stream and stripping line we want to use
stream = 'AllStreams'
line = 'D2hhPromptDst2D2KKLine'

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKK')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)]
dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^K+) ^pi+]CC'

# add a kinematic fitter
dtt.addBranches({
    'Dstar': '[D*(2010)+ -> (D0 -> K- K+) pi+]CC',
})
dtt.Dstar.addTupleTool('TupleToolDecayTreeFitter/ConsD')
dtt.Dstar.ConsD.constrainToOriginVertex = True
dtt.Dstar.ConsD.Verbose = True
dtt.Dstar.ConsD.daughtersToConstrain = ['D0']

# add another fitter, this time we will change a mass hypothesis
dtt.Dstar.addTupleTool('TupleToolDecayTreeFitter/ConsDKpi')
dtt.Dstar.ConsDKpi.constrainToOriginVertex = True
dtt.Dstar.ConsDKpi.Verbose = True
dtt.Dstar.ConsDKpi.daughtersToConstrain = ['D0']

# make the hypothesis that actually we had the decay D0->pi+pi-
# note that you have to explicitely give both charges
# CC does not work here!
tuple.addTool(TupleToolPid, name="TupleToolPid")
tuple.TupleToolPid.Verbose = True

#tuple.UseLabXSyntax = True

#tuple.Decay = " [B0 -> ^[ D0 -> ^K- ^pi+ ]CC ^[ K*(892)0 -> ^K+ ^pi- ]CC]CC "
#tuple.Decay = " [B0 -> ^(D0 -> ^K- ^pi+) ^(K*(892)0 -> ^K+ ^pi-) ]CC "
tuple.Decay = "[B0 -> ^( D0 -> ^K+ ^K- ) ^( rho(770)0 -> ^pi+ ^pi- ) ]CC "
tuple.addBranches({
    "B":
    " [B0 ->  ( D0 ->  K+  K- )  ( rho(770)0 ->  pi+  pi- ) ]CC ",
    "D":
    " [B0 -> ^( D0 ->  K+  K- )  ( rho(770)0 ->  pi+  pi- ) ]CC ",
    "D0p":
    " [B0 ->  ( D0 -> ^K+  K- )  ( rho(770)0 ->  pi+  pi- ) ]CC ",
    "D0m":
    " [B0 ->  ( D0 ->  K+ ^K- )  ( rho(770)0 ->  pi+  pi- ) ]CC ",
    "pip":
    " [B0 ->  ( D0 ->  K+  K- )  ( rho(770)0 -> ^pi+  pi- ) ]CC ",
    "pim":
    " [B0 ->  ( D0 ->  K+  K- )  ( rho(770)0 ->  pi+ ^pi- ) ]CC ",
    "rho":
    " [B0 ->  ( D0 ->  K+  K- ) ^( rho(770)0 ->  pi+  pi- ) ]CC "
})

tuple.addTupleTool("TupleToolTISTOS/TupleToolTISTOS")
tuple.TupleToolTISTOS.VerboseL0 = True
tuple.TupleToolTISTOS.VerboseHlt1 = True
tuple.TupleToolTISTOS.VerboseHlt2 = True
tuple.TupleToolTISTOS.TriggerList = myTriggerList

#Add Loki variables
Exemple #3
0
    def makeTuple(self):
        """
        Make tuple
        """

        from Configurables import FitDecayTrees, DecayTreeTuple, TupleToolDecayTreeFitter, TupleToolDecay, TupleToolTrigger, TupleToolTISTOS, TupleToolPropertime, PropertimeFitter, TupleToolKinematic, TupleToolGeometry, TupleToolEventInfo, TupleToolPrimaries, TupleToolPid, TupleToolTrackInfo, TupleToolRecoStats, TupleToolMCTruth,  LoKi__Hybrid__TupleTool, LoKi__Hybrid__EvtTupleTool
        

        tuple = DecayTreeTuple('Tuple'+self.name) # I can put as an argument a name if I use more than a DecayTreeTuple
        tuple.Inputs = [ self.sequence.outputLocation() ]
        tuple.Decay = self.dec
        tuple.ToolList = ['TupleToolKinematic',
                          'TupleToolEventInfo', 
                          'TupleToolTrackInfo',
                          'TupleToolPid',
                          'TupleToolGeometry', 
                          'TupleToolAngles', # Helicity angle
                          # 'TupleToolPropertime', #proper time TAU of reco particles
                          ]

        
        tuple.InputPrimaryVertices = '/Event/Charm/Rec/Vertex/Primary'


        # Other event infos
        tuple.addTupleTool('LoKi::Hybrid::EvtTupleTool/LoKi_Evt')
        tuple.LoKi_Evt.VOID_Variables = {
            #"nSPDHits" :  " CONTAINS('Raw/Spd/Digits')  " ,
            'nTracks' :  " CONTAINS ('Charm/Rec/Track/Best') "  ,
            }
        
        # # Other variables
        # tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All')
        # tuple.LoKi_All.Variables = {
        #     'BPVIPCHI2' : 'BPVIPCHI2()',
        #     'BPVDIRA' : 'BPVDIRA',
        #     'BPVLTFITCHI2' : 'BPVLTFITCHI2()',           
        #     } 
        
        tuple.addBranches(self.branches)
        
        tuple.phi.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_phi")
        tuple.phi.LoKi_phi.Variables =  {
            'DOCAMAX' : 'DOCAMAX',
            "MassDiff_Phi" : "DMASS('phi(1020)')",
            "BPVDIRA" : "BPVDIRA",
            "IPS_Phi" : "MIPCHI2DV(PRIMARY)",
            "VFASPF_CHI2DOF" : "VFASPF(VCHI2/VDOF)",
            "VFASPF_CHI2" : "VFASPF(VCHI2)",
            "BPVIPCHI2" : "BPVIPCHI2()",
            "ADOCA" : "DOCA(1,2)",
            "ADOCACHI2" : "DOCACHI2(1,2)",

            "DTF_CHI2_PV"   : "DTF_CHI2( True, 'phi(1020)' )",
            "DTF_NDOF_PV"   : "DTF_NDOF( True, 'phi(1020)' )",
            "DTF_M_PV"      : "DTF_FUN ( M, True, 'phi(1020)' )",
            "DTF_M_Ks1_PV"    : "DTF_FUN ( CHILD(M,1), True, 'phi(1020)' )",
            "DTF_M_Ks2_PV"    : "DTF_FUN ( CHILD(M,2), True, 'phi(1020)' )",
           
            # "DTF_CTAU_Ks1"    : "DTF_CTAU(1, False, 'phi(1020)' )",
            # "DTF_CTAU_Ks2"    : "DTF_CTAU(2, False, 'phi(1020)' )",
            
           
            }
        

        def mySharedConf_Ks(branch):
            atool=branch.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Ks')
            atool.Variables =  {
                "BPVDIRA" : "BPVDIRA",
                "VFASPF_CHI2DOF" : "VFASPF(VCHI2/VDOF)",
                "VFASPF_CHI2" : "VFASPF(VCHI2)",
                "BPVIPCHI2" : "BPVIPCHI2()",
                "BPVVD" : "BPVVD",
                "BPVVDCHI2" : "BPVVDCHI2",
                "ADOCA" : "DOCA(1,2)",
                "ADOCACHI2" : "DOCACHI2(1,2)",
                'BPVLTIME' : 'BPVLTIME()',
                }
            PropertimeTool = branch.addTupleTool("TupleToolPropertime/Propertime_Ks")
            

        mySharedConf_Ks(tuple.Ks1)
        mySharedConf_Ks(tuple.Ks2)

        def mySharedConf_pi(branch):
            atool=branch.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_pi')
            atool.Variables =  {
                'TRCHI2DOF' : 'TRCHI2DOF',
                'TRGHOSTPROB' : 'TRGHOSTPROB',
                }

        mySharedConf_pi(tuple.pi1)
        mySharedConf_pi(tuple.pi2)     
        mySharedConf_pi(tuple.pi3)
        mySharedConf_pi(tuple.pi4) 

        
        # Triggers:   
        tuple.phi.addTupleTool('TupleToolTISTOS/TISTOS')
        tuple.phi.TISTOS.TriggerList = trigger_list
        tuple.phi.TISTOS.VerboseL0   = True
        tuple.phi.TISTOS.VerboseHlt1 = True
        tuple.phi.TISTOS.VerboseHlt2 = True
        
                
        if dataSample.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")

        
        self.sequence.sequence().Members += [tuple]
Exemple #4
0
# Tell DecayTreeTuple the structure of your decay, you must put ^ in front
# of particles that you want to write out (apart from head). J/psi->mu+mu-
# is a CP eigenstate so we don't need []CC here.
tuple.Decay = "[J/psi(1S) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)]CC"
tuple.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",
}

tuple.addBranches(tuple.Branches)


tuple.JPsi.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_JPsi")
tuple.JPsi.LoKi_JPsi.Variables = {
    "DOCAMAX": "DOCAMAX",
    "MassDiff_JPsi": "DMASS('J/psi(1S)')",
    "BPVDIRA": "BPVDIRA",
    "IPS_JPsi": "MIPCHI2DV(PRIMARY)",
    "VFASPF_CHI2DOF": "VFASPF(VCHI2/VDOF)",
    "VFASPF_CHI2": "VFASPF(VCHI2)",
    "BPVIPCHI2": "BPVIPCHI2()",
    "ADOCA": "DOCA(1,2)",
    "ADOCACHI2": "DOCACHI2(1,2)",
    "DTF_CHI2_PV": "DTF_CHI2( True, 'KS0' )",
    "DTF_NDOF_PV": "DTF_NDOF( True, 'KS0' )",
Exemple #5
0
tuple = DecayTreeTuple("Jpsi_Tuple")

tuple.Inputs = ["/Event/Dimuon/Phys/B2XMuMu_Line/Particles"]

tuple.ToolList =  [
      "TupleToolKinematic"
    , "TupleToolEventInfo"
    , "TupleToolRecoStats"
    , "TupleBuKmmFit"
]

tuple.addBranches ({
      "Bplus"        :  "[B+ ->  K+  ( J/psi(1S) ->  mu+  mu-)]CC",
      "Kplus"        :  "[B+ -> ^K+  ( J/psi(1S) ->  mu+  mu-)]CC",
      "Jpsi"         :  "[B+ ->  K+ ^( J/psi(1S) ->  mu+  mu-)]CC",
      "muplus"       :  "[B+ ->  K+  ( J/psi(1S) -> ^mu+  mu-)]CC",
      "muminus"      :  "[B+ ->  K+  ( J/psi(1S) ->  mu+ ^mu-)]CC",
})

LoKi_All = tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
        'MINIPCHI2' : "MIPCHI2DV(PRIMARY)",
        'MINIP' : "MIPDV(PRIMARY)",
        'IPCHI2_OWNPV' : "BPVIPCHI2()",
        'IP_OWNPV' : "BPVIP()"
}

LoKi_muplus = tuple.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_muplus")
LoKi_muplus.Variables = {
       'PIDmu' : "PIDmu",
Exemple #6
0
tuple = DecayTreeTuple("Jpsi_Tuple")

tuple.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_eeLine/Particles"]

tuple.ToolList =  [
      "TupleToolKinematic"
    , "TupleToolEventInfo"
    , "TupleToolRecoStats"
    , "TupleBuKmmFit"
]

tuple.addBranches ({
      "Bplus"        :  "[B+ ->  K+ ( J/psi(1S) ->  e+  e-)]CC",
      "Kplus"        :  "[B+ -> ^K+ ( J/psi(1S) ->  e+  e-)]CC",
      "Jpsi"         :  "[B+ ->  K+ (^J/psi(1S) ->  e+  e-)]CC",
      "muplus"       :  "[B+ ->  K+ ( J/psi(1S) -> ^e+  e-)]CC",
      "muminus"      :  "[B+ ->  K+ ( J/psi(1S) ->  e+ ^e-)]CC",
})

LoKi_All = tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
        'MINIPCHI2' : "MIPCHI2DV(PRIMARY)",
        'MINIP' : "MIPDV(PRIMARY)",
        'IPCHI2_OWNPV' : "BPVIPCHI2()",
        'IP_OWNPV' : "BPVIP()"
}

LoKi_Jpsi = tuple.Jpsi.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Jpsi")
LoKi_Jpsi.Variables = {
            "q_PV_constr_B_constr" : "DTF_FUN ( M , True , 'B+' )" ,
Exemple #7
0
    "TupleToolKinematic",
    "TupleToolEventInfo",
    "TupleToolRecoStats",
    "TupleToolGeometry",
    "TupleToolMCBackgroundInfo"  #comment out for data      
    ,
    "TupleToolMCTruth"  #comment out for data                                           
    ,
    "TupleToolSLTruth",
    "TupleToolL0Calo"  #for Calorimeter info                                             
]  # Probably need to add many more Tools.

tupleB.addBranches({
    "Lb": "[B- -> (Lambda_c+ -> p+ K- pi+) mu-]CC",
    "Lc": "[B- -> ^Lambda_c+ mu-]CC",
    "p": "[B- -> (Lambda_c+ -> ^p+ K- pi+) mu-]CC",
    "pi": "[B- -> (Lambda_c+ -> p+ K- ^pi+) mu-]CC",
    "K": "[B- -> (Lambda_c+ -> p+ ^K- pi+) mu-]CC",
    "mu": "[B- -> (Lambda_c+ -> p+ K- pi+) ^mu-]CC"
})

l0_lines = ['L0HadronDecision', 'L0MuonDecision', 'L0ElectronDecision']

hlt1_lines = ['Hlt1TrackMVADecision', 'Hlt1TwoTrackMVADecision']

hlt2_lines = [
    "Hlt2XcMuXForTauB2XcMuDecision", "Hlt2XcMuXForTauB2XcFakeMuDecision"
]

LoKi_All = tupleB.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
    'MINIPCHI2': "MIPCHI2DV(PRIMARY)",
Exemple #8
0
def decay_tree_tuple(name, decay, mothers, intermediate, daughters, inputs,
                     mc):
    """Return a configured DecayTreeTuple instance.

    A DecayTreeTuple 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
        decay_tree_tuple(
            'TupleDstToD0pi_D0ToKpi',
            '[D*(2010)+ -> K- 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'
            },
            'Phys/StrippingLineName/Particles'
        )
    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
    inputs -- str of list of str, as the value of DecayTreeTuple.Inputs
    mc -- Extra MC information is included if True
    """

    # Define tuple tools to add
    tools = [
        "TupleToolPropertime",
        'TupleToolEventInfo',
    ]

    # Extra variables, added using LoKi hybrid tuple tools
    basic_loki_vars = {
        'ETA': 'ETA',
        'PHI': 'PHI',
        'PT': 'PT',
        'ID': 'ID',
        'P': 'P',
        'Loki_BPVIPCHI2': 'BPVIPCHI2()',
        'Loki_MIPCHI2DV': 'MIPCHI2DV(PRIMARY)',
    }
    intermediate_loki_vars = {
        'Loki_AM34': 'LoKi.Particles.PFunA(AM34)',
        'Loki_AM4': 'LoKi.Particles.PFunA(AM4)',
        'Loki_BPVDIRA': "BPVDIRA",
        'Loki_acosBPVDIRA': "acos(BPVDIRA)",
    }
    daughter_loki_vars = {
        'PIDK': 'PIDK',
        'PIDe': 'PIDe',
        'PIDmu': 'PIDmu',
        'PIDp': 'PIDp',
        'Loki_TRACKCHI2NDOF': 'TRCHI2DOF',
        'Loki_TRACKGHOSTPROB': 'TRGHOSTPROB',
    }
    mother_loki_vars = {
        'M': 'M',
        'Loki_BPVVDCHI2': 'BPVVDCHI2',
        'Loki_BPVIPCHI2': 'BPVIPCHI2()',
        'Loki_DOCAMAX': 'DOCAMAX',
        'Loki_AMAXDOCA': "LoKi.Particles.PFunA(AMAXDOCA(''))",
        'Loki_AMINDOCA': "LoKi.Particles.PFunA(AMINDOCA(''))",
        'Loki_DOCACHI2MAX': 'DOCACHI2MAX',
        'Loki_VCHI2NDOF': 'VFASPF(VCHI2/VDOF)',
        'Loki_VX': 'VFASPF(VX)',
        'Loki_VY': 'VFASPF(VY)',
        'Loki_VZ': 'VFASPF(VZ)',
        'Loki_SUMPT': 'SUMTREE(PT,  ISBASIC)',
        'Loki_BPVLTIME': "BPVLTIME()",
    }

    # Template DecayTreeTuple
    t = DecayTreeTuple(name)

    # Providing str will throw an exception, so wrap it in a list
    try:
        t.Inputs = inputs
    except ValueError:
        t.Inputs = [inputs]
    t.Decay = decay
    # Merge the mother and daughter dictionaries
    t.addBranches(
        dict(mothers.items() + intermediate.items() + daughters.items()))
    # Tools for all branches
    t.ToolList = tools
    # Verbose reconstruction information
    t.addTupleTool('TupleToolANNPID').ANNPIDTunes = ["MC15TuneV1"]
    # t.addTupleTool('TupleToolRecoStats')
    # MC truth information
    if mc:
        if has_turbo_inputs(t):
            print 'Adding MC truth information for Turbo'
            from TeslaTools import TeslaTruthUtils
            relations = TeslaTruthUtils.getRelLoc("")
            print 'relations = {}'.format(relations)
            toollist = ['MCTupleToolPrompt']
            rels = [relations]

            MCTruth = TupleToolMCTruth()
            #MCTruth.OutputLevel = 1
            MCTruth = t.addTupleTool('TupleToolMCTruth')
            MCTruth.ToolList = toollist
            MCTruth.addTool(DaVinciSmartAssociator)
            MCTruth.DaVinciSmartAssociator.RedoNeutral = False
            MCTruth.DaVinciSmartAssociator.addTool(P2MCPFromProtoP)
            MCTruth.DaVinciSmartAssociator.P2MCPFromProtoP.Locations = rels
            MCTruth.addTool(MCMatchObjP2MCRelator)
            MCTruth.MCMatchObjP2MCRelator.RelTableLocations = rels

            MCTruth.DaVinciSmartAssociator.addTool(BackgroundCategory)
            MCTruth.DaVinciSmartAssociator.BackgroundCategory.addTool(
                P2MCPFromProtoP)
            MCTruth.DaVinciSmartAssociator.BackgroundCategory.vetoNeutralRedo = True
            MCTruth.DaVinciSmartAssociator.BackgroundCategory.P2MCPFromProtoP.Locations = rels

            bkgcat = t.addTupleTool('TupleToolMCBackgroundInfo')
            bkgcat.addTool(BackgroundCategory)
            bkgcat.OutputLevel = 10
            bkgcat.BackgroundCategory.vetoNeutralRedo = True
            bkgcat.BackgroundCategory.addTool(P2MCPFromProtoP)
            bkgcat.BackgroundCategory.P2MCPFromProtoP.Locations = rels

            t.OutputLevel = 10
        else:
            print 'Adding MC truth information'
            t.addTupleTool('TupleToolMCTruth')
            t.addTupleTool('TupleToolMCBackgroundInfo')
    # Extra information from LoKi
    hybrid_tt = t.addTupleTool('LoKi::Hybrid::TupleTool/basicLoKiTT')
    hybrid_tt.Variables = basic_loki_vars
    hybrid_tt.Preambulo = ['from LoKiTracks.decorators import TrIDC']

    # Add mother-specific varaibles to each mother branch
    for mother in mothers:
        branch = getattr(t, mother)
        branch.addTupleTool('LoKi::Hybrid::TupleTool/{0}LoKiTT'.format(
            mother)).Variables = mother_loki_vars
        # For some unknown reason this doesn't work with Turbo candidates, so
        # the information for them has to be added to every branch
        DictTuple = branch.addTupleTool(LoKi__Hybrid__Dict2Tuple,
                                        name="DTFTuple")
        DictTuple.addTool(DTFDict, name="DTF")
        DictTuple.Source = "LoKi::Hybrid::DTFDict/DTF"
        DictTuple.NumVar = 6 * (len(mothers) + len(intermediate) +
                                len(daughters))

        # configure the DecayTreeFitter in the usual way
        DictTuple.DTF.constrainToOriginVertex = True
        DictTuple.DTF.daughtersToConstrain = ['D0']
        DictTuple.DTF.addTool(LoKi__Hybrid__DictOfFunctors, name="dict")
        DictTuple.DTF.Source = "LoKi::Hybrid::DictOfFunctors/dict"
        DictTuple.DTF.dict.Variables = {
            "DTFDict_{}_PT".format(mother): "PT",
            "DTFDict_{}_ETA".format(mother): "ETA",
            "DTFDict_{}_PHI".format(mother): "PHI",
            "DTFDict_{}_P".format(mother): "P",
            "DTFDict_{}_M".format(mother): "M",
        }
        for part, decay in intermediate.items() + daughters.items():
            DictTuple.DTF.dict.Variables["DTFDict_{}_PT".format(
                part)] = "CHILD(PT,'{}')".format(decay)
            DictTuple.DTF.dict.Variables["DTFDict_{}_ETA".format(
                part)] = "CHILD(ETA,'{}')".format(decay)
            DictTuple.DTF.dict.Variables["DTFDict_{}_PHI".format(
                part)] = "CHILD(PHI,'{}')".format(decay)
            DictTuple.DTF.dict.Variables["DTFDict_{}_P".format(
                part)] = "CHILD(P,'{}')".format(decay)
            DictTuple.DTF.dict.Variables["DTFDict_{}_M".format(
                part)] = "CHILD(M,'{}')".format(decay)

    # Add intermediate-specific varaibles to each mother branch
    mom_int = mother_loki_vars.copy()
    mom_int.update(intermediate_loki_vars)
    for mother in intermediate:
        branch = getattr(t, mother)
        branch.addTupleTool('LoKi::Hybrid::TupleTool/{0}LoKiTT'.format(
            mother)).Variables = mom_int
        # For some unknown reason this doesn't work with Turbo candidates, so
        # the information for them has to be added to every branch

    for daughter in daughters:
        branch = getattr(t, daughter)
        branch.addTupleTool('LoKi::Hybrid::TupleTool/{0}LoKiTT'.format(
            daughter)).Variables = daughter_loki_vars

    return t
def execute_option_file(path):
    # ================= BEGIN EDIT AREA =======================
    tuplename = "Bu2LLK_meLine"
    simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"
    data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"

    decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    branches = {    # Dictionary for the branches to write in the tuple
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"    : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
    }

    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    #use data.addTupleTool('<tool>') in the corresponding section below if you also want to modify the specific tool
    toollist = [
          "TupleToolGeometry"       #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV)
        , "TupleToolKinematic"      #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT)
        , "TupleToolEventInfo"      #Event information such as run number, polarity, GPS time etc.
        #, "TupleToolPropertime"    #proper lifetime of reconstructed particles
        , "TupleToolAngles"         #decay angles of charged tracks (i.e. angle in mothers frame, name: CosTheta)
        #, "TupleToolTrigger"       #Saves trigger decision (I prefer to use TupleToolTISTOS)
        , "TupleToolTISTOS"         #Trigger on/independent of signal
        , "TupleToolTrackInfo"      #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track...
        , "TupleToolPrimaries"      #Number and coordinates of all primary vertices
        , "TupleToolDira"           #Angle between secondary minus primary vertex and the mother momentum
        #, "TupleToolTrackPosition" #Extrapolate track to given z-position (option .Z, default=2500. which is TT)
        , "TupleToolRecoStats"      #Fills reconstruction information like nTracks, nSPDHits, nMuonTracks from RecSummary
        , "TupleToolBremInfo"       #Bremsstrahlung information
        ]
    # ================= END EDIT AREA =======================









    # ================= BEGIN DO NOT EDIT HERE =======================
    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]




    #DecayTreeTuple -> Fills information about particles, vertices and daughters
    ntuple = DecayTreeTuple(tuplename)


    ntuple.ToolList = toollist


    if DaVinci().InputType != 'MDST':
        ntuple.ToolList += ["TupleToolTrackIsolation"]
    if DaVinci().Simulation is True:
        ntuple.ToolList +=["TupleToolMCBackgroundInfo"]            #Sets the background category
        MCTruth=ntuple.addTupleTool("TupleToolMCTruth")            #Saves information of MC particle associated to the current particle (you can add tools to it itself!)
        MCTruth.addTupleTool("MCTupleToolHierarchy")               #True IDs of mother and grandmother particles



    if DaVinci().Simulation is True: # for MC
        ntuple.Inputs = [simulation_inputstring]
    elif DaVinci().Simulation is False: # for Tuple
        ntuple.Inputs = [data_inputstring]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    ntuple.Decay = decaydescriptor
    ntuple.addBranches(branches)

    ntuple.TupleName = "DecayTree"

    MySequencer.Members.append(ntuple)
    # ================= END DO NOT EDIT HERE =======================













    # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ==================

    # LOKI TupleTool
    LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool")
    LoKi.Variables =  {
        "ETA" : "ETA",       #Pseudorapidity
        "PHI" : "PHI"       #Azimuthal angle
    }




    # PID TupleTool
    if(True):
        pid = ntuple.addTupleTool("TupleToolPid")            #PID information for charged particles
        pid.Verbose = True                                 #More information like isMuonLoose etc.



    #TISTOS TupleTool
    if(True):
        from Configurables import TupleToolTISTOS

        L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
        ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']

        Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

        Hlt2Triggers = [
            ## muon lines
            "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
            "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
            "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
            "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
            ## hadron/Topo lines
            "Hlt2B2HHDecision",
            "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
            "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
            "Hlt2TopoE2BodyBBDTDecision", "Hlt2TopoE3BodyBBDTDecision", "Hlt2TopoE4BodyBBDTDecision",
            "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
            ##others
            "Hlt2PassThroughDecision",
            "Hlt2TransparentDecision",
            ## inclusive decisions
            "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
            ]

        triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers

        ntuple.addTool(TupleToolTISTOS)
        ntuple.TupleToolTISTOS.VerboseL0 = True
        ntuple.TupleToolTISTOS.VerboseHlt1 = True
        ntuple.TupleToolTISTOS.VerboseHlt2 = True
        ntuple.TupleToolTISTOS.FillL0 = True
        ntuple.TupleToolTISTOS.FillHlt1 = True
        ntuple.TupleToolTISTOS.FillHlt2 = True
        ntuple.TupleToolTISTOS.OutputLevel = INFO
        ntuple.TupleToolTISTOS.TriggerList = triggerList



    #DecayTreeFitter
    if(False):
        fitter = ntuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
        fitter.constrainToOriginVertex = False
        fitter.daughtersToConstrain = [ "J/psi(1S)" ]
        fitter.Verbose = True

    #Isolation
    if(True):
        from Configurables import TupleToolApplyIsolation
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
        ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
        ntuple.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml"
        #ntuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"]
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
        ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
        ntuple.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml"
        #ntuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"]
        ntuple.B.addTupleTool("TupleToolVtxIsoln")
        #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3
        #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3


    #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters)
    if(True):   #Change this value if you don't want to use this tool
        from Configurables import TupleToolTrackHits, STOfflinePosition
        trackhits = ntuple.addTupleTool("TupleToolTrackHits")
        trackhits.Verbose = True

        if DaVinci().InputType == 'MDST':
            from Configurables import MeasurementProvider
            ntuple.addTool(MeasurementProvider('MeasProvider'))
            ntuple.MeasProvider.RootInTES = "/Event/Leptonic/"        #Change Leptonic for your stream-name in case of MDST
            trackhits.MeasurementProvider = ntuple.MeasProvider

        itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
        itClusterPosition.DetType = 'IT'


    # ================= END EDIT TUPLETOOLS WITH OPTIONS ==================
















    #DDDB and CondDB-Tags for DATA (needs to be set for Simulation in runfile.py according to generation->see bookkeeping!)
    #Always use the latest tags for the given datatype from (the newest are currently not in the database yet, therefore take the default ones!)
    """
    if DaVinci().Simulation is False:
        if DaVinci().DataType == '2012':
            DaVinci().CondDBtag = "dddb-20150522-2"
            DaVinci().DDDBtag = "cond-20150409-1"
        elif DaVinci().DataType == '2011':
            DaVinci().CondDBtag = "dddb-20150522-1"
            DaVinci().DDDBtag = "cond-20150409"
    """



    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [ntuple]
    DaVinci().EvtMax     = -1
    DaVinci().Lumi       = True
Exemple #10
0
tuple.Inputs = ["Phys/B2XMuMu_InclDiMuHighQ2Line/Particles/"]


tuple.ToolList =  [
      "TupleToolKinematic"
    , "TupleToolEventInfo"
    , "TupleToolRecoStats"
    , "TupleToolMCTruth"
    , "TupleToolMCBackgroundInfo"
   # , "TupleBuKmmFit"
]


tuple.addBranches ({         
      "muplus" :  "B0 -> ^mu+ mu-",
      "muminus" :  "B0 -> mu+ ^mu-",
      "Dimuon" : "B0 : B0 -> mu+ mu-",
})
LoKi_All=tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
        'MINIPCHI2' : "MIPCHI2DV(PRIMARY)", 
        'MINIP' : "MIPDV(PRIMARY)",
        'IPCHI2_OWNPV' : "BPVIPCHI2()", 
        'IP_OWNPV' : "BPVIP()"
}

LoKi_muplus=tuple.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_muplus")
LoKi_muplus.Variables = {
       'PIDmu' : "PIDmu",
       'ghost' : "TRGHP",
       'TRACK_CHI2' : "TRCHI2DOF",
def execute_option_file():

    Tuple = DecayTreeTuple('Bu2LLK_eeLine2')

    Tuple.ToolList = [
          "TupleToolGeometry"
        , "TupleToolKinematic"
        , "TupleToolEventInfo"
        , "TupleToolPropertime"
        , "TupleToolTrigger"
        , "TupleToolTISTOS"
        , "TupleToolPid"
        , "TupleToolTrackInfo"
        , "TupleToolPrimaries"
        , "TupleToolDira"
        , "TupleToolTrackIsolation"
        , "TupleToolTrackPosition"
        , "TupleToolRecoStats"
        ]
    if DaVinci().Simulation is True:
        Tuple.ToolList +=[
          "TupleToolMCBackgroundInfo"
        , "TupleToolMCTruth"
        ]


    L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
    ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']


    Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

    Hlt2Triggers = [
        ## muon lines
        "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
        "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
        "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
        "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
        ## hadron/Topo lines
        "Hlt2B2HHDecision",
        "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
        "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
        "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
        ##others
        "Hlt2PassThroughDecision",
        "Hlt2TransparentDecision",
        ## inclusive decisions
        "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
        ]

    triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers


    Tuple.addTool(TupleToolTISTOS)
    Tuple.TupleToolTISTOS.VerboseL0 = True
    Tuple.TupleToolTISTOS.VerboseHlt1 = True
    Tuple.TupleToolTISTOS.VerboseHlt2 = True
    Tuple.TupleToolTISTOS.FillL0 = True
    Tuple.TupleToolTISTOS.FillHlt1 = True
    Tuple.TupleToolTISTOS.FillHlt2 = True
    Tuple.TupleToolTISTOS.OutputLevel = INFO
    Tuple.TupleToolTISTOS.TriggerList = triggerList


    if DaVinci().Simulation is True: # for MC
        Tuple.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_eeLine2/Particles"]
    elif DaVinci().Simulation is False: # for Tuple
        Tuple.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_eeLine2/Particles"]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    Tuple.Decay = "[B+ -> ^(J/psi(1S) -> ^e+ ^e-) ^K+]CC"
    Tuple.addBranches({
        "B"         : "[B+ -> (J/psi(1S) -> e+ e-) K+]CC",
        "Psi"       : "[B+ -> ^(J/psi(1S) -> e+ e-) K+]CC",
        "eplus"    : "[B+ -> (J/psi(1S) -> ^e+ e-) K+]CC",
        "eminus"   : "[B+ -> (J/psi(1S) -> e+ ^e-) K+]CC",
        "Kplus"     : "[B+ -> (J/psi(1S) -> e+ e-) ^K+]CC"
        })

    Tuple.TupleName = "DecayTree"

    #DecayTreeFitter
    fitter = Tuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
    fitter.constrainToOriginVertex = False
    fitter.daughtersToConstrain = [ "J/psi(1S)" ]
    fitter.Verbose = True


    #Isolation
    Tuple.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
    Tuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
    Tuple.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml"
    Tuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"]
    Tuple.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
    Tuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
    Tuple.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml"
    Tuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"]
    vtxiso = Tuple.B.addTupleTool("TupleToolVtxIsoln")
    #Tuple.B.TupleToolApplyIsolationHard.OutputLevel = 3
    #Tuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3


    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().InputType = 'DST'
    DaVinci().UserAlgorithms = [Tuple]
    DaVinci().MoniSequence += [Tuple]
    DaVinci().EvtMax     = -1
    DaVinci().Lumi       = True
Exemple #12
0
def execute(stripRun, stripConf, stripLine, dataType, hltReport, tupleDecay, evtMax, mag, outputType="ntuple", strippingStream = "Charm"):

  #0 "pi" "pi"
  #1 "mu" "mu"
  #2 "K"  "pi"
  #3 "e"  "mu"
  #4 "K"  "mu"
  stripLines = {
    "kkpi":0,
    "kpipi":1,
    "pipipi":2,
    "kpipios":3,
    "kkk":4,
    "kkpios":5,
    "hhh":6,
    }

  lineNumber = stripLines[stripLine]

  # Now build the stream
  from StrippingConf.StrippingStream import StrippingStream
  ss = StrippingStream("ByTom")

  from StrippingSelections import StrippingD2hhh_conf
  line = False
  if stripConf == "default" or stripConf == "def":

    from StrippingArchive import Utils
    D2HHHConf, default_config = Utils.lineBuilderAndConf("stripping20","D2hhh")

    def_str_no_pre = default_config
    for key, val in def_str_no_pre.iteritems():
      if "Prescale" in key:
        def_str_no_pre[key] = 1.0

    D2HHHConf = StrippingD2hhh_conf.D2hhhConf('D2hhh',def_str_no_pre)
    D2hhhLines = D2HHHConf.lines()
    for line in D2hhhLines :
      print line.name(), line.outputLocation()

    ss.appendLines( [D2hhhLines[lineNumber]] )
    stripOutputLoc = D2hhhLines[lineNumber].outputLocation()
  else:
    raise ValueError("Unknown value of stripConf: %s"%stripConf)

  from StrippingConf.Configuration import StrippingConf
  conf = StrippingConf( Streams = [ ss ] )

  from Configurables import StrippingReport
  sr = StrippingReport(Selections = conf.selections())


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

  from Configurables import DaVinci
  from Configurables import LoKi__HDRFilter as StripFilter

  strfilter = StripFilter( 'StripPassFilter', Code="HLT_PASS('"+D2hhhLines[lineNumber].name()+"Decision')", Location="/Event/Strip/Phys/DecReports" )
  #strfilter = StripFilter( 'StripPassFilter', Code="HLT_PASS('StrippingD2hhh_PPPLineDecision')", Location="/Event/Strip/Phys/DecReports" )
  DaVinci().EventPreFilters += [strfilter]

  DaVinci().PrintFreq = 500
  DaVinci().HistogramFile = 'DV_histos.root'
  DaVinci().TupleFile = "DPiPiPi_NTuple.root"
  DaVinci().EvtMax = evtMax

  storeExp = StoreExplorerAlg()
  storeExp.Load = 1
  storeExp.PrintFreq = 10.0

  #DaVinci().appendToMainSequence( [ storeExp ] )
  if stripRun:
    #from Configurables import bankKiller
    #bk = bankKiller( "KillHltBanks", BankTypes = [ "Evt/Strip/Phys/DecReports", "Evt/AllStreams" ] )
    #DaVinci().appendToMainSequence( [ bk ] )
    from Configurables import EventNodeKiller
    enk = EventNodeKiller()
    enk.Nodes=[
      "Event/Strip/Phys/DecReports",
      "Event/AllStreams"]
    DaVinci().appendToMainSequence( [ enk ] )
    #DaVinci().appendToMainSequence( [ storeExp ] )

    DaVinci().appendToMainSequence( [ conf.sequence() ] )
    DaVinci().appendToMainSequence( [ sr ] )
  if hltReport:
    from Configurables import ReadHltReport
    DaVinci().appendToMainSequence( [ ReadHltReport() ] )

  DaVinci().InputType = 'MDST'
  DaVinci().RootInTES = "/Event/Charm"

  a = "->"

  if dataType == "MC10":
    DaVinci().DataType = "2010"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "head-20101206"
    if mag == "up":
      DaVinci().CondDBtag = "sim-20101210-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "sim-20101210-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC11":
    DaVinci().DataType = "2011"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "MC11-20111102"
    if mag == "up":
      DaVinci().CondDBtag = "sim-20111111-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "sim-20111111-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC11a":
    DaVinci().DataType = "2011"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "MC11-20111102"
    if mag == "up":
      DaVinci().CondDBtag = "sim-20111111-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "sim-20111111-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC2012":
    DaVinci().DataType = "2012"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "Sim08-20130503-1"
    if mag == "up":
      DaVinci().CondDBtag = "Sim08-20130503-1-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "Sim08-20130503-1-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC2011":
    DaVinci().DataType = "2011"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "Sim08-20130503"
    if mag == "up":
      DaVinci().CondDBtag = "Sim08-20130503-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "Sim08-20130503-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "data2012":
    a = "->"
    DaVinci().DataType = "2012"
    DaVinci().Simulation = False
    #DaVinci().DDDBtag = "dddb-20130111"
    #if mag == "up":
      #DaVinci().CondDBtag = "cond-20130114"
    #elif mag == "down":
      #DaVinci().CondDBtag = "cond-20130114"
    DaVinci().Lumi = True
  elif dataType == "data2011":
    a = "->"
    DaVinci().DataType = "2011"
    DaVinci().Simulation = False
    #DaVinci().DDDBtag = "dddb-20130111"
    #if mag == "up":
      #DaVinci().CondDBtag = "cond-20130114"
    #elif mag == "down":
      #DaVinci().CondDBtag = "cond-20130114"
    DaVinci().Lumi = True
  elif dataType == "data":
    sys.exit("correct the dataType to include the year")


  from Configurables import DecayTreeTuple
  from Configurables import TupleToolTISTOS
  from Configurables import TupleToolMassHypo, TupleToolSubMass

  if outputType in ["ntuple", "nt", "tuple", "root"]:

    print "stripOutputLoc:",stripOutputLoc

    dttuple = DecayTreeTuple( "DPiPiPi_NTuple" )

    dttuple.ToolList = ["TupleToolGeometry",
                        "TupleToolEventInfo",
                        "TupleToolKinematic",
                        #"TupleToolPrimaries",
                        "TupleToolPropertime",
                        "TupleToolAngles",
                        "TupleToolPid",
                        #"TupleToolRICHPid",
                        "TupleToolDecay",
                        #"TupleToolTrigger",
                        #"TupleToolTrackPosition",
                        #"TupleToolTrackInfo",
                        #"TupleToolRecoStats",
                        "TupleToolDira",
                        "TupleToolDalitz",
                        "TupleToolSubMass",
                        ]

    dttuple.Inputs = [ stripOutputLoc ]

    print "tuple input :",dttuple.Inputs
    print "number of events:", DaVinci().EvtMax


    #[D+ -> pi- pi+ pi+]CC

    if tupleDecay == "pipipi":
      dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^pi+]CC"
      dttuple.addBranches ({
        "D":   "[D+ "+a+" pi- pi+ pi+]CC",
        "x1": "[D+ "+a+" ^pi- pi+ pi+]CC",
        "x2": "[D+ "+a+" pi- ^pi+ pi+]CC",
        "x3": "[D+ "+a+" pi- pi+ ^pi+]CC",
        })
    elif tupleDecay == "kpipios":
      dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^K+]CC"
      dttuple.addBranches ({
        "D":   "[D+ "+a+" pi- pi+ K+]CC",
        "x1": "[D+ "+a+" ^pi- pi+ K+]CC",
        "x2": "[D+ "+a+" pi- ^pi+ K+]CC",
        "x3": "[D+ "+a+" pi- pi+ ^K+]CC",
        })
    elif tupleDecay == "ds2phipi":
      dttuple.Decay = "[D+ "+a+" ^mu+ ^mu- ^pi+]CC"
      dttuple.addBranches ({
        "D":   "[D+ "+a+" mu+ mu- pi+]CC",
        "x1": "[D+ "+a+" ^mu+ mu- pi+]CC",
        "x2": "[D+ "+a+" mu+ ^mu- pi+]CC",
        "x3": "[D+ "+a+" mu+ mu- ^pi+]CC",
        })

    #if tupleDecay == "eta":
      #dttuple.Decay = "[(D+ "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi+),(D- "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi-)]"
      #dttuple.addBranches ({
        #"D":   "[(D+ "+a+" (eta "+a+" pi+ pi-) pi+),(D- "+a+" (eta "+a+" pi+ pi-) pi-)]",
        #"eta": "[(D+ "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi+),(D- "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi-)]",
        #"pip": "[(D+ "+a+" (eta "+a+" ^pi+ pi-) pi+),(D- "+a+" (eta "+a+" ^pi+ pi-) pi-)]",
        #"pim": "[(D+ "+a+" (eta "+a+" pi+ ^pi-) pi+),(D- "+a+" (eta "+a+" pi+ ^pi-) pi-)]",
        #"pi":  "[(D+ "+a+" (eta "+a+" pi+ pi-) ^pi+),(D- "+a+" (eta "+a+" pi+ pi-) ^pi-)]",
        #})

    dttuple.TupleName = "DPiPiPi_NTuple"

    ttmhk = TupleToolMassHypo("KaonHypo")
    ttmhk.PIDReplacements = { "pi+" : "K+"}
    #ttmhk.CC = True
    dttuple.D.addTool(ttmhk)
    dttuple.D.ToolList += ["TupleToolMassHypo/KaonHypo"]

    ttmhm = TupleToolMassHypo("MuonHypo")
    ttmhm.PIDReplacements = { "pi+" : "mu+"}
    #ttmhm.CC = True
    dttuple.D.addTool(ttmhm)
    dttuple.D.ToolList += ["TupleToolMassHypo/MuonHypo"]

    dttuple.addTool(TupleToolTISTOS())
    dttuple.TupleToolTISTOS.VerboseL0 = True
    dttuple.TupleToolTISTOS.VerboseHlt1 = True
    dttuple.TupleToolTISTOS.VerboseHlt2 = True
    dttuple.TupleToolTISTOS.Verbose = True
    dttuple.ToolList += ["TupleToolTISTOS"]

    dttuple.TupleToolTISTOS.TriggerList = [

        "L0CALODecision",
        "L0ElectronDecision",
        "L0PhotonDecision",
        "L0HadronDecision",
        "L0MuonDecision",

        "Hlt1TrackMuonDecision",
        "Hlt1TrackAllL0Decision",

        "Hlt2Topo2BodyBBDTDecision",
        "Hlt2Topo3BodyBBDTDecision",
        "Hlt2Topo4BodyBBDTDecision",

        'Hlt2CharmHadD2HHHDecision',

        ] #+ [ trigger_name+"Decision" for trigger_name in
          #      ["L0CALO","L0ElectronNoSPD","L0PhotonNoSPD","L0HadronNoSPD","L0MuonNoSPD","L0DiMuonNoSPD","L0Electron","L0ElectronHi","L0Photon","L0PhotonHi","L0Hadron","L0Muon","L0DiMuon","L0HighSumETJet","L0B1gas","L0B2gas",]\
          #    + ["Hlt1MBMicroBiasVelo","Hlt1Global","Hlt1DiMuonHighMass","Hlt1DiMuonLowMass","Hlt1SingleMuonNoIP","Hlt1SingleMuonHighPT","Hlt1TrackAllL0","Hlt1TrackMuon","Hlt1TrackPhoton","Hlt1Lumi","Hlt1LumiMidBeamCrossing","Hlt1MBNoBias","Hlt1MBMicroBiasVeloRateLimited","Hlt1MBMicroBiasTStation","Hlt1MBMicroBiasTStationRateLimited","Hlt1L0Any","Hlt1L0AnyRateLimited","Hlt1L0AnyNoSPD","Hlt1L0AnyNoSPDRateLimited","Hlt1NoPVPassThrough","Hlt1DiProton","Hlt1DiProtonLowMult","Hlt1BeamGasNoBeamBeam1","Hlt1BeamGasNoBeamBeam2","Hlt1BeamGasBeam1","Hlt1BeamGasBeam2","Hlt1BeamGasCrossingEnhancedBeam1","Hlt1BeamGasCrossingEnhancedBeam2","Hlt1BeamGasCrossingForcedReco","Hlt1ODINTechnical","Hlt1Tell1Error","Hlt1VeloClosingMicroBias","Hlt1BeamGasCrossingParasitic","Hlt1ErrorEvent","Hlt1SingleElectronNoIP","Hlt1TrackForwardPassThrough","Hlt1TrackForwardPassThroughLoose","Hlt1CharmCalibrationNoBias","Hlt1L0HighSumETJet","Hlt1BeamGasCrossingForcedRecoFullZ","Hlt1BeamGasHighRhoVertices","Hlt1VertexDisplVertex","Hlt1TrackAllL0Tight","Hlt1HighPtJetsSinglePV","Hlt1L0PU","Hlt1L0CALO",]\
          #    + ["Hlt2SingleElectronTFLowPt","Hlt2SingleElectronTFHighPt","Hlt2DiElectronHighMass","Hlt2DiElectronB","Hlt2B2HHLTUnbiased","Hlt2Topo2BodySimple","Hlt2Topo3BodySimple","Hlt2Topo4BodySimple","Hlt2Topo2BodyBBDT","Hlt2Topo3BodyBBDT","Hlt2Topo4BodyBBDT","Hlt2TopoMu2BodyBBDT","Hlt2TopoMu3BodyBBDT","Hlt2TopoMu4BodyBBDT","Hlt2TopoE2BodyBBDT","Hlt2TopoE3BodyBBDT","Hlt2TopoE4BodyBBDT","Hlt2IncPhi","Hlt2IncPhiSidebands","Hlt2CharmHadD02HHKsLL","Hlt2Dst2PiD02PiPi","Hlt2Dst2PiD02MuMu","Hlt2Dst2PiD02KMu","Hlt2Dst2PiD02KPi","Hlt2PassThrough","Hlt2Transparent","Hlt2Forward","Hlt2DebugEvent","Hlt2CharmHadD02HH_D02PiPi","Hlt2CharmHadD02HH_D02PiPiWideMass","Hlt2CharmHadD02HH_D02KK","Hlt2CharmHadD02HH_D02KKWideMass","Hlt2CharmHadD02HH_D02KPi","Hlt2CharmHadD02HH_D02KPiWideMass","Hlt2ExpressJPsi","Hlt2ExpressJPsiTagProbe","Hlt2ExpressLambda","Hlt2ExpressKS","Hlt2ExpressDs2PhiPi","Hlt2ExpressBeamHalo","Hlt2ExpressDStar2D0Pi","Hlt2ExpressHLT1Physics","Hlt2Bs2PhiGamma","Hlt2Bs2PhiGammaWideBMass","Hlt2Bd2KstGamma","Hlt2Bd2KstGammaWideKMass","Hlt2Bd2KstGammaWideBMass","Hlt2CharmHadD2KS0H_D2KS0Pi","Hlt2CharmHadD2KS0H_D2KS0K","Hlt2CharmRareDecayD02MuMu","Hlt2B2HH","Hlt2MuonFromHLT1","Hlt2SingleMuon","Hlt2SingleMuonHighPT","Hlt2SingleMuonLowPT","Hlt2DiProton","Hlt2DiProtonTF","Hlt2DiProtonLowMult","Hlt2DiProtonLowMultTF","Hlt2CharmSemilepD02HMuNu_D02KMuNuWS","Hlt2CharmSemilepD02HMuNu_D02PiMuNuWS","Hlt2CharmSemilepD02HMuNu_D02KMuNu","Hlt2CharmSemilepD02HMuNu_D02PiMuNu","Hlt2TFBc2JpsiMuX","Hlt2TFBc2JpsiMuXSignal","Hlt2DisplVerticesLowMassSingle","Hlt2DisplVerticesHighMassSingle","Hlt2DisplVerticesDouble","Hlt2DisplVerticesSinglePostScaled","Hlt2DisplVerticesHighFDSingle","Hlt2DisplVerticesSingleDown","Hlt2CharmSemilepD2HMuMu","Hlt2CharmSemilepD2HMuMuWideMass","Hlt2B2HHPi0_Merged","Hlt2CharmHadD2HHH","Hlt2CharmHadD2HHHWideMass","Hlt2DiMuon","Hlt2DiMuonLowMass","Hlt2DiMuonJPsi","Hlt2DiMuonJPsiHighPT","Hlt2DiMuonPsi2S","Hlt2DiMuonB","Hlt2DiMuonZ","Hlt2DiMuonDY1","Hlt2DiMuonDY2","Hlt2DiMuonDY3","Hlt2DiMuonDY4","Hlt2DiMuonDetached","Hlt2DiMuonDetachedHeavy","Hlt2DiMuonDetachedJPsi","Hlt2DiMuonNoPV","Hlt2TriMuonDetached","Hlt2TriMuonTau","Hlt2CharmSemilepD02HHMuMu","Hlt2CharmSemilepD02HHMuMuWideMass","Hlt2CharmHadD02HHHH","Hlt2CharmHadD02HHHHWideMass","Hlt2ErrorEvent","Hlt2Global","Hlt2diPhotonDiMuon","Hlt2LowMultMuon","Hlt2LowMultHadron","Hlt2LowMultPhoton","Hlt2LowMultElectron","Hlt2SingleTFElectron","Hlt2SingleTFVHighPtElectron","Hlt2B2HHLTUnbiasedDetached","Hlt2CharmHadLambdaC2KPPi","Hlt2SingleMuonVHighPT","Hlt2CharmSemilepD02HMuNu_D02KMuNuTight","Hlt2CharmHadMinBiasLambdaC2KPPi","Hlt2CharmHadMinBiasD02KPi","Hlt2CharmHadMinBiasD02KK","Hlt2CharmHadMinBiasDplus2hhh","Hlt2CharmHadMinBiasLambdaC2LambdaPi","Hlt2DisplVerticesSingle","Hlt2DisplVerticesDoublePostScaled","Hlt2DisplVerticesSingleHighMassPostScaled","Hlt2DisplVerticesSingleHighFDPostScaled","Hlt2DisplVerticesSingleMVPostScaled","Hlt2RadiativeTopoTrackTOS","Hlt2RadiativeTopoPhotonL0","Hlt2DiMuonPsi2SHighPT","Hlt2DoubleDiMuon","Hlt2DiMuonAndMuon","Hlt2DiMuonAndGamma","Hlt2DiMuonAndD0","Hlt2DiMuonAndDp","Hlt2DiMuonAndDs","Hlt2DiMuonAndLc","Hlt2CharmSemilepD02HHMuMuHardHadronsSoftMuons","Hlt2CharmSemilepD02HHMuMuHardHadronsSoftMuonsWideMass","Hlt2CharmSemilepD02HHMuMuHardHadronsAndMuons","Hlt2CharmSemilepD02HHMuMuHardHadronsAndMuonsWideMass","Hlt2TopoRad2BodyBBDT","Hlt2TopoRad2plus1BodyBBDT","Hlt2Lumi","Hlt2LowMultHadron_nofilter","Hlt2LowMultElectron_nofilter","Hlt2CharmHadD02HHKsDD","Hlt2CharmHadD2KS0KS0","Hlt2CharmHadD2KS0KS0WideMass","Hlt2ExpressD02KPi","Hlt2CharmHadLambdaC2KPPiWideMass","Hlt2CharmHadLambdaC2KPK","Hlt2CharmHadLambdaC2KPKWideMass","Hlt2CharmHadLambdaC2PiPPi","Hlt2CharmHadLambdaC2PiPPiWideMass","Hlt2CharmHadLambdaC2PiPK","Hlt2CharmHadLambdaC2PiPKWideMass","Hlt2CharmHadD2KS0H_D2KS0DDPi","Hlt2CharmHadD2KS0H_D2KS0DDK","Hlt2DiPhi","Hlt2CharmHadD02HHHHDstNoHltOne_4pi","Hlt2CharmHadD02HHHHDstNoHltOne_4piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_K3pi","Hlt2CharmHadD02HHHHDstNoHltOne_K3piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_KKpipi","Hlt2CharmHadD02HHHHDstNoHltOne_KKpipiWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_2K2pi","Hlt2CharmHadD02HHHHDstNoHltOne_2K2piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_3Kpi","Hlt2CharmHadD02HHHHDstNoHltOne_3KpiWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_Ch2","Hlt2CharmHadD02HHHHDstNoHltOne_Ch2WideMass","Hlt2CharmSemilep3bodyD2PiMuMu","Hlt2CharmSemilep3bodyD2PiMuMuSS","Hlt2CharmSemilep3bodyD2KMuMu","Hlt2CharmSemilep3bodyD2KMuMuSS","Hlt2CharmSemilep3bodyLambdac2PMuMu","Hlt2CharmSemilep3bodyLambdac2PMuMuSS","Hlt2LambdaC_LambdaC2Lambda0LLPi","Hlt2LambdaC_LambdaC2Lambda0LLK","Hlt2LambdaC_LambdaC2Lambda0DDPi","Hlt2LambdaC_LambdaC2Lambda0DDK","Hlt2RadiativeTopoTrack","Hlt2RadiativeTopoPhoton","Hlt2CharmHadD02HHHHDst_4pi","Hlt2CharmHadD02HHHHDst_4piWideMass","Hlt2CharmHadD02HHHHDst_K3pi","Hlt2CharmHadD02HHHHDst_K3piWideMass","Hlt2CharmHadD02HHHHDst_KKpipi","Hlt2CharmHadD02HHHHDst_KKpipiWideMass","Hlt2CharmHadD02HHHHDst_2K2pi","Hlt2CharmHadD02HHHHDst_2K2piWideMass","Hlt2CharmHadD02HHHHDst_3Kpi","Hlt2CharmHadD02HHHHDst_3KpiWideMass","Hlt2CharmHadD02HHHHDst_Ch2","Hlt2CharmHadD02HHHHDst_Ch2WideMass","Hlt2CharmSemilepD02PiPiMuMu","Hlt2CharmSemilepD02KKMuMu","Hlt2CharmSemilepD02KPiMuMu","Hlt2CharmHadD02HHHH_4pi","Hlt2CharmHadD02HHHH_4piWideMass","Hlt2CharmHadD02HHHH_K3pi","Hlt2CharmHadD02HHHH_K3piWideMass","Hlt2CharmHadD02HHHH_KKpipi","Hlt2CharmHadD02HHHH_KKpipiWideMass","Hlt2CharmHadD02HHHH_2K2pi","Hlt2CharmHadD02HHHH_2K2piWideMass","Hlt2CharmHadD02HHHH_3Kpi","Hlt2CharmHadD02HHHH_3KpiWideMass","Hlt2CharmHadD02HHHH_Ch2","Hlt2CharmHadD02HHHH_Ch2WideMass","Hlt2DiMuonDetachedPsi2S","Hlt2CharmHadD02HHXDst_hhX","Hlt2CharmHadD02HHXDst_hhXWideMass","Hlt2LowMultD2KPi","Hlt2LowMultD2KPiPi","Hlt2LowMultD2K3Pi","Hlt2LowMultChiC2HH","Hlt2LowMultChiC2HHHH","Hlt2LowMultD2KPiWS","Hlt2LowMultD2KPiPiWS","Hlt2LowMultD2K3PiWS","Hlt2LowMultChiC2HHWS","Hlt2LowMultChiC2HHHHWS","Hlt2LowMultDDInc","Hlt2DisplVerticesSingleLoosePS","Hlt2DisplVerticesSingleHighFD","Hlt2DisplVerticesSingleVeryHighFD","Hlt2DisplVerticesSingleHighMass","Hlt2DisplVerticesSinglePS","Hlt2DisplVerticesDoublePS","Hlt2CharmHadD2HHHKsLL","Hlt2CharmHadD2HHHKsDD","Hlt2KshortToMuMuPiPi","Hlt2LowMultChiC2PP","Hlt2LowMultDDIncCP","Hlt2LowMultDDIncVF","Hlt2LowMultLMR2HH","Hlt2HighPtJets","Hlt2ChargedHyperon_Xi2Lambda0LLPi","Hlt2ChargedHyperon_Xi2Lambda0LLMu","Hlt2ChargedHyperon_Omega2Lambda0LLK","Hlt2ChargedHyperon_Xi2Lambda0DDPi","Hlt2ChargedHyperon_Xi2Lambda0DDMu","Hlt2ChargedHyperon_Omega2Lambda0DDK","Hlt2CharmHadD02HHXDst_BaryonhhX","Hlt2CharmHadD02HHXDst_BaryonhhXWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSLL","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSLLWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0LL","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0LLWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSDD","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSDDWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0DD","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0DDWideMass","Hlt2CharmHadD02HHXDst_LeptonhhX","Hlt2CharmHadD02HHXDst_LeptonhhXWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSLL","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSLLWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0LL","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0LLWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSDD","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSDDWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0DD","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0DDWideMass"]
          #  ]

    from Configurables import LoKi__Hybrid__TupleTool
    LoKi_DTFMASS = LoKi__Hybrid__TupleTool("LoKi_DTFMASS")
    LoKi_DTFMASS.Variables = {
        "DTF_CHI2"   : "DTF_CHI2( True )",
        "DTF_NDOF"   : "DTF_NDOF( True )",

        "DTF_D_M"     : "DTF_FUN ( M ,                      True )",
        "DTF_D_MM"    : "DTF_FUN ( MM ,                     True )",
        "DTF_D_P"     : "DTF_FUN ( P ,                      True )",
        "DTF_D_PT"    : "DTF_FUN ( PT ,                     True )",
        "DTF_D_PE"    : "DTF_FUN ( E ,                      True )",
        "DTF_D_PX"    : "DTF_FUN ( PX ,                     True )",
        "DTF_D_PY"    : "DTF_FUN ( PY ,                     True )",
        "DTF_D_PZ"    : "DTF_FUN ( PZ ,                     True )",

        "DTF_x1_M"   : "DTF_FUN ( CHILD(M,1) ,             True )",
        "DTF_x1_MM"  : "DTF_FUN ( CHILD(MM,1) ,            True )",
        "DTF_x1_P"   : "DTF_FUN ( CHILD(P,1) ,             True )",
        "DTF_x1_PT"  : "DTF_FUN ( CHILD(PT,1) ,            True )",
        "DTF_x1_PE"  : "DTF_FUN ( CHILD(E,1) ,             True )",
        "DTF_x1_PX"  : "DTF_FUN ( CHILD(PX,1) ,            True )",
        "DTF_x1_PY"  : "DTF_FUN ( CHILD(PY,1) ,            True )",
        "DTF_x1_PZ"  : "DTF_FUN ( CHILD(PZ,1) ,            True )",

        "DTF_x2_M"   : "DTF_FUN ( CHILD(M,2) ,             True )",
        "DTF_x2_MM"  : "DTF_FUN ( CHILD(MM,2) ,            True )",
        "DTF_x2_P"   : "DTF_FUN ( CHILD(P,2) ,             True )",
        "DTF_x2_PT"  : "DTF_FUN ( CHILD(PT,2) ,            True )",
        "DTF_x2_PE"  : "DTF_FUN ( CHILD(E,2) ,             True )",
        "DTF_x2_PX"  : "DTF_FUN ( CHILD(PX,2) ,            True )",
        "DTF_x2_PY"  : "DTF_FUN ( CHILD(PY,2) ,            True )",
        "DTF_x2_PZ"  : "DTF_FUN ( CHILD(PZ,2) ,            True )",

        "DTF_x3_M"   : "DTF_FUN ( CHILD(M,3) ,             True )",
        "DTF_x3_MM"  : "DTF_FUN ( CHILD(MM,3) ,            True )",
        "DTF_x3_P"   : "DTF_FUN ( CHILD(P,3) ,             True )",
        "DTF_x3_PT"  : "DTF_FUN ( CHILD(PT,3) ,            True )",
        "DTF_x3_PE"  : "DTF_FUN ( CHILD(E,3) ,             True )",
        "DTF_x3_PX"  : "DTF_FUN ( CHILD(PX,3) ,            True )",
        "DTF_x3_PY"  : "DTF_FUN ( CHILD(PY,3) ,            True )",
        "DTF_x3_PZ"  : "DTF_FUN ( CHILD(PZ,3) ,            True )",

        }
    dttuple.D.ToolList+=["LoKi::Hybrid::TupleTool/LoKi_DTFMASS"]
    dttuple.D.addTool(LoKi_DTFMASS)

    if "MC" in dataType:
      from Configurables import TupleToolMCBackgroundInfo
      dttuple.addTool(TupleToolMCBackgroundInfo, name="TupleToolMCBackgroundInfo")
      dttuple.TupleToolMCBackgroundInfo.Verbose=True
      dttuple.addTool(TupleToolMCTruth, name="truth")
      dttuple.truth.ToolList += ["MCTupleToolHierarchy",
                                "MCTupleToolKinematic"]
      dttuple.ToolList+=["TupleToolMCBackgroundInfo/TupleToolMCBackgroundInfo"]
      dttuple.ToolList+=["TupleToolMCTruth/truth"]

    DaVinci().appendToMainSequence( [ dttuple ] )

  elif outputType == "dst":

    from Configurables import SelDSTWriter
    if stripRun:
      dst_Sel = AutomaticData(Location = stripOutputLoc)
    else:
      dst_Sel = AutomaticData(Location = "/Event/"+strippingStream+"/" + stripOutputLoc)

    dst_Filter = FilterDesktop('dst_Filter', Code = "ALL")

    dst_FilterSel = Selection(name = line.name().replace("Stripping",""),
                              Algorithm = dst_Filter,
                              RequiredSelections = [ dst_Sel ])

    dst_Seq = SelectionSequence('lsdata',
                                TopSelection = dst_FilterSel,
                                )

    dstw = SelDSTWriter("DSTWriter")
    dstw.OutputFileSuffix = "PiPiPi"
    #dstw.CopyProtoParticles = False
    dstw.SelectionSequences = [dst_Seq]
    #dstw.CopyL0DUReport = False
    #dstw.CopyHltDecReports = False
    #dstw.CopyMCTruth = True
    #dstw.CopyBTags = True
    DaVinci().appendToMainSequence( [ dstw.sequence() ] )
Exemple #13
0
def options(year, mag, data_type, mode):

    #======================================#
    #=== DaVinci script for Data and MC ===#
    #======================================#
    #=== year = year of data taking   ===#
    #=== mag  = magnet polarity of data ===#
    #=== data_type = MC or data?    ===#
    #======================================#
    #=== These variables are given to   ===#
    #=== function by the ganga script,  ===#
    #=== which is different, depending  ===#
    #=== on whether MC or data is being ===#
    #=== looked at.           ===#
    #======================================#
    from Configurables import DaVinci
    from Configurables import MCMatchObjP2MCRelator
    from PhysConf.Filters import LoKi_Filters
    #===========================#
    #=== Check if MC or Data ===#
    #===========================#
    if data_type == "data":
        data = True
    elif data_type == "MC":
        data = False
    else:
        print "WARNING: data type not recognised. Please enter either \"data\" or \"MC\" as the third argument to options()!"

    #====================================#
    #=== Setup depending on data type ===#
    #====================================#
    if data:
        stream = 'Bhadron'
        prefix = 'Data'
    else:
        stream = 'AllStreams'
        prefix = 'MC'

    #==============================#
    #=== Assign Stripping Lines ===#
    #==============================#

    #=== b2dk d2pi0hh  ===#
    line_k = 'B2D0KD2Pi0HHResolvedBeauty2CharmLine'
    #=== b2dpi d2pi0hh ===#
    line_pi = 'B2D0PiD2Pi0HHResolvedBeauty2CharmLine'

    #=============================#
    #=== Stripping Pre-Filters ===#
    #=============================#
    fltrs = LoKi_Filters(
        STRIP_Code=
        "HLT_PASS_RE('StrippingB2D0KD2Pi0HHResolvedBeauty2CharmLineDecision') | HLT_PASS_RE('StrippingB2D0PiD2Pi0HHResolvedBeauty2CharmLineDecision')"
    )

    #==============================#
    #=== Import necessary tools ===#
    #==============================#
    from Configurables import DecayTreeTuple
    from DecayTreeTuple.Configuration import *
    if data:
        from Configurables import TrackScaleState
        scaler = TrackScaleState('StateScale')
        scaler.RootInTES = '/Event/{0}/'.format(stream)

    #===================================================#
    #=== Setup DecayTreeTuples for each channel/mode ===#
    #===================================================#
    etuple = EventTuple()
    if data:
        dk_d2kpipi0 = DecayTreeTuple('B2DK_D2KPiPi0')
        dk_d2pikpi0 = DecayTreeTuple('B2DK_D2PiKPi0')
        dk_d2kkpi0 = DecayTreeTuple('B2DK_D2KKPi0')
        dk_d2pipipi0 = DecayTreeTuple('B2DK_D2PiPiPi0')
        dpi_d2kpipi0 = DecayTreeTuple('B2DPi_D2KPiPi0')
        dpi_d2pikpi0 = DecayTreeTuple('B2DPi_D2PiKPi0')
        dpi_d2kkpi0 = DecayTreeTuple('B2DPi_D2KKPi0')
        dpi_d2pipipi0 = DecayTreeTuple('B2DPi_D2PiPiPi0')
    else:
        dk_d2kpipi0 = DecayTreeTuple('B2DK_D2KPiPi0_MC')
        dk_d2pikpi0 = DecayTreeTuple('B2DK_D2PiKPi0_MC')
        dk_d2kkpi0 = DecayTreeTuple('B2DK_D2KKPi0_MC')
        dk_d2pipipi0 = DecayTreeTuple('B2DK_D2PiPiPi0_MC')
        dpi_d2kpipi0 = DecayTreeTuple('B2DPi_D2KPiPi0_MC')
        dpi_d2pikpi0 = DecayTreeTuple('B2DPi_D2PiKPi0_MC')
        dpi_d2kkpi0 = DecayTreeTuple('B2DPi_D2KKPi0_MC')
        dpi_d2pipipi0 = DecayTreeTuple('B2DPi_D2PiPiPi0_MC')

    #=== Assign vectors of DecayTreeTuples for easy use later ===#
    channels = [
        dk_d2kpipi0, dk_d2pikpi0, dk_d2kkpi0, dk_d2pipipi0, dpi_d2kpipi0,
        dpi_d2pikpi0, dpi_d2kkpi0, dpi_d2pipipi0
    ]

    k_chans = [dk_d2kpipi0, dk_d2pikpi0, dk_d2kkpi0, dk_d2pipipi0]
    pi_chans = [dpi_d2kpipi0, dpi_d2pikpi0, dpi_d2kkpi0, dpi_d2pipipi0]

    #=== Setting location/inputs is different depending on data type ===#
    if data:
        for channel in channels:
            channel.RootInTES = '/Event/{0}'.format(stream)
        for channel in k_chans:
            channel.Inputs = ['Phys/{0}/Particles'.format(line_k)]
        for channel in pi_chans:
            channel.Inputs = ['Phys/{0}/Particles'.format(line_pi)]

    else:
        for channel in k_chans:
            if year == '2012' or year == '2011':  # 2012 and 2011 MC is DST!
                channel.Inputs = [
                    '/Event/{0}/Phys/{1}/Particles'.format(stream, line_k)
                ]
            else:
                channel.Inputs = ['Phys/{0}/Particles'.format(line_k)]
        for channel in pi_chans:
            if year == '2012' or year == '2011':
                channel.Inputs = [
                    '/Event/{0}/Phys/{1}/Particles'.format(stream, line_pi)
                ]
            else:
                channel.Inputs = ['Phys/{0}/Particles'.format(line_pi)]

    #=====================================================#
    #=== Setup decay descriptors for each channel/mode ===#
    #=====================================================#
    #=== B2DK ===#
    dk_d2kpipi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^K+)  ,  (B- --> ^(D0 --> ^K- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^K- )]'
    dk_d2kpipi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) K+ )  ,  (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) K-  )]',
        'D0':
        '[(B+ --> ^(D0 --> K+ pi- (pi0 --> gamma gamma)) K+)  ,  (B- --> ^(D0 --> K- pi+ (pi0 --> gamma gamma)) K- )]',
        'K0':
        '[(B+ --> (D0 --> ^K+ pi- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> ^K- pi+ (pi0 --> gamma gamma)) K- )]',
        'P0':
        '[(B+ --> (D0 --> K+ ^pi- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> K- ^pi+ (pi0 --> gamma gamma)) K- )]',
        'Pi0':
        '[(B+ --> (D0 --> K+ pi- ^(pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> K- pi+ ^(pi0 --> gamma gamma)) K- )]',
        'Bach':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) ^K+)  ,  (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) ^K- )]',
        'Gamma1':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> ^gamma gamma)) K+)  ,  (B- --> (D0 --> K- pi+ (pi0 --> ^gamma gamma)) K- )]',
        'Gamma2':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma ^gamma)) K+)  ,  (B- --> (D0 --> K- pi+ (pi0 --> gamma ^gamma)) K- )]'
    })

    dk_d2pikpi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^K- ^(pi0 --> ^gamma ^gamma)) ^K+)  ,  (B- --> ^(D0 --> ^pi- ^K+ ^(pi0 --> ^gamma ^gamma)) ^K- )]'
    dk_d2pikpi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) K+ )  ,  (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) K-  )]',
        'D0':
        '[(B+ --> ^(D0 --> pi+ K- (pi0 --> gamma gamma)) K+)  ,  (B- --> ^(D0 --> pi- K+ (pi0 --> gamma gamma)) K- )]',
        'P0':
        '[(B+ --> (D0 --> ^pi+ K- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> ^pi- K+ (pi0 --> gamma gamma)) K- )]',
        'K0':
        '[(B+ --> (D0 --> pi+ ^K- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> pi- ^K+ (pi0 --> gamma gamma)) K- )]',
        'Pi0':
        '[(B+ --> (D0 --> pi+ K- ^(pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> pi- K+ ^(pi0 --> gamma gamma)) K- )]',
        'Bach':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) ^K+)  ,  (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) ^K- )]',
        'Gamma1':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> ^gamma gamma)) K+)  ,  (B- --> (D0 --> pi- K+ (pi0 --> ^gamma gamma)) K- )]',
        'Gamma2':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma ^gamma)) K+)  ,  (B- --> (D0 --> pi- K+ (pi0 --> gamma ^gamma)) K- )]'
    })

    dk_d2kkpi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^K- ^(pi0 --> ^gamma ^gamma)) ^K+)  ,  (B- --> ^(D0 --> ^K- ^K+ ^(pi0 --> ^gamma ^gamma)) ^K- )]'
    dk_d2kkpi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) K+ )  ,  (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) K-  )]',
        'D0':
        '[(B+ --> ^(D0 --> K+ K- (pi0 --> gamma gamma)) K+)  ,  (B- --> ^(D0 --> K- K+ (pi0 --> gamma gamma)) K- )]',
        'K0':
        '[(B+ --> (D0 --> ^K+ K- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> ^K- K+ (pi0 --> gamma gamma)) K- )]',
        'K1':
        '[(B+ --> (D0 --> K+ ^K- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> K- ^K+ (pi0 --> gamma gamma)) K- )]',
        'Pi0':
        '[(B+ --> (D0 --> K+ K- ^(pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> K- K+ ^(pi0 --> gamma gamma)) K- )]',
        'Bach':
        '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) ^K+)  ,  (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) ^K- )]',
        'Gamma1':
        '[(B+ --> (D0 --> K+ K- (pi0 --> ^gamma gamma)) K+)  ,  (B- --> (D0 --> K- K+ (pi0 --> ^gamma gamma)) K- )]',
        'Gamma2':
        '[(B+ --> (D0 --> K+ K- (pi0 --> gamma ^gamma)) K+)  ,  (B- --> (D0 --> K- K+ (pi0 --> gamma ^gamma)) K- )]'
    })

    dk_d2pipipi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^K+)  ,  (B- --> ^(D0 --> ^pi- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^K- )]'
    dk_d2pipipi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) K+ )  ,  (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) K-  )]',
        'D0':
        '[(B+ --> ^(D0 --> pi+ pi- (pi0 --> gamma gamma)) K+)  ,  (B- --> ^(D0 --> pi- pi+ (pi0 --> gamma gamma)) K- )]',
        'P0':
        '[(B+ --> (D0 --> ^pi+ pi- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> ^pi- pi+ (pi0 --> gamma gamma)) K- )]',
        'P1':
        '[(B+ --> (D0 --> pi+ ^pi- (pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> pi- ^pi+ (pi0 --> gamma gamma)) K- )]',
        'Pi0':
        '[(B+ --> (D0 --> pi+ pi- ^(pi0 --> gamma gamma)) K+)  ,  (B- --> (D0 --> pi- pi+ ^(pi0 --> gamma gamma)) K- )]',
        'Bach':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) ^K+)  ,  (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) ^K- )]',
        'Gamma1':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> ^gamma gamma)) K+)  ,  (B- --> (D0 --> pi- pi+ (pi0 --> ^gamma gamma)) K- )]',
        'Gamma2':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma ^gamma)) K+)  ,  (B- --> (D0 --> pi- pi+ (pi0 --> gamma ^gamma)) K- )]'
    })

    #=== B2DPi ===#
    dpi_d2kpipi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^pi+)  ,  (B- --> ^(D0 --> ^K- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^pi- )]'
    dpi_d2kpipi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) pi+ )  ,  (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) pi-  )]',
        'D0':
        '[(B+ --> ^(D0 --> K+ pi- (pi0 --> gamma gamma)) pi+)  ,  (B- --> ^(D0 --> K- pi+ (pi0 --> gamma gamma)) pi- )]',
        'K0':
        '[(B+ --> (D0 --> ^K+ pi- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> ^K- pi+ (pi0 --> gamma gamma)) pi- )]',
        'P0':
        '[(B+ --> (D0 --> K+ ^pi- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> K- ^pi+ (pi0 --> gamma gamma)) pi- )]',
        'Pi0':
        '[(B+ --> (D0 --> K+ pi- ^(pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> K- pi+ ^(pi0 --> gamma gamma)) pi- )]',
        'Bach':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma gamma)) ^pi+)  ,  (B- --> (D0 --> K- pi+ (pi0 --> gamma gamma)) ^pi- )]',
        'Gamma1':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> ^gamma gamma)) pi+)  ,  (B- --> (D0 --> K- pi+ (pi0 --> ^gamma gamma)) pi- )]',
        'Gamma2':
        '[(B+ --> (D0 --> K+ pi- (pi0 --> gamma ^gamma)) pi+)  ,  (B- --> (D0 --> K- pi+ (pi0 --> gamma ^gamma)) pi- )]'
    })

    dpi_d2pikpi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^K- ^(pi0 --> ^gamma ^gamma)) ^pi+)  ,  (B- --> ^(D0 --> ^pi- ^K+ ^(pi0 --> ^gamma ^gamma)) ^pi-)]'
    dpi_d2pikpi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) pi+ )  ,  (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) pi-  )]',
        'D0':
        '[(B+ --> ^(D0 --> pi+ K- (pi0 --> gamma gamma)) pi+)  ,  (B- --> ^(D0 --> pi- K+ (pi0 --> gamma gamma)) pi-)]',
        'P0':
        '[(B+ --> (D0 --> ^pi+ K- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> ^pi- K+ (pi0 --> gamma gamma)) pi-)]',
        'K0':
        '[(B+ --> (D0 --> pi+ ^K- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> pi- ^K+ (pi0 --> gamma gamma)) pi-)]',
        'Pi0':
        '[(B+ --> (D0 --> pi+ K- ^(pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> pi- K+ ^(pi0 --> gamma gamma)) pi-)]',
        'Bach':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma gamma)) ^pi+)  ,  (B- --> (D0 --> pi- K+ (pi0 --> gamma gamma)) ^pi-)]',
        'Gamma1':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> ^gamma gamma)) pi+)  ,  (B- --> (D0 --> pi- K+ (pi0 --> ^gamma gamma)) pi-)]',
        'Gamma2':
        '[(B+ --> (D0 --> pi+ K- (pi0 --> gamma ^gamma)) pi+)  ,  (B- --> (D0 --> pi- K+ (pi0 --> gamma ^gamma)) pi-)]'
    })

    dpi_d2kkpi0.Decay = '[(B+ --> ^(D0 --> ^K+ ^K- ^(pi0 --> ^gamma ^gamma)) ^pi+)  ,  (B- --> ^(D0 --> ^K- ^K+ ^(pi0 --> ^gamma ^gamma)) ^pi-)]'
    dpi_d2kkpi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) pi+ )  ,  (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) pi-  )]',
        'D0':
        '[(B+ --> ^(D0 --> K+ K- (pi0 --> gamma gamma)) pi+)  ,  (B- --> ^(D0 --> K- K+ (pi0 --> gamma gamma)) pi-)]',
        'K0':
        '[(B+ --> (D0 --> ^K+ K- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> ^K- K+ (pi0 --> gamma gamma)) pi-)]',
        'K1':
        '[(B+ --> (D0 --> K+ ^K- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> K- ^K+ (pi0 --> gamma gamma)) pi-)]',
        'Pi0':
        '[(B+ --> (D0 --> K+ K- ^(pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> K- K+ ^(pi0 --> gamma gamma)) pi-)]',
        'Bach':
        '[(B+ --> (D0 --> K+ K- (pi0 --> gamma gamma)) ^pi+)  ,  (B- --> (D0 --> K- K+ (pi0 --> gamma gamma)) ^pi-)]',
        'Gamma1':
        '[(B+ --> (D0 --> K+ K- (pi0 --> ^gamma gamma)) pi+)  ,  (B- --> (D0 --> K- K+ (pi0 --> ^gamma gamma)) pi-)]',
        'Gamma2':
        '[(B+ --> (D0 --> K+ K- (pi0 --> gamma ^gamma)) pi+)  ,  (B- --> (D0 --> K- K+ (pi0 --> gamma ^gamma)) pi-)]'
    })

    dpi_d2pipipi0.Decay = '[(B+ --> ^(D0 --> ^pi+ ^pi- ^(pi0 --> ^gamma ^gamma)) ^pi+)  ,  (B- --> ^(D0 --> ^pi- ^pi+ ^(pi0 --> ^gamma ^gamma)) ^pi- )]'
    dpi_d2pipipi0.addBranches({
        'Bu':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) pi+ )  ,  (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) pi-  )]',
        'D0':
        '[(B+ --> ^(D0 --> pi+ pi- (pi0 --> gamma gamma)) pi+)  ,  (B- --> ^(D0 --> pi- pi+ (pi0 --> gamma gamma)) pi- )]',
        'P0':
        '[(B+ --> (D0 --> ^pi+ pi- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> ^pi- pi+ (pi0 --> gamma gamma)) pi- )]',
        'P1':
        '[(B+ --> (D0 --> pi+ ^pi- (pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> pi- ^pi+ (pi0 --> gamma gamma)) pi- )]',
        'Pi0':
        '[(B+ --> (D0 --> pi+ pi- ^(pi0 --> gamma gamma)) pi+)  ,  (B- --> (D0 --> pi- pi+ ^(pi0 --> gamma gamma)) pi- )]',
        'Bach':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma gamma)) ^pi+)  ,  (B- --> (D0 --> pi- pi+ (pi0 --> gamma gamma)) ^pi- )]',
        'Gamma1':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> ^gamma gamma)) pi+)  ,  (B- --> (D0 --> pi- pi+ (pi0 --> ^gamma gamma)) pi- )]',
        'Gamma2':
        '[(B+ --> (D0 --> pi+ pi- (pi0 --> gamma ^gamma)) pi+)  ,  (B- --> (D0 --> pi- pi+ (pi0 --> gamma ^gamma)) pi- )]'
    })

    #========================================#
    #=== Setup LoKi variables to be added ===#
    #========================================#
    #=== Added to all branches ===#
    LoKiVars = {
        "Q": "Q",
        "DIRA_BPV": "BPVDIRA",
        "MAXDOCA": "DOCAMAX",
        "AMAXDOCA": "PFUNA(AMAXDOCA(''))",
        "MIPCHI2_PV": "MIPCHI2DV(PRIMARY)",
        "VTXCHI2DOF": "VFASPF(VCHI2/VDOF)",
        "LT_BPV": "BPVLTIME('PropertimeFitter/ProperTime::PUBLIC')",
    }

    if data:
        #=== Added only to B2DK channels ===#
        LoKiVars_K = {
            "ptasy_1.50":
            "RELINFO('/Event/Bhadron/Phys/B2D0KD2Pi0HHResolvedBeauty2CharmLine/P2ConeVar1','CONEPTASYM',-1000.)"
        }

        #=== Added only to B2DPi channels ===#
        LoKiVars_Pi = {
            "ptasy_1.50":
            "RELINFO('/Event/Bhadron/Phys/B2D0PiD2Pi0HHResolvedBeauty2CharmLine/P2ConeVar1','CONEPTASYM',-1000.)"
        }

    #============================================#
    #=== Add tuple tools to relevent branches ===#
    #============================================#

    #=== Needed for new MC which has "turbo" in LFN path name ===#
    default_rel_locs = MCMatchObjP2MCRelator().getDefaultProperty(
        'RelTableLocations')
    rel_locs = [loc for loc in default_rel_locs if 'Turbo' not in loc]

    if not data:
        etuple.addTupleTool("TupleToolGeneration")
        etuple.addTupleTool("TupleToolTrigger")

    for channel in channels:
        #=== Added to all branches ===#
        channel.ToolList += [
            "TupleToolAngles", "TupleToolEventInfo", "TupleToolGeometry",
            "TupleToolKinematic", "TupleToolPid", "TupleToolPrimaries",
            "TupleToolPropertime", "TupleToolRecoStats", "TupleToolTrackInfo"
        ]

        if not data:
            ttMCt = channel.addTupleTool("TupleToolMCTruth")
            ttMCt.addTool(MCMatchObjP2MCRelator)
            ttMCt.MCMatchObjP2MCRelator.RelTableLocations = rel_locs

        channel.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
        channel.LoKi_All.Variables = LoKiVars

        #=== Neutral variables added to photons from pi0 decay ===#
        channel.Gamma1.addTupleTool("TupleToolPhotonInfo")
        channel.Gamma1.addTupleTool("TupleToolCaloHypo")
        channel.Gamma1.addTupleTool("TupleToolProtoPData/ProtoPData")
        channel.Gamma1.ProtoPData.DataList = ["IsNotE"]

        channel.Gamma2.addTupleTool("TupleToolPhotonInfo")
        channel.Gamma2.addTupleTool("TupleToolCaloHypo")
        channel.Gamma2.addTupleTool("TupleToolProtoPData/ProtoPData")
        channel.Gamma2.ProtoPData.DataList = ["IsNotE"]

        #=== Add Pi0 information ===#
        channel.Pi0.addTupleTool("TupleToolPi0Info")
        channel.Pi0.addTupleTool("TupleToolCaloHypo")

        #=== Trigger information added to Bu ===#
        channel.Bu.addTupleTool("TupleToolTISTOS")
        channel.Bu.TupleToolTISTOS.Verbose = True
        # Trigger names changed with runs!
        TriggerListL0 = ["L0HadronDecision"]
        TriggerListHlt1 = []
        TriggerListHlt2 = []

        if year == '2011' or year == '2012':
            TriggerListHlt1 = ["Hlt1TrackAllL0Decision"]
            TriggerListHlt2 = [
                "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision",
                "Hlt2Topo4BodyBBDTDecision"
            ]

        if year == '2015' or year == '2016' or year == '2017':
            TriggerListHlt1 = [
                "Hlt1TrackMVADecision", "Hlt1TwoTrackMVADecision"
            ]
            TriggerListHlt2 = [
                "Hlt2Topo2BodyDecision", "Hlt2Topo3BodyDecision",
                "Hlt2Topo4BodyDecision"
            ]

        AllTriggers = TriggerListL0 + TriggerListHlt1 + TriggerListHlt2
        channel.Bu.TupleToolTISTOS.TriggerList = AllTriggers

        #=== Kinematic refit of Bu based on fixing D0 mass and fixing origin vertex ===#
        #=== DPVCFIT = D0 (mass), primary vertex constrained fit ===#
        channel.Bu.addTupleTool("TupleToolDecayTreeFitter/DPVCFIT")
        channel.Bu.DPVCFIT.constrainToOriginVertex = True
        channel.Bu.DPVCFIT.Verbose = True
        channel.Bu.DPVCFIT.daughtersToConstrain = ["D0"]
        channel.Bu.DPVCFIT.UpdateDaughters = True

        #=== Add branches which are exclusive to MC data ===#
        if not data:
            channel.ToolList += ["TupleToolMCBackgroundInfo"]
            ttMCt.ToolList = [
                "MCTupleToolDecayType", "MCTupleToolHierarchy",
                "MCTupleToolKinematic", "MCTupleToolReconstructed"
            ]

            #=== Add ptasy_1.50 variable ===#
            channel.addTupleTool("TupleToolTrackIsolation/ttti")
            channel.ttti.FillAsymmetry = True
            channel.ttti.MinConeAngle = 1.5
            channel.ttti.MaxConeAngle = 1.5

    #=== Add ptasy_1.50 variable for data ===#
    if data:
        for channel in k_chans:
            channel.Bu.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bu")
            channel.Bu.LoKi_Bu.Variables = dict(LoKiVars.items() +
                                                LoKiVars_K.items())
            channel.Pi0.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Pi0")
            channel.Pi0.LoKi_Pi0.Variables = dict(LoKiVars.items() +
                                                  LoKiVars_K.items())
            channel.Gamma1.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma1")
            channel.Gamma1.LoKi_Gamma1.Variables = dict(LoKiVars.items() +
                                                        LoKiVars_K.items())
            channel.Gamma2.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma2")
            channel.Gamma2.LoKi_Gamma2.Variables = dict(LoKiVars.items() +
                                                        LoKiVars_K.items())

        for channel in pi_chans:
            channel.Bu.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Bu")
            channel.Bu.LoKi_Bu.Variables = dict(LoKiVars.items() +
                                                LoKiVars_Pi.items())
            channel.Pi0.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Pi0")
            channel.Pi0.LoKi_Pi0.Variables = dict(LoKiVars.items() +
                                                  LoKiVars_Pi.items())
            channel.Gamma1.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma1")
            channel.Gamma1.LoKi_Gamma1.Variables = dict(LoKiVars.items() +
                                                        LoKiVars_Pi.items())
            channel.Gamma2.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Gamma2")
            channel.Gamma2.LoKi_Gamma2.Variables = dict(LoKiVars.items() +
                                                        LoKiVars_Pi.items())

    #==============================#
    #=== Finalise configuration ===#
    #==============================#
    #=== Set database tags ===#
    from Configurables import CondDB
    if data:
        CondDB(LatestGlobalTagByDataType=year)

    #=== Configure DaVinci ===#

    if data:
        DaVinci().RootInTES = '/Event/{0}'.format(stream)
        DaVinci().appendToMainSequence([scaler])
        DaVinci().EventPreFilters = fltrs.filters('Filters')
        channels += [etuple]
        DaVinci().UserAlgorithms += channels

    #=== Input type for 2012 MC is DST, but all data is MDST ===#
    if data:
        DaVinci().InputType = 'MDST'
        DaVinci(
        ).TupleFile = prefix + '_Bu2DH_AllModes_' + year + '_Mag' + mag + '.root'
    if not data:
        DaVinci(
        ).TupleFile = prefix + '_Bu2' + mode + '_' + year + '_Mag' + mag + '.root'
        if year == "2012" or year == "2011":
            DaVinci().InputType = 'DST'
        else:
            DaVinci().InputType = 'MDST'
            DaVinci().RootInTES = '/Event/{0}'.format(stream)

    DaVinci().PrintFreq = 1000
    DaVinci().DataType = year
    DaVinci().Simulation = not data
    DaVinci().Lumi = not DaVinci().Simulation
    DaVinci().EvtMax = -1
    DaVinci().RootCompressionLevel = 'ZLIB:1'

    #=======================================================#
    #=== Set database tags! Only needs to be done for MC ===#
    #=======================================================#
    if not data:
        #=== D --> K Pi Pi0 ===#
        if mode == "DK_D2KPiPi0" or mode == "DPi_D2KPiPi0":
            if year == "2012":
                if mag == 'Up':
                    DaVinci().CondDBtag = 'sim-20160321-2-vc-mu100'
                if mag == 'Down':
                    DaVinci().CondDBtag = 'sim-20160321-2-vc-md100'
                    DaVinci().DDDBtag = 'dddb-20150928'
            if year == "2015":
                if mag == 'Up':
                    DaVinci().CondDBtag = 'sim-20161124-vc-mu100'
                if mag == 'Down':
                    DaVinci().CondDBtag = 'sim-20161124-vc-md100'
            DaVinci().DDDBtag = 'dddb-20170721-3'

        #=== D --> Pi Pi Pi0 ===#
        if mode == "DK_D2PiPiPi0" or mode == "DPi_D2PiPiPi0":
            if year == "2012":
                if mag == 'Up':
                    DaVinci().CondDBtag = 'sim-20130522-1-vc-mu100'
                if mag == 'Down':
                    DaVinci().CondDBtag = 'sim-20130522-1-vc-md100'
            DaVinci().DDDBtag = 'dddb-20130929-1'
        #=== D --> K K Pi0 ===#
        if mode == "DK_D2KKPi0" or mode == "DPi_D2KKPi0":
            if year == "2012":
                if mag == 'Up':
                    DaVinci().CondDBtag = 'sim-20130522-1-vc-mu100'
                if mag == 'Down':
                    DaVinci().CondDBtag = 'sim-20130522-1-vc-md100'
            DaVinci().DDDBtag = 'dddb-20130929-1'

    return
# Only ask for luminosity information when not using simulated data
DaVinci().EvtMax = -1
DaVinci().CondDBtag = 'sim-20130522-vc-md100'
DaVinci().DDDBtag = 'dddb-20130929'
#MessageSvc().OutputLevel = DEBUG

# Create an ntuple to capture B decays from the StrippingLine line
dtt = DecayTreeTuple('Bu2LLK_ee')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)]
#dtt.Decay = '[B0 -> K*(892)0  e- e+]CC'
dtt.Decay = '[B0 -> ^K*(892)0 ^(J/psi(1S) -> ^e- ^e+ )]CC'

#dtt.addBranches({'B0'    : '[B0 -> K*(892)0 e- e+]CC',
#                 'Kstar' : '[B0 -> ^K*(892)0 e- e+]CC',
#                 'eplus' : '[B0 -> K*(892)0 ^e- e+]CC',
#                 'eminus': '[B0 -> K*(892)0 e- ^e+]CC'})
dtt.addBranches({'B0'    : '[^(B0 -> K*(892)0 (J/psi(1S) -> e- e+ ))]CC',
                 'Kst_892_0' : '[B0 -> ^K*(892)0 (J/psi(1S) -> e- e+ )]CC',
                 'E1' : '[B0 -> K*(892)0 (J/psi(1S) -> ^e- e+ )]CC',
                 'E2': '[B0 -> K*(892)0 (J/psi(1S) -> e- ^e+ )]CC',
                 'JPs': '[B0 -> K*(892)0 ^(J/psi(1S) -> e- e+ )]CC'})

b0_hybrid = dtt.B0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_B0')

b0_hybrid.Variables = {
    'hop_mass': 'BPVHOPM',
    'corr_mass': 'BPVCORRM'
}

DaVinci().UserAlgorithms += [dtt]
    NTupleLUN="DTT",
    ## input particles from selection:
    Inputs=[particlePath],
    ## Primary vertices from mDST
    P2PVInputLocations=[p2PVLocation],
    UseP2PVRelations=True,
    WriteP2PVRelations=False,
)

dtt.Decay = "B_s0 -> (^J/psi(1S) => ^mu+ ^mu-) (^phi(1020) -> ^K+ ^K-)"
if mDST: dtt.RootInTES = locationRoot

from DecayTreeTuple.Configuration import *
## Add appropriate tools

dtt.addBranches(
    {"B": "B_s0 : B_s0 -> (J/psi(1S) => mu+ mu-) (phi(1020) -> K+ K-)"})

dtt.B.addTupleTool('TupleToolPropertime')
ttsi = dtt.B.addTupleTool('TupleToolSwimmingInfo/TriggerInfo')
ttsis = dtt.B.addTupleTool('TupleToolSwimmingInfo/StrippingInfo')
ttsi.ReportsLocation = selectionPath + '/P2TPRelations'
ttsis.ReportsLocation = selectionPath + '/P2TPRelations'
ttsis.ReportStage = "Stripping"

tttt = dtt.B.addTupleTool('TupleToolTISTOS')
tttt.TriggerList = [
    'Hlt1TrackAllL0Decision', 'Hlt1TrackMuonDecision',
    'Hlt1DiMuonHighMassDecision', 'Hlt2DiMuonDetachedJpsiDecision',
    'Hlt2DiMuonJpsiDecision'
]
tttt.VerboseHlt1 = True
DstConf().Turbo = True 

#Do not line below when data from 2015

TurboConf().PersistReco=True


turbo_loc = '/Event/Turbo/{0}/Particles'
dz_line = 'Hlt2CharmHadD02KmPipTurbo'

dtt = DecayTreeTuple('TupleD0ToKpi')
dtt.Inputs = [turbo_loc.format(dz_line)]
dtt.Decay = '[D0 -> K- pi+]CC'
dtt.addBranches({
    'D0': '[D0 -> K- pi+]CC'
})

dz=DataOnDemand(turbo_loc.format(dz_line))
pions = DataOnDemand('Phys/StdAllNoPIDsPions/Particles')


dst = CombineParticles('DstToD0pi',
                        DecayDescriptors=['[D*(2010)+ -> D0 pi+]cc'],
                        CombinationCut=("AM - ACHILD(M,1) < 800*MeV"),
                        MotherCut="(VFASPF(VCHI2/VDOF) < 6)") 

dst_sel = Selection(
    'Sel_DstToD0pi',
    Algorithm=dst,
    RequiredSelections=[dz, pions]
# Run fixing XmumuLine
#---------------------------
from Configurables import NeutrinoBuildTupleTool, PromptNeutrinoTupleTool

tuple = DecayTreeTuple('PromptNeutrinoTupleTool')
tuple.OutputLevel = INFO

stream = 'AllStreams'
stripping_line = 'B2XMuMu_Line'

tuple.Inputs = [StripSel1.outputLocation()]
tuple.Decay = "[B+  -> ^( J/psi(1S)  -> ^mu-  ^mu+ ) ^pi+]CC"
tuple.addBranches({
    "B"       : "[B+ -> ( J/psi(1S)  -> mu-  mu+ ) pi+ ]CC",
    "Jpsi"    : "[B+ -> ^(J/psi(1S)  -> mu-  mu+) pi+]CC",
    "mu_prim" : "[B+ -> (J/psi(1S) -> mu- ^mu+) pi+]CC",
    "mu_sec"  : "[B+ -> (J/psi(1S) -> ^mu- mu+) pi+]CC",
    "pi"      : "[B+ -> (J/psi(1S) -> mu- mu+) ^pi+]CC",
    })

tuple.ToolList = [
    "TupleToolKinematic",
    "TupleToolPid",
    "TupleToolGeometry",
    "TupleToolPrimaries",
    "TupleToolTrackInfo",
    "TupleToolEventInfo",
    "TupleToolIsolationTwoBody",
    "TupleToolRecoStats",
    "TupleToolAngles",
    "TupleToolANNPID",
Exemple #18
0
LHCbApp().CondDBtag = 'sim-20190430-1-vc-mu100'
LHCbApp().Simulation = True

stream = "AllStreams"  # MC: AllStreams
strip = "Bu2LLK_eeLine2"

tup = DecayTreeTuple('Bd_Kstee')
#tup.Decay = '[[B0]CC -> ^(J/psi(1S) -> ^e+ ^e-) ^(K*(892)0 -> ^K+ ^pi-)]CC'
tup.Decay = '[[B0]CC -> (J/psi(1S) -> e+ ^e-) (K*(892)0 -> K+ pi-)]CC'
tup.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, strip)]
tup.addBranches({
    'B0':
    '[[B0]CC -> (J/psi(1S) -> e+ e-) (K*(892)0 -> K+ pi-)]CC',
    #'Kaon'  : '[[B0]CC -> (J/psi(1S) -> e+ e-) (K*(892)0 -> ^K+ pi-)]CC',
    #'Pion'  : '[[B0]CC -> (J/psi(1S) -> e+ e-) (K*(892)0 -> K+ ^pi-)]CC',
    #'Kstar' : '[[B0]CC -> (J/psi(1S) -> e+ e-) ^(K*(892)0 -> K+ pi-)]CC',
    #'Jpsi'  : '[[B0]CC -> ^(J/psi(1S) -> e+ e-) (K*(892)0 -> K+ pi-)]CC',
    #'eplus' : '[[B0]CC -> (J/psi(1S) -> ^e+ e-) (K*(892)0 -> K+ pi-)]CC',
    'eminus':
    '[[B0]CC -> (J/psi(1S) -> e+ ^e-) (K*(892)0 -> K+ pi-)]CC'
})

tup.ToolList = []
tup.addTupleTool("TupleToolPrimaries")
tup.addTupleTool("TupleToolEventInfo")
tup.addTupleTool("TupleToolCaloInfo")  # (custom) dump of ECAL clusters
tup.eminus.addTupleTool("TupleToolKinematic")
tup.eminus.addTupleTool("TupleToolPid")
tup.eminus.addTupleTool("TupleToolGeometry")
tup.eminus.addTupleTool("TupleToolTrackInfo")
tup.eminus.addTupleTool("TupleToolBremInfo")  # Brem adder information
stream = "AllStreams"
line = "D2hhCompleteEventPromptDst2D2RSLine"

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple("TupleDstToD0pi_D0ToKpi")
dtt.Inputs = ["/Event/{0}/Phys/{1}/Particles".format(stream, line)]
dtt.Decay = "[D*(2010)+ -> (D0 -> K- pi+) pi+]CC"
track_tool = dtt.addTupleTool("TupleToolTrackInfo")
track_tool.Verbose = True
dtt.addTupleTool("TupleToolPrimaries")

dtt.addBranches(
    {
        "Dstar": "[D*(2010)+ -> (D0 -> K- pi+) pi+]CC",
        "D0": "[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC",
        "Kminus": "[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC",
        "piplus": "[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC",
        "pisoft": "[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC",
    }
)

dtt.D0.addTupleTool("TupleToolPropertime")

# Configure DaVinci
DaVinci().UserAlgorithms += [dtt]
DaVinci().InputType = "DST"
DaVinci().TupleFile = "DVntuple.root"
DaVinci().PrintFreq = 1000
DaVinci().DataType = "2012"
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
# pions (test)
#tuple_pions = DecayTreeTuple( 'pions' )
#tuple_pions.Decay = '[pi+]CC'
#tuple_pions.Inputs = ["Phys/StdAllLoosePions/Particles"]
#tuple_pions.addTool(TupleToolDecay, name="Pi")

# (prompt) Lc -> p K pi
stream = "AllStreams"
tuple_Lc2pKpi = DecayTreeTuple('tuple_Lc2pKpi')
tuple_Lc2pKpi.Inputs = [
    '/Event/{0}/Phys/{1}/Particles'.format(stream, line) for line in lines
]
tuple_Lc2pKpi.Decay = '[Lambda_c+ -> ^p+ ^K- ^pi+]CC'
tuple_Lc2pKpi.addBranches({
    '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'
})
#tuple_Lc2pKpi.setDescriptorTemplate('${lcplus}[Lambda_c+ -> ${pplus}p+ ${kminus}K- ${piplus}pi+]CC') # new setup, replaces Decay and addBranches
# add DecayTreeFitter tool to constrain origin to PV and refit kinematics
dtftool = tuple_Lc2pKpi.lcplus.addTupleTool(
    'TupleToolDecayTreeFitter/PVConstrainedDTF')
dtftool.constrainToOriginVertex = True

# Build combinations ourselves instead of depending on stripping output.
if (Turbo):
    from PhysConf.Selections import AutomaticData
    Pions = AutomaticData('Phys/StdAllNoPIDsPions/Particles')
    Kaons = AutomaticData('Phys/StdAllLooseKaons/Particles')
    Protons = AutomaticData('Phys/StdAllLooseProtons/Particles')
TurboConf().PersistReco = True

pions = DataOnDemand('Phys/StdAllNoPIDsPions/Particles')
ks0 = CombineParticles('Ks0Topipi',
                        DecayDescriptors=['[KS0 -> pi+ pi+]cc'],
                        CombinationCut=("AM < 320*MeV"), #parent
                        MotherCut="ALL")
ks0_sel = Selection(
    'Sel_Ks0Topipi',
    Algorithm=ks0,
    RequiredSelections=[pions]
)
ks0_selseq = SelectionSequence(
    'SelSeq_Ks0Topipi',
    TopSelection=ks0_sel
)

dtt_ks0 = DecayTreeTuple('TupleKs0Topipi')
dtt_ks0.Inputs = ks0_selseq.outputLocations()
dtt_ks0.Decay = '[KS0 -> ^pi+ ^pi+]CC'
dtt_ks0.addBranches({
    'Ks0': '[KS0 -> pi+ pi+]CC',
    'pi1': '[KS0 -> ^pi+ pi+]CC',
    'pi2': '[KS0 -> pi+ ^pi+]CC'
})

DaVinci().UserAlgorithms = [ks0_selseq.sequence(), dtt_ks0]
DaVinci().DataType = '2016'
DaVinci().EvtMax = 1000
DaVinci().TupleFile = 'PersistRecoTuple_ks0_pipi.root'
Exemple #22
0
tuple.addTool(TupleToolPid, name="TupleToolPid")
tuple.TupleToolPid.Verbose = True

#tuple.UseLabXSyntax = True

#tuple.Decay = " [B0 -> ^[ D0 -> ^K- ^pi+ ]CC ^[ K*(892)0 -> ^K+ ^pi- ]CC]CC "
#tuple.Decay = " [B0 -> ^(D0 -> ^K- ^pi+) ^(K*(892)0 -> ^K+ ^pi-) ]CC "
tuple.Decay = "[B0 -> ^( D0 -> ^K+ ^K- ) [^( K*(892)0 -> ^K+ ^pi- )]CC ]CC "
tuple.addBranches({
    "B":
    " [B0 ->  ( D0 ->  K+  K- ) [ ( K*(892)0 ->  K+  pi- )]CC ]CC ",
    "D":
    " [B0 -> ^( D0 ->  K+  K- ) [ ( K*(892)0 ->  K+  pi- )]CC ]CC ",
    "D0p":
    " [B0 ->  ( D0 -> ^K+  K- ) [ ( K*(892)0 ->  K+  pi- )]CC ]CC ",
    "D0m":
    " [B0 ->  ( D0 ->  K+ ^K- ) [ ( K*(892)0 ->  K+  pi- )]CC ]CC ",
    "K":
    " [B0 ->  ( D0 ->  K+  K- ) [ ( K*(892)0 -> ^K+  pi- )]CC ]CC ",
    "pi":
    " [B0 ->  ( D0 ->  K+  K- ) [ ( K*(892)0 ->  K+ ^pi- )]CC ]CC ",
    "Kst":
    " [B0 ->  ( D0 ->  K+  K- ) [^( K*(892)0 ->  K+  pi- )]CC ]CC "
})

tuple.addTupleTool("TupleToolTISTOS/TupleToolTISTOS")
tuple.TupleToolTISTOS.VerboseL0 = True
tuple.TupleToolTISTOS.VerboseHlt1 = True
tuple.TupleToolTISTOS.VerboseHlt2 = True
tuple.TupleToolTISTOS.TriggerList = myTriggerList

#Add Loki variables
Exemple #23
0
if IsMC:
    tuple.addTool(TupleToolTrackIsolation, name="TupleToolTrackIsolation")
    tuple.TupleToolTrackIsolation.Verbose = True
    tuple.ToolList+=["TupleToolTrackIsolation/TupleToolTrackIsolation"]

tuple.Decay = "[B0 -> ^(phi(1020) -> ^K+ ^K-) ^(rho(770)0 -> ^pi+ ^pi-)]CC"
if myDecayType == 1:
  tuple.Decay = "[B_s0 -> ^(phi(1020) -> ^K+ ^K-) ^(rho(770)0 -> ^pi+ ^pi-)]CC"
elif myDecayType ==2 :
  tuple.Decay = "[B_s0 -> ^(phi(1020) -> ^K+ ^K-) ^(f_0(980) -> ^pi+ ^pi-)]CC"
elif myDecayType == 3:
  tuple.Decay = "[B_s0 -> ^(phi(1020) -> ^K+ ^K-) ^(phi(1020) -> ^K+ ^K-)]CC"

if myDecayType == 1:
    tuple.addBranches({
       "Bs" : "^([B_s0 -> (phi(1020) -> K+ K-) (rho(770)0 -> pi+ pi-)]CC)",
       "f0" : " [B_s0 -> (phi(1020) -> K+ K-) ^(rho(770)0 -> pi+ pi-)]CC "
    })
elif myDecayType == 2:
    tuple.addBranches({
       "Bs" : "^([B_s0 -> (phi(1020) -> K+ K-) (f_0(980) -> pi+ pi-)]CC)",
       "f0" : " [B_s0 -> (phi(1020) -> K+ K-) ^(f_0(980) -> pi+ pi-)]CC "
    })
elif myDecayType == 3:
    tuple.addBranches({
       "Bs" : "^([B_s0 -> (phi(1020) -> K+ K-) (phi(1020) -> K+ K-)]CC)",
       "f0" : " [B_s0 -> (phi(1020) -> K+ K-) ^(phi(1020) -> K+ K-)]CC ",
       "piplus" : " [B_s0 -> (phi(1020) -> K+ K-) (phi(1020) -> ^K+ K-)]CC ",
       "piminus" : " [B_s0 -> (phi(1020) -> K+ K-) (phi(1020) -> K+ ^K-)]CC "
    })
else:
    tuple.addBranches({
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().EvtMax = -1
DaVinci().CondDBtag = 'sim-20130522-vc-md100'
DaVinci().DDDBtag = 'dddb-20130929'
#MessageSvc().OutputLevel = DEBUG

# Create an ntuple to capture B decays from the StrippingLine line
dtt = DecayTreeTuple('Bu2LLK_ee')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)]
#dtt.Decay = '[B0 -> K*(892)0  e- e+]CC'
dtt.Decay = '[B0 -> ^K*(892)0 ^(J/psi(1S) -> ^e- ^e+ )]CC'

#dtt.addBranches({'B0'    : '[B0 -> K*(892)0 e- e+]CC',
#                 'Kstar' : '[B0 -> ^K*(892)0 e- e+]CC',
#                 'eplus' : '[B0 -> K*(892)0 ^e- e+]CC',
#                 'eminus': '[B0 -> K*(892)0 e- ^e+]CC'})
dtt.addBranches({
    'B0': '[^(B0 -> K*(892)0 (J/psi(1S) -> e- e+ ))]CC',
    'Kst_892_0': '[B0 -> ^K*(892)0 (J/psi(1S) -> e- e+ )]CC',
    'E1': '[B0 -> K*(892)0 (J/psi(1S) -> ^e- e+ )]CC',
    'E2': '[B0 -> K*(892)0 (J/psi(1S) -> e- ^e+ )]CC',
    'JPs': '[B0 -> K*(892)0 ^(J/psi(1S) -> e- e+ )]CC'
})

b0_hybrid = dtt.B0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_B0')

b0_hybrid.Variables = {'hop_mass': 'BPVHOPM', 'corr_mass': 'BPVCORRM'}

DaVinci().UserAlgorithms += [dtt]
Exemple #25
0
    '/Event/AllStreams/Phys/BetaSPsi2SMuMu_Bs2Psi2SPhiMuMuDetatchedLine/Particles'
]

tuple.ToolList = [
    "TupleToolKinematic", "TupleToolEventInfo", "TupleToolRecoStats",
    "TupleToolMCTruth", "TupleToolMCBackgroundInfo"
]

tuple.addBranches({
    "Kplus":
    "[B_s0 ->  (psi(2S) ->  mu+  mu-)  (phi(1020) -> ^K+  K-)]CC",
    "Kminus":
    "[B_s0 ->  (psi(2S) ->  mu+  mu-)  (phi(1020) ->  K+ ^K-)]CC",
    "muplus":
    "[B_s0 ->  (psi(2S) -> ^mu+  mu-)  (phi(1020) ->  K+  K-)]CC",
    "muminus":
    "[B_s0 ->  (psi(2S) ->  mu+ ^mu-)  (phi(1020) ->  K+  K-)]CC",
    "psi":
    "[B_s0 -> ^(psi(2S) ->  mu+  mu-)  (phi(1020) ->  K+  K-)]CC",
    "phi":
    "[B_s0 ->  (psi(2S) ->  mu+  mu-) ^(phi(1020) ->  K+  K-)]CC",
    "B_s0":
    "[B_s0 ->  (psi(2S) ->  mu+  mu-)  (phi(1020) ->  K+  K-)]CC",
})

LoKi_All = tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
    'MINIPCHI2': "MIPCHI2DV(PRIMARY)",
    'MINIP': "MIPDV(PRIMARY)",
    'IPCHI2_OWNPV': "BPVIPCHI2()",
    'IP_OWNPV': "BPVIP()"
}
Exemple #26
0
    ## input particles from selection:
    Inputs = [ '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/Particles' ],
    ## Primary vertices from mDST
    P2PVInputLocations = [ '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/Particle2VertexRelations'],
    UseP2PVRelations = True,
    WriteP2PVRelations = False,
    Decay = "[[D0]cc -> ^K- ^pi+]cc"
    )

from DecayTreeTuple.Configuration import *
## Add appropriate tools
from Configurables import EventNodeKiller
killer=EventNodeKiller( Nodes = ["/Event/DAQ","/Event/pRec"] ) 

dtt.addBranches({
    "D" : "[D0]cc : [[D0]cc -> K- pi+]cc"
})

dtt.D.addTupleTool('TupleToolPropertime')
ttsi = dtt.D.addTupleTool('TupleToolSwimmingInfo/TriggerInfo')
ttsis = dtt.D.addTupleTool('TupleToolSwimmingInfo/StrippingInfo')
ttsi.ReportsLocation = '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/P2TPRelations'
ttsis.ReportsLocation = '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/P2TPRelations'
ttsis.ReportStage = "Stripping"

tttt = dtt.D.addTupleTool('TupleToolTISTOS')
tttt.TriggerList = ['Hlt1TrackAllL0Decision', 'Hlt2CharmHadD02HH_D02KPiDecision']
tttt.VerboseHlt1 = True
tttt.VerboseHlt2 = True

dv = DaVinci()
# Stream and stripping line we want to use
stream = 'AllStreams'
line = 'D2hhCompleteEventPromptDst2D2RSLine'

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)]
dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC'
track_tool = dtt.addTupleTool('TupleToolTrackInfo')
track_tool.Verbose = True
dtt.addTupleTool('TupleToolPrimaries')

dtt.addBranches({
    'Dstar': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC',
    'D0': '[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC',
    'Kminus': '[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC',
    'piplus': '[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC',
    'pisoft': '[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC'
})

dtt.D0.addTupleTool('TupleToolPropertime')

# Configure DaVinci
DaVinci().UserAlgorithms += [dtt]
DaVinci().InputType = 'DST'
DaVinci().TupleFile = 'DVntuple.root'
DaVinci().PrintFreq = 1000
DaVinci().DataType = '2012'
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().Lumi = not DaVinci().Simulation
#---------------------------
# Configure lines and Decay
#---------------------------
tuple = DecayTreeTuple('DetachedN')
TupleInputs = []
for line in B2Lambda0MuLines:
    TupleInputs.append(line.outputLocation())
tuple.Inputs = TupleInputs

tuple.OutputLevel = INFO

tuple.Decay = "[B- -> ^(Lambda0 -> ^mu- ^pi+) ^mu-]CC"
tuple.addBranches({
    "B": "[B- -> (Lambda0 -> mu- pi+) mu-]CC",
    "N": "[B- -> ^(Lambda0 -> mu- pi+) mu-]CC",
    "mu_prim": "[B- -> (Lambda0 -> mu- pi+) ^mu-]CC",
    "mu_sec": "[B- -> (Lambda0 -> ^mu- pi+) mu-]CC",
    "pi": "[B- -> (Lambda0 -> mu- ^pi+) mu-]CC"
})

#---------------------------
# Define nTuple Variables
#---------------------------

tuple.ToolList = [
    "TupleToolKinematic",
    "TupleToolPid",
    "TupleToolGeometry",
    "TupleToolPrimaries",
    "TupleToolTrackInfo",
    "TupleToolEventInfo",
tuple.Lambda_b0.NoPVFit.Verbose=True
tuple.Lambda_b0.NoPVFit.constrainToOriginVertex=False
tuple.Lambda_b0.NoPVFit.daughtersToConstrain = ["eta","p+","K-"]

#========================================REFIT WITH NOTHING CONSTRAINED========================================
tuple.Lambda_b0.addTupleTool('TupleToolDecayTreeFitter/Consnothing')
tuple.Lambda_b0.Consnothing.Verbose=True
tuple.Lambda_b0.Consnothing.constrainToOriginVertex=False

#========================================LOKI FUBNCTOR VARIABLES========================================

tuple.addBranches({
    'proton' : '[Lambda_b0 -> ^p+ K- (eta -> pi+ pi- (pi0 -> gamma gamma))]CC',
    'Kminus' : '[Lambda_b0 -> p+ ^K- (eta -> pi+ pi- (pi0 -> gamma gamma))]CC',
    'eta' : '[Lambda_b0 -> p+ K- ^(eta -> pi+ pi- (pi0 -> gamma gamma))]CC',
    'piplus':'[Lambda_b0 -> p+ K- (eta -> ^pi+ pi- (pi0 -> gamma gamma))]CC',
    'piminus':'[Lambda_b0 -> p+ K- (eta -> pi+ ^pi- (pi0 -> gamma gamma))]CC',
    'pi0':'[Lambda_b0 -> p+ K- (eta -> pi+ pi- ^(pi0 -> gamma gamma))]CC',
    'gamma':'[Lambda_b0 -> p+ K- (eta -> pi+ pi- (pi0 -> ^gamma gamma))]CC',
    'gamma0':'[Lambda_b0 -> p+ K- (eta -> pi+ pi- (pi0 -> gamma ^gamma))]CC',
})


from LoKiPhys.decorators import MAXTREE,MINTREE,ISBASIC,HASTRACK,SUMTREE,PT,ABSID,NINTREE,ETA,TRPCHI2
Lambda_b0_hybrid=tuple.Lambda_b0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Lambda_b0')
proton_hybrid=tuple.proton.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_proton')
Kminus_hybrid=tuple.Kminus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Kminus')
eta_hybrid=tuple.eta.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_eta')
piminus_hybrid=tuple.piminus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piminus')
piplus_hybrid=tuple.piplus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piplus')
gamma_hybrid=tuple.gamma.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_gamma')
gamma0_hybrid=tuple.gamma0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_gamma0')
Exemple #30
0
dttuple.Inputs = [ stripOutputLoc ]

print "tuple input :",dttuple.Inputs
print "number of events:", DaVinci().EvtMax

a = "->"

dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^pi+]CC"
branch_definitions = {
  "D"  : "[D+ "+a+" pi- pi+ pi+]CC",
  "pi1": "[D+ "+a+" ^pi- pi+ pi+]CC",
  "pi2": "[D+ "+a+" pi- ^pi+ pi+]CC",
  "pi3": "[D+ "+a+" pi- pi+ ^pi+]CC",
  }
dttuple.addBranches(branch_definitions)

dttuple.TupleName = "DPiPiPi_NTuple"

dttuple.addTool(TupleToolTISTOS())
dttuple.TupleToolTISTOS.VerboseL0 = True
dttuple.TupleToolTISTOS.VerboseHlt1 = True
dttuple.TupleToolTISTOS.VerboseHlt2 = True
dttuple.TupleToolTISTOS.Verbose = True

ttmhk = TupleToolMassHypo("KaonHypo")
ttmhk.PIDReplacements = { "pi+" : "K+"}
#ttmhk.CC = True
dttuple.D.addTool(ttmhk)
dttuple.D.ToolList += ["TupleToolMassHypo/KaonHypo"]
Exemple #31
0
from Configurables import TupleToolPropertime, DecayTreeTuple, TupleToolTISTOS, TupleToolDecayTreeFitter

tupleNames = 'Dst2010ToD0ToKpipipipiTuple', 'Dst2010ToD0ToKKKpipiTuple', \
    'Dst2010ToD0TopipipipipiTuple', 'Dst2010ToD0ToKKpipipiTuple'
for tupleName in tupleNames :
    TupleToolPropertime(tupleName + '.TupleToolPropertime').FitToPV = True
    dtt = DecayTreeTuple(tupleName)
    #dtt.lab0.setName('Dstar')
    #dtt.Branches['Dstar'] = dtt.Branches['lab0']
    #del dtt.Branches['lab0']
    dtt.addBranches({'D0' : dtt.Decay.replace('^', '').replace('(D0', '^(D0')})
    tt_tistos = filter(lambda tool : tool.__class__.__name__ == 'TupleToolTISTOS', dtt.lab0.getTools())[0]
    dtt.D0.addTupleTool(TupleToolTISTOS('D0_TISTOS', TriggerList = tt_tistos.TriggerList,
                                        Verbose = True, VerboseL0 = True, VerboseHlt1 = True, 
                                        VerboseHlt2 = True))
    ttdtf = dtt.lab0.addTupleTool(TupleToolDecayTreeFitter('tt_dtf'))
    ttdtf.Verbose = True
    ttdtfvtx = dtt.lab0.addTupleTool(TupleToolDecayTreeFitter('tt_dtf_vtx'))
    ttdtfvtx.Verbose = True
    ttdtfvtx.constrainToOriginVertex = True
    
Exemple #32
0
    def makeTuple(self):
        """
        Make tuple
        """

        from Configurables import (
            FitDecayTrees,
            DecayTreeTuple,
            TupleToolDecayTreeFitter,
            TupleToolDecay,
            TupleToolTrigger,
            TupleToolTISTOS,
            TupleToolPropertime,
            PropertimeFitter,
            TupleToolKinematic,
            TupleToolGeometry,
            TupleToolEventInfo,
            TupleToolPrimaries,
            TupleToolPid,
            TupleToolTrackInfo,
            TupleToolRecoStats,
            TupleToolMCTruth,
            LoKi__Hybrid__TupleTool,
            LoKi__Hybrid__EvtTupleTool,
        )

        tuple = DecayTreeTuple(
            "Tuple" + self.name
        )  # I can put as an argument a name if I use more than a DecayTreeTuple
        tuple.Inputs = [self.sequence.outputLocation()]
        tuple.Decay = self.dec
        tuple.ToolList = [
            "TupleToolKinematic",
            "TupleToolEventInfo",
            "TupleToolTrackInfo",
            "TupleToolPid",
            "TupleToolGeometry",
            "TupleToolAngles",  # Helicity angle
            # 'TupleToolPropertime', #proper time TAU of reco particles
        ]

        # Other event infos
        tuple.addTupleTool("LoKi::Hybrid::EvtTupleTool/LoKi_Evt")
        if dataSample.isMC:
            tuple.LoKi_Evt.VOID_Variables = {
                # "nSPDHits" :  " CONTAINS('Raw/Spd/Digits')  " ,
                "nTracks": "TrSOURCE('Rec/Track/Best') >> TrSIZE",
                "nPVs": "CONTAINS('Rec/Vertex/Primary')",
            }
        else:
            tuple.LoKi_Evt.VOID_Variables = {
                # "nSPDHits" :  " CONTAINS('Raw/Spd/Digits')  " ,
                "nTracks": "CONTAINS('/Event/Charm/Rec/Track/Best')",
                "nPVs": "CONTAINS('/Event/Charm/Rec/Vertex/Primary')",
            }

        # # Other variables
        # tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All')
        # tuple.LoKi_All.Variables = {
        #     'BPVIPCHI2' : 'BPVIPCHI2()',
        #     'BPVDIRA' : 'BPVDIRA',
        #     'BPVLTFITCHI2' : 'BPVLTFITCHI2()',
        #     }

        tuple.addBranches(self.branches)

        tuple.phi.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_phi")
        tuple.phi.LoKi_phi.Variables = {
            "DOCAMAX": "DOCAMAX",
            "MassDiff_Phi": "DMASS('phi(1020)')",
            "BPVDIRA": "BPVDIRA",
            "IPS_Phi": "MIPCHI2DV(PRIMARY)",
            "VFASPF_CHI2DOF": "VFASPF(VCHI2/VDOF)",
            "VFASPF_CHI2": "VFASPF(VCHI2)",
            "BPVIPCHI2": "BPVIPCHI2()",
            "ADOCA": "DOCA(1,2)",
            "ADOCACHI2": "DOCACHI2(1,2)",
            "DTF_CTAU_Ks1": "DTF_CTAU(1, True, strings('KS0') )",
            "DTF_CTAU_Ks2": "DTF_CTAU(2, True, strings('KS0') )",
            "DTF_DT": "DTF_CTAU(1, True, strings('KS0') )- DTF_CTAU(2, True, strings('KS0') )",
            "DTF_ADT": "abs(DTF_CTAU(1, True, strings('KS0') )- DTF_CTAU(2, True, strings('KS0') ))",
        }

        def mySharedConf_Ks(branch):
            atool = branch.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Ks")
            atool.Variables = {
                "BPVDIRA": "BPVDIRA",
                "VFASPF_CHI2DOF": "VFASPF(VCHI2/VDOF)",
                "VFASPF_CHI2": "VFASPF(VCHI2)",
                "BPVIPCHI2": "BPVIPCHI2()",
                "BPVVD": "BPVVD",
                "BPVVDCHI2": "BPVVDCHI2",
                "ADOCA": "DOCA(1,2)",
                "ADOCACHI2": "DOCACHI2(1,2)",
                "BPVLTIME": "BPVLTIME()",
            }
            PropertimeTool = branch.addTupleTool("TupleToolPropertime/Propertime_Ks")

        mySharedConf_Ks(tuple.Ks1)
        mySharedConf_Ks(tuple.Ks2)

        def mySharedConf_pi(branch):
            atool = branch.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_pi")
            atool.Variables = {"TRCHI2DOF": "TRCHI2DOF", "TRGHOSTPROB": "TRGHOSTPROB"}

        mySharedConf_pi(tuple.pi1)
        mySharedConf_pi(tuple.pi2)
        mySharedConf_pi(tuple.pi3)
        mySharedConf_pi(tuple.pi4)

        # Triggers:
        tuple.phi.addTupleTool("TupleToolTISTOS/TISTOS")
        tuple.phi.TISTOS.TriggerList = trigger_list
        tuple.phi.TISTOS.VerboseL0 = True
        tuple.phi.TISTOS.VerboseHlt1 = True
        tuple.phi.TISTOS.VerboseHlt2 = True

        if dataSample.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")

        self.sequence.sequence().Members += [tuple]
Exemple #33
0
# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKK')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)] #Phys/{0}/Particles'.format(line)] # for microDST
#dtt.Decay = '[D*(2010)+ -> (D0 -> K- K+) pi+]CC' # written like this means tuple tools only runs on the D*(2010)+, to select particles to store information on mark them with a ^, e.g.:
dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^K+) ^pi+]CC' # but this not ideal as we may only want to run some tools on D and some on children, use Branches below
                                               # CC means "and also equivalent C conjugated decay" ?
# Additional tuple tools:
track_tool = dtt.addTupleTool('TupleToolTrackInfo')
# Only need to store a tool in a variable if you want to configure it:
track_tool.Verbose = True # 'Verbose' - further information
dtt.addTupleTool('TupleToolPrimaries')

dtt.addBranches({'Dstar'  :'[D*(2010)+ -> (D0 -> K- K+) pi+]CC',
                 'D0'     :'[D*(2010)+ -> ^(D0 -> K- K+) pi+]CC',
                 'Kminus' :'[D*(2010)+ -> (D0 -> ^K- K+) pi+]CC',
                 'Kplus'  :'[D*(2010)+ -> (D0 -> K- ^K+) pi+]CC',
                 'pisoft' :'[D*(2010)+ -> (D0 -> K- K+) ^pi+]CC'}) # and mark particles which we want to use in dtt.Decay (with ^ ?)!!
# Alternativley, use setDescriptorTemplate() to do all this in one line:
#dtt.setDescriptorTemplate('${Dstar}[D*(2010)+ -> ${D0}(D0 -> ${Kminus}K- ${Kplus}K+) ${pisoft}pi+]CC') # sets up both dtt.Decay and Branches
# Access branches with dtt.PARTICLENAME
dtt.D0.addTupleTool('TupleToolPropertime') # e.g. of adding tuple tools to specific particles
'''
All tuple tools start with DecayTreeTuple here:  https://gitlab.cern.ch/lhcb/Analysis/tree/master/Phys
      DecayTreeTuple           for the more general tools;
      DecayTreeTupleANNPID     for the NeuralNet-based PID tools;
      DecayTreeTupleDalitz     for Dalitz analysis;
      DecayTreeTupleJets       for obtaining information on jets;
      DecayTreeTupleMC         gives us access to MC-level information;
      DecayTreeTupleMuonCalib  for muon calibration tools;
      DecayTreeTupleReco       for reconstruction-level information, such as TupleToolTrackInfo;
def execute_option_file(path):

    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')


    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]




    #Create DecayTreeTuple -> Fills information about particles, vertices and daughters
    data = DecayTreeTuple('Bu2LLK_meLine')

    #Set root "folder" for MDST - better don't do this as it most likely causes a crash
    #Instead set RootInTES for the particular Tool (e.g. TupleToolTrackHits that needs it)
    #if DaVinci().InputType == 'MDST':
    #    data.RootInTES = "/Event/Leptonic"


    if DaVinci().Simulation is True: # for MC
        data.Inputs = ["/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"]
    elif DaVinci().Simulation is False: # for Tuple
        data.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    data.Decay = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    data.addBranches({
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"   : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
        })

    data.TupleName = "DecayTree"


    #TupleTools

    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    data.ToolList = [

        ]


    #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters)
    if(True):   #Change this value if you don't want to use this tool
        from Configurables import TupleToolTrackHits, STOfflinePosition
        trackhits = data.addTupleTool("TupleToolTrackHits")

        if DaVinci().InputType == 'MDST':
            from Configurables import MeasurementProvider
            data.addTool(MeasurementProvider('MeasProvider'))
            data.MeasProvider.RootInTES = "/Event/Leptonic/"        #Change Leptonic for your stream-name in case of MDST
            trackhits.MeasurementProvider = data.MeasProvider

        itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
        itClusterPosition.DetType = 'IT'






    MySequencer.Members.append(data)






    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [data]
    DaVinci().EvtMax     = 5000
    DaVinci().Lumi       = True
    DaVinci().SkipEvents = 0
Exemple #35
0
    , "TupleToolPropertime"
    , "TupleToolPrimaries"
    , "TupleToolTrackInfo"
]
MCtruth = tuple.addTupleTool("TupleToolMCTruth")
MCtruth.addTupleTool("LoKi::Hybrid::MCTupleTool/LoKi_Photos").Variables = {
    "nPhotons"  : "MCNINTREE(('gamma' == MCABSID))",
    "photons_TRUEP_X" : "MCSUMTREE(MCPX,('gamma' == MCABSID))", 
    "photons_TRUEP_Y" : "MCSUMTREE(MCPY,('gamma' == MCABSID))",
    "photons_TRUEP_Z" : "MCSUMTREE(MCPZ,('gamma' == MCABSID))", 
    "photons_TRUEP_E"  : "MCSUMTREE(MCE,('gamma'==MCABSID))" 
    }
      
tuple.addBranches ({         
      "muplus" :  "[B0 -> ^mu+ mu-]CC",
      "muminus" :  "[B0 -> mu+ ^mu-]CC",
      "B0" : "[B0 -> mu+ mu-]CC",
})

LoKi_All=tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
        'MINIPCHI2' : "MIPCHI2DV(PRIMARY)", 
        'MINIP' : "MIPDV(PRIMARY)",
        'IPCHI2_OWNPV' : "BPVIPCHI2()", 
        'IP_OWNPV' : "BPVIP()"
}

LoKi_muplus=tuple.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_muplus")
LoKi_muplus.Variables = {
       'PIDmu' : "PIDmu",
       'ghost' : "TRGHP",
    BTaggingTool,
    MessageSvc,
)
from Gaudi.Configuration import INFO, DEBUG, WARNING

from DecayTreeTuple.Configuration import *

from FlavourTagging.Tunings import applyTuning

ntuple = DecayTreeTuple("TaggingTest")

descriptor_B = "[B0 -> ^(J/psi(1S) -> ^mu+ ^mu-) ^(K*(892)0 -> ^K+ ^pi-)]CC"

ntuple.Inputs = ['Dimuon/Phys/BetaSBd2JpsiKstarDetachedLine/Particles']
ntuple.Decay = descriptor_B
ntuple.addBranches({'B0': descriptor_B})
ntuple.ReFitPVs = True

ntuple.ToolList = [
    "TupleToolKinematic", "TupleToolPropertime", "TupleToolPrimaries",
    "TupleToolPid"
]

# Configure TupleToolTagging
tt_tagging = ntuple.addTupleTool("TupleToolTagging")
tt_tagging.UseFTfromDST = False
tt_tagging.OutputLevel = INFO
tt_tagging.Verbose = True
btag = tt_tagging.addTool(BTaggingTool, 'MyBTaggingTool')
applyTuning(btag, tuning_version="Summer2019Optimisation_v1_Run2"
            )  # apply most recent tuning
def execute_option_file(path):

    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['DAQ','pRec']
        MySequencer.Members+=[eventNodeKiller]




    #DecayTreeTuple
    data = DecayTreeTuple('Bu2LLK_mmLine')

    data.ToolList = [
          "TupleToolGeometry"
        , "TupleToolKinematic"
        , "TupleToolEventInfo"
        , "TupleToolPropertime"
        , "TupleToolTrigger"
        , "TupleToolTISTOS"
        , "TupleToolPid"
        , "TupleToolTrackInfo"
        , "TupleToolPrimaries"
        , "TupleToolDira"
        , "TupleToolTrackPosition"
        , "TupleToolRecoStats"
        ]
    if DaVinci().InputType != 'MDST':
        data.ToolList += ["TupleToolTrackIsolation"]
    if DaVinci().Simulation is True:
        data.ToolList +=[
          "TupleToolMCBackgroundInfo"
        , "TupleToolMCTruth"
        ]


    L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
    ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']


    Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

    Hlt2Triggers = [
        ## muon lines
        "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
        "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
        "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
        "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
        ## hadron/Topo lines
        "Hlt2B2HHDecision",
        "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
        "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
        "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
        ##others
        "Hlt2PassThroughDecision",
        "Hlt2TransparentDecision",
        ## inclusive decisions
        "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
        ]

    triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers


    data.addTool(TupleToolTISTOS)
    data.TupleToolTISTOS.VerboseL0 = True
    data.TupleToolTISTOS.VerboseHlt1 = True
    data.TupleToolTISTOS.VerboseHlt2 = True
    data.TupleToolTISTOS.FillL0 = True
    data.TupleToolTISTOS.FillHlt1 = True
    data.TupleToolTISTOS.FillHlt2 = True
    data.TupleToolTISTOS.OutputLevel = INFO
    data.TupleToolTISTOS.TriggerList = triggerList


    if DaVinci().Simulation is True: # for MC
        data.Inputs = ["/Event/AllStreams/Phys/Bu2LLK_mmLine/Particles"]
    elif DaVinci().Simulation is False: # for Tuple
        data.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_mmLine/Particles"]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    data.Decay = "[B+ -> ^(J/psi(1S) -> ^mu+ ^mu-) ^K+]CC"
    data.addBranches({
        "B"         : "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC",
        "Psi"       : "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC",
        "muplus"    : "[B+ -> (J/psi(1S) -> ^mu+ mu-) K+]CC",
        "muminus"   : "[B+ -> (J/psi(1S) -> mu+ ^mu-) K+]CC",
        "Kplus"     : "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC"
        })

    data.TupleName = "DecayTree"


    #DecayTreeFitter
    fitter = data.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
    fitter.constrainToOriginVertex = False
    fitter.daughtersToConstrain = [ "J/psi(1S)" ]
    fitter.Verbose = True



    #Isolation
    data.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
    data.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
    data.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml"
    data.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"]
    data.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
    data.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
    data.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml"
    data.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"]
    vtxiso = data.B.addTupleTool("TupleToolVtxIsoln")
    #data.B.TupleToolApplyIsolationHard.OutputLevel = 3
    #data.B.TupleToolApplyIsolationSoft.OutputLevel = 3


    MySequencer.Members.append(data)





    #EventTuple for simulation
    """
    if DaVinci().Simulation is True:
        etuple = EventTuple()
        etuple.ToolList=["TupleToolEventInfo"]

        MySequencer.Members.append(etuple)
    """



    #DDDB and CondDB-Tags for DATA (needs to be set for Simulation in runfile.py according to generation->see bookkeeping!)
    #Always use the latest tags for the given datatype from (the newest are currently not in the database yet, therefore take the default ones!)
    """
    if DaVinci().Simulation is False:
        if DaVinci().DataType == '2012':
            DaVinci().CondDBtag = "dddb-20150522-2"
            DaVinci().DDDBtag = "cond-20150409-1"
        elif DaVinci().DataType == '2011':
            DaVinci().CondDBtag = "dddb-20150522-1"
            DaVinci().DDDBtag = "cond-20150409"
    """



    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [data]
    DaVinci().EvtMax     = -1
    DaVinci().Lumi       = True
BuKFilteredSel = Selection("BuKFilteredSel",Algorithm=BuKFilter,RequiredSelections=[BuK_Sel])

BuKFilteredSel_Seq= SelectionSequence("BuKFilteredSel_Seq",TopSelection=BuKFilteredSel)




#from SelPy.graph import graph
#graph(BuSel, format='png')

from Configurables import DecayTreeTuple
from Configurables import TupleToolL0Calo
from DecayTreeTuple.Configuration import *
tuple=DecayTreeTuple()
tuple.Decay="[B+ -> ^K+ ^(eta_prime -> ^(rho(770)0 -> ^pi+ ^pi-) ^gamma)]CC"
tuple.addBranches({'Bu':"[B+ -> K+ (eta_prime -> (rho(770)0 -> pi+ pi-) gamma)]CC"})
tuple.Inputs=[BuKFilteredSel_Seq.outputLocation()]
tuple.addTool(TupleToolL0Calo())
tuple.TupleToolL0Calo.TriggerClusterLocation="/Event/Trig/L0/Calo"
tuple.TupleToolL0Calo.WhichCalo="HCAL"


tuple.ToolList += [
    "TupleToolGeometry"
    , "TupleToolDira"
    , "TupleToolAngles"
    , "TupleToolPid"
    , "TupleToolKinematic"
    , "TupleToolPropertime"
    , "TupleToolPrimaries"
    , "TupleToolEventInfo"
Exemple #39
0
from Configurables import DecayTreeTuple, FitDecayTrees, TupleToolRecoStats, TupleToolTrigger, TupleToolTISTOS, CondDB
from DecayTreeTuple.Configuration import *

tuple = DecayTreeTuple("Jpsi_Tuple")

tuple.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_eeLine/Particles"]

tuple.ToolList = [
    "TupleToolKinematic", "TupleToolEventInfo", "TupleToolRecoStats",
    "TupleBuKmmFit"
]

tuple.addBranches({
    "Bplus": "[B+ ->  K+  ( J/psi(1S) ->  e+  e-)]CC",
    "Kplus": "[B+ -> ^K+  ( J/psi(1S) ->  e+  e-)]CC",
    "Jpsi": "[B+ ->  K+ ^( J/psi(1S) ->  e+  e-)]CC",
    "muplus": "[B+ ->  K+  ( J/psi(1S) -> ^e+  e-)]CC",
    "muminus": "[B+ ->  K+  ( J/psi(1S) ->  e+ ^e-)]CC",
})

LoKi_All = tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
LoKi_All.Variables = {
    'MINIPCHI2': "MIPCHI2DV(PRIMARY)",
    'MINIP': "MIPDV(PRIMARY)",
    'IPCHI2_OWNPV': "BPVIPCHI2()",
    'IP_OWNPV': "BPVIP()"
}

LoKi_muplus = tuple.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_muplus")
LoKi_muplus.Variables = {
    'PIDmu': "PIDmu",
# Other variables
tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All')
tuple.LoKi_All.Variables = {
    'BPVIPCHI2' : 'BPVIPCHI2()',
    'BPVDIRA' : 'BPVDIRA',
    'BPVLTFITCHI2' : 'BPVLTFITCHI2()',
    } 


branches = {'Tau' : '[tau- -> (phi(1020) -> K+ K-) mu-]CC', #automatically choose the head
            'Phi' : '[tau- -> ^(phi(1020) -> K+ K-) mu-]CC',
            'KPlus' : '[tau- -> (phi(1020) -> ^K+ K-) mu-]CC',
            'KMinus' : '[tau- -> (phi(1020) -> K+ ^K-) mu-]CC',
            'Mu' : '[tau- -> (phi(1020) -> K+ K-) ^mu-]CC'}

tuple.addBranches(branches)

tuple.Tau.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Tau")
numbers_phi_X = [1,2]
tuple.Tau.LoKi_Tau.Preambulo = [
        "from LoKiCore.math import sqrt",
        "Phi_E  = CHILD(E,  {})".format(numbers_phi_X[0]),
        "Phi_PX = CHILD(PX, {})".format(numbers_phi_X[0]),
        "Phi_PY = CHILD(PY, {})".format(numbers_phi_X[0]),
        "Phi_PZ = CHILD(PZ, {})".format(numbers_phi_X[0]),
        "X_P  = CHILD(P,  {})".format(numbers_phi_X[1]),
        "X_E_asMu  = sqrt(105.6583715**2 + X_P**2)",
        "X_E_asPi  = sqrt(139.57018**2 + X_P**2)",
        "X_PX = CHILD(PX, {})".format(numbers_phi_X[1]),
        "X_PY = CHILD(PY, {})".format(numbers_phi_X[1]),
        "X_PZ = CHILD(PZ, {})".format(numbers_phi_X[1]),
tuple.B0.Conskstar_eta.Verbose=True
tuple.B0.Conskstar_eta.constrainToOriginVertex=False
tuple.B0.Conskstar_eta.daughtersToConstrain = ["K*(892)0","eta"]

#========================================REFIT WITH NOTHING CONSTRAINED========================================
tuple.B0.addTupleTool('TupleToolDecayTreeFitter/Consnothing')
tuple.B0.Consnothing.Verbose=True
tuple.B0.Consnothing.constrainToOriginVertex=False

########################################=LOKI FUNCOR VARIABLES===============================================

tuple.addBranches({'Kstar' : '[B0 -> ^(K*(892)0 -> K+ pi-) (eta-> pi- pi+ (pi0 -> gamma gamma))]CC',
                   'eta' : '[B0 -> (K*(892)0 -> K+ pi-) ^(eta-> pi- pi+ (pi0 -> gamma gamma))]CC',
                   'Kplus' : '[B0 -> (K*(892)0 -> ^K+ pi-) (eta-> pi- pi+ (pi0 -> gamma gamma))]CC',
                   'piminus' : '[B0 -> (K*(892)0 -> K+ ^pi-) (eta-> pi- pi+ (pi0 -> gamma gamma))]CC',
                   'piplus' : '[B0 -> (K*(892)0 -> K+ pi-) (eta-> pi- ^pi+ (pi0 -> gamma gamma))]CC',
                   'piminus0' : '[B0 -> (K*(892)0 -> K+ pi-) (eta-> ^pi- pi+ (pi0 -> gamma gamma))]CC',
                   'gamma' : '[B0 -> (K*(892)0 -> K+ pi-) (eta-> pi- pi+ (pi0 -> ^gamma gamma))]CC',
                   'gamma0' : '[B0 -> (K*(892)0 -> K+ pi-) (eta-> pi- pi+ (pi0 -> gamma ^gamma))]CC',
                   'pi0' : '[B0 -> (K*(892)0 -> K+ pi-) (eta-> pi- pi+ ^(pi0 -> gamma gamma))]CC'})

from LoKiPhys.decorators import MAXTREE,MINTREE,ISBASIC,HASTRACK,SUMTREE,PT,ABSID,NINTREE,ETA,TRPCHI2
B0_hybrid=tuple.B0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_B0')
Kstar_hybrid=tuple.Kstar.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Kstar')
eta_hybrid=tuple.eta.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_eta')
Kplus_hybrid=tuple.Kplus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Kplus')
piminus_hybrid=tuple.piminus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piminus')
piplus_hybrid=tuple.piplus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piplus')
piminus0_hybrid=tuple.piminus0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piminus0')
gamma_hybrid=tuple.gamma.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_gamma')
gamma0_hybrid=tuple.gamma0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_gamma0')
    DecayTreeTuple,
)
from DecayTreeTuple.Configuration import *

# Stream and stripping line we want to use
stream = 'AllStreams'
line = 'D2hhCompleteEventPromptDst2D2RSLine'

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)]
dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC'

# add a kinematic fitter
dtt.addBranches({
    'Dstar': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC',
})
dtt.Dstar.addTupleTool('TupleToolDecayTreeFitter/ConsD')
dtt.Dstar.ConsD.constrainToOriginVertex = True
dtt.Dstar.ConsD.Verbose = True
dtt.Dstar.ConsD.daughtersToConstrain = ['D0']

# add another fitter, this time we will change a mass hypothesis
dtt.Dstar.addTupleTool('TupleToolDecayTreeFitter/ConsDpipi')
dtt.Dstar.ConsDpipi.constrainToOriginVertex = True
dtt.Dstar.ConsDpipi.Verbose = True
dtt.Dstar.ConsDpipi.daughtersToConstrain = ['D0']

# make the hypothesis that actually we had the decay D0->pi+pi-
# note that you have to explicitely give both charges
# CC does not work here!
stream = 'AllStreams'
line = 'D2hhCompleteEventPromptDst2D2RSLine'

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi')
dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)]
# Note that we mark all particles, otherwise the branches won't work
dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC'
track_tool = dtt.addTupleTool('TupleToolTrackInfo')
track_tool.Verbose = True
dtt.addTupleTool('TupleToolPrimaries')

dtt.addBranches({
    'Dstar': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC',
    'D0': '[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC',
    'Kminus': '[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC',
    'piplus': '[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC',
    'pisoft': '[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC'
})

dtt.D0.addTupleTool('TupleToolPropertime')

# Configure DaVinci
DaVinci().UserAlgorithms += [dtt]
DaVinci().InputType = 'DST'
DaVinci().TupleFile = 'DVntuple.root'
DaVinci().PrintFreq = 1000
DaVinci().DataType = '2012'
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().Lumi = not DaVinci().Simulation
tuple.B0.addTupleTool('TupleToolDecayTreeFitter/Conskstar_etap')
tuple.B0.Conskstar_etap.Verbose=True
tuple.B0.Conskstar_etap.constrainToOriginVertex=False
tuple.B0.Conskstar_etap.daughtersToConstrain = ["K*(892)0","eta_prime"]

#========================================REFIT WITH NOTHING CONSTRAINED========================================
tuple.B0.addTupleTool('TupleToolDecayTreeFitter/Consnothing')
tuple.B0.Consnothing.Verbose=True
tuple.B0.Consnothing.constrainToOriginVertex=False

#========================================LOKI FUBNCTOR VARIABLES========================================

tuple.addBranches({'Kstar' : '[B0 -> ^(K*(892)0 -> K+ pi-) (eta_prime -> pi- pi+ gamma)]CC',
                   'eta_prime' : '[B0 -> (K*(892)0 -> K+ pi-) ^(eta_prime -> pi- pi+ gamma)]CC',
                   'Kplus' : '[B0 -> (K*(892)0 -> ^K+ pi-) (eta_prime -> pi- pi+ gamma)]CC',
                   'piminus' : '[B0 -> (K*(892)0 -> K+ ^pi-) (eta_prime -> pi- pi+ gamma)]CC',
                   'piplus' : '[B0 -> (K*(892)0 -> K+ pi-) (eta_prime -> pi- ^pi+ gamma)]CC',
                   'piminus0' : '[B0 -> (K*(892)0 -> K+ pi-) (eta_prime -> ^pi- pi+ gamma)]CC',
                   'gamma' : '[B0 -> (K*(892)0 -> K+ pi-) (eta_prime -> pi- pi+ ^gamma)]CC'})


from LoKiPhys.decorators import MAXTREE,MINTREE,ISBASIC,HASTRACK,SUMTREE,PT,ABSID,NINTREE,ETA,TRPCHI2
B0_hybrid=tuple.B0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_B0')
Kstar_hybrid=tuple.Kstar.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Kstar')
eta_prime_hybrid=tuple.eta_prime.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_eta_prime')
Kplus_hybrid=tuple.Kplus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Kplus')
piminus_hybrid=tuple.piminus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piminus')
piplus_hybrid=tuple.piplus.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piplus')
piminus0_hybrid=tuple.piminus0.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_piminus0')
gamma_hybrid=tuple.gamma.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_gamma')
Exemple #45
0
    ,'Hlt2DiMuonDecision'
    ,'Hlt2CharmSemilepD2HMuMuDecision'
    ,'Hlt2CharmSemilepD2HMuMuWideMassDecision'

  ]

LoKi_Vars = LoKi__Hybrid__TupleTool("LoKi_Vars")
LoKi_Vars.Variables =  {
            "LoKi_BPVVDCHI2"    : "BPVVDCHI2"
          , "LoKi_BPVIPCHI2"    : "BPVIPCHI2()"
          , "LoKi_DOCA"         : "DOCA(1,2)"
          , "LoKi_BPVLTIME"     : "BPVLTIME()"
          }


dtt.addBranches({"D" :  "[D+ -> K+ mu+ mu-]CC"} )

from Configurables import DaVinci

# Configure DaVinci
DaVinci().UserAlgorithms += [dtt]
DaVinci().InputType = 'DST'
DaVinci().TupleFile = 'MCDKmumu12-Up.root'
DaVinci().PrintFreq = 1000
DaVinci().DataType = '2012'
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().Lumi = DaVinci().Simulation
DaVinci().EvtMax = -1
DaVinci().CondDBtag = 'Sim08-20130503-vc-md100'
DaVinci().DDDBtag = 'Sim08-20130503'
Exemple #46
0
        ]
# Get trigger info
tuple.addTool(TupleToolTrigger, name="TupleToolTrigger")
tuple.TupleToolTrigger.Verbose = True
tuple.TupleToolTrigger.TriggerList = tlist

# Get TISTOS info
tuple.addTool(TupleToolTISTOS, name="TupleToolTISTOS")
tuple.TupleToolTISTOS.Verbose = True
tuple.TupleToolTISTOS.TriggerList = tlist
# Decay descriptor
tuple.Decay = "[B_s0 -> ^(phi(1020) -> ^K+ ^K-) ^(f_0(980) -> ^K+ ^K-)]CC"
#tuple.Decay = "[B0 -> ^(phi(1020) -> ^K+ ^K-) ^(rho(770)0 -> ^pi+ ^pi-)]CC" # original
# Rename f_0(980) branch to KK
tuple.addBranches({
   "KK" : " [B_s0 -> (phi(1020) -> K+ K-) ^(f_0(980) -> K+ K-)]CC "
})
# LOKI Vairables
from Configurables import  LoKi__Hybrid__TupleTool
LoKiVariables2 = LoKi__Hybrid__TupleTool('LoKiVariables2')
LoKiVariables2.Variables = {
  "LOKI_Mass" : "DTF_FUN(M, True)",
  "LOKI_Chi2" : "DTF_CHI2(True)",
  "LOKI_ndof" : "DTF_NDOF(True)",
  "LOKI_MassError2" : "DTF_FUN(M2ERR2, True)",
  "LOKI_DTF_CTAU"        : "DTF_CTAU( 0, True )",
  "LOKI_DTF_CTAUS"       : "DTF_CTAUSIGNIFICANCE( 0, True )",
  "LOKI_DTF_CTAUERR"     : "DTF_CTAUERR( 0, True )",

  "PX_kaon0": "DTF_FUN(CHILD(PX, 1,1), True)",
  "PY_kaon0": "DTF_FUN(CHILD(PY, 1,1), True)",
def execute_option_file(path):
    # ================= BEGIN EDIT AREA =======================
    tuplename = "Bu2LLK_meLine"
    simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"
    data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"

    decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    branches = {    # Dictionary for the branches to write in the tuple
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"    : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
    }

    toollist = [  "TupleToolBremInfo"       #Bremsstrahlung information
                #, "TupleToolGeometry"       #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV)
                , "TupleToolKinematic"      #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT)
                #, "TupleToolEventInfo"      #Event information such as run number, polarity, GPS time etc.
                #, "TupleToolPropertime"     #proper lifetime of reconstructed particles
                #, "TupleToolAngles"        #decay angles of charged tracks
                #, "TupleToolTrigger"
                #, "TupleToolTrackInfo"      #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track...
                #, "TupleToolPrimaries"      #Number and coordinates of all primary vertices
                #, "TupleToolDira"
                #, "TupleToolTrackPosition"  #Plot the X/Y position at a given Z (default: 2500 = TTstation)
                #, "TupleToolRecoStats"
                #, "TupleToolIsolationTwoBody"  #degree of isolation of two particles with common mother from Bsmumu
                #, "TupleToolANNPID"         #V2,V3,... ProbNN variables
                #, "TupleToolCaloHypo"
                #, "TupleToolL0Calo"
                ]
    # ================= END EDIT AREA =======================




    # ================= BEGIN DO NOT EDIT HERE =======================
    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]



    #DecayTreeTuple -> Fills information about particles, vertices and daughters
    ntuple = DecayTreeTuple(tuplename)



    if DaVinci().Simulation is True: # for MC
        ntuple.Inputs = [simulation_inputstring]
    elif DaVinci().Simulation is False: # for Tuple
        ntuple.Inputs = [data_inputstring]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    ntuple.Decay = decaydescriptor
    ntuple.addBranches(branches)

    ntuple.TupleName = "DecayTree"


    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    ntuple.ToolList = toollist

    MySequencer.Members.append(ntuple)






    # ================= END DO NOT EDIT HERE =======================




    if DaVinci().Simulation is True:
        from Configurables import BackgroundCategory
        backgroundinfo = ntuple.addTupleTool("TupleToolMCBackgroundInfo")           #Fills the background category
        backgroundinfo.addTool(BackgroundCategory('BackgroundCategory'))
        backgroundinfo.BackgroundCategory.SoftPhotonCut = 100000000000.                    #Ignores all photons
        MCTruth=ntuple.addTupleTool("TupleToolMCTruth")            #Saves information of MC particle associated to the current particle (you can add tools to it itself!)
        MCTruth.addTupleTool("MCTupleToolHierarchy")               #True IDs of mother and grandmother particles




    # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ==================

    # LOKI TupleTool
    LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool")
    LoKi.Variables =  {
        "ETA" : "ETA",
        "PHI" : "PHI"       #Azimuthal angle
    }


    #Track isolation
    if(False):
        if DaVinci().InputType != 'MDST':
            ntuple.ToolList += ["TupleToolTrackIsolation"]


    # PID TupleTool
    if(True):
        pid = ntuple.addTupleTool("TupleToolPid")            #PID information for charged particles
        pid.Verbose = True                                   #More information like isMuonLoose etc.



    #TISTOS TupleTool
    if(False):
        from Configurables import TupleToolTISTOS

        L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
        ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']

        Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

        Hlt2Triggers = [
            ## muon lines
            "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
            "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
            "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
            "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
            ## hadron/Topo lines
            "Hlt2B2HHDecision",
            "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
            "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
            "Hlt2TopoE2BodyBBDTDecision", "Hlt2TopoE3BodyBBDTDecision", "Hlt2TopoE4BodyBBDTDecision",
            "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
            ##others
            "Hlt2PassThroughDecision",
            "Hlt2TransparentDecision",
            ## inclusive decisions
            "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
            ]

        triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers

        ntuple.addTupleTool("TupleToolTISTOS")
        ntuple.TupleToolTISTOS.VerboseL0 = True
        ntuple.TupleToolTISTOS.VerboseHlt1 = True
        ntuple.TupleToolTISTOS.VerboseHlt2 = True
        ntuple.TupleToolTISTOS.FillL0 = True
        ntuple.TupleToolTISTOS.FillHlt1 = True
        ntuple.TupleToolTISTOS.FillHlt2 = True
        ntuple.TupleToolTISTOS.OutputLevel = INFO
        ntuple.TupleToolTISTOS.TriggerList = triggerList



    #DecayTreeFitter
    if(False):
        fitter = ntuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
        fitter.constrainToOriginVertex = False
        fitter.daughtersToConstrain = [ "J/psi(1S)" ]
        fitter.Verbose = True





    #Isolation tool from Alex
    weightsfolder = "./"
    if(False):
        from Configurables import TupleToolApplyIsolation
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
        ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
        ntuple.B.TupleToolApplyIsolationHard.WeightsFile= weightsfolder+"weightsHard.xml"
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
        ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
        ntuple.B.TupleToolApplyIsolationSoft.WeightsFile= weightsfolder+"weightsSoft.xml"
        ntuple.B.addTupleTool("TupleToolVtxIsoln")
        #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3
        #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3

    #Tool from B2ee
    if(False):
        from Configurables import TupleToolMuonVariables
        ntuple.addTupleTool("TupleToolMuonVariables")
        if DaVinci().InputType == 'MDST':
            ntuple.TupleToolMuonVariables.TrackContainer = "/Event/Leptonic/Rec/Track/Best"         #Change in case of MDST!
        ntuple.TupleToolMuonVariables.BDTSRootFile = weightsfolder+"HflatBDTS_7Dec.root"
        ntuple.TupleToolMuonVariables.BDTSXMLFile  = weightsfolder+"TMVA_7Dec.weights.xml"





    #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters)
    if(True):   #Change this value if you don't want to use this tool
        from Configurables import TupleToolTrackHits, STOfflinePosition
        trackhits = ntuple.addTupleTool("TupleToolTrackHits")
        trackhits.Verbose = True

        if DaVinci().InputType == 'MDST':
            from Configurables import MeasurementProvider
            ntuple.addTool(MeasurementProvider('MeasProvider'))
            ntuple.MeasProvider.RootInTES = "/Event/Leptonic/"        #Change Leptonic for your stream-name in case of MDST
            trackhits.MeasurementProvider = ntuple.MeasProvider

        itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
        itClusterPosition.DetType = 'IT'


    #Settings for TupleToolAllPhotons (only works for fullDST files)
    #Should be always added to only one branch
    if(DaVinci().InputType == 'DST'):
        if(True):
            from Configurables import TupleToolAllPhotons, STOfflinePosition
            allphotons = ntuple.eminus.addTupleTool("TupleToolAllPhotons")
            allphotons.MCTruth = True
            allphotons.PhotonsLocation = "/Event/Phys/StdVeryLooseAllPhotons/Particles"

            itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
            itClusterPosition.DetType = 'IT'
            #allphotons.PhotonsLocation = "/Event/Phys/StdLooseAllPhotons/Particles"



    #Settings for TupleToolBremRemover
    #Should be always added to specific branches
    if(True):
        from Configurables import TupleToolBremRemover
        bremremover = ntuple.eminus.addTupleTool("TupleToolBremRemover")
        if DaVinci().Simulation is True:
            bremremover.TRUEP = True


    #TupleToolTrackKink: Refits the track and outputs kink as point with highest Chi2 variation (should be run last because of the refit)
    if(False):
        ntuple.eminus.addTupleTool("TupleToolTrackKink")

    # ================= END EDIT TUPLETOOLS WITH OPTIONS ==================




    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [ntuple]
    DaVinci().EvtMax     = -1
    DaVinci().SkipEvents = 0
    DaVinci().Lumi       = True
#==============================REFIT WITH K SWAPPED FOR P ALL CONSTRAINED ==============================
tuple.Lambda_b0.addTupleTool('TupleToolDecayTreeFitter/DTFKforP')
tuple.Lambda_b0.DTFKforP.Verbose=True
tuple.Lambda_b0.DTFKforP.constrainToOriginVertex=True
tuple.Lambda_b0.DTFKforP.daughtersToConstrain = ["eta_prime"]
tuple.Lambda_b0.DTFKforP.Substitutions={
    "Lambda_b0 -> ^p+ K- (eta_prime -> pi- pi+ gamma)" : "p~-",
    "Lambda_b~0 -> ^p~- K+ (eta_prime -> pi- pi+ gamma)" : "p+",
    }

########################################=LOKI FUNCOR VARIABLES===============================================

tuple.addBranches({'Proton':'[Lambda_b0 -> ^p+ K- (eta_prime -> pi- pi+ gamma)]CC',
                   'Kaon' : '[Lambda_b0 -> p+ ^K- (eta_prime -> pi- pi+ gamma)]CC',
                   'eta_prime' : '[Lambda_b0 -> p+ K- ^(eta_prime -> pi- pi+ gamma)]CC',
                   'piminus' : '[Lambda_b0 -> p+ K- (eta_prime -> ^pi- pi+ gamma)]CC',
                   'piplus' : '[Lambda_b0 -> p+ K- (eta_prime -> pi- ^pi+ gamma)]CC',
                   'gamma' : '[Lambda_b0 -> p+ K- (eta_prime -> pi- pi+ ^gamma)]CC',
                   })

from Configurables import TupleToolMCBackgroundInfo
tuple.Lambda_b0.addTool( TupleToolMCBackgroundInfo )
tuple.Lambda_b0.ToolList += [ "TupleToolMCBackgroundInfo" ]



from LoKiPhys.decorators import MAXTREE,MINTREE,ISBASIC,HASTRACK,SUMTREE,PT,ABSID,NINTREE,ETA,TRPCHI2

#eventtupletool=tuple.addTupleTool('LoKi::Hybrid::EventTupleTool/ETT')
#eventtupletool.VOID_Variables = {
#    "nTracks" : "TrSOURCE('Rec/Track/Best') >> TrSIZE"
from Configurables import TupleToolTrackInfo, TupleToolRICHPid, TupleToolGeometry, TupleToolPid
from Configurables import TupleToolANNPID
from DecayTreeTuple.Configuration import *

tupleB = DecayTreeTuple("bae-"+tuplename+"-mc")


tupleB.Inputs = ["Phys/B2KLLXInclusive_InclKLLLine_NoHadronPID/Particles"]

#decay = ""
if LeptonType == "Muons" : 
    decay =  "[B+ -> ^(J/psi(1S) -> ^mu+ ^mu-) ^K+]CC"
    tupleB.addBranches ({
            "Kplus"  :  "[B+ -> ^K+ (J/psi(1S) -> mu+ mu-)]CC",
            "Jpsi"   :  "[B+ -> K+ ^(J/psi(1S) -> mu+ mu-)]CC",
            "lplus"  :  "[B+ -> K+ (J/psi(1S) -> ^mu+ mu-)]CC",
            "lminus" :  "[B+ -> K+ (J/psi(1S) -> mu+ ^mu-)]CC",
            "Bplus"  : "[B+ -> K+ J/psi(1S)]CC",
            })

if LeptonType == "Electrons":
    decay =  "[B+ -> ^(J/psi(1S) -> ^e+ ^e-) ^K+]CC"
    tupleB.addBranches ({
            "Kplus"  :  "[B+ -> ^K+ (J/psi(1S) -> e+ e-)]CC",
            "Jpsi"   :  "[B+ -> K+ ^(J/psi(1S) -> e+ e-)]CC",
            "lplus"  :  "[B+ -> K+ (J/psi(1S) -> ^e+ e-)]CC",
            "lminus" :  "[B+ -> K+ (J/psi(1S) -> e+ ^e-)]CC",
            "Bplus"  :  "[B+ -> K+ J/psi(1S)]CC",
            })
tupleB.Decay = decay
Exemple #50
0
#    "D"    : " [B0 -> ^(D0 -> [K-]cc [pi+]cc ) [(K*(892)0 -> K+ pi-)]CC ]CC ",
#    "D0K"  : " [B0 -> (D0 -> ^[K-]cc [pi+]cc ) [(K*(892)0 -> K+ pi-)]CC ]CC ",
#    "D0pi" : " [B0 -> (D0 -> [K-]cc ^[pi+]cc ) [(K*(892)0 -> K+ pi-)]CC ]CC ",
#    "K"    : " [B0 -> (D0 -> [K-]cc [pi+]cc ) [(K*(892)0 -> ^K+ pi-)]CC ]CC ",
#    "pi"   : " [B0 -> (D0 -> [K-]cc [pi+]cc ) [(K*(892)0 -> K+ ^pi-)]CC ]CC ",
#    "Kst"  : " [B0 -> (D0 -> [K-]cc [pi+]cc ) [^(K*(892)0 -> K+ pi-)]CC ]CC "
#})
tuple.Decay = " B0 -> (D0 -> K- pi+ ) (K*(892)0 -> { K+ pi- ,  K-  pi+ }) "
tuple.addBranches({
    "B":
    "  B0 -> ( D0 ->  K-  pi+ ) ( K*(892)0 -> { K+  pi- ,  K-  pi+ }) ",
    "D":
    "  B0 -> (^D0 ->  K-  pi+ ) ( K*(892)0 -> { K+  pi- ,  K-  pi+ }) ",
    "D0K":
    "  B0 -> ( D0 -> ^K-  pi+ ) ( K*(892)0 -> { K+  pi- ,  K-  pi+ }) ",
    "D0pi":
    "  B0 -> ( D0 ->  K- ^pi+ ) ( K*(892)0 -> { K+  pi- ,  K-  pi+ }) ",
    "K":
    "  B0 -> ( D0 ->  K-  pi+ ) ( K*(892)0 -> {^K+  pi- , ^K-  pi+ }) ",
    "pi":
    "  B0 -> ( D0 ->  K-  pi+ ) ( K*(892)0 -> { K+ ^pi- ,  K- ^pi+ }) ",
    "Kst":
    "  B0 -> ( D0 ->  K-  pi+ ) (^K*(892)0 -> { K+  pi- ,  K-  pi+ }) "
})

tuple.addTupleTool("TupleToolTISTOS/TupleToolTISTOS")
tuple.TupleToolTISTOS.VerboseL0 = True
tuple.TupleToolTISTOS.VerboseHlt1 = True
tuple.TupleToolTISTOS.VerboseHlt2 = True
tuple.TupleToolTISTOS.TriggerList = myTriggerList

#Add Loki variables