ATLAS Offline Software
Loading...
Searching...
No Matches
BookkeeperDumperTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
9
11
13
14
16 : asg::AsgMetadataTool(name)
17{
18#ifndef XAOD_STANDALONE
19 declareInterface< ::IMetaDataTool >( this );
20#endif // XAOD_STANDALONE
21}
22
23
25{
26 if (m_standaloneMode.value()) {
28 }
29
30 return StatusCode::SUCCESS;
31}
32
33
35{
36 // Complete CutBookkeepers
37 size_t index{};
38 while (true)
39 {
40 std::string name{"CutBookkeepers"};
41 if (index > 0) {
42 name.append("_weight_");
43 name.append(std::to_string(index));
44 }
45
47 const xAOD::CutBookkeeperContainer* completeBookkeepers{};
48 ATH_CHECK(inputMetaStore()->retrieve(completeBookkeepers, name));
49
50 ATH_MSG_INFO("Complete CBK " << name << " size = " << completeBookkeepers->size());
51 for (const xAOD::CutBookkeeper *cbk : *completeBookkeepers) {
52 ATH_MSG_INFO("Complete CBK"
53 << " name= " << cbk->name()
54 << " cycle=" << cbk->cycle()
55 << " stream=" << cbk->inputStream()
56 << " N=" << cbk->nAcceptedEvents()
57 << " W=" << cbk->sumOfEventWeights()
58 << " W2=" << cbk->sumOfEventWeightsSquared()
59 << " nc=" << cbk->nChildren());
60 }
61 index++;
62 } else {
63 if (index == 0) {
64 ATH_MSG_INFO("No complete CutBookkeepers found");
65 }
66 break;
67 }
68
69 if (!m_allVariations) {
70 break;
71 }
72 }
73
74 // Incomplete CutBookkeepers
75 index = 0;
76 while (true)
77 {
78 std::string name{"IncompleteCutBookkeepers"};
79 if (index > 0) {
80 name.append("_weight_");
81 name.append(std::to_string(index));
82 }
83
85 const xAOD::CutBookkeeperContainer* incompleteBookkeepers{};
86 ATH_CHECK(inputMetaStore()->retrieve(incompleteBookkeepers, name));
87
88 ATH_MSG_INFO("Incomplete CBK " << name << " size = " << incompleteBookkeepers->size());
89 for (const xAOD::CutBookkeeper *cbk : *incompleteBookkeepers) {
90 ATH_MSG_INFO("Incomplete CBK"
91 << " name= " << cbk->name()
92 << " cycle=" << cbk->cycle()
93 << " stream=" << cbk->inputStream()
94 << " N=" << cbk->nAcceptedEvents()
95 << " W=" << cbk->sumOfEventWeights()
96 << " W2=" << cbk->sumOfEventWeightsSquared()
97 << " nc=" << cbk->nChildren());
98 }
99 index++;
100 } else {
101 if (index == 0) {
102 ATH_MSG_INFO("No incomplete CutBookkeepers found");
103 }
104 break;
105 }
106
107 if (!m_allVariations) {
108 break;
109 }
110 }
111
112 // Complete PDF CutBookkeepers
113 if (inputMetaStore()->contains<xAOD::CutBookkeeperContainer>("PDFSumOfWeights")) {
114 const xAOD::CutBookkeeperContainer* pdfBookkeepers = nullptr;
115 ATH_CHECK(inputMetaStore()->retrieve(pdfBookkeepers, "PDFSumOfWeights"));
116
117 ATH_MSG_INFO("PDF CBK size = " << pdfBookkeepers->size());
118 for (const xAOD::CutBookkeeper *cbk : *pdfBookkeepers) {
119 ATH_MSG_INFO("PDF CBK"
120 << " name= " << cbk->name()
121 << " cycle=" << cbk->cycle()
122 << " stream=" << cbk->inputStream()
123 << " N=" << cbk->nAcceptedEvents()
124 << " W=" << cbk->sumOfEventWeights()
125 << " W2=" << cbk->sumOfEventWeightsSquared()
126 << " nc=" << cbk->nChildren());
127 }
128 } else {
129 ATH_MSG_INFO("No PDF CutBookkeepers found");
130 }
131
132 // Incomplete PDF CutBookkeepers
133 if (inputMetaStore()->contains<xAOD::CutBookkeeperContainer>("IncompletePDFSumOfWeights")) {
134 const xAOD::CutBookkeeperContainer* pdfBookkeepers = nullptr;
135 ATH_CHECK(inputMetaStore()->retrieve(pdfBookkeepers, "IncompletePDFSumOfWeights"));
136
137 ATH_MSG_INFO("Incomplete PDF CBK size = " << pdfBookkeepers->size());
138 for (const xAOD::CutBookkeeper *cbk : *pdfBookkeepers) {
139 ATH_MSG_INFO("Incomplete PDF CBK"
140 << " name= " << cbk->name()
141 << " cycle=" << cbk->cycle()
142 << " stream=" << cbk->inputStream()
143 << " N=" << cbk->nAcceptedEvents()
144 << " W=" << cbk->sumOfEventWeights()
145 << " W2=" << cbk->sumOfEventWeightsSquared()
146 << " nc=" << cbk->nChildren());
147 }
148 } else {
149 ATH_MSG_INFO("No incomplete PDF CutBookkeepers found");
150 }
151
152 return StatusCode::SUCCESS;
153}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
class definition for BookkeeperDumperTool
Gaudi::Property< bool > m_allVariations
virtual StatusCode initialize() final
Dummy implementation of the initialisation function.
Gaudi::Property< bool > m_standaloneMode
BookkeeperDumperTool(const std::string &name="BookkeeperDumperTool")
Declare the correct constructor for Athena.
virtual StatusCode beginInputFile() final
Function called when a new input file is opened.
size_type size() const noexcept
Returns the number of elements in the collection.
AsgMetadataTool(const std::string &name)
Normal ASG tool constructor with a name.
MetaStorePtr_t inputMetaStore() const
Accessor for the input metadata store.
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
Definition index.py:1
CutBookkeeper_v1 CutBookkeeper
Define the latest version of the CutBookkeeper class.
CutBookkeeperContainer_v1 CutBookkeeperContainer
Define the latest version of the CutBookkeeperContainer class.