Allow cz restriction with CE generation#1782
Conversation
|
Hi @michaelmackenzie,
which require these tests: build. @Mu2e/write, @Mu2e/fnalbuild-users have access to CI actions on main. ⌛ The following tests have been triggered for c54976b: build (Build queue - API unavailable) |
|
☀️ The build tests passed at c54976b.
N.B. These results were obtained from a build of this Pull Request at c54976b after being merged into the base branch at a31b07e. For more information, please check the job page here. |
|
I'll review this pull request by examining the changes and details.Now let me look at the 1. 🔴 No input validation on
|
| # | Severity | Issue |
|---|---|---|
| 1 | 🔴 High | No validation on czMin/czMax — invalid ranges silently produce wrong physics |
| 2 | 🟡 Medium | No documentation or warning about solid-angle normalization impact |
| 3 | 🟡 Medium | New parameters not included in verbose logging |
| 4 | 🟢 Info | Naming convention is consistent ✅ |
The code change itself is mechanically correct — the RandomUnitSphere constructor does accept the czmin/czmax arguments in exactly this form. The main concern is the lack of input guardrails and logging for the new parameters.
|
I added an error throw for bad cz range values and added the values to the logged output |
|
@FNALbuild build test |
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for 6c62b85: build (Build queue - API unavailable) |
brownd1978
left a comment
There was a problem hiding this comment.
Would it make sense to record the acceptance of the cz cut ( 0.5*(czmax-czmin)) as a FilterFraction in the enjob? That would allow computing the net POT equivalent without having to harvest numbers from a log file.
|
@brownd1978 I was thinking about this as well, either as an EventWeight (but being per-event is wasteful) or a FilterFraction (but it's not really filtering gen events). I could make a new data product SubRunWeight to cover this? Or just put EventWeight into the sub run. I don't think the FilterFraction payload/accumulation will make as much sense here, but I haven't thought about it too deeply |
|
📝 The HEAD of |
|
☔ The build is failing at 6c62b85.
N.B. These results were obtained from a build of this Pull Request at 6c62b85 after being merged into the base branch at a31b07e. For more information, please check the job page here. |
|
@FNALbuild run build test |
|
⌛ The following tests have been triggered for 713ba67: build (Build queue - API unavailable) |
|
☀️ The build tests passed at 713ba67.
N.B. These results were obtained from a build of this Pull Request at 713ba67 after being merged into the base branch at 50ac9dc. For more information, please check the job page here. |
|
In a sense it is a filter, just applied during the generation. So I think
FilterFraction is adequate.
…On Mon, Apr 6, 2026 at 8:49 AM Michael MacKenzie ***@***.***> wrote:
*michaelmackenzie* left a comment (Mu2e/Offline#1782)
<#1782 (comment)>
@brownd1978 <https://github.com/brownd1978> I was thinking about this as
well, either as an EventWeight (but being per-event is wasteful) or a
FilterFraction (but it's not really filtering gen events). I could make a
new data product SubRunWeight to cover this? Or just put EventWeight into
the sub run. I don't think the FilterFraction payload/accumulation will
make as much sense here, but I haven't thought about it too deeply
—
Reply to this email directly, view it on GitHub
<#1782 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAH573SNW7RAMBHZUKMBLD4UPGZRAVCNFSM6AAAAACXOH2RESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOJTGI4DMMRSGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
David Brown ***@***.***
Office Phone (510) 486-7261
Lawrence Berkeley National Lab
M/S 50R5008 (50-6026C) Berkeley, CA 94720
|
|
@brownd1978 What would you suggest for Perhaps more appropriate would be |
|
npassed_ = gencount (number of events generated)
nseen_ = gencount/fraction. This woud be rounded, as you say, which isn't
perfect but also isn't wrong.
chained is an internal variable. Add and chain would work as expected.
Essentially think of this as a pure phasespace generator followed by a
filter.
I don't see SpectrumConfig in any Mu2e repo, is that your private struct?
…On Mon, Apr 6, 2026 at 11:32 AM Michael MacKenzie ***@***.***> wrote:
*michaelmackenzie* left a comment (Mu2e/Offline#1782)
<#1782 (comment)>
@brownd1978 <https://github.com/brownd1978> What would you suggest for
nseen_ and npassed_ for the object? As these are integers, setting the
weight becomes a bit tricky in that we'd need to represent the double
correction value as a fraction. It also has payloads bool chained_, uint64_t
nseen_ , and uint64_t npassed_ instead of essentially the double fraction_
we'd ideally store here.
Perhaps more appropriate would be SpectrumConfig struct that could have
emin_, emax_, tmin_, tmax_, czmin_, czmax_, and fraction_sampled_ for
commonly configured generation values. This would also help flat
electron/photon datasets that need (emax - emin) for proper
normalization. Of course it wouldn't cover all cases, but this could
consolidate some of these issues into a single solution struct.
—
Reply to this email directly, view it on GitHub
<#1782 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAH57YCRHL5FLHAXMCGOZ34UPZ4PAVCNFSM6AAAAACXOH2RESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOJUGIYDQNJXGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
David Brown ***@***.***
Office Phone (510) 486-7261
Lawrence Berkeley National Lab
M/S 50R5008 (50-6026C) Berkeley, CA 94720
|
|
There isn't a |
|
I see. Your idea does make sense, but interpreting this payload as a
fraction requires context (ie is the E spectrum flat?). Where would that go?
You should decide which solution.
David Brown ***@***.***
Office Phone (510) 486-7261
Lawrence Berkeley National Lab
M/S 50R5008 (50-6026C) Berkeley, CA 94720
…On Mon, Apr 6, 2026 at 11:51 Michael MacKenzie ***@***.***> wrote:
*michaelmackenzie* left a comment (Mu2e/Offline#1782)
<#1782 (comment)>
There isn't a SpectrumConfig struct, I meant this as a proposal. I'm
often annoyed that I have to check fcl to know emin/emax or czmin/czmax,
where something like this would automate this. But I don't feel strongly,
just adding this as an idea to target two issues at once
—
Reply to this email directly, view it on GitHub
<#1782 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABAH5764KMK7J74GEDMNTQT4UP4B3AVCNFSM6AAAAACXOH2RESVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCOJUGMYTOMRZGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Allow cos(theta_z) restriction in Ce endpoint random unit sphere