ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
dqm_algorithms
src
BasicGraphCheck.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/BasicGraphCheck.h
>
11
#include <
dqm_algorithms/tools/AlgorithmHelper.h
>
12
#include <TGraph.h>
13
#include <TClass.h>
14
#include <ers/ers.h>
15
16
#include <dqm_core/AlgorithmManager.h>
17
18
namespace
19
{
20
dqm_algorithms::BasicGraphCheck
GraphFilling(
"Graph_Not_Empty"
);
21
dqm_algorithms::BasicGraphCheck
GraphEmpty(
"Graph_Empty"
);
22
23
}
24
25
26
dqm_algorithms::BasicGraphCheck::BasicGraphCheck
(
const
std::string & name )
27
:
m_name
( name )
28
{
29
dqm_core::AlgorithmManager::instance().registerAlgorithm(name,
this
);
30
}
31
32
dqm_algorithms::BasicGraphCheck
*
33
dqm_algorithms::BasicGraphCheck::clone
()
34
{
35
36
return
new
BasicGraphCheck
(
m_name
);
37
}
38
39
40
dqm_core::Result *
41
dqm_algorithms::BasicGraphCheck::execute
(
const
std::string & name ,
42
const
TObject &
object
,
43
const
dqm_core::AlgorithmConfig & config)
44
{
45
const
TGraph * graph;
46
47
if
(
object
.
IsA
()->InheritsFrom(
"TGraph"
) ) {
48
graph =
static_cast<
const
TGraph*
>
(&object);
49
}
else
{
50
throw
dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TGraph"
);
51
}
52
53
double
minstat =
dqm_algorithms::tools::GetFirstFromMap
(
"MinStat"
, config.getParameters(), -1 );
54
55
if
(graph->GetN() < minstat ) {
56
dqm_core::Result *result =
new
dqm_core::Result(dqm_core::Result::Undefined);
57
result->tags_[
"InsufficientN"
] = graph->GetN();
58
return
result;
59
}
60
61
if
(
m_name
==
"Graph_Not_Empty"
) {
62
if
(graph->GetN() != 0) {
63
ERS_DEBUG(1,
"Graph "
<<graph->GetName()<<
" is Not Empty"
);
64
return
new
dqm_core::Result(dqm_core::Result::Green);
65
}
else
{
66
ERS_DEBUG(1,
"Graph "
<<graph->GetName()<<
" is Empty"
);
67
return
new
dqm_core::Result(dqm_core::Result::Red);
68
}
69
}
else
if
(
m_name
==
"Graph_Empty"
) {
70
if
(graph->GetN() == 0) {
71
ERS_DEBUG(1,
"Graph "
<<graph->GetName()<<
" is Empty"
);
72
return
new
dqm_core::Result(dqm_core::Result::Green);
73
}
else
{
74
ERS_DEBUG(1,
"Graph "
<<graph->GetName()<<
" is Not Empty"
);
75
return
new
dqm_core::Result(dqm_core::Result::Red);
76
}
77
}
else
{
78
return
new
dqm_core::Result();
79
}
80
81
82
}
83
84
void
85
dqm_algorithms::BasicGraphCheck::printDescription
(std::ostream& out)
86
{
87
if
(
m_name
==
"Graph_Not_Empty"
){
88
out<<
"Graph_Not_Empty: Checks that graph is not empty\n"
<<std::endl;
89
}
else
if
(
m_name
==
"Graph_Empty"
){
90
out<<
"Graph_Empty: Checks that graph is empty\n"
<<std::endl;
91
}
92
93
out<<
"Optional Parameter: MinStat: Minimum graph statistics needed to perform Algorithm\n"
<<std::endl;
94
}
95
AlgorithmHelper.h
BasicGraphCheck.h
file declares the dqm_core::BasicGraphCheck class.
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string ¶mName, const std::map< std::string, double > ¶ms)
Definition
AlgorithmHelper.cxx:346
dqm_algorithms::BasicGraphCheck
Definition
BasicGraphCheck.h:19
dqm_algorithms::BasicGraphCheck::m_name
std::string m_name
Definition
BasicGraphCheck.h:29
dqm_algorithms::BasicGraphCheck::BasicGraphCheck
BasicGraphCheck(const std::string &name)
Definition
BasicGraphCheck.cxx:26
dqm_algorithms::BasicGraphCheck::clone
BasicGraphCheck * clone()
Definition
BasicGraphCheck.cxx:33
dqm_algorithms::BasicGraphCheck::execute
dqm_core::Result * execute(const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
Definition
BasicGraphCheck.cxx:41
dqm_algorithms::BasicGraphCheck::printDescription
void printDescription(std::ostream &out)
Definition
BasicGraphCheck.cxx:85
IsA
#define IsA
Declare the TObject style functions.
Definition
xAODTEventBranch.h:59
Generated on
for ATLAS Offline Software by
1.17.0