86{
87 const EventContext& ctx = Gaudi::Hive::currentContext();
88
89
90 SG::ThinningHandle<xAOD::CaloClusterContainer> importedTopoCaloCluster(
92
93
94 unsigned int nTopoClusters = importedTopoCaloCluster->size();
95 if (nTopoClusters == 0)
96 return StatusCode::SUCCESS;
97
98
99 std::vector<bool> topomask;
100 topomask.assign(nTopoClusters, false);
102
103
105 SG::ReadHandle<xAOD::JetContainer> importedJetsHandle{
m_sgKey, ctx };
106 importedJets = importedJetsHandle.
ptr();
107 if (importedJets == nullptr) {
109 << " found in StoreGate!");
110 return StatusCode::FAILURE;
111 }
112 unsigned int nJets(importedJets->size());
113 if (nJets == 0)
114 return StatusCode::SUCCESS;
115 std::vector<const xAOD::Jet*> jetToCheck;
116 jetToCheck.clear();
117
118
120 std::vector<int>
entries = m_parser->evaluateAsVector();
122
123 if (nJets != nEntries) {
124 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string "
125 "used jets objects??");
126 return StatusCode::FAILURE;
127 } else {
128
129 for (
unsigned int i = 0;
i < nJets; ++
i)
131 jetToCheck.push_back((*importedJets)[i]);
132 }
133
134 if(jetToCheck.empty())
135 return StatusCode::SUCCESS;
136
138 const auto&
links = jet->constituentLinks();
139 for( const auto& link : links ) {
140
141 if( ! link.isValid() ) {
142 continue;
143 }
144 topomask.at( link.index() ) = true;
145 }
146 }
147 }
148 else{
149 for(
const xAOD::Jet* jet : *importedJets){
150 const auto&
links = jet->constituentLinks();
151 for( const auto& link : links ) {
152
153 if( ! link.isValid() ) {
154 continue;
155 }
156 topomask.at( link.index() ) = true;
157 }
158 }
159 }
160
161
162 for (
unsigned int i = 0;
i < nTopoClusters; ++
i) {
163 if (topomask[i])
165 }
166
167
168 importedTopoCaloCluster.keep(topomask);
169
171 SG::ThinningHandle<xAOD::CaloClusterContainer> tempClusters(addClusterKey);
172 tempClusters.keep(topomask);
173 }
174
175 return StatusCode::SUCCESS;
176}
SG::ReadHandleKey< xAOD::JetContainer > m_sgKey
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_TopoClSGKey
std::vector< SG::ThinningHandleKey< xAOD::CaloClusterContainer > > m_addClusterKeys
const_pointer_type ptr()
Dereference the pointer.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".