51 {
52
53 dqm_core::Result*
result =
new dqm_core::Result();
54
55
56
57
58
59
61
62 if(
object.
IsA()->InheritsFrom(
"TH1" ) ) {
65 throw dqm_core::BadConfig( ERS_HERE, name, "dimension != 2 " );
66 }
67 } else {
68 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
69 }
70
71
72
73
74
75
76
77
78 double gthreshold;
79 double rthreshold;
80 try {
83 }
84 catch( dqm_core::Exception & ex ) {
85 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
86 }
87
88
89
90
91
92
93
99
100
102 if (
histogram->GetEntries() < minStat ) {
103 result->status_ = dqm_core::Result::Undefined;
105 }
106
107
110
111
112 std::vector<int>
range;
113 try{
115 }
116 catch( dqm_core::Exception & ex ) {
117 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
118 }
119
121
122
124
128 if (maxPublish > 999) maxPublish=999;
129
130
135
136
139 bool findBinsOverAvg = true;
140 bool findBinsUnderAvg = true;
141
142 if (!lessThan && greaterThan) {
143 findBinsUnderAvg = false;
144 }
145 else if (!greaterThan && lessThan) {
146 findBinsOverAvg = false;
147 }
148
149
150
151
153
154
156
157
159
160
161
162
164 if (minBinsBeforeSkimming < 3) {
165 if ( !testConsistencyWithErrors ) minBinsBeforeSkimming = 50;
166 else minBinsBeforeSkimming = 8;
167 }
168
170 if (minBinsAfterSkimming < 2) {
171 if ( !testConsistencyWithErrors ) minBinsAfterSkimming = 8;
172 else minBinsAfterSkimming = 3;
173 }
174
175
177
178
180
181
182
183
184
185
186
187
189
190
196
197
199config.getParameters(), 0.3);
201
202
203
204
205
206
209
210 int ismax = ixmax;
211 int inmax = iymax;
212 if( yStrips) {
213 ismax = iymax;
214 inmax = ixmax;
215 }
216
217
218
219 std::vector<double> xBinCenters;
220 std::vector<double> yBinCenters;
221 double * xBinEdges = new double[ixmax+1];
222 double * yBinEdges = new double[iymax+1];
223
224
225 xBinCenters.push_back(
histogram->GetXaxis()->GetBinLowEdge(range[0]) );
226 for (
int i = range[0];
i <=
range[1];
i++ ) {
227 xBinCenters.push_back(
histogram->GetXaxis()->GetBinCenter(i) );
229 }
230 xBinEdges[ixmax] =
histogram->GetXaxis()->GetBinUpEdge(range[1]);
231 xBinCenters.push_back( xBinEdges[ixmax] );
232
233
234 yBinCenters.push_back(
histogram->GetYaxis()->GetBinLowEdge(range[2]) );
235
236 for (
int j = range[2]; j <=
range[3]; j++ ) {
237 yBinCenters.push_back(
histogram->GetYaxis()->GetBinCenter(j) );
239 }
240 yBinEdges[iymax] =
histogram->GetYaxis()->GetBinUpEdge(range[3]);
241 yBinCenters.push_back( yBinEdges[iymax] );
242
243 double * sBinEdges = xBinEdges;
244 if( yStrips ) {
245 sBinEdges = yBinEdges;
246 }
247
248
249 TH2F* inputBins =
new TH2F(
"inputBins",
histogram->GetTitle(), ixmax, xBinEdges, iymax, yBinEdges);
250 TH2F* binwiseStatus =
new TH2F(
"binewiseStatus",
"BinsDiffByStrips Status Results per Bin", ixmax, xBinEdges,
251 iymax, yBinEdges);
252 TH2F* binDeviations =
new TH2F(
"binDeviations",
"Input bin content normalized by skimmed average and variance per strip",
253 ixmax, xBinEdges, iymax, yBinEdges);
254 TH1F* stripAverages =
new TH1F(
"stripAverages",
"Average Value from Cells in Strip After Removal of Outliers",
255 ismax, sBinEdges);
256 TH1F* stripVariances =
new TH1F(
"stripVariances",
"Standard Variance of Cells in Strip After Removal of Outliers",
257 ismax, sBinEdges);
258
259 delete[] xBinEdges;
260 delete[] yBinEdges;
261
262 double maxDeviation = 0;
263 std::vector <tools::binContainer> yellowBins;
264 std::vector <tools::binContainer> redBins;
265 int nBinsRed = 0;
266 int nBinsYellow = 0;
267 int nBinsGreen = 0;
268 int nBinsUndefined = 0;
269
270
271
272
273
274
275
276 std::vector<std::vector<tools::binContainer> > strips;
277
278std::vector<tools::binContainer> AllBinInOneStrip;
279double emptyBinCounter=0;
280int name_flag = 0;
281
282
283 for ( int is = 1; is <= ismax; is++ ) {
284 std::vector<tools::binContainer>
inputs;
285
286 int ix = is;
287 int iy = 1;
288 if ( yStrips ) {
289 iy = is;
290 ix = 1;
291 }
292 for ( int in = 1; in <= inmax; in++ ) {
293
294 if ( yStrips ) {
295 ix = in;
296 }
297 else {
298 iy = in;
299 }
300
301 int bin =
histogram->GetBin(ix + range[0]-1,iy + range[2]-1);
304 inputBins->SetBinContent(ix,iy,value);
305 inputBins->SetBinError(ix,iy,error);
306 if(value==0) emptyBinCounter++;
307tools::binContainer binContent_tmp = {
value,
error,1,ix,iy,xBinCenters[ix],yBinCenters[iy] };
308AllBinInOneStrip.push_back(binContent_tmp);
309 if( (value != ignoreValue) && (error > minError) ){
310 tools::binContainer binContent = {
value,
error,1,ix,iy,xBinCenters[ix],yBinCenters[iy] };
311
312 inputs.push_back(binContent);
313 }
314 else {
315 binwiseStatus->SetBinContent(ix,iy,dqm_core::Result::Disabled);
316 }
317 }
318
319
320
321 if( (!combineStripsBeforeSkimming) && ((
int)
inputs.size() < minBinsBeforeSkimming) ) {
322 nBinsUndefined +=
inputs.size();
323 }
324 else if(not
inputs.empty()) {
325 strips.push_back(std::move(inputs));
326 }
327 }
328
329
330 if( combineStripsBeforeSkimming ) {
332 }
333
334
335
336 std::vector<double> inputValues;
337 std::vector<double> inputErrors;
338 std::vector<double> stripAveragesVector;
339 std::vector<double> stripErrors;
340
341 std::vector<tools::binContainer> deviations;
342
343 for( std::vector<std::vector<tools::binContainer> >::iterator stripItr = strips.begin(); stripItr != strips.end(); ++stripItr ) {
344
345 if ( stripItr->empty() ) {
346 continue;
347 }
348
349
350 double stripAvg = 0;
351 double iScale = 0;
352 int nIn = 0;
353 int nTot = stripItr->size();
354 if( findOutliersUsingErrors ) {
356 }
357 else {
358 tools::findOutliers(*stripItr, stripAvg, iScale, nIn, nIter, iVarExp , iterThresh, isbf, ibc);
359 }
360
361
362
363
364
365
366 if ( (nIn < minBinsAfterSkimming) ) {
367 for (std::vector<tools::binContainer>::const_iterator it = stripItr->begin(); it != stripItr->end(); ++it) {
368 tools::binContainer deviationContainer = { 0, -3, -13,
it->ix,
it->iy,
it->x,
it->y };
369 deviations.push_back(deviationContainer);
370 }
371 continue;
372 }
373
374
375 double stripVariance = 0;
376 double stripVarianceError = 0;
377 double stripAvgError = 0;
378 double err2Sum = 0;
379
380 if( !useMeanErrorForScale ) {
381
382
383
384
385
386
388 double sumSquaredDiffFromAvg = 0;
389 double sumCompensator = 0;
390 double err2Diff2Sum = 0;
393 nIn = 0;
394
395
396 for (std::vector<tools::binContainer>::const_iterator it = stripItr->begin(); it != stripItr->end(); ++it) {
397
398
399
401 if( nIn == 0 ) {
404 }
407 nIn++;
408
409 double diffFromAvg =
it->value - stripAvg;
410 sumSquaredDiffFromAvg += std::pow( diffFromAvg, 2);
411 sumCompensator += ( diffFromAvg );
412
413
414 double inputErr2 = std::pow(
it->error,2.);
415 err2Sum += inputErr2;
416 err2Diff2Sum += inputErr2 * std::pow( diffFromAvg, 2);
417 }
418 }
419
420
422
423
424
425 double countingVariance = 0;
426 double countingWeight = 0;
427
428 if( (nTot != 0) && (range != 0) && ((nTot - nIn) != 0) ) {
429 double erfin = TMath::ErfInverse( (1.0 * nIn) / nTot );
430 double erfin2 = std::pow(erfin,2);
431
432 if( erfin2 != 0 ) {
433 countingVariance =
range / (erfin * 2 * std::sqrt(2));
434 countingWeight = 8 * std::pow(erfin2 / (range * std::exp(erfin2)),2) * std::pow(1.0 * nTot,3.) / (
M_PI * nIn * (nTot - nIn));
435 }
436 }
437
438
439 double boundedVariance = 0;
440 double boundedWeight = 0;
441 double sumWeights = 0;
442 if(nIn > 2) {
443 S2 = (sumSquaredDiffFromAvg - (std::pow(sumCompensator,2)/nIn) )/(nIn - 1);
444 boundedVariance = std::sqrt(
S2);
445 double boundEffect = 1;
446 double U = 0;
447 if( countingVariance != 0 ) {
448 U =
range / (2 * countingVariance);
449 }
450 else if( boundedVariance != 0 ) {
451 U =
range / (2 * boundedVariance);
452 }
453 if( U != 0 ) {
454 boundEffect = TMath::Erf( U / 2 ) ;
455 }
456 if(boundEffect != 0) {
457 boundedVariance = boundedVariance / boundEffect;
458 }
459 double boundedErr2 = 0;
461 boundedErr2 = ( std::pow( err2Diff2Sum / (std::pow(nIn-1,2.) *
S2), 2) + std::pow( boundedVariance*(1 - boundEffect)/2,2) );
462 }
463 if( boundedErr2 != 0 ) {
464 boundedWeight = 1/boundedErr2;
465 }
466 sumWeights = ( countingWeight + boundedWeight );
467 stripVariance = 0;
468 if(sumWeights != 0) {
469
470 stripVariance = (countingVariance * countingWeight + boundedVariance * boundedWeight ) / sumWeights;
471 if(stripVariance != 0 ) {
472 boundEffect = TMath::Erf( range / (4 * stripVariance) );
473 if( boundEffect != 0 ) {
474 boundedVariance = std::sqrt(
S2) / boundEffect;
475 boundedErr2 = ( std::pow( err2Diff2Sum / (std::pow(nIn-1,2.) *
S2), 2) + std::pow( boundedVariance*(1 - boundEffect)/2,2) );
476 }
477 }
478 }
479
480
481 }
482 else if ( iScale != 0 ){
483
484 boundedVariance = iScale;
485 boundedWeight = std::pow(iScale, -2);
486 }
487
488
489 sumWeights = ( countingWeight + boundedWeight );
490 stripVariance = 0;
491
492 if(sumWeights != 0) {
493 stripVariance = (countingVariance * countingWeight + boundedVariance * boundedWeight ) / sumWeights;
494 stripVarianceError = 1./std::sqrt(sumWeights);
495
496 }
497 }
498 else if (nIn > 2) {
499
500 for (std::vector<tools::binContainer>::const_iterator it = stripItr->begin(); it != stripItr->end(); ++it) {
501
502
504 err2Sum += std::pow(
it->error,2.);
505 }
506 }
507 stripVariance = std::sqrt( err2Sum / nIn );
508 stripVarianceError = stripVariance / std::sqrt( nIn );
509 }
510
511
512
513 stripAvgError = std::sqrt(err2Sum)/nIn;
514
515 int is = 0;
516 if (yStrips) {
517 is = stripItr->front().iy;
518 }
519 else {
520 is = stripItr->front().ix;
521 }
522
523
524 stripAverages->SetBinContent(is,stripAvg);
525 stripAverages->SetBinError(is,stripAvgError);
526 stripVariances->SetBinContent(is,stripVariance);
527 stripVariances->SetBinError(is,stripVarianceError);
528
529
530 if(doChiSquaredTest) {
531 for (std::vector<tools::binContainer>::const_iterator it = stripItr->begin(); it != stripItr->end(); ++it) {
532 inputValues.push_back(
it->value );
533 inputErrors.push_back( 0. );
534 stripAveragesVector.push_back( stripAvg );
535 stripErrors.push_back( stripVariance );
536 }
537 }
538
539
540 for (std::vector<tools::binContainer>::const_iterator it = stripItr->begin(); it != stripItr->end(); ++it) {
541 double deviation = 0;
542 double deviationError = -1;
543 double diffFromAvg =
it->value - stripAvg;
544
545
546 if(stripVariance > 0.00001){
547 deviation = diffFromAvg / stripVariance;
548 if ( nIn > 1 ) {
549 deviationError = sqrt( (( std::pow(
it->error,2) + std::pow(stripAvgError,2) ) / std::pow(stripVariance,2))
550 + ( std::pow(diffFromAvg,2) * std::pow(stripVarianceError,2) / std::pow(stripVariance,4)) );
551
552 }
553 }
554 else {deviation=0;
555 deviationError=0;
556 if( (
it->test==0) && (std::abs(
it->value)/std::abs(stripAvg)) > outstandingRatio ) {
557 name_flag = 1;
558 }
559 }
560 int binStatus = 0;
561 if ( std::abs(diffFromAvg) < (absDiffGreenThresh + std::sqrt(std::pow(
it->error,2) + (err2Sum/nIn))) ) {
562 binStatus = 3;
563 }
564
565 tools::binContainer deviationContainer = { deviation , deviationError, binStatus,
it->ix,
it->iy,
it->x,
it->y };
566 deviations.push_back(deviationContainer);
567
568 int bin = binDeviations->GetBin(
it->ix,
it->iy);
569 binDeviations->SetBinContent(bin,deviation);
570 binDeviations->SetBinError(bin,deviationError);
571 }
572 }
573
574
575
576 std::vector<tools::binCluster>
clusters;
577 std::vector<tools::binCluster> redClusters;
578 std::vector<tools::binCluster> yellowClusters;
579 if(clusterResults) {
580
581
583
584
585 std::vector<std::vector<tools::binContainer*> > binMap =
makeBinMap(deviations, ixmax, iymax, topology);
586
587 for (std::vector<tools::binContainer>::iterator it = deviations.begin(); it != deviations.end(); ++it) {
588 if( (
it->value > seedThreshold +
it->error) && !
it->test ) {
589 tools::binCluster cluster =
tools::buildCluster(*it,binMap,xBinCenters,yBinCenters,growthThreshold,topology);
590 if(cluster.n > 1) {
591
593 }
594 else {
595
597 }
598 }
599 }
600
601
602
603 for( std::vector<tools::binCluster>::const_iterator it =
clusters.begin(); it !=
clusters.end(); ++it) {
604 double fabsDeviation = std::abs(
it->value);
605 double significanceBound = sigmaThresh *
it->error;
606 bool overAvg = (
it->value >= 0 );
607 if ( (findBinsOverAvg && overAvg) || (findBinsUnderAvg && !overAvg) ) {
608 if ( fabsDeviation > (gthreshold + significanceBound) ) {
609 if ( fabsDeviation > (rthreshold + significanceBound) ) {
611 if (publish || publishRed) {
612 redClusters.push_back(*it);
613 }
614 continue;
615 }
616 nBinsYellow +=
it->n;
617 if (publish) {
618 yellowClusters.push_back(*it);
619 }
620 }
621 }
622 }
623 }
624
625 tools::binContainer maxDevBin = { 0, -999.9, 0, 0, 0, 0, 0 };
626
627
628 for (std::vector<tools::binContainer>::const_iterator it = deviations.begin(); it != deviations.end(); ++it) {
629 int bin = binwiseStatus->GetBin(
it->ix,
it->iy);
630
631 if (
it->error < 0 ) {
632 binwiseStatus->SetBinContent(bin,dqm_core::Result::Undefined);
633 nBinsUndefined++;
634 continue;
635 }
636
637 if (std::abs(
it->value) > std::abs(maxDeviation) ) {
638
639 maxDeviation =
it->value;
641 }
642
643 if (
it->test == 3 ) {
644 binwiseStatus->SetBinContent(bin,dqm_core::Result::Green);
645 nBinsGreen++;
646 continue;
647 }
648
649
650 double fabsDeviation = std::abs(
it->value);
651 double significanceBound = sigmaThresh *
it->error;
652
653
654 if ( fabsDeviation < (gthreshold - significanceBound ) ) {
655 binwiseStatus->SetBinContent(bin,dqm_core::Result::Green);
656 nBinsGreen++;
657 continue;
658 }
659 bool overAvg = (
it->value >= 0 );
660 if ( (findBinsOverAvg && overAvg) || (findBinsUnderAvg && !overAvg) ) {
661 if ( fabsDeviation > (gthreshold + significanceBound) ) {
662 if ( fabsDeviation > (rthreshold + significanceBound) ) {
663
664 binwiseStatus->SetBinContent(bin,dqm_core::Result::Red);
665
666
667 if(
it->test != 10 ) {
668
669 if (publish || publishRed) {
670 redBins.push_back( *it );
671 }
672 nBinsRed++;
673 }
674 continue;
675 }
676
677 binwiseStatus->SetBinContent(bin,dqm_core::Result::Yellow);
678
679 if(
it->test != 10 ) {
680 if (publish) {
681 yellowBins.push_back( *it );
682 }
683 nBinsYellow++;
684 }
685 continue;
686 }
687 }
688 binwiseStatus->SetBinContent(bin,dqm_core::Result::Undefined);
689 nBinsUndefined++;
690 }
691
692tools::binContainer onebin_my={0,0,0,0,0,0,0};
693tools::binContainer onebin_my_pre={0,0,0,0,0,0,0};
694double maxvalue_pre=-1;
695std::vector<tools::binContainer> topBinEntries;
696std::vector<tools::binContainer> topDeviations;
697double emptyRatio_this = emptyBinCounter/(
histogram->GetNbinsX()*
histogram->GetNbinsY());
698if (emptyRatio_this > emptyRatio) name_flag=1;
699if(name_flag==1){
700 int NTopEntries=0;
701 if(AllBinInOneStrip.size()>10 ) NTopEntries=10;
702 else NTopEntries = AllBinInOneStrip.size();
703 int AllBinInOneStrip_size = AllBinInOneStrip.size();
704 bool *bin_entries_status = new bool [AllBinInOneStrip_size];
705 for(
int i=0;
i< AllBinInOneStrip_size;
i++) bin_entries_status[i] =
true;
706 for(
int i=0;
i<NTopEntries;
i++){
707 double maxvalue=0;
709 int counter2=0;
710 for(std::vector<tools::binContainer>::const_iterator it =AllBinInOneStrip.begin();it!=AllBinInOneStrip.end();++it){
711 int flag_my =
i==0 || ( bin_entries_status[
counter] &&
it->value <= maxvalue_pre);
712 if(std::abs(
it->value) >= std::abs(maxvalue) && flag_my) {
713 maxvalue =
it->value;
716 }
718 }
719 bin_entries_status[counter2]=0;
720if (onebin_my.x!= onebin_my_pre.x||onebin_my.y!=onebin_my_pre.y) topBinEntries.push_back(onebin_my);
721 maxvalue_pre = maxvalue;
722 onebin_my_pre = onebin_my;
723 }
724 delete[] bin_entries_status;
725}
726else {
727 int NTopdeviation=0;
728 if(deviations.size()>5) NTopdeviation = 5;
729 else NTopdeviation = deviations.size();
730 int deviations_size = deviations.size();
731 bool *bin_dev_status = new bool [ deviations_size];
732 for(
int i=0;
i< deviations_size ;
i++) bin_dev_status[i] =
true;
733 for(
int i=0;
i<NTopdeviation;
i++){
734 double maxvalue=0;
736 int counter2=0;
737 if(deviations.size()!=0){
738 for (std::vector<tools::binContainer>::const_iterator it = deviations.begin(); it != deviations.end(); ++it){
739 int flag_my =
i==0 || ( bin_dev_status[
counter] &&
it->value <= maxvalue_pre);
740 if(std::abs(
it->value) >= std::abs(maxvalue) && flag_my) {
741 maxvalue =
it->value;
744 }
746 }
747 bin_dev_status[counter2]=0;
748 if (onebin_my.x!= onebin_my_pre.x||onebin_my.y!=onebin_my_pre.y) {
749 topDeviations.push_back(onebin_my);
750 maxvalue_pre = maxvalue;
751 onebin_my_pre = onebin_my;
752 }
753}
754
755 }
756 delete[] bin_dev_status;
757 }
758 if ( publish || publishRed) {
759
760 int objectsPublished = 0;
761 int clustersPublished = 0;
762
764 std::vector<tools::binCluster>::const_reverse_iterator rbcrbegin = redClusters.rbegin();
765 std::vector<tools::binCluster>::const_reverse_iterator rbcrend = redClusters.rend();
766 for (std::vector<tools::binCluster>::const_reverse_iterator it = rbcrbegin;
767 it != rbcrend; ++
it) {
768
769 if (objectsPublished < maxPublish) {
770 char ctag[256];
771 sprintf(ctag,
"C%.3i-R-%.3iBins@ Eta=(%+.3f_to_%+.3f) Phi=(%+.3f_to_%+.3f) Center=(%+.3f,%+.3f) Radius=%+.3f",clustersPublished,
it->n,
772 xBinCenters[
it->ixmin],xBinCenters[
it->ixmax],yBinCenters[
it->iymin],yBinCenters[
it->iymax],
it->x,
it->y,
it->radius);
773
774 std::string
tag = ctag;
775 int sizeDiff = 30 -
tag.size();
776 if( sizeDiff > 0 ) {
777 tag.append(sizeDiff,
'_');
778 }
779
781 clustersPublished++;
782 objectsPublished++;
783 }
784 }
785
786
787
788 int binsPublished = 0;
790
791 for ( std::vector<tools::binContainer>::const_reverse_iterator rIter = redBins.rbegin();
792 rIter != redBins.rend();
793 ++rIter) {
794 if (objectsPublished < maxPublish) {
795 char ctag[16];
796 sprintf(ctag,"%.3i-R-",binsPublished);
797 std::string
tag = ctag;
800 binsPublished++;
801 objectsPublished++;
802 }
803 else {
804 break;
805 }
806 }
807
808
809 if ( publish ) {
811 for ( std::vector<tools::binContainer>::const_reverse_iterator rIter = yellowBins.rbegin();
812 rIter != yellowBins.rend();
813 ++rIter) {
814 if (objectsPublished < maxPublish) {
815 char ctag[16];
816 sprintf(ctag,"%.3i-Y-",binsPublished);
817 std::string
tag = ctag;
820 binsPublished++;
821 objectsPublished++;
822
823 }
824 else {
825 break;
826 }
827 }
828 }
829
830 if ( publish ) {
832 for (std::vector<tools::binCluster>::const_reverse_iterator it = yellowClusters.rbegin();
833 it != yellowClusters.rend(); ++it) {
834 if (objectsPublished < maxPublish) {
835 char ctag[256];
836 sprintf(ctag,
"C%.3i-Y-%.3iBins@ Eta=(%+.3f_to_%+.3f) Phi=(%+.3f_to_%+.3f) Center=(%+.3f,%+.3f) Radius=%+.3f",clustersPublished,
it->n,
837 xBinCenters[
it->ixmin],xBinCenters[
it->ixmax],yBinCenters[
it->iymin],yBinCenters[
it->iymax],
it->x,
it->y,
it->radius);
838 std::string
tag = ctag;
839 int sizeDiff = 30 -
tag.size();
840 if( sizeDiff > 0 ) {
841 tag.append(sizeDiff,
'_');
842 }
844 clustersPublished++;
845 objectsPublished++;
846 }
847 }
848 }
849
850 }
851 result->tags_[
"NBins_RED"] = nBinsRed;
852 result->tags_[
"NBins_YELLOW"] = nBinsYellow;
853
854
855if(name_flag!=1){
856 for(
unsigned int i=0;
i<topDeviations.size();
i++){
857 if(topDeviations[i].error !=-999.9 ) {
859 sprintf(tmp,"MaxDeviation%u-",i);
860 std::string myString =
tmp;
862 result->tags_[myString] = topDeviations[
i].value;
863 }
864 }
865}
866if(name_flag==1) {
867 if( maxDevBin.error != -999.9 ) {
868 std::string devString = "MaxDeviation-";
870 result->tags_[devString] = maxDeviation;
871 }
872 for(
unsigned int i=0;
i<topBinEntries.size();
i++){
874 sprintf(tmp,"LeadingBinContents%u-",i);
875 std::string myString =
tmp;
877 result->tags_[myString] = topBinEntries[
i].value;
878 }
879}
880
881
882 result->tags_[
"Algorithm--BinsDiffByStrips"] = 5;
883
884
885
887 if( andGroup != -99999 ) {
888 result->tags_[
"AndGroup"] = andGroup;
889 }
890
891
892 TObjArray * resultList = new TObjArray(5,0);
893
894
895
896 resultList->Add(binwiseStatus);
897 resultList->Add(inputBins);
898 resultList->Add(binDeviations);
899 resultList->Add(stripAverages);
900 resultList->Add(stripVariances);
901
902 resultList->SetOwner(true);
903
904 result->object_ = boost::shared_ptr<TObject>(resultList);
905
906
907 if( doChiSquaredTest ) {
908
910 result->tags_[
"SigmaChiSq"] = chiSquareResult.second;
911
912 if ( testConsistencyWithErrors ) {
913
914 if ( chiSquareResult.second <= gthreshold ) {
915 result->status_ = dqm_core::Result::Green;
916 } else if ( chiSquareResult.second < rthreshold ) {
917 result->status_ = dqm_core::Result::Yellow;
918 } else {
919 result->status_ = dqm_core::Result::Red;
920 }
921
923 }
924 }
925
926
927 int nActiveBins = nBinsGreen + nBinsRed + nBinsYellow + nBinsUndefined;
928 if( nActiveBins != 0 ) {
929 if ( (nBinsRed >= nRedBinsToRedStatus) || ((nBinsRed * 1.0 / nActiveBins) > redFracToRedStatus) ) {
930 result->status_ = dqm_core::Result::Red;
931 }
932 else if ( ((nBinsRed + nBinsYellow) >= nYellowBinsToYellowStatus)
933 || ((static_cast<double>(nBinsRed + nBinsYellow) / nActiveBins) > yellowFracToYellowStatus) ) {
934 result->status_ = dqm_core::Result::Yellow;
935 }
936 else if ( (nBinsGreen * 1.0 / nActiveBins ) >= greenFracToGreenStatus ) {
937 result->status_ = dqm_core::Result::Green;
938 }
939 else {
940 result->status_ = dqm_core::Result::Undefined;
941 }
942 }
943 else {
944 result->status_ = dqm_core::Result::Disabled;
945 }
947}
struct TBPatternUnitContext S2
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
#define IsA
Declare the TObject style functions.