drawing exclusion area in histograms

From: Stephan Zimmer <zimmerst_at_googlemail.com>
Date: Fri, 20 Nov 2009 04:20:41 +0100


Hi Rooters,
to specify the previous question.
I have a histogram (no tree!) and I want to draw an exclusion area. I've tried the TCutG class. However when i specify the points it's quite messy plus I need to specify them in general coordinates otherwise they will be plotted to the wrong place in my canvas. Is there an easy way of saying for instance I have a histogram and for a certain bin range this histogram is overlaid by a rectangle? Something like this?

{
  TH1D *h1gaus = new TH1D("h1gaus","gaus",100,-10,10);   for (int i = 0; i<1000000; i++) h1gaus->Fill(TMath::Pi()*gRandom->Gaus());   TCanvas c1;
  c1->DrawFrame(-10.,0.,10.0,30000);

  TCutG *atlasdr = new TCutG("atlasdr",5);

  atlasdr->SetVarX("");
  atlasdr->SetVarY("");
  atlasdr->SetPoint(0,-10.,0.);
  atlasdr->SetPoint(1,-5.8,0.);
  atlasdr->SetPoint(2,-5.8,30000.);
  atlasdr->SetPoint(3,-10.,30000.);
  atlasdr->SetPoint(4,-10,0);
  atlasdr->SetFillColor(2);
  atlasdr->SetFillStyle(3004);
  atlasdr->Draw("F");

  h1gaus->Draw("same");
}

Here it is pretty annoying that I have to draw the histogram as the last piece. Is there an easier way???
Thank you very much,
Cheers,
Stephan Received on Fri Nov 20 2009 - 04:20:51 CET

This archive was generated by hypermail 2.2.0 : Fri Nov 20 2009 - 23:50:02 CET