41 return StatusCode::SUCCESS;
46 float sumETCellsLAr = 0.;
47 float eta0cut = 0.075;
48 float eta1cut = 0.0475;
49 float eta2cut = 0.075;
53 float phi2cut = 0.075;
54 float phi3cut = 0.075;
62 constexpr size_t numberOfEM_Layers{4};
63 constexpr double invalidCoordinate{-11111.};
64 constexpr double invalidCoordinateThreshold{-11110.};
65 std::array<double, numberOfEM_Layers> extrapolatedEta{};
66 std::array<double, numberOfEM_Layers> extrapolatedPhi{};
67 extrapolatedEta.fill(invalidCoordinate);
68 extrapolatedPhi.fill(invalidCoordinate);
72 std::unique_ptr<Trk::CaloExtension> uniqueExtension ;
74 trackIndex = orgTrack->
index();
79 Gaudi::Hive::currentContext(), *orgTrack);
80 caloExtension = uniqueExtension.get();
85 caloExtension = (*particleCache)[trackIndex];
86 ATH_MSG_VERBOSE(
"Getting element " << trackIndex <<
" from the particleCache");
87 if( not caloExtension ){
88 ATH_MSG_VERBOSE(
"Cache does not contain a calo extension -> Calculating with the a CaloExtensionTool" );
90 Gaudi::Hive::currentContext(), *orgTrack);
91 caloExtension = uniqueExtension.get();
94 if( not caloExtension){
95 ATH_MSG_DEBUG(
"extrapolation of leading track to calo surfaces failed : caloExtension is nullptr" );
96 return StatusCode::RECOVERABLE;
98 const std::vector<Trk::CurvilinearParameters>& clParametersVector = caloExtension->
caloLayerIntersections();
99 if(clParametersVector.empty() ){
100 ATH_MSG_DEBUG(
"extrapolation of leading track to calo surfaces failed : caloLayerIntersection is empty" );
101 return StatusCode::RECOVERABLE;
109 if( sample == CaloSampling::PreSamplerE || sample == CaloSampling::PreSamplerB )
index = 0;
110 else if( sample == CaloSampling::EME1 || sample == CaloSampling::EMB1 )
index = 1;
111 else if( sample == CaloSampling::EME2 || sample == CaloSampling::EMB2 )
index = 2;
112 else if( sample == CaloSampling::EME3 || sample == CaloSampling::EMB3 )
index = 3;
113 if(
index < 0 )
continue;
114 extrapolatedEta[
index] = cur.position().eta();
115 extrapolatedPhi[
index] = cur.position().phi();
117 for (
size_t i = 0; i < numberOfEM_Layers; ++i) {
118 if ( extrapolatedEta[i] < invalidCoordinateThreshold || extrapolatedPhi[i] < invalidCoordinateThreshold ){
119 ATH_MSG_DEBUG(
"extrapolation of leading track to calo surfaces failed for sampling : " << i );
120 return StatusCode::SUCCESS;
125 std::bitset<200000> cellSeen{};
126 const std::unordered_map<int, int> samplingLookup{
127 {4,0}, {5,1}, {6,2}, {7,3}, {8,12},
128 {15, 12}, {16,13}, {17,14}, {18,12}, {19, 13}, {20,14}
130 const auto notFound{samplingLookup.end()};
132 std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.
vertexedClusters();
137 if (cell_links ==
nullptr) {
138 ATH_MSG_DEBUG(
"NO Cell links found for cluster with pT " << cluster.
pt());
143 for (; pCellIter != pCellIterE; ++pCellIter) {
144 double cellEta{}, cellPhi{}, cellET{};
150 cellPhi = vxCell.
phi();
151 cellEta = vxCell.
eta();
152 cellET = vxCell.
et();
154 cellPhi = pCell->
phi();
155 cellEta = pCell->
eta();
156 cellET = pCell->
et();
159 if (
const auto & pElement {samplingLookup.find(sampling)};pElement != notFound){
160 sampling = pElement->second;
163 if (sampling < 4) i = sampling;
164 if (sampling == 12 || sampling == 13 || sampling == 14) i = 3;
165 detPhiTrk = TVector2::Phi_mpi_pi(cellPhi-extrapolatedPhi[i]);
166 detEtaTrk = std::abs( cellEta - extrapolatedEta[i] );
167 if ((sampling == 0 && detEtaTrk < eta0cut && detPhiTrk < phi0cut) ||
168 (sampling == 1 && detEtaTrk < eta1cut && detPhiTrk < phi1cut) ||
169 (sampling == 2 && detEtaTrk < eta2cut && detPhiTrk < phi2cut) ||
170 (sampling == 3 && detEtaTrk < eta3cut && detPhiTrk < phi3cut)) {
171 sumETCellsLAr += cellET;
177 return StatusCode::SUCCESS;