ATLAS Offline Software
Loading...
Searching...
No Matches
ClusterAtMLScaleTool.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
8#include "GaudiKernel/ThreadLocalContext.h"
9
10
14
15
17
19 ATH_MSG_ERROR("As the name suggests, ClusterAtMLScaleTool cannot operate on objects of type "
20 << m_inputType);
21 return StatusCode::FAILURE;
22 }
23
25
26 const std::string& type = m_clusterMLCorrectedEnergyDecorationType.value();
27 if (type != "float" && type != "double") {
29 "Invalid value for ClusterMLCorrectedEnergyDecorationType: '"
30 << type
31 << "'. Allowed values are 'float' and 'double'.");
32 return StatusCode::FAILURE;
33 }
34
35 return StatusCode::SUCCESS;
36}
37
38
39template <typename T>
42 const EventContext& ctx) const
43 {
46
47 if (!dec.isValid()) {
48 ATH_MSG_ERROR("Decoration handle is not valid: "
50 return StatusCode::FAILURE;
51 }
52
53 for (xAOD::CaloCluster* cl : cont) {
54 if (!cl) continue;
55
56 const double calE = dec(*cl);
57
58 cl->setCalE(calE);
59 cl->setCalM(cl->rawM());
60 cl->setCalPhi(cl->rawPhi());
61 cl->setCalEta(cl->rawEta());
62 }
63
64 return StatusCode::SUCCESS;
65 }
66template StatusCode
69 const EventContext&) const;
70
71template StatusCode
74 const EventContext&) const;
75
76
78
79 const EventContext& ctx = Gaudi::Hive::currentContext();
80 return (m_clusterMLCorrectedEnergyDecorationType.value() == "double")
83}
84
85
87 xAOD::CaloClusterContainer* clust = dynamic_cast<xAOD::CaloClusterContainer*> (cont); // Get CaloCluster container
88 if(clust)
89 return setClustersToMLScale(*clust);
90
91 return StatusCode::FAILURE;
92}
93
94
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
Handle class for reading a decoration on an object.
StatusCode setClustersToMLScale(xAOD::CaloClusterContainer &cont) const
SG::ReadDecorHandleKey< xAOD::CaloClusterContainer > m_clusterMLCorrectedEnergyKey
Gaudi::Property< std::string > m_clusterMLCorrectedEnergyDecorationType
ClusterAtMLScaleTool(const std::string &name)
virtual StatusCode process_impl(xAOD::IParticleContainer *cont) const override
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
StatusCode setClustersToMLScaleImpl(xAOD::CaloClusterContainer &cont, const EventContext &ctx) const
JetConstituentModifierBase(const std::string &name)
Handle class for reading a decoration on an object.
@ CaloCluster
The object is a calorimeter cluster.
Definition ObjectType.h:39
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.