Ejemplo n.º 1
0
def main(name1,name2):

    my_path= basf2.create_path()
    
    fileList = name1
    
    inputMdstList('default', fileList, path=my_path)
    
    output_file= '/home/belle2/sanjeeda/D0_Ks_Ks/reconstructed/reco'+name2
    
    #load the lists for pion and kaon
    stdc.stdPi(listtype='all', path=my_path)
    stdc.stdK(listtype='all', path=my_path)
    
    #list of soft pion with cuts
    soft = '[thetaInCDCAcceptance] and [dr<0.5] and [abs(dz)<2] and [nCDCHits>0]'
    fillParticleList('pi+:soft', soft, path=my_path)  
    
    #create merged K_S0 list
    stdKshorts(prioritiseV0=True,fitter='TreeFit',path=my_path) 
    reconstructDecay('K_S0:merged -> pi-:all pi+:all', cut='0.3 < M < 0.7', path=my_path)
    variablesToExtraInfo(particleList= 'K_S0:merged', variables={'M': 'M_preFit'}, path=my_path)
 
    reconstructDecay('D0:sig -> K_S0:merged K_S0:merged', cut='1.7 < M < 2.1', path=my_path)
    
    reconstructDecay('D*+ -> D0:sig pi+:soft', cut='useCMSFrame(p)> 2 and massDifference(0) < 0.16', path=my_path)
    
    matchMCTruth(list_name='D*+',path=my_path)
    
    vx.treeFit(list_name='D*+', conf_level=0.001, ipConstraint=True, updateAllDaughters=True, massConstraint=[310],path=my_path)
    
    vertex_variables = vc.flight_info + ['M','x','y','z','mcX','mcY','mcZ',
                                         'mcProdVertexX','mcProdVertexY','mcProdVertexZ','mcFlightTime','mcFlightDistance']
    d0_vars= vu.create_aliases_for_selected(
        list_of_variables = vc.inv_mass + vc.mc_truth + vertex_variables + vc.kinematics +['isSignalAcceptMissingGamma'],
        decay_string='D*+ -> [^D0:sig -> [K_S0:merged -> pi+:all pi-:all]  [K_S0:merged -> pi+:all pi-:all]] pi+:soft', prefix='Dz')
    
    kshort_vars = vu.create_aliases_for_selected(
        list_of_variables = vc.inv_mass + vc.mc_truth +  vertex_variables + vc.kinematics +  ['extraInfo(M_preFit)'],
        decay_string= 'D*+ -> [D0:sig -> [^K_S0:merged -> pi+:all pi-:all]  [^K_S0:merged -> pi+:all pi-:all]] pi+:soft',prefix=['Ks1','Ks2'])
    
    
    pi_vars = vu.create_aliases_for_selected(
        list_of_variables = vc.kinematics + vc.track + vc.mc_truth + vc.pid,
        decay_string='D*+ -> [D0:sig -> [K_S0:merged -> ^pi+:all ^pi-:all] [K_S0:merged -> ^pi+:all ^pi-:all]] ^pi+:soft',prefix=['pi1','pi2','pi3','pi4','pisoft'])
    
    dstar_vars= vu.create_aliases_for_selected(
        list_of_variables = vc.inv_mass + vc.mc_truth + vc.kinematics+['useCMSFrame(p)','massDifference(0)','isSignalAcceptMissingGamma','Q'] ,
        decay_string='^D*+ -> [D0:sig -> [K_S0:merged -> pi+:all pi-:all] [K_S0:merged -> pi+:all pi-:all]] pi+:soft',prefix ='Dst')
    
    variablesToNtuple('D*+', d0_vars + kshort_vars + pi_vars + dstar_vars,
                      filename=output_file, treename='D0KsKs', path=my_path)
    
 


    process(my_path)
    print(statistics)
Ejemplo n.º 2
0
def create_analysis_path(
        b_ntuple_filename="B_ntuple.root",
        d_ntuple_filename="D_ntuple.root",
        mbc_range=(5.2, 5.3),
):
    """
    Example of a minimal reconstruction with a cut as a changeable function
    parameter, adapted from code in the ``B2T_Basics_3_FirstAnalysis.ipynb``
    notebook from b2 starter kit.
    """
    path = basf2.create_path()
    # this local inputMdstList will only be used when this steerig file is run locally, gbasf2 overrides it
    local_input_files = [
        "/group/belle2/dataprod/MC/MC13a/prod00009434/s00/e1003/4S/r00000/mixed/mdst/sub00/mdst_000001_prod00009434_task10020000001.root"
    ]
    mA.inputMdstList(
        environmentType="default",
        filelist=local_input_files,
        path=path,
    )
    stdK("higheff", path=path)
    stdPi("higheff", path=path)
    mA.reconstructDecay('D0:Kpi -> K-:higheff pi+:higheff',
                        '1.7 < M < 1.9',
                        path=path)
    # use try except to have this code work for both the old and new function names for the tree fit
    mA.matchMCTruth('D0:Kpi', path=path)
    mA.reconstructDecay('B- -> D0:Kpi pi-:higheff',
                        f"{mbc_range[0]} < Mbc < {mbc_range[1]}",
                        path=path)
    try:
        vx.treeFit('B+', 0.1, path=path)
    except AttributeError:
        vx.vertexTree('B+', 0.1, path=path)
    mA.setAnalysisConfigParams({"mcMatchingVersion": "BelleII"}, path)
    mA.matchMCTruth('B-', path=path)
    vm.addAlias("p_cms",
                "useCMSFrame(p)")  # include aliases to test if they work
    vm.addAlias("E_cms", "useCMSFrame(E)")
    mA.variablesToNtuple('D0:Kpi', [
        'M', 'p', 'E', 'E_cms', 'p_cms', 'daughter(0, kaonID)',
        'daughter(1, pionID)', 'isSignal', 'mcErrors'
    ],
                         filename=d_ntuple_filename,
                         treename="D",
                         path=path)
    mA.variablesToNtuple('B-', ['Mbc', 'deltaE', 'isSignal', 'mcErrors', 'M'],
                         filename=b_ntuple_filename,
                         treename="B",
                         path=path)
    return path
Ejemplo n.º 3
0
b2.conditions.prepend_testing_payloads('localdb/database.txt')


path = b2.create_path()




ma.inputMdstList("default", [input_file], path=path)


print(b2.conditions.globaltags)

# Book charged Kaons and Pions
from stdCharged import stdK, stdPi
stdK("higheff",  path=path)
stdPi("higheff", path=path)

# Reconstruct D0 decay
ma.reconstructDecay('D0:my -> K-:higheff pi+:higheff', cut='1.75 < M < 1.95', path=path)

# Reconstruct D* decay
ma.reconstructDecay('D*+:my -> D0:my pi+:higheff', cut='1.90 < M < 2.25' , path=path)

# Fit vertex
#vx.treeFit('D*+:my', ipConstraint=True, updateAllDaughters=True, conf_level=0, path=path)
vx.treeFit('D*+:my', conf_level=0, path=path)

#ma.printList('D0:my', True, path=path)
#ma.printVariableValues('D0:my', ['IPX'], path=path)
# create path
my_path = b2.create_path()

# load input ROOT file
ma.inputMdst(environmentType='default',
             filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples',
                                   False),
             path=my_path)

# create and fill final state ParticleLists
# use standard lists
# creates "pi+:loose" ParticleList (and c.c.)
stdc.stdPi(listtype='loose', path=my_path)
# creates "K+:loose" ParticleList (and c.c.)
stdc.stdK(listtype='loose', path=my_path)
# creates "mu+:loose" ParticleList (and c.c.)
stdc.stdMu(listtype='loose', path=my_path)

# creates "pi0:looseFit" ParticleList
stdPi0s(listtype='looseFit', path=my_path)

# 1. reconstruct D0 in multiple decay modes
ma.reconstructDecay(decayString='D0:ch1 -> K-:loose pi+:loose',
                    cut='1.8 < M < 1.9',
                    dmID=1,
                    path=my_path)
ma.reconstructDecay(decayString='D0:ch2 -> K-:loose pi+:loose pi0:looseFit',
                    cut='1.8 < M < 1.9',
                    dmID=2,
                    path=my_path)