12 #include <dqm_core/AlgorithmConfig.h> 
   14 #include <dqm_core/Result.h> 
   18 #include <dqm_core/AlgorithmManager.h> 
   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());
 
   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" );
 
   89   Double_t 
inside = 
histo->Integral( minbin , maxbin );
 
   90   if ( UseUnderFlow ) 
tot+=
histo->GetBinContent(0);
 
   91   if ( UseOverFlow ) 
tot+=
histo->GetBinContent(
histo->GetNbinsX()+1);
 
   93   if ( !AbsoluteValue ) { 
 
   95     if (
tot > 0. || 
tot < 0.) {
 
   99   ERS_DEBUG(2,
"Total:"<<
tot<<
" SideBand:"<<sideband);
 
  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);
 
  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);
 
  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");
 
  133   std::stringstream 
msg;
 
  134   msg<<
m_name<<
": Checks the integral of a histogram outside a specified range ";
 
  135   if ( 
m_name==
"SideBand_Absolute" )
 
  136     msg<<
" using an absolute threshold.";
 
  138     msg<<
" using a relative threshold.";
 
  141       "Parameter: UseUnderFlow: if != 0 include also underflow bin\n" 
  142       "Parameter: UseOverFlow: if != 0 include also overflow bin\n" 
  143       "Parameter: Min: Specify Lower limit (unset means full range)\n" 
  144       "Parameter: Max: Specify Upper limit (unset means full range)\n" 
  145       "Threshold: Threshold: How large or small the sidebands should be.\n" 
  146       "    The comparison type (greater-than or less-than) depends on\n" 
  147       "    the relative order of the green and red threshold value." << std::endl;