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

#include <JarqueBeraTest_JB.h>

Inheritance diagram for dqm_algorithms::JarqueBeraTest_JB:
Collaboration diagram for dqm_algorithms::JarqueBeraTest_JB:

Public Member Functions

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

Private Attributes

std::string m_name
 

Detailed Description

Definition at line 16 of file JarqueBeraTest_JB.h.

Constructor & Destructor Documentation

◆ JarqueBeraTest_JB()

dqm_algorithms::JarqueBeraTest_JB::JarqueBeraTest_JB ( )
inline

Definition at line 18 of file JarqueBeraTest_JB.h.

18 : JarqueBeraTest("JB") {} ;

Member Function Documentation

◆ clone()

dqm_algorithms::JarqueBeraTest * dqm_algorithms::JarqueBeraTest::clone ( )
inherited

Definition at line 27 of file JarqueBeraTest.cxx.

28 {
29  return new JarqueBeraTest(m_name);
30 }

◆ execute()

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

Definition at line 33 of file JarqueBeraTest.cxx.

36 {
37  const TH1 * histogram;
38  if(object.IsA()->InheritsFrom( "TH1" )) {
39  histogram = static_cast<const TH1*>( &object );
40  if (histogram->GetDimension() > 2 ){
41  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
42  }
43  } else {
44  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
45  }
46 
47  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
48  ERS_DEBUG(2,"Minimum statistics required:"<<minstat);
49  if (histogram->GetEffectiveEntries() < minstat ) {
51  result->tags_["InsufficientEffectiveEntries"] = histogram->GetEffectiveEntries();
52  return result;
53  }
54  double gthresho,rthresho;
55  std::string thresholdname="JB";
56  if ( m_name == "Prob") thresholdname = "P";
57  try {
58  gthresho = dqm_algorithms::tools::GetFromMap( thresholdname, config.getGreenThresholds() );
59  rthresho = dqm_algorithms::tools::GetFromMap( thresholdname, config.getRedThresholds() );
60  }
61  catch ( dqm_core::Exception & ex ) {
62  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
63  }
64  ERS_DEBUG(2,"Green Threshold: "<<gthresho<<" Red: "<<rthresho);
65 
66  // N.B. Root's return the excess kurtosis, i.e. gamma_2-3
67  // The excess kurtosis is defined scuh as K(N(0,1))=0
68  double k = histogram->GetKurtosis();
69  double s = histogram->GetSkewness();
70  double n = histogram->GetEffectiveEntries();
71  double jb = n/6*( s*s + (k*k)/4 ); //Calculate Jarque Bera
72  //The statistic JB has an asymptotic chi-square distribution with two degrees of freedom
73  // and can be used to test the null hypothesis that the data are from a normal distribution.
74  double prob = TMath::Prob( jb , 2 );
75  ERS_DEBUG(2," K="<<k<<" S="<<s<<" n="<<n<<" jb="<<jb<<" prob="<<prob);
76 
77  //Check against thresholds
78  double testValue;
79  if ( m_name == "Prob" ) testValue = prob; //Use probability
80  else testValue = jb; // Use the JB value for comparison
81 
83  result->tags_["JB"] = jb;
84  result->tags_["Prob"]=prob;
85  if ( TMath::IsNaN( testValue ) ) //This may happen if RMS==0 Kurtosis and Skewness are inf
86  {
88  return result;
89  }
90  if ( m_name=="Prob" )
91  {
92  if ( testValue >= gthresho ) {
94  } else if ( testValue > rthresho ) {
95  result->status_ = dqm_core::Result::Yellow;
96  } else {
97  result->status_ = dqm_core::Result::Red;
98  }
99  }
100  else
101  {
102  if ( testValue <= gthresho ) {
103  result->status_ = dqm_core::Result::Green;
104  } else if ( testValue < rthresho ) {
105  result->status_ = dqm_core::Result::Yellow;
106  } else {
107  result->status_ = dqm_core::Result::Red;
108  }
109  }
110  return result;
111 }

◆ printDescription()

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

Definition at line 114 of file JarqueBeraTest.cxx.

115 {
116  out<<"JarqueBeraTest"+m_name+" gives back the ";
117  if ( m_name == "Prob") out<<" probability that the input histogram follows the normal distribution\n"<<std::endl;
118  else out<<" Jarque-Bera value of the input histogram\n"<<std::endl;
119  out<<"Mandatory Green/Red Threshold: ";
120  if ( m_name == "Prob") out<<" P : Probability";
121  else out<<" JB : Jarque-Bera value";
122  out<<" to give Green/Red result.\n"<<std::endl;
123  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"<<std::endl;
124 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::JarqueBeraTest::m_name
privateinherited

Definition at line 27 of file JarqueBeraTest.h.


The documentation for this struct was generated from the following file:
Undefined
@ Undefined
Definition: MaterialTypes.h:8
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
dqm_algorithms::JarqueBeraTest::m_name
std::string m_name
Definition: JarqueBeraTest.h:27
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
covarianceTool.prob
prob
Definition: covarianceTool.py:678
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
beamspotman.n
n
Definition: beamspotman.py:731
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::JarqueBeraTest::JarqueBeraTest
JarqueBeraTest(const std::string &name)
Definition: JarqueBeraTest.cxx:20
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
fitman.k
k
Definition: fitman.py:528