53{
55
56 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
59 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
60 }
61 } else {
62 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
63 }
65
66 double grThr = 0.05, reThr = 0.1;
67 try {
70 } catch ( dqm_core::Exception & ex ) {
71 throw dqm_core::BadConfig(ERS_HERE,name,"Paramter: 'Threshold' is mandatory, cannot continue");
72 }
73
74
75 if ((grThr>1.0 || reThr>1.0) ) {
76 throw dqm_core::BadConfig(ERS_HERE,
m_name,
"Configuration Error: Threshold should be between [0.0, 1.0] 10% => 0.1");
77 }
78
79
81
82 size_t ntotBins = (size_t)
histogram -> GetNbinsX();
83
84
85 size_t colflags[4];
90
91 bool doflags[2];
94
95 dqm_core::Result*
result =
new dqm_core::Result();
96 colflags[0] = ((colflags[0] > 0) && (colflags[0] <= ntotBins)) ? colflags[0] : 1;
97 colflags[1] = ((colflags[1] >= colflags[0]) && (colflags[1] <= ntotBins)) ? colflags[1] : ntotBins;
98 colflags[2] = ((colflags[2] > 0) && (colflags[2] <= ntotBins)) ? colflags[2] : 1;
99 colflags[3] = ((colflags[3] >= colflags[2]) && (colflags[3] <= ntotBins)) ? colflags[3] : ntotBins;
100 bool yellowLo2HiEmpty = true, redLo2HiEmpty = true;
101 int ycnt = 0, rcnt = 0;
102
103
104
105
107 double nevtstot = 1.;
108 if(!std::isnan(nentries/ntotBins) || !std::isinf(nentries / ntotBins)) nevtstot =
nentries/ntotBins;
109
110
111 double theYFracMax = -9., theRFracMax = -9.;
112 if(doflags[0]) {
113 for( size_t j = colflags[0]; j <= colflags[1]; j++ ) {
114
115 double thebinc =
histogram -> GetBinContent(j);
116
117 double thefrac = thebinc / nevtstot;
118
119
120
121
122
123 if(thefrac > grThr) {
124 if(theYFracMax < thefrac) theYFracMax = thefrac;
125 yellowLo2HiEmpty = false;
126 ycnt ++;
127 }
128 }
129 }
130
131
132 if(doflags[1]) {
133 for( size_t j = colflags[2]; j <= colflags[3]; j++ ) {
134
135 double thebinc =
histogram -> GetBinContent(j);
136
137 double thefrac = thebinc / nevtstot;
138 if(thefrac > reThr) {
139 if(theRFracMax < thefrac) theRFracMax = thefrac;
140 redLo2HiEmpty = false;
141 rcnt++;
142 }
143 }
144 }
145
146
147 result->status_ = dqm_core::Result::Green;
148
149 if(doflags[0] && !yellowLo2HiEmpty) {
150 result->status_ = dqm_core::Result::Yellow;
151 }
152
153 if(doflags[1] && !redLo2HiEmpty) {
154 result->status_ = dqm_core::Result::Red;
155 }
156
157 result->tags_[
"NumOfStatusBitsYellow"] = ycnt;
158 result->tags_[
"EventFractionYellow"] = theYFracMax;
159 result->tags_[
"NumOfStatusBitsRed"] = rcnt;
160 result->tags_[
"EventFractionRed"] = theRFracMax;
161
163
165}
TGraphErrors * GetEntries(TH2F *histo)
#define IsA
Declare the TObject style functions.