Skip to content

Commit ff8978f

Browse files
committed
add rawIdx to match with (sparse) SoA indices
1 parent 26fcdd0 commit ff8978f

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ void createMiniDoubletBranches() {
354354
//
355355
// The container will hold per entry a mini-doublet built by LST in the event.
356356
//
357+
#ifdef CUT_VALUE_DEBUG
358+
ana.tx->createBranch<std::vector<int>>("md_rawIdx"); // raw index in the SoA
359+
#endif
357360
ana.tx->createBranch<std::vector<bool>>("md_isPLS");
358361
ana.tx->createBranch<std::vector<float>>("md_pt"); // pt (computed based on delta phi change)
359362
ana.tx->createBranch<std::vector<float>>("md_eta"); // eta (computed based on anchor hit's eta)
@@ -389,6 +392,9 @@ void createLineSegmentBranches() {
389392
//
390393
// The container will hold per entry a line-segment built by LST in the event.
391394
//
395+
#ifdef CUT_VALUE_DEBUG
396+
ana.tx->createBranch<std::vector<int>>("ls_rawIdx"); // raw index in the SoA
397+
#endif
392398
ana.tx->createBranch<std::vector<bool>>("ls_isPLS");
393399
// pt (computed based on radius of the circle formed by three points: (origin), (anchor hit 1), (anchor hit 2))
394400
ana.tx->createBranch<std::vector<float>>("ls_pt");
@@ -425,6 +431,9 @@ void createTripletBranches() {
425431
//
426432
// The container will hold per entry a triplets built by LST in the event.
427433
//
434+
#ifdef CUT_VALUE_DEBUG
435+
ana.tx->createBranch<std::vector<int>>("t3_rawIdx"); // raw index in the SoA
436+
#endif
428437
// pt (computed based on radius of the circle formed by three points: anchor hit 1, 2, 3
429438
ana.tx->createBranch<std::vector<float>>("t3_pt");
430439
ana.tx->createBranch<std::vector<float>>("t3_eta"); // eta (computed based on last anchor hit's eta)
@@ -484,6 +493,9 @@ void createQuintupletBranches() {
484493
//
485494
// The container will hold per entry a quintuplet built by LST in the event.
486495
//
496+
#ifdef CUT_VALUE_DEBUG
497+
ana.tx->createBranch<std::vector<int>>("t5_rawIdx"); // raw index in the SoA
498+
#endif
487499
// pt (computed based on average of the 4 circles formed by, (1, 2, 3), (2, 3, 4), (3, 4, 5), (1, 3, 5)
488500
ana.tx->createBranch<std::vector<std::vector<float>>>("t5_embed");
489501
ana.tx->createBranch<std::vector<float>>("t5_dnnScore");
@@ -513,6 +525,9 @@ void createPixelLineSegmentBranches() {
513525
//
514526
// The container will hold per entry a pixel line segment (built by an external algo, e.g. patatrack) accepted by LST in the event.
515527
//
528+
#ifdef CUT_VALUE_DEBUG
529+
ana.tx->createBranch<std::vector<int>>("pLS_rawIdx"); // raw index in the SoA
530+
#endif
516531
ana.tx->createBranch<std::vector<int>>("pLS_lsIdx"); // LS-format part
517532
// pt (taken from pt of the 3-vector from see_stateTrajGlbPx/Py/Pz)
518533
ana.tx->createBranch<std::vector<float>>("pLS_pt");
@@ -559,6 +574,9 @@ void createPixelTripletBranches() {
559574
//
560575
// The container will hold per entry a pT3 built by LST in the event.
561576
//
577+
#ifdef CUT_VALUE_DEBUG
578+
ana.tx->createBranch<std::vector<int>>("pT3_rawIdx"); // raw index in the SoA
579+
#endif
562580
ana.tx->createBranch<std::vector<int>>("sim_pT3_matched");
563581
ana.tx->createBranch<std::vector<float>>("pT3_score");
564582
ana.tx->createBranch<std::vector<float>>("pT3_pt"); // pt (taken from the pLS)
@@ -597,6 +615,9 @@ void createPixelQuintupletBranches() {
597615
//
598616
// The container will hold per entry a pT5 built by LST in the event.
599617
//
618+
#ifdef CUT_VALUE_DEBUG
619+
ana.tx->createBranch<std::vector<int>>("pT5_rawIdx"); // raw index in the SoA
620+
#endif
600621
ana.tx->createBranch<std::vector<float>>("pT5_pt"); // pt (taken from the pLS)
601622
ana.tx->createBranch<std::vector<float>>("pT5_eta"); // eta (taken from the pLS)
602623
ana.tx->createBranch<std::vector<float>>("pT5_phi"); // phi (taken from the pLS)
@@ -986,6 +1007,9 @@ std::map<unsigned int, unsigned int> setMiniDoubletBranches(LSTEvent* event,
9861007
int isPS = isPLS ? 0 : (is_endcap ? (layer <= 2 ? ring <= 10 : ring <= 7) : layer <= 3);
9871008

9881009
// Write out the ntuple
1010+
#ifdef CUT_VALUE_DEBUG
1011+
ana.tx->pushbackToBranch<int>("md_rawIdx", mdIdx);
1012+
#endif
9891013
ana.tx->pushbackToBranch<bool>("md_isPLS", isPLS);
9901014
ana.tx->pushbackToBranch<float>("md_pt", pt);
9911015
ana.tx->pushbackToBranch<float>("md_eta", eta);
@@ -1160,6 +1184,9 @@ std::map<unsigned int, unsigned int> setLineSegmentBranches(LSTEvent* event,
11601184
#endif
11611185

11621186
// Write out the ntuple
1187+
#ifdef CUT_VALUE_DEBUG
1188+
ana.tx->pushbackToBranch<int>("ls_rawIdx", lsIdx);
1189+
#endif
11631190
ana.tx->pushbackToBranch<bool>("ls_isPLS", isPLS);
11641191
ana.tx->pushbackToBranch<float>("ls_pt", pt);
11651192
ana.tx->pushbackToBranch<float>("ls_eta", eta);
@@ -1290,6 +1317,9 @@ std::map<unsigned int, unsigned int> setTripletBranches(LSTEvent* event,
12901317
for (unsigned int idx = 0; idx < nRanges; ++idx) {
12911318
for (unsigned int iT3 = 0; iT3 < tripletOccupancies.nTriplets()[idx]; iT3++) {
12921319
unsigned int t3Idx = ranges.tripletModuleIndices()[idx] + iT3;
1320+
#ifdef CUT_VALUE_DEBUG
1321+
ana.tx->pushbackToBranch<int>("t3_rawIdx", t3Idx);
1322+
#endif
12931323
t3_idx_map[t3Idx] = t3_idx;
12941324
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFromT3(event, t3Idx);
12951325
auto [simidx, simidxfrac] =
@@ -1582,6 +1612,9 @@ std::map<unsigned int, unsigned int> setQuintupletBranches(LSTEvent* event,
15821612
for (unsigned int idx = 0; idx < nRanges; ++idx) {
15831613
for (unsigned int iT5 = 0; iT5 < quintupletOccupancies.nQuintuplets()[idx]; iT5++) {
15841614
unsigned int t5Idx = ranges.quintupletModuleIndices()[idx] + iT5;
1615+
#ifdef CUT_VALUE_DEBUG
1616+
ana.tx->pushbackToBranch<int>("t5_rawIdx", t5Idx);
1617+
#endif
15851618
t5_idx_map[t5Idx] = t5_idx;
15861619
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFromT5(event, t5Idx);
15871620
float percent_matched;
@@ -1744,6 +1777,9 @@ std::map<unsigned int, unsigned int> setPixelLineSegmentBranches(
17441777
unsigned int n_pls = segmentsOccupancy.nSegments()[pixelModule];
17451778
unsigned int pls_range_start = ranges.segmentModuleIndices()[pixelModule];
17461779
for (unsigned int ipLS = 0; ipLS < n_pls; ipLS++) {
1780+
#ifdef CUT_VALUE_DEBUG
1781+
ana.tx->pushbackToBranch<int>("pLS_rawIdx", ipLS);
1782+
#endif
17471783
unsigned int plsIdx = pls_range_start + ipLS;
17481784
pls_idx_map[plsIdx] = pls_idx;
17491785
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFrompLS(event, ipLS);
@@ -1881,6 +1917,9 @@ std::map<unsigned int, unsigned int> setPixelTripletBranches(LSTEvent* event,
18811917
unsigned int nPixelTriplets = pixelTriplets.nPixelTriplets();
18821918
for (unsigned int ipT3 = 0; ipT3 < nPixelTriplets; ipT3++) {
18831919
unsigned int pt3Idx = ipT3;
1920+
#ifdef CUT_VALUE_DEBUG
1921+
ana.tx->pushbackToBranch<int>("pT3_rawIdx", ipT3);
1922+
#endif
18841923
pt3_idx_map[pt3Idx] = pt3_idx;
18851924
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFrompT3(event, ipT3);
18861925
auto [simidx, simidxfrac] =
@@ -2087,6 +2126,9 @@ std::map<unsigned int, unsigned int> setPixelQuintupletBranches(LSTEvent* event,
20872126
unsigned int nPixelQuintuplets = pixelQuintuplets.nPixelQuintuplets();
20882127
for (unsigned int ipT5 = 0; ipT5 < nPixelQuintuplets; ipT5++) {
20892128
unsigned int pt5Idx = ipT5;
2129+
#ifdef CUT_VALUE_DEBUG
2130+
ana.tx->pushbackToBranch<int>("pT5_rawIdx", ipT5);
2131+
#endif
20902132
pt5_idx_map[pt5Idx] = pt5_idx;
20912133
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFrompT5(event, ipT5);
20922134
auto [simidx, simidxfrac] =

0 commit comments

Comments
 (0)