42 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
45 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
48 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
68 if (
histogram->GetEntries() < minstat ) {
79 }
catch( dqm_core::Exception & ex ) {
80 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
84 std::vector<double> stripsSize;
85 std::vector<double> stripsMedian;
86 std::vector<double> stripsAvg;
87 std::vector<double> stripsVariance;
90 if ( (
int)
range.size() < 4 ){
91 throw dqm_core::BadConfig( ERS_HERE,
name,
"BinRange vector <4 " );
95 std::vector<double> onestrip;
98 float binvalue =
histogram->GetBinContent(
i,j);
99 if (std::abs(binvalue- ignoreval1)<0.0001 || std::abs(binvalue - ignoreval2)<0.0001)
continue;
100 onestrip.push_back(binvalue);
101 stripSum += binvalue;
102 if(binvalue > maxInMap) {
106 if(onestrip.size()!=0 ) {
107 stripsAvg.push_back(stripSum/onestrip.size());
109 stripsAvg.push_back(0);
112 stripsSize.push_back(onestrip.size());
116 if ((
int)stripsAvg.size() <=
i-
range[0] ){
117 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsAvg range " );
119 float strip_avg = stripsAvg[
i-
range[0]];
121 for (
int j =
range[2]; j <=
range[3]; ++j ) {
122 if (std::abs(
histogram->GetBinContent(
i,j)-ignoreval1)<0.0001 || std::abs(
histogram->GetBinContent(
i,j)-ignoreval2)<0.0001)
continue;
123 double binvalue =
histogram->GetBinContent(
i,j);
124 double diff=binvalue-strip_avg;
130 stripsVariance.push_back(variance);
134 std::vector<binOnline> redbins;
135 std::vector<binOnline> yellowbins;
136 std::vector<binOnline> Allbins;
140 if ((
int)stripsSize.size() <=
q ){
141 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsSize range " );
143 if(stripsSize[
q]<minstatperstrip)
continue;
144 if ((
int)stripsMedian.size() <=
q ){
145 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsMedian range " );
147 if ((
int)stripsVariance.size() <=
q){
148 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsVariance range " );
150 if ((
int)stripsAvg.size() <=
q ){
151 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of stripsAvg range " );
153 double strip_median = stripsMedian[
q];
154 double strip_variance = stripsVariance[
q];
155 double strip_avg = stripsAvg[
q];
157 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)<0.0001){
160 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)>0.0001) {
161 strip_median = strip_avg;
163 if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)<0.0001)
continue;
170 if (std::abs(binvalue-ignoreval1)<0.0001 || std::abs(binvalue-ignoreval2)<0.0001)
continue;
171 double outstandingRatio=0;
172 if(std::abs(strip_median) > 0.0001 ){
173 outstandingRatio= (binvalue-strip_median)/std::sqrt(std::abs(strip_median));
179 binOnline onebin = {
eta,
phi,
k,
l,binvalue,outstandingRatio};
180 Allbins.push_back(onebin);
181 if(std::abs(outstandingRatio) > rthreshold ) {
182 if( VisualMode && (binvalue / maxInMap < suppressRedFactor) ){
185 redbins.push_back(onebin);
186 }
else if(std::abs(outstandingRatio) > gthreshold ){
187 if( VisualMode && (binvalue / maxInMap < suppressFactor) ){
190 yellowbins.push_back(onebin);
195 int count_yellow_c = 0;
196 std::vector<std::vector<colorbinOnline> > ColorBinMap;
200 for (
int q = 0;
q <=
limit; ++
q ) {
202 std::vector<colorbinOnline> oneColorStrip;
204 colorbinOnline oneColorBin = {-1,-1,
k,
l,-1,
green,1};
205 oneColorStrip.push_back(oneColorBin);
207 ColorBinMap.push_back(std::move(oneColorStrip));
211 for(
unsigned int i=0;
i<redbins.size();
i++){
213 int q=redbins[
i].m_ix -
range[0];
214 int p = redbins[
i].m_iy-
range[2];
216 if ((
int)ColorBinMap.size() <=
q){
217 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
220 if ((
int)ColorBinMap[
q].
size() <=
p ){
221 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
224 ColorBinMap[
q][
p].m_eta = redbins[
i].m_eta;
226 ColorBinMap[
q][
p].m_phi = redbins[
i].m_phi;
227 ColorBinMap[
q][
p].m_value = redbins[
i].m_value;
228 ColorBinMap[
q][
p].m_color =
red;
233 for(
unsigned int i=0;
i<yellowbins.size();
i++){
234 int q=yellowbins[
i].m_ix -
range[0];
235 int p = yellowbins[
i].m_iy-
range[2];
237 if ((
int)ColorBinMap.size() <=
q ){
238 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
241 if ((
int)ColorBinMap[
q].
size() <=
p ){
242 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
245 ColorBinMap[
q][
p].m_eta = yellowbins[
i].m_eta;
246 ColorBinMap[
q][
p].m_phi = yellowbins[
i].m_phi;
247 ColorBinMap[
q][
p].m_value = yellowbins[
i].m_value;
253 std::vector<colorclusterOnline > clusterArray;
254 for(
unsigned int i=0;
i<redbins.size();
i++){
256 int q=redbins[
i].m_ix -
range[0];
257 int p = redbins[
i].m_iy-
range[2];
259 if ((
int)ColorBinMap.size() <=
q ){
260 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
263 if ((
int)ColorBinMap[
q].
size() <=
p ){
264 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
267 if(ColorBinMap[
q][
p].m_color !=
green){
269 if((
int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
272 for(
unsigned int i=0;
i<yellowbins.size();
i++){
273 int q=yellowbins[
i].m_ix -
range[0];
274 int p = yellowbins[
i].m_iy-
range[2];
276 if ((
int)ColorBinMap.size() <=
q ){
277 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
280 if ((
int)ColorBinMap[
q].
size() <=
p ){
281 throw dqm_core::BadConfig( ERS_HERE,
name,
"out of ColorBinMap range " );
284 if(ColorBinMap[
q][
p].m_color !=
green){
286 if((
int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
291 for(
unsigned int i=0;
i<clusterArray.size();
i++){
293 if(clusterArray[
i].m_color==
red){
294 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);
296 }
else if(clusterArray[
i].m_color==
yellow){
297 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);
303 result->tags_[
"NRedClusters"] = count_red_c;
304 result->tags_[
"NYellowClusters"] = count_yellow_c;
308 std::sort(redbins.begin(),redbins.end());
309 std::sort(yellowbins.begin(),yellowbins.end());
310 std::sort(Allbins.begin(),Allbins.end());
313 for(
unsigned int i=0;
i<redbins.size();
i++){
315 int q = redbins[
i].m_ix-
range[0];
316 int p = redbins[
i].m_iy-
range[2];
319 if(
q<(
int)ColorBinMap.size()){
320 if(
p<(
int)ColorBinMap[
q].
size()){
321 if( ColorBinMap[
q][
p].m_status==0 )
continue;
328 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);
334 if(count_red > NpublishRed)
break;
340 for(
unsigned int i=0;
i<yellowbins.size();
i++){
341 int q = yellowbins[
i].m_ix-
range[0];
342 int p = yellowbins[
i].m_iy-
range[2];
345 if(
q<(
int)ColorBinMap.size()){
346 if(
p<(
int)ColorBinMap[
q].
size()){
347 if(ColorBinMap[
q][
p].m_status==0)
continue;
351 if(publish && (count_red+count_yellow) < Nmaxpublish ){
353 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);
359 result->tags_[
"NRedBins"] = count_red;
360 result->tags_[
"NYellowBins"] = count_yellow;
362 if(count_red+count_yellow==0 && (
int)Allbins.size()>=5 ){
363 for(
int i=0;
i<5;
i++){
365 snprintf(tmptmp,500,
"LeadingBin%i-(eta,phi)=(%0.3f,%0.3f)",
i,Allbins[
i].m_eta,Allbins[
i].m_phi);
366 std::string tagtag(tmptmp);
367 result->tags_[tagtag] = Allbins[
i].m_value;
374 if(count_red>0 || count_red_c>0) {
377 if (count_yellow>0||count_yellow_c>0) {
378 result->status_ = dqm_core::Result::Yellow;
382 if(count_red>=Nred_red){
384 }
else if (count_red>=Nred_yellow || count_yellow>=Nyellow_yellow || (count_red+count_yellow)>=Nredyellow_yellow){
385 result->status_ = dqm_core::Result::Yellow;