ATLAS Offline Software
Loading...
Searching...
No Matches
CommonAugmentation.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// CommonAugmentation.cxx
8// Author: James Catmore (James.Catmore@cern.ch)
9// This code loops over common tools from the CP groups, which write
10// into SG so that other derivations can make use of them without
11// re-running the tools.
12
14
15#include <sstream> // C++ utilities
16#include <string>
17#include <algorithm>
18#include <fstream>
19
20#include "GaudiKernel/ISvcLocator.h"
22#include "AthLinks/ElementLink.h"
23#include "GaudiKernel/Chrono.h"
24
28
30
31DerivationFramework::CommonAugmentation::CommonAugmentation(const std::string& name, ISvcLocator* pSvcLocator) :
32AthReentrantAlgorithm(name, pSvcLocator)
33{
34}
35
36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
37
39
40 ATH_MSG_INFO("Initializing the common selections in " << name());
41
42 // get the augmentation tools
43 ATH_CHECK ( m_augmentationTools.retrieve() );
44 ATH_MSG_INFO("The following augmentation tools will be applied....");
46
47 // get the chrono auditor
48 ATH_CHECK ( m_chronoSvc.retrieve() );
49
50 return StatusCode::SUCCESS;
51
52}
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
55
56StatusCode DerivationFramework::CommonAugmentation::execute(const EventContext& ctx) const {
57
58 // On your marks.... get set....
59 Chrono chrono( &(*m_chronoSvc), name() );
60 // GO!!
61
62 //=============================================================================
63 // AUGMENTATION ===============================================================
64 //=============================================================================
65 for (const auto & augmentationTool : m_augmentationTools) {
66 if ( augmentationTool->addBranches(ctx).isFailure() ) {
67 ATH_MSG_ERROR("Augmentation failed!");
68 return StatusCode::FAILURE;
69 }
70 }
71
72 return StatusCode::SUCCESS;
73
74}
75
76// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
77
79
80 ATH_MSG_INFO( "============================================================================");
81 ATH_MSG_INFO( " The following CP tools were called by " << name() << " for the whole train:");
82 for (const auto & augmentationTool : m_augmentationTools) {
83 ATH_MSG_INFO ( augmentationTool->name() );
84 }
85 ATH_MSG_INFO( "============================================================================");
86
87 return StatusCode::SUCCESS;
88
89}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
defines an "iterator" over instances of a given type in StoreGateSvc
An STL vector of pointers that by default owns its pointed-to elements.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode execute(const EventContext &ctx) const override
ServiceHandle< IChronoStatSvc > m_chronoSvc
CommonAugmentation(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
PublicToolHandleArray< IAugmentationTool > m_augmentationTools