ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::CheckHisto_RMS Struct Reference

#include <CheckHisto_RMS.h>

Inheritance diagram for dqm_algorithms::CheckHisto_RMS:
Collaboration diagram for dqm_algorithms::CheckHisto_RMS:

Public Member Functions

 CheckHisto_RMS ()
BasicStatCheckclone ()
dqm_core::Result * execute (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 CheckHisto_RMS.h.

Constructor & Destructor Documentation

◆ CheckHisto_RMS()

dqm_algorithms::CheckHisto_RMS::CheckHisto_RMS ( )
inline

Definition at line 18 of file CheckHisto_RMS.h.

18: BasicStatCheck("RMS") {};
BasicStatCheck(const std::string &name)

Member Function Documentation

◆ clone()

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

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 )
inherited

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 ) {
63 dqm_core::Result *result = new dqm_core::Result(dqm_core::Result::Undefined);
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
86 dqm_core::Result* result;
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}
std::string histogram
Definition chains.cxx:52
std::vector< int > GetBinRange(const TH1 *histogram, const std::map< std::string, double > &params)
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
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)
#define IsA
Declare the TObject style functions.

◆ printDescription()

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

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
privateinherited

Definition at line 31 of file BasicStatCheck.h.


The documentation for this struct was generated from the following file: