![]() |
![]() |
#include <DQM/EcalCommon/interface/UtilsClient.h>
Static Public Member Functions | |
static bool | getBinQuality (const MonitorElement *me, const int ix, const int iy) |
Returns true if the bin quality is good or masked. | |
template<class T> | |
static bool | getBinStatistics (const T *histo, const int ix, const int iy, float &num, float &mean, float &rms) |
Returns true if the bin contains good statistical data. | |
static bool | getBinStatus (const MonitorElement *me, const int ix, const int iy) |
Returns true if the bin status is red/dark red. | |
static int | getFirstNonEmptyChannel (const TProfile2D *histo) |
Find the first non empty bin. | |
template<class T> | |
static T | getHisto (const MonitorElement *me, bool clone=false, T ret=0) |
Returns the histogram contained by the Monitor Element. | |
static void | maskBinContent (const MonitorElement *me, const int ix, const int iy) |
Mask the bin content. | |
template<class T> | |
static void | printBadChannels (const MonitorElement *me, const T *hi, bool positive_only=false) |
Print the bad channels. | |
Protected Member Functions | |
UtilsClient () |
Definition at line 26 of file UtilsClient.h.
UtilsClient::UtilsClient | ( | ) | [inline, protected] |
static bool UtilsClient::getBinQuality | ( | const MonitorElement * | me, | |
const int | ix, | |||
const int | iy | |||
) | [inline, static] |
Returns true if the bin quality is good or masked.
me | input histogram | |
(ix,iy) | input histogram's bins |
Definition at line 159 of file UtilsClient.h.
References MonitorElement::getBinContent().
Referenced by EELedClient::writeDb(), EBTestPulseClient::writeDb(), EETimingClient::writeDb(), EBLaserClient::writeDb(), EEPedestalOnlineClient::writeDb(), EBPedestalOnlineClient::writeDb(), EBPedestalClient::writeDb(), EBTimingClient::writeDb(), EETestPulseClient::writeDb(), EEPedestalClient::writeDb(), and EELaserClient::writeDb().
00159 { 00160 if ( me ) { 00161 float val = me->getBinContent(ix, iy); 00162 // 0/3 = red/dark red 00163 // 1/4 = green/dark green 00164 // 2/5 = yellow/dark yellow 00165 // 6 = unknown 00166 if ( val == 0. || val == 2 || val == 6 ) return false; 00167 if ( val == 1. || val == 3 || val == 4 || val == 5 ) return true; 00168 } 00169 return false; 00170 }
template< class T > static bool UtilsClient::getBinStatistics | ( | const T * | histo, | |
const int | ix, | |||
const int | iy, | |||
float & | num, | |||
float & | mean, | |||
float & | rms | |||
) | [inline, static] |
Returns true if the bin contains good statistical data.
histo | input ROOT histogram | |
(ix,iy) | input histogram's bin | |
num | bin's entries | |
mean | bins' mean | |
rms | bin's rms |
Definition at line 136 of file UtilsClient.h.
Referenced by EEPedestalClient::analyze(), EETimingClient::analyze(), EBTimingClient::analyze(), EELaserClient::analyze(), EETestPulseClient::analyze(), EEPedestalOnlineClient::analyze(), EBLaserClient::analyze(), EBTestPulseClient::analyze(), EELedClient::analyze(), EBPedestalClient::analyze(), EBPedestalOnlineClient::analyze(), EBTestPulseClient::writeDb(), EELedClient::writeDb(), EETimingClient::writeDb(), EBLaserClient::writeDb(), EBPedestalClient::writeDb(), EBPedestalOnlineClient::writeDb(), EEPedestalOnlineClient::writeDb(), EBTimingClient::writeDb(), EETestPulseClient::writeDb(), EELaserClient::writeDb(), and EEPedestalClient::writeDb().
00136 { 00137 num = -1.; mean = -1.; rms = -1.; 00138 float percent = 0.01; float n_min_bin = 10.; 00139 00140 if ( histo ) { 00141 float n_min_tot = percent * n_min_bin * histo->GetNbinsX() * histo->GetNbinsY(); 00142 if ( histo->GetEntries() >= n_min_tot ) { 00143 num = histo->GetBinEntries(histo->GetBin(ix, iy)); 00144 if ( num >= n_min_bin ) { 00145 mean = histo->GetBinContent(ix, iy); 00146 rms = histo->GetBinError(ix, iy); 00147 return true; 00148 } 00149 } 00150 } 00151 return false; 00152 }
static bool UtilsClient::getBinStatus | ( | const MonitorElement * | me, | |
const int | ix, | |||
const int | iy | |||
) | [inline, static] |
Returns true if the bin status is red/dark red.
me | input histogram | |
(ix,iy) | input histogram's bins |
Definition at line 177 of file UtilsClient.h.
References MonitorElement::getBinContent().
Referenced by EELedClient::writeDb(), EBTestPulseClient::writeDb(), EETimingClient::writeDb(), EBLaserClient::writeDb(), EEPedestalOnlineClient::writeDb(), EBPedestalOnlineClient::writeDb(), EBPedestalClient::writeDb(), EBTimingClient::writeDb(), EETestPulseClient::writeDb(), EEPedestalClient::writeDb(), and EELaserClient::writeDb().
00177 { 00178 if ( me ) { 00179 float val = me->getBinContent(ix, iy); 00180 // 0/3 = red/dark red 00181 // 1/4 = green/dark green 00182 // 2/5 = yellow/dark yellow 00183 // 6 = unknown 00184 if ( val == 0. || val == 3 ) return true; 00185 return false; 00186 } 00187 return false; 00188 }
static int UtilsClient::getFirstNonEmptyChannel | ( | const TProfile2D * | histo | ) | [inline, static] |
Find the first non empty bin.
static int getFirstNonEmptyChannel( const TProfile2D* histo )
histo | input ROOT histogram |
Definition at line 212 of file UtilsClient.h.
Referenced by EELaserClient::analyze(), EETestPulseClient::analyze(), EBLaserClient::analyze(), EBTestPulseClient::analyze(), and EELedClient::analyze().
00212 { 00213 if ( histo ) { 00214 int ichannel = 1; 00215 while ( ichannel <= histo->GetNbinsX() ) { 00216 double counts = histo->GetBinContent(ichannel, 1); 00217 if ( counts > 0 ) return( ichannel ); 00218 ichannel++; 00219 } 00220 } 00221 return( 1 ); 00222 }
template< class T > static T UtilsClient::getHisto | ( | const MonitorElement * | me, | |
bool | clone = false , |
|||
T | ret = 0 | |||
) | [inline, static] |
Returns the histogram contained by the Monitor Element.
me | Monitor Element | |
clone | (boolean) if true clone the histogram | |
ret | in case of clonation delete the histogram first |
Definition at line 36 of file UtilsClient.h.
References clone(), MonitorElement::getName(), and s.
00036 { 00037 if( me ) { 00038 // std::cout << "Found '" << me->getName() <<"'" << std::endl; 00039 TObject* ob = const_cast<MonitorElement*>(me)->getRootObject(); 00040 if( ob ) { 00041 if( clone ) { 00042 if( ret ) { 00043 delete ret; 00044 } 00045 std::string s = "ME " + me->getName(); 00046 ret = dynamic_cast<T>(ob->Clone(s.c_str())); 00047 if( ret ) { 00048 ret->SetDirectory(0); 00049 } 00050 } else { 00051 ret = dynamic_cast<T>(ob); 00052 } 00053 } else { 00054 ret = 0; 00055 } 00056 } else { 00057 if( !clone ) { 00058 ret = 0; 00059 } 00060 } 00061 return ret; 00062 }
static void UtilsClient::maskBinContent | ( | const MonitorElement * | me, | |
const int | ix, | |||
const int | iy | |||
) | [inline, static] |
Mask the bin content.
static void maskBinContent( const MonitorElement* me, const int ix, const int iy )
histo | input histogram | |
(ix,iy) | input histogram's bins |
Definition at line 195 of file UtilsClient.h.
References MonitorElement::getBinContent().
Referenced by EETimingClient::analyze(), EEPedestalClient::analyze(), EELaserClient::analyze(), EBTimingClient::analyze(), EEIntegrityClient::analyze(), EETestPulseClient::analyze(), EEPedestalOnlineClient::analyze(), EELedClient::analyze(), EBTestPulseClient::analyze(), EBLaserClient::analyze(), EBPedestalOnlineClient::analyze(), EBPedestalClient::analyze(), and EBIntegrityClient::analyze().
00195 { 00196 if ( me ) { 00197 float val = me->getBinContent(ix, iy); 00198 // 0/3 = red/dark red 00199 // 1/4 = green/dark green 00200 // 2/5 = yellow/dark yellow 00201 // 6 = unknown 00202 if ( val >= 0. && val <= 2. ) { 00203 const_cast<MonitorElement*>(me)->setBinContent(ix, iy, val+3); 00204 } 00205 } 00206 }
template< class T > static void UtilsClient::printBadChannels | ( | const MonitorElement * | me, | |
const T * | hi, | |||
bool | positive_only = false | |||
) | [inline, static] |
Print the bad channels.
me | monitor element | |
hi | histogram | |
positive_only | enable logging of channels with positive content, only |
Definition at line 70 of file UtilsClient.h.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MonitorElement::getBinContent(), MonitorElement::getName(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), and indexGen::title.
Referenced by EELedClient::writeDb(), EBTestPulseClient::writeDb(), EETriggerTowerClient::writeDb(), EETimingClient::writeDb(), EBTriggerTowerClient::writeDb(), EBLaserClient::writeDb(), EEPedestalOnlineClient::writeDb(), EBPedestalOnlineClient::writeDb(), EBPedestalClient::writeDb(), EBTimingClient::writeDb(), EBStatusFlagsClient::writeDb(), EETestPulseClient::writeDb(), EEStatusFlagsClient::writeDb(), EEIntegrityClient::writeDb(), EEPedestalClient::writeDb(), EELaserClient::writeDb(), and EBIntegrityClient::writeDb().
00070 { 00071 if ( ! me ) { 00072 std::cout << "printBadChannels() failed, NULL pointer to MonitorElement !" 00073 << std::endl; 00074 return; 00075 } 00076 if ( ! hi ) { 00077 std::cout << "printBadChannels() failed, NULL pointer to ROOT histogram !" 00078 << std::endl; 00079 return; 00080 } 00081 bool title = false; 00082 TProfile2D* hj = dynamic_cast<TProfile2D*>(const_cast<T*>(hi)); 00083 int kx = -1; 00084 int ky = -1; 00085 for ( int ix = 1; ix <= me->getNbinsX(); ix++ ) { 00086 int jx = ix * hi->GetNbinsX() / me->getNbinsX(); 00087 if ( jx == kx ) continue; 00088 kx = jx; 00089 for ( int iy = 1; iy <= me->getNbinsY(); iy++ ) { 00090 int jy = iy * hi->GetNbinsY() / me->getNbinsY(); 00091 if ( jy == ky ) continue; 00092 ky = jy; 00093 if ( positive_only ) { 00094 if ( hi->GetBinContent(hi->GetBin(jx, jy)) <= 0 ) continue; 00095 } else { 00096 float val = me->getBinContent( ix, iy ); 00097 // 0/3 = red/dark red 00098 // 1/4 = green/dark green 00099 // 2/5 = yellow/dark yellow 00100 // 6 = unknown 00101 if ( val == 6 ) continue; 00102 if ( int(val) % 3 != 0 ) continue; 00103 } 00104 if ( ! title ) { 00105 std::cout << " Channels failing \"" << me->getName() << "\"" 00106 << " (" << hi->GetName() << ") " 00107 << std::endl << std::endl; 00108 title = true; 00109 } 00110 std::cout << " (" 00111 << hi->GetXaxis()->GetBinUpEdge(jx) 00112 << ", " 00113 << hi->GetYaxis()->GetBinUpEdge(jy); 00114 if ( hj ) 00115 std::cout << ", " 00116 << hj->GetBinEntries(hj->GetBin(jx, jy)); 00117 std::cout << ") = " 00118 << hi->GetBinContent(hi->GetBin(jx, jy)) 00119 << " +- " 00120 << hi->GetBinError(hi->GetBin(jx, jy)) 00121 << std::endl; 00122 } 00123 } 00124 if ( title ) std::cout << std::endl; 00125 return; 00126 }