[cernRoot] how to get contours from a TH2D
来源:互联网 发布:mysql 5.17 ngram 编辑:程序博客网 时间:2024/05/21 18:02
here, i use a TMultiGraph
to save the gotten contours, because the contours may be not closed in a TH2D
, with the function TMultiGraph * GetContours(const char * fn, const char * th2dname, int nlevel)
. And in the Test()
function, the TGraph
objects of the TMultiGraph
are extracted.
void Test(){ TMultiGraph * mg = GetContours("res_b64_fit_3id_ddmts_mc.root", "0", 1); mg->DrawClone("ACP");// TList * list = mg->GetListOfGraphs();// TGraph * gr = (TGraph *)list->First();// gr->DrawClone("ACP");// cout << list->GetSize() << endl;delete mg;}TMultiGraph * GetContours(const char * fn, const char * th2dname, int nlevel){ TGraph ** gr; TFile * f = new TFile(fn, "read"); TH2D * h = (TH2D *) f->Get(th2dname); double chisq = h->GetMinimum(); double contours[2] = {chisq + 2.3, chisq + 6.14}; h->SetContour(2, contours); TCanvas * cc = new TCanvas(th2dname, th2dname); cc->Divide(2,2); cc->cd(1); h->Draw("CONT1"); cc->cd(2); h->Draw("CONT Z LIST"); cc->Update();///////////////////////////// TObjArray * cont = (TObjArray *)(gROOT->GetListOfSpecials()->FindObject("contours")); TList * list = (TList *)cont->At(nlevel); int ngr = list->GetSize(); TGraph * grtemp; if(ngr > 0) { gr = new TGraph * [ngr]; grtemp = (TGraph *)list->First(); gr[0] = grtemp->Clone(); for(int igr = 1; igr < ngr; ++ igr) { grtemp = (TGraph *)list->After(grtemp); gr[igr] = grtemp->Clone(); } } cc->Close(); delete cc; f->Close(); delete f; delete grtemp; TMultiGraph * mg = new TMultiGraph(); for(int i = 0; i < ngr; ++ i) mg->Add(gr[i]); delete [] gr; return mg;}
0 0
- [cernRoot] how to get contours from a TH2D
- [cernRoot] Getting Contours From TH2D
- [cernRoot]How to get tree name from root file
- [cernRoot]how to get tree name?
- How to get IHTMLDocument2 from a HWND
- [cernRoot]Get graphs from TMultiGraph
- [cernRoot] How make a beautiful graph by CernRoot?
- How to get an X11 Window from a Process ID?
- How to Get WiFi From a Mile Away
- Java How to get the PID from a process?
- [cernRoot]how to deal with TPavetext->SetTextAngle()?
- how to get internal items from a dialog created from wizard of VC2005
- how to get a polygon
- How to get a solution?
- How to get the DOM of a WebBrowser control from a window handle (VB6)
- How to get file from classpath
- How to get parameters from the URL?
- How to get bean from tag component
- 迭代器用法
- 打印Log和吐司显示的工具类
- Linux下安装jdk8步骤详述
- ElasticSearch学习21_TF-IDF及其算法
- c#基本语法
- [cernRoot] how to get contours from a TH2D
- 微信小程序之数据传递
- mysql的sql_quote_show_create与SHOW CREATE TABLE命令介绍
- java线程基础
- 把MyEclipse中的项目部署到服务器
- 横竖屏切换时候Activity的生命周期
- 文章标题
- 欢迎使用CSDN-markdown编辑器
- status bar使用