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

#include <TRTHistogramHasNonZeroEntries.h>

Inheritance diagram for dqm_algorithms::TRTHistogramHasNonZeroEntries:
Collaboration diagram for dqm_algorithms::TRTHistogramHasNonZeroEntries:

Public Member Functions

 TRTHistogramHasNonZeroEntries ()
virtual ~TRTHistogramHasNonZeroEntries ()
virtual dqm_core::Algorithm * clone ()
virtual dqm_core::Result * execute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
virtual void printDescription (std::ostream &out)

Private Attributes

std::string m_name

Detailed Description

Definition at line 20 of file TRTHistogramHasNonZeroEntries.h.

Constructor & Destructor Documentation

◆ TRTHistogramHasNonZeroEntries()

dqm_algorithms::TRTHistogramHasNonZeroEntries::TRTHistogramHasNonZeroEntries ( )

Definition at line 30 of file TRTHistogramHasNonZeroEntries.cxx.

30 : m_name("TRTHistogram_Has_NonZero_Entries")
31{
32 dqm_core::AlgorithmManager::instance().registerAlgorithm(m_name, this);
33}

◆ ~TRTHistogramHasNonZeroEntries()

dqm_algorithms::TRTHistogramHasNonZeroEntries::~TRTHistogramHasNonZeroEntries ( )
virtual

Definition at line 35 of file TRTHistogramHasNonZeroEntries.cxx.

36{
37}

Member Function Documentation

◆ clone()

dqm_core::Algorithm * dqm_algorithms::TRTHistogramHasNonZeroEntries::clone ( )
virtual

◆ execute()

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

Definition at line 44 of file TRTHistogramHasNonZeroEntries.cxx.

45{
46 const TH1 *histogram;
47
48 if (object.IsA()->InheritsFrom("TH1")) {
49 histogram = static_cast<const TH1*>(&object);
50 if (histogram->GetDimension() > 3) {
51 throw dqm_core::BadConfig(ERS_HERE, name, "dimension > 3 ");
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
59 if (histogram->GetEntries() < minstat) {
60 // ERS_INFO("Histogram does not satisfy MinStat requirement " << histogram->GetName());
61 dqm_core::Result *result = new dqm_core::Result(dqm_core::Result::Undefined);
62 result->tags_["InsufficientEntries"] = histogram->GetEntries();
63 return result;
64 }
65
66 dqm_core::Result *result = new dqm_core::Result();
67
68 if (histogram->GetEntries() == 0 || histogram->Integral() == 0) {
69 ERS_DEBUG(1, "Histogram " << histogram->GetName() << " is Empty");
70 result->status_ = dqm_core::Result::Red;
71 result->tags_["Integral"] = histogram->Integral();
72 } else {
73 ERS_DEBUG(1, "Histogram " << histogram->GetName() << " is Not Empty");
74 result->status_ = dqm_core::Result::Green;
75 result->tags_["Integral"] = histogram->Integral();
76 }
77 return result;
78}
std::string histogram
Definition chains.cxx:52
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
#define IsA
Declare the TObject style functions.

◆ printDescription()

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

Definition at line 80 of file TRTHistogramHasNonZeroEntries.cxx.

81{
82 out << m_name << ": Checks if histogram has entries that are not zero." << std::endl;
83}

Member Data Documentation

◆ m_name

std::string dqm_algorithms::TRTHistogramHasNonZeroEntries::m_name
private

Definition at line 32 of file TRTHistogramHasNonZeroEntries.h.


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