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


C++ TPad::SetLogx方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
      }
    }
    
    {
        cout<<"Our first bin is "<<AllPlots["UpQuarkPair"]->GetBinContent(1)<<endl;
    }
    
  
    cout << "test 2" << endl;

    AllPlots["Quark Quark And AntiQuark AntiQuark"]->Add(AllPlots["TwoAntiQuarks"]);
    cout << "test 2.1" << endl;
    AllPlots["Quark Quark And AntiQuark AntiQuark"] ->Add(AllPlots["TwoQuarks"]);
    TH1D* AllQuarksNorm = (TH1D*) AllPlots["QuarkAntiQuarkPair"]->Clone("Devisor");
    AllQuarksNorm->Scale(1 / AllQuarksNorm->Integral());
    for (int i = 0; i < 5; i++) {
      string NewName = "Ratio" + NamesOfPlots[i];
      RatioPlots[NewName] = (TH1D*) AllPlots[NamesOfPlots[i]]->Clone(NewName.c_str());
      RatioPlots[NewName]->Scale(1 / RatioPlots[NewName]->Integral());
      RatioPlots[NewName]->Divide(AllQuarksNorm);
    }
    cout << "test 3" << endl;

    for (size_t i = 0; i < AllPlots.size(); i++) {
      for (size_t j = 1; j <= nphistar; j++) {
        AllPlots[NamesOfPlots[i]]->SetBinContent(j, AllPlots[NamesOfPlots[i]]->GetBinContent(j) / (phistarBins[j] - phistarBins[j - 1]));
      }
    }
    cout << "test 4" << endl;
    for (size_t i = 0; i < NamesOfPlots.size(); i++) {

      TCanvas canvas("canvas", "canvas", 1000, 1000);
      canvas.cd();
      canvas.SetLogx();
      canvas.SetLogy();
      gStyle->SetCanvasColor(0);
      gStyle->SetStatBorderSize(1);
      gStyle->SetOptStat("");
      gStyle->SetOptFit();
      AllPlots[NamesOfPlots[i]]->GetXaxis()->SetRangeUser(.004, 10);
      AllPlots[NamesOfPlots[i]]->Draw();
      AllPlots[NamesOfPlots[i]]->SetLineWidth(2);

      string SaveName = NamesOfPlots[i];
      SaveName = 0 == w ? "Mom_" + SaveName : "PenUltimate_" + SaveName;
      string WithType = "PhiStarPlots/Mompng/" + SaveName + ".png";
      canvas.Print(WithType.c_str());
      WithType = "PhiStarPlots/MomPDF/" + SaveName + ".pdf";
      canvas.Print(WithType.c_str());
      WithType = "PhiStarPlots/MomC/" + SaveName + ".C";
      canvas.Print(WithType.c_str());



      //if (i == 8)canvas.Print("Broken.png");
    }
    cout << "test 5" << endl;

    TCanvas canvas("c2", "c2", 1000, 1000);
    canvas.cd();
    canvas.SetLogx();
    canvas.SetLogy();
    gStyle->SetCanvasColor(0);
    gStyle->SetStatBorderSize(1);
    gStyle->SetOptStat("");
开发者ID:optimisticcynic,项目名称:ZFinder,代码行数:66,代码来源:MomPDFPlots.cpp

示例2: QA_Draw_CEMC_G4Hit


//.........这里部分代码省略.........
  {
    TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection =
        (TH2F *) qa_file_new->GetObjectChecked(
            "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F");
    assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection);

    TH1D *proj_new =
        h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY(
            "qa_file_new_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py");

    proj_new->Scale(1. / proj_new->GetSum());

    TH1D *proj_ref = NULL;
    if (qa_file_ref)
    {
      TH2F *h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection =
          (TH2F *) qa_file_ref->GetObjectChecked(
              "h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection", "TH2F");
      assert(h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection);

      proj_ref = h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection->ProjectionY(
          "qa_file_ref_h_QAG4Sim_CEMC_G4Hit_LateralTruthProjection_py");
      proj_ref->Scale(1. / proj_ref->GetSum());
    }

    proj_new->GetYaxis()->SetTitle("Normalized energy distribution");
    proj_new->GetXaxis()->SetRangeUser(-10, 10);

    DrawReference(proj_new, proj_ref);
  }

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  p->SetLogx();
  p->SetLogy();

  {
    TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
        "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F");
    assert(h_new);

    h_new->Rebin(5);
    h_new->Scale(1. / h_new->GetSum());

    TH1F *h_ref = NULL;
    if (qa_file_ref)
    {
      h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
          "h_QAG4Sim_CEMC_G4Hit_HitTime", "TH1F");
      assert(h_ref);

      h_ref->Rebin(5);
      h_ref->Scale(1. / h_ref->GetSum());
    }

    h_new->GetYaxis()->SetTitleOffset(1.5);
    h_new->GetYaxis()->SetTitle("Normalized energy per bin");
    //      h_new->GetXaxis()->SetRangeUser(-0, .1);

    DrawReference(h_new, h_ref);
  }

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  //    p->SetLogx();
  p->SetLogy();
开发者ID:sPHENIX-Collaboration,项目名称:macros,代码行数:67,代码来源:QA_Draw_CEMC_G4Hit.C

示例3: FastVsSlowSimRes

void FastVsSlowSimRes() {

  Int_t plusTPC =0;

  gROOT->LoadMacro("~/fig_template.C"); // figure style
  myOptions(0);
  gROOT->ForceStyle();

  TCanvas *myCan = new TCanvas("myCan");
  myCan->Draw();
  myCan->cd();
  
  TPad *myPad = new TPad("myPad", "The pad",0,0,1,1);
  myPadSetUp(myPad,0.15,0.04,0.04,0.15);
  myPad->Draw();   myPad->cd();
  myPad->SetGridx();   myPad->SetGridy();  myPad->SetLogx(); 

  //  TLegend *leg = new TLegend(0.7,160,20,290,"","brCDN"); 
  TLegend *leg = new TLegend(0.44,160,1.7,290,"","brCDN"); 
 
  leg->SetFillColor(0);

  
  // Current ITS +++++++++++++++++++++++++++++++++++++++++

  DetectorK its("ALICE","ITS");
  its.MakeAliceCurrent(0,plusTPC);
  its.SetMaxRadiusOfSlowDetectors(0.1);
  its.SolveViaBilloir(0);
  Int_t color=1; Int_t linewidth=2;

  TGraph *c[6];
  TGraph *d[6];

  Int_t pi =0;
  d[pi] = its.GetGraphPointingResolution(1,color,linewidth);
  d[pi]->SetLineStyle(2);
  //  d[pi]->GetYaxis()->SetTitle("Pointing resolution #sigma [#mum]");
  //  d[pi]->SetTitle("Pointing resolution .vs. Pt");
  //  d[pi]->Draw("AC");
  
  c[pi] = its.GetGraphPointingResolution(0,color,linewidth);
  c[pi]->SetMinimum(-1);
  c[pi]->Draw("AC");

  leg->AddEntry(c[pi],"FastTool:  Current ITS","l");
  //  leg->AddEntry(d[pi],"in z  - Current ITS","l");

 

 
  // Current ITS +++++++++++++++++++++++++++++++++++++++++

  Int_t color=3; Int_t linewidth=2;
  Int_t pi =2;

  DetectorK its("ALICE","ITS");
  its.MakeAliceCurrent(0,plusTPC);
  
  its.SetRadius("bpipe",2.0);
  its.AddLayer("spd0", 2.2,1,1,1);  

  its.SetRadius("spd0",2.2); its.SetRadiationLength("spd0",X0); its.SetResolution("spd0",resRPhi,resZ);
  its.SetRadius("spd1",4.8);   its.SetRadiationLength("spd1",X0); its.SetResolution("spd1",resRPhi,resZ);
  its.SetRadius("spd2",9.1);   its.SetRadiationLength("spd2",X0); its.SetResolution("spd2",resRPhi,resZ);

  its.SetMaxRadiusOfSlowDetectors(0.1);
  its.SolveViaBilloir(0);

  d[pi] = its.GetGraphPointingResolution(1,color,linewidth);
  d[pi]->SetLineStyle(2);
  //  d[pi]->Draw("C");

  c[pi] = its.GetGraphPointingResolution(0,color,linewidth);
  c[pi]->Draw("C");

  leg->AddEntry(c[pi],"FastTool: \"New SPDs\"","l");
  //  leg->AddEntry(d[pi],"in z  - \"New SPDs\"","l");



  // ALL NEW +++++++++++++++++++++++++++++++++++++++++++

  color=2; Int_t linewidth=2;
  Int_t pi =1; 


  // for a 0.8,0.2 weight configuration
  
  DetectorK *itsU = new DetectorK((char*)"ALICE",(char*)"ITS");
  
  itsU->AddLayer((char*)"bpipe", 2.0,0.0022); // beam pipe
  itsU->AddLayer((char*)"vertex",  0,     0); // dummy vertex for matrix calculation
  
  itsU->AddLayer("ddd1",  2.2 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd2",  3.8 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd3",  6.8 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd4", 12.4 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd5", 23.5 ,  X0, resRPhi, resZ); 
  itsU->AddLayer("ddd6", 39.6 ,  X0, resRPhi, resZ); 
//.........这里部分代码省略.........
开发者ID:alisw,项目名称:AliRoot,代码行数:101,代码来源:FastVsSlowSim.C

示例4: compareInDir


//.........这里部分代码省略.........
      pH = new TPad("head","head", 0, 0.93, 1, 1);
      pH->Draw();
      pH->cd();
      pt = new TPaveText(0,0,1,1); pt->SetFillColor(0);
      pt->AddText(dirName.c_str());
      pt->Draw();
      cv->cd();
      pD = new TPad("dis","dis", 0, 0.0, 1, 0.93);
      pD->Draw();
      pD->cd();
    }
    
    pD->Clear();
    pD->cd();
    std::cout<<"Save : "<<dirName.c_str()<<"/"<<h1->GetName()<<std::endl;

    if (! isH2){
      h1->SetLineWidth(2);
      h1->SetLineColor(1);
      h1->SetMarkerColor(1);
      h2->SetLineColor(2);
      h2->SetMarkerColor(2);
      //      if (h1->GetNbinsX() > 25) h1 = h1->Rebin();
 //     if (h2->GetNbinsX() > 25) h2 = h2->Rebin();
      //      if (h1->GetNbinsX() > 50) h1 = h1->Rebin(5);
      //      if (h2->GetNbinsX() > 50) h2 = h2->Rebin(5);
      double max1 = h1->GetMaximum();
      double max2 = h2->GetMaximum();
      double min1 = h1->GetMinimum();
      double min2 = h2->GetMinimum();
      if (max2> max1) h1->SetMaximum(max2+0.15*fabs(max2));
      if (min2 < min1) h1->SetMinimum(min2-0.15*fabs(min2));
      //      pD->SetLogy();
      if ((logmod&1)) pD->SetLogx();
      if ((logmod&2)) pD->SetLogy();
      h1->Draw();
      h2->Draw("sames");   

      if (std::string(h1->GetName())==std::string("reconstruction_step_module_total")
	  || std::string(h1->GetName())==std::string("validation_step_module_total")){
	TPaveText ksPt(0,0, 0.35, 0.04, "NDC"); ksPt.SetBorderSize(0); ksPt.SetFillColor(0);
	ksPt.AddText(Form("P(KS)=%g, diffBins=%g, eblk %g ered %g",ksProb, bDiff, h1->GetEntries(), h2->GetEntries()));
	//	ksPt.AddText(h1->GetName());
	ksPt.Draw();
	cv->Print("diff.ps");

	int nX = h1->GetNbinsX();
	TAxis* h1Ax = h1->GetXaxis();
	int nRanges = nX/20 + 1;
	double h1Int = h1->Integral();
	float curBMargin = pD->GetBottomMargin(); 
	pD->SetBottomMargin(0.3);
	for (int iR = 0; iR < nRanges; iR++){
	  h1Ax->SetRange(iR*20+1, iR*20+20);
	  double bDiffL = 0;
	  double max1L = -1;
	  double max2L = -1;
	  double min1L = h1->GetMaximum();
	  double min2L = h2->GetMaximum();
	  for (int iBL = iR*20+1; iBL<= iR*20+20; ++iBL){
	    double h1L = h1->GetBinContent(iBL);
	    double h2L = h2->GetBinContent(iBL);
	    bDiffL += std::abs(h1L-h2L);
	    if (max1L < h1L) max1L = h1L;
	    if (max2L < h2L) max2L = h2L;
	    if (min1L > h1L) min1L = h1L;
开发者ID:HuguesBrun,项目名称:cms-bot,代码行数:67,代码来源:compareValHists.C

示例5: EMCDistribution_PeakSample_Fast

void EMCDistribution_PeakSample_Fast(bool full_gain = false)
{
  const TString gain = "RAW";

  TString hname = "EMCDistribution_" + gain + TString(full_gain ? "_FullGain" : "") + cuts;

  TH2 *h2 = NULL;
  {
    if (full_gain)
    {
      h2 = new TH2F(hname,
                    Form(";Calibrated Tower Energy Sum (ADC);Count / bin"), 100,
                    .05 * 100, 25 * 100, 64, -.5, 63.5);
      QAHistManagerDef::useLogBins(h2->GetXaxis());
    }
    else
    {
      h2 = new TH2F(hname,
                    Form(";Calibrated Tower Energy Sum (ADC);Count / bin"), 260,
                    -.2 * 100, 5 * 100, 64, -.5, 63.5);
    }
    T->Draw(
        "TOWER_" + gain + "_CEMC[].get_bineta() + 8* TOWER_" + gain + "_CEMC[].get_binphi():(TOWER_RAW_CEMC[].signal_samples[10] - TOWER_RAW_CEMC[].signal_samples[0])*(-1)>>" + hname, "", "goff");
  }

  TText *t;
  TCanvas *c1 = new TCanvas(
      "EMCDistribution_PeakSample_Fast_" + TString(full_gain ? "_FullGain" : "") + cuts,
      "EMCDistribution_PeakSample_Fast_" + TString(full_gain ? "_FullGain" : "") + cuts, 1800, 950);
  c1->Divide(8, 8, 0., 0.01);
  int idx = 1;
  TPad *p;

  for (int iphi = 8 - 1; iphi >= 0; iphi--)
  {
    for (int ieta = 0; ieta < 8; ieta++)
    {
      p = (TPad *) c1->cd(idx++);
      c1->Update();

      p->SetLogy();
      if (full_gain)
      {
        p->SetLogx();
      }
      p->SetGridx(0);
      p->SetGridy(0);

      TString hname = Form("hEnergy_ieta%d_iphi%d", ieta, iphi) + TString(full_gain ? "_FullGain" : "");

      TH1 *h = h2->ProjectionX(hname, ieta + 8 * iphi + 1,
                               ieta + 8 * iphi + 1);  // axis bin number is encoded as ieta+8*iphi+1

      h->SetLineWidth(0);
      h->SetLineColor(kBlue + 3);
      h->SetFillColor(kBlue + 3);

      h->GetXaxis()->SetTitleSize(.09);
      h->GetXaxis()->SetLabelSize(.08);
      h->GetYaxis()->SetLabelSize(.08);

      h->Draw();

      if (full_gain)
        h->Fit("x*gaus", "M");
      else
        h->Fit("landau", "M");

      double peak = -1;

      TF1 *fit = ((TF1 *) (h->GetListOfFunctions()->At(0)));
      if (fit)
      {
        fit->SetLineColor(kRed);
        peak = fit->GetParameter(1);
      }

      cout << Form("Finished <Col%d Row%d> = %.1f", ieta, iphi, peak)
           << endl;

      TText *t = new TText(.9, .9,
                           Form("<Col%d Row%d> = %.1f", ieta, iphi, peak));
      t->SetTextAlign(33);
      t->SetTextSize(.15);
      t->SetNDC();
      t->Draw();
    }
  }

  SaveCanvas(c1,
             TString(_file0->GetName()) + TString("_DrawPrototype3EMCalTower_") + TString(c1->GetName()), false);
}
开发者ID:sPHENIX-Collaboration,项目名称:analysis,代码行数:92,代码来源:DrawPrototype3EMCalTower.C

示例6: QA_Draw_Jet_Spectrum


//.........这里部分代码省略.........
  p = (TPad *) c1->cd(idx++);
  c1->Update();
  p->SetLogy();

  {
    TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
        TString(jet) + TString("_Leading_Mass"), "TH1F");
    assert(h_new);

    h_new->Rebin(2);
    h_new->Sumw2();
    h_new->Scale(1. / Nevent_new);

    TH1F *h_ref = NULL;
    if (qa_file_ref)
    {
      h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
          TString(jet) + TString("_Leading_Mass"), "TH1F");
      assert(h_ref);

      h_ref->Rebin(2);
      h_ref->Scale(1. / Nevent_ref);
    }

    h_new->GetYaxis()->SetTitleOffset(1.5);
    h_new->GetYaxis()->SetTitle("Count / event / bin");
    //      h_new->GetXaxis()->SetRangeUser(-0, .1);

    DrawReference(h_new, h_ref);
  }

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  p->SetLogx();

  {
    TH1F *h_new = (TH1F *) qa_file_new->GetObjectChecked(
        TString(jet) + TString("_Leading_CompSize"), "TH1F");
    assert(h_new);

    h_new->Rebin(2);
    h_new->Sumw2();
    h_new->Scale(1. / Nevent_new);

    TH1F *h_ref = NULL;
    if (qa_file_ref)
    {
      h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
          TString(jet) + TString("_Leading_CompSize"), "TH1F");
      assert(h_ref);

      h_ref->Rebin(2);
      h_ref->Scale(1. / Nevent_ref);
    }

    h_new->GetYaxis()->SetTitleOffset(1.5);
    h_new->GetYaxis()->SetTitle("Count / event / bin");
    //      h_new->GetXaxis()->SetRangeUser(-0, .1);

    DrawReference(h_new, h_ref);
  }

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  p->SetLogy();
开发者ID:sPHENIX-Collaboration,项目名称:macros,代码行数:66,代码来源:QA_Draw_Jet_Spectrum.C

示例7: SetOKStyle

void
QA_Draw_HCALIN_TowerCluster(
    const char * qa_file_name_new =
        "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi-_eta0.30_32GeV-0000.root_qa.root",
    const char * qa_file_name_ref =
        "/phenix/u/jinhuang/links/ePHENIX_work/sPHENIX_work/production_analysis_updates/spacal1d/fieldmap/G4Hits_sPHENIX_pi+_eta0.30_32GeV-0000.root_qa.root")
{

  SetOKStyle();
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(1111);
  TVirtualFitter::SetDefaultFitter("Minuit2");

  TFile * qa_file_new = new TFile(qa_file_name_new);
  assert(qa_file_new->IsOpen());

  TFile * qa_file_ref = NULL;
  if (qa_file_name_ref)
    {
      qa_file_ref = new TFile(qa_file_name_ref);
      assert(qa_file_ref->IsOpen());
    }

  TCanvas *c1 = new TCanvas("QA_Draw_HCALIN_TowerCluster",
      "QA_Draw_HCALIN_TowerCluster", 1800, 900);
  c1->Divide(4, 2);
  int idx = 1;
  TPad * p;

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  p->SetLogx();
  p->SetLogy();

    {
      TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked(
          "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F");
      assert(h_new);

      h_new->Scale(1. / h_new->GetSum());

      TH1F * h_ref = NULL;
      if (qa_file_ref)
        {
          TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
              "h_QAG4Sim_HCALIN_Tower_1x1", "TH1F");
          assert(h_ref);

          h_ref->Scale(1. / h_ref->GetSum());
        }

      h_new->GetYaxis()->SetTitleOffset(1.5);
      h_new->GetYaxis()->SetTitle("Normalized tower count per bin");
//      h_new->GetXaxis()->SetRangeUser(-0, .1);

      DrawReference(h_new, h_ref);
    }

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  p->SetLogx();
  p->SetLogy();

    {
      TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked(
          "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F");
      assert(h_new);

      h_new->Scale(1. / h_new->GetSum());

      TH1F * h_ref = NULL;
      if (qa_file_ref)
        {
          TH1F * h_ref = (TH1F *) qa_file_ref->GetObjectChecked(
              "h_QAG4Sim_HCALIN_Tower_3x3", "TH1F");
          assert(h_ref);

          h_ref->Scale(1. / h_ref->GetSum());
        }

      h_new->GetYaxis()->SetTitleOffset(1.5);
      h_new->GetYaxis()->SetTitle("Normalized tower count per bin");
      //      h_new->GetXaxis()->SetRangeUser(-0, .1);

      DrawReference(h_new, h_ref);
    }

  p = (TPad *) c1->cd(idx++);
  c1->Update();
  //    p->SetLogx();
  p->SetLogy();

    {

      TH1F * h_new = (TH1F *) qa_file_new->GetObjectChecked(
          "h_QAG4Sim_HCALIN_Tower_1x1_max", "TH1F");
      assert(h_new);

      h_new->Rebin(40);
      h_new->Sumw2();
//.........这里部分代码省略.........
开发者ID:Chongk,项目名称:coresoftware,代码行数:101,代码来源:QA_Draw_HCALIN_TowerCluster.C

示例8: ATLASCMSCOMPARISON


//.........这里部分代码省略.........
  ATLASdata7  ->Draw("p e2 same");
  CMSdata7    ->Draw("p e2 same");
  leg0 ->Draw("same");
  privatworklabel->Draw("same");
  // b) log scale
  TH1F* dummy2=(TH1F*)dummy->Clone();
  dummy2->SetMinimum(0.00001);
  dummy2->SetMaximum(max*10);
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  plotCanvas_[plotCanvas_.size()-1]->SetLogy();
  // drawing
  dummy2->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg0 ->Draw("same");
  privatworklabel->Draw("same");
  // c) both data with bands
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  //DrawSteps(C, "e2 same");
  //C->Draw("e2 same");
  //DrawSteps(A, "e2 same");
  //A->Draw("e2 same");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  // new pad for log plot
  TPad *rPad = new TPad("rPad","",0.4,0.15,0.95,0.85);
  rPad->SetFillStyle(0);
  rPad->SetFillColor(0);
  rPad->SetBorderSize(0);
  rPad->SetBorderMode(0);
  rPad->SetLogy(0);
  rPad->SetLogx(0);
  rPad->SetTicky(1);
  rPad->Draw("");
  rPad->cd();
  // log plot curves
  rPad->SetLogy();
  dummy2->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg1->Draw("same");
  privatworklabel->Draw("same");
  // d) both data with ratio
  addCanvas(plotCanvas_);
  plotCanvas_[plotCanvas_.size()-1]->cd(0);
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity+" measurement comparison");
  // drawing
  dummy->Draw("axis");
  if(cmssim) CMSMadGraph7->Draw("p e1 same");
  //DrawSteps(C, "e2 same");
  //C->Draw("e2 same");
  //DrawSteps(A, "e2 same");
  //A->Draw("e2 same");
  CMSdata7    ->Draw("p e2 same");
  ATLASdata7  ->Draw("p e2 same");
  leg1 ->Draw("same");
  privatworklabel->Draw("same");
  std::vector<double> errA_;
  for(int bin=1; bin<=Nbins7; ++bin){
    errA_.push_back((ATLASdata7->GetY()[bin-1]/CMSdata7->GetY()[bin-1])*((ATLASdata7->GetErrorYhigh(bin-1)/ATLASdata7->GetY()[bin-1])));
  }
  std::vector<double> errC_;
  for(int bin=1; bin<=Nbins7; ++bin){
    errC_.push_back((CMSdata7->GetErrorYhigh(bin-1)/CMSdata7->GetY()[bin-1]));
  }
  if(cmssim){
    std::vector<double> errM_;
    for(int bin=1; bin<=Nbins7; ++bin){
      errM_.push_back(0.);
      //errM_.push_back((CMSMadGraph7->GetY()[bin-1]/CMSdata7->GetY()[bin-1])*((CMSMadGraph7->GetErrorYhigh(bin-1)/CMSMadGraph7->GetY()[bin-1])));
    }
    drawRatio(M, C, 0.5, 1.5,  myStyle, 0, errM_, "x", "CMS data", "hist ", kAzure+6, false, 0.7);
    drawRatio(C, C, 0.5, 1.5,  myStyle, 0, errC_, "x", "CMS data", "p e2 same"     , kBlue, true, 0.7);

  }
  else drawRatio(C, C, 0.5, 1.5,  myStyle, 0, errC_, "x", "CMS data", "p e2"     , kBlue, true, 0.7);
  drawRatio(A, C, 0.5, 1.5,  myStyle, 0, errA_, "x", "CMS data", "p e2 same", kRed , true, 0.7);

  //saving
  TString path="./diffXSecFromSignal/plots/combined/2012/comparisonATLAS/";
  plotCanvas_[0]->Print(path+quantity+"ATLASvsCMS7TeV.eps");
  plotCanvas_[0]->Print(path+quantity+"ATLASvsCMS7TeV.png");
  plotCanvas_[1]->Print(path+quantity+"ATLASvsCMS7TeVLog.eps");
  plotCanvas_[1]->Print(path+quantity+"ATLASvsCMS7TeVLog.png");
  plotCanvas_[2]->Print(path+quantity+"ATLASvsCMS7TeVNoratio.eps");
  plotCanvas_[2]->Print(path+quantity+"ATLASvsCMS7TeVNoratio.png");
  plotCanvas_[plotCanvas_.size()-1]->Print(path+quantity+"ATLASvsCMS7TeVratio.eps");
  plotCanvas_[plotCanvas_.size()-1]->Print(path+quantity+"ATLASvsCMS7TeVratio.png");
  plotCanvas_[plotCanvas_.size()-1]->SetTitle(quantity);
  saveToRootFile("ATLASvsCMSDataComparisonPlots.root", plotCanvas_[plotCanvas_.size()-1], true, 0,"");
}
开发者ID:eschliec,项目名称:TopAnalysis,代码行数:101,代码来源:ATLASCMSCOMPARISON.C

示例9: macro_MakeQcdClosureTest


//.........这里部分代码省略.........
      // integrate from the right side
      if (j == 1) { 
        // loop over bins
        double error;
        for (int i = 1; i < nBins + 1; ++i) {
          emuMass_wjets.back()->SetBinContent(i, emuMass_wjets.back()->IntegralAndError(i, nBins, error));
          emuMass_wjets.back()->SetBinError(i, error);
          emuMass_qcd.back()->SetBinContent(i, emuMass_qcd.back()->IntegralAndError(i, nBins, error));
          emuMass_qcd.back()->SetBinError(i, error);
          emuMass_qcdFromFake.back()->SetBinContent(i, emuMass_qcdFromFake.back()->IntegralAndError(i, nBins, error));
          emuMass_qcdFromFake.back()->SetBinError(i, error);
        }     
      }

      if (!plotSign[k]) continue;
      if (!plotType[j]) continue;

      TCanvas *emuPlot;
      TPad *specPad;
      if (plotPullBelowSpec && j == 0) {
        emuPlot = new TCanvas("emuPlot" + histoSign[k] + nameSuffix[j], "emu Spectrum" + titleSuffix[j], 100, 100, 900, 900);
        specPad = new TPad("specPad" + histoSign[k] + nameSuffix[j], "emu Spectrum" + titleSuffix[j], 0., 0.33, 1., 1.);
        specPad->SetBottomMargin(0.06);
      } else {
        emuPlot = new TCanvas("emuPlot" + histoSign[k] + nameSuffix[j], "emu Spectrum" + titleSuffix[j], 100, 100, 900, 600);
        specPad = new TPad("specPad" + histoSign[k] + nameSuffix[j], "emu Spectrum" + titleSuffix[j], 0., 0., 1., 1.);
        specPad->SetBottomMargin(0.12);
      }
      specPad->SetBorderMode(0);
      specPad->SetBorderSize(2);
      specPad->SetFrameBorderMode(0);
      specPad->SetFillColor(0);
      specPad->SetFrameFillColor(0);
      if (logPlotX) specPad->SetLogx();
      if (logPlotY) specPad->SetLogy();
      specPad->SetLeftMargin(0.11);
      specPad->SetRightMargin(0.09);
      specPad->SetTopMargin(0.08);
      specPad->SetTickx(1);
      specPad->SetTicky(1);
      specPad->Draw();
      specPad->cd();
 
      gStyle->SetTitleFont(font);
      gStyle->SetLabelFont(font);
      gStyle->SetLegendFont(font);
      gStyle->SetOptStat(0);
      gStyle->SetOptTitle(0);
      gStyle->SetTitleXOffset(1.);
      gStyle->SetTitleYOffset(1.3);
      gPad->SetTicks(1, 1);

      // make a histogram stack with the bg 
      THStack *bgStack = new THStack("bgStack" + histoSign[k] + nameSuffix[j], "Invariant Mass" + titleSuffix[j]);
      bgStack->Add(emuMass_qcd.back());
      bgStack->Add(emuMass_wjets.back());

      // plot spectrum
      emuMass_wjets.back()->SetFillColor(wjetColour);
      emuMass_wjets.back()->SetMarkerColor(wjetColour);
      emuMass_wjets.back()->SetLineColor(kBlack);
      emuMass_wjets.back()->SetLineWidth(2);
      //emuMass_wjets.back()->Draw("HISTsames");
      emuMass_qcd.back()->SetFillColor(jetBkgColour);
      emuMass_qcd.back()->SetMarkerColor(jetBkgColour);
      emuMass_qcd.back()->SetLineColor(kBlack);
开发者ID:gfasanel,项目名称:myCmsCode,代码行数:67,代码来源:macro_MakeQcdClosureTest.C


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