当前位置: 首页>>代码示例>>Python>>正文


Python RooDataSet.tree方法代码示例

本文整理汇总了Python中ROOT.RooDataSet.tree方法的典型用法代码示例。如果您正苦于以下问题:Python RooDataSet.tree方法的具体用法?Python RooDataSet.tree怎么用?Python RooDataSet.tree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ROOT.RooDataSet的用法示例。


在下文中一共展示了RooDataSet.tree方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from ROOT import RooDataSet [as 别名]
# 或者: from ROOT.RooDataSet import tree [as 别名]

#.........这里部分代码省略.........
            
            deltaR_Jpsig = deltaR(jpsiCand.eta(),jpsiCand.phi(),gammaCand.eta(),gammaCand.phi())
            deltaPhi_Jpsig = deltaPhi(jpsiCand.phi(),gammaCand.phi())
            deltaEta_Jpsig = abs(jpsiCand.eta()-gammaCand.eta())
            deltaR_ChiJpsi = deltaR(jpsiCand.eta(),jpsiCand.phi(),chicCand.eta(),chicCand.phi())
    
            #if deltaR_Jpsig > 1.3 : continue
    
    
            Qval = chicCand.mass()-jpsiCand.mass()
    
            #if mass < 10.43 and mass > 10.42:
                #print "\n--------------\nmass : %f\tgammapt : %f\tjpsiPt :%f \t run %d \t lumi %d \t orbit %d \t file %s"  %(mass, gammaCand.pt(), jpsiCand.pt(),event._event.getRun().run(),event._event.luminosityBlock(), event._event.orbitNumber(),event._event.getTFile().GetName())
    
            #print "\n--------------\nrun %d \t event %015d \t lumi %06d \t orbit %010d \t file %s"  %(event._event.getRun().run(),event._event.id().event(),event._event.luminosityBlock(), event._event.orbitNumber(),event._event.getTFile().GetName())
    
            #print "\n--------------\nrun %d \t event %015d \t mass : %f\tgammapt : %f\tjpsiPt :%f \t file %s"  %(event._event.getRun().run(),event._event.id().event(),mass, gammaCand.pt(), jpsiCand.pt(),event._event.getTFile().GetName())
            nSel+=1
                    
            Ymass.Fill(jpsiCand.mass())
            hmass.Fill(Qval)
            hgammapt.Fill(gammaCand.pt())
            hgammapt_DeltaRJpsig.Fill(deltaR_Jpsig,gammaCand.pt())
            hct.Fill(jpsiCandPAT.userFloat('ppdlPV'))
            hmass_DeltaRJpsig.Fill(deltaR_Jpsig,Qval)
            hmass_DeltaRChiJpsi.Fill(deltaR_ChiJpsi,Qval)
            hmass_DeltaPhiJpsig.Fill(deltaPhi_Jpsig,Qval)
            hmass_DeltaEtaJpsig.Fill(deltaEta_Jpsig,Qval)
            hmass_gammapt.Fill(gammaCand.pt(),Qval)
            hmass_Rconv.Fill(convCand.conversionVertex().position().rho(),Qval)
            
            gammaP=sqrt(gammaCand.px()*gammaCand.px()+gammaCand.py()*gammaCand.py()+gammaCand.pz()*gammaCand.pz())
            UpsP=sqrt(jpsiCand.px()*jpsiCand.px()+jpsiCand.py()*jpsiCand.py()+jpsiCand.pz()*jpsiCand.pz())
            hGammaP.Fill(gammaP)
            hUpsP.Fill(UpsP)
            hCosAlphaP.Fill((gammaCand.px()*jpsiCand.px()+gammaCand.py()*jpsiCand.py()+gammaCand.pz()*jpsiCand.pz())/(gammaP*UpsP))
            
            #fill RooDataSet
            #if mass > 3.2 and mass < 4.0:
    
            sigma=Ymass_a+Ymass_b*(abs(jpsiCand.y())-Ymass_c)
            if abs(jpsiCand.y())<Ymass_c:
                sigma=Ymass_a
            
            
            deltaRChiJpsi.setVal(deltaR_ChiJpsi)
            deltaRJpsig.setVal(deltaR_Jpsig)  
            invm1S.setVal( Qval + Y1Smass0 )
            invm2S.setVal( Qval + Y2Smass0 )
            invm3S.setVal( Qval + Y3Smass0 )
            jpsipt.setVal(jpsiCand.pt())
            jpsimass.setVal(jpsiCand.mass())
            jpsieta.setVal(jpsiCand.y())
            ctpv.setVal(jpsiCandPAT.userFloat('ppdlPV'))
            ctpverr.setVal(jpsiCandPAT.userFloat('ppdlErrPV'))
            ctbs.setVal(jpsiCandPAT.userFloat('ppdlBS'))
            ctbserr.setVal(jpsiCandPAT.userFloat('ppdlErrBS'))
            gammapt.setVal(gammaCand.pt())
            Rconv.setVal(convCand.conversionVertex().position().rho())
            ctpvsig.setVal(abs(jpsiCandPAT.userFloat('ppdlPV'))/jpsiCandPAT.userFloat('ppdlErrPV'))
            ctbssig.setVal(abs(jpsiCandPAT.userFloat('ppdlBS'))/jpsiCandPAT.userFloat('ppdlErrBS'))
            jpsiVprob.setVal(jpsiCandPAT.userFloat('vProb'))
            Y1Smass_nSigma.setVal((jpsiCand.mass()-Y1Smass0)/sigma)
            Y2Smass_nSigma.setVal((jpsiCand.mass()-Y2Smass0)/sigma)
            Y3Smass_nSigma.setVal((jpsiCand.mass()-Y3Smass0)/sigma)
            vertexChi2ProbGamma.setVal(TMath.Prob(convCand.conversionVertex().chi2(),int(convCand.conversionVertex().ndof())))
#            vertexChi2ProbGamma.setVal(1)
            jpsipx.setVal(jpsiCand.px())
            jpsipy.setVal(jpsiCand.py())
            jpsipz.setVal(jpsiCand.pz())
            gammapx.setVal(gammaCand.px())
            gammapy.setVal(gammaCand.py())
            gammapz.setVal(gammaCand.pz())
            Q.setVal(Qval)
 
            weight.setVal(1)
 
            rds.add(argSet)
            
#            print TMath.Prob(convCand.conversionVertex().chi2(),int(convCand.conversionVertex().ndof())), "from ", int(convCand.conversionVertex().ndof()), " and " ,convCand.conversionVertex().ndof(), " and ", convCand.conversionVertex().chi2()
    
        if ncands%1000==0:
            print ncands
            #break
    
    print "countExceptions:                    ", countExceptions
    print "Number of chib candidates:          ", ncands 
    print "Number of selected chib candidates: ", nSel
    
    outdataset= TFile("rooDS_"+str(options.cutName)+".root","recreate")
    
    outdataset.cd()
    rds.Write()
    tree = rds.tree()
    tree.SetName("tree")
    tree.Write()
    
    hlist = [hmass,Ymass,hgammapt,hct, hgammapt_DeltaRJpsig , hmass_DeltaRJpsig ,hmass_DeltaPhiJpsig ,hmass_DeltaEtaJpsig , hmass_gammapt, hmass_DeltaRChiJpsi, hmass_Rconv,hCosAlphaP,hGammaP,hUpsP]
    
    for h in hlist : h.Write()
开发者ID:knuenz,项目名称:CMS,代码行数:104,代码来源:chibanalysis_new.py


注:本文中的ROOT.RooDataSet.tree方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。