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;
58 const EventContext& ctx = Gaudi::Hive::currentContext();
64 constexpr size_t numberOfEM_Layers{4};
65 constexpr double invalidCoordinate{-11111.};
66 constexpr double invalidCoordinateThreshold{-11110.};
67 std::array<double, numberOfEM_Layers> extrapolatedEta{};
68 std::array<double, numberOfEM_Layers> extrapolatedPhi{};
69 extrapolatedEta.fill(invalidCoordinate);
70 extrapolatedPhi.fill(invalidCoordinate);
74 std::unique_ptr<Trk::CaloExtension> uniqueExtension ;
76 trackIndex = orgTrack->index();
81 caloExtension = uniqueExtension.get();
86 caloExtension = (*particleCache)[trackIndex];
87 ATH_MSG_VERBOSE(
"Getting element " << trackIndex <<
" from the particleCache");
88 if( not caloExtension ){
89 ATH_MSG_VERBOSE(
"Cache does not contain a calo extension -> Calculating with the a CaloExtensionTool" );
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;
127 std::bitset<200000> cellSeen{};
128 const std::unordered_map<int, int> samplingLookup{
129 {4,0}, {5,1}, {6,2}, {7,3}, {8,12},
130 {15, 12}, {16,13}, {17,14}, {18,12}, {19, 13}, {20,14}
132 const auto notFound{samplingLookup.end()};
134 std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.
vertexedClusters();
139 if (cell_links ==
nullptr) {
140 ATH_MSG_DEBUG(
"NO Cell links found for cluster with pT " << cluster.
pt());
145 for (; pCellIter != pCellIterE; ++pCellIter) {
146 double cellEta{}, cellPhi{}, cellET{};
152 cellPhi = vxCell.
phi();
153 cellEta = vxCell.
eta();
154 cellET = vxCell.
et();
156 cellPhi = pCell->
phi();
157 cellEta = pCell->
eta();
158 cellET = pCell->
et();
161 if (
const auto & pElement {samplingLookup.find(sampling)};pElement != notFound){
162 sampling = pElement->second;
165 if (sampling < 4) i = sampling;
166 if (sampling == 12 || sampling == 13 || sampling == 14) i = 3;
167 detPhiTrk = TVector2::Phi_mpi_pi(cellPhi-extrapolatedPhi[i]);
168 detEtaTrk = std::abs( cellEta - extrapolatedEta[i] );
169 if ((sampling == 0 && detEtaTrk < eta0cut && detPhiTrk < phi0cut) ||
170 (sampling == 1 && detEtaTrk < eta1cut && detPhiTrk < phi1cut) ||
171 (sampling == 2 && detEtaTrk < eta2cut && detPhiTrk < phi2cut) ||
172 (sampling == 3 && detEtaTrk < eta3cut && detPhiTrk < phi3cut)) {
173 sumETCellsLAr += cellET;
179 return StatusCode::SUCCESS;