31 #ifndef ROOT_TPolyLine
32 #include "TPolyLine.h"
40 #ifndef ROOT_TPolyLine
41 #include "TPolyLine.h"
73 TVirtualPad *locpad = 0x0;
75 if ( TVirtualPad::Pad() == 0x0 )
78 locpad = TVirtualPad::Pad();
83 TIter next(locpad->GetListOfPrimitives());
84 while ( (obj = next()) ) {
85 if ( obj->InheritsFrom(
"TH1") ) {
86 h =
dynamic_cast<TH1*
> ( obj );
94 if(g != 0x0) h = g->GetHistogram();
107 TVirtualPad *locpad = 0x0;
109 if ( TVirtualPad::Pad() == 0x0 )
112 locpad = TVirtualPad::Pad();
117 TIter next(locpad->GetListOfPrimitives());
118 while ( (obj = next()) ) {
119 if ( obj->InheritsFrom(
"TGraph") ) {
120 h =
dynamic_cast<TGraph*
> ( obj );
130 TPolyLine *result =
new TPolyLine();
133 Double_t altitude = 0.9*h->GetMaximum();
135 for (Int_t i = h->GetXaxis()->FindFixBin(xmin); i < h->GetXaxis()->FindFixBin(xmax); i++) {
137 Double_t yy, xx, yytmp;
139 xx = h->GetBinLowEdge(i);
140 yy = h->GetBinContent(i) - f->Eval(h->GetBinLowEdge(i)) ;
141 yytmp = h->GetBinContent(i) - f->Eval(h->GetBinCenter(i));
142 if ( TMath::Abs( yytmp ) < TMath::Abs( yy ) ) {
143 xx = h->GetBinCenter(i);
146 yytmp = h->GetBinContent(i) - f->Eval(h->GetBinLowEdge(i)+h->GetBinWidth(i));
147 if ( TMath::Abs( yytmp ) < TMath::Abs( yy ) ){
148 xx = h->GetBinLowEdge(i)+h->GetBinWidth(i);
152 yytmp = altitude + yy;
153 result->SetNextPoint(xx,yytmp);
155 if ( TVirtualPad::Pad() )
header file for PadManager.cpp
static TPolyLine * ShowDiff(const TH1 *h, const TF1 *f, Double_t xmin, Double_t xmax)
show a polyline calculated as the difference between an histogram and a function (used for instance f...
ClassImp(PadManager) PadManager
static EActionMode gActionMode
Global to be applied on Canvas that are not Gw::Canvas or dont't have an individual mode...
static TH1 * GetHisto(TVirtualPad *pad=0x0, Option_t *op="")
look for an histogram into the pad
static TGraph * GetGraph(TVirtualPad *pad=0x0, Option_t *op="")