DecayTreeTuple, [phis], Decay="phi(1020) -> ^K+ ^K-", Branches={ "phi": "phi(1020)-> K+ K-", "K+": "phi(1020)-> ^K+ K-", "K-": "phi(1020)-> K+ ^K-", }) ## extra configurataion of tuple algorithm (if needed) tuples = [tup] import DecayTreeTuple.Configuration from Configurables import TupleToolMCTruth, MCTupleToolKinematic, MCTupleToolHierarchy, TupleToolMCBackgroundInfo, TupleToolTrackInfo, TupleToolRICHPid, TupleToolMuonPid, TupleToolPid, TupleToolGeometry for tup in tuples: tupalg = tup.algorithm() #tupalg.OutputLevel = MSG.DEBUG tupalg.ToolList += [ "TupleToolGeometry", "TupleToolKinematic", "TupleToolPrimaries", "TupleToolEventInfo", "TupleToolTrackInfo" # , "TupleToolAngles" , "TupleToolPid" # , "TupleToolPropertime" # , "TupleToolTrigger" # , "TupleToolRICHPid" # , "TupleToolMuonPid"
if not bool(tes['/Event']): break evtnum += 1 ntuple.clear() # Fill event info. try: ntuple.ntuple['evt_pvr_n'][0] = len(tes['Rec/Vertex/Primary']) except: continue # Fill generator level info. fill = False # fill combinations try: dis = tes[phis.algorithm().Output] for di in dis: ntuple.addDi(di, "phi") fill = True except: pass # fill other tracks try: for trk in tes['Phys/StdAllNoPIDsPions/Particles']: ntuple.addTrk(trk) #fill = True except: pass # Fill the ntuple. if fill: ntuple.fill()
, Branches = { # 'B0' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) (omega(782) -> pi+ pi- (pi0 -> gamma gamma) )" , 'Jpsi' : "[B0]cc -> ^(J/psi(1S) -> mu+ mu- ) (omega(782) -> pi+ pi- (pi0 -> gamma gamma) )" , 'muplus' : "[B0]cc -> (J/psi(1S) -> ^mu+ mu- ) (omega(782) -> pi+ pi- (pi0 -> gamma gamma) )" , 'muminus' : "[B0]cc -> (J/psi(1S) -> mu+ ^mu- ) (omega(782) -> pi+ pi- (pi0 -> gamma gamma) )" , 'omega' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) ^(omega(782) -> pi+ pi- (pi0 -> gamma gamma) )" , 'piplus' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) (omega(782) -> ^pi+ pi- (pi0 -> gamma gamma) )" , 'piminus' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) (omega(782) -> pi+ ^pi- (pi0 -> gamma gamma) )" , 'pizero' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) (omega(782) -> pi+ pi- ^(pi0 -> gamma gamma) )" , 'gamma1' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) (omega(782) -> pi+ pi- (pi0 -> ^gamma gamma) )" , 'gamma2' : "[B0]cc -> (J/psi(1S) -> mu+ mu- ) (omega(782) -> pi+ pi- (pi0 -> gamma ^gamma) )" } ) tuple_B2psiomega = rd_selection.algorithm() for particle in ["B0", "Jpsi", "muplus", "muminus", "omega", "piplus", "piminus", "pizero", "gamma1", "gamma2"]: tuple_B2psiomega.addTool(TupleToolDecay, name = particle) # List of the reconstructed tuples tuples = [ tuple_B2psiomega ] for tup in tuples: # tup.ReFitPVs = True if MODE == "MC": tup.addTool(TupleToolMCTruth, name = "TruthTool") tup.addTool(TupleToolMCBackgroundInfo, name = "BackgroundInfo") tup.ToolList += ["TupleToolMCTruth/TruthTool"] tup.ToolList += ["TupleToolMCBackgroundInfo/BackgroundInfo"]
fill = False gens = tes['MC/Particles'] try: for gen in gens: pid = gen.particleID() if pid.abspid() == 333 or pid.abspid() == 321: ntuple.addGen(gen) fill = True except: print dir(gens[0].particleID()) pass # fill combinations try: dis = tes[phis.algorithm().Output] for di in dis: ntuple.addDi(di, "phi") except: pass # fill other kaons try: for trk in tes[kaons.algorithm().Output]: ntuple.addTrk(trk) #fill = True except: pass # Fill the ntuple. if fill: ntuple.fill() ntuple.close()