Skip to content

Neutron generator updates#1878

Open
michaelmackenzie wants to merge 2 commits into
Mu2e:mainfrom
michaelmackenzie:NeutronTail
Open

Neutron generator updates#1878
michaelmackenzie wants to merge 2 commits into
Mu2e:mainfrom
michaelmackenzie:NeutronTail

Conversation

@michaelmackenzie

Copy link
Copy Markdown
Contributor

This is so we can simulate the high energy neutron tail component for calo cluster background studies

@FNALbuild

Copy link
Copy Markdown
Collaborator

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

  • EventGenerator
  • MCDataProducts

which require these tests: build.

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

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

About FNALbuild. Code review on Mu2e/Offline.

@oksuzian

Copy link
Copy Markdown
Collaborator

Core change

New helper in the base class centralizes what DIOGenerator did inline:

double calculateBinnedSpectrumEnergyFraction(fhicl::ParameterSet pset,
                                             std::string var_low = "elow",
                                             std::string var_high = "ehi",
                                             double full_var_low = 0.,
                                             double full_var_high = 0.) const {
  BinnedSpectrum spectrum(pset);
  pset.erase(var_low);
  pset.erase(var_high);
  pset.put(var_low, full_var_low);
  pset.put(var_high, full_var_high);
  BinnedSpectrum fullSpectrum(pset);
  ...
  const double fraction = (fullIntegral > 0.) ? integral / fullIntegral : 0.;
  return fraction;
}

MuCapNeutronGenerator now actually uses the fraction (previously hardcoded 1.), and DIOGenerator was rewritten to call the helper and renamed _energy_fraction_energyFraction.

Issues / concerns

1. Behavior change in DIO: dropped threshold correction (medium). The old DIO code added a near-threshold correction before computing the fraction; the new shared helper omits it:

// removed in DIOGenerator_tool.cc
double pmin = _spectrum.getAbscissa(0);
double pdfmin = _spectrum.getPDF(0);
double binsize = _spectrum.getBinWidth();
fullintegral += 0.5*pdfmin*pmin/binsize;

This changes the DIO _energyFraction value (and thus normalization) versus current behavior. The comment noted it corrects "the missing prediction near threshold, assuming the rate falls to 0 linearly." Confirm this drop is intentional and acceptable for DIO — if not, the correction should be preserved (e.g. as an optional flag in the helper).

2. pset passed by value but reused after mutation (low, but verify). In both callers fullconfig is retrieved and passed to the helper. The helper takes pset by value and mutates it locally, so callers are safe — good. Just confirm no caller relies on fullconfig being modified afterward.

3. Debug std::cout left in production paths (low). Both generators unconditionally print sampled-fraction lines to stdout on every construction. Consider mf::LogInfo/a verbosity guard instead of raw std::cout for job-log cleanliness.

4. classes_def.xml addition — verify necessity (low). New dictionary entries for std::pair<std::string, RestrictedVar> and its wrapper are added. Confirm these are actually needed for persistence and that a matching entry exists in classes.h (only classes_def.xml is touched here) — mismatches cause genreflex/build failures.

@FNALbuild

Copy link
Copy Markdown
Collaborator

☀️ The build tests passed at fd5c2a7.

Test Result Details
test with Command did not list any other PRs to include
merge Merged fd5c2a7 at 20895af
build (prof) Log file. Build time: 08 min 41 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.
check_cmake Log file.
FIXME, TODO TODO (0) FIXME (0) in 3 files
clang-tidy ➡️ 4 errors 17 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at fd5c2a7 after being merged into the base branch at 20895af.

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.

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