示例#1
0
void Renderer::RenderFrame(float time) {
  time_ = time;

  SetupFrame();

  // draw scene
  Setup3DRendering();

  glBindBuffer(GL_ARRAY_BUFFER, world.map_->vboId);
  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, world.map_->iboId);
  glEnableVertexAttribArray(2);
  for (unsigned int i = 0; i < renderables_.size(); ++i) {
    RenderFace(renderables_[i]);
  }

  RenderModel();
  // draw gui and overlays
  // Setup2DRendering();

  // font.PrintString("<Q3 BSP RENDERER>", glm::vec2(10.0f, 10.0f),
  // glm::vec4(1.0, 0.0, 0.0, 1.0));

  //  if (delta == 0) delta = 1;
  //
  //    std::stringstream fps;
  //    fps << "frametime in ms: " << delta << " fps: " << 1000 / delta;
  //    font.PrintString(fps.str(), glm::vec2(10.0f,
  //    (float)screen_height_-20.0f), glm::vec4(1.0, 1.0, 1.0, 1.0));
}
示例#2
0
/* * Open the netcdf file, read all dimension and variable IDs, close.
  * Return the number of frames in the file. 
  */
int Traj_AmberNetcdf::setupTrajin(std::string const& fname, Topology* trajParm)
{
  filename_.SetFileNameWithExpansion( fname );
  if (openTrajin()) return TRAJIN_ERR;

  // Sanity check - Make sure this is a Netcdf trajectory
  if ( GetNetcdfConventions() != NC_AMBERTRAJ ) {
    mprinterr("Error: Netcdf file %s conventions do not include \"AMBER\"\n",filename_.base());
    return TRAJIN_ERR;
  }
  // Get global attributes
  std::string attrText = GetAttrText("ConventionVersion");
  if ( attrText != "1.0") 
    mprintf("Warning: Netcdf file %s has ConventionVersion that is not 1.0 (%s)\n",
            filename_.base(), attrText.c_str());
  // Get title
  SetTitle( GetAttrText("title") );
  // Get Frame info
  if ( SetupFrame()!=0 ) return TRAJIN_ERR;
  // Setup Coordinates/Velocities
  if ( SetupCoordsVelo()!=0 ) return TRAJIN_ERR;
  SetVelocity( HasVelocities() );
  // Check that specified number of atoms matches expected number.
  if (Ncatom() != trajParm->Natom()) {
    mprinterr("Error: Number of atoms in NetCDF file %s (%i) does not\n",
              filename_.base(),Ncatom());
    mprinterr("       match number in associated parmtop (%i)!\n",trajParm->Natom());
    return TRAJIN_ERR;
  }
  // Setup Time
  if ( SetupTime()!=0 ) return TRAJIN_ERR;
  // Box info
  double boxcrd[6];
  if (SetupBox(boxcrd, NC_AMBERTRAJ) == 1) // 1 indicates an error
    return TRAJIN_ERR;
  SetBox( boxcrd );
  // Replica Temperatures - Allowed to fail silently
  if (SetupTemperature() == 0)
    SetTemperature( true );
  // Replica Dimensions
  if ( SetupMultiD() == -1 ) return TRAJIN_ERR;
  // NOTE: TO BE ADDED
  // labelDID;
  //int cell_spatialDID, cell_angularDID;
  //int spatialVID, cell_spatialVID, cell_angularVID;
  // Amber Netcdf coords are float. Allocate a float array for converting
  // float to/from double.
  if (Coord_ != 0) delete[] Coord_;
  Coord_ = new float[ Ncatom3() ];
  if (Veloc_ != 0) delete[] Veloc_;
  if (velocityVID_ != -1) 
    Veloc_ = new float[ Ncatom3() ];
  else
    Veloc_ = 0;
  if (debug_>1) NetcdfDebug();
  closeTraj();
  // NetCDF files are always seekable
  SetSeekable( true );
  return Ncframe();
}
示例#3
0
/**************************************************************************
 *
 * Moves focus to specified window
 *
 *************************************************************************/
void FocusOn(FvwmWindow *t, Bool FocusByMouse, char *action)
{
  int dx,dy;
  int cx,cy;
  Bool do_not_warp;

  if (t == NULL || HAS_NEVER_FOCUS(t))
  {
    UngrabEm(GRAB_NORMAL);
    if (t)
    {
      /* give the window a chance to take the focus itself */
      MoveFocus(t->w, t, FocusByMouse, 1, 0);
    }
    return;
  }

  if (!(do_not_warp = StrEquals(PeekToken(action, NULL), "NoWarp")))
  {
    if (t->Desk != Scr.CurrentDesk)
    {
      goto_desk(t->Desk);
    }

    if (IS_ICONIFIED(t))
    {
      cx = t->icon_xl_loc + t->icon_g.width/2;
      cy = t->icon_g.y + t->icon_p_height + ICON_HEIGHT(t) / 2;
    }
    else
    {
      cx = t->frame_g.x + t->frame_g.width/2;
      cy = t->frame_g.y + t->frame_g.height/2;
    }
    dx = (cx + Scr.Vx)/Scr.MyDisplayWidth*Scr.MyDisplayWidth;
    dy = (cy +Scr.Vy)/Scr.MyDisplayHeight*Scr.MyDisplayHeight;
    MoveViewport(dx,dy,True);

    /* If the window is still not visible, make it visible! */
    if (((t->frame_g.x + t->frame_g.height)< 0)||
	(t->frame_g.y + t->frame_g.width < 0)||
	(t->frame_g.x >Scr.MyDisplayWidth)||(t->frame_g.y>Scr.MyDisplayHeight))
    {
      SetupFrame(t, 0, 0, t->frame_g.width, t->frame_g.height, False);
      if (HAS_MOUSE_FOCUS(t) || HAS_SLOPPY_FOCUS(t))
      {
	XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, 2,2);
      }
    }
  }

  UngrabEm(GRAB_NORMAL);
  if (t->Desk == Scr.CurrentDesk)
  {
    MoveFocus(t->w, t, FocusByMouse, do_not_warp, 0);
  }

  return;
}
bool CHolly_Theora_Video::Start()
{
	m_bFrameWaiting = false;

	th_info thInfo;
	th_info_init( &thInfo );

	thInfo.frame_width				= Width();
	thInfo.frame_height				= Height();
	thInfo.pic_width				= Width();
	thInfo.pic_height				= Height();
	thInfo.pic_x					= 0;
	thInfo.pic_y					= 0;
	thInfo.colorspace				= TH_CS_ITU_REC_470BG;
	thInfo.pixel_fmt				= TH_PF_420; // TH_PF_444
	thInfo.target_bitrate			= BitRate() * 1024;
	thInfo.quality					= 42;
	thInfo.keyframe_granule_shift	= 6; // default value
	thInfo.fps_numerator			= FPS();
	thInfo.fps_denominator			= 1;
	thInfo.aspect_numerator			= 1;
	thInfo.aspect_denominator		= 1;

	m_Encoder = th_encode_alloc( &thInfo );
	if ( !m_Encoder )
	{
		return false;
	}

	th_info_clear( &thInfo );

	SetupFrame();
	WriteHeader();

	return true;
}
示例#5
0
void PlotJetScheme()
{
  gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();
//=============================================================================

  TFile *file = TFile::Open("data/incl/AnalysisOutputs_jet_py8_JetR05_SjeR01.root", "READ");
  TH1D *h5py8I = (TH1D*)file->Get("hJet"); h5py8I->SetName("h5py8I"); h5py8I->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_py6_JetR05_SjeR01.root", "READ");
  TH1D *h5py6I = (TH1D*)file->Get("hJet"); h5py6I->SetName("h5py6I"); h5py6I->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_qpy_JetR05_SjeR01.root", "READ");
  TH1D *h5qpyI = (TH1D*)file->Get("hJet"); h5qpyI->SetName("h5qpyI"); h5qpyI->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_vac_JetR05_SjeR01.root", "READ");
  TH1D *h5vacI = (TH1D*)file->Get("hJet"); h5vacI->SetName("h5vacI"); h5vacI->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_med_JetR05_SjeR01.root", "READ");
  TH1D *h5medI = (TH1D*)file->Get("hJet"); h5medI->SetName("h5medI"); h5medI->SetDirectory(0);
  file->Close();


  file = TFile::Open("data/incl/AnalysisOutputs_jet_py8_JetR04_SjeR01.root", "READ");
  TH1D *h4py8I = (TH1D*)file->Get("hJet"); h4py8I->SetName("h4py8I"); h4py8I->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_py6_JetR04_SjeR01.root", "READ");
  TH1D *h4py6I = (TH1D*)file->Get("hJet"); h4py6I->SetName("h4py6I"); h4py6I->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_qpy_JetR04_SjeR01.root", "READ");
  TH1D *h4qpyI = (TH1D*)file->Get("hJet"); h4qpyI->SetName("h4qpyI"); h4qpyI->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_vac_JetR04_SjeR01.root", "READ");
  TH1D *h4vacI = (TH1D*)file->Get("hJet"); h4vacI->SetName("h4vacI"); h4vacI->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_jet_med_JetR04_SjeR01.root", "READ");
  TH1D *h4medI = (TH1D*)file->Get("hJet"); h4medI->SetName("h4medI"); h4medI->SetDirectory(0);
  file->Close();


  file = TFile::Open("data/mass/AnalysisOutputs_jet_py8_JetR05_SjeR01.root", "READ");
  TH1D *h5py8M = (TH1D*)file->Get("hJet"); h5py8M->SetName("h5py8M"); h5py8M->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_py6_JetR05_SjeR01.root", "READ");
  TH1D *h5py6M = (TH1D*)file->Get("hJet"); h5py6M->SetName("h5py6M"); h5py6M->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_qpy_JetR05_SjeR01.root", "READ");
  TH1D *h5qpyM = (TH1D*)file->Get("hJet"); h5qpyM->SetName("h5qpyM"); h5qpyM->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_vac_JetR05_SjeR01.root", "READ");
  TH1D *h5vacM = (TH1D*)file->Get("hJet"); h5vacM->SetName("h5vacM"); h5vacM->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_med_JetR05_SjeR01.root", "READ");
  TH1D *h5medM = (TH1D*)file->Get("hJet"); h5medM->SetName("h5medM"); h5medM->SetDirectory(0);
  file->Close();


  file = TFile::Open("data/mass/AnalysisOutputs_jet_py8_JetR04_SjeR01.root", "READ");
  TH1D *h4py8M = (TH1D*)file->Get("hJet"); h4py8M->SetName("h4py8M"); h4py8M->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_py6_JetR04_SjeR01.root", "READ");
  TH1D *h4py6M = (TH1D*)file->Get("hJet"); h4py6M->SetName("h4py6M"); h4py6M->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_qpy_JetR04_SjeR01.root", "READ");
  TH1D *h4qpyM = (TH1D*)file->Get("hJet"); h4qpyM->SetName("h4qpyM"); h4qpyM->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_vac_JetR04_SjeR01.root", "READ");
  TH1D *h4vacM = (TH1D*)file->Get("hJet"); h4vacM->SetName("h4vacM"); h4vacM->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_jet_med_JetR04_SjeR01.root", "READ");
  TH1D *h4medM = (TH1D*)file->Get("hJet"); h4medM->SetName("h4medM"); h4medM->SetDirectory(0);
  file->Close();
//=============================================================================

  TH1F    *hfm = 0;
  TCanvas *can = 0;
  TLegend *leg = 0;
  TLatex  *tex = 0;
  TLine  *line = 0;

  const Float_t dflx = -40., dfux = 200.;
  const Float_t dfly = 8e-10, dfuy = 8e3;

  const Float_t dlsx = 0.05, dlsy = 0.05;
  const Float_t dtsx = 0.06, dtsy = 0.06;
  const Float_t dtox = 1.10, dtoy = 1.00;

  const TString stnx = "#it{p}_{T,jet}^{ch} (GeV/#it{c})";
  const TString stny = "d#sigma/d#it{p}_{T} (mb/GetV/#it{c})";

  TH1D *hSE = new TH1D("hSE", "", 10., 0., 10.);
  hSE->SetLineWidth(2);
  hSE->SetLineColor(wcl[0]);
  hSE->SetMarkerStyle(wmk[0]);
  hSE->SetMarkerColor(wcl[0]);

  TH1D *hME = new TH1D("hME", "", 10., 0., 10.);
  hME->SetLineWidth(2);
  hME->SetLineColor(wcl[0]);
  hME->SetMarkerStyle(wmk[2]);
  hME->SetMarkerColor(wcl[0]);
//=============================================================================

  const Double_t dBin[] = { 0., 10., 20., 30., 40., 50., 60., 80., 100., 120., 150., 200., 250., 300., 350., 400., 500. };
  const Int_t nBin = sizeof(dBin) / sizeof(Double_t) -1;

  TH1D *h5py8Irb = h5py8I->Rebin(nBin, "h5py8Irb", dBin); TH1D *h4py8Irb = h4py8I->Rebin(nBin, "h4py8Irb", dBin);
  TH1D *h5py6Irb = h5py6I->Rebin(nBin, "h5py6Irb", dBin); TH1D *h4py6Irb = h4py6I->Rebin(nBin, "h4py6Irb", dBin);
  TH1D *h5qpyIrb = h5qpyI->Rebin(nBin, "h5qpyIrb", dBin); TH1D *h4qpyIrb = h4qpyI->Rebin(nBin, "h4qpyIrb", dBin);
  TH1D *h5vacIrb = h5vacI->Rebin(nBin, "h5vacIrb", dBin); TH1D *h4vacIrb = h4vacI->Rebin(nBin, "h4vacIrb", dBin);
  TH1D *h5medIrb = h5medI->Rebin(nBin, "h5medIrb", dBin); TH1D *h4medIrb = h4medI->Rebin(nBin, "h4medIrb", dBin);

  TH1D *h5py8Mrb = h5py8M->Rebin(nBin, "h5py8Mrb", dBin); TH1D *h4py8Mrb = h4py8M->Rebin(nBin, "h4py8Mrb", dBin);
  TH1D *h5py6Mrb = h5py6M->Rebin(nBin, "h5py6Mrb", dBin); TH1D *h4py6Mrb = h4py6M->Rebin(nBin, "h4py6Mrb", dBin);
  TH1D *h5qpyMrb = h5qpyM->Rebin(nBin, "h5qpyMrb", dBin); TH1D *h4qpyMrb = h4qpyM->Rebin(nBin, "h4qpyMrb", dBin);
  TH1D *h5vacMrb = h5vacM->Rebin(nBin, "h5vacMrb", dBin); TH1D *h4vacMrb = h4vacM->Rebin(nBin, "h4vacMrb", dBin);
  TH1D *h5medMrb = h5medM->Rebin(nBin, "h5medMrb", dBin); TH1D *h4medMrb = h4medM->Rebin(nBin, "h4medMrb", dBin);
//=============================================================================

  TH1D *h5py8R = (TH1D*)h5py8Irb->Clone("h5py8R"); h5py8R->Divide(h5py8Mrb);
  TH1D *h5qpyR = (TH1D*)h5qpyIrb->Clone("h5qpyR"); h5qpyR->Divide(h5qpyMrb);
  TH1D *h5medR = (TH1D*)h5medIrb->Clone("h5medR"); h5medR->Divide(h5medMrb);

  TH1D *h4py8R = (TH1D*)h4py8Irb->Clone("h4py8R"); h4py8R->Divide(h4py8Mrb);
  TH1D *h4qpyR = (TH1D*)h4qpyIrb->Clone("h4qpyR"); h4qpyR->Divide(h4qpyMrb);
  TH1D *h4medR = (TH1D*)h4medIrb->Clone("h4medR"); h4medR->Divide(h4medMrb);
//=============================================================================

  can = MakeCanvas("Jet5R"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0.95, 500., 1.2); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy,
                                                      "#it{p}_{T,jet} (GeV/#it{c})",
                                                      "Ratio: BIpt scheme / E scheme");
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(h5py8R, wcl[3], wmk[0], "SAME");
  DrawHisto(h5qpyR, wcl[1], wmk[0], "SAME");
  DrawHisto(h5medR, wcl[5], wmk[0], "SAME");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(h5py8R, "PYTHIA 8", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h5qpyR, "Q-PYTHIA", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h5medR, "JEWEL+PYTHIA", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jets anti-#it{k}_{T}, #it{R}=0.5, |#eta_{jet}|<1");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("Jet4R"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0.95, 500., 1.2); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy,
                                                      "#it{p}_{T,jet} (GeV/#it{c})",
                                                      "Ratio: BIpt scheme / E scheme");
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(h4py8R, wcl[3], wmk[0], "SAME");
  DrawHisto(h4qpyR, wcl[1], wmk[0], "SAME");
  DrawHisto(h4medR, wcl[5], wmk[0], "SAME");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(h4py8R, "PYTHIA 8", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h4qpyR, "Q-PYTHIA", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h4medR, "JEWEL+PYTHIA", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jets anti-#it{k}_{T}, #it{R}=0.4, |#eta_{jet}|<1");
  CanvasEnd(can);
//=============================================================================

  TH1D *h5qpyIAA = (TH1D*)h5qpyIrb->Clone("h5qpyIAA"); h5qpyIAA->Divide(h5py6Irb);
  TH1D *h5medIAA = (TH1D*)h5medIrb->Clone("h5medIAA"); h5medIAA->Divide(h5vacIrb);

  TH1D *h4qpyIAA = (TH1D*)h4qpyIrb->Clone("h4qpyIAA"); h4qpyIAA->Divide(h4py6Irb);
  TH1D *h4medIAA = (TH1D*)h4medIrb->Clone("h4medIAA"); h4medIAA->Divide(h4vacIrb);

  TH1D *h5qpyMAA = (TH1D*)h5qpyMrb->Clone("h5qpyMAA"); h5qpyMAA->Divide(h5py6Mrb);
  TH1D *h5medMAA = (TH1D*)h5medMrb->Clone("h5medMAA"); h5medMAA->Divide(h5vacMrb);

  TH1D *h4qpyMAA = (TH1D*)h4qpyMrb->Clone("h4qpyMAA"); h4qpyMAA->Divide(h4py6Mrb);
  TH1D *h4medMAA = (TH1D*)h4medMrb->Clone("h4medMAA"); h4medMAA->Divide(h4vacMrb);
//=============================================================================

  can = MakeCanvas("Jet5RAA"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0., 500., 1.2); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy,
                                                        "#it{p}_{T,jet} (GeV/#it{c})",
                                                        "#it{R}_{AA}");
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(h5qpyIAA, wcl[1], wmk[0], "SAME");
  DrawHisto(h5medIAA, wcl[5], wmk[0], "SAME");

  DrawHisto(h5qpyMAA, wcl[1], wmk[2], "SAME");
  DrawHisto(h5medMAA, wcl[5], wmk[2], "SAME");

  leg = new TLegend(0.42, 0.56, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(h5qpyIAA, "Q-PYTHIA, BIpt scheme", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h5qpyMAA, "Q-PYTHIA, BIpt scheme", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h5medIAA, "JEWEL+PYTHIA, E scheme", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h5medMAA, "JEWEL+PYTHIA, E scheme", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet anti-#it{k}_{T}, #it{R}=0.5, |#eta_{jet}|<1");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("Jet4RAA"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0., 500., 1.2); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy,
                                                        "#it{p}_{T,jet} (GeV/#it{c})",
                                                        "#it{R}_{AA}");
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(h4qpyIAA, wcl[1], wmk[0], "SAME");
  DrawHisto(h4medIAA, wcl[5], wmk[0], "SAME");

  DrawHisto(h4qpyMAA, wcl[1], wmk[2], "SAME");
  DrawHisto(h4medMAA, wcl[5], wmk[2], "SAME");

  leg = new TLegend(0.42, 0.56, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(h4qpyIAA, "Q-PYTHIA, BIpt scheme", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h4qpyMAA, "Q-PYTHIA, BIpt scheme", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h4medIAA, "JEWEL+PYTHIA, E scheme", "LP")->SetTextSizePixels(24);
  leg->AddEntry(h4medMAA, "JEWEL+PYTHIA, E scheme", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet anti-#it{k}_{T}, #it{R}=0.4, |#eta_{jet}|<1");
  CanvasEnd(can);
//=============================================================================

  return;
}
示例#6
0
void PlotDszR04Reco()
{
  gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();

  const TString sTag = "#it{p}_{T,particle}^{Trigger}>20 GeV/#it{c}";
//=============================================================================

  TFile *file = TFile::Open("data/incl/AnalysisOutputs_Rje_py8_JetR04_SjeR01.root", "READ");
  TH2D *hpy8 = (TH2D*)file->Get("hJetDszt020"); hpy8->SetName("hpy8"); hpy8->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_Rje_qpy_JetR04_SjeR01.root", "READ");
  TH2D *hqpy = (TH2D*)file->Get("hJetDszt020"); hqpy->SetName("hqpy"); hqpy->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/incl/AnalysisOutputs_Rje_med_JetR04_SjeR01.root", "READ");
  TH2D *hmed = (TH2D*)file->Get("hJetDszt020"); hmed->SetName("hmed"); hmed->SetDirectory(0);
  file->Close();
//=============================================================================

  TH1D *hpy8020 = hpy8->ProjectionY("hpy8020", hpy8->GetXaxis()->FindBin( 20.+1e-6), hpy8->GetXaxis()->FindBin( 30.-1e-6));
  TH1D *hpy8060 = hpy8->ProjectionY("hpy8060", hpy8->GetXaxis()->FindBin( 60.+1e-6), hpy8->GetXaxis()->FindBin( 80.-1e-6));
  TH1D *hpy8120 = hpy8->ProjectionY("hpy8120", hpy8->GetXaxis()->FindBin(120.+1e-6), hpy8->GetXaxis()->FindBin(150.-1e-6));

  TH1D *hqpy020 = hqpy->ProjectionY("hqpy020", hqpy->GetXaxis()->FindBin( 20.+1e-6), hqpy->GetXaxis()->FindBin( 30.-1e-6));
  TH1D *hqpy060 = hqpy->ProjectionY("hqpy060", hqpy->GetXaxis()->FindBin( 60.+1e-6), hqpy->GetXaxis()->FindBin( 80.-1e-6));
  TH1D *hqpy120 = hqpy->ProjectionY("hqpy120", hqpy->GetXaxis()->FindBin(120.+1e-6), hqpy->GetXaxis()->FindBin(150.-1e-6));

  TH1D *hmed020 = hmed->ProjectionY("hmed020", hmed->GetXaxis()->FindBin( 20.+1e-6), hmed->GetXaxis()->FindBin( 30.-1e-6));
  TH1D *hmed060 = hmed->ProjectionY("hmed060", hmed->GetXaxis()->FindBin( 60.+1e-6), hmed->GetXaxis()->FindBin( 80.-1e-6));
  TH1D *hmed120 = hmed->ProjectionY("hmed120", hmed->GetXaxis()->FindBin(120.+1e-6), hmed->GetXaxis()->FindBin(150.-1e-6));


  hpy8020->Rebin(10.); hpy8020->Scale(1./hpy8020->Integral()); NormBinningHistogram(hpy8020);
  hpy8060->Rebin(10.); hpy8060->Scale(1./hpy8060->Integral()); NormBinningHistogram(hpy8060);
  hpy8120->Rebin(10.); hpy8120->Scale(1./hpy8120->Integral()); NormBinningHistogram(hpy8120);

  hqpy020->Rebin(10.); hqpy020->Scale(1./hqpy020->Integral()); NormBinningHistogram(hqpy020);
  hqpy060->Rebin(10.); hqpy060->Scale(1./hqpy060->Integral()); NormBinningHistogram(hqpy060);
  hqpy120->Rebin(10.); hqpy120->Scale(1./hqpy120->Integral()); NormBinningHistogram(hqpy120);

  hmed020->Rebin(10.); hmed020->Scale(1./hmed020->Integral()); NormBinningHistogram(hmed020);
  hmed060->Rebin(10.); hmed060->Scale(1./hmed060->Integral()); NormBinningHistogram(hmed060);
  hmed120->Rebin(10.); hmed120->Scale(1./hmed120->Integral()); NormBinningHistogram(hmed120);


  TGraph *gpy8020 = new TGraph(hpy8020); TGraph *gpy8060 = new TGraph(hpy8060); TGraph *gpy8120 = new TGraph(hpy8120);
  TGraph *gqpy020 = new TGraph(hqpy020); TGraph *gqpy060 = new TGraph(hqpy060); TGraph *gqpy120 = new TGraph(hqpy120);
  TGraph *gmed020 = new TGraph(hmed020); TGraph *gmed060 = new TGraph(hmed060); TGraph *gmed120 = new TGraph(hmed120);
//=============================================================================

  TH1F    *hfm = 0;
  TCanvas *can = 0;
  TLegend *leg = 0;
  TLatex  *tex = 0;
  TLine  *line = 0;

  const Float_t dflx = -40., dfux = 200.;
  const Float_t dfly = 8e-10, dfuy = 8e3;

  const Float_t dlsx = 0.05, dlsy = 0.05;
  const Float_t dtsx = 0.06, dtsy = 0.06;
  const Float_t dtox = 1.10, dtoy = 1.00;

  const TString stnx = "#Delta#it{z}_{sj}";
  const TString stny = "1/#it{N}_{jet} d#it{N}/d#Delta#it{z}_{sj}";
//=============================================================================

  can = MakeCanvas("Jet4Dsz020"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0., 1., 5.); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawGraph(gpy8020, wcl[3], "C");
  DrawGraph(gqpy020, wcl[1], "C");
  DrawGraph(gmed020, wcl[5], "C");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(gpy8020, "PYTHIA 8", "L")->SetTextSizePixels(24);
  leg->AddEntry(gqpy020, "Q-PYTHIA", "L")->SetTextSizePixels(24);
  leg->AddEntry(gmed020, "JEWEL+PYTHIA", "L")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet #it{R}=0.4, anti-#it{k}_{T}, 20<#it{p}_{T,jet}<30 GeV/#it{c}, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.84, sTag.Data());
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("Jet4Dsz060"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0., 1., 5.); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawGraph(gpy8060, wcl[3], "C");
  DrawGraph(gqpy060, wcl[1], "C");
  DrawGraph(gmed060, wcl[5], "C");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(gpy8060, "PYTHIA 8", "L")->SetTextSizePixels(24);
  leg->AddEntry(gqpy060, "Q-PYTHIA", "L")->SetTextSizePixels(24);
  leg->AddEntry(gmed060, "JEWEL+PYTHIA", "L")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet #it{R}=0.4, anti-#it{k}_{T}, 60<#it{p}_{T,jet}<80 GeV/#it{c}, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.84, sTag.Data());
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("Jet4Dsz120"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(0., 0., 1., 5.); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawGraph(gpy8120, wcl[3], "C");
  DrawGraph(gqpy120, wcl[1], "C");
  DrawGraph(gmed120, wcl[5], "C");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(gpy8120, "PYTHIA 8", "L")->SetTextSizePixels(24);
  leg->AddEntry(gqpy120, "Q-PYTHIA", "L")->SetTextSizePixels(24);
  leg->AddEntry(gmed120, "JEWEL+PYTHIA", "L")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.14, 0.92, "2.76 TeV, Jet #it{R}=0.4, anti-#it{k}_{T}, 120<#it{p}_{T,jet}<150 GeV/#it{c}, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.84, sTag.Data());
  CanvasEnd(can);
//=============================================================================

  return;
}
示例#7
0
void PlotIsjMean()
{
  gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();
//=============================================================================

  TFile *file = TFile::Open("data/AnalysisOutputs_Isj.root", "READ");
  TList *listPy8R4S1 = (TList*)file->Get("list_py8_JetR04_SjeR01");
  TList *listPy8R4S2 = (TList*)file->Get("list_py8_JetR04_SjeR02");
  TList *listPy8R4S3 = (TList*)file->Get("list_py8_JetR04_SjeR03");
  TList *listPy8R5S1 = (TList*)file->Get("list_py8_JetR05_SjeR01");
  TList *listPy8R5S2 = (TList*)file->Get("list_py8_JetR05_SjeR02");
  TList *listPy8R5S3 = (TList*)file->Get("list_py8_JetR05_SjeR03");
  TList *listPy8R5S4 = (TList*)file->Get("list_py8_JetR05_SjeR04");

  TList *listVacR4S1 = (TList*)file->Get("list_vac_JetR04_SjeR01");
  TList *listVacR4S2 = (TList*)file->Get("list_vac_JetR04_SjeR02");
  TList *listVacR4S3 = (TList*)file->Get("list_vac_JetR04_SjeR03");
  TList *listVacR5S1 = (TList*)file->Get("list_vac_JetR05_SjeR01");
  TList *listVacR5S2 = (TList*)file->Get("list_vac_JetR05_SjeR02");
  TList *listVacR5S3 = (TList*)file->Get("list_vac_JetR05_SjeR03");
  TList *listVacR5S4 = (TList*)file->Get("list_vac_JetR05_SjeR04");

  TList *listMedR4S1 = (TList*)file->Get("list_med_JetR04_SjeR01");
  TList *listMedR4S2 = (TList*)file->Get("list_med_JetR04_SjeR02");
  TList *listMedR4S3 = (TList*)file->Get("list_med_JetR04_SjeR03");
  TList *listMedR5S1 = (TList*)file->Get("list_med_JetR05_SjeR01");
  TList *listMedR5S2 = (TList*)file->Get("list_med_JetR05_SjeR02");
  TList *listMedR5S3 = (TList*)file->Get("list_med_JetR05_SjeR03");
  TList *listMedR5S4 = (TList*)file->Get("list_med_JetR05_SjeR04");
  file->Close();

  TProfile *hPy8R4S1 = (TProfile*)listPy8R4S1->FindObject("hJetIsj_mean"); hPy8R4S1->SetName("hPy8R4S1");
  TProfile *hPy8R4S2 = (TProfile*)listPy8R4S2->FindObject("hJetIsj_mean"); hPy8R4S2->SetName("hPy8R4S2");
  TProfile *hPy8R4S3 = (TProfile*)listPy8R4S3->FindObject("hJetIsj_mean"); hPy8R4S3->SetName("hPy8R4S3");
  TProfile *hPy8R5S1 = (TProfile*)listPy8R5S1->FindObject("hJetIsj_mean"); hPy8R5S1->SetName("hPy8R5S1");
  TProfile *hPy8R5S2 = (TProfile*)listPy8R5S2->FindObject("hJetIsj_mean"); hPy8R5S2->SetName("hPy8R5S2");
  TProfile *hPy8R5S3 = (TProfile*)listPy8R5S3->FindObject("hJetIsj_mean"); hPy8R5S3->SetName("hPy8R5S3");
  TProfile *hPy8R5S4 = (TProfile*)listPy8R5S4->FindObject("hJetIsj_mean"); hPy8R5S4->SetName("hPy8R5S4");

  TProfile *hVacR4S1 = (TProfile*)listVacR4S1->FindObject("hJetIsj_mean"); hVacR4S1->SetName("hVacR4S1");
  TProfile *hVacR4S2 = (TProfile*)listVacR4S2->FindObject("hJetIsj_mean"); hVacR4S2->SetName("hVacR4S2");
  TProfile *hVacR4S3 = (TProfile*)listVacR4S3->FindObject("hJetIsj_mean"); hVacR4S3->SetName("hVacR4S3");
  TProfile *hVacR5S1 = (TProfile*)listVacR5S1->FindObject("hJetIsj_mean"); hVacR5S1->SetName("hVacR5S1");
  TProfile *hVacR5S2 = (TProfile*)listVacR5S2->FindObject("hJetIsj_mean"); hVacR5S2->SetName("hVacR5S2");
  TProfile *hVacR5S3 = (TProfile*)listVacR5S3->FindObject("hJetIsj_mean"); hVacR5S3->SetName("hVacR5S3");
  TProfile *hVacR5S4 = (TProfile*)listVacR5S4->FindObject("hJetIsj_mean"); hVacR5S4->SetName("hVacR5S4");

  TProfile *hMedR4S1 = (TProfile*)listMedR4S1->FindObject("hJetIsj_mean"); hMedR4S1->SetName("hMedR4S1");
  TProfile *hMedR4S2 = (TProfile*)listMedR4S2->FindObject("hJetIsj_mean"); hMedR4S2->SetName("hMedR4S2");
  TProfile *hMedR4S3 = (TProfile*)listMedR4S3->FindObject("hJetIsj_mean"); hMedR4S3->SetName("hMedR4S3");
  TProfile *hMedR5S1 = (TProfile*)listMedR5S1->FindObject("hJetIsj_mean"); hMedR5S1->SetName("hMedR5S1");
  TProfile *hMedR5S2 = (TProfile*)listMedR5S2->FindObject("hJetIsj_mean"); hMedR5S2->SetName("hMedR5S2");
  TProfile *hMedR5S3 = (TProfile*)listMedR5S3->FindObject("hJetIsj_mean"); hMedR5S3->SetName("hMedR5S3");
  TProfile *hMedR5S4 = (TProfile*)listMedR5S4->FindObject("hJetIsj_mean"); hMedR5S4->SetName("hMedR5S4");
//=============================================================================

  TH1F    *hfm = 0;
  TCanvas *can = 0;
  TLegend *leg = 0;
  TLatex  *tex = 0;
  TLine  *line = 0;

  const Float_t dflx = 0., dfux = 500.;
  const Float_t dfly = 0., dfuy = 500.;

  const Float_t dlsx = 0.05, dlsy = 0.05;
  const Float_t dtsx = 0.06, dtsy = 0.06;
  const Float_t dtox = 1.10, dtoy = 1.00;

  const TString stnx = "#it{p}_{T,jet} (GeV/#it{c})";
  const TString stny = "#it{p}_{T,subjet}^{mean} (GeV/#it{c})";

  TH1D *hSE = new TH1D("hSE", "", 10., 0., 10.);
  hSE->SetLineWidth(2);
  hSE->SetLineColor(wcl[0]);
  hSE->SetMarkerStyle(wmk[0]);
  hSE->SetMarkerColor(wcl[0]);

  TH1D *hME = new TH1D("hME", "", 10., 0., 10.);
  hME->SetLineWidth(2);
  hME->SetLineColor(wcl[0]);
  hME->SetMarkerStyle(wmk[2]);
  hME->SetMarkerColor(wcl[0]);
//=============================================================================

  can = MakeCanvas("IsjPy8R04_mean"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
  hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hPy8R4S1, wcl[1], wmk[0], "SAME");
  DrawHisto(hPy8R4S2, wcl[3], wmk[0], "SAME");
  DrawHisto(hPy8R4S3, wcl[4], wmk[0], "SAME");

  leg = new TLegend(0.68, 0.66, 0.98, 0.90); SetupLegend(leg);
  leg->AddEntry(hPy8R4S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hPy8R4S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hPy8R4S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA 8, tune 4C, pp #sqrt{#it{s}_{NN}}=2.76 TeV");
  tex->DrawLatex(0.16, 0.84, "Jet: anti-#it{k}_{T}, #it{R}=0.4, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.76, "Sub-jet: #it{k}_{T}");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("IsjPy8R05_mean"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
  hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hPy8R5S1, wcl[1], wmk[0], "SAME");
  DrawHisto(hPy8R5S2, wcl[3], wmk[0], "SAME");
  DrawHisto(hPy8R5S3, wcl[4], wmk[0], "SAME");
  DrawHisto(hPy8R5S4, wcl[2], wmk[0], "SAME");

  leg = new TLegend(0.58, 0.74, 0.98, 0.90); SetupLegend(leg);
  leg->SetNColumns(2);
  leg->AddEntry(hPy8R5S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hPy8R5S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hPy8R5S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hPy8R5S4, "#it{R}_{sub}=0.4", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA 8, tune 4C, pp #sqrt{#it{s}_{NN}}=2.76 TeV");
  tex->DrawLatex(0.16, 0.84, "Jet: anti-#it{k}_{T}, #it{R}=0.5, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.76, "Sub-jet: #it{k}_{T}");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("IsjVacR04_mean"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
  hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hVacR4S1, wcl[1], wmk[0], "SAME");
  DrawHisto(hVacR4S2, wcl[3], wmk[0], "SAME");
  DrawHisto(hVacR4S3, wcl[4], wmk[0], "SAME");

  leg = new TLegend(0.68, 0.66, 0.98, 0.90); SetupLegend(leg);
  leg->AddEntry(hVacR4S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hVacR4S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hVacR4S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA+JEWEL, vacuum, #sqrt{#it{s}_{NN}}=2.76 TeV");
  tex->DrawLatex(0.16, 0.84, "Jet: anti-#it{k}_{T}, #it{R}=0.4, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.76, "Sub-jet: #it{k}_{T}");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("IsjVacR05_mean"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
  hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy,  stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hVacR5S1, wcl[1], wmk[0], "SAME");
  DrawHisto(hVacR5S2, wcl[3], wmk[0], "SAME");
  DrawHisto(hVacR5S3, wcl[4], wmk[0], "SAME");
  DrawHisto(hVacR5S4, wcl[2], wmk[0], "SAME");

  leg = new TLegend(0.58, 0.74, 0.98, 0.90); SetupLegend(leg);
  leg->SetNColumns(2);
  leg->AddEntry(hVacR5S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hVacR5S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hVacR5S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hVacR5S4, "#it{R}_{sub}=0.4", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA+JEWEL, vacuum, #sqrt{#it{s}_{NN}}=2.76 TeV");
  tex->DrawLatex(0.16, 0.84, "Jet: anti-#it{k}_{T}, #it{R}=0.5, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.76, "Sub-jet: #it{k}_{T}");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("IsjMedR04_mean"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
  hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy,  stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hMedR4S1, wcl[1], wmk[0], "SAME");
  DrawHisto(hMedR4S2, wcl[3], wmk[0], "SAME");
  DrawHisto(hMedR4S3, wcl[4], wmk[0], "SAME");

  leg = new TLegend(0.68, 0.66, 0.98, 0.90); SetupLegend(leg);
  leg->AddEntry(hMedR4S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hMedR4S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hMedR4S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA+JEWEL, medium, #sqrt{#it{s}_{NN}}=2.76 TeV");
  tex->DrawLatex(0.16, 0.84, "Jet: anti-#it{k}_{T}, #it{R}=0.4, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.76, "Sub-jet: #it{k}_{T}");
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("IsjMedR05_mean"); can->SetGridx(); can->SetGridy(); //can->SetLogy();
  hfm = can->DrawFrame(dflx,dfly,dfux,dfuy); SetupFrame(hfm,dlsx,dlsy,dtsx,dtsy,dtox,dtoy,  stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hMedR5S1, wcl[1], wmk[0], "SAME");
  DrawHisto(hMedR5S2, wcl[3], wmk[0], "SAME");
  DrawHisto(hMedR5S3, wcl[4], wmk[0], "SAME");
  DrawHisto(hMedR5S4, wcl[2], wmk[0], "SAME");

  leg = new TLegend(0.58, 0.74, 0.98, 0.90); SetupLegend(leg);
  leg->SetNColumns(2);
  leg->AddEntry(hMedR5S1, "#it{R}_{sub}=0.1", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hMedR5S2, "#it{R}_{sub}=0.2", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hMedR5S3, "#it{R}_{sub}=0.3", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hMedR5S4, "#it{R}_{sub}=0.4", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA+JEWEL, medium, #sqrt{#it{s}_{NN}}=2.76 TeV");
  tex->DrawLatex(0.16, 0.84, "Jet: anti-#it{k}_{T}, #it{R}=0.5, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.76, "Sub-jet: #it{k}_{T}");
  CanvasEnd(can);
//=============================================================================

  return;
}
示例#8
0
文件: move.c 项目: tonnerre/fvwm
/****************************************************************************
 *
 * Start a window move operation
 *
 ****************************************************************************/
void move_window(XEvent *eventp,Window w,FvwmWindow *tmp_win,int context,
		 int val1, int val2, int val1_unit,int val2_unit)
{
  int FinalX, FinalY;

  /* gotta have a window */
  if(tmp_win == NULL)
    return;

  w = tmp_win->frame;
  if(tmp_win->flags & ICONIFIED)
    {
      if(tmp_win->icon_pixmap_w != None)
	{
	  XUnmapWindow(dpy,tmp_win->icon_w);
	  w = tmp_win->icon_pixmap_w;
	}
      else
	w = tmp_win->icon_w;
    }

  if((val1 !=0)||(val2 != 0))
    {
      FinalX = val1*val1_unit/100;
      FinalY = val2*val2_unit/100;
    }
  else
    InteractiveMove(&w,tmp_win,&FinalX,&FinalY,eventp);

  if (w == tmp_win->frame)
    {
      SetupFrame (tmp_win, FinalX, FinalY,
		  tmp_win->frame_width, tmp_win->frame_height,FALSE);
    }
  else /* icon window */
    {
      tmp_win->flags |= ICON_MOVED;
      tmp_win->icon_x_loc = FinalX ;
      tmp_win->icon_xl_loc = FinalX -
	    (tmp_win->icon_w_width - tmp_win->icon_p_width)/2;
      tmp_win->icon_y_loc = FinalY; 
      Broadcast(M_ICON_LOCATION,7,tmp_win->w,tmp_win->frame,
		(unsigned long)tmp_win,
		tmp_win->icon_x_loc,tmp_win->icon_y_loc,
		tmp_win->icon_w_width, tmp_win->icon_w_height
		+tmp_win->icon_p_height);
      XMoveWindow(dpy,tmp_win->icon_w, 
		  tmp_win->icon_xl_loc, FinalY+tmp_win->icon_p_height);
      if(tmp_win->icon_pixmap_w != None)
	{
	  XMapWindow(dpy,tmp_win->icon_w);
	  XMoveWindow(dpy, tmp_win->icon_pixmap_w, tmp_win->icon_x_loc,FinalY);
	  XMapWindow(dpy,w);
	}
      
    }
  
#ifndef NO_PAGER
  RedrawPager();
#endif

  return;
}
示例#9
0
/**************************************************************************
 *
 * Moves pointer to specified window
 *
 *************************************************************************/
static void warp_to_fvwm_window(
  XEvent *eventp, FvwmWindow *t, int warp_x, int x_unit, int warp_y, int y_unit)
{
  int dx,dy;
  int cx,cy;
  int x,y;

  if(t == (FvwmWindow *)0 || (IS_ICONIFIED(t) && t->icon_w == None))
    return;

  if(t->Desk != Scr.CurrentDesk)
  {
    goto_desk(t->Desk);
  }

  if(IS_ICONIFIED(t))
  {
    cx = t->icon_xl_loc + t->icon_g.width/2;
    cy = t->icon_g.y + t->icon_p_height + ICON_HEIGHT(t) / 2;
  }
  else
  {
    cx = t->frame_g.x + t->frame_g.width/2;
    cy = t->frame_g.y + t->frame_g.height/2;
  }

  dx = (cx + Scr.Vx) / Scr.MyDisplayWidth * Scr.MyDisplayWidth;
  dy = (cy + Scr.Vy) / Scr.MyDisplayHeight * Scr.MyDisplayHeight;

  MoveViewport(dx,dy,True);

  if(IS_ICONIFIED(t))
  {
    x = t->icon_xl_loc + t->icon_g.width / 2;
    y = t->icon_g.y + t->icon_p_height + ICON_HEIGHT(t) / 2;
  }
  else
  {
    if (x_unit != Scr.MyDisplayWidth && warp_x >= 0)
      x = t->frame_g.x + warp_x;
    else if (x_unit != Scr.MyDisplayWidth)
      x = t->frame_g.x + t->frame_g.width + warp_x;
    else if (warp_x >= 0)
      x = t->frame_g.x + (t->frame_g.width - 1) * warp_x / 100;
    else
      x = t->frame_g.x + (t->frame_g.width - 1) * (100 + warp_x) / 100;

    if (y_unit != Scr.MyDisplayHeight && warp_y >= 0)
      y = t->frame_g.y + warp_y;
    else if (y_unit != Scr.MyDisplayHeight)
      y = t->frame_g.y + t->frame_g.height + warp_y;
    else if (warp_y >= 0)
      y = t->frame_g.y + (t->frame_g.height - 1) * warp_y / 100;
    else
      y = t->frame_g.y + (t->frame_g.height - 1) * (100 + warp_y) / 100;
  }
  XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, x, y);
  SetPointerEventPosition(eventp, x, y);
  RaiseWindow(t);

  /* If the window is still not visible, make it visible! */
  if (t->frame_g.x + t->frame_g.width  < 0 ||
      t->frame_g.y + t->frame_g.height < 0 ||
      t->frame_g.x >= Scr.MyDisplayWidth   ||
      t->frame_g.y >= Scr.MyDisplayHeight)
  {
    SetupFrame(t, 0, 0, t->frame_g.width, t->frame_g.height, False);
    XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, 2,2);
    SetPointerEventPosition(eventp, 2, 2);
  }
}
示例#10
0
///////////////////
// Start the diner
bool Dnr_Start(char *szDir)
{
    keyboard_t *kb = System_GetKeyboard();
    GLfloat     one[] = {0.3f,0.3f,0.3f,1};
    GLfloat     blue[] = {0.3f, 0.3f, 1.0f, 1.0f};
    GLfloat     pos1[4] = {1,1,1,1};
    GLfloat     pos2[4] = {1,1,1,1};
    GLfloat     pos3[4] = {25,-100,50,1};
    int         i;

    if( !Dnr_Load(szDir) )
        return false;

    for( i=0; i<3; i++ ) {
        pos1[i] = psDiner->pcLocation->getScene()->getLight(0).Position.GetIndex(i);
        pos2[i] = psDiner->pcLocation->getScene()->getLight(1).Position.GetIndex(i);
    }

    // Setup the diner for an opponent
    psDiner->nOppState = opp_waiting;
    psDiner->fOppTimer = tMainSR3.fCurTime + (float)GetRandomInt(2)+2.0f;

    sRaceInfo.pcOpponent = NULL;

    // HACK: Quickly get the opponent in the diner
    //Dnr_RollinOpponent();


    //psDiner->pcLocation->SetupCamera( CVec(25,11,-1.4f),100);
    //psDiner->pcLocation->setCamPos( CVec(0,0,0) );

    // Setup the fog
    State_Disable(GL_FOG);

    // Setup the lighting
    State_Enable(GL_LIGHTING);
    State_Enable(GL_LIGHT1);
    State_Enable(GL_LIGHT2);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, one);
    glLightfv(GL_LIGHT1, GL_DIFFUSE, one);
    glLightfv(GL_LIGHT2, GL_DIFFUSE, one);
    glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.00f);
	glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.0f);
    glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, 1.00f);
	glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0.0f);
    glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 0.80f);
	glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.01f);
    glMaterialf(GL_FRONT, GL_SHININESS, 25.0);
    glMaterialfv(GL_FRONT, GL_SPECULAR, one);


    System_ProcessInput();
	while(psDiner->bProcessDiner) {
		System_ProcessInput();

        //
        // Processing
        //
        psDiner->pcLocation->Process();
        psDiner->cSky.Simulate(tMainSR3.fDeltaTime);

        if( !psDiner->bSpeechBubble ) {
            Dnr_ProcessOpponent();
            Dnr_ProcessGUI();
        }

		cMainGuy->processFrame();



        //
        // 3D Drawing
        //
        glLightfv(GL_LIGHT0, GL_POSITION, pos1);
        glLightfv(GL_LIGHT1, GL_POSITION, pos2);
        glLightfv(GL_LIGHT2, GL_POSITION, pos3);

        SetupFrame();
        // Manually setup the camera
        psDiner->pcLocation->getCamera()->LookAt(psDiner->pcLocation->getCamLook());
        psDiner->pcLocation->getCamera()->Show();

        psDiner->cSky.Render( psDiner->pcLocation->getCamera() );
        State_Enable(GL_LIGHTING);
		psDiner->pcLocation->Draw(true, true, false);

        Dnr_DrawOpponent();



        //
        // 2D Drawing
        //
        Render_Begin2D();

            // Draw the sidedoor bit
            State_Enable(GL_TEXTURE_2D);
            State_Disable(GL_LIGHTING);
            State_Enable(GL_BLEND);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            glColor4f(1,1,1,1);
            BlitTexture(psDiner->psSideDoor, 0,0, 0,472, 105,128, 1,1);
            for(i=0; i<10; i++ ) {
                BlitTexture(psDiner->psSideDoor, 105,0, i*95+105,472, 95,128, 1,1);
            }

            if( psDiner->bSpeechBubble )
                Dnr_SpeechProcess();

            psDiner->pcLocation->FinalDraw();

            if(psOptions->nShowFPS) {
                Font_SetAlpha(1);
                Font_SetSize(14);
                int fps = GetFPS();
                Font_Draw(5, 583, CVec(0,0,0), "FPS:  %d", fps);
                Font_Draw(5, 585, CVec(1,1,1), "FPS:  %d", fps);
            }
            if(psOptions->nDeveloper) {
                Font_SetAlpha(1);
                Font_SetSize(14);
                Font_Draw(5, 563, CVec(0,0,0), "Tris: %d", tMainSR3.TriCount);
                Font_Draw(5, 565, CVec(1,1,1), "Tris: %d", tMainSR3.TriCount);
            }

            // Draw the gui
            if(!psDiner->bSpeechBubble && psDiner->bProcessDiner) {
                if( psDiner->bOppClicked )
                    cDinerLayout.Draw();
                cDinerLayout2.Draw();
            }

            gui_DrawMouse();

		Render_End2D();

		SDL_GL_SwapBuffers();
    }

    //
    // Show a loading sign on the screen
    //
    Render_Begin2D();
    Font_SetSize(14);
    Font_SetAlpha(1);
    Font_DrawCentered(400, 300, CVec(1,1,1), "Loading...");
    Render_End2D();
    SDL_GL_SwapBuffers();


    // Are we going to race?
    if(psDiner->bRacing)
        // Off to the track
        Game_SetLocation(LOC_RACE);
    else
        // Back to the garage
        Game_SetLocation(LOC_GARAGE);

    Dnr_Shutdown();

    return true;
}
示例#11
0
void PlotTrkPt()
{
  gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();
//=============================================================================

  TFile *file = TFile::Open("data/AnalysisResults_vac_JetR05_skTR01.root", "READ");
  TH2D *hTrkPtEtaVac = (TH2D*)file->Get("hTrkPtEta"); hTrkPtEtaVac->SetName("hTrkPtEtaVac"); hTrkPtEtaVac->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/AnalysisResults_med_JetR05_skTR01.root", "READ");
  TH2D *hTrkPtEtaMed = (TH2D*)file->Get("hTrkPtEta"); hTrkPtEtaMed->SetName("hTrkPtEtaMed"); hTrkPtEtaMed->SetDirectory(0);
  file->Close();
//=============================================================================

  TH1D *hTrkPtVac = hTrkPtEtaVac->ProjectionX("hTrkPtVac");
  TH1D *hTrkPtMed = hTrkPtEtaMed->ProjectionX("hTrkPtMed");

  hTrkPtVac->Rebin(10); hTrkPtVac->Scale(1./5.);
  hTrkPtMed->Rebin(10); hTrkPtMed->Scale(1./5.);
//=============================================================================

  TH1F    *hfm = 0;
  TCanvas *can = 0;
  TLegend *leg = 0;
  TLatex  *tex = 0;
  TLine  *line = 0;

  const Float_t dflx = 0., dfux = 300.;
  const Float_t dfly = 8e-13, dfuy = 8e2;

  const Float_t dlsx = 0.05, dlsy = 0.05;
  const Float_t dtsx = 0.06, dtsy = 0.06;
  const Float_t dtox = 1.10, dtoy = 1.00;

  const TString stnx = "#it{p}_{T} (GeV/#it{c})";
  const TString stny = "d#sigma/d#it{p}_{T} (mb/GeV/#it{c})";

  TH1D *hSE = new TH1D("hSE", "", 10., 0., 10.);
  hSE->SetLineWidth(2);
  hSE->SetLineColor(wcl[0]);
  hSE->SetMarkerStyle(wmk[0]);
  hSE->SetMarkerColor(wcl[0]);

  TH1D *hME = new TH1D("hME", "", 10., 0., 10.);
  hME->SetLineWidth(2);
  hME->SetLineColor(wcl[0]);
  hME->SetMarkerStyle(wmk[2]);
  hME->SetMarkerColor(wcl[0]);
//=============================================================================

  can = MakeCanvas("TrkPt"); can->SetGridx(); can->SetGridy(); can->SetLogy();
  hfm = can->DrawFrame(dflx, dfly, dfux, dfuy); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hTrkPtVac, wcl[3], wmk[0], "SAME");
  DrawHisto(hTrkPtMed, wcl[1], wmk[0], "SAME");

  leg = new TLegend(0.62, 0.72, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(hTrkPtVac, "Vacuum", "LP")->SetTextSizePixels(24);
  leg->AddEntry(hTrkPtMed, "Medium", "LP")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA+JEWEL, 2.76 TeV, |#eta|<2.6");
  CanvasEnd(can);
//=============================================================================

  const Double_t dBins[] = { 0., 5., 10., 20., 30., 50., 80., 120., 160., 200., 250., 300., 400., 500. };
  const Int_t nBins = sizeof(dBins) / sizeof(Double_t) - 1;

  TH1D *hTrkPtVacRB = hTrkPtVac->Rebin(nBins, "hTrkPtVacRB", dBins);
  TH1D *hTrkPtMedRB = hTrkPtMed->Rebin(nBins, "hTrkPtMedRB", dBins); hTrkPtMedRB->Divide(hTrkPtVacRB);

  can = MakeCanvas("TrkPtRAA"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(dflx, 0., dfux, 2.); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, "#it{R}_{AA}");
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawHisto(hTrkPtMedRB, wcl[0], wmk[0], "SAME");

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "PYTHIA+JEWEL, 2.76 TeV, |#eta|<2.6");
  CanvasEnd(can);
//=============================================================================

  return;
}
示例#12
0
void HandlePropertyNotify()
{
  XTextProperty text_prop;
  Boolean       OnThisPage    =  False;

  DBUG("HandlePropertyNotify","Routine Entered");

  if ((!Tmp_win)||
      (XGetGeometry(dpy, Tmp_win->w, &JunkRoot, &JunkX, &JunkY,
		    &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0))
    return;

  /*
      Make sure at least part of window is on this page
      before giving it focus...
  */
  if ( (Tmp_win->Desk == Scr.CurrentDesk) &&
       ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 &&
          Tmp_win->frame_x < Scr.MyDisplayWidth) &&
         ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 &&
          Tmp_win->frame_y < Scr.MyDisplayHeight)
       )
     )
    {
      OnThisPage  =  True;
    }

  switch (Event.xproperty.atom)
    {
    case XA_WM_TRANSIENT_FOR:
      {
        if(XGetTransientForHint(dpy, Tmp_win->w, &Tmp_win->transientfor))
        {
           Tmp_win->flags |= TRANSIENT;
           RaiseWindow(Tmp_win);
        }
        else
        {
           Tmp_win->flags &= ~TRANSIENT;
        }
      }
      break;

    case XA_WM_NAME:
      if (!XGetWMName(dpy, Tmp_win->w, &text_prop))
	return;

      free_window_names (Tmp_win, True, False);

      Tmp_win->name = (char *)text_prop.value;
      if (Tmp_win->name && strlen(Tmp_win->name) > 200)
	/* limit to prevent hanging X server */
	Tmp_win->name[200] = 0;

      if (Tmp_win->name == NULL)
        Tmp_win->name = NoName;
      BroadcastName(M_WINDOW_NAME,Tmp_win->w,Tmp_win->frame,
		    (unsigned long)Tmp_win,Tmp_win->name);

      /* fix the name in the title bar */
      if(!(Tmp_win->flags & ICONIFIED))
	SetTitleBar(Tmp_win,(Scr.Hilite==Tmp_win),True);

      /*
       * if the icon name is NoName, set the name of the icon to be
       * the same as the window
       */
      if (Tmp_win->icon_name == NoName)
	{
	  Tmp_win->icon_name = Tmp_win->name;
	  BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame,
			(unsigned long)Tmp_win,Tmp_win->icon_name);
	  RedoIconName(Tmp_win);
	}
      break;

    case XA_WM_ICON_NAME:
      if (!XGetWMIconName (dpy, Tmp_win->w, &text_prop))
	return;
      free_window_names (Tmp_win, False, True);
      Tmp_win->icon_name = (char *) text_prop.value;
      if (Tmp_win->icon_name && strlen(Tmp_win->icon_name) > 200)
	/* limit to prevent hanging X server */
	Tmp_win->icon_name[200] = 0;
      if (Tmp_win->icon_name == NULL)
        Tmp_win->icon_name = NoName;
      BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame,
		    (unsigned long)Tmp_win,Tmp_win->icon_name);
      RedoIconName(Tmp_win);
      break;

    case XA_WM_HINTS:
      if (Tmp_win->wmhints)
	XFree ((char *) Tmp_win->wmhints);
      Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window);

      if(Tmp_win->wmhints == NULL)
	return;

      if((Tmp_win->wmhints->flags & IconPixmapHint)||
	 (Tmp_win->wmhints->flags & IconWindowHint))
	if(Tmp_win->icon_bitmap_file == Scr.DefaultIcon)
	  Tmp_win->icon_bitmap_file = (char *)0;

      if((Tmp_win->wmhints->flags & IconPixmapHint)||
         (Tmp_win->wmhints->flags & IconWindowHint))
	{
	  if (!(Tmp_win->flags & SUPPRESSICON))
	    {
              if (Tmp_win->icon_w)
                XDestroyWindow(dpy,Tmp_win->icon_w);
	      XDeleteContext(dpy, Tmp_win->icon_w, FvwmContext);
	      if(Tmp_win->flags & ICON_OURS)
		{
		  if(Tmp_win->icon_pixmap_w != None)
		    {
		      XDestroyWindow(dpy,Tmp_win->icon_pixmap_w);
		      XDeleteContext(dpy, Tmp_win->icon_pixmap_w, FvwmContext);
		    }
		}
	      else
		XUnmapWindow(dpy,Tmp_win->icon_pixmap_w);
	    }
          Tmp_win->icon_w = None;
          Tmp_win->icon_pixmap_w = None;
	  Tmp_win->iconPixmap = (Window)NULL;
	  if(Tmp_win->flags & ICONIFIED)
	    {
	      Tmp_win->flags &= ~ICONIFIED;
	      Tmp_win->flags &= ~ICON_UNMAPPED;
	      CreateIconWindow(Tmp_win,
			       Tmp_win->icon_x_loc,Tmp_win->icon_y_loc);
	      BroadcastPacket(M_ICONIFY, 7,
                              Tmp_win->w, Tmp_win->frame,
                              (unsigned long)Tmp_win,
                              Tmp_win->icon_x_loc, Tmp_win->icon_y_loc,
                              Tmp_win->icon_w_width, Tmp_win->icon_w_height);
	      BroadcastConfig(M_CONFIGURE_WINDOW, Tmp_win);

	      if (!(Tmp_win->flags & SUPPRESSICON))
		{
		  LowerWindow(Tmp_win);
		  AutoPlace(Tmp_win);
		  if(Tmp_win->Desk == Scr.CurrentDesk)
		    {
                      if(Tmp_win->icon_w)
                        XMapWindow(dpy, Tmp_win->icon_w);
		      if(Tmp_win->icon_pixmap_w != None)
			XMapWindow(dpy, Tmp_win->icon_pixmap_w);
		    }
		}
	      Tmp_win->flags |= ICONIFIED;
	      DrawIconWindow(Tmp_win);
	    }
	}
      break;

    case XA_WM_NORMAL_HINTS:
      GetWindowSizeHints (Tmp_win);
#if 0
      /*
      ** ckh - not sure why this next stuff was here, but fvwm 1.xx
      ** didn't do this, and it seems to cause a bug when changing
      ** fonts in XTerm
      */
      {
	int new_width, new_height;
	new_width = Tmp_win->frame_width;
	new_height = Tmp_win->frame_height;
	ConstrainSize(Tmp_win, &new_width, &new_height, False, 0, 0);
	if((new_width != Tmp_win->frame_width)||
	   (new_height != Tmp_win->frame_height))
	  SetupFrame(Tmp_win,Tmp_win->frame_x, Tmp_win->frame_y,
		     new_width,new_height,False);
      }
#endif /* 0 */
      BroadcastConfig(M_CONFIGURE_WINDOW,Tmp_win);
      break;

    default:
      if(Event.xproperty.atom == _XA_WM_PROTOCOLS)
	FetchWmProtocols (Tmp_win);
      else if (Event.xproperty.atom == _XA_WM_COLORMAP_WINDOWS)
	{
	  FetchWmColormapWindows (Tmp_win);	/* frees old data */
	  ReInstallActiveColormap();
	}
      else if(Event.xproperty.atom == _XA_WM_STATE)
	{
	  if((Tmp_win != NULL)&&(Tmp_win->flags & ClickToFocus)
	     &&(Tmp_win == Scr.Focus))
	    {
              if (OnThisPage)
              {
	        Scr.Focus = NULL;
	        SetFocus(Tmp_win->w,Tmp_win,0);
              }
	    }
	}
      break;
    }
}
示例#13
0
/***********************************************************************
 *
 *  Procedure:
 *	HandleConfigureRequest - ConfigureRequest event handler
 *
 ************************************************************************/
void HandleConfigureRequest()
{
  XWindowChanges xwc;
  unsigned long xwcm;
  int x, y, width, height;
  XConfigureRequestEvent *cre = &Event.xconfigurerequest;
  Bool sendEvent=False;
  FvwmWindow  *FvwmSib;

  DBUG("HandleConfigureRequest","Routine Entered");

  /*
   * Event.xany.window is Event.xconfigurerequest.parent, so Tmp_win will
   * be wrong
   */
  Event.xany.window = cre->window;	/* mash parent field */
  if (XFindContext (dpy, cre->window, FvwmContext, (caddr_t *) &Tmp_win) ==
      XCNOENT)
    Tmp_win = NULL;

  /*
   * According to the July 27, 1988 ICCCM draft, we should ignore size and
   * position fields in the WM_NORMAL_HINTS property when we map a window.
   * Instead, we'll read the current geometry.  Therefore, we should respond
   * to configuration requests for windows which have never been mapped.
   */
  if (!Tmp_win || cre->window == Tmp_win->icon_w ||
      cre->window == Tmp_win->icon_pixmap_w)
  {

    xwcm = cre->value_mask &
      (CWX | CWY | CWWidth | CWHeight | CWBorderWidth);
    xwc.x = cre->x;
    xwc.y = cre->y;
    if((Tmp_win)&&((Tmp_win->icon_pixmap_w == cre->window)))
    {
      Tmp_win->icon_p_height = cre->height+ cre->border_width +
	cre->border_width;
    }
    else if((Tmp_win)&&((Tmp_win->icon_w == cre->window)))
    {
      Tmp_win->icon_xl_loc = cre->x;
      Tmp_win->icon_x_loc = cre->x +
        (Tmp_win->icon_w_width - Tmp_win->icon_p_width)/2;
      Tmp_win->icon_y_loc = cre->y - Tmp_win->icon_p_height;
      if(!(Tmp_win->flags & ICON_UNMAPPED))
        BroadcastPacket(M_ICON_LOCATION, 7,
                        Tmp_win->w, Tmp_win->frame,
                        (unsigned long)Tmp_win,
                        Tmp_win->icon_x_loc, Tmp_win->icon_y_loc,
                        Tmp_win->icon_w_width,
                        Tmp_win->icon_w_height + Tmp_win->icon_p_height);
    }
    xwc.width = cre->width;
    xwc.height = cre->height;
    xwc.border_width = cre->border_width;

    XConfigureWindow(dpy, Event.xany.window, xwcm, &xwc);

    if(Tmp_win)
    {
      if (cre->window != Tmp_win->icon_pixmap_w &&
	  Tmp_win->icon_pixmap_w != None)
      {
	xwc.x = Tmp_win->icon_x_loc;
	xwc.y = Tmp_win->icon_y_loc - Tmp_win->icon_p_height;
	xwcm = cre->value_mask & (CWX | CWY);
	XConfigureWindow(dpy, Tmp_win->icon_pixmap_w, xwcm, &xwc);
      }
      if(Tmp_win->icon_w != None)
      {
	xwc.x = Tmp_win->icon_x_loc;
	xwc.y = Tmp_win->icon_y_loc;
	xwcm = cre->value_mask & (CWX | CWY);
        XConfigureWindow(dpy, Tmp_win->icon_w, xwcm, &xwc);
      }
    }
    return;
  }

  /*  Stacking order change requested...  */
  if (cre->value_mask & CWStackMode)
  {
    FvwmWindow *otherwin;

    otherwin  =  NULL;
    xwc.sibling = (((cre->value_mask & CWSibling) &&
                    (XFindContext (dpy, cre->above, FvwmContext,
                                   (caddr_t *) &otherwin) == XCSUCCESS))
                   ? otherwin->frame : cre->above);
    xwc.stack_mode = cre->detail;
    XConfigureWindow (dpy, Tmp_win->frame,
                      cre->value_mask & (CWSibling | CWStackMode), &xwc);
    sendEvent = True;

    /*
        RBW - Update the stacking order ring.
    */
    if (xwc.stack_mode == Above || xwc.stack_mode == Below)
      {
        FvwmSib = (otherwin != NULL ) ? otherwin: Scr.FvwmRoot.stack_next;  /*  Set up for Above.  */
        if (xwc.stack_mode == Below)
	  {
            /*
                If Below-sibling, raise above next lower window. If no sibling,
                bottom of stack is "above" Scr.FvwmRoot in the ring.
            */
            FvwmSib = (FvwmSib == otherwin) ? FvwmSib->stack_next: FvwmSib->stack_prev;
	  }
        if (Tmp_win != FvwmSib)                            /* Don't chain it to itself!  */
          {
            Tmp_win->stack_prev->stack_next = Tmp_win->stack_next;  /* Pluck from chain.   */
            Tmp_win->stack_next->stack_prev = Tmp_win->stack_prev;
            Tmp_win->stack_next = FvwmSib;                          /* Set new pointers.   */
            Tmp_win->stack_prev = FvwmSib->stack_prev;
            FvwmSib->stack_prev->stack_next = Tmp_win;              /* Re-insert above sibling. */
            FvwmSib->stack_prev = Tmp_win;
          }
      }
    else
      {
        /*
            Oh, bother! We have to rebuild the stacking order ring to figure
            out where this one went (TopIf, BottomIf, or Opposite).
        */
        ResyncFvwmStackRing();
      }
  }

#ifdef SHAPE
  if (ShapesSupported)
  {
    int xws, yws, xbs, ybs;
    unsigned wws, hws, wbs, hbs;
    int boundingShaped, clipShaped;

    XShapeQueryExtents (dpy, Tmp_win->w,&boundingShaped, &xws, &yws, &wws,
			&hws,&clipShaped, &xbs, &ybs, &wbs, &hbs);
    Tmp_win->wShaped = boundingShaped;
  }
#endif /* SHAPE */

  /* Don't modify frame_XXX fields before calling SetupWindow! */
  x = Tmp_win->frame_x;
  y = Tmp_win->frame_y;
  width = Tmp_win->frame_width;
  height = Tmp_win->frame_height;

  /* for restoring */
  if (cre->value_mask & CWBorderWidth)
  {
    Tmp_win->old_bw = cre->border_width;
  }
  /* override even if border change */

  if (cre->value_mask & CWX)
    x = cre->x - Tmp_win->boundary_width - Tmp_win->bw;
  if (cre->value_mask & CWY)
    y = cre->y - Tmp_win->boundary_width - Tmp_win->title_height - Tmp_win->bw;
  if (cre->value_mask & CWWidth)
    width = cre->width + 2*Tmp_win->boundary_width;
  if (cre->value_mask & CWHeight)
    height = cre->height+Tmp_win->title_height+2*Tmp_win->boundary_width;

  /*
   * SetupWindow (x,y) are the location of the upper-left outer corner and
   * are passed directly to XMoveResizeWindow (frame).  The (width,height)
   * are the inner size of the frame.  The inner width is the same as the
   * requested client window width; the inner height is the same as the
   * requested client window height plus any title bar slop.
   */
  ConstrainSize(Tmp_win, &width, &height, False, 0, 0);
  SetupFrame (Tmp_win, x, y, width, height,sendEvent);
  KeepOnTop();
}
示例#14
0
void PlotDrmCorr()
{
  gROOT->LoadMacro("$LOCAL/include/TUntilsOpHisto.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsAliFigs.h");
  gROOT->LoadMacro("$LOCAL/include/TUntilsPlotStd.h"); SetStyle();

 const TString sJetTag = "120<#it{p}_{T,jet}<150 GeV/#it{c}";
//=============================================================================

  TFile *file = TFile::Open("data/mass/AnalysisOutputs_Dsm_py8_JetR05_SjeR01.root", "READ");
  TH2D *h5py8 = (TH2D*)file->Get("hDfrDdm120"); h5py8->SetName("h5py8"); h5py8->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_Dsm_qpy_JetR05_SjeR01.root", "READ");
  TH2D *h5qpy = (TH2D*)file->Get("hDfrDdm120"); h5qpy->SetName("h5qpy"); h5qpy->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_Dsm_med_JetR05_SjeR01.root", "READ");
  TH2D *h5med = (TH2D*)file->Get("hDfrDdm120"); h5med->SetName("h5med"); h5med->SetDirectory(0);
  file->Close();


  file = TFile::Open("data/mass/AnalysisOutputs_Dsm_py8_JetR04_SjeR01.root", "READ");
  TH2D *h4py8 = (TH2D*)file->Get("hDfrDdm120"); h4py8->SetName("h4py8"); h4py8->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_Dsm_qpy_JetR04_SjeR01.root", "READ");
  TH2D *h4qpy = (TH2D*)file->Get("hDfrDdm120"); h4qpy->SetName("h4qpy"); h4qpy->SetDirectory(0);
  file->Close();

  file = TFile::Open("data/mass/AnalysisOutputs_Dsm_med_JetR04_SjeR01.root", "READ");
  TH2D *h4med = (TH2D*)file->Get("hDfrDdm120"); h4med->SetName("h4med"); h4med->SetDirectory(0);
  file->Close();
//=============================================================================

  const Double_t dBin[] = { 0., 0.1, 0.3, 0.5, 0.8, 1.2 };
  const Int_t nBin = sizeof(dBin) / sizeof(Double_t) -1;

  h5py8->RebinX(50); h4py8->RebinX(50);
  h5qpy->RebinX(50); h4qpy->RebinX(50);
  h5med->RebinX(50); h4med->RebinX(50);

  TH1D *h5py8M = SetRMS(h5py8,"h5py8M"); TH1D *h4py8M = SetRMS(h4py8,"h4py8M");
  TH1D *h5qpyM = SetRMS(h5qpy,"h5qpyM"); TH1D *h4qpyM = SetRMS(h4qpy,"h4qpyM");
  TH1D *h5medM = SetRMS(h5med,"h5medM"); TH1D *h4medM = SetRMS(h4med,"h4medM");

  TGraph *g5py8 = new TGraph(h5py8M); TGraph *g4py8 = new TGraph(h4py8M);
  TGraph *g5qpy = new TGraph(h5qpyM); TGraph *g4qpy = new TGraph(h4qpyM);
  TGraph *g5med = new TGraph(h5medM); TGraph *g4med = new TGraph(h4medM);
//=============================================================================

  TH1F    *hfm = 0;
  TCanvas *can = 0;
  TLegend *leg = 0;
  TLatex  *tex = 0;
  TLine  *line = 0;

  const Float_t dflx = 0.2, dfux = 1.;
  const Float_t dfly = 2., dfuy = 15.;

  const Float_t dlsx = 0.05, dlsy = 0.05;
  const Float_t dtsx = 0.06, dtsy = 0.06;
  const Float_t dtox = 1.10, dtoy = 1.00;

  const TString stnx = "#it{R}(sj^{1st},sj^{2nd})";
  const TString stny = "#sigma(m_{jet}-m_{sj}) (GeV/#it{c}^{2})";

  TH1D *hSE = new TH1D("hSE", "", 10., 0., 10.);
  hSE->SetLineWidth(2);
  hSE->SetLineColor(wcl[0]);
  hSE->SetMarkerStyle(wmk[0]);
  hSE->SetMarkerColor(wcl[0]);

  TH1D *hME = new TH1D("hME", "", 10., 0., 10.);
  hME->SetLineWidth(2);
  hME->SetLineColor(wcl[0]);
  hME->SetMarkerStyle(wmk[2]);
  hME->SetMarkerColor(wcl[0]);
//=============================================================================

  can = MakeCanvas("Jet5py8DrmRMS"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(dflx, dfly, dfux, dfuy); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawGraph(g5py8, wcl[3], "C");
  DrawGraph(g5qpy, wcl[1], "C");
  DrawGraph(g5med, wcl[5], "C");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(g5py8, "PYTHIA 8", "L")->SetTextSizePixels(24);
  leg->AddEntry(g5qpy, "Q-PYTHIA", "L")->SetTextSizePixels(24);
  leg->AddEntry(g5med, "JEWEL+PYTHIA", "L")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet #it{R}=0.5, anti-#it{k}_{T}, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.84, sJetTag.Data());
  CanvasEnd(can);
//=============================================================================

  can = MakeCanvas("Jet4py8DrmRMS"); can->SetGridx(); can->SetGridy();
  hfm = can->DrawFrame(dflx, dfly, dfux, dfuy); SetupFrame(hfm, dlsx, dlsy, dtsx, dtsy, dtox, dtoy, stnx, stny);
  hfm->GetXaxis()->SetNdivisions(510);
  hfm->GetYaxis()->SetNdivisions(510);

  DrawGraph(g4py8, wcl[3], "C");
  DrawGraph(g4qpy, wcl[1], "C");
  DrawGraph(g4med, wcl[5], "C");

  leg = new TLegend(0.62, 0.64, 0.98, 0.88); SetupLegend(leg);
  leg->AddEntry(g4py8, "PYTHIA 8", "L")->SetTextSizePixels(24);
  leg->AddEntry(g4qpy, "Q-PYTHIA", "L")->SetTextSizePixels(24);
  leg->AddEntry(g4med, "JEWEL+PYTHIA", "L")->SetTextSizePixels(24);
  leg->Draw();

  tex = new TLatex();
  tex->SetNDC();
  tex->SetTextSizePixels(24);
  tex->DrawLatex(0.16, 0.92, "2.76 TeV, Jet #it{R}=0.4, anti-#it{k}_{T}, |#eta_{jet}|<1");
  tex->DrawLatex(0.16, 0.84, sJetTag.Data());
  CanvasEnd(can);
//=============================================================================



  return;
}