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