26 std::vector<ElementLink<xAOD::PFOContainer>> empty;
32 return StatusCode::SUCCESS;
36 std::vector<const xAOD::PFO*> shotPFOs;
41 shotPFOs.push_back(shotPFO);
45 std::map<unsigned, const xAOD::CaloCluster*> shotToClusterMap =
getShotToClusterMap(shotPFOs, pi0ClusterContainer, tau);
56 TLorentzVector clusterP4;
59 clusterP4 = vertexedCluster.
p4();
62 clusterP4 = cluster->p4();
67 if (clusterP4.DeltaR(tauAxis) > 0.4)
continue;
71 neutralPFOContainer.
push_back(neutralPFO);
74 neutralPFO->
setP4(clusterP4.Pt(), clusterP4.Eta(), clusterP4.Phi(), 0.);
85 std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.
vertexedClusters();
87 TLorentzVector clusterP4 = vertexedCluster.p4();
90 if(clusterP4.E()<=0.)
continue;
91 if(clusterP4.DeltaR(tauAxis) > 0.2)
continue;
93 double clusterEnergyHad = 0.;
102 for (; cellLink != cellLinks->
end(); ++cellLink) {
105 int sampling =
cell->caloDDE()->getSampling();
106 if (sampling < 8)
continue;
109 double cellEnergy =
cell->e() * cellLink.
weight();
110 clusterEnergyHad += cellEnergy;
114 if(clusterEnergyHad <= 0.)
continue;
118 hadronicPFOContainer.
push_back(hadronicPFO);
128 return StatusCode::SUCCESS;
136 std::map<unsigned, const xAOD::CaloCluster*> shotToClusterMap;
140 int seedHashInt = -1;
142 ATH_MSG_WARNING(
"Couldn't find seed hash. Set it to -1, no cluster will be associated to shot.");
152 float weightInCluster = -1.;
153 float weightInPreviousCluster = -1;
158 TLorentzVector clusterP4;
161 clusterP4 = vertexedCluster.
p4();
164 clusterP4 = cluster->p4();
167 weightInCluster = -1.;
169 if (clusterP4.DeltaR(tauAxis) > 0.4)
continue;
173 for (; cellLink != cellLinks->
end(); ++cellLink) {
177 if (
cell->caloDDE()->calo_hash() != seedHash)
continue;
179 weightInCluster = cellLink.
weight();
184 if (weightInCluster < 0)
continue;
187 if (weightInPreviousCluster < 0) {
190 shotToClusterMap[
index] = cluster;
191 weightInPreviousCluster = weightInCluster;
197 if (weightInCluster > weightInPreviousCluster) {
198 shotToClusterMap[
index] = cluster;
206 return shotToClusterMap;
212 const std::map<unsigned, const xAOD::CaloCluster*>& shotToClusterMap,
214 std::vector<unsigned> shotsMatchedToCluster;
219 if (
iterator == shotToClusterMap.end())
continue;
220 if (
iterator->second != &pi0Cluster)
continue;
222 shotsMatchedToCluster.push_back(
index);
225 return shotsMatchedToCluster;
231 const std::vector<unsigned>& shotsInCluster)
const {
232 int totalPhotons = 0;
240 totalPhotons += nPhotons;
249 std::vector<int> nPosECells(3, 0);
253 for (; cellLink != cellLinks->
end(); ++cellLink) {
255 int sampling =
cell->caloDDE()->getSampling();
258 int layer = sampling%4;
259 if (layer < 3 && cell->
e() > 0) {
270 float coreEnergyEM1 = 0.;
271 float totalEnergyEM1 = 0.;
275 for (; cellLink != cellLinks->
end(); ++cellLink) {
279 int sampling =
cell->caloDDE()->getSampling();
280 if (sampling != 1 && sampling != 5)
continue;
284 float cellEnergy =
cell->e() * cellLink.
weight();
285 if (cellEnergy <= 0)
continue;
287 totalEnergyEM1 += cellEnergy;
293 if(std::abs(
deltaPhi) > 0.05 || std::abs(
deltaEta) > 2 * 0.025/8.)
continue;
295 coreEnergyEM1 += cellEnergy;
298 if (totalEnergyEM1 <= 0.)
return 0.;
299 return coreEnergyEM1/totalEnergyEM1;
305 std::vector<float> deltaEtaFirstMom (3, 0.);
306 std::vector<float> totalEnergy (3, 0.);
310 for (; cellLink != cellLinks->
end(); ++cellLink) {
314 int sampling =
cell->caloDDE()->getSampling();
315 int layer = sampling%4;
316 if (
layer >= 3)
continue;
319 float cellEnergy =
cell->e();
320 if (cellEnergy <= 0)
continue;
324 totalEnergy[
layer] += cellEnergy;
328 if (totalEnergy[
layer] != 0.) {
329 deltaEtaFirstMom[
layer]/=std::abs(totalEnergy[
layer]);
332 deltaEtaFirstMom[
layer]=0.;
336 return deltaEtaFirstMom;
342 std::vector<float> deltaEtaSecondMom (3, 0.);
343 std::vector<float> totalEnergy (3, 0.);
347 for (; cellLink != cellLinks->
end(); ++cellLink) {
351 int sampling =
cell->caloDDE()->getSampling();
352 int layer = sampling%4;
353 if (
layer >= 3)
continue;
356 float cellEnergy=
cell->e();
357 if (cellEnergy <= 0)
continue;
361 totalEnergy[
layer] += cellEnergy;
365 if (totalEnergy[
layer] != 0.) {
366 deltaEtaSecondMom[
layer]/=std::abs(totalEnergy[
layer]);
369 deltaEtaSecondMom[
layer]=0.;
373 return deltaEtaSecondMom;
381 const std::vector<const xAOD::PFO*>& shotPFOs,
382 const std::map<unsigned, const xAOD::CaloCluster*>& shotToClusterMap,
399 int NHitsInEM1 =
getNPhotons(shotPFOs, shotsInCluster);
432 const std::array< std::pair<Moment, Attribute>, 12> momentAttributePairs {{
447 for (
const auto& [moment, attribute] : momentAttributePairs) {
449 if (! cluster.retrieveMoment(moment,
value)) {
461 std::vector<ElementLink<xAOD::IParticleContainer>> shotlinks;
465 if (!shotElementLink.
isValid()) {
468 shotlinks.push_back(shotElementLink);
474 return StatusCode::SUCCESS;
480 double clusterEnergyHad,
482 double clusterPtHad = clusterEnergyHad/std::cosh(cluster.eta());
483 hadronicPFO.
setP4(clusterPtHad, cluster.eta(), cluster.phi(), 0.);
485 return StatusCode::SUCCESS;