![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
11 #ifndef GENERATIONBASE
16 #ifndef XAOD_STANDALONE
28 #ifndef XAOD_STANDALONE
29 declareInterface< ::IMetaDataTool >(
this );
30 #endif // XAOD_STANDALONE
41 #ifndef XAOD_STANDALONE
47 return StatusCode::SUCCESS;
51 #ifdef XAOD_STANDALONE
64 if (m_numberOfWeightVariations == 0) {
66 #ifndef GENERATIONBASE
67 if (inputMetaStore()->contains<xAOD::TruthMetaDataContainer>(
"TruthMetaData")) {
70 if (
status.isRecoverable()) {
73 return StatusCode::FAILURE;
83 if (m_numberOfWeightVariations == 0) {
84 ATH_MSG_ERROR(
"Could not determine the number of weight variations");
85 return StatusCode::FAILURE;
88 ATH_MSG_INFO(
"Using number of event weight variations " << m_numberOfWeightVariations);
90 #ifndef XAOD_STANDALONE
91 ATH_CHECK(m_cutFlowSvcPrivate->setNumberOfWeightVariations(m_numberOfWeightVariations));
95 #ifdef XAOD_STANDALONE
100 ATH_MSG_INFO(
"Preparing local cache for source '" << source <<
"' with " << m_numberOfWeightVariations <<
" variations");
105 auto sit = m_inputContainers.find(source);
106 if (sit != m_inputContainers.end()) {
107 ATH_MSG_ERROR(
"Undefined behaviour: this file has already been processed");
108 return StatusCode::FAILURE;
113 std::string incompleteCollName =
"Incomplete" + m_inputCollName;
114 if (inputMetaStore()->contains<xAOD::CutBookkeeperContainer>(incompleteCollName)) {
115 for (
size_t i{};
i < m_numberOfWeightVariations; ++
i) {
116 std::string
name = incompleteCollName;
118 name.append(
"_weight_");
121 if (inputMetaStore()->contains<xAOD::CutBookkeeperContainer>(
name)
126 ATH_MSG_DEBUG(
"Successfully merged input incomplete bookkeepers with output");
128 ATH_MSG_INFO(
"No incomplete bookkeepers with name '" << incompleteCollName <<
"' in this file");
132 if (inputMetaStore()->contains<xAOD::CutBookkeeperContainer>(m_inputCollName)) {
137 for (
size_t i{};
i < m_numberOfWeightVariations; ++
i) {
138 std::string
name = m_inputCollName;
140 name.append(
"_weight_");
143 if (inputMetaStore()->contains<xAOD::CutBookkeeperContainer>(
name)
148 ATH_MSG_DEBUG(
"Successfully copied complete bookkeepers to temp container");
150 ATH_MSG_INFO(
"No complete bookkeepers with name '" << m_inputCollName.value() <<
"' in this file");
153 return StatusCode::SUCCESS;
156 #ifdef XAOD_STANDALONE
162 #ifdef XAOD_STANDALONE
165 ATH_MSG_INFO(
"Copying input containers for source '" << source <<
"'");
166 ATH_CHECK(copyInputContainersToOutput(m_completeContainers, source));
168 return StatusCode::SUCCESS;
189 name.append(
"_weight_");
192 std::string incompleteName =
"Incomplete" +
name;
198 ATH_MSG_ERROR(
"Could not get " <<
name <<
" CutBookkeepers from output MetaDataStore");
199 return StatusCode::FAILURE;
207 if (
outputMetaStore()->contains<xAOD::CutBookkeeperContainer>(incompleteName)) {
210 ATH_MSG_ERROR(
"Could not get " << incompleteName <<
" CutBookkeepers from output MetaDataStore");
211 return StatusCode::FAILURE;
226 ATH_MSG_INFO(
"Successfully copied CutBookkeepers to the output MetaDataStore");
228 return StatusCode::SUCCESS;
244 if (!source.empty()) {
248 return StatusCode::SUCCESS;
251 for (std::size_t
i = 0;
i <
it->second.size(); ++
i) {
256 return StatusCode::SUCCESS;
260 for (std::size_t
i = 0;
i <
list.size(); ++
i) {
266 return StatusCode::SUCCESS;
271 #ifndef XAOD_STANDALONE
276 if (!cache.
empty()) {
283 for (std::size_t
i = 0;
i < cache.
size(); ++
i) {
288 return StatusCode::FAILURE;
292 return StatusCode::SUCCESS;
298 #ifdef GENERATIONBASE
299 return StatusCode::RECOVERABLE;
303 ATH_MSG_DEBUG(
"Attempting to retrieve MC channel number...");
306 if (
inputMetaStore()->contains<xAOD::FileMetaData>(
"FileMetaData")) {
308 float fltChannelNumber{-1};
314 ATH_MSG_WARNING(
"... MC channel number could not be loaded from FileMetaData");
315 #ifdef XAOD_STANDALONE
318 return StatusCode::RECOVERABLE;
333 auto itTruthMetaDataPtr = std::find_if(metaDataContainer->begin(), metaDataContainer->end(),
334 [
mcChannelNumber] (
const auto&
it) { return it->mcChannelNumber() == mcChannelNumber; }
338 if (itTruthMetaDataPtr == metaDataContainer->end()) {
339 #ifdef XAOD_STANDALONE
341 ATH_MSG_DEBUG(
"Could not load weight meta data! Assuming 1 variation.");
342 return StatusCode::SUCCESS;
344 ATH_MSG_DEBUG(
"Could not load weight meta data from TruthMetaData!");
345 return StatusCode::RECOVERABLE;
350 const std::vector<std::string> &truthWeightNames = (*itTruthMetaDataPtr)->weightNames();
358 return StatusCode::SUCCESS;
366 #ifdef XAOD_STANDALONE
367 return StatusCode::SUCCESS;
372 if (container ==
nullptr) {
375 return StatusCode::SUCCESS;
381 return StatusCode::FAILURE;
387 const coral::Attribute& attr
390 ATH_MSG_DEBUG(
"Attempting to load weight meta data from /Generation/Parameters");
391 std::map<std::string, int> truthWeightMap;
396 return StatusCode::SUCCESS;
397 #endif // XAOD_STANDALONE
def retrieve(aClass, aKey=None)
CondAttrListCollection * at(unsigned int i) const
Element access.
StatusCode parse(std::tuple< Tup... > &tup, const Gaudi::Parsers::InputData &input)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
const CutBookkeepersLocalCache & getCutBookkeepers() const
Get CutBookkeepers cache.
bool msgLvl(const MSG::Level lvl) const
std::vector< std::unique_ptr< xAOD::CutBookkeeperContainer > > cont
size_type size() const
size of payload vector
static void prepareContainers(CutBookkeepersLocalCache &target, size_t size, bool extend=false)
Helper in-memory structure.
This implements the methods for ICutFlowSvc.
std::vector< std::unique_ptr< xAOD::CutBookkeeperAuxContainer > > aux
::StatusCode StatusCode
StatusCode definition for legacy code.
ChanNum chanNum(unsigned int index) const
channel number for index: (index = 0 to size-1)
Container that holds the Container of all CutBookkeepers.
void updateContainer(xAOD::CutBookkeeperContainer *contToUpdate, const xAOD::CutBookkeeperContainer *otherCont)
Helper function to update a container with information from another one.
const AttributeList & attributeList(ChanNum chanNum) const
attribute list for a given channel number
xAOD::CutBookkeeperContainer * at(std::size_t n) const
std::string to_string(const DetectorType &type)
size_type size() const
number of Chan/AttributeList pairs
#define ATH_MSG_WARNING(x)
bool empty() const noexcept
Returns true if the collection is empty.