ATLAS Offline Software
Public Member Functions | List of all members
dqm_algorithms::Chi2Test_Scatterplot Struct Reference

#include <Chi2Test_Scatterplot.h>

Inheritance diagram for dqm_algorithms::Chi2Test_Scatterplot:
Collaboration diagram for dqm_algorithms::Chi2Test_Scatterplot:

Public Member Functions

 Chi2Test_Scatterplot ()
 
Chi2Test_Scatterplotclone ()
 
dqm_core::Resultexecute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
 
void printDescription (std::ostream &out)
 

Detailed Description

Definition at line 18 of file Chi2Test_Scatterplot.h.

Constructor & Destructor Documentation

◆ Chi2Test_Scatterplot()

dqm_algorithms::Chi2Test_Scatterplot::Chi2Test_Scatterplot ( )

Definition at line 28 of file Chi2Test_Scatterplot.cxx.

29  {
30  dqm_core::AlgorithmManager::instance().registerAlgorithm("Chi2Test_Scatterplot", this );
31 }

Member Function Documentation

◆ clone()

dqm_algorithms::Chi2Test_Scatterplot * dqm_algorithms::Chi2Test_Scatterplot::clone ( )

Definition at line 35 of file Chi2Test_Scatterplot.cxx.

36 {
37  return new Chi2Test_Scatterplot();
38 }

◆ execute()

dqm_core::Result * dqm_algorithms::Chi2Test_Scatterplot::execute ( const std::string &  name,
const TObject &  object,
const dqm_core::AlgorithmConfig &  config 
)

Definition at line 42 of file Chi2Test_Scatterplot.cxx.

45 {
46  const TH1 * inputgraph;
47 
48  if(object.IsA()->InheritsFrom( "TH1" )) {
49  inputgraph = static_cast<const TH1*>( &object );
50 
51  } else {
52  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
53  }
54 
55  double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), 1 );
56 
57  if (inputgraph->GetEntries() < minstat ) {
59  result->tags_["InsufficientEntries"] = inputgraph->GetEntries();
60  return result;
61  }
62 
63 
64 
65 
66  TH1 * refhist;
67  double gthresho;
68  double rthresho;
69  std::string option;
70 
71  std::string thresholdname="Chi2_per_NDF";
72 
73  try {
74  gthresho = dqm_algorithms::tools::GetFromMap( thresholdname, config.getGreenThresholds() );
75  rthresho = dqm_algorithms::tools::GetFromMap( thresholdname, config.getRedThresholds() );
76  }
77  catch ( dqm_core::Exception & ex ) {
78  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
79 
80  }
81 
82  try {
83  refhist = static_cast<TH1 *>( config.getReference() );
84  }
85  catch ( dqm_core::Exception & ex ) {
86  throw dqm_core::BadRefHist(ERS_HERE,name," Could not retreive reference");
87  }
88 
89  if (inputgraph->GetDimension() != refhist->GetDimension() ) {
90  throw dqm_core::BadRefHist( ERS_HERE, "Dimension", name );
91  }
92 
93 
94 
95  if ((inputgraph->GetNbinsX() != refhist->GetNbinsX()) || (inputgraph->GetNbinsY() != refhist->GetNbinsY())) {
96  throw dqm_core::BadRefHist( ERS_HERE, "number of bins", name );
97  }
98 
99  int n=0;
100  double chisq=0;
101  double errsquared{};
102  double inputerr{};
103  double referr{};
104  double val{};
105  double refval{};
106 
107 
108  //read in the range of bin values to use
109  std::vector<int> range;
110  try{
111  range=dqm_algorithms::tools::GetBinRange(inputgraph,config.getParameters());
112  }
113  catch( dqm_core::Exception & ex ) {
114  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
115  }
116 
117 //now compute the chisq/ndf
118 
119  int count_ndf=0;
120 
121  for(n=range[0];n<(range[1]+1);n++)
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;
129  count_ndf++;
130  }
131  else
132  {//out<<"One of the errors is too small???? "<<n<<std::endl;
133  }
134 
135  }
136 
137 
138  const double value = (count_ndf > 1) ? (chisq / (count_ndf - 1)) : 0; // avoid to divide by zero (should never happen)
139 
141  result->tags_[thresholdname] = value;
142 
143 
144 //check the thresholds
145 
146  if ( value <= gthresho ) {
147  result->status_ = dqm_core::Result::Green;
148  } else if ( value < rthresho ) {
149  result->status_ = dqm_core::Result::Yellow;
150  } else {
151  result->status_ = dqm_core::Result::Red;
152  }
153 
154  ERS_DEBUG(2,"Result: "<<*result);
155 
156  return result;
157 
158 }

◆ printDescription()

void dqm_algorithms::Chi2Test_Scatterplot::printDescription ( std::ostream &  out)

Definition at line 160 of file Chi2Test_Scatterplot.cxx.

161 {
162 
163  out<<"Chi2Test_Scatterplot performs chisq/ndf test on a scatterplot and returns a dqm_result"<<std::endl;
164 
165 
166  out<<"Mandatory Green/Red Threshold: Chi2_per_NDF to give Green/Red result\n"<<std::endl;
167 
168  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;
169 
170 }

The documentation for this struct was generated from the following files:
dqm_algorithms::tools::GetBinRange
std::vector< int > GetBinRange(const TH1 *histogram, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:380
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
athena.value
value
Definition: athena.py:122
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
beamspotman.n
n
Definition: beamspotman.py:731
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.handimod.Green
int Green
Definition: handimod.py:524
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
dqm_algorithms::Chi2Test_Scatterplot::Chi2Test_Scatterplot
Chi2Test_Scatterplot()
Definition: Chi2Test_Scatterplot.cxx:28
TH1::GetBinContent
double GetBinContent(int) const
Definition: rootspy.cxx:298
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
TH1
Definition: rootspy.cxx:268
dqm_algorithms::tools::GetFromMap
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
Definition: AlgorithmHelper.h:114
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339