ATLAS Offline Software
Loading...
Searching...
No Matches
AsgShallowCopyAlg.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
9
21
22
23namespace CP
24{
25 template<typename Type> StatusCode AsgShallowCopyAlg ::
26 executeTemplate (const CP::SystematicSet& sys)
27 {
28 const Type *input = nullptr;
29 ANA_CHECK (evtStore()->retrieve (input, m_inputHandle.getName (sys)));
30
31 const auto& name = m_outputHandle.getName(sys);
32 [[maybe_unused]] Type *output = nullptr;
34 (msg(), *evtStore(), output, input,
35 name, name + "Aux."));
36
37 return StatusCode::SUCCESS;
38 }
39
40
41
42 StatusCode AsgShallowCopyAlg ::
43 executeFindType (const CP::SystematicSet& sys)
44 {
45 const xAOD::IParticleContainer *input = nullptr;
47 {
48 ANA_CHECK (m_inputHandle.retrieve (input, sys));
49 }
50
51 if (dynamic_cast<const xAOD::ElectronContainer*> (input))
52 {
55 }
56 else if (dynamic_cast<const xAOD::PhotonContainer*> (input))
57 {
60 }
61 else if (dynamic_cast<const xAOD::JetContainer*> (input))
62 {
65 }
66 else if (dynamic_cast<const xAOD::MuonContainer*> (input)) {
69 }
70 else if (dynamic_cast<const xAOD::TauJetContainer*> (input))
71 {
74 }
75 else if (dynamic_cast<const xAOD::DiTauJetContainer*> (input))
76 {
79 }
80 else if (dynamic_cast<const xAOD::TrackParticleContainer*> (input))
81 {
84 }
85 else if (dynamic_cast<const xAOD::TruthParticleContainer*> (input))
86 {
89 }
91 {
94 }
95 else
96 {
97 ANA_MSG_ERROR ("unknown type contained in AsgShallowCopyAlg, please extend it");
98 return StatusCode::FAILURE;
99 }
100
101 return (this->*m_function) (sys);
102 }
103
104
105
106 AsgShallowCopyAlg ::
107 AsgShallowCopyAlg (const std::string& name,
108 ISvcLocator* pSvcLocator)
109 : AnaAlgorithm (name, pSvcLocator)
110 {
111 }
112
113
114
115 StatusCode AsgShallowCopyAlg ::
116 initialize ()
117 {
118 ANA_CHECK (m_systematicsList.service().registerCopy (m_inputHandle.getNamePattern(), m_outputHandle.getNamePattern()));
121 ANA_CHECK (m_systematicsList.initialize());
122
123 return StatusCode::SUCCESS;
124 }
125
126
127
128 StatusCode AsgShallowCopyAlg ::
129 execute ()
130 {
131 for (const auto& sys : m_systematicsList.systematicsVector())
132 {
133 ANA_CHECK ((this->*m_function) (sys));
134 }
135 return StatusCode::SUCCESS;
136 }
137}
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
StatusCode(AsgShallowCopyAlg::* m_function)(const CP::SystematicSet &sys)
SysWriteHandle< xAOD::IParticleContainer > m_outputHandle
the output view container we produce
StatusCode executeTemplate(const CP::SystematicSet &sys)
the templated version of execute for a single systematic
SysListHandle m_systematicsList
the systematics list we run
SysReadHandle< xAOD::IParticleContainer > m_inputHandle
the input collection we run on
Class to wrap a set of SystematicVariations.
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
Select isolated Photons, Electrons and Muons.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
DiTauJetContainer_v1 DiTauJetContainer
Definition of the current DiTauJet container version.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
a helper class to create shallow copies and register them in the event store
MsgStream & msg
Definition testRead.cxx:32