Execute the algorithm.
37{
38 SG::ThinningHandle<xAOD::TauJetContainer>
taus (
m_taus, ctx);
40
41 SG::ThinningHandle<xAOD::TauTrackContainer> tauTracks (
m_tauTracks, ctx);
42 tauTracks.thinAll();
43
44 SG::ThinningHandle<xAOD::PFOContainer> neutralPFOs (
m_neutralPFOs, ctx);
45 neutralPFOs.thinAll();
46
47 SG::ThinningHandle<xAOD::CaloClusterContainer> pi0clusters (
m_pi0clusters, ctx);
48 pi0clusters.thinAll();
49
50 SG::ThinningHandle<CaloClusterCellLinkContainer> pi0CellLinks (
m_pi0CellLinks, ctx);
51 pi0CellLinks.thinAll();
52
53 SG::ThinningHandle<xAOD::PFOContainer> shotPFOs (
m_shotPFOs, ctx);
54 shotPFOs.thinAll();
55
56 SG::ThinningHandle<xAOD::PFOContainer> hadronicPFOs (
m_hadronicPFOs, ctx);
57 hadronicPFOs.thinAll();
58
60 secondaryVertices.thinAll();
61
62 SG::ThinningHandle<CaloCellContainer>
cells (
m_cells, ctx);
64
65 SG::ThinningHandle<CaloClusterCellLinkContainer> tauCellLinks (
m_tauCellLinks, ctx);
66 tauCellLinks.thinAll();
67
68
69
70
71 std::optional<SG::ThinningHandle<xAOD::ParticleContainer> > finalPi0sOpt;
74 finalPi0sOpt->thinAll();
75 }
76
77 std::optional<SG::ThinningHandle<xAOD::CaloClusterContainer> > shotclustersOpt;
80 shotclustersOpt->thinAll();
81 }
82
83 std::optional<SG::ThinningHandle<CaloClusterCellLinkContainer> > shotCellLinksOpt;
86 shotCellLinksOpt->thinAll();
87 }
88
89 static const SG::ConstAccessor<char> acc_passThinning("passThinning");
90
92
93 if (!acc_passThinning(*tau)) continue;
94
95
97
98
100
102 continue;
103
104 tauTracks.keep(
track->index());
105 }
106
107
110
111 for (
const xAOD::IParticle* particle :
tau->clusters()) {
113 TLorentzVector clusterP4 = cluster->
p4();
114
115
116 if (tauVertex) {
117 xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, tauVertex->
position());
118 clusterP4 = vertexedCluster.p4();
119 }
120
122
123 const CaloClusterCellLink* cellLinks = cluster->
getCellLinks();
124 if (!cellLinks) {
126 continue;
127 }
128
129
131 if(cellLinks_it != tauCellLinks->end()) {
132 size_t link_index = std::distance(tauCellLinks->begin(), cellLinks_it);
133 tauCellLinks.keep(link_index);
134 }
135 else {
137 continue;
138 }
139
140
141 CaloClusterCellLink::const_iterator
it = cellLinks->
begin();
142 CaloClusterCellLink::const_iterator
end = cellLinks->
end();
144 if (
it.index() >=
cells->size()) {
145 ATH_MSG_WARNING(
"Cell index " <<
it.index() <<
" is larger than the number of cells in " <<
m_cells.key() <<
" (" <<
cells->size() <<
")" );
146 continue;
147 }
149 }
150 }
151
152
153 for(
size_t i=0;
i<
tau->nNeutralPFOs();
i++) {
154
155
157
158
160
161
163
164
165 neutralPFOs.keep(
tau->neutralPFO(i)->index());
166
167
168 pi0clusters.keep(cluster->index());
169
170
171 const CaloClusterCellLink* cellLinks = cluster->
getCellLinks();
173 if(cellLinks_it != pi0CellLinks->end()) {
174 size_t link_index = std::distance(pi0CellLinks->begin(), cellLinks_it);
175 pi0CellLinks.keep(link_index);
176 }
177 else {
179 }
180
181
182 CaloClusterCellLink::const_iterator
it = cellLinks->
begin();
183 CaloClusterCellLink::const_iterator
end = cellLinks->
end();
185 if (
it.index() >=
cells->size()) {
186 ATH_MSG_WARNING(
"Cell index " <<
it.index() <<
" is larger than the number of cells in " <<
m_cells.key() <<
" (" <<
cells->size() <<
")" );
187 continue;
188 }
190 }
191 }
192
193
194 if (finalPi0sOpt) {
195 for(
size_t i=0;
i<
tau->nPi0s();
i++) {
196 finalPi0sOpt->keep(
tau->pi0(i)->index());
197 }
198 }
199
200
201 for(
size_t i=0;
i<
tau->nShotPFOs();
i++) {
202
203 shotPFOs.keep(
tau->shotPFO(i)->index());
204
205
207 if (!cluster) continue;
208 if (shotclustersOpt) {
209 shotclustersOpt->keep(cluster->index());
210 }
211
212
213 const CaloClusterCellLink* cellLinks = cluster->
getCellLinks();
214 if (shotCellLinksOpt) {
216 if(cellLinks_it != (*shotCellLinksOpt)->end()) {
217 size_t link_index = std::distance((*shotCellLinksOpt)->begin(), cellLinks_it);
218 shotCellLinksOpt->keep(link_index);
219 }
220 else {
222 }
223 }
224
225
226 CaloClusterCellLink::const_iterator
it = cellLinks->
begin();
227 CaloClusterCellLink::const_iterator
end = cellLinks->
end();
229 if (
it.index() >=
cells->size()) {
230 ATH_MSG_WARNING(
"Cell index " <<
it.index() <<
" is larger than the number of cells in " <<
m_cells.key() <<
" (" <<
cells->size() <<
")" );
231 continue;
232 }
234 }
235 }
236
237
238 for(
size_t i=0;
i<
tau->nHadronicPFOs();
i++) {
239 hadronicPFOs.keep(
tau->hadronicPFO(i)->index());
240 }
241
242
243 if (
tau->secondaryVertex() !=
nullptr) {
244 secondaryVertices.keep(
tau->secondaryVertex()->index());
245 }
246 }
247
248 return StatusCode::SUCCESS;
249}
#define ATH_MSG_WARNING(x,...)
ServiceHandle< StoreGateSvc > & evtStore()
const_iterator end() const
const end method
const_iterator begin() const
const begin method
DataModel_detail::const_iterator< DataVector > const_iterator
SG::ThinningHandleKey< CaloClusterCellLinkContainer > m_tauCellLinks
Gaudi::Property< float > m_DrTauClusters
SG::ThinningHandleKey< xAOD::ParticleContainer > m_finalPi0s
Gaudi::Property< float > m_DrTauNeutrals
SG::ThinningHandleKey< xAOD::VertexContainer > m_secondaryVertices
SG::ThinningHandleKey< CaloClusterCellLinkContainer > m_pi0CellLinks
Gaudi::Property< bool > m_saveOnlyGoodTracks
SG::ThinningHandleKey< xAOD::TauJetContainer > m_taus
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_shotclusters
Gaudi::Property< bool > m_doVertexCorrection
Gaudi::Property< float > m_minNeutralPFOPt
SG::ThinningHandleKey< xAOD::PFOContainer > m_shotPFOs
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_pi0clusters
SG::ThinningHandleKey< xAOD::PFOContainer > m_hadronicPFOs
SG::ThinningHandleKey< CaloCellContainer > m_cells
SG::ThinningHandleKey< CaloClusterCellLinkContainer > m_shotCellLinks
SG::ThinningHandleKey< xAOD::PFOContainer > m_neutralPFOs
SG::ThinningHandleKey< xAOD::TauTrackContainer > m_tauTracks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version).
virtual FourMom_t p4() const
The full 4-momentum of the particle.
const Amg::Vector3D & position() const
Returns the 3-pos.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Vertex_v1 Vertex
Define the latest version of the vertex class.
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".