ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
MetadataHistAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
8
//
9
// includes
10
//
11
12
#include <
AsgAnalysisAlgorithms/MetadataHistAlg.h
>
13
#include <TH1.h>
14
15
//
16
// method implementations
17
//
18
19
namespace
CP
20
{
21
22
StatusCode MetadataHistAlg ::
23
initialize ()
24
{
25
if
(
m_histogramName
.empty())
26
{
27
ANA_MSG_ERROR
(
"histogram name should not be empty"
);
28
return
StatusCode::FAILURE;
29
}
30
31
if
(
m_dataType
.empty())
32
{
33
ANA_MSG_ERROR
(
"dataType should not be empty"
);
34
return
StatusCode::FAILURE;
35
}
36
37
if
(
m_campaign
.empty())
38
{
39
ANA_MSG_ERROR
(
"campaign should not be empty"
);
40
return
StatusCode::FAILURE;
41
}
42
43
if
(
m_mcChannelNumber
.empty())
44
{
45
ANA_MSG_ERROR
(
"mcChannelNumber should not be empty"
);
46
return
StatusCode::FAILURE;
47
}
48
49
if
(
m_etag
.empty())
50
{
51
ANA_MSG_ERROR
(
"etag should not be empty"
);
52
return
StatusCode::FAILURE;
53
}
54
55
return
StatusCode::SUCCESS;
56
}
57
58
59
60
StatusCode MetadataHistAlg ::
61
execute (
const
EventContext&
/*ctx*/
)
62
{
63
if
(!
m_firstEvent
)
64
{
65
return
StatusCode::SUCCESS;
66
}
67
68
m_firstEvent
=
false
;
69
70
ANA_CHECK
(
book
(TH1F (
m_histogramName
.value().c_str(),
"Sample metadata"
, 4, 0.0, 4.0)));
71
TH1 *
histogram
=
hist
(
m_histogramName
);
72
73
// Please keep the bin order unchanged
74
histogram
->GetXaxis()->SetBinLabel(1,
m_dataType
.value().c_str());
75
histogram
->GetXaxis()->SetBinLabel(2,
m_campaign
.value().c_str());
76
histogram
->GetXaxis()->SetBinLabel(3,
m_mcChannelNumber
.value().c_str());
77
histogram
->GetXaxis()->SetBinLabel(4,
m_etag
.value().c_str());
78
79
return
StatusCode::SUCCESS;
80
}
81
82
83
StatusCode MetadataHistAlg ::
84
finalize ()
85
{
86
return
StatusCode::SUCCESS;
87
}
88
}
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
MetadataHistAlg.h
histogram
std::string histogram
Definition
chains.cxx:52
AthHistogramming::book
StatusCode book(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
Definition
AthHistogramming.h:305
AthHistogramming::hist
TH1 * hist(const std::string &histName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered histograms of any type.
Definition
AthHistogramming.cxx:164
CP::MetadataHistAlg::m_etag
Gaudi::Property< std::string > m_etag
the e-tag of the sample to store
Definition
MetadataHistAlg.h:49
CP::MetadataHistAlg::m_campaign
Gaudi::Property< std::string > m_campaign
the campaign of the sample to store
Definition
MetadataHistAlg.h:41
CP::MetadataHistAlg::m_firstEvent
bool m_firstEvent
whether the next event will be the first event
Definition
MetadataHistAlg.h:54
CP::MetadataHistAlg::m_mcChannelNumber
Gaudi::Property< std::string > m_mcChannelNumber
the mc channel number of the sample to store
Definition
MetadataHistAlg.h:45
CP::MetadataHistAlg::m_histogramName
Gaudi::Property< std::string > m_histogramName
the name of the histogram to use
Definition
MetadataHistAlg.h:33
CP::MetadataHistAlg::m_dataType
Gaudi::Property< std::string > m_dataType
the data type of the sample to store
Definition
MetadataHistAlg.h:37
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
Generated on
for ATLAS Offline Software by
1.17.0