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


Python RooRealVar.removeMax方法代码示例

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


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

示例1: processFittingData

# 需要导入模块: from ROOT import RooRealVar [as 别名]
# 或者: from ROOT.RooRealVar import removeMax [as 别名]
def processFittingData(ws,cfg,section):
    pwd = ROOT.gDirectory.GetPath()

    inpFile = cfg.get(section,'input_data').split(':')[0]
    inpObj  = cfg.get(section,'input_data').split(':')[1]    

    #get the necessary object from the TFile and close it
    # keeping in the RooWorkspace context the whole time
    inpFile = TFile.Open(inpFile)
    ROOT.gDirectory.cd(pwd)    
    inpObj = inpFile.Get(inpObj)
    if isinstance(inpObj,ROOT.TTree):
        inpObj = inpObj.CloneTree()
    else:
        inpObj = inpObj.Clone()    
    inpFile.Close()
    ROOT.gDirectory.cd(pwd)
    
    bins = [float(i) for i in cfg.get(section,'obsBins').split(',')]
    
    obs = RooRealVar('%s_%s'%(cfg.get(section,'obsVar'),section),
                     '%s_%s'%(cfg.get(section,'obsVar'),section),
                     (bins[0]+bins[-1])/2.0,bins[0],bins[-1])
    getattr(ws,'import')(obs)
    n_observed = RooRealVar('n_observed_%s'%section,
                            'n_observed_%s'%section,
                            1.0,0,10)
    n_observed.removeMax()
    countingSet = RooDataSet('countingdata_%s'%section,
                             'countingdata_%s'%section,
                             RooArgSet(obs,n_observed))       

    if isinstance(inpObj,ROOT.TH1) and inpObj.GetDimension() == 1:
        print 'Input fitting data for channel: "%s" is a TH1'%section
        cfg.set(section,'obsBins',binEdges(inpObj))        
        print 'Config binning is overridden, new binning is:',cfg.get(section,'obsBins')
        inpObj.SetName('%s_input_data'%section)       

        for i in range(1,len(bins)+1):
            print i,inpObj.GetBinContent(i)
                
        histoToCountingSet(ws,cfg,section,inpObj,countingSet,n_observed)        
            
    elif isinstance(inpObj,ROOT.TTree):
        print 'Input fitting data for channel: "%s" is a TTree'%section
        obsVar = cfg.get(section,'obsVar')        
        bins = [float(i) for i in cfg.get(section,'obsBins').split(',')]
        temp = TH1F('%s_input_data'%section,
                    'Input Photon E_{T} Spectrum from Data',
                    len(bins)-1,array('d',bins))        
        
        inpObj.Draw('%s >> %s_input_data'%(obsVar,section),'','goff')

        for i in range(1,len(bins)+1):
            print i,temp.GetBinContent(i)

        histoToCountingSet(ws,cfg,section,temp,countingSet,n_observed)
        
        
    else:
        print 'Invalid input data type: "%s"\nExiting!'%(inpObj.IsA())
        exit(1)

    getattr(ws,'import')(countingSet)
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:66,代码来源:aTGCRooStats.py


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