49{
50 using namespace std;
51
53
54
55 if(
object.
IsA()->InheritsFrom(
"TH2" ) ) {
57 if (
hist->GetDimension() != 2 ){
58 throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " );
59 }
60 } else {
61 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH2" );
62 }
63
64
66 double minstat=-1;
67 int centralBin=4;
68
69 try {
72 }
73 catch ( dqm_core::Exception & ex ) {
74 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
75 }
76
77
78
79
80
81 TH1* projection =
hist->ProjectionX();
82
83 dqm_core::Result*
result =
new dqm_core::Result();
84 std::map<std::string,double>
tags;
85
86
87 result->status_ = dqm_core::Result::Green;
89
90 for(int iBin=1;iBin<=projection->GetNbinsX();iBin++)
91 {
92 if( projection->GetBinContent(iBin)*thresh >
hist->GetBinContent(iBin,centralBin) )
93 {
94 result->status_ = dqm_core::Result::Yellow;
95 howmanybad++;
96
97 std::string slNum = std::to_string(iBin-1);
98 if(iBin < 10) slNum = "0" + slNum;
99
100 tags[slNum] =
hist->GetBinContent(iBin,centralBin)*1.0 / projection->GetBinContent(iBin) ;
101 }
102 }
103 tags[
"howmanybad"] = howmanybad;
104
105
107
108
109 if(howmanybad>2)
110 result->status_ = dqm_core::Result::Red;
111
113 hist->GetStats(stats);
114
115 if(stats[0]<minstat)
116 result->status_ = dqm_core::Result::Undefined;
117
118
120}
std::vector< std::string > tags
#define IsA
Declare the TObject style functions.