ATLAS Offline Software
Loading...
Searching...
No Matches
dqm_algorithms::CTP_AllBinsAreEmptyExceptZero Class Reference

#include <CTP_AllBinsAreEmptyExceptZero.h>

Inheritance diagram for dqm_algorithms::CTP_AllBinsAreEmptyExceptZero:
Collaboration diagram for dqm_algorithms::CTP_AllBinsAreEmptyExceptZero:

Public Member Functions

 CTP_AllBinsAreEmptyExceptZero ()
virtual ~CTP_AllBinsAreEmptyExceptZero ()=default
virtual dqm_core::Algorithm * clone () override
virtual dqm_core::Result * execute (const std::string &name, const TObject &data, const dqm_core::AlgorithmConfig &config) override
virtual void printDescription (std::ostream &out)

Private Attributes

std::string m_name

Detailed Description

Definition at line 15 of file CTP_AllBinsAreEmptyExceptZero.h.

Constructor & Destructor Documentation

◆ CTP_AllBinsAreEmptyExceptZero()

dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::CTP_AllBinsAreEmptyExceptZero ( )

Definition at line 34 of file CTP_AllBinsAreEmptyExceptZero.cxx.

35 : m_name("CTP_AllBinsAreEmptyExceptZero")
36{
37 dqm_core::AlgorithmManager::instance().registerAlgorithm( m_name, this );
38}

◆ ~CTP_AllBinsAreEmptyExceptZero()

virtual dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::~CTP_AllBinsAreEmptyExceptZero ( )
virtualdefault

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::clone ( )
overridevirtual

◆ execute()

dqm_core::Result * dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::execute ( const std::string & name,
const TObject & data,
const dqm_core::AlgorithmConfig & config )
overridevirtual

Definition at line 48 of file CTP_AllBinsAreEmptyExceptZero.cxx.

49{
50 using namespace std;
51
52 const TH1 *hist{};
53
54 if(object.IsA()->InheritsFrom( "TH1" )) {
55 hist = static_cast<const TH1*>( &object );
56 if (hist->GetDimension() > 1 ){
57 throw dqm_core::BadConfig( ERS_HERE, name, "dimension > 1 " );
58 }
59 } else {
60 throw dqm_core::BadConfig( ERS_HERE, name, "does not inherit from TH1" );
61 }
62
63 //Get Parameters and Thresholds
64 double threshold = 0;
65
66 try {
67 threshold = dqm_algorithms::tools::GetFirstFromMap("threshold", config.getParameters(), 0);
68 }
69 catch ( dqm_core::Exception & ex ) {
70 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
71 }
72
73 //Algo
74 dqm_core::Result* result = new dqm_core::Result();
75 std::map<std::string,double> tags; //defined in https://gitlab.cern.ch/atlas-tdaq-software/dqm_core/-/blob/master/dqm_core/Result.h
76
77 //assume all good, until find a bad one
78 result->status_ = dqm_core::Result::Green;
79 int nbinsx = hist->GetXaxis()->GetNbins();
80 int badBins = 0;
81
82 for(int iBin = 1; iBin <= nbinsx-1; ++iBin) //foreach bin of the projection (0=underflow)
83 {
84 // If bin content is nonzero, and 0 does not lie in between bin edges
85 if( hist->GetBinContent(iBin) > threshold && hist->GetBinLowEdge(iBin) * hist->GetBinLowEdge(iBin+1) > 0 )
86 {
87 result->status_ = dqm_core::Result::Red;
88 ++ badBins;
89 }
90 }
91 tags["# Bad bins"] = badBins;
92
93 //set the result tags
94 result->tags_ = std::move(tags);
95
96 // Return the result
97 return result;
98}
std::vector< std::string > tags
Definition hcg.cxx:105
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
#define IsA
Declare the TObject style functions.

◆ printDescription()

void dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::printDescription ( std::ostream & out)
virtual

Definition at line 102 of file CTP_AllBinsAreEmptyExceptZero.cxx.

102 {
103 std::string message;
104 message += "\n";
105 message += "Algorithm: \"" + m_name + "\"\n";
106 message += "Description: Check that the only non-empty bin is the one centered in zero.\n";
107 out << message;
108}

Member Data Documentation

◆ m_name

std::string dqm_algorithms::CTP_AllBinsAreEmptyExceptZero::m_name
private

Definition at line 27 of file CTP_AllBinsAreEmptyExceptZero.h.


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