Skip to content

Allow angle restriction and force photon generation for CAPHRI studies#1714

Open
michaelmackenzie wants to merge 1 commit intoMu2e:mainfrom
michaelmackenzie:MuCap1809keVUpdate
Open

Allow angle restriction and force photon generation for CAPHRI studies#1714
michaelmackenzie wants to merge 1 commit intoMu2e:mainfrom
michaelmackenzie:MuCap1809keVUpdate

Conversation

@michaelmackenzie
Copy link
Contributor

No description provided.

@FNALbuild
Copy link
Collaborator

Hi @michaelmackenzie,
You have proposed changes to files in these packages:

  • EventGenerator

which require these tests: build.

@Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main.

⌛ The following tests have been triggered for 6f29681: build (Build queue - API unavailable)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at 6f29681.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 6f29681 at 4f1ca06
build (prof) Log file. Build time: 04 min 34 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
trigger Log file. Return Code 2.
check_cmake Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy ➡️ 2 errors 4 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 6f29681 after being merged into the base branch at 4f1ca06.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

Copy link
Collaborator

@giro94 giro94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good


double rand = _randFlat->fire();
if (rand < _intensity) {
const bool fire = (_fireAll) ? true : _randFlat->fire() < _intensity;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could simply be if (_fireAll || _randFlat->fire() < _intensity) {

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enhances the MuCap1809keVGammaGenerator_tool to support CAPHRI studies by adding the ability to restrict the angular distribution of generated photons and optionally force photon generation in every event.

Changes:

  • Added configurable angle restrictions (czMin, czMax) to limit the cos(theta_z) range for photon generation
  • Added a fireAll flag to force photon generation in every event instead of using the branching fraction
  • Added validation to ensure angle parameters are physically valid

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

struct PhysConfig {
using Name=fhicl::Name;
using Comment=fhicl::Comment;
fhicl::Atom<double> czMin {Name("czmin") , Comment("Restrict cos(theta_z) minimum"), -1.};
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name "czmin" in the Name() should use lowercase to match the established convention across the codebase. All other similar generators use lowercase "czmin" (see RMCGenerator_tool.cc, PrimaryAntiProtonGun_module.cc, StoppedMuonXRayGammaRayGun_module.cc, etc.).

Copilot uses AI. Check for mistakes.
using Name=fhicl::Name;
using Comment=fhicl::Comment;
fhicl::Atom<double> czMin {Name("czmin") , Comment("Restrict cos(theta_z) minimum"), -1.};
fhicl::Atom<double> czMax {Name("czmax") , Comment("Restrict cos(theta_z) maximum"), 1.};
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter name "czmax" in the Name() should use lowercase to match the established convention across the codebase. All other similar generators use lowercase "czmax" (see RMCGenerator_tool.cc, PrimaryAntiProtonGun_module.cc, StoppedMuonXRayGammaRayGun_module.cc, etc.).

Copilot uses AI. Check for mistakes.

double rand = _randFlat->fire();
if (rand < _intensity) {
const bool fire = (_fireAll) ? true : _randFlat->fire() < _intensity;
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ternary expression can be simplified. Instead of (_fireAll) ? true : _randFlat->fire() < _intensity, use _fireAll || _randFlat->fire() < _intensity which is more concise and idiomatic.

Suggested change
const bool fire = (_fireAll) ? true : _randFlat->fire() < _intensity;
const bool fire = _fireAll || _randFlat->fire() < _intensity;

Copilot uses AI. Check for mistakes.
@giro94
Copy link
Collaborator

giro94 commented Feb 5, 2026

Do we need copilot for a 10-lines PR ?

@FNALbuild
Copy link
Collaborator

📝 The HEAD of main has changed to 1148372. Tests are now out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants