Skip to content

Commit 7d5fabc

Browse files
committed
add rawIdx to match with (sparse) SoA indices
1 parent a8b1e83 commit 7d5fabc

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
@@ -348,6 +348,9 @@ void createMiniDoubletBranches() {
348348
//
349349
// The container will hold per entry a mini-doublet built by LST in the event.
350350
//
351+
#ifdef CUT_VALUE_DEBUG
352+
ana.tx->createBranch<std::vector<int>>("md_rawIdx"); // raw index in the SoA
353+
#endif
351354
ana.tx->createBranch<std::vector<bool>>("md_isPLS");
352355
ana.tx->createBranch<std::vector<float>>("md_pt"); // pt (computed based on delta phi change)
353356
ana.tx->createBranch<std::vector<float>>("md_eta"); // eta (computed based on anchor hit's eta)
@@ -383,6 +386,9 @@ void createLineSegmentBranches() {
383386
//
384387
// The container will hold per entry a line-segment built by LST in the event.
385388
//
389+
#ifdef CUT_VALUE_DEBUG
390+
ana.tx->createBranch<std::vector<int>>("ls_rawIdx"); // raw index in the SoA
391+
#endif
386392
ana.tx->createBranch<std::vector<bool>>("ls_isPLS");
387393
// pt (computed based on radius of the circle formed by three points: (origin), (anchor hit 1), (anchor hit 2))
388394
ana.tx->createBranch<std::vector<float>>("ls_pt");
@@ -419,6 +425,9 @@ void createTripletBranches() {
419425
//
420426
// The container will hold per entry a triplets built by LST in the event.
421427
//
428+
#ifdef CUT_VALUE_DEBUG
429+
ana.tx->createBranch<std::vector<int>>("t3_rawIdx"); // raw index in the SoA
430+
#endif
422431
// pt (computed based on radius of the circle formed by three points: anchor hit 1, 2, 3
423432
ana.tx->createBranch<std::vector<float>>("t3_pt");
424433
ana.tx->createBranch<std::vector<float>>("t3_eta"); // eta (computed based on last anchor hit's eta)
@@ -474,6 +483,9 @@ void createQuintupletBranches() {
474483
//
475484
// The container will hold per entry a quintuplet built by LST in the event.
476485
//
486+
#ifdef CUT_VALUE_DEBUG
487+
ana.tx->createBranch<std::vector<int>>("t5_rawIdx"); // raw index in the SoA
488+
#endif
477489
// pt (computed based on average of the 4 circles formed by, (1, 2, 3), (2, 3, 4), (3, 4, 5), (1, 3, 5)
478490
ana.tx->createBranch<std::vector<std::vector<float>>>("t5_embed");
479491
ana.tx->createBranch<std::vector<float>>("t5_dnnScore");
@@ -503,6 +515,9 @@ void createPixelLineSegmentBranches() {
503515
//
504516
// The container will hold per entry a pixel line segment (built by an external algo, e.g. patatrack) accepted by LST in the event.
505517
//
518+
#ifdef CUT_VALUE_DEBUG
519+
ana.tx->createBranch<std::vector<int>>("pLS_rawIdx"); // raw index in the SoA
520+
#endif
506521
ana.tx->createBranch<std::vector<int>>("pLS_lsIdx"); // LS-format part
507522
// pt (taken from pt of the 3-vector from see_stateTrajGlbPx/Py/Pz)
508523
ana.tx->createBranch<std::vector<float>>("pLS_pt");
@@ -549,6 +564,9 @@ void createPixelTripletBranches() {
549564
//
550565
// The container will hold per entry a pT3 built by LST in the event.
551566
//
567+
#ifdef CUT_VALUE_DEBUG
568+
ana.tx->createBranch<std::vector<int>>("pT3_rawIdx"); // raw index in the SoA
569+
#endif
552570
ana.tx->createBranch<std::vector<int>>("sim_pT3_matched");
553571
ana.tx->createBranch<std::vector<float>>("pT3_score");
554572
ana.tx->createBranch<std::vector<float>>("pT3_pt"); // pt (taken from the pLS)
@@ -585,6 +603,9 @@ void createPixelQuintupletBranches() {
585603
//
586604
// The container will hold per entry a pT5 built by LST in the event.
587605
//
606+
#ifdef CUT_VALUE_DEBUG
607+
ana.tx->createBranch<std::vector<int>>("pT5_rawIdx"); // raw index in the SoA
608+
#endif
588609
ana.tx->createBranch<std::vector<float>>("pT5_pt"); // pt (taken from the pLS)
589610
ana.tx->createBranch<std::vector<float>>("pT5_eta"); // eta (taken from the pLS)
590611
ana.tx->createBranch<std::vector<float>>("pT5_phi"); // phi (taken from the pLS)
@@ -957,6 +978,9 @@ std::map<unsigned int, unsigned int> setMiniDoubletBranches(LSTEvent* event,
957978
int isPS = isPLS ? 0 : (is_endcap ? (layer <= 2 ? ring <= 10 : ring <= 7) : layer <= 3);
958979

959980
// Write out the ntuple
981+
#ifdef CUT_VALUE_DEBUG
982+
ana.tx->pushbackToBranch<int>("md_rawIdx", mdIdx);
983+
#endif
960984
ana.tx->pushbackToBranch<bool>("md_isPLS", isPLS);
961985
ana.tx->pushbackToBranch<float>("md_pt", pt);
962986
ana.tx->pushbackToBranch<float>("md_eta", eta);
@@ -1131,6 +1155,9 @@ std::map<unsigned int, unsigned int> setLineSegmentBranches(LSTEvent* event,
11311155
#endif
11321156

11331157
// Write out the ntuple
1158+
#ifdef CUT_VALUE_DEBUG
1159+
ana.tx->pushbackToBranch<int>("ls_rawIdx", lsIdx);
1160+
#endif
11341161
ana.tx->pushbackToBranch<bool>("ls_isPLS", isPLS);
11351162
ana.tx->pushbackToBranch<float>("ls_pt", pt);
11361163
ana.tx->pushbackToBranch<float>("ls_eta", eta);
@@ -1261,6 +1288,9 @@ std::map<unsigned int, unsigned int> setTripletBranches(LSTEvent* event,
12611288
for (unsigned int idx = 0; idx < nRanges; ++idx) {
12621289
for (unsigned int iT3 = 0; iT3 < tripletOccupancies.nTriplets()[idx]; iT3++) {
12631290
unsigned int t3Idx = ranges.tripletModuleIndices()[idx] + iT3;
1291+
#ifdef CUT_VALUE_DEBUG
1292+
ana.tx->pushbackToBranch<int>("t3_rawIdx", t3Idx);
1293+
#endif
12641294
t3_idx_map[t3Idx] = t3_idx;
12651295
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFromT3(event, t3Idx);
12661296
auto [simidx, simidxfrac] =
@@ -1551,6 +1581,9 @@ std::map<unsigned int, unsigned int> setQuintupletBranches(LSTEvent* event,
15511581
for (unsigned int idx = 0; idx < nRanges; ++idx) {
15521582
for (unsigned int iT5 = 0; iT5 < quintupletOccupancies.nQuintuplets()[idx]; iT5++) {
15531583
unsigned int t5Idx = ranges.quintupletModuleIndices()[idx] + iT5;
1584+
#ifdef CUT_VALUE_DEBUG
1585+
ana.tx->pushbackToBranch<int>("t5_rawIdx", t5Idx);
1586+
#endif
15541587
t5_idx_map[t5Idx] = t5_idx;
15551588
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFromT5(event, t5Idx);
15561589
float percent_matched;
@@ -1713,6 +1746,9 @@ std::map<unsigned int, unsigned int> setPixelLineSegmentBranches(
17131746
unsigned int n_pls = segmentsOccupancy.nSegments()[pixelModule];
17141747
unsigned int pls_range_start = ranges.segmentModuleIndices()[pixelModule];
17151748
for (unsigned int ipLS = 0; ipLS < n_pls; ipLS++) {
1749+
#ifdef CUT_VALUE_DEBUG
1750+
ana.tx->pushbackToBranch<int>("pLS_rawIdx", ipLS);
1751+
#endif
17161752
unsigned int plsIdx = pls_range_start + ipLS;
17171753
pls_idx_map[plsIdx] = pls_idx;
17181754
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFrompLS(event, ipLS);
@@ -1850,6 +1886,9 @@ std::map<unsigned int, unsigned int> setPixelTripletBranches(LSTEvent* event,
18501886
unsigned int nPixelTriplets = pixelTriplets.nPixelTriplets();
18511887
for (unsigned int ipT3 = 0; ipT3 < nPixelTriplets; ipT3++) {
18521888
unsigned int pt3Idx = ipT3;
1889+
#ifdef CUT_VALUE_DEBUG
1890+
ana.tx->pushbackToBranch<int>("pT3_rawIdx", ipT3);
1891+
#endif
18531892
pt3_idx_map[pt3Idx] = pt3_idx;
18541893
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFrompT3(event, ipT3);
18551894
auto [simidx, simidxfrac] =
@@ -2052,6 +2091,9 @@ std::map<unsigned int, unsigned int> setPixelQuintupletBranches(LSTEvent* event,
20522091
unsigned int nPixelQuintuplets = pixelQuintuplets.nPixelQuintuplets();
20532092
for (unsigned int ipT5 = 0; ipT5 < nPixelQuintuplets; ipT5++) {
20542093
unsigned int pt5Idx = ipT5;
2094+
#ifdef CUT_VALUE_DEBUG
2095+
ana.tx->pushbackToBranch<int>("pT5_rawIdx", ipT5);
2096+
#endif
20552097
pt5_idx_map[pt5Idx] = pt5_idx;
20562098
auto [hit_idx, hit_type] = getHitIdxsAndHitTypesFrompT5(event, ipT5);
20572099
auto [simidx, simidxfrac] =

0 commit comments

Comments
 (0)