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

#include <BasicStatCheck.h>

Inheritance diagram for dqm_algorithms::BasicStatCheck:
Collaboration diagram for dqm_algorithms::BasicStatCheck:

Public Member Functions

 BasicStatCheck (const std::string &name)
 
BasicStatCheckclone ()
 
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 20 of file BasicStatCheck.h.

Constructor & Destructor Documentation

◆ BasicStatCheck()

dqm_algorithms::BasicStatCheck::BasicStatCheck ( const std::string &  name)

Definition at line 27 of file BasicStatCheck.cxx.

28  : m_name( name )
29 {
30  dqm_core::AlgorithmManager::instance().registerAlgorithm("CheckHisto_"+name, this);
31 }

Member Function Documentation

◆ clone()

dqm_algorithms::BasicStatCheck * dqm_algorithms::BasicStatCheck::clone ( )

Definition at line 34 of file BasicStatCheck.cxx.

35 {
36 
37  return new BasicStatCheck( m_name );
38 }

◆ execute()

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

Definition at line 42 of file BasicStatCheck.cxx.

45 {
46  const TH1 * histogram;
47 
48  if( object.IsA()->InheritsFrom( "TH1" ) ) {
49  histogram = static_cast<const TH1*>(&object);
50  if (histogram->GetDimension() > 2 ){
51  throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
52  }
53  } else {
54  throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
55  }
56 
57  const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
58  const double subtractfromxmean = dqm_algorithms::tools::GetFirstFromMap( "SubtractFromXMean", config.getParameters(), 0);
59  const double subtractfromymean = dqm_algorithms::tools::GetFirstFromMap( "SubtractFromYMean", config.getParameters(), 0);
60  const unsigned int publishType = static_cast<unsigned int>(dqm_algorithms::tools::GetFirstFromMap( "PublishType", config.getParameters(), 3));
61 
62  if (histogram->GetEntries() < minstat ) {
64  result->tags_["InsufficientEntries"] = histogram->GetEntries();
65  return result;
66  }
67 
68 
69  std::vector<int> range=dqm_algorithms::tools::GetBinRange(histogram, config.getParameters());
70  const_cast<TAxis*>(histogram->GetXaxis())->SetRange(range[0], range[1]);
71  const_cast<TAxis*>(histogram->GetYaxis())->SetRange(range[2], range[3]);
72 
73  std::map<std::string, double> params;
74  if (m_name == "Mean") {
75  params["XMean"]=histogram->GetMean(1) - subtractfromxmean;
76  params["YMean"]=histogram->GetMean(2) - subtractfromymean;
77  ERS_DEBUG(1,"XMean Value " <<histogram->GetMean(1)<<" YMean Value " <<histogram->GetMean(2));
78  } else if (m_name == "RMS" ) {
79  params["XRMS"]=histogram->GetRMS(1);
80  params["YRMS"]=histogram->GetRMS(2);
81  ERS_DEBUG(1,"XRMS Value " <<histogram->GetRMS(1)<<" YRMS Value "<<histogram->GetRMS(2));
82  }else {
83  return new dqm_core::Result();
84  }
85 
87 
88  try {
89  result = dqm_algorithms::tools::MakeComparisons(params, config.getGreenThresholds(), config.getRedThresholds() );
90  }
91  catch ( dqm_core::Exception & ex ) {
92  throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
93  }
94 
95  if (m_name == "Mean") {
96  if (publishType & 0x01) result->tags_["XMean"] = params["XMean"];
97  if (publishType & 0x02) result->tags_["YMean"] = params["YMean"];
98  } else if (m_name == "RMS") {
99  if (publishType & 0x01) result->tags_["XRMS"] = params["XRMS"];
100  if (publishType & 0x02) result->tags_["YRMS"] = params["YRMS"];
101  }
102 
103  return result;
104 }

◆ printDescription()

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

Definition at line 107 of file BasicStatCheck.cxx.

108 {
109  if (m_name == "Mean") {
110  out<<"CheckHisto_Mean: Checks that X and Y Mean of histo are within specified thresholds\n"<<std::endl;
111  out<<"Green/Red Threshold: XMean or AbsXMean: X Mean value to give Green/Red result; AbsXMean checks the absolute value"<<std::endl;
112  out<<"Green/Red Threshold: YMean or AbsYMean: Y Mean value to give Green/Red result; AbsYMean checks the absolute value\n"<<std::endl;
113  }else if (m_name == "RMS"){
114  out<<"CheckHisto_RMS: Checks that X and Y RMS of histo are within specified thresholds\n"<<std::endl;
115  out<<"Green/Red Threshold: XRMS: X RMS value to give Green/Red result"<<std::endl;
116  out<<"Green/Red Threshold: YRMS: Y RMS value to give Green/Red result\n"<<std::endl;
117  }
118  out<<"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm"<<std::endl;
119  out<<"Optional Parameter: xmin: minimum x range"<<std::endl;
120  out<<"Optional Parameter: xmax: maximum x range"<<std::endl;
121  out<<"Optional Parameter: ymin: minimum y range"<<std::endl;
122  out<<"Optional Parameter: ymax: maximum y range"<<std::endl;
123  out<<"Optional Parameter: SubtractFromXMean: value subtracted from XMean before test is applied: allows using AbsXMean for non-zero expected mean"<<std::endl;
124  out<<"Optional Parameter: SubtractFromYMean: value subtracted from YMean before test is applied: allows using AbsYMean for non-zero expected mean"<<std::endl;
125  out<<"Optional Parameter: PublishType: 0 = publish no results, 1 = publish X result, 2 = publish Y result, 3 = publish both results (default)."<<std::endl;
126 }

Member Data Documentation

◆ m_name

std::string dqm_algorithms::BasicStatCheck::m_name
private

Definition at line 31 of file BasicStatCheck.h.


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
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
dqm_algorithms::tools::MakeComparisons
dqm_core::Result * MakeComparisons(const std::map< std::string, double > &algparams, const std::map< std::string, double > &gthreshold, const std::map< std::string, double > &rthreshold)
Definition: AlgorithmHelper.cxx:60
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TH1
Definition: rootspy.cxx:268
dqm_algorithms::BasicStatCheck::m_name
std::string m_name
Definition: BasicStatCheck.h:31
pickleTool.object
object
Definition: pickleTool.py:30
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
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
dqm_algorithms::BasicStatCheck::BasicStatCheck
BasicStatCheck(const std::string &name)
Definition: BasicStatCheck.cxx:27