Skip to content

Jdkio/290 reco hit truth - #303

Merged
jdkio merged 3 commits into
mainfrom
jdkio/290_reco_hit_truth
Aug 19, 2026
Merged

Jdkio/290 reco hit truth#303
jdkio merged 3 commits into
mainfrom
jdkio/290_reco_hit_truth

Conversation

@jdkio

@jdkio jdkio commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Adds new branches that tell us the primary contributing particle of each reco hit. This is useful for untracked hit truth-matching studies. For example, track matching between ND-LAr and TMS. It's slightly sub-optimal for 2 reasons:

  1. We're only tracking primary particles. So if a neutron creates a proton, the neutron will be given credit for creating the hit energy. For muons, this is mostly what we want but see issue Match reconstructed tracks to actual contributing particle lineages #258 if you have comments.
  2. We're only saving a single true particle (plus a record of energy from other particles). For most muon studies, we only really deal with a single contributor. But one could imagine complex interactions have many contributors.
auto t = (TTree*)_file0->Get("Line_Candidates");

t->Scan(
  "Iteration$:RecoHitPrimaryRunId:RecoHitPrimaryVertexId:"
  "RecoHitPrimaryVertexGlobalId:RecoHitPrimaryTrackId:"
  "RecoHitPrimaryParticleIndex:RecoHitPrimaryTrueEnergy:"
  "RecoHitOtherTrueEnergy",
  "",
  "colsize=14",
  50
);

After:
***************************************************************************************************************************************************************
*    Row   * Instance *     Iteration$ * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitOtherTr *
***************************************************************************************************************************************************************
*        0 *        0 *              0 *             10 *            145 *       10000145 *              4 *           2895 * 1.913566112518 *              0 *
*        0 *        1 *              1 *     1000000010 *            313 * 1.00000001e+15 *              2 *           1274 * 1.900746464729 *              0 *
*        0 *        2 *              2 *     1000000010 *            295 * 1.00000001e+15 *              4 *           1487 * 7.753574371337 *              0 *
*        0 *        3 *              3 *     1000000010 *            431 * 1.00000001e+15 *              1 *            195 * 0.641244888305 *              0 *
*        0 *        4 *              4 *     1000000010 *             78 * 1.00000001e+15 *              1 *           3536 * 1.562241792678 *              0 *
*        0 *        5 *              5 *     1000000010 *            427 * 1.00000001e+15 *              1 *            211 * 0.904848098754 *              0 *
*        0 *        6 *              6 *     1000000010 *            344 * 1.00000001e+15 *              2 *            990 * 0.088525742292 *              0 *
*        0 *        7 *              7 *     1000000010 *            178 * 1.00000001e+15 *              1 *           2583 * 0.197356626391 *              0 *
*        0 *        8 *              8 *             10 *            145 *       10000145 *              4 *           2895 * 1.662308573722 *              0 *
*        0 *        9 *              9 *     1000000010 *              1 * 1.00000001e+15 *              1 *           4165 * 2.808391094207 *              0 *
*        0 *       10 *             10 *     1000000010 *              1 * 1.00000001e+15 *              1 *           4165 * 4.381511688232 *              0 *
*        0 *       11 *             11 *             10 *            145 *       10000145 *              0 *           2891 * 1.841270089149 * 0.016343042254 *
*        0 *       12 *             12 *     1000000010 *            224 * 1.00000001e+15 *            494 *           2151 * 0.131381198763 *              0 *
*        0 *       13 *             13 *     1000000010 *            393 * 1.00000001e+15 *              5 *            510 * 2.711185216903 *              0 *
*        0 *       14 *             14 *     1000000010 *            393 * 1.00000001e+15 *              5 *            510 * 3.569132328033 *              0 *
*        0 *       15 *             15 *             10 *             21 *       10000021 *              1 *           4009 * 1.244379520416 *              0 *
*        0 *       16 *             16 *     1000000010 *            313 * 1.00000001e+15 *             18 *           1283 * 3.103991985321 *              0 *
*        0 *       17 *             17 *             10 *            145 *       10000145 *              4 *           2895 * 0.992904186248 *              0 *
*        0 *       18 *             18 *     1000000010 *            313 * 1.00000001e+15 *             18 *           1283 * 2.141293287277 *              0 *
*        0 *       19 *             19 *     1000000010 *            296 * 1.00000001e+15 *              8 *           1479 * 0.910681247711 *              0 *
*        0 *       20 *             20 *             10 *             23 *       10000023 *              3 *           3992 * 1.907194852829 *              0 *
*        0 *       21 *             21 *     1000000010 *            178 * 1.00000001e+15 *              1 *           2583 * 2.632756710052 *              0 *
*        0 *       22 *             22 *     1000000010 *            352 * 1.00000001e+15 *             12 *            880 * 0.136072382330 *              0 *
*        0 *       23 *             23 *             10 *            172 *       10000172 *              3 *           2665 * 1.312479376792 *              0 *
*        0 *       24 *             24 *             10 *            172 *       10000172 *              3 *           2665 * 0.594662547111 *              0 *

Before:
***************************************************************************************************************************************************************
*    Row   * Instance *     Iteration$ * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitOtherTr *
***************************************************************************************************************************************************************
*        0 *        0 *              0 *             10 *            145 *       10000145 *              4 *           2895 * 1.913566112518 *              0 *
*        0 *        1 *              1 *     1000000010 *            313 * 1.00000001e+15 *              2 *           1274 * 1.900746464729 *              0 *
*        0 *        2 *              2 *     1000000010 *            295 * 1.00000001e+15 *              4 *           1487 * 7.753574371337 *              0 *
*        0 *        3 *              3 *     1000000010 *            431 * 1.00000001e+15 *              1 *            195 * 0.641244888305 *              0 *
*        0 *        4 *              4 *     1000000010 *             78 * 1.00000001e+15 *              1 *           3536 * 1.562241792678 *              0 *
*        0 *        5 *              5 *     1000000010 *            427 * 1.00000001e+15 *              1 *            211 * 0.904848098754 *              0 *
*        0 *        6 *              6 *     1000000010 *            344 * 1.00000001e+15 *              2 *            990 * 0.088525742292 *              0 *
*        0 *        7 *              7 *     1000000010 *            178 * 1.00000001e+15 *              1 *           2583 * 0.197356626391 *              0 *
*        0 *        8 *              8 *             10 *            145 *       10000145 *              4 *           2895 * 1.662308573722 *              0 *
*        0 *        9 *              9 *     1000000010 *              1 * 1.00000001e+15 *              1 *           4165 * 2.808391094207 *              0 *
*        0 *       10 *             10 *     1000000010 *              1 * 1.00000001e+15 *              1 *           4165 * 4.381511688232 *              0 *
*        0 *       11 *             11 *             10 *            145 *       10000145 *              0 *           2891 * 1.841270089149 * 0.016343042254 *
*        0 *       12 *             12 *     1000000010 *            224 * 1.00000001e+15 *            494 *           2151 * 0.131381198763 *              0 *
*        0 *       13 *             13 *     1000000010 *            393 * 1.00000001e+15 *              5 *            510 * 2.711185216903 *              0 *

t->Scan(
  "Iteration$:RecoHitEnergy:RecoHitPrimaryTrueEnergy:"
  "RecoHitOtherTrueEnergy:"
  "RecoHitPrimaryTrueEnergy+RecoHitOtherTrueEnergy:"
  "RecoHitEnergy-RecoHitPrimaryTrueEnergy-RecoHitOtherTrueEnergy",
  "",
  "colsize=14",
  50
);
*****************************************************************************************************************************
*    Row   * Instance *     Iteration$ *  RecoHitEnergy * RecoHitPrimary * RecoHitOtherTr * RecoHitPrimary * RecoHitEnergy- *
*****************************************************************************************************************************
*        0 *        0 *              0 * 3.093544721603 * 1.913566112518 *              0 * 1.913566112518 * 1.179978609085 *
*        0 *        1 *              1 * 2.513243436813 * 1.900746464729 *              0 * 1.900746464729 * 0.612496972084 *
*        0 *        2 *              2 * 0.707094073295 * 7.753574371337 *              0 * 7.753574371337 * -7.04648029804 *
*        0 *        3 *              3 * 1.196407198905 * 0.641244888305 *              0 * 0.641244888305 * 0.555162310600 *
*        0 *        4 *              4 * 1.209006428718 * 1.562241792678 *              0 * 1.562241792678 * -0.35323536396 *
*        0 *        5 *              5 * 0.289199948310 * 0.904848098754 *              0 * 0.904848098754 * -0.61564815044 *
*        0 *        6 *              6 * 0.313903182744 * 0.088525742292 *              0 * 0.088525742292 * 0.225377440452 *
*        0 *        7 *              7 * 0.498210608959 * 0.197356626391 *              0 * 0.197356626391 * 0.300853982567 *
*        0 *        8 *              8 * 0.465293586254 * 1.662308573722 *              0 * 1.662308573722 * -1.19701498746 *
*        0 *        9 *              9 * 1.455952286720 * 2.808391094207 *              0 * 2.808391094207 * -1.35243880748 *
*        0 *       10 *             10 * 2.218230009079 * 4.381511688232 *              0 * 4.381511688232 * -2.16328167915 *
*        0 *       11 *             11 * 3.332807302475 * 1.841270089149 * 0.016343042254 * 1.857613131403 * 1.475194171071 *
*        0 *       12 *             12 * 0.378732413053 * 0.131381198763 *              0 * 0.131381198763 * 0.247351214289 *
*        0 *       13 *             13 * 2.253765821456 * 2.711185216903 *              0 * 2.711185216903 * -0.45741939544 *

t->Scan(
  "Iteration$:RecoHitPrimaryRunId:RecoHitPrimaryVertexId:"
  "RecoHitPrimaryTrackId:RecoHitPrimaryParticleIndex:"
  "RecoHitPrimaryTrueEnergy:RecoHitOtherTrueEnergy",
  "Entry$==12",
  "colsize=14"
);

**********************************************************************************************************************************************
*    Row   * Instance *     Iteration$ * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitPrimary * RecoHitOtherTr *
**********************************************************************************************************************************************
*       12 *        0 *              0 *             10 *             69 *              0 *           3621 * 3.646056652069 *              0 *
*       12 *        1 *              1 *             10 *             69 *              0 *           3621 * 3.576422691345 *              0 *
*       12 *        2 *              2 *             10 *             69 *              0 *           3621 * 3.037264347076 *              0 *
*       12 *        3 *              3 *             10 *             69 *              0 *           3621 * 2.823726654052 *              0 *
*       12 *        4 *              4 *             10 *             69 *              0 *           3621 * 4.475830554962 *              0 *
*       12 *        5 *              5 *             10 *             69 *              0 *           3621 * 3.455480337142 *              0 *
*       12 *        6 *              6 *             10 *             69 *              0 *           3621 * 2.677153348922 *              0 *
*       12 *        7 *              7 *             10 *             69 *              0 *           3621 * 3.233307838439 *              0 *
*       12 *        8 *              8 *             10 *             69 *              0 *           3621 * 3.118544340133 *              0 *
*       12 *        9 *              9 *             10 *             69 *              0 *           3621 * 1.853075623512 *              0 *
*       12 *       10 *             10 *             10 *             69 *              0 *           3621 * 6.861517906189 *              0 *
*       12 *       11 *             11 *     1000000010 *             74 *              0 *           3579 * 2.980810165405 * 0.132844462990 *
*       12 *       12 *             12 *             10 *             69 *              0 *           3621 * 13.21075630188 *              0 *
*       12 *       13 *             13 *             10 *             69 *              0 *           3621 * 0.851206481456 *              0 *

@jdkio jdkio added the enhancement New feature or request label Aug 12, 2026
@jdkio
jdkio merged commit ccd6bcd into main Aug 19, 2026
1 check passed
@jdkio
jdkio deleted the jdkio/290_reco_hit_truth branch August 19, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants