7 #include "GaudiKernel/ServiceHandle.h"
29 return StatusCode::SUCCESS;
33 return StatusCode::SUCCESS;
36 std::vector<InDet::PixelClusterParts>
39 std::vector<InDet::PixelClusterParts> Parts;
41 const std::vector<Identifier> & Rdos = OrigCluster.
rdoList();
42 const unsigned int NumPixels =
static_cast<unsigned int>(Rdos.size());
46 if (NumPixels < m_minPixels || NumPixels >
m_maxPixels)
return Parts;
48 std::vector<InDetDD::SiCellId> CellIds(NumPixels);
51 std::transform(Rdos.begin(),Rdos.end(), CellIds.begin(), getCellId);
65 const auto [pMinPhi,pMaxPhi] = std::minmax_element(CellIds.begin(), CellIds.end(), comparePhi);
66 const auto [pMinEta,pMaxEta] = std::minmax_element(CellIds.begin(), CellIds.end(), compareEta);
67 const auto & MinPhiIdx = pMinPhi->phiIndex();
68 const auto & MaxPhiIdx = pMaxPhi->phiIndex();
69 const auto & MinEtaIdx = pMinEta->etaIndex();
70 const auto & MaxEtaIdx = pMaxEta->etaIndex();
71 const int PhiWidth = MaxPhiIdx - MinPhiIdx + 1;
72 const int EtaWidth = MaxEtaIdx - MinEtaIdx + 1;
75 const std::vector<float> & Charges = OrigCluster.
chargeList();
77 std::vector<float> PhiChargeHist(PhiWidth, 0.);
78 unsigned int NumPhiMinima = 0;
79 std::vector<unsigned int> PhiMinimaLoc(PhiWidth/2);
80 std::vector<float> PhiMinimaQuality(PhiWidth/2);
84 for (
unsigned int i = 0;
i < NumPixels;
i++)
85 PhiChargeHist[CellIds[
i].
phiIndex() - MinPhiIdx] += Charges[
i];
88 for (
int i = 1;
i < PhiWidth - 1;
i++)
90 if (PhiChargeHist[
i-1] <= PhiChargeHist[
i] || PhiChargeHist[
i] >= PhiChargeHist[
i+1])
continue;
92 PhiMinimaLoc[NumPhiMinima] =
static_cast<unsigned int>(
i);
93 PhiMinimaQuality[NumPhiMinima++] = (PhiChargeHist[
i+1] + PhiChargeHist[
i-1] - 2.*PhiChargeHist[
i]) /
94 (PhiChargeHist[
i+1] + PhiChargeHist[
i-1]);
98 std::vector<float> EtaChargeHist(EtaWidth, 0.);
99 unsigned int NumEtaMinima = 0;
100 std::vector<unsigned int> EtaMinimaLoc(EtaWidth/2);
101 std::vector<float> EtaMinimaQuality(EtaWidth/2);
102 const float LongPixScale = 2./3.;
107 for (
unsigned int i = 0;
i < NumPixels;
i++)
110 if ( (PixType % 2) == 1 )
111 Scale = LongPixScale;
114 EtaChargeHist[CellIds[
i].etaIndex() - MinEtaIdx] +=
Scale*Charges[
i];
118 for (
int i = 1;
i < EtaWidth - 1;
i++)
120 if (EtaChargeHist[
i-1] <= EtaChargeHist[
i] || EtaChargeHist[
i] >= EtaChargeHist[
i+1])
continue;
122 EtaMinimaLoc[NumEtaMinima] =
static_cast<unsigned int>(
i);
123 EtaMinimaQuality[NumEtaMinima++] = (EtaChargeHist[
i+1] + EtaChargeHist[
i-1] - 2.*EtaChargeHist[
i]) /
124 (EtaChargeHist[
i+1] + EtaChargeHist[
i-1]);
129 unsigned int bestMin = 0;
130 float bestQual = -1.;
132 for (
unsigned int i = 0;
i < NumPhiMinima;
i++)
134 if (PhiMinimaQuality[
i] <= bestQual)
continue;
136 bestMin = PhiMinimaLoc[
i];
137 bestQual = PhiMinimaQuality[
i];
139 for (
unsigned int i = 0;
i < NumEtaMinima;
i++)
141 if (EtaMinimaQuality[
i] <= bestQual)
continue;
143 bestMin = EtaMinimaLoc[
i];
144 bestQual = EtaMinimaQuality[
i];
146 const int SplitIndex =
static_cast<int>(bestMin);
156 ATH_MSG_ERROR(
"<InDet::TotPixelClusterSplitter::splitCluster> : Unrecognized SplitType!");
163 const int LowIdx = (
Type ==
PhiSplit) ? MinPhiIdx : MinEtaIdx;
166 std::vector<Identifier> SplitRdos[2];
167 std::vector<int> Totgroups[2];
168 std::vector<int> Lvl1groups[2];
170 const std::vector<int>& OrigTots = OrigCluster.
totList();
171 const int Lvl1a = OrigCluster.
LVL1A();
185 const PixelID& pixelID = *pixelIDp;
188 for (
unsigned int i = 0;
i < NumPixels;
i++)
190 Idx = (CellIds[
i].*IndexFunc)() - LowIdx;
191 if (Idx < SplitIndex)
193 SplitRdos[0].push_back(Rdos[
i]);
194 Totgroups[0].push_back(OrigTots[
i]);
195 Lvl1groups[0].push_back(Lvl1a);
197 else if (Idx > SplitIndex)
199 SplitRdos[1].push_back(Rdos[
i]);
200 Totgroups[1].push_back(OrigTots[
i]);
201 Lvl1groups[1].push_back(Lvl1a);
205 for (
int j = 0; j < 2; j++)
214 SplitRdos[j].push_back(Rdos[
i]);
215 Totgroups[j].push_back(calibData->
getToT(
type, moduleHash, FE, Charges[
i] / 2.0));
216 Lvl1groups[j].push_back(Lvl1a);
221 Parts.emplace_back(SplitRdos[0], Totgroups[0], Lvl1groups[0]);
222 Parts.emplace_back(SplitRdos[1], Totgroups[1], Lvl1groups[1]);
236 if (EtaIdx%18 != 0 && EtaIdx%18 != 17)
238 if (PhiIdx==152 || PhiIdx==154 || PhiIdx==156 || PhiIdx==158 ||
239 PhiIdx==169 || PhiIdx==171 || PhiIdx==173 || PhiIdx==175)
241 else if (PhiIdx==153 || PhiIdx==155 || PhiIdx==157 || PhiIdx==159 ||
242 (PhiIdx > 159 && PhiIdx < 168) ||
243 PhiIdx==168 || PhiIdx==170 || PhiIdx==172 || PhiIdx==174)
250 if (PhiIdx==152 || PhiIdx==154 || PhiIdx==156 || PhiIdx==158 ||
251 PhiIdx==169 || PhiIdx==171 || PhiIdx==173 || PhiIdx==175)
253 else if (PhiIdx==153 || PhiIdx==155 || PhiIdx==157 || PhiIdx==159 ||
254 (PhiIdx > 159 && PhiIdx < 168) ||
255 PhiIdx==168 || PhiIdx==170 || PhiIdx==172 || PhiIdx==174)