ATLAS Offline Software
Classes | Public Member Functions | List of all members
dqm_algorithms::BinsDiffFromStripMedianOnline Struct Reference

#include <BinsDiffFromStripMedianOnline.h>

Inheritance diagram for dqm_algorithms::BinsDiffFromStripMedianOnline:
Collaboration diagram for dqm_algorithms::BinsDiffFromStripMedianOnline:

Classes

class  binOnline
 
class  colorbinOnline
 
class  colorclusterOnline
 

Public Member Functions

 BinsDiffFromStripMedianOnline ()
 
 ~BinsDiffFromStripMedianOnline ()
 
BinsDiffFromStripMedianOnlineclone ()
 
dqm_core::Resultexecute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
 
void FindStripMedianOnline (const std::string &, std::vector< double > onestrip, std::vector< double > &stripsMedian)
 
void printDescription (std::ostream &out)
 
colorclusterOnline MakeClusterOnline (const std::string &name, const int r0, const int r2, binOnline &onebin, std::vector< std::vector< colorbinOnline > > &ColorBinMap)
 
void AddToList (const int r0, const int r2, int i, int j, std::vector< std::vector< colorbinOnline > > &ColorBinMap, std::vector< colorbinOnline > &LookAtList)
 
double CalEta (std::vector< colorbinOnline > &LookAtList)
 
double CalPhi (std::vector< colorbinOnline > &LookAtList)
 
double CalVal (std::vector< colorbinOnline > &LookAtList)
 
double CalR (std::vector< colorbinOnline > &LookAtList, double eta, double phi)
 

Detailed Description

Definition at line 25 of file BinsDiffFromStripMedianOnline.h.

Constructor & Destructor Documentation

◆ BinsDiffFromStripMedianOnline()

dqm_algorithms::BinsDiffFromStripMedianOnline::BinsDiffFromStripMedianOnline ( )

Definition at line 26 of file BinsDiffFromStripMedianOnline.cxx.

26  {
27  dqm_core::AlgorithmManager::instance().registerAlgorithm("BinsDiffFromStripMedianOnline", this);
28 }

◆ ~BinsDiffFromStripMedianOnline()

dqm_algorithms::BinsDiffFromStripMedianOnline::~BinsDiffFromStripMedianOnline ( )

Definition at line 30 of file BinsDiffFromStripMedianOnline.cxx.

30  {
31 }

Member Function Documentation

◆ AddToList()

void dqm_algorithms::BinsDiffFromStripMedianOnline::AddToList ( const int  r0,
const int  r2,
int  i,
int  j,
std::vector< std::vector< colorbinOnline > > &  ColorBinMap,
std::vector< colorbinOnline > &  LookAtList 
)

Definition at line 414 of file BinsDiffFromStripMedianOnline.cxx.

414  {
415 
416  if( i-r0<0 || i-r0>=(int)ColorBinMap.size()) return;
417  if( j-r2<0 || j-r2>=(int)ColorBinMap[i-r0].size() ) return;
418 
419  std::vector<colorbinOnline> tmp;
420 
421  if(i-1-r0>=0 && i-1-r0<(int)ColorBinMap.size()){
422  if(j-1-r2>=0 && j-1-r2<(int)ColorBinMap[i-1-r0].size()){
423  if(ColorBinMap[i-1-r0][j-1-r2].m_status==1){
424  tmp.push_back(ColorBinMap[i-1-r0][j-1-r2]);
425  ColorBinMap[i-1-r0][j-1-r2].m_status=0;
426  }
427  }
428  }
429  if(i-r0>=0 && i-r0<(int)ColorBinMap.size()){
430  if(j-1-r2>=0 && j-1-r2<(int)ColorBinMap[i-r0].size()){
431  if(ColorBinMap[i-r0][j-1-r2].m_status==1){
432  tmp.push_back(ColorBinMap[i-r0][j-1-r2]);
433  ColorBinMap[i-r0][j-1-r2].m_status=0;
434  }
435  }
436  }
437 
438  if(i+1-r0>=0 && i+1-r0<(int)ColorBinMap.size()){
439  if(j-1-r2>=0 && j-1-r2<(int)ColorBinMap[i+1-r0].size()){
440  if(ColorBinMap[i+1-r0][j-1-r2].m_status==1){
441  tmp.push_back(ColorBinMap[i+1-r0][j-1-r2]);
442  ColorBinMap[i+1-r0][j-1-r2].m_status=0;
443  }
444  }
445  }
446 
447  if(i-1-r0>=0 && i-1-r0<(int)ColorBinMap.size()){
448  if(j-r2>=0 && j-r2<(int)ColorBinMap[i-1-r0].size()){
449  if(ColorBinMap[i-1-r0][j-r2].m_status==1){
450  tmp.push_back(ColorBinMap[i-1-r0][j-r2]);
451  ColorBinMap[i-1-r0][j-r2].m_status=0;
452  }
453  }
454  }
455 
456 
457  if(i+1-r0>=0 && i+1-r0<(int)ColorBinMap.size()){
458  if(j-r2>=0 && j-r2<(int)ColorBinMap[i+1-r0].size()){
459  if(ColorBinMap[i+1-r0][j-r2].m_status==1){
460  tmp.push_back(ColorBinMap[i+1-r0][j-r2]);
461  ColorBinMap[i+1-r0][j-r2].m_status=0;
462  }
463  }
464  }
465 
466 
467  if(i-1-r0>=0 && i-1-r0<(int)ColorBinMap.size()){
468  if(j+1-r2>=0 && j+1-r2<(int)ColorBinMap[i-1-r0].size()){
469  if(ColorBinMap[i-1-r0][j+1-r2].m_status==1){
470  tmp.push_back(ColorBinMap[i-1-r0][j+1-r2]);
471  ColorBinMap[i-1-r0][j+1-r2].m_status=0;
472  }
473  }
474  }
475 
476  if(i-r0>=0 && i-r0<(int)ColorBinMap.size()){
477  if(j+1-r2>=0 && j+1-r2<(int)ColorBinMap[i-r0].size()){
478  if(ColorBinMap[i-r0][j+1-r2].m_status==1){
479  tmp.push_back(ColorBinMap[i-r0][j+1-r2]);
480  ColorBinMap[i-r0][j+1-r2].m_status=0;
481  }
482  }
483  }
484 
485  if(i+1-r0>=0 && i+1-r0<(int)ColorBinMap.size()){
486  if(j+1-r2>=0 && j+1-r2<(int)ColorBinMap[i+1-r0].size()){
487  if(ColorBinMap[i+1-r0][j+1-r2].m_status==1){
488  tmp.push_back(ColorBinMap[i+1-r0][j+1-r2]);
489  ColorBinMap[i+1-r0][j+1-r2].m_status=0;
490  }
491  }
492  }
493 
494  for(unsigned int k=0;k<tmp.size();k++){
495  if(tmp[k].m_color!=green){
496  LookAtList.push_back(tmp[k]);
497  AddToList(r0,r2,tmp[k].m_ix,tmp[k].m_iy,ColorBinMap,LookAtList);
498  }
499  }
500  return;
501 
502 }

◆ CalEta()

double dqm_algorithms::BinsDiffFromStripMedianOnline::CalEta ( std::vector< colorbinOnline > &  LookAtList)

Definition at line 504 of file BinsDiffFromStripMedianOnline.cxx.

504  {
505  double sumEta=0;
506  double sumN=0;
507  for(unsigned int i=0;i<LookAtList.size();i++){
508  double eta = LookAtList[i].m_eta;
509  double n = LookAtList[i].m_value;
510  sumEta += n*eta;
511  sumN +=n;
512  }
513  if(sumN!=0){
514  return sumEta/sumN;
515  }else{
516  return -99.;
517  }
518 }

◆ CalPhi()

double dqm_algorithms::BinsDiffFromStripMedianOnline::CalPhi ( std::vector< colorbinOnline > &  LookAtList)

Definition at line 520 of file BinsDiffFromStripMedianOnline.cxx.

520  {
521  double sumPhi=0;
522  double sumN=0;
523  for(unsigned int i=0;i<LookAtList.size();i++){
524  double phi = LookAtList[i].m_phi;
525  double n = LookAtList[i].m_value;
526  sumPhi += n*phi;
527  sumN +=n;
528  }
529  if(sumN!=0){
530  return sumPhi/sumN;
531  }else{
532  return -99.;
533  }
534 }

◆ CalR()

double dqm_algorithms::BinsDiffFromStripMedianOnline::CalR ( std::vector< colorbinOnline > &  LookAtList,
double  eta,
double  phi 
)

Definition at line 544 of file BinsDiffFromStripMedianOnline.cxx.

544  {
545  if(LookAtList.size()<2) return 0;
546  double maxR=0;
547  for(unsigned int i=0;i<LookAtList.size();i++){
548  double distance = std::sqrt(std::pow((LookAtList[i].m_eta-eta),2)+std::pow((LookAtList[i].m_phi-phi),2));
549  maxR=distance>maxR?distance:maxR;
550  }
551  return maxR;
552 }

◆ CalVal()

double dqm_algorithms::BinsDiffFromStripMedianOnline::CalVal ( std::vector< colorbinOnline > &  LookAtList)

Definition at line 536 of file BinsDiffFromStripMedianOnline.cxx.

536  {
537  double sumN=0;
538  for(unsigned int i=0;i<LookAtList.size();i++){
539  double n = LookAtList[i].m_value;
540  sumN += n;
541  }
542  return sumN;
543 }

◆ clone()

dqm_algorithms::BinsDiffFromStripMedianOnline * dqm_algorithms::BinsDiffFromStripMedianOnline::clone ( )

Definition at line 33 of file BinsDiffFromStripMedianOnline.cxx.

33  {
34  return new BinsDiffFromStripMedianOnline();
35 }

◆ execute()

dqm_core::Result * dqm_algorithms::BinsDiffFromStripMedianOnline::execute ( const std::string &  name,
const TObject &  object,
const dqm_core::AlgorithmConfig &  config 
)

Definition at line 38 of file BinsDiffFromStripMedianOnline.cxx.

40  {
41  const TH1* histogram;
42 
43  if( object.IsA()->InheritsFrom( "TH1" ) ) {
44  histogram = static_cast<const TH1*>(&object);
45  if (histogram->GetDimension() > 2 ){
46  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
47  }
48  } else {
49  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
50  }
51 
52  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
53  const double minstatperstrip = dqm_algorithms::tools::GetFirstFromMap( "MinStatPerstrip", config.getParameters(), -1);
54  const double ignoreval1 = dqm_algorithms::tools::GetFirstFromMap( "ignoreval1", config.getParameters(), -99999);
55  const double ignoreval2 = dqm_algorithms::tools::GetFirstFromMap( "ignoreval2", config.getParameters(), 0.);
56  const bool publish = (bool) dqm_algorithms::tools::GetFirstFromMap( "PublishBins", config.getParameters(), 1);
57  const int Nmaxpublish = (int) dqm_algorithms::tools::GetFirstFromMap( "MaxPublish", config.getParameters(), 20);
58  const bool VisualMode = (bool) dqm_algorithms::tools::GetFirstFromMap( "VisualMode", config.getParameters(), 1);
59  const int NpublishRed = (int) dqm_algorithms::tools::GetFirstFromMap( "PublishRedBins",config.getParameters(), 0);
60  const bool ClusterResult = (bool) dqm_algorithms::tools::GetFirstFromMap( "ClusterResult", config.getParameters(), 0);
61  const double suppressFactor = dqm_algorithms::tools::GetFirstFromMap("SuppressFactor", config.getParameters(), 0.05);
62  const double suppressRedFactor = dqm_algorithms::tools::GetFirstFromMap("SuppressRedFactor", config.getParameters(), 0.01);
63  const bool OnlineMode = (bool) dqm_algorithms::tools::GetFirstFromMap( "OnlineMode", config.getParameters(), 0);
64  const double Nred_red = (double) dqm_algorithms::tools::GetFirstFromMap( "Nred_red", config.getParameters(), 5.);
65  const double Nred_yellow = (double) dqm_algorithms::tools::GetFirstFromMap( "Nred_yellow", config.getParameters(), 3.);
66  const double Nyellow_yellow = (double) dqm_algorithms::tools::GetFirstFromMap( "Nyellow_yellow", config.getParameters(), 5.);
67  const double Nredyellow_yellow = (double) dqm_algorithms::tools::GetFirstFromMap( "Nredyellow_yellow", config.getParameters(), 4.);
68 
69  if ( histogram->GetEntries() < minstat ) {
71  result->tags_["InsufficientEntries"] = histogram->GetEntries();
72  return result;
73  }
74 
75  double gthreshold;
76  double rthreshold;
77  try {
78  rthreshold = dqm_algorithms::tools::GetFromMap( "MaxDeviation", config.getRedThresholds() );
79  gthreshold = dqm_algorithms::tools::GetFromMap( "MaxDeviation", config.getGreenThresholds() );
80  }catch( dqm_core::Exception & ex ) {
81  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
82  }
83 
84  std::vector<int> range=dqm_algorithms::tools::GetBinRange(histogram, config.getParameters());
85  std::vector<double> stripsSize;
86  std::vector<double> stripsMedian;
87  std::vector<double> stripsAvg;
88  std::vector<double> stripsVariance;
89  double maxInMap=0;
90 
91  if ( (int)range.size() < 4 ){
92  throw dqm_core::BadConfig( ERS_HERE, name, "BinRange vector <4 " );
93  }
94 
95  for ( int i = range[0]; i <= range[1]; ++i ) {
96  std::vector<double> onestrip;
97  double stripSum=0;
98  for ( int j = range[2]; j <= range[3]; ++j ) {
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) {
104  maxInMap = binvalue;
105  }
106  }
107  if(onestrip.size()!=0 ) {
108  stripsAvg.push_back(stripSum/onestrip.size());
109  }else {
110  stripsAvg.push_back(0);
111  }
112  FindStripMedianOnline(name,onestrip,stripsMedian);
113  stripsSize.push_back(onestrip.size());
114 
115  float sumdiff2=0;
116  int counter=0;
117  if ((int)stripsAvg.size() <= i-range[0] ){
118  throw dqm_core::BadConfig( ERS_HERE, name, "out of stripsAvg range " );
119  }
120  float strip_avg = stripsAvg[i-range[0]];
121 
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;
126  sumdiff2 +=std::pow(diff,2);
127  counter++;
128  }
129  double variance=-1;
130  if(counter!=0) variance = sumdiff2 / counter ;
131  stripsVariance.push_back(variance);
132  }
133 
135  std::vector<binOnline> redbins;
136  std::vector<binOnline> yellowbins;
137  std::vector<binOnline> Allbins;
138  int limit = range[1]-range[0];
139  for ( int q=0; q <= limit; ++q ) {
140  int k=q+range[0];
141  if ((int)stripsSize.size() <= q ){
142  throw dqm_core::BadConfig( ERS_HERE, name, "out of stripsSize range " );
143  }
144  if(stripsSize[q]<minstatperstrip) continue;
145  if ((int)stripsMedian.size() <= q ){
146  throw dqm_core::BadConfig( ERS_HERE, name, "out of stripsMedian range " );
147  }
148  if ((int)stripsVariance.size() <= q){
149  throw dqm_core::BadConfig( ERS_HERE, name, "out of stripsVariance range " );
150  }
151  if ((int)stripsAvg.size() <= q ){
152  throw dqm_core::BadConfig( ERS_HERE, name, "out of stripsAvg range " );
153  }
154  double strip_median = stripsMedian[q];
155  double strip_variance = stripsVariance[q];
156  double strip_avg = stripsAvg[q];
157 
158  if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)<0.0001){
159  continue; // skip empty strip
160  }else {
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;
163  } else{
164  if(std::abs(strip_median)<0.0001 && std::abs(strip_variance)>0.0001 && std::abs(strip_avg)<0.0001) continue;
165  }
166  }
167 
168 
169  for ( int l = range[2]; l <= range[3]; ++l ) {
170  double binvalue = histogram->GetBinContent(k,l);
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*/ (binvalue-strip_median)/std::sqrt(std::abs(strip_median));
175  }else{
176  continue;
177  }
178  double eta = histogram->GetXaxis()->GetBinCenter(k);
179  double phi = histogram->GetYaxis()->GetBinCenter(l);
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) ){
184  continue;
185  }
186  redbins.push_back(onebin);
187  }else if(std::abs(outstandingRatio) > gthreshold ){
188  if( VisualMode && (binvalue / maxInMap < suppressFactor) ){
189  continue;
190  }
191  yellowbins.push_back(onebin);
192  }
193  }
194  }
195  int count_red_c = 0;
196  int count_yellow_c = 0;
197  std::vector<std::vector<colorbinOnline> > ColorBinMap;
198  if(ClusterResult){
199  // initialize ColorBinMap
200  int limit = range[1]-range[0];
201  for ( int q = 0; q <= limit; ++q ) {
202  int k =q+range[0];
203  std::vector<colorbinOnline> oneColorStrip;
204  for ( int l = range[2]; l <= range[3]; ++l ) {
205  colorbinOnline oneColorBin = {-1,-1,k,l,-1,green,1};
206  oneColorStrip.push_back(oneColorBin);
207  }
208  ColorBinMap.push_back(oneColorStrip);
209  }
210 
211  // map redbins and yellowbins to ColorBinMap
212  for(unsigned int i=0;i<redbins.size();i++){
213 
214  int q=redbins[i].m_ix - range[0];
215  int p = redbins[i].m_iy-range[2];
216 
217  if ((int)ColorBinMap.size() <= q){
218  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
219  }
220 
221  if ((int)ColorBinMap[q].size() <= p ){
222  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
223  }
224 
225  ColorBinMap[q][p].m_eta = redbins[i].m_eta;
226 
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;
230 
231  }
232 
233 
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];
237 
238  if ((int)ColorBinMap.size() <= q ){
239  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
240  }
241 
242  if ((int)ColorBinMap[q].size() <= p ){
243  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
244  }
245 
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;
249  ColorBinMap[q][p].m_color = yellow;
250  }
251 
252 
253  // cluster bad bins
254  std::vector<colorclusterOnline > clusterArray;
255  for(unsigned int i=0;i<redbins.size();i++){
256 
257  int q=redbins[i].m_ix - range[0];
258  int p = redbins[i].m_iy-range[2];
259 
260  if ((int)ColorBinMap.size() <= q ){
261  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
262  }
263 
264  if ((int)ColorBinMap[q].size() <= p ){
265  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
266  }
267 
268  if(ColorBinMap[q][p].m_color != green){
269  colorclusterOnline onecluster = MakeClusterOnline(name,range[0],range[2],redbins[i],ColorBinMap);
270  if((int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
271  }
272  }
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];
276 
277  if ((int)ColorBinMap.size() <= q ){
278  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
279  }
280 
281  if ((int)ColorBinMap[q].size() <= p ){
282  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
283  }
284 
285  if(ColorBinMap[q][p].m_color != green){
286  colorclusterOnline onecluster = MakeClusterOnline(name,range[0],range[2],yellowbins[i],ColorBinMap);
287  if((int)onecluster.m_size > 1) clusterArray.push_back(onecluster);
288  }
289  }
290 
291  // publish clusters here:
292  for(unsigned int i=0;i<clusterArray.size();i++){
293  char tmp[500]{};
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);
296  count_red_c++;
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);
299  count_yellow_c++;
300  }
301  std::string tag(tmp);
302  result->tags_[tag] = clusterArray[i].m_value;
303  }
304  result->tags_["NRedClusters"] = count_red_c;
305  result->tags_["NYellowClusters"] = count_yellow_c;
306 
307  }
308 
309  std::sort(redbins.begin(),redbins.end());
310  std::sort(yellowbins.begin(),yellowbins.end());
311  std::sort(Allbins.begin(),Allbins.end());
312  // publish red bins
313  int count_red=0;
314  for(unsigned int i=0;i<redbins.size();i++){
315 
316  int q = redbins[i].m_ix-range[0];
317  int p = redbins[i].m_iy-range[2];
318 
319  if(ClusterResult){
320  if(q<(int)ColorBinMap.size()){
321  if(p<(int)ColorBinMap[q].size()){
322  if( ColorBinMap[q][p].m_status==0 ) continue;
323  }
324  }
325  }
326 
327  if(publish){
328  char tmp[500]{};
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);
330  std::string tag(tmp);
331  result->tags_[tag] = redbins[i].m_value;
332  }
333  count_red++;
334  if(NpublishRed > 0){
335  if(count_red > NpublishRed) break;
336  }
337  }
338 
339  // publish yellow bins
340  int count_yellow=0;
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];
344 
345  if(ClusterResult){
346  if(q<(int)ColorBinMap.size()){
347  if(p<(int)ColorBinMap[q].size()){
348  if(ColorBinMap[q][p].m_status==0) continue;
349  }
350  }
351  }
352  if(publish && (count_red+count_yellow) < Nmaxpublish ){
353  char tmp[500]{};
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);
355  std::string tag(tmp);
356  result->tags_[tag] = yellowbins[i].m_value;
357  }
358  count_yellow++;
359  }
360  result->tags_["NRedBins"] = count_red; // count_red is the number of red bins printed
361  result->tags_["NYellowBins"] = count_yellow; // count_yellow is the number of yellow bins printed
362 
363  if(count_red+count_yellow==0 && (int)Allbins.size()>=5 ){
364  for(int i=0;i<5;i++){
365  char tmptmp[500]{};
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;
369  }
370 
371  }
372 
373 
374  if(!OnlineMode){
375  if(count_red>0 || count_red_c>0) {
376  result->status_ = dqm_core::Result::Red;
377  } else {
378  if (count_yellow>0||count_yellow_c>0) {
379  result->status_ = dqm_core::Result::Yellow;
380  } else { result->status_ = dqm_core::Result::Green; }
381  }
382  } else {
383  if(count_red>=Nred_red){
384  result->status_ = dqm_core::Result::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;
387  }else{
388  result->status_ = dqm_core::Result::Green;
389  }
390  }
391 
392  return result;
393 
394 }

◆ FindStripMedianOnline()

void dqm_algorithms::BinsDiffFromStripMedianOnline::FindStripMedianOnline ( const std::string &  name,
std::vector< double >  onestrip,
std::vector< double > &  stripsMedian 
)

Definition at line 396 of file BinsDiffFromStripMedianOnline.cxx.

396  {
397  double median=0;
398 
399  std::sort(onestrip_tmp.begin(),onestrip_tmp.end());
400  int index1=(int)(onestrip_tmp.size()/4.);
401 
402  int index2=(int)(onestrip_tmp.size()/2.);
403  int index3=(int) (3.*onestrip_tmp.size()/4.);
404  if(onestrip_tmp.size()>0){
405  if ((int)onestrip_tmp.size() <= index1 || (int)onestrip_tmp.size() <= index2 || (int)onestrip_tmp.size() <= index3){
406  throw dqm_core::BadConfig( ERS_HERE, name, "out of onestrip_tmp range " );
407  }
408 
409  median = (onestrip_tmp[index1]+onestrip_tmp[index2]+onestrip_tmp[index3])/3.0;
410  }
411  stripsMedian.push_back(median);
412 }

◆ MakeClusterOnline()

dqm_algorithms::BinsDiffFromStripMedianOnline::colorclusterOnline dqm_algorithms::BinsDiffFromStripMedianOnline::MakeClusterOnline ( const std::string &  name,
const int  r0,
const int  r2,
binOnline onebin,
std::vector< std::vector< colorbinOnline > > &  ColorBinMap 
)

Definition at line 555 of file BinsDiffFromStripMedianOnline.cxx.

555  {
556  colorclusterOnline onecluster={0,0,0,0,green,-1};
557 
558  if ((int)ColorBinMap.size() <= (onebin.m_ix-r0) ){
559  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
560  }
561 
562  if ((int)ColorBinMap[onebin.m_ix-r0].size() <= (onebin.m_iy-r2) ){
563  throw dqm_core::BadConfig( ERS_HERE, name, "out of ColorBinMap range " );
564  }
565 
566  if(ColorBinMap[onebin.m_ix-r0][onebin.m_iy-r2].m_status==0)
567  return onecluster;
568  std::vector<colorbinOnline> LookAtList;
569  if(ColorBinMap[onebin.m_ix-r0][onebin.m_iy-r2].m_color!=green){
570  LookAtList.push_back(ColorBinMap[onebin.m_ix-r0][onebin.m_iy-r2]);
571  ColorBinMap[onebin.m_ix-r0][onebin.m_iy-r2].m_status=0;
572  AddToList(r0,r2,onebin.m_ix,onebin.m_iy,ColorBinMap, LookAtList);
573  if(LookAtList.size()>1){
574  onecluster.m_size = LookAtList.size();
575  onecluster.m_value = CalVal(LookAtList);
576  if(ColorBinMap[onebin.m_ix-r0][onebin.m_iy-r2].m_color==red){
577  onecluster.m_color = red;
578  }else{
579  onecluster.m_color = yellow;
580  }
581  onecluster.m_eta = CalEta(LookAtList);
582  onecluster.m_phi = CalPhi(LookAtList);
583  onecluster.m_radius = CalR(LookAtList,onecluster.m_eta,onecluster.m_phi);
584  } else {
585  ColorBinMap[onebin.m_ix-r0][onebin.m_iy-r2].m_status=1;
586  }
587  }
588  return onecluster;
589 }

◆ printDescription()

void dqm_algorithms::BinsDiffFromStripMedianOnline::printDescription ( std::ostream &  out)

Definition at line 591 of file BinsDiffFromStripMedianOnline.cxx.

591  {
592 
593  out<<"BinsDiffFromStripMedianOnline: Calculates smoothed strip median and then find out bins which are aliens "<<std::endl;
594 
595  out<<"Mandatory Green/Red Threshold is the value of outstandingRatio=(bin value)/(strip median) based on which to give Green/Red result\n"<<std::endl;
596 
597  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
598  out<<"Optional Parameter: MinStatPerstrip: Minimum strip statistics needed to perform Algorithm"<<std::endl;
599  out<<"Optional Parameter: ignoreval0: values to be ignored for being processed"<<std::endl;
600  out<<"Optional Parameter: ignoreval1: values to be ignored for being processed"<<std::endl;
601  out<<"Optional Parameter: PublishBins: Save bins which are different from average in Result (on:1,off:0,default is 1)"<<std::endl;
602  out<<"Optional Parameter: MaxPublish: Max number of bins to save (default 20)"<<std::endl;
603  out<<"Optional Parameter: VisualMode: is to make the evaluation process similar to the shift work, so one will get resonable result efficiently."<<std::endl;
604 
605  out<<"Optional Parameter: PublishRedBins: Max number of red bins to save."<<std::endl;
606  out<<"Optional Parameter: ClusterResult: to cluster close bad bins together."<<std::endl;
607  out<<"Optional Parameter: SuppressFactor: if the ratio of the bin contennt to max one in the histogram is smaller than SuppressFactor, don't set the bin as red or yellow ."<<std::endl;
608  out<<"Optional Parameter: SuppressRedFactor: if the ratio of the bin contennt to max one in the histogram is smaller than SuppressRedFactor, don't set the bin as red ."<<std::endl;
609  out<<"Optional Parameter: OnlineMode: switch on when running online."<<std::endl;
610  out<<"Optional Parameter: Nred_red: minimum number of red bins needed to label the histogram as red."<<std::endl;
611  out<<"Optional Parameter: Nyellow_yellow: minimum number of yellow bins needed to label the histogram as yellow."<<std::endl;
612  out<<"Optional Parameter: Nred_yellow: minimum number of red bins needed to label the histogram as yellow."<<std::endl;
613  out<<"Optional Parameter: Nredyellow_yellow: minimum number of yellow+red bins needed to label the histogram as yellow."<<std::endl;
614 
615 }

The documentation for this struct was generated from the following files:
dqm_algorithms::tools::GetBinRange
std::vector< int > GetBinRange(const TH1 *histogram, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:380
dqm_algorithms::BinsDiffFromStripMedianOnline::AddToList
void AddToList(const int r0, const int r2, int i, int j, std::vector< std::vector< colorbinOnline > > &ColorBinMap, std::vector< colorbinOnline > &LookAtList)
Definition: BinsDiffFromStripMedianOnline.cxx:414
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
dqm_algorithms::BinsDiffFromStripMedianOnline::FindStripMedianOnline
void FindStripMedianOnline(const std::string &, std::vector< double > onestrip, std::vector< double > &stripsMedian)
Definition: BinsDiffFromStripMedianOnline.cxx:396
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
InDet::median
float median(std::vector< float > &Vec)
Definition: BTagVrtSec.cxx:35
dqm_algorithms::BinsDiffFromStripMedianOnline::MakeClusterOnline
colorclusterOnline MakeClusterOnline(const std::string &name, const int r0, const int r2, binOnline &onebin, std::vector< std::vector< colorbinOnline > > &ColorBinMap)
Definition: BinsDiffFromStripMedianOnline.cxx:555
MCP::ScaleSmearParam::r2
@ r2
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
Trk::index3
@ index3
Definition: BoundarySurfaceFace.h:50
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
dqm_algorithms::BinsDiffFromStripMedianOnline::CalVal
double CalVal(std::vector< colorbinOnline > &LookAtList)
Definition: BinsDiffFromStripMedianOnline.cxx:536
Trk::index1
@ index1
Definition: BoundarySurfaceFace.h:48
yellow
@ yellow
Definition: BinsDiffFromStripMedian.h:18
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
TRT_PAI_physicsConstants::r0
const double r0
electron radius{cm}
Definition: TRT_PAI_physicsConstants.h:20
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.handimod.Green
int Green
Definition: handimod.py:524
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
python.handimod.Red
Red
Definition: handimod.py:551
Trk::index2
@ index2
Definition: BoundarySurfaceFace.h:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
green
@ green
Definition: BinsDiffFromStripMedian.h:18
dqm_algorithms::BinsDiffFromStripMedianOnline::CalEta
double CalEta(std::vector< colorbinOnline > &LookAtList)
Definition: BinsDiffFromStripMedianOnline.cxx:504
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
extractSporadic.q
list q
Definition: extractSporadic.py:98
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
pickleTool.object
object
Definition: pickleTool.py:30
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
dqm_algorithms::BinsDiffFromStripMedianOnline::CalR
double CalR(std::vector< colorbinOnline > &LookAtList, double eta, double phi)
Definition: BinsDiffFromStripMedianOnline.cxx:544
test_pyathena.counter
counter
Definition: test_pyathena.py:15
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
dqm_algorithms::BinsDiffFromStripMedianOnline::BinsDiffFromStripMedianOnline
BinsDiffFromStripMedianOnline()
Definition: BinsDiffFromStripMedianOnline.cxx:26
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
updateCoolNtuple.limit
int limit
Definition: updateCoolNtuple.py:45
red
@ red
Definition: BinsDiffFromStripMedian.h:18
histogram
std::string histogram
Definition: chains.cxx:52
fitman.k
k
Definition: fitman.py:528
dqm_algorithms::BinsDiffFromStripMedianOnline::CalPhi
double CalPhi(std::vector< colorbinOnline > &LookAtList)
Definition: BinsDiffFromStripMedianOnline.cxx:520