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


C++ TMultiGraph::SetMaximum方法代码示例

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


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

示例1: plotEffCurveMulti

void plotEffCurveMulti(const char* canvas,
		       int ngraph, int npts, const double* signalEff, 
		       const char classifiers[][200],
		       const double* bgrndEff, const double* bgrndErr,
		       double ymax, bool setMax=false)
{
  TCanvas *c
    = new TCanvas(canvas,"SPR BgrndEff vs SignalEff",200,10,600,400);
  TMultiGraph *mg = new TMultiGraph();
  if( setMax ) mg->SetMaximum(ymax);
  TLegend *leg = new TLegend(0.1,0.85,0.5,1.,
			     "SPR BackgroundEff vs SignalEff","NDC");
  for( int i=0;i<ngraph;i++ ) {
    TGraph *gr = new TGraphErrors(npts,signalEff,
				  bgrndEff+(i*npts),0,bgrndErr+(i*npts));
    gr->SetMarkerStyle(21);
    gr->SetLineColor(i+1);
    gr->SetLineWidth(3);
    gr->SetMarkerColor(i+1);
    mg->Add(gr);
    leg->AddEntry(gr,classifiers[i],"P");
  }
  mg->Draw("ALP");
  leg->Draw();
}
开发者ID:aashaqshah,项目名称:cmssw-1,代码行数:25,代码来源:spr_plot.C

示例2: plotEffOnOneCanvas

// =================================================
void plotter::plotEffOnOneCanvas( string extension )
{
	yAxisLabel_ = "Efficiency";
	xAxisLabel_ = "Electron p_{T} (GeV)";
	
	x_[6] = 125;
	xRange_[6] = 75;
	
	setExtension( extension );
   setOutFilexPrefix( "eff" );
	setUpCanvas();
	
	TMultiGraph *mg = new TMultiGraph();
	
   for( int j = 0; j < max_-1; j++)
	{
		// Read Data input
      input.readDataEff( inputDataPath_, files1_.at(j) );
		eff1_ = input.getDataEff().first;
		eff_error1_ = input.getDataEff().second;
		
      TGraphAsymmErrors *tgaeEffData = new TGraphAsymmErrors( numOfPoints_, x_, eff1_, xRange_, xRange_, eff_error1_, eff_error1_);
      tgaeEffData->SetTitle("TGraphAsymmErrors for Data efficiencies");
      tgaeEffData->SetMarkerSize(1);
      if (j == 0) tgaeEffData->SetMarkerStyle(20);
		else if (j == 1) tgaeEffData->SetMarkerStyle(24);
      else if (j == 2) tgaeEffData->SetMarkerStyle(21);
      else tgaeEffData->SetMarkerStyle(25);
		
		tgaeEffData->SetMarkerColor(kAzure - 2*j);
      tgaeEffData->SetLineColor(kAzure - 2*j);
		
		legend_->SetX1(.60);
		legend_->SetX2(.87);
		legend_->AddEntry(tgaeEffData, etaRegionLegend_.at(j), "p");
		
		mg->Add(tgaeEffData,"p");
   } // end for j
	
	canvas->SetLogx();
	
	mg->SetMinimum(0.4);
	mg->SetMaximum(1);
	mg->Draw("A");
	mg->GetXaxis()->SetMoreLogLabels();
	mg->GetXaxis()->SetTitle( xAxisLabel_ );
   mg->GetYaxis()->SetTitle( yAxisLabel_ );
	mg->GetXaxis()->SetTitleOffset(1.3);
	mg->GetYaxis()->SetTitleOffset(1.25);
	
	legend_->Draw();
	pt_->Draw();
	texZee_->Draw();
//	texCMS_->Draw();
//	texLumi_->Draw();
	
	cout << "--------------------------------------------------------------------------------" << endl;
	TString fileName = "eff_04";
	if ( extension_ == "all" )
	{
		canvas->SaveAs( outPlotsDir_ + fileName + ".pdf" );
		canvas->SaveAs( outPlotsDir_ + fileName + ".png" );
		canvas->SaveAs( outPlotsDir_ + fileName + ".eps" );
//		canvas->SaveAs( outPlotsDir_ + fileName + ".ps"  );
		canvas->SaveAs( outPlotsDir_ + fileName + ".C"   );
		canvas->SaveAs( outPlotsDir_ + fileName + ".root");
	}
	else
		canvas->SaveAs( outPlotsDir_ + fileName + extension_ );
	cout << "--------------------------------------------------------------------------------" << endl;
	
	canvas->Destructor();
	legend_->Clear();
	
	// Clear out files vector
   outFiles_.clear();
	
} // end plotEffOnOneCanvas
开发者ID:tsculac,项目名称:Electron_TagAndProbe,代码行数:79,代码来源:plotter_original.cpp

示例3: start

void start(const char *basename, const double offset = 0.0)
{

  TFile *file1 = TFile::Open(Form("Data/ROOT/%s_VMIN_SIPM1_meanHistSub_projections.root",basename));
  TFile *file2 = TFile::Open(Form("Data/ROOT/%s_VMIN_SIPM2_meanHistSub_projections.root",basename));

  if(file1==NULL) {cout<<"cannot find file1"<<endl;return;}
  if(file2==NULL) {cout<<"cannot find file2"<<endl;return;}

  calc(file1,file2,basename,0);
  calc(file1,file2,basename,1);
  calc(file1,file2,basename,2);
  calc(file1,file2,basename,3);
  calc(file1,file2,basename,4);
  calc(file1,file2,basename,5);
  calc(file1,file2,basename,6);
  calc(file1,file2,basename,7);
  calc(file1,file2,basename,8);

  ofstream fout(Form("Data/Text/%s_Asymmetries.txt"));
  double pn[9];
  for(int i=0; i<9; i++)
    {
      fout<<frac1[i]<<" "
	  <<frac2[i]<<" "
	  <<fracAv[i]<<" "
	  <<fracAs[i]<<" "
	  <<endl;
      //pn[i] = i+0.5; // projection number
      pn[i] = -2.0 + i/2.0; // distance
      pn[i] += offset;
    }

  TGraph *tg1 = new TGraph(9,pn,frac1);
  TGraph *tg2 = new TGraph(9,pn,frac2);
  TGraph *tgAv = new TGraph(9,pn,fracAv);
  TGraph *tgAs = new TGraph(9,pn,fracAs);
  tg1->SetMarkerStyle(kFullCircle);
  tg2->SetMarkerStyle(kFullCircle);
  tgAv->SetMarkerStyle(kOpenCircle);
  tgAs->SetMarkerStyle(kFullSquare);
  tg1->SetMarkerColor(kBlue);
  tg2->SetMarkerColor(kRed);
  tgAv->SetMarkerColor(kBlack);
  tgAs->SetMarkerColor(kBlack);
  TMultiGraph *tmg = new TMultiGraph();
  tmg->Add(tgAs);
  tmg->Add(tg1);
  tmg->Add(tg2);
  tmg->Add(tgAv);
  tmg->Draw("ap");
  tmg->SetMaximum(1.0);
  tmg->SetMinimum(0.0);
  tmg->GetXaxis()->SetLimits(-2.25+offset,2.25+offset);
  //tmg->GetXaxis()->SetLimits(0.0,9.0); // projection number
  tmg->GetXaxis()->SetTitle("Distance from fiber (cm)");
  tmg->GetYaxis()->SetTitle("f_{core} from different methods");
  TLegend *leg1 = new TLegend(0.18,0.18,0.28,0.38);
  leg1->AddEntry(tg1,"SiPM1","p");
  leg1->AddEntry(tg2,"SiPM2","p");
  leg1->AddEntry(tgAv,"Average SiPM1+SiPM2","p");
  leg1->AddEntry(tgAs,"Asymmetry","p");
  leg1->SetFillStyle(0);
  leg1->SetTextSize(0.05);
  leg1->Draw();

  c1->Print(Form("Figures/%s_AsymmetryComparison.png",basename));
  c1->Print(Form("Figures/%s_AsymmetryComparison.pdf",basename));

}
开发者ID:belmonrj,项目名称:TestStand,代码行数:70,代码来源:DrawAsymmetry.C

示例4: plotExclusion


//.........这里部分代码省略.........
   exp1[7] = 0.565467804363;
   exp1[22] = 0.425115372019;
   exp2[7] = 0.672064509509;
   exp2[22] = 0.4120593318;
   exp[8] = 0.563947415859;
   obs[8] = 0.536922403468;
   exp1[8] = 0.672650081221;
   exp1[21] = 0.534487182571;
   exp2[8] = 0.808457381294;
   exp2[21] = 0.514649041607;
   exp[9] = 0.700579859433;
   obs[9] = 0.676280384249;
   exp1[9] = 0.798482092783;
   exp1[20] = 0.674378686191;
   exp2[9] = 1.0120004248;
   exp2[20] = 0.663954563503;
   exp[10] = 0.918970653344;
   obs[10] = 0.889845853577;
   exp1[10] = 1.04923440155;
   exp1[19] = 0.858375432352;
   exp2[10] = 1.24717913491;
   exp2[19] = 0.746731022724;
   exp[11] = 1.19793401961;
   obs[11] = 1.17653186674;
   exp1[11] = 1.39512272299;
   exp1[18] = 1.16185610477;
   exp2[11] = 1.62812001722;
   exp2[18] = 1.01020656441;
   exp[12] = 1.58254134376;
   obs[12] = 1.56834374153;
   exp1[12] = 1.84607923047;
   exp1[17] = 1.51628586669;
   exp2[12] = 2.18103685499;
   exp2[17] = 1.31304946585;
   exp[13] = 2.30981854338;
   obs[13] = 2.30117260535;
   exp1[13] = 2.42189837009;
   exp1[16] = 2.13395645197;
   exp2[13] = 2.92307163497;
   exp2[16] = 2.04337780276;
   exp[14] = 3.19375101546;
   obs[14] = 3.16458908761;
   exp1[14] = 3.28113723449;
   exp1[15] = 2.99139611866;
   exp2[14] = 4.07139223438;
   exp2[15] = 2.84407249777;

  TGraph* grExp = new TGraph(15, masses, exp);
  TGraph* grObs = new TGraph(15, masses, obs);
  TGraph* grExp1 = new TGraph(30, masses2D, exp1);
  TGraph* grExp2 = new TGraph(30, masses2D, exp2);

  grExp->SetLineColor(kBlack);
  grExp->SetMarkerColor(kBlack);
  grExp->SetLineStyle(kDashed);
  grObs->SetLineColor(kBlack);
  grObs->SetMarkerColor(kBlack);
  grObs->SetMarkerStyle(20);
  grExp1->SetFillStyle(1001);
  grExp1->SetFillColor(kGreen);
  grExp2->SetFillStyle(1001);
  grExp2->SetFillColor(kYellow);

  mg->Add(grExp2, "F");
  mg->Add(grExp1, "F");
  mg->Add(grExp,  "L");
  mg->Add(grObs,  "P");
  mg->SetMinimum(0.1);
  mg->SetMaximum(10.);
  mg->Draw("a");

  TLine* line = new TLine(200, 1, 1500, 1);
  line->Draw();

  TLegend* leg = new TLegend(0.2, 0.62, 0.58, 0.92);
  leg->SetTextSize(0.05);
  leg->SetTextFont(42);
  leg->AddEntry(grObs, "Obs. Limit", "p");
  leg->AddEntry(grExp, "Exp. Limit", "l");
  leg->AddEntry(grExp1, "Exp. #pm 1#sigma", "f");
  leg->AddEntry(grExp2, "Exp. #pm 2#sigma", "f");
  leg->AddEntry(line, "W'_{SSM}#rightarrowWZ Coupling", "l");
  leg->SetBorderSize(0);
  leg->SetFillColor(0);
  leg->Draw();

  TLatex latexLabel;
  latexLabel.SetNDC();
  latexLabel.SetTextSize(0.05);
  latexLabel.SetTextFont(42);
  latexLabel.DrawLatex(0.33, 0.96, "CMS Preliminary 2011");
  latexLabel.DrawLatex(0.67, 0.38, "#sqrt{s} = 7 TeV");
  latexLabel.DrawLatex(0.62, 0.25, Form("#intL dt = %.2f fb^{-1}",4.98));


  c1->RedrawAxis();
  c1->Print("wprimewz_limits.C");
  c1->Print("wprimewz_limits.pdf");
  c1->Print("wprimewz_limits.png");
}
开发者ID:cfantasia,项目名称:CMGWPrimeGroup,代码行数:101,代码来源:plotExclusion.C

示例5: plot


//.........这里部分代码省略.........

	countMass++;

      }
    }
  

  for(int i = 0 ; i < nMassPoints ; i++){
    cout << "Mass " << X[i] << endl;
    cout << "Exp  " << Y[i] << endl;
    cout << "Obs  " << obsY[i] << endl;

    eY1sH[i] = eY1sH[i]-Y[i];
    eY1sL[i] = fabs(eY1sL[i]-Y[i]);
    eY2sH[i] = eY2sH[i]-Y[i];
    eY2sL[i] = TMath::Max( TMath::Abs(eY2sL[i]-Y[i]), eY1sL[i] );

    if((string(stream.Data())).find("mu")!=string::npos && (string(variable.Data())).find("diTauVisMass")!=string::npos &&
       (i==1 || i==4) ){
      eY1sH[i] = eY1sH[i-1];
      eY2sH[i] = eY2sH[i-1];
    }

    if((string(stream.Data())).find("mu")!=string::npos && (string(variable.Data())).find("diTauNSVfitMass")!=string::npos &&
       i==4 )
      eY2sH[i] = eY2sH[i-1];

    if((string(stream.Data())).find("ele")!=string::npos && (string(variable.Data())).find("diTauVisMass")!=string::npos &&
       i==6 )
      eY2sH[i] = eY2sH[7]-Y[7];

    cout << "1s Up   " << eY1sH[i] << endl;
    cout << "1s Down " << eY1sL[i] << endl;
  }

  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("");

  TGraphAsymmErrors* expected = new TGraphAsymmErrors(nMassPoints, X, Y, eX1sL ,eX1sL , eX1sL, eX1sL);
  TGraphAsymmErrors* oneSigma = new TGraphAsymmErrors(nMassPoints, X, Y, eX1sL, eX1sL, eY1sL, eY1sH);
  TGraphAsymmErrors* twoSigma = new TGraphAsymmErrors(nMassPoints, X, Y, eX2sL, eX2sL, eY2sL, eY2sH);
  TGraphAsymmErrors* observed = new TGraphAsymmErrors(nMassPoints, X, obsY, eX1sL ,eX1sL , eX1sL, eX1sL);

 
  oneSigma->SetMarkerColor(kBlack);
  oneSigma->SetMarkerStyle(kFullCircle);
  oneSigma->SetFillColor(kGreen);
  oneSigma->SetFillStyle(1001);

  twoSigma->SetMarkerColor(kBlack);
  twoSigma->SetMarkerStyle(kFullCircle);
  twoSigma->SetFillColor(kYellow);
  twoSigma->SetFillStyle(1001);

  expected->SetMarkerColor(kBlack);
  expected->SetMarkerStyle(kFullCircle);
  expected->SetMarkerSize(1.5);
  expected->SetLineColor(kBlack);
  expected->SetLineWidth(2);

  observed->SetMarkerColor(kBlue);
  observed->SetMarkerStyle(1);
  observed->SetLineColor(kBlue);
  observed->SetLineWidth(4);

  mg->Add(twoSigma);
  mg->Add(oneSigma);
  mg->Add(expected);
  mg->Add(observed);

  mg->Draw("ALP3");

  c1->cd();
  gPad->Modified();
  mg->GetXaxis()->SetLimits(105,140);
  mg->GetYaxis()->SetTitleOffset(0.97);
  mg->SetMinimum(0.);
  mg->SetMaximum(xMax);
  mg->GetXaxis()->SetTitle("m_{H} (GeV)");
  mg->GetYaxis()->SetTitle("#sigma X BR(H#rightarrow#tau#tau)_{95% CLs}/#sigma_{SM}");

  if((string(stream.Data())).find("ele")!=string::npos )
    leg->SetHeader("#splitline{CMS Preliminary}{#sqrt{s}=7 TeV, 1.9 fb^{-1}, #tau_{e}#tau_{had}}");
  else if((string(stream.Data())).find("mu")!=string::npos )
    leg->SetHeader("#splitline{CMS Preliminary}{#sqrt{s}=7 TeV, 1.9 fb^{-1}, #tau_{#mu}#tau_{had}}");

  leg->AddEntry(expected,"Expected CLs limit","P");
  leg->AddEntry(observed,"Observed CLs limit","L");

  leg->Draw();

  TF1 *line = new TF1("line","1",100,150);
  line->SetLineColor(kRed);
  line->SetLineWidth(2);

  line->Draw("SAME");

  gPad->SaveAs("submit/grid/limits_"+stream+"_"+variable+".png");

}
开发者ID:aknayak,项目名称:LLRAnalysis,代码行数:101,代码来源:makePlot.C

示例6: main

int main(int argc, char** argv)
{

  std::string plot_type = argv[1];
    //"HVScan";
  //    std::string plot_type = "AngScanHigh";
  //  std::string plot_type = "scanX0_HVLow_50";
  //  std::string plot_type = "scanX0_HVLow_20";
  std::cout<<plot_type<<std::endl;

  TFile* inF_GaAsEm;
  //TFile* inF_GaAsEm_OFF;
  TFile* inF_MultiAlkEm;
  //TFile* inF_MultiAlkEm_OFF;
  TFile* inF_Double9090;
  TFile* inF_Double9040;
  TFile* inF_Double9090b;
  TFile* inF_Double9040b;

  TMultiGraph *mg = new TMultiGraph();

  TLegend *legC;

  if(plot_type == "HV12"){
    legC = new TLegend(0.12,0.62,0.30,0.87,NULL,"brNDC");

	//plot name MCPName_ScanType_HVScanScanType_MCPName
    inF_MultiAlkEm = TFile::Open("plots/efficiency_studies/MultiAlkEm_HV12_HVScan12_MultiAlkEm.root");
    inF_GaAsEm = TFile::Open("plots/efficiency_studies/GaAsEm_HV12_HVScan12_GaAsEm.root");
    //inF_GaAsEm_OFF = TFile::Open("plots/efficiency_studies/GaAsEm_HV_HVScan7.root");
    inF_Double9090 = TFile::Open("plots/efficiency_studies/Double9090_HV12_HVScan12_Double9090.root");
    inF_Double9040 = TFile::Open("plots/efficiency_studies/Double9040_HV12_HVScan12_Double9040.root");    
    TGraphErrors* eff_GaAsEm = (TGraphErrors*)inF_GaAsEm->Get("eff");
    TGraphErrors* eff_MultiAlkEm = (TGraphErrors*)inF_MultiAlkEm->Get("eff");
    TGraphErrors* eff_Double9040 = (TGraphErrors*)inF_Double9040->Get("eff");
    TGraphErrors* eff_Double9090 = (TGraphErrors*)inF_Double9090->Get("eff");

    //settings
    eff_GaAsEm->SetMarkerColor(kGreen+1);
    eff_GaAsEm->SetLineColor(kGreen+1);
    //eff_GaAsEm_OFF->SetMarkerColor(kGreen+1);
    //eff_GaAsEm_OFF->SetLineColor(kGreen+1);
    eff_Double9040->SetMarkerColor(kBlue);
    eff_Double9040->SetLineColor(kBlue);
    eff_Double9090->SetMarkerColor(kRed);
    eff_Double9090->SetLineColor(kRed);
    eff_MultiAlkEm->SetMarkerColor(1);
    eff_MultiAlkEm->SetLineColor(1);
  //
    eff_GaAsEm->SetMarkerStyle(20);
    eff_GaAsEm->SetLineWidth(2);
    eff_GaAsEm->SetMarkerSize(0.9);
//    eff_GaAsEm_OFF->SetMarkerStyle(22);
//    eff_GaAsEm_OFF->SetLineWidth(2);
    eff_Double9040->SetMarkerStyle(20);
    eff_Double9040->SetLineWidth(2);
    eff_Double9040->SetMarkerSize(0.9);
    eff_Double9090->SetMarkerStyle(20);
    eff_Double9090->SetLineWidth(2);
    eff_Double9090->SetMarkerSize(0.9);
    eff_MultiAlkEm->SetMarkerStyle(22);
    eff_MultiAlkEm->SetLineWidth(2);

    legC->SetTextFont(42);
    legC->SetTextSize(0.034);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);
    legC->AddEntry(eff_MultiAlkEm, "MultiAlk. emitt. ON: #DeltaV_{12} = 300 V", "p");
    legC->AddEntry(eff_GaAsEm, "GaAs emitt. ON: #DeltaV_{12} = 300 V", "p");
//    legC->AddEntry(eff_GaAsEm_OFF, "GaAs emitt. - iMCP mode", "p");
    legC->AddEntry(eff_Double9040, "Double9040 HV_{1} = HV_{2}", "p");
    legC->AddEntry(eff_Double9090, "Double9090 HV_{1} = HV_{2}", "p");
  
    mg->Add(eff_GaAsEm);
//    mg->Add(eff_GaAsEm_OFF);
    mg->Add(eff_Double9090);
    mg->Add(eff_Double9040);
    mg->Add(eff_MultiAlkEm);

    //    TCanvas* c = new TCanvas("cEff","cEff",400,800);
    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/efficiency_%s.pdf", plot_type.c_str());

    mg->Draw("APL");
    mg->SetTitle("Electron Beam 450 MeV");
    mg->GetXaxis()->SetRangeUser(1200,4000);
    mg->GetXaxis()->SetTitle("HV_{1} (V)");
    mg->GetXaxis()->SetTitleSize(0.05);
    mg->GetYaxis()->SetTitle("Efficiency");
    mg->GetYaxis()->SetTitleSize(0.05);
    mg->SetMaximum(1);
    mg->SetMinimum(0);
    mg->Draw("APL");  
    legC->Draw("same");
    banner4Plot();
//.........这里部分代码省略.........
开发者ID:amartelli,项目名称:iMCP_TB,代码行数:101,代码来源:drawEfficiency.cpp

示例7: drawFigure7

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
//    parameter = "dg0"
//    parameter = "lam0"
//    parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
  gInterpreter->ExecuteMacro("WZPaperStyle.C");

  gSystem->mkdir("pdf", kTRUE);
  gSystem->mkdir("png", kTRUE);


  // Individual settings
  //----------------------------------------------------------------------------
  if (parameter.Contains("dg0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#lambda";
      xmin   = -0.5;
      xmax   =  0.5;
      ymin   = -0.039;
      ymax   =  0.053;
    }
  else if (parameter.Contains("lam0"))
    {
      xtitle = "#Delta#kappa^{Z}";
      ytitle = "#Deltag^{Z}_{1}";
      xmin   = -0.53;
      xmax   =  0.53;
      ymin   = -0.05;
      ymax   =  0.09;
    }
  else if (parameter.Contains("dk0"))
    {
      xtitle = "#Deltag^{Z}_{1}";
      ytitle = "#lambda";
      xmin   = -0.059;
      xmax   =  0.059;
      ymin   = -0.037;
      ymax   =  0.052;
    }


  // Read the input file
  //----------------------------------------------------------------------------
  TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");

  TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
  TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
  TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
  TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
  TGraph* bestFit     = (TGraph*)file->Get("bestFit");

  bestFit->SetMarkerSize(1.5);
  bestFit->SetMarkerStyle(34);

  TGraph* g_large = new TGraph(2);

  g_large->SetPoint(0, -1.0, 1.0);
  g_large->SetPoint(1,  1.0, 1.0);


  // Draw
  //----------------------------------------------------------------------------
  TCanvas* canvas = new TCanvas("canvas", "canvas");

  TMultiGraph* mg = new TMultiGraph();

  mg->Add(cont_exp_68);
  mg->Add(cont_exp_95);
  mg->Add(cont_exp_99);
  mg->Add(cont_obs_95);
  mg->Add(bestFit, "p");
  mg->Add(g_large);

  mg->Draw("ac");

  mg->SetMinimum(ymin);
  mg->SetMaximum(ymax);


  // Axis labels
  //----------------------------------------------------------------------------
  TAxis* xaxis = mg->GetXaxis();
  TAxis* yaxis = mg->GetYaxis();
  
  xaxis->SetLabelFont  (    42);
  xaxis->SetLabelOffset(  0.01);
  xaxis->SetLabelSize  (  0.05);
  xaxis->SetNdivisions (   505);
  xaxis->SetTitle      (xtitle);
  xaxis->SetTitleFont  (    42);
  xaxis->SetTitleOffset(   1.2);
  xaxis->SetTitleSize  (  0.05);

//.........这里部分代码省略.........
开发者ID:piedraj,项目名称:usercode,代码行数:101,代码来源:drawFigure7.C

示例8: EnergyDependentCorrections


//.........这里部分代码省略.........
  }

  infile.close();

  infile.open(TString::Format("%s/Asymmetries/AllCorr_OctetAsymmetries_AnaChC_Octets_%i-%i_BinByBin.txt",getenv("ANALYSIS_RESULTS"),60,121));
  
  while (infile >> en >> val >> err) {
    AllCorr2012.push_back(val);
  }

  infile.close();


  
  
  
  

  std::vector <Double_t> en_Th;
  std::vector <Double_t> corr_Th;
  std::vector <Double_t> en_MC2011;
  std::vector <Double_t> corr_MC2011;
  std::vector <Double_t> en_MC2012;
  std::vector <Double_t> corr_MC2012;
  
  
  for (int i=2;i<80;++i) {

    if (UnCorr2011[i]!=0.) en_Th.push_back(energy[i]), corr_Th.push_back(100.*(TheoryCorr2011[i]/UnCorr2011[i]-1.));
    if (TheoryCorr2011[i]!=0.) en_MC2011.push_back(energy[i]), corr_MC2011.push_back(100.*(AllCorr2011[i]/TheoryCorr2011[i]-1.));
    if (TheoryCorr2012[i]!=0.) en_MC2012.push_back(energy[i]), corr_MC2012.push_back(100.*(AllCorr2012[i]/TheoryCorr2012[i]-1.));
  }

  

  TCanvas *c2 = new TCanvas("c2","c2",1200,800);
  c2->Divide(2,1);

  c2->cd(1);

  TGraph *gTheory = new TGraph(en_Th.size(),&en_Th[0],&corr_Th[0]);
  gTheory->SetTitle("Theory Corrections vs. Energy");
  gTheory->SetMarkerStyle(kFullCircle);
  gTheory->SetMinimum(-5.);
  gTheory->SetMaximum(0.);
  gTheory->SetLineWidth(3);
  gTheory->SetLineColor(kBlack);
  gTheory->GetYaxis()->SetTitle("#DeltaA/A (%)");
  gTheory->GetYaxis()->CenterTitle();
  gTheory->GetXaxis()->SetTitle("Energy (keV)");
  gTheory->GetXaxis()->CenterTitle();
  gTheory->Draw("AL");
  
  c2->cd(2);

  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("MC Corrections vs. Energy");
  
  TGraph *gMC2011 = new TGraph(en_MC2011.size(),&en_MC2011[0],&corr_MC2011[0]);
  gMC2011->SetMarkerStyle(kFullCircle);
  //gMC2011->SetMinimum(-10.);
  //gMC2011->SetMaximum(6.);
  gMC2011->SetLineWidth(3);
  gMC2011->SetLineColor(kBlue);
  gMC2011->GetYaxis()->SetTitle("#DeltaA/A (%)");
  gMC2011->GetYaxis()->CenterTitle();
  gMC2011->GetXaxis()->SetTitle("Energy (keV)");
  gMC2011->GetXaxis()->CenterTitle();
  //gMC2011->Draw("AC");

  TGraph *gMC2012 = new TGraph(en_MC2012.size(),&en_MC2012[0],&corr_MC2012[0]);
  gMC2012->SetMarkerStyle(kFullCircle);
  //gMC2012->SetMinimum(-10.);
  //gMC2012->SetMaximum(6.);
  gMC2012->SetLineWidth(3);
  gMC2012->SetLineColor(kGreen);
  //gMC2012->GetYaxis()->SetTitle("#DeltaA/A (%)");
  //gMC2012->GetYaxis()->CenterTitle();
  //gMC2012->GetXaxis()->SetTitle("Energy (keV)");
  //gMC2012->GetXaxis()->CenterTitle();
  //gMC2012->Draw("AC");
  
  mg->Add(gMC2011);
  mg->Add(gMC2012);
  mg->SetMinimum(-8.);
  mg->SetMaximum(6.);
  
  mg->Draw("AC");
  mg->GetYaxis()->SetTitle("#DeltaA/A (%)");
  mg->GetYaxis()->CenterTitle();
  mg->GetXaxis()->SetTitle("Energy (keV)");
  mg->GetXaxis()->CenterTitle();
  gPad->Modified();

  TLegend *leg = new TLegend(0.55,0.75,0.85,0.85);
  leg->AddEntry(gMC2011,"2011-2012","l");
  leg->AddEntry(gMC2012,"2012-2013","l");
  leg->SetTextSize(0.05);
  leg->Draw("SAME");
}
开发者ID:mabrow05,项目名称:ParallelAnalyzer-1,代码行数:101,代码来源:EnergyDependentCorrections.C

示例9: plot


//.........这里部分代码省略.........

  for(unsigned int i = 0 ; i < nMassPoints; i++){

    TFile f(Form("higgsCombine%s%s.Asymptotic.mH%.0f.root",stream.Data(),channel.Data(),X[i]),"READ");
    if(f.IsZombie()){
      cout << "Cannot open file for " << string(channel.Data()) << " and mass " << X[i] << endl;
      continue;
    }

    Double_t r;
    TTree* limit = (TTree*)f.Get("limit");
    limit->SetBranchAddress("limit",&r);

    for(int k = 0 ; k< limit->GetEntries() ; k++){
      limit->GetEntry(k);
      if(k==0) expY2sL[i] = r;
      if(k==1) expY1sL[i] = r;
      if(k==2) expY[i]    = r;
      if(k==3) expY1sH[i] = r;
      if(k==4) expY2sH[i] = r;
      if(k==5) obsY[i]    = r;
    }

  }
 


  for(int i = 0 ; i < nMassPoints ; i++){
    expY1sH[i] = TMath::Abs(expY1sH[i]-expY[i]);
    expY1sL[i] = TMath::Abs(expY1sL[i]-expY[i]);
    expY2sH[i] = TMath::Abs(expY2sH[i]-expY[i]);
    expY2sL[i] = TMath::Abs(expY2sL[i]-expY[i]);

    cout << "Mass " << X[i] << " => " << expY2sL[i] << ", " << expY1sL[i] << ", " << expY1sH[i] << ", "
	 << expY2sH[i] << ", " << endl;
  }

  TMultiGraph *mg = new TMultiGraph();
  mg->SetTitle("");

  TGraphAsymmErrors* expected = new TGraphAsymmErrors(nMassPoints, X, expY, expX1sL ,expX1sL , expX1sL, expX1sL);
  TGraphAsymmErrors* oneSigma = new TGraphAsymmErrors(nMassPoints, X, expY, expX1sL, expX1sL,  expY1sL, expY1sH);
  TGraphAsymmErrors* twoSigma = new TGraphAsymmErrors(nMassPoints, X, expY, expX2sL, expX2sL,  expY2sL, expY2sH);
  TGraphAsymmErrors* observed = new TGraphAsymmErrors(nMassPoints, X, obsY, expX1sL ,expX1sL , expX1sL, expX1sL);

 
  oneSigma->SetMarkerColor(kBlack);
  oneSigma->SetMarkerStyle(kFullCircle);
  oneSigma->SetFillColor(kGreen);
  oneSigma->SetFillStyle(1001);

  twoSigma->SetMarkerColor(kBlack);
  twoSigma->SetMarkerStyle(kFullCircle);
  twoSigma->SetFillColor(kYellow);
  twoSigma->SetFillStyle(1001);

  expected->SetMarkerColor(kBlack);
  expected->SetMarkerStyle(kFullCircle);
  expected->SetMarkerSize(1.5);
  expected->SetLineColor(kBlack);
  expected->SetLineWidth(2);

  observed->SetMarkerColor(kBlue);
  observed->SetMarkerStyle(1);
  observed->SetLineColor(kBlue);
  observed->SetLineWidth(4);

  mg->Add(twoSigma);
  mg->Add(oneSigma);
  mg->Add(expected);
  mg->Add(observed);

  mg->Draw("ALP3");

  c1->cd();
  gPad->Modified();
  mg->GetXaxis()->SetLimits(110,145);
  mg->GetYaxis()->SetTitleOffset(0.97);
  mg->SetMinimum(0.);
  mg->SetMaximum(xMax_);
  mg->GetXaxis()->SetTitle("m_{H} (GeV)");
  mg->GetYaxis()->SetTitle("#sigma X BR(H#rightarrow#tau#tau)_{95% CLs}/#sigma_{SM}");

  leg->SetHeader(Form("#splitline{CMS Preliminary #sqrt{s}=7 TeV}{4.6 fb^{-1}, %s}",legend.Data()));

  leg->AddEntry(expected,"Expected","P");
  leg->AddEntry(observed,"Observed","L");

  leg->Draw();

  TF1 *line = new TF1("line","1",100,150);
  line->SetLineColor(kRed);
  line->SetLineWidth(2);

  line->Draw("SAME");

  gPad->SaveAs(Form("limit_%s_%s.png",stream.Data(), channel.Data()));
  gPad->SaveAs(Form("limit_%s_%s.pdf",stream.Data(), channel.Data()));

}
开发者ID:bianchini,项目名称:usercode,代码行数:101,代码来源:makePlot.C

示例10: EffVsMass

void EffVsMass(string inName, int applyAnalysisCuts){

  gErrorIgnoreLevel = kWarning;
  CMSstyle();
  gStyle->SetOptStat(0);

  TFile *fin = TFile::Open(inName.c_str(), "read"); assert(fin);
  TGraphAsymmErrors* g[4];
  for(int ch=0; ch<4; ++ch){
    g[ch] = new TGraphAsymmErrors();
  }

  int ipoint = 0;
  for(int mass=200; mass <= 2000; mass += 100){
    string name = Form("WprimeToWZTo3LNu_M-%i",mass);
    
    float sample_tot(0), sample_pass(0);
    
    TH1F* hInfo = (TH1F*) fin->Get(Form("%s/hFileInfo", name.c_str()));
    if(!hInfo) continue;  
    float sample_weight = GetSampleInfo(hInfo, "Sample Weight");
    sample_tot = GetSampleInfo(hInfo, "Number of Events Produced");
    sample_tot *= (4./9.); //remove tau contribution from denom
    
    //get tree from file
    TTree* t = getTree(fin, name, "tEvts_MET"); assert(t);
    string analysisCuts = applyAnalysisCuts ? (applyAnalysisCuts == 1 ? Form("Lt > %.0f", LtCut(mass)) : AnalysisCuts(mass)) : "1";

    for(int ch=0; ch<4; ++ch){
      float tot = sample_tot / 4;
      float pass = 0;

      float pass_alt = t->Draw("WZMass", Form("weight*(EvtType == %i)*(%s)",ch, analysisCuts.c_str()), "goff");
      int n = t->GetSelectedRows();
      for(int ientry=0; ientry<n; ++ientry){
        float weight = t->GetW()[ientry];
        pass += weight;
      }
      pass /= sample_weight;
      sample_pass += pass;
      
      float mean    = tot>0 ? pass / tot : 0.;
      float errUp   = TEfficiency::ClopperPearson(tot, pass, 0.68, true) - mean;
      float errDown = mean - TEfficiency::ClopperPearson(tot, pass, 0.68, false);
      
      errDown = std::max(errDown, (float) 0.);
      float err = (errUp + errDown)/2;
      printf(" %s %ie%i\\mu &  %4.2f & %4.2f or %4.2f & %.2f \\pm %.2f\\%% \\\\\n", name.c_str(), 3-ch, ch, tot, pass, pass_alt, mean*100, err*100);

      g[ch]->SetPoint(ipoint, mass, mean);
      g[ch]->SetPointError(ipoint, 0., 0., errDown, errUp);
    }
    ipoint++;
  }

  TCanvas* c1 = new TCanvas();
  TMultiGraph* mg = new TMultiGraph("mg", ";M_{W'} (GeV); #varepsilon");
  TLegend *legend = new TLegend(0.4,0.2,0.51,0.4,"");
  prepLegend(legend);
  for(int ch=0; ch<4; ++ch){
    g[ch]->SetMarkerColor(ch+2);
    g[ch]->SetLineColor(ch+2);
    legend->AddEntry(g[ch], Form("%ie%i#mu", 3-ch, ch), "PE");
    mg->Add(g[ch]);
  }
  mg->SetMaximum(1.1);
  mg->SetMinimum(0. );
  mg->Draw("AP");
  legend->Draw();

  TLatex latexLabel;
  latexLabel.SetNDC();
  latexLabel.SetTextSize(0.05);
  latexLabel.SetTextFont(42);
  latexLabel.DrawLatex(0.33, 0.96, "CMS Simulation 2012");
  latexLabel.DrawLatex(0.21, 0.85, "#sqrt{s} = 8 TeV");

  string outName = applyAnalysisCuts ? (applyAnalysisCuts==1 ? "EffVsMass_LtCut.png" : "EffVsMass_AnalysisCuts.png") : "EffVsMass.png";
  c1->SaveAs(outName.c_str());
}
开发者ID:cfantasia,项目名称:CMGWPrimeGroup,代码行数:80,代码来源:EffVsMass.C

示例11: main


//.........这里部分代码省略.........
    legC->SetTextSize(0.03);
    legC->SetFillColor(kWhite);
    legC->SetLineColor(kWhite);
    legC->SetShadowColor(kWhite);

    legC->AddEntry(eff_MiB3_ON, "MiB3 chevron-ON", "p");
    legC->AddEntry(eff_MiB3_OFF, "MiB3 chevron-OFF", "p");
    legC->AddEntry(eff_ZStack2_ON, "ZStack2 ON", "p");
    legC->AddEntry(eff_ZStack2_OFF, "ZStack2 OFF", "p");
    legC->AddEntry(eff_ZStack1_ON, "ZStack1 ON", "p");
    legC->AddEntry(eff_ZStack1_OFF, "ZStack1 OFF", "p");
    legC->AddEntry(eff_enSEE, "SEE OFF", "p");
  
    mg->Add(eff_MiB3_ON);
    mg->Add(eff_MiB3_OFF);
    mg->Add(eff_ZStack1_ON);
    mg->Add(eff_ZStack1_OFF);
    mg->Add(eff_ZStack2_OFF);
    mg->Add(eff_ZStack2_ON);
    mg->Add(eff_ZStack2_OFF);
    mg->Add(eff_enSEE);

    TCanvas* c = new TCanvas();
    gPad->SetTicks();
    char plot_name[100];
    std::string command = "if [ ! -e final_plots/ ] ; then mkdir final_plots ; fi";
    system(command.c_str());
    sprintf(plot_name, "final_plots/saturatedFrac_%s.pdf", plot_type.c_str());

    mg->Draw("AP");
    mg->GetXaxis()->SetRangeUser(-0.1,5.1);
    mg->GetXaxis()->SetTitle("HV (V)");
    mg->GetYaxis()->SetTitle("SaturatedFrac");
    mg->SetMaximum(100);
    mg->SetMinimum(0);
    mg->Draw("AP");  
    legC->Draw("same");

    c->Print(plot_name, "pdf");
    sprintf(plot_name, "final_plots/saturatedFrac_%s.png", plot_type.c_str());
    c->Print(plot_name, "png");

  }

  else {

    legC = new TLegend(0.15,0.70,0.3,0.85,NULL,"brNDC");

    TGraphErrors* eff_MiB3;
    TGraphErrors* eff_enSEE;
    TGraphErrors* eff_ZStack1;
    TGraphErrors* eff_ZStack2;

    if(plot_type == "AngScanHigh"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_AngScan_HVHigh.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_AngScan_HVHigh.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_AngScan_HVHigh.root");
    }
    if(plot_type == "AngScanLow"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_AngScan_HVLow.root");
      inF_enSEE = TFile::Open("plots/efficiency_studies/enSEE_X0_AngScan_HVLow.root");
      inF_ZStack1 = TFile::Open("plots/efficiency_studies/ZStack1_X0_AngScan_HVLow.root");
    }
    
    if(plot_type == "scanX0_HVHigh_50"){
      inF_MiB3 = TFile::Open("plots/efficiency_studies/MiB3_X0_scanX0_HVHigh50GeV.root");
开发者ID:amartelli,项目名称:iMCP_TB,代码行数:67,代码来源:drawSaturatedFrac.cpp

示例12: Limit_lambda


//.........这里部分代码省略.........

   TCanvas *c1a = new TCanvas("c1a","c1a" ,800,800);
   //c1a->SetGridy() ;
   c1a->SetTopMargin(0.1);
   c1a->SetBottomMargin(0.13);
   c1a->SetLeftMargin(0.16);
   c1a->SetRightMargin(0.05);

   c1a->SetLogy() ;
   TMultiGraph *mg = new TMultiGraph();
   //gStyle->SetTitleW(0.85);
   //mg->SetTitle( "   CMS 19.1 fb^{-1}                                                   #sqrt{s} = 8 TeV" );

   // SetFillStyle ref: http://root.cern.ch/root/html/TAttFill.html
   TGraphAsymmErrors* gbe = new TGraphAsymmErrors(sz, x, md, ex, ex, d2, u2);
   gbe->SetFillStyle(1001);
   gbe->SetFillColor(kYellow);
   //gbe->GetXaxis()->SetLimits(240.,6100.) ;

   TGraphAsymmErrors* gae = new TGraphAsymmErrors(sz, x, md, ex, ex, d1, u1);
   gae->SetFillStyle(1001);
   //gae->SetFillColor(kSpring);
   gae->SetFillColor(kGreen);
   //gae->GetXaxis()->SetRangeUser(1.,5.) ;
   //gae->GetXaxis()->SetLimits(1.,5.) ;

   mg->Add( gbe ) ;
   mg->Add( gae ) ;
   mg->Draw("a3") ;

   // this modify the x-axis range, must set after Draw() ...stupid ROOT 
   gPad->Modified();
   mg->GetXaxis()->SetLimits( x[0] - 1, x[sz-1]+1 ) ;
   mg->SetMaximum( yMax );
   mg->SetMinimum( yMin );
   mg->GetXaxis()->SetTitleOffset(1.1);
   mg->GetYaxis()->SetTitleOffset(1.3);
   mg->GetXaxis()->SetTitleFont(42);
   mg->GetYaxis()->SetTitleFont(42);
   mg->GetXaxis()->SetTitleSize(0.04);
   mg->GetYaxis()->SetTitleSize(0.04);
   mg->GetXaxis()->SetTitle( "SUSY breaking scale (TeV)"  ) ;
   //mg->GetXaxis()->SetTitle( "MET Cut (GeV)" ) ;
   mg->GetYaxis()->SetTitle(" #sigma_{Upper Limit} (pb) at 95% CL") ;

   // expected
   TGraph*  g1  = new TGraph(sz, x, md ) ;
   g1->SetLineColor(2) ;
   g1->SetLineWidth(2) ;
   g1->SetLineStyle(1) ;
   //g1->GetXaxis()->SetLimits(1.,5.) ;
   g1->Draw("LP") ;
   c1a->Update() ;

   // observation
   TGraph*  g0  = new TGraph(sz, x, ob ) ;
   g0->SetLineColor(1) ;
   g0->SetLineWidth(2) ;
   g0->SetLineStyle(1) ;
   //g0->GetXaxis()->SetLimits(1.,5.) ;
   //g0->SetMarkerStyle(20) ;
   g0->Draw("LP") ;
   c1a->Update() ;


   // theoratical suggestion
开发者ID:TENorbert,项目名称:DPGenStudy,代码行数:67,代码来源:Limit_lambda.C

示例13: DY


//.........这里部分代码省略.........
               hExpectedDYSF->GetBinError(2),
               scaleFactor);
        printf("\n [%s] DY relative systematic uncertainties\n", channel.Data());
        printf(" -------------------------------------------------\n");
        printf(" DY normalisation = %.0f (stat.) $\\bigoplus$ %.0f (syst.)\n\n",
               1e2*statError/yield, 1e2*systError/yield);
    }


    // Check
    //----------------------------------------------------------------------------
    Double_t check = hExpectedDYSF->GetBinContent(2) - NoutDYSF[sysR];
    if (check != 0) printf(" WARNING: DY yields do not much by %f\n\n", check);


    // Draw histograms
    //----------------------------------------------------------------------------
    if (drawR) {

        Double_t absoluteMin = 999;

        TGraphErrors* gR     = new TGraphErrors(numberMetCuts-1);
        TGraphErrors* gRdata = new TGraphErrors(numberMetCuts-1);

        for (UInt_t i=0; i<numberMetCuts-1; i++) {

            gR->SetPoint     (i, 0.5 * (MetDraw[i+1] + MetDraw[i]),    R[i]);
            gR->SetPointError(i, 0.5 * (MetDraw[i+1] - MetDraw[i]), errR[i]);

            gRdata->SetPoint     (i, 0.5 * (MetDraw[i+1] + MetDraw[i]),    RData[i]);
            gRdata->SetPointError(i, 0.5 * (MetDraw[i+1] - MetDraw[i]), errRData[i]);

            if (absoluteMin > (R[i]     - errR[i]))     absoluteMin = R[i]     - errR[i];
            if (absoluteMin > (RData[i] - errRData[i])) absoluteMin = RData[i] - errRData[i];
        }

        if (absoluteMin > 0) absoluteMin = 0;


        // Cosmetics
        //--------------------------------------------------------------------------
        gR->SetMarkerSize (0.9);
        gR->SetMarkerStyle(kFullCircle);

        gRdata->SetLineColor  (kRed+1);
        gRdata->SetMarkerColor(kRed+1);
        gRdata->SetMarkerSize (0.9);
        gRdata->SetMarkerStyle(kFullCircle);


        // Draw
        //--------------------------------------------------------------------------
        canvas = new TCanvas();

        TMultiGraph *mgR = new TMultiGraph();
        mgR->Add(gRdata);
        mgR->Add(gR);

        mgR->Draw("ap");

        mgR->GetYaxis()->SetTitle("R^{out/in}");
        mgR->GetXaxis()->SetTitle("mpmet (GeV)");

        mgR->SetMinimum(absoluteMin - 0.1);
        mgR->SetMaximum(1.0);


        // Legend
        //--------------------------------------------------------------------------
        TLegend* lmgR = new TLegend(0.72, 0.68, 0.92, 0.88);

        lmgR->AddEntry(gR,    " DY MC", "lp");
        lmgR->AddEntry(gRdata," data",  "lp");

        lmgR->SetFillColor(0);
        lmgR->SetTextAlign(12);
        lmgR->SetTextFont (42);
        lmgR->SetTextSize (0.04);

        if      (channel == "SF")   lmgR->SetHeader("ee + #mu#mu");
        else if (channel == "EE")   lmgR->SetHeader("ee");
        else if (channel == "MuMu") lmgR->SetHeader("#mu#mu");

        lmgR->Draw("same");


        // Line at zero
        //--------------------------------------------------------------------------
        TLine* zeroLine = new TLine(canvas->GetUxmin(), 0.0, canvas->GetUxmax(), 0.0);
        zeroLine->SetLineStyle(3);
        zeroLine->SetLineWidth(2);
        zeroLine->Draw("same");
        mgR->Draw("p,same");


        // Save
        //--------------------------------------------------------------------------
        canvas->SaveAs("R_" + channel + ".png");
    }
}
开发者ID:piedraj,项目名称:usercode,代码行数:101,代码来源:DY.C

示例14: doDY


//.........这里部分代码省略.........
  if (check != 0) printf(" WARNING: DY yields do not much by %f\n\n", check);


  // Draw histograms
  //----------------------------------------------------------------------------
  if (drawR) {

    Double_t absoluteMin = 999;

    TGraphErrors* gR     = new TGraphErrors(numberMetCuts-1);
    TGraphErrors* gRdata = new TGraphErrors(numberMetCuts-1);

    for (UInt_t i=0; i<numberMetCuts-1; i++) {

      gR->SetPoint     (i, 0.5 * (MetDraw[i+1] + MetDraw[i]),    R[i]);
      gR->SetPointError(i, 0.5 * (MetDraw[i+1] - MetDraw[i]), errR[i]);

      gRdata->SetPoint     (i, 0.5 * (MetDraw[i+1] + MetDraw[i]),    RData[i]);
      gRdata->SetPointError(i, 0.5 * (MetDraw[i+1] - MetDraw[i]), errRData[i]);

      if (absoluteMin > (R[i]     - errR[i]))     absoluteMin = R[i]     - errR[i];
      if (absoluteMin > (RData[i] - errRData[i])) absoluteMin = RData[i] - errRData[i];
    }
    
    if (absoluteMin > 0) absoluteMin = 0;

    // Cosmetics
    //--------------------------------------------------------------------------
    gR->SetMarkerSize (0.9);
    gR->SetMarkerStyle(kFullCircle);

    gRdata->SetLineColor  (kRed+1);
    gRdata->SetMarkerColor(kRed+1);
    gRdata->SetMarkerSize (0.9);
    gRdata->SetMarkerStyle(kFullCircle);


    // Draw
    //--------------------------------------------------------------------------
    canvas = new TCanvas();

    TMultiGraph *mgR = new TMultiGraph();
    mgR->Add(gRdata);
    mgR->Add(gR);

    mgR->Draw("ap");

    mgR->GetYaxis()->SetTitle("R^{out/in}");
    mgR->GetXaxis()->SetTitle("mpmet (GeV)");

    mgR->SetMinimum(absoluteMin - 0.1);
    mgR->SetMaximum(1.0);


    // Legend
    //--------------------------------------------------------------------------
    TLegend* lmgR = new TLegend(0.62, 0.68, 0.86, 0.88);

    lmgR->AddEntry(gR,    " DY MC", "lp");
    lmgR->AddEntry(gRdata," data",  "lp");

    lmgR->SetFillColor(0);
    lmgR->SetLineColor(kWhite);
    lmgR->SetTextAlign(12);
    lmgR->SetTextFont (42);
    lmgR->SetTextSize (0.04);

    if      (channel == "SF")   lmgR->SetHeader("ee + #mu#mu");
    else if (channel == "EE")   lmgR->SetHeader("ee");
    else if (channel == "MuMu") lmgR->SetHeader("#mu#mu");

    lmgR->Draw();

    // Line at zero
    //--------------------------------------------------------------------------
    TLine* zeroLine = new TLine(canvas->GetUxmin(), 0.0, canvas->GetUxmax(), 0.0);
    zeroLine->SetLineStyle(3);
    zeroLine->SetLineWidth(2);
    zeroLine->Draw("same");
    mgR->Draw("p,same");
  

    // Save
    //--------------------------------------------------------------------------
    lmgR->Draw("same");

    if (jetbin == '3'){
      DrawTLatex(0.725, 0.65, 0.04,  "Inclusive");
      canvas->SaveAs("R_" + channel + "_Inclusive.png");
      canvas->SaveAs("R_" + channel + "_Inclusive.pdf");
    }
    else{                                                   //Inclusive 
      if      (jetbin == '0') DrawTLatex(0.725, 0.65, 0.04,  "0 Jet    ");
      else if (jetbin == '1') DrawTLatex(0.725, 0.65, 0.04,  "1 Jet    ");
      else if (jetbin == '2') DrawTLatex(0.725, 0.65, 0.04,  "2+ Jets  ");
      canvas->SaveAs("R_" + channel + "_" + jetbin + "jet.png");
      canvas->SaveAs("R_" + channel + "_" + jetbin + "jet.pdf");
    }
  }
}
开发者ID:NTrevisani,项目名称:newWW13TeV,代码行数:101,代码来源:DY.C

示例15: PlotRanges

/**
The purpose of this function is to conveniently plot an event. Each event is plotted on a TCanvas. Divided into as many pads as there are panels. Each pad is a TMultiGraph with a TLegend, and shows the channels of the digitizer connected to the lines of that panel. The grouping into pads must not necessarily be according to panels, but in any other prefered way.

@param a_channels - a vector of a vector of samples, containing all 32 channels
@ param a_channelsToPadsAssociation - a map from std::string, which is the name of the panel (or group of channels) to be assigned to each pad to a vector if integers, which is the list of channels indices corresponding to indices of channels in the paramater a_channels to associate to a pad
@param sEventTitle - a string containing the title of the event (for example, the time stamp)
*/
void RangePlotter::PlotRanges(Channels_t& a_channels, Range_t& a_channelsToPadsAssociation, std::string sEventTitle)
{	
//	printf("Plotting\n");
	//m_pCanvas->Clear();
	m_pCanvas->SetTitle(sEventTitle.c_str());
	
	
	int iPadCounter = 0;
	if(0 == m_vpMultiGraph.size())
	{
		MakePads(a_channelsToPadsAssociation.size());	
		for (auto& rangeIt: a_channelsToPadsAssociation)
		{	
			TMultiGraph* pMg = new TMultiGraph();	
			m_vpMultiGraph.push_back(std::unique_ptr<TMultiGraph>(pMg));

	//		m_pCanvas->cd(iPadCounter + 1);
			ChangePad(iPadCounter);
			int i = 0;

			auto legend = new TLegend(0.8,0.8,1,1, "Channels");
			m_vpLegends.push_back(std::unique_ptr<TLegend>(legend));
			printf("printing panel %s\n", rangeIt.first.c_str());
			for (auto& chanIt: rangeIt.second)
			{
				int iNumOfSamples = a_channels[chanIt].size();
				TGraph* pGr = new TGraph(iNumOfSamples);
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					pGr->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[chanIt][counter]));
				}

				m_vpGraph[chanIt] = pGr;
				pGr->SetLineColor(m_colors[i%(sizeof(m_colors)/sizeof(int))]);
				pGr->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + std::string("chan_") + std::to_string(chanIt)).c_str());
				std::string sGraphTitle = std::string("Channel ") + std::to_string(chanIt);
				pGr->SetTitle(sGraphTitle.c_str());
				legend->AddEntry(pGr,std::to_string(chanIt).c_str(), "l");
		
				pMg->Add(pGr);
				i++;
			}

			if(Configuration::Instance().ShowTriggerInWaveformsStep())
			{
				int iNumOfSamples = a_channels[a_channels.size() - 1].size();
				m_vpGraphPrecisionTrigger = new TGraph(iNumOfSamples);
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);
				for (int counter = 0; counter < iNumOfSamples; counter++)
				{
					m_vpGraphPrecisionTrigger->SetPoint(counter, vTimeSeq[counter], TransformToVoltage(a_channels[a_channels.size() - 1][counter]));
				}
				
				m_vpGraphPrecisionTrigger->SetName((m_sInstanceName + std::string("Pan_") + rangeIt.first + "_Trig").c_str());	
				m_vpGraphPrecisionTrigger->SetTitle("Trigger");
				legend->AddEntry(m_vpGraphPrecisionTrigger,"Trigger", "l");
				pMg->Add(m_vpGraphPrecisionTrigger);
			}
			
			std::string sMultiGraphTitle = std::string("Panel ") + rangeIt.first;
			pMg->SetTitle(sMultiGraphTitle.c_str());

			pMg->Draw("AL");
			pMg->GetXaxis()->SetTitle("Time [nanoseconds]");
			pMg->GetXaxis()->CenterTitle();
			pMg->GetYaxis()->SetTitle("Voltage [volts]");
			pMg->GetYaxis()->CenterTitle();

			gPad->Modified();

			pMg->SetMinimum(m_fMinVoltage);
			pMg->SetMaximum(m_fMaxVoltage);
			legend->Draw();
			iPadCounter++;
		}
		m_pCanvas->Update();
	}
	else
	{
//		printf("Plottin again\n");
		for (auto& rangeIt: a_channelsToPadsAssociation)
		{
			printf("Panel %s\n", rangeIt.first.c_str());
			m_pCanvas->cd(iPadCounter + 1);
			for (auto& chanIt: rangeIt.second)
			{
//				printf("Chanenl %d\n", chanIt);
				//TODO: num of samples is constant per run at least!
				m_vpGraph[chanIt]->SetLineWidth(1);
				int iNumOfSamples = a_channels[chanIt].size();	
				std::vector<float> vTimeSeq = CommonUtils::GenerateTimeSequence(iNumOfSamples, m_fSamplingFreqGHz);	
				for (int counter = 0; counter < iNumOfSamples; counter++)
//.........这里部分代码省略.........
开发者ID:davereikher,项目名称:pps-daq,代码行数:101,代码来源:RangePlotter.cpp


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