ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::LastBinThresholdAction< Exceed, Action > Class Template Reference

#include <LastBinThresholdAction.h>

Inheritance diagram for dqm_algorithms::LastBinThresholdAction< Exceed, Action >:
Collaboration diagram for dqm_algorithms::LastBinThresholdAction< Exceed, Action >:

Public Member Functions

 LastBinThresholdAction (const std::string &name)
virtual LastBinThresholdActionclone () override
virtual dqm_core::Result * execute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &) override
virtual void printDescription (std::ostream &out) const

Private Attributes

std::string m_name
Exceed m_exceeds
Action m_doAction

Detailed Description

template<class Exceed, class Action>
class dqm_algorithms::LastBinThresholdAction< Exceed, Action >

Definition at line 47 of file LastBinThresholdAction.h.

Constructor & Destructor Documentation

◆ LastBinThresholdAction()

template<class Exceed, class Action>
dqm_algorithms::LastBinThresholdAction< Exceed, Action >::LastBinThresholdAction ( const std::string & name)

Member Function Documentation

◆ clone()

template<class Exceed, class Action>
dqm_algorithms::LastBinThresholdAction< Exceed, Action > * dqm_algorithms::LastBinThresholdAction< Exceed, Action >::clone ( )
overridevirtual

Definition at line 72 of file LastBinThresholdAction.cxx.

72 {
74}

◆ execute()

template<class Exceed, class Action>
dqm_core::Result * dqm_algorithms::LastBinThresholdAction< Exceed, Action >::execute ( const std::string & name,
const TObject & object,
const dqm_core::AlgorithmConfig & config )
overridevirtual

Definition at line 78 of file LastBinThresholdAction.cxx.

81{
82 const TProfile* histogram;
83
84 if( object.IsA()->InheritsFrom( "TProfile" ) ) {
85 histogram = static_cast<const TProfile*>(&object);
86 if (histogram->GetDimension() > 1){
87 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 2 " );
88 }
89 } else {
90 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TProfile" );
91 }
92
93 const double minStat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1);
94 const double fixedError = dqm_algorithms::tools::GetFirstFromMap( "FixedError", config.getParameters(), -1);
95 const bool ignoreEmpty = static_cast<bool>( dqm_algorithms::tools::GetFirstFromMap( "IgnoreEmpty", config.getParameters(), 1) );
96 const bool publish = static_cast<bool>( dqm_algorithms::tools::GetFirstFromMap( "PublishBins", config.getParameters(), 0) );
97 const int maxPublish = static_cast<int>( dqm_algorithms::tools::GetFirstFromMap( "MaxPublish", config.getParameters(), 20) );
98 const int nBinsToWatch = static_cast<int>( dqm_algorithms::tools::GetFirstFromMap( "NBinsToWatch", config.getParameters(), -1) );
99 const int nBinsForAction = static_cast<int>( dqm_algorithms::tools::GetFirstFromMap( "NBinsForAction", config.getParameters(), 99999) );
100
102 std::map<std::string, std::string>::const_iterator itAction = config.getGenericParameters().find("Action");
103 if (itAction != config.getGenericParameters().end()) {
104 action = itAction->second;
105 }
106
107 if (histogram->GetEntries() < minStat ) {
109 result->tags_["InsufficientEntries"] = histogram->GetEntries();
110 return result;
111 }
112
113 double binThreshold;
114 double greenThreshold;
115 double redThreshold;
116 try {
117 binThreshold = dqm_algorithms::tools::GetFirstFromMap( "BinThreshold", config.getParameters() );
118 redThreshold = dqm_algorithms::tools::GetFromMap( "NBins", config.getRedThresholds() );
119 greenThreshold = dqm_algorithms::tools::GetFromMap( "NBins", config.getGreenThresholds() );
120 } catch ( dqm_core::Exception & ex ) {
121 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
122 }
123
125
126 int nBinsOverThreshold = 0;
127
128 int firstBin = 1;
129 int lastBin = histogram->GetNbinsX();
130
131 if (nBinsToWatch > 0) {
132 while ((histogram->GetBinEntries(lastBin) == 0) && (lastBin > 1)) --lastBin;
134
135 result->tags_["LastBinNumber"] = lastBin; // report where we began the checks (mostly for debugging)
136 result->tags_["LastBinCenter"] = histogram->GetBinCenter(lastBin); // report where that is on the x-axis
137 }
138
139 double lastBinOverThresholdContent(0.0);
140 double binsOverThresholdContent(0.0);
141
142 for (int bin = firstBin; bin <= lastBin; ++bin) {
143 if (ignoreEmpty && (histogram->GetBinEntries(bin) == 0)) {
144 continue;
145 }
146 double content = histogram->GetBinContent(bin);
153 }
154 }
155 }
156
157 ERS_DEBUG(1,"Number of bins exceeded threshold of " << binThreshold << " is " << nBinsOverThreshold );
158 ERS_DEBUG(1,"Green threshold: "<< greenThreshold << " bin(s); Red threshold : " << redThreshold << " bin(s) ");
159
160 result->tags_["NBins"] = nBinsOverThreshold;
164 } else if (nBinsOverThreshold > redThreshold) {
166 } else {
167 result->status_ = dqm_core::Result::Red;
168 }
169 } else {
172 } else if (nBinsOverThreshold < redThreshold) {
174 } else {
175 result->status_ = dqm_core::Result::Red;
176 }
177 }
178
181 //coverity[copy_constructor_call]
183 }
184
185 return result;
186
187}
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
const T & GetFromMap(const std::string &pname, const std::map< std::string, T > &params)
void PublishBin(const TH1 *histogram, int xbin, int ybin, double content, dqm_core::Result *result)
#define IsA
Declare the TObject style functions.

◆ printDescription()

template<class Exceed, class Action>
void dqm_algorithms::LastBinThresholdAction< Exceed, Action >::printDescription ( std::ostream & out) const
virtual

Definition at line 190 of file LastBinThresholdAction.cxx.

190 {
191
192 out << m_name + ": Checks for number of bins exceded threshold value" << std::endl;
193 out << "Mandatory Parameter: BinThreshold: Look for bins exceeded BinTreshold; Count number of bins satifying requirement" << std::endl;
194 out << "Mandatory Green/Red Threshold: NBins: Number of bins satifying BinThreshold constraint to give Green/Red result" << std::endl;
195
196 out << "Optional Parameter: FixedError: override the histogram errors with this value" << std::endl;
197 out << "Optional Parameter: IgnoreEmpty: Ignore bins which have zero entries in histogram" << std::endl;
198 out << "Optional Parameter: PublishBins: Save bins which are different from average in Result (set to 1)" << std::endl;
199 out << "Optional Parameter: MaxPublish: Max number of bins to save (default 20)" << std::endl;
200 out << "Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm" << std::endl;
201 out << "Optional parameter: NBinsToWatch - number of final bins that will be checked. (NBinsToWatch >= 1, default = -1)" << std::endl;
202}

Member Data Documentation

◆ m_doAction

template<class Exceed, class Action>
Action dqm_algorithms::LastBinThresholdAction< Exceed, Action >::m_doAction
private

Definition at line 60 of file LastBinThresholdAction.h.

◆ m_exceeds

template<class Exceed, class Action>
Exceed dqm_algorithms::LastBinThresholdAction< Exceed, Action >::m_exceeds
private

Definition at line 59 of file LastBinThresholdAction.h.

◆ m_name

template<class Exceed, class Action>
std::string dqm_algorithms::LastBinThresholdAction< Exceed, Action >::m_name
private

Definition at line 58 of file LastBinThresholdAction.h.


The documentation for this class was generated from the following files: