ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
dqm_algorithms
src
BasicHistoCheckModuleStatus.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
8
9
#include <dqm_core/AlgorithmConfig.h>
10
#include <
dqm_algorithms/BasicHistoCheckModuleStatus.h
>
11
#include <
dqm_algorithms/tools/AlgorithmHelper.h
>
12
#include <TH1.h>
13
#include <TF1.h>
14
#include <TClass.h>
15
#include <ers/ers.h>
16
17
#include <dqm_core/AlgorithmManager.h>
18
19
namespace
20
{
21
dqm_algorithms::BasicHistoCheckModuleStatus
BinsFilled(
"ModuleStatus_All_Bins_Filled"
);
22
23
}
24
25
26
dqm_algorithms::BasicHistoCheckModuleStatus::BasicHistoCheckModuleStatus
(
const
std::string & name )
27
:
m_name
( name )
28
{
29
dqm_core::AlgorithmManager::instance().registerAlgorithm(name,
this
);
30
}
31
32
dqm_algorithms::BasicHistoCheckModuleStatus
*
33
dqm_algorithms::BasicHistoCheckModuleStatus::clone
()
34
{
35
36
return
new
BasicHistoCheckModuleStatus
(
m_name
);
37
}
38
39
40
dqm_core::Result *
41
dqm_algorithms::BasicHistoCheckModuleStatus::execute
(
const
std::string & name ,
42
const
TObject &
object
,
43
const
dqm_core::AlgorithmConfig & config)
44
{
45
const
TH1 *
histogram
;
46
47
if
(
object
.
IsA
()->InheritsFrom(
"TH1"
) ) {
48
histogram
=
static_cast<
const
TH1*
>
(&object);
49
if
(
histogram
->GetDimension() > 3 ){
50
throw
dqm_core::BadConfig( ERS_HERE, name,
"dimension > 3 "
);
51
}
52
}
else
{
53
throw
dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1"
);
54
}
55
56
const
double
minstat =
dqm_algorithms::tools::GetFirstFromMap
(
"MinStat"
, config.getParameters(), -1);
57
58
if
(
histogram
->GetEntries() < minstat ) {
59
dqm_core::Result *result =
new
dqm_core::Result(dqm_core::Result::Undefined);
60
result->tags_[
"InsufficientEntries"
] =
histogram
->GetEntries();
61
return
result;
62
}
63
64
65
66
if
(
m_name
==
"ModuleStatus_All_Bins_Filled"
) {
67
unsigned
int
nbinsX_filled = 0;
68
const
unsigned
int
binsx =
histogram
->GetNbinsX();
69
//const unsigned int binsy = histogram->GetNbinsY();
70
//const unsigned int binsz = histogram->GetNbinsZ();
71
for
(
unsigned
int
i(1); i <= binsx; ++i ) {
72
//for ( unsigned int j(1); j <= binsy; ++j ) {
73
//for ( unsigned int k(1); k<= binsz; ++k ) {
74
double
content=
histogram
-> GetBinContent(i);
75
if
( content == 0) {
76
// ERS_DEBUG(1, "Histogram " <<histogram->GetName()<<" has empty bins");
77
// return new dqm_core::Result(dqm_core::Result::Red);
78
79
nbinsX_filled++;
80
}
81
82
}
83
84
if
(
histogram
->GetEffectiveEntries() == 0){
85
86
ERS_DEBUG(1,
"Histogram "
<<
histogram
->GetName()<<
" does not have all filled bins"
);
87
return
new
dqm_core::Result(dqm_core::Result::Disabled);
88
89
}
90
91
92
if
(nbinsX_filled >0 && nbinsX_filled < binsx){
93
ERS_DEBUG(1,
"Histogram "
<<
histogram
->GetName()<<
" has empty bins"
);
94
return
new
dqm_core::Result(dqm_core::Result::Red);
95
}
96
97
98
ERS_DEBUG(1,
"Histogram "
<<
histogram
->GetName()<<
" has all filled bins"
);
99
return
new
dqm_core::Result(dqm_core::Result::Green);
100
101
}
102
103
else
{
104
return
new
dqm_core::Result();
105
}
106
107
108
}
109
110
void
111
dqm_algorithms::BasicHistoCheckModuleStatus::printDescription
(std::ostream& out)
112
{
113
if
(
m_name
==
"All_Bins_Filled"
){
114
out<<
"All_Bins_Filled: Checks that all bins of histogram are filled\n"
<<std::endl;
115
}
116
117
out<<
"Optional Parameter: MinStat: Minimum histogram statistics needed to perform Algorithm\n"
<<std::endl;
118
}
119
AlgorithmHelper.h
BasicHistoCheckModuleStatus.h
histogram
std::string histogram
Definition
chains.cxx:52
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string ¶mName, const std::map< std::string, double > ¶ms)
Definition
AlgorithmHelper.cxx:346
dqm_algorithms::BasicHistoCheckModuleStatus
Definition
BasicHistoCheckModuleStatus.h:19
dqm_algorithms::BasicHistoCheckModuleStatus::clone
BasicHistoCheckModuleStatus * clone()
Definition
BasicHistoCheckModuleStatus.cxx:33
dqm_algorithms::BasicHistoCheckModuleStatus::BasicHistoCheckModuleStatus
BasicHistoCheckModuleStatus(const std::string &name)
Definition
BasicHistoCheckModuleStatus.cxx:26
dqm_algorithms::BasicHistoCheckModuleStatus::printDescription
void printDescription(std::ostream &out)
Definition
BasicHistoCheckModuleStatus.cxx:111
dqm_algorithms::BasicHistoCheckModuleStatus::m_name
std::string m_name
Definition
BasicHistoCheckModuleStatus.h:29
dqm_algorithms::BasicHistoCheckModuleStatus::execute
dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition
BasicHistoCheckModuleStatus.cxx:41
IsA
#define IsA
Declare the TObject style functions.
Definition
xAODTEventBranch.h:59
Generated on
for ATLAS Offline Software by
1.17.0