Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Allow matching to only primary particles #1356

Closed
wants to merge 1 commit into from

Conversation

bschmookler
Copy link
Contributor

Briefly, what does this PR introduce?

In current main branch, it is possible to match a reconstructed track to a secondary particle with generatorStatus==0. An example where this incorrectly happens can be seen below.

image1 image2

What kind of change does this PR introduce?

  • [x ] Bug fix (issue #__)
  • New feature (issue #__)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

Does this PR change default behavior?

Yes, for matching of ReconstructedChargedParticles and ReconstructedSeededChargedParticles

@bschmookler bschmookler requested review from veprbl and wdconinc March 30, 2024 00:36
@github-actions github-actions bot added the topic: PID Relates to PID reconstruction label Mar 30, 2024
@veprbl
Copy link
Member

veprbl commented Apr 14, 2024

I was waiting for someone else to response. My first thought that, indeed, generatorStatus==0 is a secondary particle, but I'm not convinced that this is unwanted. The comment/printout can be corrected, for sure.

I wasn't able to understand your screenshots, second one mentions index 34, but the first one has ~20 particles. I suspect, they were taken from different events.

@veprbl
Copy link
Member

veprbl commented Apr 14, 2024

It could be that the primaries should somehow take priority, but that's not what you suggest.

@bschmookler
Copy link
Contributor Author

Hi Dmitry. Thanks.

Yeah, thinking about it, I agree that do this 'geometric' matching to charged particles created in the tracking volume makes sense (e.g. a electron-positron pair created by a conversion photon.)

In the screenshots above, I used the TTree::Show(...) method, which I guess truncates some of the printed output. Let me show another event in a different way.

For event 22 in my file:

root [15] events->Scan("ReconstructedSeededChargedParticleAssociations.simID","Entry$==22")
***********************************
*    Row   * Instance * Reconstru *
***********************************
*       22 *        0 *         2 *
*       22 *        1 *        36 *
***********************************

There are 2 matched particles. If I plot the generator status, PDG ID, total momentum, and the r and z of the creation point, I see this for the matched particle 1:

events->Scan("MCParticles.generatorStatus[2]:MCParticles.PDG[2]:std::hypot(MCParticles.momentum.x[2],MCParticles.momentum.y[2],MCParticles.momentum.z[2]):std::hypot(MCParticles.vertex.x[2],MCParticles.vertex.y[2]):MCParticles.vertex.z[2]","Entry$==22")
************************************************************************
*    Row   * MCParticl * MCParticl * std::hypo * std::hypo * MCParticl *
************************************************************************
*       22 *         1 *        11 * 5.3219824 * 0.0448534 * 10.682283 *
************************************************************************

and this for the matched particle 2:

events->Scan("MCParticles.generatorStatus[36]:MCParticles.PDG[36]:std::hypot(MCParticles.momentum.x[36],MCParticles.momentum.y[36],MCParticles.momentum.z[36]):std::hypot(MCParticles.vertex.x[36],MCParticles.vertex.y[36]):MCParticles.vertex.z[36]","Entry$==22")
************************************************************************
*    Row   * MCParticl * MCParticl * std::hypo * std::hypo * MCParticl *
************************************************************************
*       22 *         0 *        11 * 0.1125881 * 829.46469 * -1488.119 *
************************************************************************

You can see that the second particle is created at r = 830mm and z = 1488mm, which is outside the outer barrel MPGD layer.

@veprbl
Copy link
Member

veprbl commented Apr 15, 2024

I think, we need to implement a different algorithm in place of this one. It could determine leading MCParticle by looking up Track -> Measurement2D -> TrackerHit.

@veprbl
Copy link
Member

veprbl commented Apr 15, 2024

A workaround for your problem might be to check the DCA from MC vertex to the track.

github-merge-queue bot pushed a commit that referenced this pull request Aug 22, 2024
### Briefly, what does this PR introduce?
The #1564 had implemented meaningful
associations based on hits used. That information became available for
Tracks, but end users use ReconstructedParticles, and that's what we'd
like to have implemented in this PR.

Closes: #1356

### What kind of change does this PR introduce?
- [ ] Bug fix (issue #__)
- [x] New feature (issue #__)
- [ ] Documentation update
- [ ] Other: __

### Please check if this PR fulfills the following:
- [ ] Tests for the changes have been added
- [ ] Documentation has been added / updated
- [ ] Changes have been communicated to collaborators

### Does this PR introduce breaking changes? What changes might users
need to make to their code?
No

There will be new warnings like
```
[PFRICH:RICHEndcapNLUTPID] [warning] Found a duplicate association for ReconstructedParticle at index 18
[PFRICH:RICHEndcapNLUTPID] [warning] The previous MCParticle was at 149 and the duplicate is at 200
```
those are mostly harmless and are to be addressed separately.

### Does this PR change default behavior?
Yes

---------

Co-authored-by: Wouter Deconinck <[email protected]>
@veprbl veprbl closed this in #1589 Aug 22, 2024
@bschmookler bschmookler deleted the track_match_primary branch September 19, 2024 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: PID Relates to PID reconstruction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants