-
Notifications
You must be signed in to change notification settings - Fork 6
Simultaneous fit to KA and PI production #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ExactNNLO
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
There was a problem hiding this 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 PR extends the framework to support simultaneous fits of multiple hadrons by generalizing the neural network and LHAPDF interfaces. Key changes include:
- Updates to NNADparameterisation to handle multiple hadrons (via mapping output splits, rotations, and derivatives).
- Modifications to LHAPDFparameterisation and associated chi² routines to retrieve the appropriate distributions based on the hadron type.
- Changes in test and run utilities to remove redundant command‐line options and support hadron‐specific configurations.
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Reweighting.cc | Added a warning message regarding unsupported multiple hadrons and adjusted LHAPDF initialization. |
| tests/PredsComparison.cc, ClosureTests.cc | Updated to call distribution functions with the hadron argument. |
| src/parameterisations/NNADparameterisation.cc | Refactored to split outputs and rotations by hadron; now uses maps for derivative sets and hadron output sizes. |
| src/parameterisations/LHAPDFparameterisation.cc | Adjusted constructors and distribution function definitions to use hadron-dependent maps. |
| run/* (Predictions.cc, Optimize.cc, LHAPDFGrid.cc, ComputeChi2s.cc) | Updated run utilities to work with the new multiple-hadron configuration and simplified usage. |
| inc/MontBlanc/*.h | Header updates reflecting new function signatures and internal data structures for multi-hadron support. |
Files not reviewed (1)
- src/CMakeLists.txt: Language not supported
Comments suppressed due to low confidence (1)
tests/Reweighting.cc:38
- The warning message indicates 'undefined behaviour' when multiple hadrons are provided; consider rephrasing to clearly advise users on the limitations or required input format.
std::cout << "WARNING: this module does not handle multiple hadrons. If the more than one hadrons are "
| for(size_t i=1; access((ResultFolder+ "/" + SetNamesMap[0] + "/" + SetNamesMap[0] + "_" + i_to_fixed_length_str(i,4) + ".dat").c_str(), F_OK) != -1; i++) | ||
| { | ||
| //std::cout<<(ResultFolder+"/LHAPDFSet/" + std::to_string(i)); | ||
| compute_chi2s(ResultFolder, i, LHAPDFSet, "IndivChi2s/Chi2sReplica" + std::to_string(i)); | ||
| for (auto const& map : config["NNAD"]["flavour maps"]) | ||
| MembersMap.insert({map["hadron"].as<std::string>(), i}); | ||
| compute_chi2s(ResultFolder, MembersMap, SetNamesMap, "IndivChi2s/Chi2sReplica" + std::to_string(i)); |
Copilot
AI
Apr 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indexing the unordered_map 'SetNamesMap' with the key 0 is likely incorrect since it is keyed by string; consider iterating over the map or using a valid string key for file path construction.
…_MINUS_B.yaml to avoid a singular covariance matrix
This PR implements the possibility of performing simultaneous fits of multiple hadrons.
Implementation detail
NNADparameterisation
We use the same neural network to parametrise multiple hadrons. This means that the outputs of the network needs to be split into flavours belonging to different hadrons. Hence, for each hadron we define a split matrix which is stored in the class attribute
_SplitMatricesthat is defined in the constructor ofNNADparameterisation._SplitMatricesis astd::mapthat maps astd::string(the name of the hadron) to thennad:Matrixthat encodes the filtering layer for the network outputs. Hence, given a neural network that parametrises KA and PI, we can select the flavours of the PI as followsThen, one can apply flavour rotations to
SplitOutput. Note that flavour rotations also need to be coupled with the hadron. Hence, we also include the map_Rotations, which is similar to_SplitMatricesbut for flavour rotations.Both
_Rotationsand_SplitMatricesare constructed in the constructor ofNNADparameterisation. The reason is that both require runtime information taken from the runcard. For instance, the split matrices have to account for the number of flavours in each hadron and the total size of the network outputs, both specified in the runcard.On the other hand, flavour rotations require the flavour map specified for each hadron (see "Runcard Example" to learn how to specify maps for different hadrons).
The data structure of
_NNderivativeSetsis also modified. Now it isso that each hadron has its own
apfelset. This requires changes inEvaluateOnGridandDeriveOnGrid, which will loop over hadrons (see source code).Chi2 and predictions
Since we have to handle predictions with different hadrons in the same fit, we need to ensure that convolutions are computed with the correct hadron
apfel::Set. This is achieved by matching the hadron name from theDataHandlerwith the correctapfel::SetinNNADparameterisationwhen setting the FF inNangaParbat::ConvolutionTable. For instance, inAnalyticChiSquarewe haveLHAPDFgrid
The script that creates the LHAPDF grids is also modified to handle multiple hadrons. Specifically,
LHAPDFgridwill generate a grid for each hadron. The names of the sets are specified in the runcard for each hadron, under the keySetName(see runcard below).Other improvements
Using multiple cores in
ceres-solver(see Optimize.cc)It is possible to specify the number of cores to use as a command-line argument
TODO
Compatibility with scripts in the Tests folderMany scripts in theTestsfolder were already deprecated or outdated.Check that the implementation gives sensible resultsTest performed fitting KA and PI without sum rules. The two hadrons are compatible with previous separate fits (see ...)Backwards compatibilitylegacy version is tagged and the user is asked to use the old version of the code with legacy runcardRuncard example