HistDisp.cxx File Reference

#include "HistDisp.h"
#include <DataUtil/GetDetectorBins.h>
#include <TCanvas.h>
#include <TH2D.h>
#include <TView.h>
#include <TProfile.h>
#include <iostream>

Go to the source code of this file.

Functions

static bool find_bounds (TH2D *h, int &min_bin, int &max_bin, bool isx)

Function Documentation

static bool find_bounds ( TH2D *  h,
int &  min_bin,
int &  max_bin,
bool  isx 
) [static]

Definition at line 114 of file HistDisp.cxx.

Referenced by HistDisp::AutoZoom().

00115 {
00116     min_bin=max_bin=0;
00117 
00118     TProfile* p = 0;
00119     if (isx) 
00120         p = h->ProfileX();
00121     else
00122         p = h->ProfileY();
00123 
00124     int bin=0, nbins = p->GetNbinsX();
00125 
00126     for(bin = 1; bin < nbins; ++bin) {
00127         if (0.0 != p->GetBinContent(bin)) break;
00128     }
00129     if (bin == nbins) return false;
00130     for( ; nbins > bin; --nbins) {
00131         if (0.0 != p->GetBinContent(nbins)) break;
00132     }
00133     if (bin == nbins) return false;
00134     min_bin = bin;
00135     max_bin = nbins;
00136     cerr << "["<<min_bin<<","<<max_bin<<"] isx? " << isx << endl;
00137     return true;
00138 }


Generated on 15 Jul 2018 for loon by  doxygen 1.6.1