9 #include <dqm_core/AlgorithmConfig.h>
16 #include <TObjArray.h>
21 #include <TGraphErrors.h>
24 #include <dqm_core/AlgorithmManager.h>
43 const TObject &
object,
44 const dqm_core::AlgorithmConfig &
config )
46 const TH1 * inputgraph;
48 if(
object.
IsA()->InheritsFrom(
"TH1" )) {
49 inputgraph =
static_cast<const TH1*
>( &
object );
52 throw dqm_core::BadConfig( ERS_HERE,
name,
"does not inherit from TH1" );
57 if (inputgraph->GetEntries() < minstat ) {
59 result->tags_[
"InsufficientEntries"] = inputgraph->GetEntries();
71 std::string thresholdname=
"Chi2_per_NDF";
77 catch ( dqm_core::Exception & ex ) {
78 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
83 refhist =
static_cast<TH1 *
>(
config.getReference() );
85 catch ( dqm_core::Exception & ex ) {
86 throw dqm_core::BadRefHist(ERS_HERE,
name,
" Could not retreive reference");
89 if (inputgraph->GetDimension() != refhist->GetDimension() ) {
90 throw dqm_core::BadRefHist( ERS_HERE,
"Dimension",
name );
95 if ((inputgraph->GetNbinsX() != refhist->GetNbinsX()) || (inputgraph->GetNbinsY() != refhist->GetNbinsY())) {
96 throw dqm_core::BadRefHist( ERS_HERE,
"number of bins",
name );
109 std::vector<int>
range;
113 catch( dqm_core::Exception & ex ) {
114 throw dqm_core::BadConfig( ERS_HERE,
name, ex.what(), ex );
122 { inputerr=inputgraph->GetBinError(
n);
123 referr=refhist->GetBinError(
n);
124 errsquared= referr*referr+inputerr*inputerr;
125 val=inputgraph->GetBinContent(
n);
126 refval=refhist->GetBinContent(
n);
127 if (referr >0.00001 && inputerr >0.00001)
128 {chisq=chisq+((
val-refval)*(
val-refval))/errsquared;
138 const double value = (count_ndf > 1) ? (chisq / (count_ndf - 1)) : 0;
146 if (
value <= gthresho ) {
148 }
else if (
value < rthresho ) {
149 result->status_ = dqm_core::Result::Yellow;
154 ERS_DEBUG(2,
"Result: "<<*
result);
163 out<<
"Chi2Test_Scatterplot performs chisq/ndf test on a scatterplot and returns a dqm_result"<<std::endl;
166 out<<
"Mandatory Green/Red Threshold: Chi2_per_NDF to give Green/Red result\n"<<std::endl;
168 out<<
"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;