Example #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)
Example #2
0
def make_ntuple():
    from variables import variables as va
    from variables.utils import create_aliases_for_selected

    va.addAlias('PIDppi', 'atcPIDBelle(4,2)')
    va.addAlias('PIDpk', 'atcPIDBelle(4,3)')
    va.addAlias('PIDkpi', 'atcPIDBelle(3,2)')
    # Lambda vertex position relative to IP
    va.addAlias('abs_dz', 'abs(dz)')
    # va.addAlias('abs_dr', 'abs(dr)')
    va.addAlias('cosaXY', 'cosAngleBetweenMomentumAndVertexVectorInXYPlane')
    # Track parameters relative to IP
    # d0 and z0 are relative to the origin!
    va.addAlias('min_dr', 'min(abs(daughter(0, dr)), abs(daughter(1, dr)))')
    va.addAlias('min_dz', 'min(abs(daughter(0, dz)), abs(daughter(1, dz)))')
    """Create a list of all the variables to be included in the final ntuple"""
    ntuple = []
    # May have more feature than needed.
    features = [
        'dr', 'dz', 'cosaXY', 'min_dr', 'min_dz', 'pt', 'pz', 'chiProb', 'p'
    ]
    features += create_aliases_for_selected(['PIDppi', 'PIDpk', 'PIDkpi', 'p'],
                                            'Lambda0 -> ^p+ ^pi-',
                                            prefix=['proton', 'pi'])
    spectator = ['isSignal', 'isPrimarySignal', 'mcPDG', 'genMotherPDG']
    spectator += ['IPX', 'IPY', 'IPZ', 'M', 'p', 'goodBelleLambda', 'distance']
    ntuple = features + spectator
    return ntuple
Example #3
0
                  path=mp)
    # 100 MeV mass window for Sigma+ should be large enough
    ma.applyCuts('Sigma+:std',
                 'cosaXY > 0 and daughter(1, p) > 0.1 and 1.16 < M < 1.22',
                 path=mp)
    ma.matchMCTruth('Sigma+:std', path=mp)

    ntuple = [
        'M', 'p', 'chiProb', 'cosa', 'cosaXY', 'dr', 'dz', 'distance',
        'isSignal', 'genMotherPDG'
    ]
    ntuple += ['ppi0_angle', 'p_decayAngle', 'pi0_decayAngle']
    ntuple += ['IPX', 'IPY', 'IPZ']

    ntuple += create_aliases_for_selected(
        ['pid_ppi', 'pid_pk', 'pid_kpi', 'dr', 'dz', 'p', 'isSignal'],
        'Sigma+ -> ^p+ pi0',
        prefix=['p'])
    ntuple += create_aliases_for_selected(
        ['mcP', 'p', 'M', 'distance', 'isSignal', 'genMotherPDG'],
        'Sigma+ -> p+ ^pi0',
        prefix=['pi0'])
    ntuple += create_aliases_for_selected(
        ['E', 'theta', 'phi'],
        'Sigma+ -> p+ [pi0 -> ^gamma ^gamma]',
        prefix=['gamma1', 'gamma2'])

    ma.variablesToNtuple('Sigma+:std',
                         ntuple,
                         treename='sigma_std',
                         filename=outfile,
                         path=mp)
                     treename='muon',
                     filename=output_file,
                     path=my_path)
ma.variablesToNtuple(decayString='gamma:all',
                     variables=gamma_variables,
                     treename='phot',
                     filename=output_file,
                     path=my_path)

# Note here, that since we want to get info about gammas from pi0,
# we convert names of te variables from the gamma list in the way that they will
# correspond to given gammas.
ma.variablesToNtuple(
    decayString='pi0:looseFit',
    variables=pi0_variables +
    vu.create_aliases_for_selected(gamma_variables, 'pi0 -> ^gamma ^gamma'),
    filename=output_file,
    treename='pi0',
    path=my_path)

# Here for pions from K0s we do the same thing, but here we add custom aliases
# (see ntuples to see the difference)
ma.variablesToNtuple(
    decayString='K_S0:all',
    variables=K0s_variables + vu.create_aliases_for_selected(
        charged_particle_variables, 'K_S0 -> ^pi+ pi-', 'pip') +
    vu.create_aliases_for_selected(charged_particle_variables,
                                   'K_S0 -> pi+ ^pi-', 'pim'),
    filename=output_file,
    treename='kshort',
    path=my_path)
Example #5
0
ft_variables = makePretty(['qrOutput(FBDT)', 'qrOutput(FANN)', 'isRelatedRestOfEventB0Flavor', 'qOutput(FANN)', 'rBinBelle(FANN)',  'qOutput(FBDT)', 'rBinBelle(FBDT)',  'EW90', 'pMissCMS', 'cosThetaMissCMS'])
deltat_variables = ['DeltaT', 'DeltaTErr', 'MCDeltaT', 'TagVz', 'TagVzErr','mcTagVz', 'DeltaZ', 'MCTagBFlavor']
cs_variables = makePretty(['R2', 'cosTBTO', 'cosTBz','CleoConeCS(2)','KSFWVariables(hso02)', 'CleoConeCS(4)', 'CleoConeCS(9)','KSFWVariables(hso10)', 'KSFWVariables(hso12)', 'KSFWVariables(hso14)', 'thrustBm', 'thrustOm'])
roe_vars_clean = makePretty(['ROE_E(cleanMask)','ROE_P(cleanMask)', 'ROE_M(cleanMask)', 'ROE_deltae(cleanMask)', 'ROE_mbc(cleanMask)', 'nROE_Tracks(cleanMask)', 'nROE_NeutralECLClusters(cleanMask)', 'ROE_PTheta(cleanMask)', 'ROE_MC_MissFlags(cleanMask)'])
vtx_variables = ['z', 'z_uncertainty', 'pValue']
dalitz_vars = ['m12', 'm13', 'm23']
mix_variables = []#['mixFBDT', 'mixFANN', 'mixTrue']
cluster_variables = ['clusterReg','clusterTiming',
        'clusterErrorTiming','clusterE1E9',
        'clusterE9E21','clusterAbsZernikeMoment40',
        'clusterAbsZernikeMoment51','minC2TDist',
        'clusterTheta','clusterZernikeMVA',
        'clusterSecondMoment','clusterNHits']

track_variables = vc.track + vc.track_hits + vc.pid 

ma.variablesToNtuple('B0:signal',  
        vc.deltae_mbc+kin_variables+ft_variables+deltat_variables+cs_variables+vtx_variables+mix_variables+roe_vars_clean+dalitz_vars+
        ['CSMVA','isContinuumEvent','isNotContinuumEvent','pi0Likeness','etaLikeness']+
        vu.create_aliases_for_selected(list_of_variables=kin_variables, decay_string=  'B0 -> ^pi+ ^pi- [ ^K_S0 -> ^pi+ ^pi- ] ^gamma')+
        vu.create_aliases_for_selected(list_of_variables=track_variables, decay_string=  'B0 -> ^pi+ ^pi- [ K_S0 -> ^pi+ ^pi- ] gamma')+
        vu.create_aliases_for_selected(list_of_variables=cluster_variables, decay_string=  'B0 -> pi+ pi- [ K_S0 -> pi+ pi- ] ^gamma'),
    	filename = outputFilename, path=main_path)
# Process the events

b2.process(main_path)

# print out the summary
print(b2.statistics)
# 3. reconstruct Upsilon(4S) -> Btag+ Bsig- -> Btag+ mu-
ma.reconstructDecay(decayString='Upsilon(4S) -> B-:tag mu+:loose',
                    cut="",
                    path=my_path)

# perform MC matching (MC truth asociation)
ma.matchMCTruth(list_name='Upsilon(4S)', path=my_path)

# 5. build rest of the event
ma.buildRestOfEvent(target_list_name='Upsilon(4S)', path=my_path)

# 6. Select variables that we want to store to ntuple
d_vars = vc.mc_truth + vc.kinematics + vc.inv_mass
b_vars = vc.mc_truth + \
    vc.deltae_mbc + \
    vu.create_aliases_for_selected(list_of_variables=d_vars,
                                   decay_string='B- -> ^D0 pi-') + \
    vu.create_aliases(list_of_variables=['decayModeID'],
                      wrapper='daughter(0,extraInfo(variable))',
                      prefix="D")
mu_vars = vc.mc_truth

u4s_vars = vc.mc_truth + \
    vc.roe_multiplicities + \
    vc.recoil_kinematics + \
    vc.kinematics + \
    vu.create_aliases_for_selected(list_of_variables=b_vars,
                                   decay_string='Upsilon(4S) -> ^B- mu+') + \
    vu.create_aliases_for_selected(list_of_variables=mu_vars,
                                   decay_string='Upsilon(4S) -> B- ^mu+')

# 7. Saving variables to ntuple
Example #7
0
        MCassociation='breco',
        confidenceLevel=0.001,
        useFitAlgorithm='standard_PXD',
        path=my_path)

# Select variables that we want to store to ntuple
fs_vars = vc.pid + vc.track + vc.mc_truth
jpsiandk0s_vars = vc.mc_truth
bvars = vc.reco_stats + \
    vc.deltae_mbc + \
    vc.mc_truth + \
    vc.roe_multiplicities + \
    vc.flavor_tagging + \
    vc.tag_vertex + \
    vc.mc_tag_vertex + \
    vu.create_aliases_for_selected(list_of_variables=fs_vars,
                                   decay_string='B0 -> [J/psi -> ^mu+ ^mu-] pi0') + \
    vu.create_aliases_for_selected(list_of_variables=jpsiandk0s_vars,
                                   decay_string='B0 -> [^J/psi -> mu+ mu-] ^pi0')

# Saving variables to ntuple
output_file = 'B2A801-FlavorTagger.root'
ma.variablesToNtuple(decayString='B0:jspipi0',
                     variables=bvars,
                     filename=output_file,
                     treename='B0tree',
                     path=my_path)

# Summary of created Lists
ma.summaryOfLists(particleLists=['J/psi:mumu', 'pi0:looseFit', 'B0:jspipi0'],
                  path=my_path)
Example #8
0
]
track_vars = ['d0', 'z0', 'd0Err']
pid_vars = ['pid_ppi', 'pid_pk', 'pid_kpi']
event_vars = ['IPX', 'IPY', 'IPZ']

# Variables
# =============================================
# sigma+
sigma_vars = [
    'p', 'pt', 'pz', 'E', 'M', 'charge', 'distance', 'significanceOfDistance',
    'cosa', 'cosaXY', 'mcPDG', 'genMotherPDG', 'isSignal'
]
# proton
proton_vars = create_aliases_for_selected([
    'p', 'dr', 'dz', 'pid_ppi', 'pid_pk', 'pid_kpi', 'isSignal', 'genMotherPDG'
],
                                          'Sigma+ -> ^p+ pi0',
                                          prefix=['p'])

# pi0
pi0_vars = create_aliases_for_selected([
    'p', 'M', 'mcPDG', 'genMotherPDG', 'isSignal', 'distance',
    'significanceOfDistance'
],
                                       'Sigma+ -> p+ ^pi0',
                                       prefix=['pi0'])
# gamma
gamma_vars = create_aliases_for_selected([
    'phi', 'theta', 'E', 'goodBelleGamma', 'clusterReg', 'clusterE9E21',
    'clusterTiming', 'clusterErrorTiming', 'genMotherPDG', 'isSignal'
],
Example #9
0
# fit B vertex on the tag-side
vertex.TagV('B0', constraintType='tube', fitAlgorithm='Rave', path=main)

# perform best candidate selection
#b2.set_random_seed('USBelleIISummerSchool')
#ma.rankByHighest('B0', variable='random', numBest=1, path=main)

# create list of variables for output ntuple
standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
fs_vars = vc.pid + vc.track + vc.track_hits + standard_vars
jpsi_ks_vars = vc.inv_mass + vc.vertex + vc.mc_vertex + standard_vars
b_vars = vc.deltae_mbc + vc.tag_vertex + vc.mc_tag_vertex + ft.flavor_tagging + standard_vars

#b_vars += vu.create_aliases_for_selected([*fs_vars, 'isBremsCorrected'], 'B0 -> [J/psi -> ^e+ ^e-] K_S0', prefix=['ep', 'em'])
b_vars += vu.create_aliases_for_selected(fs_vars,
                                         'B0 -> J/psi [K_S0 -> ^pi+ ^pi-]',
                                         prefix=['pip', 'pim'])
b_vars += vu.create_aliases_for_selected(jpsi_ks_vars, 'B0 -> ^J/psi ^K_S0')

cmskinematics = vu.create_aliases(vc.kinematics, 'useCMSFrame({variable})',
                                  'CMS')
b_vars += vu.create_aliases_for_selected(
    cmskinematics, '^B0 -> [^J/psi -> ^mu+ ^mu-] [^K_S0 -> ^pi+ ^pi-]')

#variables.addAlias('withBremsCorrection', 'passesCut(passesCut(ep_isBremsCorrected == 1) or passesCut(em_isBremsCorrected == 1))')
#b_vars += ['withBremsCorrection']

# save variables to an ntuple
ma.variablesToNtuple('B0',
                     variables=b_vars,
                     filename='Bd2JpsiKS.root',
Example #10
0
#ma.printList(list_name='anti-nu_mu:gen', full=False, path=my_path)
#ma.printList(list_name='anti-nu_me:gen', full=False, path=my_path)

#ma.reconstructDecay('tau-:gen -> e-:gen anti-nu_e:gen nu_tau:gen', '', path=my_path)

var.addAlias('invMS1', 'invMassInLists(e-:gen, anti-nu_e:gen, nu_tau:gen)')
var.addAlias('invMS2', 'invMassInLists(e-:gen, nu_tau:gen)')
var.addAlias('invMS3', 'invMassInLists(anti-nu_e:gen, nu_tau:gen)')

mcVariables = [
    'p', 'px', 'py', 'pz', 'E', 'PDG', 'pt', 'invMS1', 'invMS2', 'invMS3'
]

#tauVariables = vc.inv_mass

variableList = vu.create_aliases_for_selected(list_of_variables=mcVariables,
                                              decay_string='^e-')  #+ #\
#vu.create_aliases_for_selected(list_of_variables=tauVariables,
#decay_string='^tau- -> ^e- ^anti-nu_e ^nu_tau')
#output_file = 'mcparticles.root'
#ma.variablesToNtuple(decayString='e+:gen',
#                    variables=mcVariables,
#                   treename='electron',
#                  filename=output_file,
#                 path=my_path)

output_file = 'GeneratorLevel-MCparticles.root'

ma.variablesToNtuple(decayString='e-:gen',
                     variables=variableList,
                     treename='electron',
                     filename=output_file,
Example #11
0
]
track_vars = ['d0', 'z0', 'd0Err']
pid_vars = ['pid_ppi', 'pid_pk', 'pid_kpi']
event_vars = ['IPX', 'IPY', 'IPZ']

# Variables
# =============================================
# sigma+
sigma_vars = [
    'p', 'pt', 'pz', 'E', 'M', 'charge', 'distance', 'significanceOfDistance',
    'cosa', 'cosaXY', 'mcPDG', 'genMotherPDG', 'isSignal'
]
# proton
proton_vars = create_aliases_for_selected([
    'p', 'dr', 'dz', 'pid_ppi', 'pid_pk', 'pid_kpi', 'isSignal', 'genMotherPDG'
],
                                          'Sigma+ -> ^p+ pi0',
                                          prefix=['p'])

# pi0
pi0_vars = create_aliases_for_selected(
    ['p', 'M', 'mcPDG', 'genMotherPDG', 'isSignal'],
    'Sigma+ -> p+ ^pi0',
    prefix=['pi0'])
# gamma
gamma_vars = create_aliases_for_selected(
    ['theta', 'E', 'genMotherPDG', 'isSignal'],
    'Sigma+ -> p+ [pi0 -> ^gamma ^gamma]',
    prefix=['gamma1', 'gamma2'])

ntuple_vars = sigma_vars + proton_vars + pi0_vars + gamma_vars + event_vars
# reconstruct B0 -> D0 pi0 decay
# keep only candidates with Mbc > 5.24 GeV
# and -1 < Delta E < 1 GeV
ma.reconstructDecay(decayString='B0:all -> D0:pi0pi0 pi0:looseFit',
                    cut='5.24 < Mbc < 5.29 and abs(deltaE) < 1.0',
                    path=my_path)

# perform MC matching (MC truth asociation)
ma.matchMCTruth(list_name='B0:all', path=my_path)

# Select variables that we want to store to ntuple
B0_vars = vc.inv_mass + \
    vc.mc_truth + \
    vu.create_aliases_for_selected(
        list_of_variables=vc.inv_mass + vc.mc_truth,
        decay_string='B0 -> ^D0 ^pi0') + \
    vu.create_aliases_for_selected(
        list_of_variables=vc.cluster,
        decay_string='B0 -> D0 [pi0 -> ^gamma ^gamma]')

pi0_vars = vc.mc_truth + \
    vc.kinematics + \
    ['extraInfo(BDT)', 'decayAngle(0)'] + \
    vu.create_aliases_for_selected(
        list_of_variables=vc.cluster + vc.kinematics,
        decay_string='pi0 -> ^gamma ^gamma')

# Saving variables to ntuple
output_file = 'B2A302-B02D0Pi0-D02Pi0Pi0-Reconstruction.root'
ma.variablesToNtuple('B0:all',
ma.rankByHighest(particleList="D0",
                 variable="chiProb",
                 cut="first_D_rank == 1",
                 outputVariable="second_D_rank",
                 path=my_path)
va.variables.addAlias('second_D_rank', 'extraInfo(second_D_rank)')

# add rank variable aliases for easier use
va.variables.addAlias('dM_rank', 'extraInfo(abs_dM_rank)')
va.variables.addAlias('chiProb_rank', 'extraInfo(chiProb_rank)')

# perform MC matching (MC truth asociation)
ma.matchMCTruth(list_name='D0', path=my_path)

# Select variables that we want to store to ntuple
fs_hadron_vars = vu.create_aliases_for_selected(list_of_variables=vc.mc_truth,
                                                decay_string='D0 -> ^K- ^pi+')

d0_vars = vc.vertex + \
    vc.mc_vertex + \
    vc.mc_truth + \
    fs_hadron_vars + \
    ['dM', 'chiProb', 'dM_rank', 'chiProb_rank', 'D1_pi_p_rank', 'first_D_rank', 'second_D_rank']

# Saving variables to ntuple
output_file = 'B2A602-BestCandidateSelection.root'
ma.variablesToNtuple(decayString='D0',
                     variables=d0_vars,
                     filename=output_file,
                     treename='D0',
                     path=my_path)
Example #14
0
# fit B vertex on the tag-side
vertex.TagV('B0', constraintType='tube', fitAlgorithm='Rave', path=main)

# perform best candidate selection
#b2.set_random_seed('USBelleIISummerSchool')
#ma.rankByHighest('B0', variable='random', numBest=1, path=main)

# create list of variables for output ntuple
standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
fs_vars = vc.pid + vc.track + vc.track_hits + standard_vars
jpsi_ks_vars = vc.inv_mass + vc.vertex + vc.mc_vertex + standard_vars
b_vars = vc.deltae_mbc + vc.tag_vertex + vc.mc_tag_vertex + ft.flavor_tagging + standard_vars

b_vars += vu.create_aliases_for_selected([*fs_vars, 'isBremsCorrected'],
                                         'B0 -> [J/psi -> ^e+ ^e-] K_S0',
                                         prefix=['ep', 'em'])
b_vars += vu.create_aliases_for_selected(fs_vars,
                                         'B0 -> J/psi [K_S0 -> ^pi+ ^pi-]',
                                         prefix=['pip', 'pim'])
b_vars += vu.create_aliases_for_selected(jpsi_ks_vars, 'B0 -> ^J/psi ^K_S0')

cmskinematics = vu.create_aliases(vc.kinematics, 'useCMSFrame({variable})',
                                  'CMS')
b_vars += vu.create_aliases_for_selected(
    cmskinematics, '^B0 -> [^J/psi -> ^e+ ^e-] [^K_S0 -> ^pi+ ^pi-]')

variables.addAlias(
    'withBremsCorrection',
    'passesCut(passesCut(ep_isBremsCorrected == 1) or passesCut(em_isBremsCorrected == 1))'
)
Example #15
0
# reconstruct D*+ -> D0 pi+ decay
# keep only candidates with Q = M(D0pi) - M(D0) - M(pi) < 20 MeV
# and D* CMS momentum > 2.5 GeV
ma.reconstructDecay(decayString='D*+ -> D0:kpi pi+:all',
                    cut='0.0 < Q < 0.2',
                    path=my_path)

# perform MC matching (MC truth asociation)
ma.matchMCTruth(list_name='D*+', path=my_path)

# Select variables that we want to store to ntuple
dstar_vars = vc.inv_mass + vc.mc_truth

fs_hadron_vars = vu.create_aliases_for_selected(
    list_of_variables=vc.pid + vc.track + vc.mc_truth,
    decay_string='D*+ -> [D0 -> ^K- ^pi+] ^pi+')

d0_vars = vu.create_aliases_for_selected(list_of_variables=vc.inv_mass +
                                         vc.mc_truth,
                                         decay_string='D*+ -> ^D0 pi+',
                                         prefix='D0')

# Saving variables to ntuple
output_file = 'B2A301-Dstar2D0Pi-Reconstruction.root'
ma.variablesToNtuple('D*+',
                     dstar_vars + d0_vars + fs_hadron_vars,
                     filename=output_file,
                     treename='dsttree',
                     path=my_path)
Example #16
0
        outfile = sys.argv[2]
    
    print(f"Input = {infile}")
    print(f"Output = {outfile}")
    
    ma.inputMdstList('default', [infile], path = mp)

    eff = 60
    stdSigmas(f'pi0eff{eff}', path = mp)
    ma.matchMCTruth('Sigma+:std', path = mp)
    
    va.addAlias('cosa', 'cosAngleBetweenMomentumAndVertexVector')
    va.addAlias('cosaXY', 'cosAngleBetweenMomentumAndVertexVectorInXYPlane')
    va.addAlias('abs_dM', 'abs(dM)')
    va.addAlias('M_noupdate', 'extraInfo(M_noupdate)')
    va.addAlias('p_noupdate', 'extraInfo(p_noupdate)')
    
    ntuple = ['M', 'p', 'chiProb', 'cosa', 'cosaXY', 'dr', 'dz', 'distance', 'isSignal', 'genMotherPDG']
    ntuple += ['IPX', 'IPY', 'IPZ']
    ntuple += create_aliases_for_selected(['protonID', 'pionID', 'dr', 'dz', 'p', 'isSignal'],
                                          'Sigma+ -> ^p+ pi0', prefix = ['p'])
    ntuple += create_aliases_for_selected(['mcP', 'p', 'M', 'distance', 'isSignal', 'genMotherPDG', 'M_noupdate', 'p_noupdate'],
                                          'Sigma+ -> p+ ^pi0', prefix = ['pi0'])
    
    ma.variablesToNtuple('Sigma+:std', ntuple, treename = f'sigma_eff{eff}', filename = outfile, path = mp)
    
    ma.fillParticleListFromMC('Sigma+:gen', '', path = mp)
    ma.variablesToNtuple('Sigma+:gen', ['cosa', 'cosaXY', 'p', 'M'], treename = 'sigma_gen', filename = outfile, path = mp)
    
    b2.process(path = mp)
    print(b2.statistics)
Example #17
0
ma.reconstructDecay(decayString='B0 -> rho0 gamma:tight',
                    cut='5.2 < Mbc < 5.29 and abs(deltaE) < 2.0',
                    path=my_path)

# perform MC matching (MC truth asociation)
ma.matchMCTruth(list_name='B0', path=my_path)

# Select variables that we want to store to ntuple

gamma_vars = vc.cluster + vc.mc_truth + vc.kinematics
rho_vars = vc.cluster + vc.mc_truth + vc.kinematics + vc.inv_mass
pi_vars = vc.pid + vc.track
b_vars = vc.kinematics + \
    vc.deltae_mbc + \
    vc.mc_truth + \
    vu.create_aliases_for_selected(list_of_variables=gamma_vars,
                                   decay_string='B0 -> rho0 ^gamma') + \
    vu.create_aliases_for_selected(list_of_variables=rho_vars,
                                   decay_string='B0 -> ^rho0 gamma') + \
    vu.create_aliases_for_selected(list_of_variables=rho_vars,
                                   decay_string='B0 -> [rho0 -> ^pi+ ^pi-] gamma')

# Saving variables to ntuple
rootOutputFile = 'B2A304-B02RhoGamma-Reconstruction.root'
ma.variablesToNtuple(decayString='B0',
                     variables=b_vars,
                     filename=rootOutputFile,
                     treename='b0',
                     path=my_path)

# Process the events
b2.process(my_path)
Example #18
0
kinematic_vars = ['M', 'p', 'pt', 'pz', 'phi', 'theta', 'charge', 'xp']
vertex_vars = [
    'cosa', 'cosaXY', 'chiProb', 'x', 'y', 'z', 'distance',
    'significanceOfDistance'
]
track_vars = ['d0', 'z0', 'd0Err']
pid_vars = ['pid_ppi', 'pid_pk', 'pid_kpi']
event_vars = ['IPX', 'IPY', 'IPZ']

# Variables
# =============================================
# sigma+
sigma_vars = kinematic_vars + vertex_vars + mc_vars + track_vars
# proton
proton_vars = create_aliases_for_selected(kinematic_vars + track_vars +
                                          pid_vars + mc_vars,
                                          'Sigma+ -> ^p+ pi0',
                                          prefix=['p'])
variables.addAlias('p_abs_d0', 'abs(p_d0)')
variables.addAlias('p_abs_z0', 'abs(p_z0)')
proton_vars += ['p_abs_d0', 'p_abs_z0']

# pi0
pi0_vars = create_aliases_for_selected(kinematic_vars + vertex_vars + mc_vars,
                                       'Sigma+ -> p+ ^pi0',
                                       prefix=['pi0'])
# gamma
gamma_vars = []
create_aliases_for_selected(['phi', 'theta', 'E', 'goodBelleGamma'],
                            'Sigma+ -> p+ [pi0 -> ^gamma ^gamma]',
                            prefix=['gamma1', 'gamma2'])
variables.addAlias('gamma_min_E', 'min(gamma1_E, gamma2_E)')
Example #19
0
]
list_basics = ['M', 'p', 'pt', 'pz']
list_lambda = [
    'distance', 'abs_dr', 'abs_dz', 'chiProb', 'cosa', 'cosaXY', 'min_daug_d0',
    'min_daug_z0', 'goodBelleLambda', 'goodLambda'
]
list_pid = ['pid_ppi', 'pid_pk', 'pid_kpi']
list_event = ['IPX', 'IPY', 'IPZ']

# Variables
# =============================================
# Lambda0
list_ntuple = list_basics + list_lambda + list_event + list_mc
# proton and pion
list_ntuple += create_aliases_for_selected(list_basics + list_pid + list_mc,
                                           'Lambda0 -> ^p+ ^pi-',
                                           prefix=['p', 'pi'])

# Reconstruction
# ==============================================
# No reconstruction. Just MC match the Lambda0:mdst list
ma.vertexTree('Lambda0:mdst', 0, path=mp)
ma.matchMCTruth('Lambda0:mdst', path=mp)
ma.applyCuts('Lambda0:mdst', 'isSignal == 0', path=mp)

# Output
# =============================================
mp.add_module('VariablesToNtuple',
              particleList='Lambda0:mdst',
              variables=list_ntuple,
              treeName='lambda',
Example #20
0
eventVariables = ['thrust', 'M', 'tauPlusMCMode', 'tauMinusMCMode']

# -- tau candidate variables
# added vc.kinematics for taus
tauVariables = vc.inv_mass + vc.kinematics + vc.deltae_mbc
tauVariables += ['mcErrors', 'genMotherPDG', 'mcPDG', 'isSignal']

# -- track level variables
trackVariables = vc.kinematics + vc.pid + vc.track + vc.track_hits + vc.vertex
trackVariables += [
    'theta', 'cosTheta', 'phi', 'charge', 'clusterE', 'EoverP', 'mcPDG'
]



variableList = vu.create_aliases_for_selected(list_of_variables=eventVariables,
                                              decay_string='^vpho') + \
               vu.create_aliases_for_selected(list_of_variables=tauVariables + ['charge'],
                                              decay_string='vpho -> ^tau+ ^tau-') + \
               vu.create_aliases_for_selected(list_of_variables=trackVariables,
                                              decay_string= decay_chain)

if tauMinus == '1':
    Outputfile = "tautau_mctruthsel_21_test.root"

if tauMinus == '3':
    Outputfile = "tautau_mctruthsel_23_test.root"

ma.variablesToNtuple('vpho:photon_B2SS',
                     variables=variableList,
                     treename='tree',
                     filename=Outputfile,
ma.reconstructDecay(decayString='B+:D0pi -> anti-D0:all pi+',
                    cut='5.24 < Mbc < 5.29 and abs(deltaE) < 1.0',
                    dmID=1,
                    path=my_path)

# perform MC matching (MC truth asociation)
ma.matchMCTruth(list_name='B+:D0pi',
                path=my_path)

# Select variables that we want to store to ntuple
d_vars = vc.inv_mass + vc.kinematics
pi_vars = vc.kinematics
b_vars = vc.deltae_mbc + \
    vc.mc_truth + \
    vu.create_aliases_for_selected(list_of_variables=d_vars,
                                   decay_string='B+ -> ^anti-D0 pi+',
                                   prefix='D0') + \
    vu.create_aliases_for_selected(list_of_variables=pi_vars,
                                   decay_string='B+ -> anti-D0 ^pi+',
                                   prefix='pi') + \
    vu.create_aliases(list_of_variables=['decayModeID'],
                      wrapper='daughter(0,extraInfo(variable))',
                      prefix="")

# Saving variables to ntuple
output_file = 'B2A303-MultipleDecays-Reconstruction.root'
ma.variablesToNtuple(decayString='B+:D0pi',
                     variables=b_vars,
                     filename=output_file,
                     treename='bp',
                     path=my_path)