How to get two stat box for two histo on same

From: Sushil Singh Chauhan <sushil_at_fnal.gov>
Date: Fri, 27 May 2005 12:42:21 +0530


Hi!,
  I am using the following script to plot two histo. I want to have both the stat box on the same plot. I am able to plot the both histo and one stat box. But I want both the stat box.   Could anybody guide me how to do this? Scripts is:



void two() {
  TLatex l;
TH1F *h=new TH1F("","",10000,-0.5,9999.5);   

  Int_t i,p=0,z;     

   Int_t y[20]=
{121,421,953,1487,1703,1796,1455,1002,589,284,115,54,13,5,1,1,0,0,0,0};   for (Int_t i=1;i<10001;i++) {
   if(i<20)
   {
  z=y[p];
  h->SetBinContent(i,z);   

  p=p+1;
  }
  else
   h->SetBinContent(i,0);
  }
  h->Draw();
   TH1F *h1=new TH1F("","",10000,-0.5,9999.5);  

  Int_t i,p1=0,z1;     

   Int_t y1[20]=
{17,144,468,1007,1506,1727,1609,1311,908,611,343,187,86,44,21,8,2,1,0,0};   for (Int_t i=1;i<10001;i++) {
   if(i<20)
   {
  z1=y1[p1];
  h1->SetBinContent(i,z1);   

  p1=p1+1;
  }
  else
   h1->SetBinContent(i,0);
  }     

  h1->Draw("same");   

// TPaveStats

*st=(TPaveStats*)h1->GetListOfFunctions()->FindObject("stats");
// st->SetX1NDC(2.0);
// st->SetX2NDC(6.0);
   

  l.SetTextAlign(12);
  l.SetTextSize(0.04);
  l.SetTextAngle(90);
  l.DrawLatex(-2.8,571,"No. of Events");
  l.SetTextAngle(0);
  l.DrawLatex(14.0,-96,"");
  l.DrawLatex(14.7,1081,"CTEQ5M1");
  

}

-- 
******************************************
Sushil Singh Chauhan
Research Scholar | HEP Delhi Group |
Dept. of Physics & Astrophysics |
University of Delhi | Delhi |INDIA |
Phone: 91-11-27667036(Office)
       91-09312520057(Cell)
******************************************
Received on Fri May 27 2005 - 09:12:36 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:08 MET