47 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
50 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
53 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
73 if (
histogram->GetEntries() < minstat ) {
84 }
catch( dqm_core::Exception & ex ) {
85 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
89 std::vector<double> stripsSize;
90 std::vector<double> stripsMedian;
91 std::vector<double> stripsAvg;
92 std::vector<double> stripsVariance;
95 if ( (
int)
range.size() < 4 ){
96 throw dqm_core::BadConfig( ERS_HERE,
name,
"BinRange vector <4 " );
100 std::vector<double> onestrip;
102 for (
int j =
range[2]; j <=
range[3]; ++j ) {
103 float binvalue =
histogram->GetBinContent(
i,j);
104 if (std::abs(binvalue- ignoreval1)<0.0001 || std::abs(binvalue - ignoreval2)<0.0001)
continue;
105 onestrip.push_back(binvalue);
106 stripSum += binvalue;
107 if(binvalue > maxInMap) {
111 if(onestrip.size()!=0 ) {
112 stripsAvg.push_back(stripSum/onestrip.size());
114 stripsAvg.push_back(0);
117 stripsSize.push_back(onestrip.size());
121 if ((
int)stripsAvg.size() <=
i-
range[0] ){
122 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsAvg range " );
124 float strip_avg = stripsAvg[
i-
range[0]];
126 for (
int j =
range[2]; j <=
range[3]; ++j ) {
127 if (std::abs(
histogram->GetBinContent(
i,j)-ignoreval1)<0.0001 || std::abs(
histogram->GetBinContent(
i,j)-ignoreval2)<0.0001)
continue;
128 double binvalue =
histogram->GetBinContent(
i,j);
129 double diff=binvalue-strip_avg;
135 stripsVariance.push_back(variance);
139 std::vector<binOnline> redbins;
140 std::vector<binOnline> yellowbins;
141 std::vector<binOnline> Allbins;
145 if ((
int)stripsSize.size() <=
q ){
146 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsSize range " );
148 if(stripsSize[
q]<minstatperstrip)
continue;
149 if ((
int)stripsMedian.size() <=
q ){
150 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsMedian range " );
152 if ((
int)stripsVariance.size() <=
q){
153 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsVariance range " );
155 if ((
int)stripsAvg.size() <=
q ){
156 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsAvg range " );
158 double strip_median = stripsMedian[
q];
159 double strip_variance = stripsVariance[
q];
160 double strip_avg = stripsAvg[
q];
162 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)<0.0001){
165 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)>0.0001) {
166 strip_median = strip_avg;
168 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)<0.0001)
continue;
175 if (std::abs(binvalue-ignoreval1)<0.0001 || std::abs(binvalue-ignoreval2)<0.0001)
continue;
176 double outstandingRatio=0;
177 if(std::abs(strip_median) > 0.0001 ){
178 outstandingRatio= (binvalue-strip_median)/std::sqrt(std::abs(strip_median));
184 binOnline onebin = {
eta,
phi,
k,
l,binvalue,outstandingRatio};
185 Allbins.push_back(onebin);
187 if(std::abs(outstandingRatio) > rthreshold ) {
188 if( VisualMode && (binvalue / maxInMap < suppressRedFactor) ){
191 redbins.push_back(onebin);
192 }
else if(std::abs(outstandingRatio) > gthreshold ){
193 if( VisualMode && (binvalue / maxInMap < suppressFactor) ){
196 yellowbins.push_back(onebin);
201 int count_yellow_c = 0;
202 std::vector<std::vector<colorbinOnline> > ColorBinMap;
206 for (
int q = 0;
q <=
limit; ++
q ) {
208 std::vector<colorbinOnline> oneColorStrip;
211 colorbinOnline oneColorBin = {-1,-1,
k,
l,-1,
green,1};
212 oneColorStrip.push_back(oneColorBin);
214 ColorBinMap.push_back(oneColorStrip);
218 for(
unsigned int i=0;
i<redbins.size();
i++){
221 int q=redbins[
i].m_ix -
range[0];
222 int p = redbins[
i].m_iy-
range[2];
224 if ((
int)ColorBinMap.size() <=
q){
225 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
228 if ((
int)ColorBinMap[
q].
size() <=
p ){
229 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
232 ColorBinMap[
q][
p].m_eta = redbins[
i].m_eta;
234 ColorBinMap[
q][
p].m_phi = redbins[
i].m_phi;
235 ColorBinMap[
q][
p].m_value = redbins[
i].m_value;
236 ColorBinMap[
q][
p].m_color =
red;
241 for(
unsigned int i=0;
i<yellowbins.size();
i++){
244 int q=yellowbins[
i].m_ix -
range[0];
245 int p = yellowbins[
i].m_iy-
range[2];
247 if ((
int)ColorBinMap.size() <=
q ){
248 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
251 if ((
int)ColorBinMap[
q].
size() <=
p ){
252 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
255 ColorBinMap[
q][
p].m_eta = yellowbins[
i].m_eta;
256 ColorBinMap[
q][
p].m_phi = yellowbins[
i].m_phi;
257 ColorBinMap[
q][
p].m_value = yellowbins[
i].m_value;
263 std::vector<colorclusterOnline > clusterArray;
264 for(
unsigned int i=0;
i<redbins.size();
i++){
267 int q=redbins[
i].m_ix -
range[0];
268 int p = redbins[
i].m_iy-
range[2];
270 if ((
int)ColorBinMap.size() <=
q ){
271 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
274 if ((
int)ColorBinMap[
q].
size() <=
p ){
275 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
278 if(ColorBinMap[
q][
p].m_color !=
green){
281 if((
int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
284 for(
unsigned int i=0;
i<yellowbins.size();
i++){
287 int q=yellowbins[
i].m_ix -
range[0];
288 int p = yellowbins[
i].m_iy-
range[2];
290 if ((
int)ColorBinMap.size() <=
q ){
291 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
294 if ((
int)ColorBinMap[
q].
size() <=
p ){
295 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
298 if(ColorBinMap[
q][
p].m_color !=
green){
301 if((
int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
306 for(
unsigned int i=0;
i<clusterArray.size();
i++){
308 if(clusterArray[
i].m_color==
red){
309 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);
311 }
else if(clusterArray[
i].m_color==
yellow){
312 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);
318 result->tags_[
"NRedClusters"] = count_red_c;
319 result->tags_[
"NYellowClusters"] = count_yellow_c;
324 std::sort(redbins.begin(),redbins.end());
326 std::sort(yellowbins.begin(),yellowbins.end());
328 std::sort(Allbins.begin(),Allbins.end());
331 for(
unsigned int i=0;
i<redbins.size();
i++){
333 int q = redbins[
i].m_ix-
range[0];
334 int p = redbins[
i].m_iy-
range[2];
337 if(
q<(
int)ColorBinMap.size()){
338 if(
p<(
int)ColorBinMap[
q].
size()){
339 if( ColorBinMap[
q][
p].m_status==0 )
continue;
346 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);
352 if(count_red > NpublishRed)
break;
358 for(
unsigned int i=0;
i<yellowbins.size();
i++){
359 int q = yellowbins[
i].m_ix-
range[0];
360 int p = yellowbins[
i].m_iy-
range[2];
363 if(
q<(
int)ColorBinMap.size()){
364 if(
p<(
int)ColorBinMap[
q].
size()){
365 if(ColorBinMap[
q][
p].m_status==0)
continue;
369 if(publish && (count_red+count_yellow) < Nmaxpublish ){
371 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);
377 result->tags_[
"NRedBins"] = count_red;
378 result->tags_[
"NYellowBins"] = count_yellow;
380 if(count_red+count_yellow==0 && (
int)Allbins.size()>=5 ){
381 for(
int i=0;
i<5;
i++){
383 snprintf(tmptmp,500,
"LeadingBin%i-(eta,phi)=(%0.3f,%0.3f)",
i,Allbins[
i].m_eta,Allbins[
i].m_phi);
384 std::string tagtag(tmptmp);
385 result->tags_[tagtag] = Allbins[
i].m_value;
392 if(count_red>0 || count_red_c>0) {
395 if (count_yellow>0||count_yellow_c>0) {
396 result->status_ = dqm_core::Result::Yellow;
400 if(count_red>=Nred_red){
402 }
else if (count_red>=Nred_yellow || count_yellow>=Nyellow_yellow || (count_red+count_yellow)>=Nredyellow_yellow){
403 result->status_ = dqm_core::Result::Yellow;