ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
dqm_algorithms::KolmogorovTest_MaxDist Struct Reference

#include <KolmogorovTest_MaxDist.h>

Inheritance diagram for dqm_algorithms::KolmogorovTest_MaxDist:
Collaboration diagram for dqm_algorithms::KolmogorovTest_MaxDist:

Public Member Functions

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

Private Attributes

std::string m_name
 
std::string m_option
 

Detailed Description

Definition at line 16 of file KolmogorovTest_MaxDist.h.

Constructor & Destructor Documentation

◆ KolmogorovTest_MaxDist()

dqm_algorithms::KolmogorovTest_MaxDist::KolmogorovTest_MaxDist ( )
inline

Definition at line 18 of file KolmogorovTest_MaxDist.h.

18 : KolmogorovTest("MaxDist") {};

Member Function Documentation

◆ clone()

dqm_algorithms::KolmogorovTest * dqm_algorithms::KolmogorovTest::clone ( )
inherited

Definition at line 33 of file KolmogorovTest.cxx.

34 {
35  return new KolmogorovTest( m_name );
36 }

◆ execute()

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

Definition at line 40 of file KolmogorovTest.cxx.

43 {
44  const TH1 * histogram;
45  const TH1 * refhist;
46  double gthresho;
47  double rthresho;
48 
49  if(object.IsA()->InheritsFrom( "TH1" )) {
50  histogram = static_cast<const TH1*>( &object );
51  if (histogram->GetDimension() > 2 ){
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 
58  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
59 
60  if (histogram->GetEntries() < minstat ) {
62  result->tags_["InsufficientEntries"] = histogram->GetEntries();
63  return result;
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 
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" );
87  }
88 
89 
90  std::string option;
91  std::string thresh;
92  if (m_name == "Prob") {
93  option="";
94  thresh="P";
95  }else if (m_name == "MaxDist") {
96  option="M";
97  thresh="MaxDist";
98  }else if (m_name == "Norm") {
99  option="N";
100  thresh="P";
101  }else if (m_name == "MaxDistPlusNorm") {
102  option="NM";
103  thresh="MaxDist";
104  }else {
105  throw dqm_core::BadConfig( ERS_HERE, "None", m_name );
106  }
107 
108  try {
109  gthresho = dqm_algorithms::tools::GetFromMap( thresh, config.getGreenThresholds() );
110  rthresho = dqm_algorithms::tools::GetFromMap( thresh, config.getRedThresholds() );
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 
123  result->tags_[m_name] = value;
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 
142  return result;
143 }

◆ printDescription()

void dqm_algorithms::KolmogorovTest::printDescription ( std::ostream &  out)
inherited

Definition at line 145 of file KolmogorovTest.cxx.

146 {
147  std::string thresh;
148  if (m_name == "Prob") {
149  m_option="";
150  thresh="P";
151  }else if (m_name == "MaxDist") {
152  m_option="M";
153  thresh="MaxDist";
154  }else if (m_name == "Norm") {
155  m_option="N";
156  thresh="P";
157  }else if (m_name == "MaxDistPlusNorm") {
158  m_option="NM";
159  thresh="MaxDist";
160  }
161 
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;
164  } else {
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;
166  }
167  out<<"Mandatory Green/Red Threshold: "+thresh+" : Probability to give Green/Red result\n"<<std::endl;
168 
169  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;
170 
171 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::KolmogorovTest::m_name
privateinherited

Definition at line 27 of file KolmogorovTest.h.

◆ m_option

std::string dqm_algorithms::KolmogorovTest::m_option
privateinherited

Definition at line 28 of file KolmogorovTest.h.


The documentation for this struct was generated from the following file:
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
physval_make_web_display.thresh
thresh
Definition: physval_make_web_display.py:36
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
athena.value
value
Definition: athena.py:124
dqm_algorithms::KolmogorovTest::m_option
std::string m_option
Definition: KolmogorovTest.h:28
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
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:228
dqm_algorithms::KolmogorovTest::KolmogorovTest
KolmogorovTest(const std::string &name)
Definition: KolmogorovTest.cxx:26
dqm_algorithms::KolmogorovTest::m_name
std::string m_name
Definition: KolmogorovTest.h:27
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
histogram
std::string histogram
Definition: chains.cxx:52