ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
dqm_algorithms
src
GatherData.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// **********************************************************************
6
// $Id: GatherData.cxx 585724 2014-02-28 18:07:18Z ponyisi $
7
// **********************************************************************
8
9
#include "
dqm_algorithms/GatherData.h
"
10
11
12
13
#include <TH1.h>
14
#include <TGraph.h>
15
#include <TEfficiency.h>
16
17
#include "dqm_core/exceptions.h"
18
#include "dqm_core/AlgorithmManager.h"
19
#include "dqm_core/Result.h"
20
#include <cmath>
21
#include <iostream>
22
#include <map>
23
24
static
dqm_algorithms::GatherData
staticInstance
;
25
26
27
namespace
dqm_algorithms
{
28
29
// *********************************************************************
30
// Public Methods
31
// *********************************************************************
32
33
GatherData::
34
GatherData
()
35
:
m_name
(
"GatherData"
)
36
{
37
dqm_core::AlgorithmManager::instance().registerAlgorithm(
m_name
,
this
);
38
}
39
40
41
GatherData::
42
~GatherData
()
43
{
44
}
45
46
47
dqm_core::Algorithm*
48
GatherData::
49
clone
()
50
{
51
return
new
GatherData
(*
this
);
52
}
53
54
55
dqm_core::Result*
56
GatherData::
57
execute
(
const
std::string& name,
const
TObject& data,
const
dqm_core::AlgorithmConfig& )
58
{
59
dqm_core::Result::Status status(dqm_core::Result::Undefined);
60
61
// Cast to the type of TObject to assess
62
const
TH1*
h
=
dynamic_cast<
const
TH1*
>
( &data );
63
const
TGraph* g =
dynamic_cast<
const
TGraph*
>
( &data );
64
const
TEfficiency* e =
dynamic_cast<
const
TEfficiency*
>
( &data );
65
if
(
h
== 0 && g == 0 && e==0 ) {
66
throw
dqm_core::BadConfig( ERS_HERE, name,
"Cannot cast data to type TH1, TGraph, or TEfficiency"
);
67
}
68
69
std::map<std::string,double>
tags
;
70
if
(
h
!= 0 ) {
71
tags
[
"Mean"
] =
h
->GetMean();
72
tags
[
"MeanError"
] =
h
->GetMeanError();
73
tags
[
"RMS"
] =
h
->GetRMS();
74
tags
[
"RMSError"
] =
h
->GetRMSError();
75
}
76
77
if
( g != 0 ) {
78
tags
[
"XMean"
] = g->GetMean(1);
79
tags
[
"YMean"
] = g->GetMean(2);
80
tags
[
"XRMS"
] = g->GetRMS(1);
81
tags
[
"YRMS"
] = g->GetRMS(2);
82
}
83
84
if
( e != 0 ) {
85
tags
[
"Mean"
] = e->GetCopyPassedHisto()->GetMean();
86
tags
[
"MeanError"
] = e->GetCopyPassedHisto()->GetMeanError();
87
tags
[
"RMS"
] = e->GetCopyPassedHisto()->GetRMS();
88
tags
[
"RMSError"
] = e->GetCopyPassedHisto()->GetRMSError();
89
}
90
91
dqm_core::Result* result =
new
dqm_core::Result( status );
92
result->tags_ = std::move(
tags
);
93
94
return
result;
95
}
96
97
98
void
99
GatherData::
100
printDescription
(std::ostream& out)
101
{
102
std::string message;
103
message +=
"\n"
;
104
message +=
"Algorithm: \""
+
m_name
+
"\"\n"
;
105
message +=
"Description: Extracts data (ex., mean, RMS) from an object without performing\n"
;
106
message +=
" any assessment; the status is always \"Undefined\"\n"
;
107
message +=
"Parameters: none\n"
;
108
message +=
"Limits: none\n"
;
109
message +=
"\n"
;
110
111
out << message;
112
}
113
114
115
// *********************************************************************
116
// Protected Methods
117
// *********************************************************************
118
119
120
}
// namespace dqm_algorithms
121
staticInstance
static dqm_algorithms::AveragePrint staticInstance
Definition
AveragePrint.cxx:19
GatherData.h
h
Header file for AthHistogramAlgorithm.
dqm_algorithms::GatherData
Definition
GatherData.h:16
dqm_algorithms::GatherData::GatherData
GatherData()
Definition
GatherData.cxx:34
dqm_algorithms::GatherData::~GatherData
virtual ~GatherData()
Definition
GatherData.cxx:42
dqm_algorithms::GatherData::clone
virtual dqm_core::Algorithm * clone()
Definition
GatherData.cxx:49
dqm_algorithms::GatherData::m_name
std::string m_name
Definition
GatherData.h:30
dqm_algorithms::GatherData::printDescription
virtual void printDescription(std::ostream &out)
Definition
GatherData.cxx:100
dqm_algorithms::GatherData::execute
virtual dqm_core::Result * execute(const std::string &name, const TObject &data, const dqm_core::AlgorithmConfig &config)
Definition
GatherData.cxx:57
tags
std::vector< std::string > tags
Definition
hcg.cxx:107
dqm_algorithms
Definition
AddReference.h:17
Generated on
for ATLAS Offline Software by
1.17.0