ATLAS Offline Software
DataQuality
dqm_algorithms
src
TRTHistogramHasNonZeroEntries.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
9
#include "
dqm_algorithms/TRTHistogramHasNonZeroEntries.h
"
10
#include "dqm_core/AlgorithmManager.h"
11
#include "dqm_core/AlgorithmConfig.h"
12
#include "dqm_core/exceptions.h"
13
#include "
dqm_algorithms/tools/AlgorithmHelper.h
"
14
#include "dqm_core/Result.h"
15
#include "ers/ers.h"
16
17
#include "TH1.h"
18
#include "TF1.h"
19
#include "TClass.h"
20
21
#include <cmath>
22
#include <iostream>
23
#include <map>
24
25
static
dqm_algorithms::TRTHistogramHasNonZeroEntries
staticInstance;
26
27
namespace
dqm_algorithms
28
{
29
30
TRTHistogramHasNonZeroEntries::TRTHistogramHasNonZeroEntries
(): m_name(
"TRTHistogram_Has_NonZero_Entries"
)
31
{
32
dqm_core::AlgorithmManager::instance
().registerAlgorithm(
m_name
,
this
);
33
}
34
35
TRTHistogramHasNonZeroEntries::~TRTHistogramHasNonZeroEntries
()
36
{
37
}
38
39
dqm_core::Algorithm *
TRTHistogramHasNonZeroEntries::clone
()
40
{
41
return
new
TRTHistogramHasNonZeroEntries
(*
this
);
42
}
43
44
dqm_core::Result
*
TRTHistogramHasNonZeroEntries::execute
(
const
std::string &
name
,
const
TObject &
object
,
const
dqm_core::AlgorithmConfig &
config
)
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
}
79
80
void
TRTHistogramHasNonZeroEntries::printDescription
(std::ostream&
out
)
81
{
82
out
<<
m_name
<<
": Checks if histogram has entries that are not zero."
<< std::endl;
83
}
84
85
}
// namespace dqm_algorithms
Undefined
@ Undefined
Definition:
MaterialTypes.h:8
get_generator_info.result
result
Definition:
get_generator_info.py:21
dqm_algorithms::TRTHistogramHasNonZeroEntries::clone
virtual dqm_core::Algorithm * clone()
Definition:
TRTHistogramHasNonZeroEntries.cxx:39
IsA
#define IsA
Declare the TObject style functions.
Definition:
xAODTEventBranch.h:59
dqm_algorithms::TRTHistogramHasNonZeroEntries
Definition:
TRTHistogramHasNonZeroEntries.h:21
dqm_algorithms::TRTHistogramHasNonZeroEntries::TRTHistogramHasNonZeroEntries
TRTHistogramHasNonZeroEntries()
Definition:
TRTHistogramHasNonZeroEntries.cxx:30
python.AthDsoLogger.out
out
Definition:
AthDsoLogger.py:71
config
Definition:
PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
dqm_algorithms::TRTHistogramHasNonZeroEntries::~TRTHistogramHasNonZeroEntries
virtual ~TRTHistogramHasNonZeroEntries()
Definition:
TRTHistogramHasNonZeroEntries.cxx:35
instance
std::map< std::string, double > instance
Definition:
Run_To_Get_Tags.h:8
Result
ICscStripFitter::Result Result
Definition:
CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition:
handimod.py:524
dqm_algorithms::TRTHistogramHasNonZeroEntries::m_name
std::string m_name
Definition:
TRTHistogramHasNonZeroEntries.h:32
python.handimod.Red
Red
Definition:
handimod.py:551
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:228
dqm_algorithms::TRTHistogramHasNonZeroEntries::execute
virtual dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition:
TRTHistogramHasNonZeroEntries.cxx:44
dqm_algorithms
Definition:
AddReference.h:17
TRTHistogramHasNonZeroEntries.h
dqm_algorithms::TRTHistogramHasNonZeroEntries::printDescription
virtual void printDescription(std::ostream &out)
Definition:
TRTHistogramHasNonZeroEntries.cxx:80
AlgorithmHelper.h
pickleTool.object
object
Definition:
pickleTool.py:30
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string ¶mName, const std::map< std::string, double > ¶ms)
Definition:
AlgorithmHelper.cxx:339
histogram
std::string histogram
Definition:
chains.cxx:52
Generated on Mon Dec 23 2024 21:22:14 for ATLAS Offline Software by
1.8.18