ATLAS Offline Software
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 
25 #include "StoreGate/DataHandle.h"
27 #include "SGTools/StlVectorClids.h"
28 
30 
31 DerivationFramework::CommonAugmentation::CommonAugmentation(const std::string& name, ISvcLocator* pSvcLocator) :
32 AthReentrantAlgorithm(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....");
45  ATH_MSG_INFO(m_augmentationTools);
46 
47  // get the chrono auditor
48  ATH_CHECK ( m_chronoSvc.retrieve() );
49 
50  return StatusCode::SUCCESS;
51 
52 }
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
55 
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 }
CommonAugmentation.h
python.HION7.augmentationTool
list augmentationTool
Definition: HION7.py:233
DerivationFramework::CommonAugmentation::CommonAugmentation
CommonAugmentation(const std::string &name, ISvcLocator *pSvcLocator)
Definition: CommonAugmentation.cxx:31
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DerivationFramework::CommonAugmentation::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: CommonAugmentation.cxx:56
DataHandle.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
StlVectorClids.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
DerivationFramework::CommonAugmentation::finalize
virtual StatusCode finalize() override
Definition: CommonAugmentation.cxx:78
DefaultKey.h
DerivationFramework::CommonAugmentation::initialize
virtual StatusCode initialize() override
Definition: CommonAugmentation.cxx:38