Added crystalID field to caloHitMC and changed LY for LYSO#1756
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 |
CaloMC/src/CaloDigiMaker_module.cc
Outdated
| 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
CaloMC/src/CaloDigiMaker_module.cc
Outdated
| 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 |
No description provided.