コード例 #1
0
ファイル: fig.C プロジェクト: PerilousApricot/bsm_analyze
void plotQCDHtlep(TFile **input, const string &title)
{
    string canvas_title = string("QCD S1+S2 Separate ") + title;
    TCanvas *canvas = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas->SetWindowSize(1200, 640);
    canvas->Divide(3, 2);

    for(int i = 0; QCD_CHANNELS > i; ++i)
    {
        canvas->cd(i + 1)->SetLeftMargin(10);
        get("htlep", input[i], i)->Draw();
        createLegend(toString(i))->Draw();
    }

    canvas->Update();

    canvas_title = string("QCD S1+S2 Merged ") + title;
    canvas = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas->SetWindowSize(800, 480);
    canvas->Divide(2);

    for(int i = 0; 2 > i; ++i)
    {
        canvas->cd(i + 1)->SetLeftMargin(10);
        merge("htlep", input, i * 3, i * 3 + 3)->Draw();
        createLegend(i ? "QCD EMEnriched" : "QCD BCtoE")->Draw();
    }

    canvas->Update();
}
コード例 #2
0
void GraphAnimationDrawer::prepareAnimation(int startNode)
{
	playingState = AnimationPlayingState::pause;
    animationGoToLast();
    framesSpentInState = 0;
    createLegend();
}
コード例 #3
0
ファイル: fig.C プロジェクト: PerilousApricot/bsm_analyze
void plotComparison(TFile **input, const string &title, const bool &reverse_order = false)
{
    TH1 *qcd = merge("htlep", input, 0, QCD_CHANNELS);
    TH1 *ttjets = get("htlep", input[TTJETS], TTJETS);
    TH1 *zjets = get("htlep", input[ZJETS], ZJETS);
    TH1 *wjets = get("htlep", input[WJETS], WJETS);
    TH1 *data = merge("htlep", input, RERECO, RERECO + DATA_CHANNELS);
    data->SetFillColor(0);
    
    THStack *stack = new THStack();
    stack->Add(qcd);
    stack->Add(ttjets);
    stack->Add(zjets);
    stack->Add(wjets);

    if (reverse_order)
    {
        stack->Draw("h");
        data->Draw("h same");
    }
    else
    {
        data->Draw("h");
        stack->Draw("h same");
    }

    TLegend *legend = createLegend(title.c_str());
    legend->Draw();
}
コード例 #4
0
void GraphAnimationDrawer::setColorScheme(const ColorScheme & cs)
{
	GraphDrawer::setColorScheme(cs);
	setChanged();
	createLegend();
	legendTexture = legend.getTexture(true);
}
コード例 #5
0
ファイル: fig.C プロジェクト: PerilousApricot/bsm_analyze
void plotCut2DSignal()
{
    string canvas_title = "Cut 2D Signal";
    TCanvas *canvas = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas->SetWindowSize(1200, 640);
    canvas->Divide(3, 2);

    canvas_title = "DeltaR Signal";
    TCanvas *canvas_dr = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas_dr->SetWindowSize(1200, 640);
    canvas_dr->Divide(3, 2);

    canvas_title = "pTrel Signal";
    TCanvas *canvas_ptrel = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas_ptrel->SetWindowSize(1200, 640);
    canvas_ptrel->Divide(3, 2);
    for(int i = 0; SIGNAL_CHANNELS > i; ++i)
    {
        int id = BACKGROUND_CHANNELS + i;
        TH1 *hist = get("dr_vs_ptrel", input_s1[id], id);
        if (!hist)
            continue;

        canvas->cd(i + 1);

        style(hist, id);
        hist->SetMarkerSize(0.1);
        hist->Draw("scat");

        TLegend *legend = createLegend(toString(id));
        legend->Draw();

        canvas_ptrel->cd(i + 1);
        TH2 *hist2d = dynamic_cast<TH2 *>(hist);
        TH1 *ptrel = dynamic_cast<TH1 *>(hist2d->ProjectionX()->Clone());
        style(ptrel, id);

        ptrel->Draw();
        legend->Draw();

        canvas_dr->cd(i + 1);
        TH2 *hist2d = dynamic_cast<TH2 *>(hist);
        TH1 *dr = dynamic_cast<TH1 *>(hist2d->ProjectionY()->Clone());
        style(dr, id);

        dr->Draw();
        legend->Draw();
    }
}
コード例 #6
0
ファイル: fig.C プロジェクト: PerilousApricot/bsm_analyze
void plotBGHtlep(TFile **input, const string &title)
{
    plotQCDHtlep(input, title);

    string canvas_title = string("BG S1+S2 Separate ") + title;
    TCanvas *canvas = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas->SetWindowSize(1200, 480);
    canvas->Divide(3);

    for(int i = QCD_CHANNELS, j = 1; BACKGROUND_CHANNELS > i; ++i, ++j)
    {
        canvas->cd(j)->SetLeftMargin(10);
        get("htlep", input[i], i)->Draw();
        createLegend(toString(i))->Draw();
    }

    canvas->Update();
}
コード例 #7
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RivGridBoxGenerator::createGridBoxLegendParts()
{
    m_gridBoxLegendParts.clear();

    CVF_ASSERT(m_displayCoordsBoundingBox.isValid());
    CVF_ASSERT(m_displayCoordsXValues.size() > 0);
    CVF_ASSERT(m_displayCoordsYValues.size() > 0);
    CVF_ASSERT(m_displayCoordsZValues.size() > 0);

    for (int edge = POS_Z_POS_X; edge <= NEG_X_NEG_Y; edge++)
    {
        cvf::Collection<cvf::Part> parts;

        createLegend((EdgeType)edge, &parts);

        for (size_t i = 0; i < parts.size(); i++)
        {
            m_gridBoxLegendParts.push_back(parts.at(i));
        }
    }
}
コード例 #8
0
ファイル: fig.C プロジェクト: PerilousApricot/bsm_analyze
void plotQCDTemplates()
{
    TH1 *htlep_s1 = merge("htlep", input_s1, 0, QCD_CHANNELS, true);
    TH1 *htlep_s2 = merge("htlep", input_s2, 0, QCD_CHANNELS, true);
    TH1 *htlep_signal = merge("htlep", input_signal, 0, QCD_CHANNELS, true);

    TH1 *mttbar_before_htlep_s1 =
        merge("mttbar_before_htlep", input_s1, 0, QCD_CHANNELS, true);
    TH1 *mttbar_before_htlep_s2 =
        merge("mttbar_before_htlep", input_s2, 0, QCD_CHANNELS, true);
    TH1 *mttbar_before_htlep_signal =
        merge("mttbar_before_htlep", input_signal, 0, QCD_CHANNELS, true);

    TH1 *mttbar_after_htlep_s1 =
        merge("mttbar_after_htlep", input_s1, 0, QCD_CHANNELS, true);
    TH1 *mttbar_after_htlep_s2 = 
        merge("mttbar_after_htlep", input_s2, 0, QCD_CHANNELS, true);
    TH1 *mttbar_after_htlep_signal =
        merge("mttbar_after_htlep", input_signal, 0, QCD_CHANNELS, true);
 
    string canvas_title = "QCD Templates";
    TCanvas *canvas = new TCanvas(canvas_title.c_str(), canvas_title.c_str());
    canvas->SetWindowSize(1200, 480);
    canvas->Divide(3);

    canvas->cd(1);
    htlep_s1->SetLineColor(4);
    htlep_s1->SetMarkerColor(4);
    htlep_s1->SetFillColor(0);
    
    htlep_s2->SetLineColor(2);
    htlep_s2->SetMarkerColor(2);
    htlep_s2->SetFillColor(0);

    htlep_signal->SetLineColor(1);
    htlep_signal->SetMarkerColor(1);
    htlep_signal->SetFillColor(0);

    THStack *stack = new THStack();
    stack->Add(htlep_s1);
    stack->Add(htlep_s2);
    stack->Add(htlep_signal);

    stack->Draw("nostack");

    TLegend *legend = createLegend("H_{T}^{lep}");
    legend->Draw();

    canvas->cd(2);
    mttbar_before_htlep_s1->SetLineColor(4);
    mttbar_before_htlep_s1->SetMarkerColor(4);
    
    mttbar_before_htlep_s2->SetLineColor(2);
    mttbar_before_htlep_s2->SetMarkerColor(2);

    mttbar_before_htlep_signal->SetLineColor(1);
    mttbar_before_htlep_signal->SetMarkerColor(1);

    stack = new THStack();
    stack->Add(mttbar_before_htlep_s1);
    stack->Add(mttbar_before_htlep_s2);
    stack->Add(mttbar_before_htlep_signal);

    stack->Draw("nostack h");

    legend = createLegend("M_{t#bar{t}} before H_{T}^{lep}");
    legend->Draw();

    canvas->cd(3);
    mttbar_after_htlep_s1->SetLineColor(4);
    mttbar_after_htlep_s1->SetMarkerColor(4);
    
    mttbar_after_htlep_s2->SetLineColor(2);
    mttbar_after_htlep_s2->SetMarkerColor(2);

    mttbar_after_htlep_signal->SetLineColor(1);
    mttbar_after_htlep_signal->SetMarkerColor(1);

    stack = new THStack();
    stack->Add(mttbar_after_htlep_s1);
    stack->Add(mttbar_after_htlep_s2);
    stack->Add(mttbar_after_htlep_signal);

    stack->Draw("nostack h");

    legend = createLegend("M_{t#bar{t}} after H_{T}^{lep}");
    legend->Draw();
}
コード例 #9
0
void showMatchingResults(Frame *frame, char* fileName)
{
  Corner *currentPoint = frame->firstPoint;
  
  IplImage *img = cvCloneImage(frame->image);
  IplImage *legend = createLegend(3); // create legend
  
  char msg[50];
  sprintf(msg, "Frame %d", frame->id);
  
  writeLegendLine(legend, msg, 0, 0, false);
  writeLegendLine(legend, ": sample (RANSAC)", 1, 0, true, cvScalar(255, 0, 0));
  writeLegendLine(legend, ": inliers", 1, 210, true, cvScalar(0, 255, 0));
  writeLegendLine(legend, ": outliers", 1, 420, true, cvScalar(0, 0, 255));
  writeLegendLine(legend, "Press \"p\" to pause, any key to continue", 2, 0, false);
  
  while(currentPoint != NULL)
  {
    CvPoint pf1 = get2DPoint(currentPoint);
    
    if (currentPoint->isFromSample) // the point was a part of the last sample randomly chosen in
                                    // the RANSAC algorithm to compute the homography between the
                                    // two views
      cvCircle(img, pf1, 6, cvScalar(255, 0, 0, 0), -1, 8, 0); // the point is encircled in blue
    
    if (currentPoint->isInlier) // the correspondence between the point and its corresponding point
                                // in the next image is consistent with the homography
    {
      CvPoint pf2 = get2DPoint(currentPoint->matchNextFrame);
      cvCircle(img, pf1, 4, cvScalar(0, 255, 0), 1, 8, 0); // draw the point in green
      cvLine(img, pf1, pf2, cvScalar(0, 255, 0), 1, 8, 0); // draw a line starting from the point
                                                           // to the image coordinates of the 
                                                           // corresponding point in the next frame
    }
    else if (currentPoint->matchNextFrame != NULL) // the correspondence between the point and its
                                                   // corresponding point in the next image isn't
                                                   // consistent with the homography
    {
      CvPoint pf2 = get2DPoint(currentPoint->matchNextFrame);
      cvCircle(img, pf1, 4, cvScalar(0, 0, 255), 1, 8, 0); // draw the point in red
      cvLine(img, pf1, pf2, cvScalar(0, 0, 255), 1, 8, 0); // draw a line starting from the point
                                                           // to the image coordinates of the 
                                                           // corresponding point in the next frame
    }
    
    currentPoint = currentPoint->nextPoint;
  }
  
  cvShowImage(VISUALIZATION, img); // show the modified image
  cvShowImage(LEGEND, legend);     // show the legend
  
  int keyInt = cvWaitKey(500); // watch 5 ms for a key pressed
  
  if(keyInt != -1) 
  {
    keyInt &= 0xFFFF; // remove NUMLOCK information (0x100000) 
    if ( (keyInt & 0xFF00) == 0x0000) 
    { 
      char keyChar = keyInt & 0xFF;  // normal keys 
      if (keyChar == 'p') // pause 
        cvWaitKey();
    }
  }

  if(fileName != NULL)
  {
	  cvSaveImage(fileName,img);
  }
   
  cvReleaseImage(&img);
  cvReleaseImage(&legend);
}