15 #include "GaudiKernel/ThreadLocalContext.h"
30 , m_selectionString(
"")
32 declareInterface<DerivationFramework::IThinningTool>(
this);
45 ATH_CHECK(m_TopoClSGKey.initialize(m_streamName));
47 <<
"as the source collection for topo calo clusters");
48 if (m_sgKey.empty()) {
50 return StatusCode::FAILURE;
53 "Calo clusters associated with objects in "
55 <<
" will be retained in this format with the rest being thinned away");
59 for(
unsigned int i=0;
i < m_addClusterSGKey.size();
i++){
60 m_tmpAddClusterKey = m_addClusterSGKey[
i];
61 ATH_CHECK(m_tmpAddClusterKey.initialize(m_streamName));
62 m_addClusterKeys.push_back(m_tmpAddClusterKey);
67 if (!m_selectionString.empty()) {
68 ATH_CHECK(initializeParser(m_selectionString));
71 return StatusCode::SUCCESS;
78 ATH_MSG_INFO(
"Processed " << m_ntotTopo <<
" topo clusters, of which "
79 << m_npassTopo <<
" were retained ");
81 return StatusCode::SUCCESS;
88 const EventContext& ctx = Gaudi::Hive::currentContext();
95 unsigned int nTopoClusters = importedTopoCaloCluster->size();
96 if (nTopoClusters == 0)
97 return StatusCode::SUCCESS;
100 std::vector<bool> topomask;
101 topomask.assign(nTopoClusters,
false);
102 m_ntotTopo += nTopoClusters;
107 importedJets = importedJetsHandle.ptr();
108 if (importedJets ==
nullptr) {
109 ATH_MSG_ERROR(
"No jet collection with name " << m_sgKey.key()
110 <<
" found in StoreGate!");
111 return StatusCode::FAILURE;
113 unsigned int nJets(importedJets->
size());
115 return StatusCode::SUCCESS;
116 std::vector<const xAOD::Jet*> jetToCheck;
120 if (!m_selectionString.empty()) {
121 std::vector<int>
entries = m_parser->evaluateAsVector();
125 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string "
126 "used jets objects??");
127 return StatusCode::FAILURE;
130 for (
unsigned int i = 0;
i < nJets; ++
i)
132 jetToCheck.push_back((*importedJets)[
i]);
135 if(jetToCheck.empty())
136 return StatusCode::SUCCESS;
139 const auto&
links =
jet->constituentLinks();
140 for(
const auto& link :
links ) {
142 if( ! link.isValid() ) {
145 topomask.at( link.index() ) =
true;
151 const auto&
links =
jet->constituentLinks();
152 for(
const auto& link :
links ) {
154 if( ! link.isValid() ) {
157 topomask.at( link.index() ) =
true;
163 for (
unsigned int i = 0;
i < nTopoClusters; ++
i) {
169 importedTopoCaloCluster.
keep(topomask);
171 for(
const auto & addClusterKey : m_addClusterKeys){
173 tempClusters.
keep(topomask);
176 return StatusCode::SUCCESS;