9 #include <dqm_core/AlgorithmConfig.h>
17 #include <dqm_core/AlgorithmManager.h>
41 const TObject &
object,
42 const dqm_core::AlgorithmConfig &
config )
49 if(
object.
IsA()->InheritsFrom(
"TH1" )) {
52 throw dqm_core::BadConfig( ERS_HERE,
name,
"dimension > 2 " );
55 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
67 refhist =
dynamic_cast<const TH1*
>(
config.getReference() );
69 catch ( dqm_core::Exception & ex ) {
70 throw dqm_core::BadRefHist(ERS_HERE,
name,
" Could not retreive reference");
74 throw dqm_core::BadRefHist(ERS_HERE,
name,
"Reference is not a histogram");
77 if (
histogram->GetDimension() != refhist->GetDimension() ) {
78 throw dqm_core::BadRefHist( ERS_HERE,
name,
"Dimension" );
81 if ((
histogram->GetNbinsX() != refhist->GetNbinsX()) || (
histogram->GetNbinsY() != refhist->GetNbinsY())) {
82 throw dqm_core::BadRefHist( ERS_HERE,
name,
"number of bins" );
85 if (
histogram->GetDimension()==2 && (m_name==
"MaxDist" || m_name==
"MaxDistPlustNorm")){
86 throw dqm_core::BadConfig( ERS_HERE,
name,
"MaxDist option cannot be used on 2D histograms" );
92 if (m_name ==
"Prob") {
95 }
else if (m_name ==
"MaxDist") {
98 }
else if (m_name ==
"Norm") {
101 }
else if (m_name ==
"MaxDistPlusNorm") {
105 throw dqm_core::BadConfig( ERS_HERE,
"None", m_name );
112 catch ( dqm_core::Exception & ex ) {
113 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
117 double value =
histogram->KolmogorovTest( refhist, option.c_str());
119 ERS_DEBUG(1,
"Kolmogorov Test with Option " << m_name <<
" is " <<
value );
120 ERS_DEBUG(1,
"Green threshold: "<< gthresho <<
"; Red threshold: " << rthresho );
125 if (
value >= gthresho ) {
127 }
else if (
value > rthresho ) {
128 result->status_ = dqm_core::Result::Yellow;
133 if (
value <= gthresho ) {
135 }
else if (
value < rthresho ) {
136 result->status_ = dqm_core::Result::Yellow;
148 if (m_name ==
"Prob") {
151 }
else if (m_name ==
"MaxDist") {
154 }
else if (m_name ==
"Norm") {
157 }
else if (m_name ==
"MaxDistPlusNorm") {
162 if (m_name ==
"Norm" || m_name ==
"Prob") {
163 out<<
"KolmogorovTest_"+ m_name+
": Give back probability after performing KolmogorovTest on histogram against referece histogram with "+m_option+
" option\n"<<std::endl;
165 out<<
"KolmogorovTest_"+ m_name+
": Give back MaxDist(for 1D histograms only) after performing KolmogorovTest on histogram against referece histogram with "+m_option+
" option\n"<<std::endl;
167 out<<
"Mandatory Green/Red Threshold: "+
thresh+
" : Probability to give Green/Red result\n"<<std::endl;
169 out<<
"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;