9 #include "TProfile2D.h"
17 std::cout <<
"printBadChannels() failed, NULL pointer to MonitorElement !"
22 std::cout <<
"printBadChannels() failed, NULL pointer to ROOT histogram !"
27 TProfile2D* hj =
dynamic_cast<TProfile2D*
>(hi);
30 for (
int ix = 1; ix <= me->
getNbinsX(); ix++ ) {
31 int jx = ix * hi->GetNbinsX() / me->
getNbinsX();
32 if ( jx == kx )
continue;
34 for (
int iy = 1; iy <= me->
getNbinsY(); iy++ ) {
35 int jy = iy * hi->GetNbinsY() / me->
getNbinsY();
36 if ( jy == ky )
continue;
38 if ( positive_only ) {
39 if ( hi->GetBinContent(hi->GetBin(jx, jy)) <= 0 )
continue;
46 if ( val == 6 )
continue;
47 if (
int(val) % 3 != 0 )
continue;
51 <<
" (" << hi->GetName() <<
") "
52 << std::endl << std::endl;
56 << hi->GetXaxis()->GetBinUpEdge(jx)
58 << hi->GetYaxis()->GetBinUpEdge(jy);
61 << hj->GetBinEntries(hj->GetBin(jx, jy));
63 << hi->GetBinContent(hi->GetBin(jx, jy))
65 << hi->GetBinError(hi->GetBin(jx, jy))
76 num = -1.; mean = -1.; rms = -1.;
78 if ( !histo )
return false;
85 int bin = histo->GetBin(ix, iy);
88 TClass *
cl = histo->IsA();
89 if( cl == TClass::GetClass(
"TProfile") ){
90 p =
static_cast<TProfile *
>(
histo);
91 num = p->GetBinEntries(bin);
92 o = *( p->GetErrorOption() );
93 }
else if( cl == TClass::GetClass(
"TProfile2D") ){
94 p2 =
static_cast<TProfile2D *
>(
histo);
95 num = p2->GetBinEntries(bin);
96 o = *( p2->GetErrorOption() );
100 if ( num < minEntries )
return false;
102 mean = histo->GetBinContent(ix, iy);
104 rms = histo->GetBinError(ix, iy);
106 rms = histo->GetBinError(ix, iy) *
std::sqrt( num );
209 if ( val == 0. || val == 2 || val == 6 )
return false;
210 if ( val == 1. || val == 3 || val == 4 || val == 5 )
return true;
224 if ( val == 0. || val == 3 )
return true;
239 if ( val >= 0. && val <= 2. ) {
250 while ( ichannel <= histo->GetNbinsX() ) {
251 double counts = histo->GetBinContent(ichannel, 1);
252 if ( counts > 0 )
return( ichannel );
const std::string & getName(void) const
get name of ME
static bool getBinQuality(const MonitorElement *me, const int ix, const int iy)
Returns true if the bin quality is good or masked.
static void maskBinContent(const MonitorElement *me, const int ix, const int iy)
Mask the bin content.
int getNbinsY(void) const
get # of bins in Y-axis
static bool getBinStatus(const MonitorElement *me, const int ix, const int iy)
Returns true if the bin status is red/dark red.
Ecal Monitor Utils for Client.
static bool getBinStatistics(TH1 *histo, const int ix, const int iy, float &num, float &mean, float &rms, float minEntries=1.)
Returns true if the bin contains good statistical data.
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX(void) const
get # of bins in X-axis
static void printBadChannels(const MonitorElement *me, TH1 *hi, bool positive_only=false)
Print the bad channels.
static int getFirstNonEmptyChannel(const TProfile2D *histo)
Find the first non empty bin.