15#include "GaudiKernel/ThreadLocalContext.h"
46 <<
"as the source collection for topo calo clusters");
49 return StatusCode::FAILURE;
52 "Calo clusters associated with objects in "
54 <<
" will be retained in this format with the rest being thinned away");
70 return StatusCode::SUCCESS;
80 return StatusCode::SUCCESS;
87 const EventContext& ctx = Gaudi::Hive::currentContext();
94 unsigned int nTopoClusters = importedTopoCaloCluster->size();
95 if (nTopoClusters == 0)
96 return StatusCode::SUCCESS;
99 std::vector<bool> topomask;
100 topomask.assign(nTopoClusters,
false);
106 importedJets = importedJetsHandle.
ptr();
107 if (importedJets ==
nullptr) {
109 <<
" found in StoreGate!");
110 return StatusCode::FAILURE;
112 unsigned int nJets(importedJets->
size());
114 return StatusCode::SUCCESS;
115 std::vector<const xAOD::Jet*> jetToCheck;
120 std::vector<int>
entries = m_parser->evaluateAsVector();
121 unsigned int nEntries =
entries.size();
123 if (nJets != nEntries) {
124 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string "
125 "used jets objects??");
126 return StatusCode::FAILURE;
129 for (
unsigned int i = 0; i < nJets; ++i)
131 jetToCheck.push_back((*importedJets)[i]);
134 if(jetToCheck.empty())
135 return StatusCode::SUCCESS;
138 const auto& links =
jet->constituentLinks();
139 for(
const auto& link : links ) {
141 if( ! link.isValid() ) {
144 topomask.at( link.index() ) =
true;
150 const auto& links =
jet->constituentLinks();
151 for(
const auto& link : links ) {
153 if( ! link.isValid() ) {
156 topomask.at( link.index() ) =
true;
162 for (
unsigned int i = 0; i < nTopoClusters; ++i) {
168 importedTopoCaloCluster.
keep(topomask);
172 tempClusters.
keep(topomask);
175 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
This file defines helper classes to deal with jet constituents.
Handle for requesting thinning for a data object.
size_type size() const noexcept
Returns the number of elements in the collection.
std::atomic< unsigned int > m_npassTopo
virtual StatusCode finalize() override
SG::ReadHandleKey< xAOD::JetContainer > m_sgKey
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_TopoClSGKey
JetCaloClusterThinning(const std::string &t, const std::string &n, const IInterface *p)
Gaudi::Property< std::vector< std::string > > m_addClusterSGKey
std::string m_selectionString
std::vector< SG::ThinningHandleKey< xAOD::CaloClusterContainer > > m_addClusterKeys
virtual StatusCode initialize() override
StringProperty m_streamName
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_tmpAddClusterKey
virtual ~JetCaloClusterThinning()
virtual StatusCode doThinning() const override
std::atomic< unsigned int > m_ntotTopo
const_pointer_type ptr()
Dereference the pointer.
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Handle for requesting thinning for a data object.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".