小非的物理小站

Xiaofei 欢迎大家使用RSS订阅

马上订阅 小非的物理小站 RSS 更新: https://xiaophy.com/feed.xml

如何用ROOT做联合拟合?

2018年6月25日 00:00

“你本来不该知道这些的,可是现在我们没有更好的工具,所以得这样弄一下……”

如何做联合拟合?

首先这里就是应用Roofit的例子(Tutorials)来学习做联合拟合(SimutaneousFit),这是一个比较常用的东西,当利用多个衰变道来重建共同的共振态时,可能要share一些变量,这样在拟合中可以得到描述该共振态共同的变量值,进而完成拟合。

这里就试着来看看例子

  1首先这里是个声明,在总的ROOT体系里使用了[LGPL2.1协议](https://root.cern.ch/license),这位WouterVerkerke贡献了该例子
  2//////////////////////////////////////////////////////////////////////////
  3//
  4// 'ORGANIZATION AND SIMULTANEOUS FITS' RooFit tutorial macro #501
  5//
  6// Using simultaneous p.d.f.s to describe simultaneous fits to multiple
  7// datasets
  8//
  9// 07/2008 - Wouter Verkerke
 10//
 11/////////////////////////////////////////////////////////////////////////
 12
 13// 头文件,名字起的很有代表性,大家用的程序要有编程规范,不然容易乱套
 14// 其实主要是需要编译时最需要,不过编译好久没有用了,现在我不太会了忘记了,一般找个MakeFile比较好
 15// CMake是用来写MakeFile的编译工具,很有意思,MakeFile用来指挥编译按步骤进行,CMake用来写指挥MakeFile如何写
 16
 17#ifndef __CINT__
 18#include "RooGlobalFunc.h"
 19#endif
 20#include "RooRealVar.h"
 21#include "RooDataSet.h"
 22#include "RooGaussian.h"
 23#include "RooConstVar.h"
 24#include "RooChebychev.h"
 25#include "RooAddPdf.h"
 26#include "RooSimultaneous.h"
 27#include "RooCategory.h"
 28#include "TCanvas.h"
 29#include "TAxis.h"
 30#include "RooPlot.h"
 31
 32// 命名空间,像一种局部用的目录,防止重名,当然没遇到重的所以暂时还不懂
 33using namespace RooFit ;
 34
 35void rf501_simultaneouspdf()
 36{
 37  // C r e a t e   m o d e l   f o r   p h y s i c s   s a m p l e
 38  // -------------------------------------------------------------
 39  // Create observables
 40  // 这里首先定义了变量x用来构建实验分布的模型
 41  RooRealVar x("x","x",-8,8) ;
 42
 43  // Construct signal pdf
 44  // 定义了信号的概率密度函数,这里有中心值、sigma自变量x一起构造高斯函数
 45  // 经常有听到拿“形状”,指的其实就是概率密度函数的形状
 46  RooRealVar mean("mean","mean",0,-8,8) ;
 47  RooRealVar sigma("sigma","sigma",0.3,0.1,10) ;
 48  RooGaussian gx("gx","gx",x,mean,sigma) ;
 49
 50  // Construct background pdf
 51  // 类似于前面构造二阶切比雪夫作为本底概率密度函数,a0和a1作为其中系数
 52  RooRealVar a0("a0","a0",-0.1,-1,1) ;
 53  RooRealVar a1("a1","a1",0.004,-1,1) ;
 

剩余内容已隐藏

查看完整文章以阅读更多