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


C++ TPaveText::AddLine方法代码示例

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


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

示例1: compare_dat_sim


//.........这里部分代码省略.........
              call hfill(3900+idbase,sngl(Q2),zero,sngl(weight))
              call hfill(4200+idbase,sngl(hstheta-th_rad),zero,sngl(weight))
              call hfill(4300+idbase,sngl(eprime),zero,sngl(weight))
              call hfill(4400+idbase,sngl(hsdelta),sngl(hstheta-th_rad),sngl(weight))         
              call hfill(4100+idbase,sngl(xi),zero,sngl(weight))
              call hfill(4000+idbase,sngl(x_bj),zero,sngl(weight))
	      call hfill(4500+idbase,sngl(hsdelta),sngl(hsytar),sngl(weight))	      
	      call hfill(4600+idbase,sngl(hsxptar),sngl(hsyptar),sngl(weight))	      


C     HISTOGRAM KEY
C     1X01     DATA 
C     1X02     DATA (ELCLEAN)
C     1X03     DATA(ELREAL)/DATA(ELCLEAN)
C     1X04     POSITRONS
C     1X05     DATA*(1-POSITRONS/DATA(ELCLEAN)) = DATA_POSCOR
C     1X06     DUMMY
C     1X07     DUMMY (ELCLEAN)
C     1X08     DUMMY(ELREAL)/DUMMY(ELCLEAN)
C     1X09     DUMMY POSITRONS
C     1X10     DUMMY*( 1-(DUMMY POSITRONS)/DUMMY(ELCLEAN) ) = DUMMY_POSCOR
C     1X11     DATA_POSCOR - DUMMY_POSCOR/7.2 * (DATA_CHARGE/DUMMY_CHARGE)
C     1X12     SIMC
C     1X13     DATA/SIMC
C     1X14     (DATA/SIMC)*MODEL
C     1X15     POSITRONS/DATA(ELCLEAN)


What we should compare to check if the data matches simulation is SIMC (12) to DATA*(1-POSITRONS/DATA(ELCLEAN)) = DATA_POSCOR (5), the positron corrected dat or DATA_POSCOR - DUMMY_POSCOR/7.2 * (DATA_CHARGE/DUMMY_CHARGE) (11) same as positron corrected data since for the dummy target theres is DUMMY_POSCOR = 0.

So compare idbase = 5/11 to sim idbase = 12
  */

  THStack *hs[15];
  Double_t didbase = 0;
  Double_t sidbase = 0;

  Double_t histid[15]={3000,3100,3200,3300,3400,3500,3600,3700,3800,3900,4200,4300,4400,4100,4000};
  TString histnam[15]={"hsdelta","hsxptar","hsyptar","hsytar","hsxfp","hsxpfp","hsyfp","hsypfp","W","Q2","hstheta","eprime","th_vs_delta","xi","x_bj"};

  // loop over the 15 types of histos from data and sim and stack them
  for (Int_t i=0;i<15; i++){
    // std::cout<<i<<std::endl;
    c->cd(i+1);
    // gPad->SetLogy();
    hs[i] = new THStack("fs",Form("%s",histnam[i].Data()));
    // first get positron corrected electron data. This could be idbase = 5 or idbase = 11 (for dummy targets only)
    didbase =5;
    TH1F *hdat = (TH1F*)f->Get(Form("h%2.0f",histid[i]+didbase));
    //std::cout<<Form("h%2.0f",histid[i]+didbase)<<std::endl;
    // next get sim histos
    sidbase = 12;
    TH1F *hsim = (TH1F*)f->Get(Form("h%2.0f",histid[i]+sidbase));
    hsim->SetLineColor(kRed);
    // std::cout<<Form("h%2.0f",histid[i]+sidbase)<<std::endl;
  
    hs[i]->Add(hsim);
    hs[i]->Add(hdat);
    hs[i]->Draw("nostack,hist");
    gPad->Update();   

    TLegend * leg = new TLegend(0.7,0.7,0.9,0.9);
    leg->AddEntry(hdat,Form("data(1x%2.0f)",didbase),"l");
    leg->AddEntry(hsim,"simc(1x12)","l");
    leg->Draw();

    // c1->cd(i+1);
    // idbase = 1;
    // TH1F *hdat1 = (TH1F*)f->Get(Form("h%2.0f",histid[i]+idbase));
    // //hdat1->SetLineColor(kGreen+2);
    // //hdat1->Add(hsim,0.0);
    // hdat1->Draw();
    // hdat1->GetXaxis()->SetLabelSize(0.07);
    // hdat1->GetYaxis()->SetLabelSize(0.07);
    // gPad->Update();
    
  }

  c->cd(16);
  TPaveText *pt = new TPaveText(.05,.1,.95,.8);
  
  pt->AddText("ROOT file used:");
  pt->AddText(rfile);
  pt->AddLine(.0,.5,1.,.5);
  pt->Draw();


  /******************
   Draw the 2D histograms
  *******************/



  //c->Print(Form("~/MyWork/HallC/SRC/xem/scripts/compare_dat_sim/stack_dat_%1.0f_sim_12_%s.png",didbase,rfile.Data()));
  //c->Print(Form("~/MyWork/HallC/SRC/xem/scripts/compare_dat_sim/stack_dat_%1.0f_sim_12_%s.C",didbase,rfile.Data()));

  //c1->Print(Form("diff_dat_sim_%s.png",rfile.Data()));
  //c1->Print(Form("diff_dat_sim_%s.C",rfile.Data()));

}
开发者ID:buddhiniw,项目名称:E03103-xem,代码行数:101,代码来源:compare_dat_sim.C

示例2: tree


//.........这里部分代码省略.........
   ar1->DrawArrow(.45,.175,.54,.175,0.015,"|>");
   ar1->DrawArrow(.43,.075,.54,.075,0.015,"|>");
   ar1->DrawArrow(.41,-.025,.54,-.025,0.015,"|>");
   TLine* ldot = new TLine(.95,.92,.99,.92);
   ldot->SetLineStyle(3);
   ldot->Draw();
   ldot->DrawLine(.9,.775,.99,.775);
   ldot->DrawLine(.9,.275,.99,.275);
   ldot->DrawLine(.55,.05,.55,0);
   ldot->DrawLine(.9,.05,.75,0);
   TText* pname = new TText(.46,.21,"fEventOffset");
   pname->SetTextFont(72);
   pname->SetTextSize(0.018);
   pname->Draw();
   pname->DrawText(.44,.11,"fBuffer");
   pname->DrawText(.42,.01,"fZipBuffer");
   pname->DrawText(.26,.81,"fLeaves = TObjArray of TLeaf");
   pname->DrawText(.24,.40,"fBasketEvent");
   pname->DrawText(.22,.31,"fBaskets = TObjArray of TBasket");
   pname->DrawText(.20,1.0,"fBranches = TObjArray of TBranch");
   TPaveText* ntleaf = new TPaveText(0.30,.42,.62,.7);
   ntleaf->SetTextSize(0.014);
   ntleaf->SetFillColor(leafcolor);
   ntleaf->SetTextAlign(12);
   ntleaf->AddText("fLen: number of fixed elements");
   ntleaf->AddText("fLenType: number of bytes of data type");
   ntleaf->AddText("fOffset: relative to Leaf0-fAddress");
   ntleaf->AddText("fNbytesIO: number of bytes used for I/O");
   ntleaf->AddText("fIsPointer: True if pointer");
   ntleaf->AddText("fIsRange: True if leaf has a range");
   ntleaf->AddText("fIsUnsigned: True if unsigned");
   ntleaf->AddText("*fLeafCount: points to Leaf counter");
   ntleaf->AddText(" ");
   ntleaf->AddLine(0,0,0,0);
   ntleaf->AddText("fName = Leaf name");
   ntleaf->AddText("fTitle = Leaf type (see Type codes)");
   ntleaf->Draw();
   TPaveText* type = new TPaveText(.65,.42,.95,.7);
   type->SetTextAlign(12);
   type->SetFillColor(leafcolor);
   type->AddText(" ");
   type->AddText("C : a character string");
   type->AddText("B : an 8 bit signed integer");
   type->AddText("b : an 8 bit unsigned integer");
   type->AddText("S : a 16 bit signed short integer");
   type->AddText("s : a 16 bit unsigned short integer");
   type->AddText("I : a 32 bit signed integer");
   type->AddText("i : a 32 bit unsigned integer");
   type->AddText("F : a 32 bit floating point");
   type->AddText("D : a 64 bit floating point");
   type->AddText("TXXXX : a class name TXXXX");
   type->Draw();
   TPaveLabel* typecode = new TPaveLabel(.7,.68,.9,.72,"fType codes");
   typecode->SetFillColor(leafcolor);
   typecode->Draw();
   ldot->DrawLine(.4,.75,.30,.7);
   ldot->DrawLine(.5,.75,.62,.7);
   TPaveText* ntbasket = new TPaveText(0.02,-0.07,0.35,.25);
   ntbasket->SetFillColor(basketcolor);
   ntbasket->SetTextSize(0.014);
   ntbasket->SetTextAlign(12);
   ntbasket->AddText("fNbytes: Size of compressed Basket");
   ntbasket->AddText("fObjLen: Size of uncompressed Basket");
   ntbasket->AddText("fDatime: Date/Time when written to store");
   ntbasket->AddText("fKeylen: Number of bytes for the key");
   ntbasket->AddText("fCycle : Cycle number");
开发者ID:digideskio,项目名称:root,代码行数:67,代码来源:tree.C

示例3: file

void file(){

   TCanvas *c1 = new TCanvas("c1","ROOT File description",200,10,700,550);

   c1->Range(0,-0.25,21,14);
   TPaveLabel *title = new TPaveLabel(5,12,15,13.7,c1->GetTitle());
   title->SetFillColor(16);
   title->Draw();

   // horizonthal file layout
   TPave *file = new TPave(1,8.5,20,11);
   file->SetFillColor(11);
   file->Draw();
   TPave *fileh = new TPave(1,8.5,2.5,11);
   fileh->SetFillColor(44);
   fileh->Draw();
   TPave *lrh = new TPave(2.5,8.5,3.3,11,1);
   lrh->SetFillColor(33);
   lrh->Draw();
   lrh->DrawPave(6.9,8.5,7.7,11,1);
   lrh->DrawPave(10.5,8.5,11.3,11,1);
   lrh->DrawPave(14.5,8.5,15.3,11,1);
   TLine *ldot = new TLine(1,8.5,0.5,6.5);
   ldot->SetLineStyle(2);
   ldot->Draw();
   ldot->DrawLine(2.5, 8.5, 9.4, 6.5);
   ldot->DrawLine(10.5, 8.5, 10, 6.5);
   ldot->DrawLine(11.3, 8.5, 19.5, 6.5);
   TLine *line = new TLine(2.6,11,2.6,11.5);
   line->Draw();
   line->DrawLine(2.6,11.5,7,11.5);
   TArrow *arrow = new TArrow(7,11.5,7,11.1,0.01,"|>");
   arrow->SetFillStyle(1001);
   arrow->Draw();
   line->DrawLine( 7, 8.5, 7, 8.0);
   line->DrawLine( 7, 8.0, 10.6, 8);
   arrow->DrawArrow( 10.6,8, 10.6, 8.4,0.01,"|>");
   line->DrawLine( 10.6, 11, 10.6, 11.5);
   line->DrawLine( 10.6, 11.5, 14.6, 11.5);
   arrow->DrawArrow( 14.6,11.5, 14.6,11.1,0.01,"|>");
   line->DrawLine( 14.6, 8.5, 14.6, 8.0);
   line->DrawLine( 14.6, 8.0, 16, 8);
   ldot->DrawLine(16, 8, 19, 8);
   TText *vert = new TText(1.5,9.75,"File");
   vert->SetTextAlign(21);
   vert->SetTextAngle(90);
   vert->SetTextSize(0.025);
   vert->Draw();
   vert->DrawText(2.0, 9.75,"Header");
   vert->DrawText(2.9, 9.75,"Logical Record");
   vert->DrawText(3.2, 9.75,"Header");
   vert->DrawText(7.3, 9.75,"Logical Record");
   vert->DrawText(7.6, 9.75,"Header");
   vert->DrawText(10.9,9.75,"Logical Record");
   vert->DrawText(11.2,9.75,"Header");
   vert->DrawText(14.9,9.75,"Logical Record");
   vert->DrawText(15.2,9.75,"Header");
   TText *hori = new TText(4.75,10,"Object");
   hori->SetTextAlign(22);
   hori->SetTextSize(0.035);
   hori->Draw();
   hori->DrawText(4.75, 9.5,"Data");
   hori->DrawText(9.2, 10,"Deleted");
   hori->DrawText(9.2, 9.5,"Object");
   line->DrawLine( 6.9, 8.5, 10.5, 11);
   line->DrawLine( 6.9, 11, 10.5, 8.5);
   TText *tbig = new TText(17,9.75,"............");
   tbig->SetTextAlign(22);
   tbig->SetTextSize(0.03);
   tbig->Draw();
   tbig->DrawText(2.6, 7, "fBEGIN");
   tbig->DrawText(20., 7, "fEND");
   arrow->DrawArrow( 2.6,7, 2.6,8.4,0.01,"|>");
   arrow->DrawArrow( 20,7, 20,8.4,0.01,"|>");

   //file header
   TPaveText *header = new TPaveText(0.5,.2,9.4,6.5);
   header->SetFillColor(44);
   header->Draw();
   TText *fh=header->AddText("File Header");
   fh->SetTextAlign(22);
   fh->SetTextSize(0.04);
   header->SetTextSize(0.027);
   header->SetTextAlign(12);
   header->AddText(" ");
   header->AddLine(0,0,0,0);
   header->AddText("\"root\": Root File Identifier");
   header->AddText("fVersion: File version identifier");
   header->AddText("fBEGIN: Pointer to first data record");
   header->AddText("fEND: Pointer to first free word at EOF");
   header->AddText("fSeekFree: Pointer to FREE data record");
   header->AddText("fNbytesFree: Number of bytes in FREE");
   header->AddText("fNfree: Number of free data records");
   header->AddText("fNbytesName: Number of bytes in name/title");
   header->AddText("fUnits: Number of bytes for pointers");
   header->AddText("fCompress: Compression level");

   //logical record header
   TPaveText *lrecord = new TPaveText(10,0.2,19.5,6.5);
   lrecord->SetFillColor(33);
//.........这里部分代码省略.........
开发者ID:MycrofD,项目名称:root,代码行数:101,代码来源:file.C


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