示例#1
0
文件: btag.C 项目: radziej/findsusyb3
void calculate_b_efficiency()
{
  TH2D * h2_btag_num_b = 0;
  plot2("btag_num_b");
  for (int i = 0; i < gMaxProcess; i++) {
    if (strstr(gProcess[i].fname, "ttjets") != 0) {
      h2_btag_num_b = new TH2D(*gHisto2[i]);
    }
  }
  TH2D * h2_btag_denom_b = 0;
  plot2("btag_denom_b");
  for (int i = 0; i < gMaxProcess; i++) {
    if (strstr(gProcess[i].fname, "ttjets") != 0) {
      h2_btag_denom_b = new TH2D(*gHisto2[i]);
    }
  }

  TH2D * h2_b_eff = new TH2D(*h2_btag_num_b);
  h2_b_eff->Divide(h2_btag_num_b, h2_btag_denom_b, 1., 1., "B");
  new TCanvas;
  //h2_b_eff->GetXaxis()->SetRangeUser(5,800);
  //h2_b_eff->GetYaxis()->SetRangeUser(-2.4,2.4);
  h2_b_eff->Draw();

  TFile * f = new TFile("btag_eff_map.root", "UPDATE");
  h2_b_eff->Smooth();
  h2_b_eff->Write();
  f->Close();
  INFO("Written efficiency map for b-quarks to btag_eff_map.root");

  
  TH1D * h1_btag_num_b = h2_btag_num_b->ProjectionX();
  TH1D * h1_btag_denom_b = h2_btag_denom_b->ProjectionX();

  TH1D * h1_b_eff = new TH1D(*h1_btag_num_b);
  h1_b_eff->Divide(h1_btag_num_b, h1_btag_denom_b, 1., 1., "B");
  
  TCanvas * b_proj = new TCanvas("b_proj", "b_proj", 800,600);
  b_proj->cd();
  setopt(b_proj);
  setopt(h1_b_eff);
  h1_b_eff->SetMarkerStyle(8);
  h1_b_eff->SetMarkerSize(.7);
  h1_b_eff->SetTitle("");
  h1_b_eff->GetYaxis()->SetTitle("b-tagging efficiency");
  h1_b_eff->GetXaxis()->SetTitle("transverse momentum of jets [GeV]");
  h1_b_eff->GetXaxis()->CenterTitle();
  h1_b_eff->GetYaxis()->SetTitleFont(62);
  h1_b_eff->GetYaxis()->SetTitleSize(0.04);
  h1_b_eff->GetYaxis()->SetLabelFont(62);
  h1_b_eff->GetYaxis()->SetLabelSize(0.04);
  h1_b_eff->GetXaxis()->SetTitleFont(62);
  h1_b_eff->GetXaxis()->SetTitleSize(0.04);
  h1_b_eff->GetXaxis()->SetLabelFont(62);
  h1_b_eff->GetXaxis()->SetLabelSize(0.04);
  h1_b_eff->Draw();
  lumi();
  drawperiod();
}
示例#2
0
void scopePlot::add2(double *data, unsigned long len,QString curveName)
{
  c2.resize(len);
  for (unsigned long i = 0; i < len; i++)
    {
      c2[i]=data[i];
    }
  plot2(curveName);
}
示例#3
0
void MainWindow::FHChanged() {
  if (MaxflatHalfband_on==NULL) {
	shape = "Maxflat Subband";
	lpf_sel(shape.c_str());
	MaxflatHalfband_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(MaxflatHalfband_on);
	MaxflatHalfband_on = NULL;
	ui->customPlot->replot();
  }
}
示例#4
0
void MainWindow::RChanged() {
  if (Remez_on==NULL) {
	shape = "Remez FIR";
	lpf_sel(shape.c_str());
	Remez_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(Remez_on);
	Remez_on = NULL;
	ui->customPlot->replot();
  }
}
示例#5
0
void MainWindow::NChanged() {
  if (NotchIIR_on==NULL) {
	shape = "Notch";
	lpf_sel(shape.c_str());
	NotchIIR_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(NotchIIR_on);
	NotchIIR_on = NULL;
	ui->customPlot->replot();
  }
}
示例#6
0
void MainWindow::CBChanged() {
  if (CutBoost_on==NULL) {
	shape = "Cut/Boost";
	lpf_sel(shape.c_str());
	CutBoost_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(CutBoost_on);
	CutBoost_on = NULL;
	ui->customPlot->replot();
  }
}
示例#7
0
void MainWindow::BChanged() {
  if (Butterworth_on==NULL) {
	shape = "Butterworth";
	lpf_sel(shape.c_str());
	Butterworth_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(Butterworth_on);
	Butterworth_on = NULL;
	ui->customPlot->replot();
  }
}
示例#8
0
void MainWindow::CChanged() {
  if (Chebyshev_on==NULL) {
	shape = "Chebyshev";
	lpf_sel(shape.c_str());
	Chebyshev_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(Chebyshev_on);
	Chebyshev_on = NULL;
	ui->customPlot->replot();
  }
}
示例#9
0
void MainWindow::EChanged() {
  if (Elliptic_on==NULL) {
	shape = "Elliptic";
	lpf_sel(shape.c_str());
	Elliptic_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(Elliptic_on);
	Elliptic_on = NULL;
	ui->customPlot->replot();
  }
}
示例#10
0
void MainWindow::NChanged() {
  if (NotchIIR_on==NULL) {
	shape = "NotchIIR";
	LPF.change_filter(spuce::NotchIIR);
	NotchIIR_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(NotchIIR_on);
	NotchIIR_on = NULL;
	ui->customPlot->replot();
  }
}
示例#11
0
void MainWindow::CChanged() {
  if (CutBoost_on==NULL) {
	shape = "CutBoost";
	LPF.change_filter(spuce::CutBoost);
	CutBoost_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(CutBoost_on);
	CutBoost_on = NULL;
	ui->customPlot->replot();
  }
}
示例#12
0
void MainWindow::EChanged() {
  if (EllipticSubband_on==NULL) {
	shape = "EllipticSubband";
	LPF.change_filter(spuce::EllipticSubband);
	EllipticSubband_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(EllipticSubband_on);
	EllipticSubband_on = NULL;
	ui->customPlot->replot();
  }
}
示例#13
0
void MainWindow::MChanged() {
  if (MaxflatSubband_on==NULL) {
	shape = "MaxflatSubband";
	LPF.change_filter(spuce::MaxflatSubband);
	MaxflatSubband_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(MaxflatSubband_on);
	MaxflatSubband_on = NULL;
	ui->customPlot->replot();
  }
}
示例#14
0
void MainWindow::RRCChanged() {
  if (RootRaisedCosine_on==NULL) {
	shape = "Root Raised Cosine";
	lpf_sel(shape.c_str());
	RootRaisedCosine_on = ui->customPlot->addGraph();
	plot2(ui->customPlot);
  } else {
	ui->customPlot->removeGraph(RootRaisedCosine_on);
	RootRaisedCosine_on = NULL;
	ui->customPlot->replot();
  }
}
示例#15
0
文件: btag.C 项目: radziej/findsusyb3
void calculate_c_efficiency()
{
  TH2D * h2_btag_num_c = 0;
  plot2("btag_num_c");
  for (int i = 0; i < gMaxProcess; i++) {
    if (strstr(gProcess[i].fname, "ttjets") != 0) {
      h2_btag_num_c = new TH2D(*gHisto2[i]);
    }
  }
  TH2D * h2_btag_denom_c = 0;
  plot2("btag_denom_c");
  for (int i = 0; i < gMaxProcess; i++) {
    if (strstr(gProcess[i].fname, "ttjets") != 0) {
      h2_btag_denom_c = new TH2D(*gHisto2[i]);
    }
  }

  TH2D * h2_c_eff = new TH2D(*h2_btag_num_c);
  h2_c_eff->Divide(h2_btag_num_c, h2_btag_denom_c, 1., 1., "B");
  new TCanvas;
  //h2_c_eff->GetXaxis()->SetRangeUser(0,500);
  //h2_c_eff->GetYaxis()->SetRangeUser(-2.4,2.4);
  h2_c_eff->DrawCopy();

  TH1D * h1_btag_num_c = h2_btag_num_c->ProjectionX();
  TH1D * h1_btag_denom_c = h2_btag_denom_c->ProjectionX();

  TH1D * h1_c_eff = new TH1D(*h1_btag_num_c);
  h1_c_eff->Divide(h1_btag_num_c, h1_btag_denom_c, 1., 1., "B");
  new TCanvas;
  h1_c_eff->Draw();

  TFile * f = new TFile("btag_eff_map.root", "UPDATE");
  h2_c_eff->Smooth();
  h2_c_eff->Write();
  f->Close();
  INFO("Written efficiency map for c-quarks to btag_eff_map.root");
}
示例#16
0
void plotParitialDegDistribution(const PNGraph& graph, std::vector<int>& nodeList) {
	std::map<int, int> inDegDistMap;
	std::map<int, int> outDegDistMap;
	
	for (int i = 0; i < nodeList.size(); ++i) {
		int curNodeId = nodeList[i];
		if (!graph->IsNode(curNodeId)) continue;
		TNGraph::TNodeI ni = graph->GetNI(curNodeId);

		int curNodeInDeg = ni.GetInDeg();
		if (inDegDistMap.find(curNodeInDeg) == inDegDistMap.end()) {
			inDegDistMap.insert(std::pair<int, int>(curNodeInDeg, 0));
		}
		inDegDistMap[curNodeInDeg]++;

		int curNodeOutDeg = ni.GetOutDeg();
		if (outDegDistMap.find(curNodeOutDeg) == outDegDistMap.end()) {
			outDegDistMap.insert(std::pair<int, int>(curNodeOutDeg, 0));
		}
		outDegDistMap[curNodeOutDeg]++;
		
	}
	
	TFltPrV inDegDist;
	for (std::map<int, int>::iterator itr = inDegDistMap.begin(); itr != inDegDistMap.end(); itr++) {
		inDegDist.Add(TFltPr(itr->first, itr->second));
	}

	TFltPrV outDegDist;
	for (std::map<int, int>::iterator itr = outDegDistMap.begin(); itr != outDegDistMap.end(); itr++) {
		outDegDist.Add(TFltPr(itr->first, itr->second));
	}
	
	TGnuPlot plot1("inDegDistParitial", "");
	plot1.AddPlot(inDegDist, gpwPoints, "");
	plot1.SetScale(gpsLog10XY);
	plot1.SavePng();

	TGnuPlot plot2("outDegDistParitial", "");
	plot2.AddPlot(outDegDist, gpwPoints, "");
	plot2.SetScale(gpsLog10XY);
	plot2.SavePng();

	TGnuPlot plot3("DegDistParitial", "");
	plot3.AddCmd("set key right top");
	plot3.AddPlot(inDegDist, gpwPoints, "In Degree");
	plot3.AddPlot(outDegDist, gpwPoints, "Out Degree");
	plot3.SetScale(gpsLog10XY);
	plot3.SavePng();
}
示例#17
0
void MainWindow::C2Changed() {
  if (Chebyshev2_on==NULL) {
		shape = "Chebyshev2";
		lpf_sel(shape.c_str());
		order = get_order();
		ui->order->setText(QApplication::translate("MainWindow", std::to_string(order).c_str(), 0));
		ui->ripple->setText(QApplication::translate("MainWindow", std::to_string(ripple()).c_str(), 0));
		ui->fc->setText(QApplication::translate("MainWindow", std::to_string(fc()).c_str(), 0));
		Chebyshev2_on = ui->customPlot->addGraph();
		plot2(ui->customPlot);
  } else {
		ui->customPlot->removeGraph(Chebyshev2_on);
		Chebyshev2_on = NULL;
		ui->customPlot->replot();
  }
}
示例#18
0
int
main( int argc, const char *argv[] )
{
    int   i, j;
    PLFLT xx, yy;

/* Parse and process command line arguments */

    (void) plparseopts( &argc, argv, PL_PARSE_FULL );

/* Set up color map 0 */
/*
 *  plscmap0n(3);
 */
/* Set up color map 1 */

    cmap1_init2();

/* Initialize plplot */

    plinit();

/* Set up data array */

    for ( i = 0; i < XPTS; i++ )
    {
        xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 );
        for ( j = 0; j < YPTS; j++ )
        {
            yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0;

            z[i][j] = xx * xx - yy * yy + ( xx - yy ) / ( xx * xx + yy * yy + 0.1 );
        }
    }
    f2mnmx( &z[0][0], XPTS, YPTS, &zmin, &zmax );

    plot1();
    plot2();
    plot3();

    plend();
    exit( 0 );
}
示例#19
0
void plotDegDistribution(const PNGraph& graph) {
	TFltPrV outDegDist;
	TSnap::GetOutDegCnt(graph, outDegDist);
	TGnuPlot plot1("outDegDist", "");
	plot1.AddPlot(outDegDist, gpwPoints, "");
	plot1.SetScale(gpsLog10XY);
	plot1.SavePng();

	TFltPrV inDegDist;
	TSnap::GetInDegCnt(graph, inDegDist);
	TGnuPlot plot2("inDegDist", "");
	plot2.AddPlot(inDegDist, gpwPoints, "");
	plot2.SetScale(gpsLog10XY);
	plot2.SavePng();

	TGnuPlot plot3("DegDist", "");
	plot3.AddCmd("set key right top");
	plot3.AddPlot(inDegDist, gpwPoints, "In degree");
	plot3.AddPlot(outDegDist, gpwPoints, "Out degree");
	plot3.SetScale(gpsLog10XY);
	plot3.SavePng();
}
示例#20
0
int
main(int argc, char *argv[])
{
    int i, digmax;
    int xleng0 = 400, yleng0 = 300, xoff0 = 200, yoff0 = 200;
    int xleng1 = 400, yleng1 = 300, xoff1 = 500, yoff1 = 500;

/* Select either TK or DP driver and use a small window */
/* Using DP results in a crash at the end due to some odd cleanup problems */
/* The geometry strings MUST be in writable memory */

    char geometry_master[] = "500x410+100+200";
    char geometry_slave[]  = "500x410+650+200";

    char driver[80];

/* plplot initialization */
/* Parse and process command line arguments */

    (void) plparseopts(&argc, argv, PL_PARSE_FULL);

    plgdev(driver);

    printf("Demo of multiple output streams via the %s driver.\n", driver);
    printf("Running with the second stream as slave to the first.\n");
    printf("\n");

/* Set up first stream */

    plsetopt("geometry", geometry_master);

    plsdev(driver);
    plssub(2, 2);
    plinit();

/* Start next stream */

    plsstrm(1);

/* Turn off pause to make this a slave (must follow master) */

    plsetopt("geometry", geometry_slave);
    plspause(0);
    plsdev(driver);
    plinit();

/* Set up the data & plot */
/* Original case */

    plsstrm(0);

    xscale = 6.;
    yscale = 1.;
    xoff = 0.;
    yoff = 0.;
    plot1();

/* Set up the data & plot */

    xscale = 1.;
    yscale = 1.e+6;
    plot1();

/* Set up the data & plot */

    xscale = 1.;
    yscale = 1.e-6;
    digmax = 2;
    plsyax(digmax, 0);
    plot1();

/* Set up the data & plot */

    xscale = 1.;
    yscale = 0.0014;
    yoff = 0.0185;
    digmax = 5;
    plsyax(digmax, 0);
    plot1();

/* To slave */
/* The pleop() ensures the eop indicator gets lit. */

    plsstrm(1);
    plot4();
    pleop();

/* Back to master */

    plsstrm(0);
    plot2();
    plot3();

/* To slave */

    plsstrm(1);
    plot5();
    pleop();

/* Back to master to wait for user to advance */

    plsstrm(0);
    pleop();

/* Call plend to finish off. */

    plend();
    exit(0);
}
示例#21
0
void myplot3()
{
    plot2();
}
示例#22
0
int
main( int argc, char *argv[] )
{
    PLINT digmax, cur_strm, new_strm;
    char  ver[80];

// plplot initialization

// Parse and process command line arguments

    plMergeOpts( options, "x01c options", notes );
    plparseopts( &argc, argv, PL_PARSE_FULL );

// Get version number, just for kicks

    plgver( ver );
    fprintf( stdout, "PLplot library version: %s\n", ver );

// Initialize plplot
// Divide page into 2x2 plots
// Note: calling plstar replaces separate calls to plssub and plinit
    plstar( 2, 2 );

// Select font set as per input flag

    if ( fontset )
        plfontld( 1 );
    else
        plfontld( 0 );

// Set up the data
// Original case

    xscale = 6.;
    yscale = 1.;
    xoff   = 0.;
    yoff   = 0.;

// Do a plot

    plot1( 0 );

// Set up the data

    xscale = 1.;
    yscale = 0.0014;
    yoff   = 0.0185;

// Do a plot

    digmax = 5;
    plsyax( digmax, 0 );

    plot1( 1 );

    plot2();

    plot3();

    //
    // Show how to save a plot:
    // Open a new device, make it current, copy parameters,
    // and replay the plot buffer
    //

    if ( f_name )   // command line option '-save filename'

    {
        printf( "The current plot was saved in color Postscript under the name `%s'.\n", f_name );
        plgstrm( &cur_strm );    // get current stream
        plmkstrm( &new_strm );   // create a new one

        plsfnam( f_name );       // file name
        plsdev( "psc" );         // device type

        plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream
        plreplot();              // do the save by replaying the plot buffer
        plend1();                // finish the device

        plsstrm( cur_strm );     // return to previous stream
    }

// Let's get some user input

    if ( locate_mode )
    {
        for (;; )
        {
            if ( !plGetCursor( &gin ) )
                break;
            if ( gin.keysym == PLK_Escape )
                break;

            pltext();
            printf( "subwin = %d, wx = %f,  wy = %f, dx = %f,  dy = %f\n",
                gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY );
            printf( "keysym = 0x%02x, button = 0x%02x, string = '%s', type = 0x%02x, state = 0x%02x\n",
                gin.keysym, gin.button, gin.string, gin.type, gin.state );
            plgra();
        }
    }

// Don't forget to call plend() to finish off!

    plend();
    exit( 0 );
}