5 const Int_t MAXMARKERS = 100; Int_t i, nbmarkers; Stat_t x[MAXMARKERS]; Int_t ind[MAXMARKERS]; TList markers; markers.SetOwner(
false);
8 if ( TVirtualPad::Pad() == NULL )
return;
12 TIter next(TVirtualPad::Pad()->GetListOfPrimitives());
14 hist = NULL; nbmarkers = 0;
15 while ( (obj = next()) ) {
16 if ( obj->InheritsFrom(
"TMarker") ) {
17 x[nbmarkers] = ((TMarker*)obj)->GetX(); markers.AddAt(obj,nbmarkers); nbmarkers++;
19 if ( obj->InheritsFrom(
"TH1") ) { hist = (TH1 *)obj; }
21 if ( hist == NULL || nbmarkers < 2 ) {
22 printf(
"There is no histograms or enough clicks in the current pad to realise an integration \n");
return; }
24 TMath::Sort(nbmarkers,x,ind,
false);
26 Int_t first_bin, last_bin; Stat_t first_bin_c, last_bin_c;
28 for ( i = 0; i < nbmarkers - 1; i++ ) {
30 TH1 *clone = hist->Clone(); clone->Reset(
"ICE"); clone->SetFillColor( ((TMarker *)markers.At(ind[i]))->GetMarkerColor() );
32 if ( i % 2 == 0 ) clone->SetFillStyle(3004);
33 else clone->SetFillStyle(3005);
35 first_bin = hist->FindBin( x[ind[i]] );
36 last_bin = hist->FindBin( x[ind[i+1]] );
37 for (Int_t bin = first_bin; bin < last_bin; bin++ ) { clone->SetBinContent(bin,hist->GetBinContent(bin)); }
printf("******************************************************************** \n")
void FillIt()
Function to fill areas between markers.