36 const dqm_core::AlgorithmConfig &
config )
39 if ( obj.IsA()->InheritsFrom(
"TH2") || obj.IsA()->InheritsFrom(
"TH3") )
41 throw dqm_core::BadConfig( ERS_HERE , name ,
" dimension > 1 ");
43 if ( obj.IsA()->InheritsFrom(
"TH1") )
45 ERS_DEBUG(2,
"Got TH1 called: "<<obj.GetName()<<
" of type:"<<obj.IsA()->GetName());
46 histo=
static_cast<const TH1*
>(&obj);
50 throw dqm_core::BadConfig( ERS_HERE ,name ,
" does not inherit from TH1");
56 const double notFound = -99999;
59 const int minbin = (
xmin == notFound) ? 1 : histo->GetXaxis()->FindBin(
xmin);
60 const int maxbin = (
xmax == notFound) ? histo->GetNbinsX() : histo->GetXaxis()->FindBin(
xmax);
68 catch ( dqm_core::Exception & ex )
70 throw dqm_core::BadConfig(ERS_HERE,name,
"Paramter: 'Threshold' is mandatory, cannot continue");
73 if (
m_name==
"SideBand_Relative" && (grThr>1.0 || reThr>1.0) )
76 throw dqm_core::BadConfig(ERS_HERE,
m_name,
"Configuration Error: Threshold>100%");
79 std::stringstream configuration;
81 <<
" - UseUnderFlow = " << UseUnderFlow <<
" - UseOverFlow = " << UseOverFlow
82 <<
" - Min = " <<
xmin <<
" - Max = " <<
xmax
83 <<
" - Green Threshold = " << grThr <<
" - Red Threshold = " << reThr;
84 ERS_DEBUG(2,
"Configuration:"<<configuration.str());
87 const bool AbsoluteValue = (
m_name ==
"SideBand_Absolute" );
88 Double_t tot = histo->Integral( 1, histo->GetNbinsX() );
89 Double_t inside = histo->Integral( minbin , maxbin );
90 if ( UseUnderFlow ) tot+=histo->GetBinContent(0);
91 if ( UseOverFlow ) tot+=histo->GetBinContent(histo->GetNbinsX()+1);
92 Double_t sideband = tot-inside;
93 if ( !AbsoluteValue ) {
95 if (tot > 0. || tot < 0.) {
99 ERS_DEBUG(2,
"Total:"<<tot<<
" SideBand:"<<sideband);
100 dqm_core::Result *
result =
new dqm_core::Result;
101 result->tags_.insert(std::make_pair(
"TotalIntegral",tot));
102 result->tags_.insert(std::make_pair(
"SideBands",sideband));
106 if ( sideband>reThr ){
107 ERS_DEBUG(1,
"[RED] Result : "<<sideband);
108 result->status_=dqm_core::Result::Red;
110 }
else if ( sideband > grThr ){
111 ERS_DEBUG(1,
"[YELLOW] Result : "<<sideband);
112 result->status_=dqm_core::Result::Yellow;
116 if ( sideband < reThr ){
117 ERS_DEBUG(1,
"[RED] Result : "<<sideband);
118 result->status_=dqm_core::Result::Red;
120 }
else if ( sideband < grThr ){
121 ERS_DEBUG(1,
"[YELLOW] Result : "<<sideband);
122 result->status_=dqm_core::Result::Yellow;
127 ERS_DEBUG(1,
"[GREEN] Result");
128 result->status_=dqm_core::Result::Green;