本文整理汇总了C++中TGraph2D::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ TGraph2D::SetName方法的具体用法?C++ TGraph2D::SetName怎么用?C++ TGraph2D::SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGraph2D
的用法示例。
在下文中一共展示了TGraph2D::SetName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: plotContsSingle
void plotContsSingle(TFile *fOUT, std::string dirname, std::string fin, float X, int keepMDM=10){
//gSystem->Load("libHiggsAnalysisCombinedLimit.so");
gROOT->SetBatch(1);
TFile *fiSignals = TFile::Open("signalsVA.root");
RooWorkspace *workspace = (RooWorkspace*)fiSignals->Get("combinedws");
TFile *fiSignalsPS = TFile::Open("signalsPS.root");
RooWorkspace *workspacePS = (RooWorkspace*)fiSignalsPS->Get("combinedws");
//TFile *fi = TFile::Open("limits-output.root");
//TFile *fi = TFile::Open("signal-scans.root");
TFile *fi = TFile::Open(fin.c_str());
TTree *tree = (TTree*)fi->Get("limit");
double mh;
double limit;
float quantile;
tree->SetBranchAddress("mh",&mh);
tree->SetBranchAddress("limit",&limit);
tree->SetBranchAddress("quantileExpected",&quantile);
int nvt = tree->GetEntries();
TGraph2D *grV = new TGraph2D(); grV->SetName("vector");
TGraph2D *grA = new TGraph2D(); grA->SetName("axial");
TGraph2D *grS = new TGraph2D(); grS->SetName("scalar");
TGraph2D *grP = new TGraph2D(); grP->SetName("pseudoscalar");
TGraph2D *grVs = new TGraph2D(); grVs->SetName("vector_signal");
TGraph2D *grAs = new TGraph2D(); grAs->SetName("axial_signal");
TGraph2D *grSs = new TGraph2D(); grSs->SetName("scalar_signal");
TGraph2D *grPs = new TGraph2D(); grPs->SetName("pseudoscalar_signal");
int ptV=0;
int ptA=0;
int ptS=0;
int ptP=0;
TGraph *grV_mMED = new TGraph(); grV_mMED->SetName(Form("vector_mMED_mDM%d",keepMDM));
TGraph *grA_mMED = new TGraph(); grA_mMED->SetName(Form("axial_mMED_mDM%d",keepMDM));
TGraph *grS_mMED = new TGraph(); grS_mMED->SetName(Form("scalar_mMED_mDM%d",keepMDM));
TGraph *grP_mMED = new TGraph(); grP_mMED->SetName(Form("pseudoscalar_mMED_mDM%d",keepMDM));
int ptVm=0;
int ptAm=0;
int ptSm=0;
int ptPm=0;
grV_mMED->SetLineWidth(2); grV_mMED->SetMarkerSize(1.0);
grA_mMED->SetLineWidth(2); grA_mMED->SetMarkerSize(1.0);
grS_mMED->SetLineWidth(2); grS_mMED->SetMarkerSize(1.0);
grP_mMED->SetLineWidth(2); grP_mMED->SetMarkerSize(1.0);
for (int i=0; i<nvt;i++){
//if ( ! ( i%6==X ) ) continue; // 2 or 5
tree->GetEntry(i);
if (quantile!=X) continue;
int cd = code(mh);
float mmed = MMED(mh,cd);
float mdm = MDM(mh,cd);
// onshell crazyness?
if ((int)mmed==2*( (int)mdm) ) continue;
//
//std::cout << " int X = " << i << std::endl;
//std::cout << mh << ", " << cd << ", " << mmed << ", " << mdm << ", " << limit << std::endl;
//std::cout << mh << ", " << Form("monojet_signal_signal_%3d%04d%04d",cd,(int)mmed,(int)mdm) << std::endl;
//exit();
//std::vector<std::pair<double,double>> pointsV_mMED;
//std::vector<std::pair<double,double>> pointsA_mMED;
//std::vector<std::pair<double,double>> pointsS_mMED;
//std::vector<std::pair<double,double>> pointsP_mMED;
RooDataHist *dh;
if (cd==801 || cd==800) dh = (RooDataHist*) workspace->data(Form("monojet_signal_signal_%3d%04d%04d",cd,(int)mmed,(int)mdm));
else if (cd==805 || cd==806) dh = (RooDataHist*) workspacePS->data(Form("monojet_signal_signal_%3d%04d%04d",cd,(int)mmed,(int)mdm));
double nsignal = 0;
if (dh) {
nsignal = dh->sumEntries();
}
if (cd==800) {
grVs->SetPoint(ptV,mmed,mdm,nsignal);
grV->SetPoint(ptV,mmed,mdm,limit);
ptV++;
if ( (int)mdm == keepMDM ) {
grV_mMED->SetPoint(ptVm,mmed,limit);
//pointsV_mMED.push_back(std::mk_pair<double,double>(mmed,limit));
ptVm++;
}
} else if (cd==801){
grAs->SetPoint(ptA,mmed,mdm,nsignal);
grA->SetPoint(ptA,mmed,mdm,limit);
ptA++;
if ( (int)mdm == keepMDM ) {
grA_mMED->SetPoint(ptAm,mmed,limit);
ptAm++;
//.........这里部分代码省略.........
示例2: fillGraphsFromFilesDeltaNLL
void fillGraphsFromFilesDeltaNLL( const TString& par1name,
const TString& par2name,
const vector<TString>& fnames,
vector<string>& keys,
map<string,TGraph2D *>& m_graphs)
{
std::cout << "fillGraphsFromFilesDeltaNLL 1" << std::endl;
keys.push_back("exp68");
keys.push_back("exp95");
keys.push_back("exp99");
// uncommented below to plot observed!
keys.push_back("obs95");
TGraph2D *grobs = new TGraph2D();
TGraph2D *grexp = new TGraph2D();
m_graphs["obs95"] = grobs;
m_graphs["exp95"] = grexp;
grobs->SetName("graph2Dobs95");
grexp->SetName("graph2Dexp95");
Int_t nobs=0, nexp=0;
for( size_t i=0; i<fnames.size(); i++) {
TFile *f = new TFile(fnames[i]);
TTree *t = (TTree *) f->Get("limit");
if (!t) {
std::cerr<<"TFile "<<f->GetName()<<" does not contain the tree"<<std::endl;
return;
}
cout << fnames[i] << " has limit tree with " << t->GetEntries() << " entries." << endl;
Float_t deltaNLL, par1, par2;
Int_t iToy;
t->SetBranchAddress("iToy", &iToy);
t->SetBranchAddress("deltaNLL", &deltaNLL);
t->SetBranchAddress(par1name, &par1);
t->SetBranchAddress(par2name, &par2);
for (size_t j = 0, n = t->GetEntries(); j < n; ++j) {
t->GetEntry(j);
printf ("%d\r",j);
if( !iToy){
// cout <<"!iToy" << endl;
grobs->SetPoint(nobs++,par1,par2,2*deltaNLL);
// cout <<"grobs->SetPoint("<<nobs++<<","<<par1<<","<< par2<< ","<< 2*deltaNLL << endl;
}
else if (iToy == -1) {
// cout <<"iToy == -1" << endl;
grexp->SetPoint(nexp++,par1,par2,2*deltaNLL);
}
else {
cerr << "Unexpected value for iToy, = " << iToy << endl;
exit(-1);
}
} // tree entry loop
f->Close();
delete f;
} // file loop
cout << endl;
m_graphs["exp68"] = (TGraph2D*)grexp->Clone("graph2Dexp68");
m_graphs["exp99"] = (TGraph2D*)grexp->Clone("graph2Dexp99");
#if 0
TCanvas *canv = new TCanvas("tester","tester",500,500);
cout << grexp->GetN()<<" points. " <<endl;
grexp->Draw("TRI"); // cont 5z list");
#endif
} // fillGraphsFromFilesDeltaNLL
示例3: makeLikelihood
void makeLikelihood(){
gSystem->Load("libHiggsAnalysisCombinedLimit.so");
//TFile *fi = TFile::Open("lduscan_neg_ext/3D/lduscan_neg_ext_3D.root");
TFile *fi = TFile::Open("allthepoints.root");
TTree *tree = (TTree*)fi->Get("limit");
//TTree *tree = new TTree("tree_vals","tree_vals");
// ------------------------------ THIS IS WHERE WE BUILD THE SPLINE ------------------------ //
// Create 2 Real-vars, one for each of the parameters of the spline
// The variables MUST be named the same as the corresponding branches in the tree
RooRealVar ldu("lambda_du","lambda_du",0.1,-2.5,2.5);
RooRealVar lVu("lambda_Vu","lambda_Vu",0.1,0,3);
RooRealVar kuu("kappa_uu","kappa_uu",0.1,0,3);
RooSplineND *spline = new RooSplineND("spline","spline",RooArgList(ldu,lVu,kuu),tree,"deltaNLL",1.,true,"deltaNLL<1000 && TMath::Abs(quantileExpected)!=1 && TMath::Abs(quantileExpected)!=0");
// ----------------------------------------------------------------------------------------- //
//TGraph *gr = spline->getGraph("x",0.1); // Return 1D graph. Will be a slice of the spline for fixed y generated at steps of 0.1
fOut = new TFile("outplots-2hdm-neg-fine-mssm-final-try2.root","RECREATE");
// Plot the 2D spline
TGraph2D *gr = new TGraph2D(); gr->SetName("type1");
TGraph2D *gr2 = new TGraph2D(); gr2->SetName("type2");
TGraph2D *gr_ldu = new TGraph2D(); gr_ldu->SetName("ldu");
TGraph2D *gr_lVu = new TGraph2D(); gr_lVu->SetName("lVu");
TGraph2D *gr_kuu = new TGraph2D(); gr_kuu->SetName("kuu");
TGraph2D *gr2_ldu = new TGraph2D(); gr2_ldu->SetName("ldu_2");
TGraph2D *gr2_lVu = new TGraph2D(); gr2_lVu->SetName("lVu_2");
TGraph2D *gr2_kuu = new TGraph2D(); gr2_kuu->SetName("kuu_2");
TGraph2D *gr_t1_lVu_V_kuu = new TGraph2D(); gr_t1_lVu_V_kuu->SetName("t1_lVu_V_kuu");
TGraph2D *gr_mssm_ldu = new TGraph2D(); gr_mssm_ldu->SetName("mssm_ldu");
TGraph2D *gr_mssm_lVu = new TGraph2D(); gr_mssm_lVu->SetName("mssm_lVu");
TGraph2D *gr_mssm_kuu = new TGraph2D(); gr_mssm_kuu->SetName("mssm_kuu");
TGraph2D *g_FFS = new TGraph2D(); g_FFS->SetName("ffs_kuu1");
double x,y,z;
double mintF = 10000;
int pt=0 ;
/*
for (double x=-1.6;x<=1.6;x+=0.05){
for (double y=0.5;y<=1.5;y+=0.05){
ldu.setVal(x);
lVu.setVal(y);
kuu.setVal(1);
double dnll2 = 2*spline->getVal();
if (dnll2 < mintF) mintF = dnll2;
g_FFS->SetPoint(pt,x,y,dnll2);
pt++;
}
}
*/
TGraph2D *gcvcf = new TGraph2D(); gcvcf->SetName("cvcf");
TGraph2D *gcvcf_kuu = new TGraph2D(); gcvcf_kuu->SetName("cvcf_kuu");
TGraph2D *gcvcf_lVu = new TGraph2D(); gcvcf_lVu->SetName("cvcf_lVu");
double mintkvkf = 10000;
int pt=0 ;
if (doXCHECK){
// Sanity check, for ldu = 1, we should resolve kv kf ?
//
for (double cv=0.5;cv<=1.4;cv+=0.05){
for (double cf=0.3;cf<=1.7;cf+=0.05){
ldu.setVal(1.);
lVu.setVal(cv/cf);
kuu.setVal(cf*cf/gamma(cv,cf,cf));
double dnll2 = 2*spline->getVal();
if (dnll2 < mintkvkf) mintkvkf = dnll2;
gcvcf->SetPoint(pt,cv,cf,dnll2);
gcvcf_lVu->SetPoint(pt,cv,cf,lVu.getVal());
gcvcf_kuu->SetPoint(pt,cv,cf,kuu.getVal());
pt++;
}
}
std::cout << " Min cV-cF = " << mintkvkf << std::endl;
for (int p=0;p<gcvcf->GetN();p++){
double z = (gcvcf->GetZ())[p] - mintkvkf;
double x = (gcvcf->GetX())[p];
double y = (gcvcf->GetY())[p];
gcvcf->SetPoint(p,x,y,z);
}
}
double Vldu, VlVu, Vkuu;
int pt = 0;
double mint2 = 10000;
double mint1 = 10000;
if (doTHDM){
for (double scbma=-1;scbma<1;scbma+=0.01){
for (double b=0.01;b<1.45;b+=0.01){
double tanb = TMath::Tan(b);
if (tanb>1. ) b+=0.05;
double cbma;
if (scbma < 0) cbma = -1*scbma*scbma;
else cbma = scbma*scbma;
// Type 1
type1(cbma, tanb, &Vldu, &VlVu, &Vkuu);
//.........这里部分代码省略.........