Skip to content

Commit f9ce336

Browse files
sgnoohcslava77devel
authored andcommitted
Fix pLS hit position retrieval using correct seed index
ipLS does not correspond to the seed index in the tracking ntuple because prepareInput filters seeds by algo type (4/22) and pt cuts. Use pixelSeeds.seedIdx()[ipLS] to get the original seed index when indexing into trk_see_hitIdx and trk_see_hitType.
1 parent 4fa6497 commit f9ce336

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,17 +1802,18 @@ std::map<unsigned int, unsigned int> setPixelLineSegmentBranches(
18021802
ana.tx->pushbackToBranch<int>("pLS_charge", pixelSeeds.charge()[ipLS]);
18031803
ana.tx->pushbackToBranch<float>("pLS_deltaPhi", pixelSeeds.deltaPhi()[ipLS]);
18041804
ana.tx->pushbackToBranch<int>("pLS_nhit", hit_idx.size());
1805-
for (size_t ihit = 0; ihit < trk_see_hitIdx[ipLS].size() && ihit < lst::Params_pLS::kHits; ++ihit) {
1806-
int hitidx = trk_see_hitIdx[ipLS][ihit];
1807-
bool isPixel = static_cast<HitType>(trk_see_hitType[ipLS][ihit]) == HitType::Pixel;
1805+
unsigned int seedIdx = pixelSeeds.seedIdx()[ipLS];
1806+
for (size_t ihit = 0; ihit < trk_see_hitIdx[seedIdx].size() && ihit < lst::Params_pLS::kHits; ++ihit) {
1807+
int hitidx = trk_see_hitIdx[seedIdx][ihit];
1808+
bool isPixel = static_cast<HitType>(trk_see_hitType[seedIdx][ihit]) == HitType::Pixel;
18081809
auto const& x = isPixel ? trk_pix_x[hitidx] : trk_ph2_x[hitidx];
18091810
auto const& y = isPixel ? trk_pix_y[hitidx] : trk_ph2_y[hitidx];
18101811
auto const& z = isPixel ? trk_pix_z[hitidx] : trk_ph2_z[hitidx];
18111812
ana.tx->pushbackToBranch<float>(TString::Format("pLS_hit%zu_x", ihit), x);
18121813
ana.tx->pushbackToBranch<float>(TString::Format("pLS_hit%zu_y", ihit), y);
18131814
ana.tx->pushbackToBranch<float>(TString::Format("pLS_hit%zu_z", ihit), z);
18141815
}
1815-
if (trk_see_hitIdx[ipLS].size() == 3) {
1816+
if (trk_see_hitIdx[seedIdx].size() == 3) {
18161817
ana.tx->pushbackToBranch<float>("pLS_hit3_x", -999);
18171818
ana.tx->pushbackToBranch<float>("pLS_hit3_y", -999);
18181819
ana.tx->pushbackToBranch<float>("pLS_hit3_z", -999);

0 commit comments

Comments
 (0)