#include <AveragePrint.h>
Definition at line 16 of file AveragePrint.h.
◆ AveragePrint()
dqm_algorithms::AveragePrint::AveragePrint |
( |
| ) |
|
◆ ~AveragePrint()
dqm_algorithms::AveragePrint::~AveragePrint |
( |
| ) |
|
|
virtual |
◆ clone()
dqm_core::Algorithm * dqm_algorithms::AveragePrint::clone |
( |
| ) |
|
|
virtual |
◆ execute()
Definition at line 65 of file AveragePrint.cxx.
72 if (!
data.IsA()->InheritsFrom(
"TH1")) {
73 throw dqm_core::BadConfig(ERS_HERE,
name,
"does not inherit from TH1");
75 const TH1*
h =
static_cast<const TH1*
>(&
data);
76 if (
h->GetDimension() > 2) {
77 throw dqm_core::BadConfig(ERS_HERE,
name,
"dimension > 2 ");
83 if (
data.IsA()->InheritsFrom(
"TProfile") ) {
86 double Average_value = 0.;
87 double Total_entries = 0;
88 int NbinsX =
h->GetNbinsX();
90 double Bin_entries = hp->GetBinEntries(
binX + 1);
91 double Bin_value = Bin_entries * (hp->GetBinContent(
binX + 1));
92 Total_entries += Bin_entries;
93 Average_value += Bin_value;
95 Average_value = Average_value / Total_entries;
96 std::string Average_name = Form(
"%s_Average",
name.c_str());
97 result->tags_[Average_name.c_str()] = Average_value;
103 if((!
data.IsA()->InheritsFrom(
"TProfile")) &&
h->GetDimension() == 1) {
104 double Average_value = 0.;
105 int NbinsX =
h->GetNbinsX();
107 Average_value +=
h->GetBinContent(
binX + 1);
109 std::string Average_name = Form(
"%s_Average",
name.c_str());
110 result->tags_[Average_name.c_str()] = Average_value;
116 if((!
data.IsA()->InheritsFrom(
"TProfile")) &&
h->GetDimension() == 2) {
117 double Average_value = 0.;
118 int NbinsX =
h->GetNbinsX();
119 int NbinsY =
h->GetNbinsY();
122 Average_value +=
h->GetBinContent(
binY + 1,
binY + 1);
125 std::string Average_name = Form(
"%s_Average",
name.c_str());
126 result->tags_[Average_name.c_str()] = Average_value;
◆ printDescription()
void dqm_algorithms::AveragePrint::printDescription |
( |
std::ostream & |
out | ) |
|
|
virtual |
Definition at line 28 of file AveragePrint.cxx.
34 message +=
"Description: Prints out the average of the histogram or profile bins\n";
35 message +=
" In the case of a TProfile each bin is weighted by its fraction of the entries\n";
36 message +=
" Overflow (and Underflow) bins are not included\n";
◆ m_name
std::string dqm_algorithms::AveragePrint::m_name |
|
protected |
The documentation for this class was generated from the following files: