85{
86
87
88 SG::ThinningHandle<xAOD::CaloClusterContainer> importedTopoCaloCluster(
90
91
92 unsigned int nTopoClusters = importedTopoCaloCluster->size();
93 if (nTopoClusters == 0)
94 return StatusCode::SUCCESS;
95
96
97 std::vector<bool> topomask;
98 topomask.assign(nTopoClusters, false);
100
101
103 SG::ReadHandle<xAOD::JetContainer> importedJetsHandle{
m_sgKey, ctx };
104 importedJets = importedJetsHandle.
ptr();
105 if (importedJets == nullptr) {
107 << " found in StoreGate!");
108 return StatusCode::FAILURE;
109 }
110 unsigned int nJets(importedJets->size());
111 if (nJets == 0)
112 return StatusCode::SUCCESS;
113 std::vector<const xAOD::Jet*> jetToCheck;
114 jetToCheck.clear();
115
116
118 std::vector<int>
entries = m_parser->evaluateAsVector();
120
121 if (nJets != nEntries) {
122 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string "
123 "used jets objects??");
124 return StatusCode::FAILURE;
125 } else {
126
127 for (
unsigned int i = 0;
i < nJets; ++
i)
129 jetToCheck.push_back((*importedJets)[i]);
130 }
131
132 if(jetToCheck.empty())
133 return StatusCode::SUCCESS;
134
136 const auto&
links = jet->constituentLinks();
137 for( const auto& link : links ) {
138
139 if( !
link.isValid() ) {
140 continue;
141 }
142 topomask.at(
link.index() ) =
true;
143 }
144 }
145 }
146 else{
147 for(
const xAOD::Jet* jet : *importedJets){
148 const auto&
links = jet->constituentLinks();
149 for( const auto& link : links ) {
150
151 if( !
link.isValid() ) {
152 continue;
153 }
154 topomask.at(
link.index() ) =
true;
155 }
156 }
157 }
158
159
160 for (
unsigned int i = 0;
i < nTopoClusters; ++
i) {
161 if (topomask[i])
163 }
164
165
166 importedTopoCaloCluster.keep(topomask);
167
169 SG::ThinningHandle<xAOD::CaloClusterContainer> tempClusters(addClusterKey);
170 tempClusters.keep(topomask);
171 }
172
173 return StatusCode::SUCCESS;
174}
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.
pointer & link(pointer p) const
Return a reference to the link for an element.
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".