43{
45 const TH1 * refhist;
46 double gthresho;
47 double rthresho;
48
49 if(
object.
IsA()->InheritsFrom(
"TH1" )) {
52 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
53 }
54 } else {
55 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
56 }
57
59
61 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
64 }
65
66 try {
67 refhist =
dynamic_cast<const TH1*
>(
config.getReference() );
68 }
69 catch ( dqm_core::Exception & ex ) {
70 throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
71 }
72
73 if (!refhist) {
74 throw dqm_core::BadRefHist(ERS_HERE, name, "Reference is not a histogram");
75 }
76
77 if (
histogram->GetDimension() != refhist->GetDimension() ) {
78 throw dqm_core::BadRefHist( ERS_HERE, name, "Dimension" );
79 }
80
81 if ((
histogram->GetNbinsX() != refhist->GetNbinsX()) || (
histogram->GetNbinsY() != refhist->GetNbinsY())) {
82 throw dqm_core::BadRefHist( ERS_HERE, name, "number of bins" );
83 }
84
86 throw dqm_core::BadConfig( ERS_HERE, name, "MaxDist option cannot be used on 2D histograms" );
87 }
88
89
90 std::string option;
93 option="";
95 }
else if (
m_name ==
"MaxDist") {
96 option="M";
98 }
else if (
m_name ==
"Norm") {
99 option="N";
101 }
else if (
m_name ==
"MaxDistPlusNorm") {
102 option="NM";
104 }else {
105 throw dqm_core::BadConfig( ERS_HERE,
"None",
m_name );
106 }
107
108 try {
111 }
112 catch ( dqm_core::Exception & ex ) {
113 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
114 }
115
116
117 double value =
histogram->KolmogorovTest( refhist, option.c_str());
118
119 ERS_DEBUG(1,
"Kolmogorov Test with Option " <<
m_name <<
" is " << value );
120 ERS_DEBUG(1, "Green threshold: "<< gthresho << "; Red threshold: " << rthresho );
121
122 dqm_core::Result*
result =
new dqm_core::Result();
124 if (thresh =="P"){
125 if ( value >= gthresho ) {
126 result->status_ = dqm_core::Result::Green;
127 } else if ( value > rthresho ) {
128 result->status_ = dqm_core::Result::Yellow;
129 } else {
130 result->status_ = dqm_core::Result::Red;
131 }
132 }else {
133 if ( value <= gthresho ) {
134 result->status_ = dqm_core::Result::Green;
135 } else if ( value < rthresho ) {
136 result->status_ = dqm_core::Result::Yellow;
137 } else {
138 result->status_ = dqm_core::Result::Red;
139 }
140 }
141
143}
#define IsA
Declare the TObject style functions.