81 gsl::span<const unsigned char> TPCShMap = recoData->clusterShMapTPC;
83 int nClus = trk.getNClusters();
84 if (nClus < npntCut) {
89 constexpr float TAN10 = 0.17632698;
90 const auto clusterIdxStruct = recoData->getTPCTracksClusterRefs();
91 const auto clusterNativeAccess = recoData->inputsTPCclusters->clusterIndex;
96 trkParam.resetCovariance();
97 float bzkG = prop->getNominalBz(), qptB5Scale = std::abs(bzkG) > 0.1 ? std::abs(bzkG) / 5.006680f : 1.f;
98 float q2pt2 = trkParam.getQ2Pt() * trkParam.getQ2Pt(), q2pt2Wgh = q2pt2 * qptB5Scale * qptB5Scale;
99 float err2 = (100.f + q2pt2Wgh) / (1.f + q2pt2Wgh) * q2pt2;
100 trkParam.setCov(err2, 14);
102 int direction = inv ? -1 : 1;
103 int start = inv ? nClus - 1 : 0;
104 int stop = inv ? -1 : nClus;
106 uint8_t sector,
row = 0, currentSector = 0, currentRow = 0;
107 short clusterState = 0, nextState;
109 bool stopLoop =
false;
111 for (
int i =
start;
i != stop;
i += cl ? 0 : direction) {
112 float x,
y,
z, xTmp, yTmp, zTmp,
charge = 0.f;
118 auto clTmp = &trk.getCluster(clusterIdxStruct,
i, clusterNativeAccess, sector,
row);
119 if (
row < algConf.minTPCPadRow) {
124 }
else if (
row > algConf.maxTPCPadRow) {
131 if (
i + direction != stop) {
140 if (algConf.discardSectorEdgeDepth > 0) {
141 if (std::abs(yTmp) + algConf.discardSectorEdgeDepth > xTmp * TAN10) {
142 if (
i + direction != stop) {
153 nextState = TPCShMap[cl - clusterNativeAccess.clustersLinear];
155 if (
clusters == 0 || (sector == currentSector && std::abs(
row - currentRow) < algConf.maxTPCRowsCombined)) {
168 currentSector = sector;
170 clusterState = nextState;
172 LOGP(
debug,
"starting a supercluster at row {} of sector {} -> {},{},{}", currentRow, currentSector,
x,
y,
z);
176 x += xTmp * cl->
qTot;
177 y += yTmp * cl->
qTot;
178 z += zTmp * cl->
qTot;
181 clusterState |= nextState;
183 LOGP(
debug,
"merging cluster #{} at row {} to a supercluster starting at row {} ",
clusters + 1,
row, currentRow);
187 if (
i + direction != stop) {
203 currentRow = combRow /
charge;
204 LOGP(
debug,
"Combined cluster of {} subclusters: row {} , {},{},{}",
clusters, currentRow,
x,
y,
z);
207 if (!trkParam.rotate(math_utils::detail::sector2Angle<float>(currentSector)) || !prop->PropagateToXBxByBz(trkParam,
x, algConf.maxSnp)) {
219 mController->
getTPCParam()->GetClusterErrors2(sector, currentRow,
z, trkParam.getSnp(), trkParam.getTgl(), -1.f, 0.f, 0.f,
c[0],
c[2]);
221 int nrComb = std::abs(
row - currentRow) + 1;
223 float fact = 1. / std::sqrt(nrComb);
228 c[0] += sysE[0] * sysE[0];
231 c[2] += sysE[1] * sysE[1];
234 if (!trkParam.update(p,
c)) {
238 auto& pnt = algTrack->addDetectorPoint();
239 pnt.setYZErrTracking(
c[0],
c[1],
c[2]);
241 pnt.setNeedUpdateFromTrack();
243 pnt.setXYZTracking(
x,
y,
z);
244 pnt.setSensor(sectSensor);
245 pnt.setAlphaSens(sectSensor->getAlpTracking());
246 pnt.setXSens(sectSensor->getXTracking());
248 pnt.setSID(sectSensor->getSID());
249 pnt.setContainsMeasurement();
254 if (npoints < npntCut) {
255 algTrack->suppressLastPoints(npoints);