43 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
46 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
49 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
69 if (
histogram->GetEntries() < minstat ) {
80 }
catch( dqm_core::Exception & ex ) {
81 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
85 std::vector<double> stripsSize;
86 std::vector<double> stripsMedian;
87 std::vector<double> stripsAvg;
88 std::vector<double> stripsVariance;
91 if ( (
int)
range.size() < 4 ){
92 throw dqm_core::BadConfig( ERS_HERE,
name,
"BinRange vector <4 " );
96 std::vector<double> onestrip;
99 float binvalue =
histogram->GetBinContent(
i,j);
100 if (std::abs(binvalue- ignoreval1)<0.0001 || std::abs(binvalue - ignoreval2)<0.0001)
continue;
101 onestrip.push_back(binvalue);
102 stripSum += binvalue;
103 if(binvalue > maxInMap) {
107 if(onestrip.size()!=0 ) {
108 stripsAvg.push_back(stripSum/onestrip.size());
110 stripsAvg.push_back(0);
113 stripsSize.push_back(onestrip.size());
117 if ((
int)stripsAvg.size() <=
i-
range[0] ){
118 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsAvg range " );
120 float strip_avg = stripsAvg[
i-
range[0]];
122 for (
int j =
range[2]; j <=
range[3]; ++j ) {
123 if (std::abs(
histogram->GetBinContent(
i,j)-ignoreval1)<0.0001 || std::abs(
histogram->GetBinContent(
i,j)-ignoreval2)<0.0001)
continue;
124 double binvalue =
histogram->GetBinContent(
i,j);
125 double diff=binvalue-strip_avg;
131 stripsVariance.push_back(variance);
135 std::vector<binOnline> redbins;
136 std::vector<binOnline> yellowbins;
137 std::vector<binOnline> Allbins;
141 if ((
int)stripsSize.size() <=
q ){
142 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsSize range " );
144 if(stripsSize[
q]<minstatperstrip)
continue;
145 if ((
int)stripsMedian.size() <=
q ){
146 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsMedian range " );
148 if ((
int)stripsVariance.size() <=
q){
149 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsVariance range " );
151 if ((
int)stripsAvg.size() <=
q ){
152 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsAvg range " );
154 double strip_median = stripsMedian[
q];
155 double strip_variance = stripsVariance[
q];
156 double strip_avg = stripsAvg[
q];
158 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)<0.0001){
161 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)>0.0001) {
162 strip_median = strip_avg;
164 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)<0.0001)
continue;
171 if (std::abs(binvalue-ignoreval1)<0.0001 || std::abs(binvalue-ignoreval2)<0.0001)
continue;
172 double outstandingRatio=0;
173 if(std::abs(strip_median) > 0.0001 ){
174 outstandingRatio= (binvalue-strip_median)/std::sqrt(std::abs(strip_median));
180 binOnline onebin = {
eta,
phi,
k,
l,binvalue,outstandingRatio};
181 Allbins.push_back(onebin);
182 if(std::abs(outstandingRatio) > rthreshold ) {
183 if( VisualMode && (binvalue / maxInMap < suppressRedFactor) ){
186 redbins.push_back(onebin);
187 }
else if(std::abs(outstandingRatio) > gthreshold ){
188 if( VisualMode && (binvalue / maxInMap < suppressFactor) ){
191 yellowbins.push_back(onebin);
196 int count_yellow_c = 0;
197 std::vector<std::vector<colorbinOnline> > ColorBinMap;
201 for (
int q = 0;
q <=
limit; ++
q ) {
203 std::vector<colorbinOnline> oneColorStrip;
205 colorbinOnline oneColorBin = {-1,-1,
k,
l,-1,
green,1};
206 oneColorStrip.push_back(oneColorBin);
208 ColorBinMap.push_back(oneColorStrip);
212 for(
unsigned int i=0;
i<redbins.size();
i++){
214 int q=redbins[
i].m_ix -
range[0];
215 int p = redbins[
i].m_iy-
range[2];
217 if ((
int)ColorBinMap.size() <=
q){
218 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
221 if ((
int)ColorBinMap[
q].
size() <=
p ){
222 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
225 ColorBinMap[
q][
p].m_eta = redbins[
i].m_eta;
227 ColorBinMap[
q][
p].m_phi = redbins[
i].m_phi;
228 ColorBinMap[
q][
p].m_value = redbins[
i].m_value;
229 ColorBinMap[
q][
p].m_color =
red;
234 for(
unsigned int i=0;
i<yellowbins.size();
i++){
235 int q=yellowbins[
i].m_ix -
range[0];
236 int p = yellowbins[
i].m_iy-
range[2];
238 if ((
int)ColorBinMap.size() <=
q ){
239 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
242 if ((
int)ColorBinMap[
q].
size() <=
p ){
243 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
246 ColorBinMap[
q][
p].m_eta = yellowbins[
i].m_eta;
247 ColorBinMap[
q][
p].m_phi = yellowbins[
i].m_phi;
248 ColorBinMap[
q][
p].m_value = yellowbins[
i].m_value;
254 std::vector<colorclusterOnline > clusterArray;
255 for(
unsigned int i=0;
i<redbins.size();
i++){
257 int q=redbins[
i].m_ix -
range[0];
258 int p = redbins[
i].m_iy-
range[2];
260 if ((
int)ColorBinMap.size() <=
q ){
261 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
264 if ((
int)ColorBinMap[
q].
size() <=
p ){
265 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
268 if(ColorBinMap[
q][
p].m_color !=
green){
270 if((
int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
273 for(
unsigned int i=0;
i<yellowbins.size();
i++){
274 int q=yellowbins[
i].m_ix -
range[0];
275 int p = yellowbins[
i].m_iy-
range[2];
277 if ((
int)ColorBinMap.size() <=
q ){
278 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
281 if ((
int)ColorBinMap[
q].
size() <=
p ){
282 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
285 if(ColorBinMap[
q][
p].m_color !=
green){
287 if((
int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
292 for(
unsigned int i=0;
i<clusterArray.size();
i++){
294 if(clusterArray[
i].m_color==
red){
295 snprintf(
tmp,500,
"CR%i-(eta,phi)(r)(size)=(%0.3f,%0.3f)(%0.3f)(%i)",count_red_c,clusterArray[
i].m_eta,clusterArray[
i].m_phi,clusterArray[
i].m_radius,clusterArray[
i].m_size);
297 }
else if(clusterArray[
i].m_color==
yellow){
298 snprintf(
tmp,500,
"CY%i-(eta,phi)(r)(size)=(%0.3f,%0.3f)(%0.3f)(%i)",count_yellow_c,clusterArray[
i].m_eta,clusterArray[
i].m_phi,clusterArray[
i].m_radius,clusterArray[
i].m_size);
304 result->tags_[
"NRedClusters"] = count_red_c;
305 result->tags_[
"NYellowClusters"] = count_yellow_c;
309 std::sort(redbins.begin(),redbins.end());
310 std::sort(yellowbins.begin(),yellowbins.end());
311 std::sort(Allbins.begin(),Allbins.end());
314 for(
unsigned int i=0;
i<redbins.size();
i++){
316 int q = redbins[
i].m_ix-
range[0];
317 int p = redbins[
i].m_iy-
range[2];
320 if(
q<(
int)ColorBinMap.size()){
321 if(
p<(
int)ColorBinMap[
q].
size()){
322 if( ColorBinMap[
q][
p].m_status==0 )
continue;
329 snprintf(
tmp,500,
"R%i-(eta,phi)[OSRatio]=(%0.3f,%0.3f)[%0.2e]",count_red,redbins[
i].m_eta,redbins[
i].m_phi,redbins[
i].m_outstandingRatio);
335 if(count_red > NpublishRed)
break;
341 for(
unsigned int i=0;
i<yellowbins.size();
i++){
342 int q = yellowbins[
i].m_ix-
range[0];
343 int p = yellowbins[
i].m_iy-
range[2];
346 if(
q<(
int)ColorBinMap.size()){
347 if(
p<(
int)ColorBinMap[
q].
size()){
348 if(ColorBinMap[
q][
p].m_status==0)
continue;
352 if(publish && (count_red+count_yellow) < Nmaxpublish ){
354 snprintf(
tmp,500,
"Y%i-(eta,phi)[OSRatio]=(%0.3f,%0.3f)[%.2e]",count_yellow,yellowbins[
i].m_eta,yellowbins[
i].m_phi,yellowbins[
i].m_outstandingRatio);
360 result->tags_[
"NRedBins"] = count_red;
361 result->tags_[
"NYellowBins"] = count_yellow;
363 if(count_red+count_yellow==0 && (
int)Allbins.size()>=5 ){
364 for(
int i=0;
i<5;
i++){
366 snprintf(tmptmp,500,
"LeadingBin%i-(eta,phi)=(%0.3f,%0.3f)",
i,Allbins[
i].m_eta,Allbins[
i].m_phi);
367 std::string tagtag(tmptmp);
368 result->tags_[tagtag] = Allbins[
i].m_value;
375 if(count_red>0 || count_red_c>0) {
378 if (count_yellow>0||count_yellow_c>0) {
379 result->status_ = dqm_core::Result::Yellow;
383 if(count_red>=Nred_red){
385 }
else if (count_red>=Nred_yellow || count_yellow>=Nyellow_yellow || (count_red+count_yellow)>=Nredyellow_yellow){
386 result->status_ = dqm_core::Result::Yellow;