Added crystalID field to caloHitMC and changed LY for LYSO#1756
Conversation
|
Hi @bechenard,
which require these tests: build. @Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main. ⌛ The following tests have been triggered for fa4d74c: build (Build queue - API unavailable) |
|
☀️ The build tests passed at fa4d74c.
N.B. These results were obtained from a build of this Pull Request at fa4d74c after being merged into the base branch at 9ffc000. For more information, please check the job page here. |
michaelmackenzie
left a comment
There was a problem hiding this comment.
Looks good to me, thank you! I just made one small comment, but it's not necessary to resolve in order to merge
| bool isCaphri = std::find(CaloConst::_caphriId.begin(),CaloConst::_caphriId.end(), | ||
| crystalID) != CaloConst::_caphriId.end(); | ||
| float pePerMeV = isCaphri ? pePerMeVLyso_ : pePerMeV_; |
There was a problem hiding this comment.
Should this be moved outside the for loop, instead of evaluated in each loop?
There was a problem hiding this comment.
Also, same comment as above
There was a problem hiding this comment.
Obviously, I was tired....
|
Let me review this pull request by examining its details and the code changes.Here's my review of PR #1756. This PR adds a 🔴 Bugs / Correctness Issues1. Breaking change to
|
| Severity | Issue | File |
|---|---|---|
| 🔴 Bug | Breaking constructor change — check all CaloHitMC call sites |
CaloHitMC.hh |
| 🔴 Bug | std::move into const& param is a no-op (copy instead of move) |
CaloHitMC.hh |
| 🔴 Merge | PR has merge conflicts with main |
— |
| 🟡 Perf | isCaphri lookup should be hoisted out of loop |
CaloShowerROMaker_module.cc |
| 🟡 Perf | Linear search for CaPHRI check on every hit | CaloDigiMaker_module.cc |
| 🟡 Design | double vs float type inconsistency for same parameter |
Multiple |
| 🟡 Style | auto var(expr) vs auto var = expr |
CaloDigiMaker_module.cc |
| 🟡 Style | crystalId_ vs crystalID() naming mismatch |
CaloHitMC.hh |
| 🟢 Fix | Correctly puts caloShowerMCTruth instead of double-moving caloHitMCTruth |
CaloHitTruthMatch_module.cc |
|
📝 The HEAD of |
| int crystalID = CaloSiPMId(iRO).crystal().id(); | ||
| bool isCaphri = std::find(CaloConst::_caphriId.begin(),CaloConst::_caphriId.end(), | ||
| crystalID) != CaloConst::_caphriId.end(); |
There was a problem hiding this comment.
You can (should?) use CaloSiPMId(iR0).crystal().isCaphri()
There was a problem hiding this comment.
Oh, didn't know about this one, will modify
| bool isCaphri = std::find(CaloConst::_caphriId.begin(),CaloConst::_caphriId.end(), | ||
| crystalID) != CaloConst::_caphriId.end(); | ||
| float pePerMeV = isCaphri ? pePerMeVLyso_ : pePerMeV_; |
There was a problem hiding this comment.
Also, same comment as above
| bool isCaphri = std::find(CaloConst::_caphriId.begin(),CaloConst::_caphriId.end(), | ||
| crystalID) != CaloConst::_caphriId.end(); | ||
| auto pePerMeV = isCaphri ? pePerMeVLyso_ : pePerMeV_; | ||
| auto scaleFactor(MeVToADC_/pePerMeV); |
There was a problem hiding this comment.
I think this could be prone to future mistakes by swapping pePerMeV with pePerMeV_.
Perhaps better to swap pePerMeV_ with pePerMeVCsI_?
No strong opinion however.
There was a problem hiding this comment.
Changed, I really start to hate these Caphri crystals..... We will adopt a better solution when we port these values into the database too.
P.S: I think we use the same SiPMs for the LYSO crystals, so the noise should be identical to that of the CsI crystals and I have left it this way. IF we use different readouts, then I'll make modifications when I refactor the noise generation
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for bbce729: build (Build queue - API unavailable) |
|
☀️ The build tests passed at bbce729.
N.B. These results were obtained from a build of this Pull Request at bbce729 after being merged into the base branch at dc50b36. For more information, please check the job page here. |
|
I'll review this pull request by examining its details and the code changes.Now let me look at the existing review comments and also examine the PR SummaryThis PR adds a Critical Issues1. 🔴 Missing
|
| File | Method |
|---|---|
CaloDigiMaker_module.cc |
CaloSiPMId(iRO).crystal().isCaphri() |
CaloShowerROMaker_module.cc |
std::find(CaloConst::_caphriId.begin(), ...) (manual linear search) |
While both should give the same result, using two different code paths for the same logic is fragile and error-prone. CaloShowerROMaker should also use the CrystalId::isCaphri() method for consistency. The author was told about isCaphri() in the review comments and updated CaloDigiMaker but forgot to update CaloShowerROMaker.
4. 🟠 double → float type narrowing is unnecessary and reduces precision
In CaloDigiMaker_module.cc, multiple member variables and fhicl parameters are changed from double to float:
float digitizationStart_;
float digitizationEnd_;
float timeFromProtonsToDRMarker_;
float digiSampling_;
float startTimeBuffer_;
float MeVToADC_;This reduces precision from ~15 significant digits to ~7. For timing values (ns-scale with sub-ns precision requirements in HEP), and for MeVToADC which is used in division (MeVToADC_/pePerMeV), the loss of precision could introduce subtle simulation artifacts. The CaloShowerROMaker already used float for some of these, but CaloDigiMaker previously used double presumably for a reason. This change is bundled silently with the LYSO feature and may not receive the scrutiny it deserves.
5. 🟡 Order of event.put() changed in CaloHitTruthMatch
- event.put(std::move(caloHitMCTruth));
event.put(std::move(caloHitMCs));
+ event.put(std::move(caloHitMCTruth));The order of event.put() calls was swapped. In the art framework, the order of event.put() for different product types typically doesn't matter, but if any downstream consumer relies on product insertion order for same-type products, this could cause a subtle issue. This should at minimum have a comment explaining why the reorder was needed.
Summary
| Severity | Issue | File |
|---|---|---|
| 🔴 Critical | const&& prevents move; silent copy |
CaloHitMC.hh |
| 🔴 Critical | Noise generator not updated for dual PE/MeV | CaloNoiseSimGenerator.hh |
| 🟠 Medium | Inconsistent CAPHRI detection methods | CaloShowerROMaker_module.cc |
| 🟠 Medium | Unnecessary double → float narrowing |
CaloDigiMaker_module.cc |
| 🟡 Low | event.put() order changed without explanation |
CaloHitTruthMatch_module.cc |
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for 64bab70: build (Build queue - API unavailable) |
|
☀️ The build tests passed at 64bab70.
N.B. These results were obtained from a build of this Pull Request at 64bab70 after being merged into the base branch at dc50b36. For more information, please check the job page here. |
|
@bechenard are changes in the trigger test expected here? It looks like there are changes in the calo paths that weren't seen in the initial CI test |
|
Nope, this is weird. Will have a look at it |
|
The trigger ran correctly, but there are small changes in the trigger rates since I changes the light yield of the LYSO crystals. Looks reasonable to me |
|
@bechenard why would the LYSO light yield change trigger reco? Wouldn't this only change the CAPHRI crystals which (I assume) aren't included in the clustering for the trigger paths that changed? |
|
Aren't the Caphri crystals treated like any other crystals in the
clustering?
…On 3/12/2026 2:50 PM, Michael MacKenzie wrote:
*michaelmackenzie* left a comment (Mu2e/Offline#1756)
<#1756 (comment)>
@bechenard <https://github.com/bechenard> why would the LYSO light
yield change trigger reco? Wouldn't this only change the CAPHRI
crystals which (I assume) aren't included in the clustering for the
trigger paths that changed?
—
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ27JH4I2DFH6WRB7ML7S34QMWLBAVCNFSM6AAAAACWJ6K5W2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DANJQGQYTKOJYGY>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I assumed they weren't since the CaloHitMakerFast produces a separate hit collection for CAPHRI vs. non-CAPHRI hits: |
|
They are treated the same in offline, separate in online |
|
@bechenard could you please check running |
|
@bechenard and I still get many changes. Do you think this could be due to double -> float changes in the module fields? |
|
That might, which is unfortunate because this means the code is not very
stable... We should investigate more, but I would like this PR to be
merged so that we can move forward.
…On 3/17/2026 8:17 AM, Michael MacKenzie wrote:
*michaelmackenzie* left a comment (Mu2e/Offline#1756)
<#1756 (comment)>
@bechenard <https://github.com/bechenard>
I ran the trigger CI with
|readoutPEPerMeVCsI : 30.0 readoutPEPerMeVLyso : 30.0 |
and I still get many changes. Do you think this could be due to double
-> float changes in the module fields?
|>>> Path cpr_TrkDe_50_D0200 has a minor change: Local counts :
[20000, 24, 19976, 0] Reference counts: [20000, 23, 19977, 0]
(delta/sqrt(reference) = 0.21) >>> Path mpr_TrkDe_80m70p_D0200 has a
minor change: Local counts : [20000, 375, 19625, 0] Reference counts:
[20000, 387, 19613, 0] (delta/sqrt(reference) = 0.61) >>> Path
calo_photon has a minor change: Local counts : [20000, 470, 19530, 0]
Reference counts: [20000, 471, 19529, 0] (delta/sqrt(reference) =
0.05) >>> Path calo_MVANNCE has a minor change: Local counts : [20000,
1857, 18143, 0] Reference counts: [20000, 1858, 18142, 0]
(delta/sqrt(reference) = 0.02) >>> Path calo_cluster_50 has a minor
change: Local counts : [20000, 3502, 16498, 0] Reference counts:
[20000, 3503, 16497, 0] (delta/sqrt(reference) = 0.02) >>> Path
calo_cluster_60 has a minor change: Local counts : [20000, 1365,
18635, 0] Reference counts: [20000, 1364, 18636, 0]
(delta/sqrt(reference) = 0.03) >>> Path calo_cluster_70 has a minor
change: Local counts : [20000, 650, 19350, 0] Reference counts:
[20000, 649, 19351, 0] (delta/sqrt(reference) = 0.04) >>> Path
calo_cluster_75 has a minor change: Local counts : [20000, 437, 19563,
0] Reference counts: [20000, 435, 19565, 0] (delta/sqrt(reference) =
0.10) |
—
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ27JCGYCWGBYNSF26EGAL4RFT7XAVCNFSM6AAAAACWJ6K5W2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DANZVG43TKMBZG4>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@bechenard perhaps these PRs are the underlying changes: #1750 and #1749 Also, this PR is already merged so the updates should be available. Thank you for looking into this though! |
|
More on this. Changes to MHF should have zero effect on clustering. The
fix in #1750 could potentially make a difference, but I expect the
impact to be very small (maybe this is naive). It could be worth trying
without it and see if we recover the original trigger rates
…On 3/17/2026 1:05 PM, Michael MacKenzie wrote:
*michaelmackenzie* left a comment (Mu2e/Offline#1756)
<#1756 (comment)>
@bechenard <https://github.com/bechenard> perhaps these PRs are the
underlying changes: #1750 <#1750>
and #1749 <#1749>
I can't view the logs as they've been purged, but the calo sorting
changing would probably explain this.
Also, this PR is already merged so the updates should be available.
Thank you for looking into this though!
—
Reply to this email directly, view it on GitHub
<#1756 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJ27JA6AIA7ZKTMBWQUTZD4RGVXNAVCNFSM6AAAAACWJ6K5W2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DANZXGY4DGOJVGU>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
No description provided.