-
Notifications
You must be signed in to change notification settings - Fork 109
Add configurable Q2 minimum cuts and spline consistency metadata #492
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
Open
Pabce
wants to merge
8
commits into
GENIE-MC:master
Choose a base branch
from
Pabce:command-line-q2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6b38a56
Make electromagnetic Q2 minimum configurable via XML
Pabce 3f3481f
Remove explicit Q² check from DISKinematicsGenerator
Pabce 96be82b
Add --em-q2-min command line argument to gevgen and gmkspl
Pabce 2f4ed24
Final candidate implementation for command line q2 limit
Pabce 472ff9b
Enable pi0 decays by default
Pabce dd2fe53
blup
Pabce 83ea8a9
Record Q2 cut metadata in spline XML
Pabce 28a9ba2
Cleanup of irrelevant local files
Pabce File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <!-- | ||
| *************************************************************************************************** | ||
| This file defines configurable kinematic phase-space cuts that are shared by the generator. | ||
| Physical limits remain in KineUtils/KPhaseSpace; these values are user-configurable cuts layered | ||
| on top of those physical limits. | ||
| *************************************************************************************************** | ||
| --> | ||
|
|
||
| <common_PhaseSpaceCuts_list> | ||
|
|
||
| <param_set name="Default"> | ||
| <param type="double" name="EM-Q2-min"> 0.02 </param> | ||
| </param_set> | ||
|
|
||
| </common_PhaseSpaceCuts_list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <!-- | ||
| *************************************************************************************************** | ||
| This file defines configurable kinematic phase-space cuts that are shared by the generator. | ||
| Physical limits remain in KineUtils/KPhaseSpace; these values are user-configurable cuts layered | ||
| on top of those physical limits. | ||
| *************************************************************************************************** | ||
| --> | ||
|
|
||
| <common_PhaseSpaceCuts_list> | ||
|
|
||
| <param_set name="Default"> | ||
| <param type="double" name="EM-Q2-min"> 0.02 </param> | ||
| </param_set> | ||
|
|
||
| </common_PhaseSpaceCuts_list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <!-- | ||
| *************************************************************************************************** | ||
| This file defines configurable kinematic phase-space cuts that are shared by the generator. | ||
| Physical limits remain in KineUtils/KPhaseSpace; these values are user-configurable cuts layered | ||
| on top of those physical limits. | ||
| *************************************************************************************************** | ||
| --> | ||
|
|
||
| <common_PhaseSpaceCuts_list> | ||
|
|
||
| <param_set name="Default"> | ||
| <param type="double" name="EM-Q2-min"> 0.02 </param> | ||
| </param_set> | ||
|
|
||
| </common_PhaseSpaceCuts_list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <!-- | ||
| *************************************************************************************************** | ||
| This file defines configurable kinematic phase-space cuts that are shared by the generator. | ||
| Physical limits remain in KineUtils/KPhaseSpace; these values are user-configurable cuts layered | ||
| on top of those physical limits. | ||
| *************************************************************************************************** | ||
| --> | ||
|
|
||
| <common_PhaseSpaceCuts_list> | ||
|
|
||
| <param_set name="Default"> | ||
| <param type="double" name="EM-Q2-min"> 0.02 </param> | ||
| </param_set> | ||
|
|
||
| </common_PhaseSpaceCuts_list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <!-- | ||
| *************************************************************************************************** | ||
| This file defines configurable kinematic phase-space cuts that are shared by the generator. | ||
| Physical limits remain in KineUtils/KPhaseSpace; these values are user-configurable cuts layered | ||
| on top of those physical limits. | ||
| *************************************************************************************************** | ||
| --> | ||
|
|
||
| <common_PhaseSpaceCuts_list> | ||
|
|
||
| <param_set name="Default"> | ||
| <param type="double" name="EM-Q2-min"> 0.02 </param> | ||
| </param_set> | ||
|
|
||
| </common_PhaseSpaceCuts_list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?xml version="1.0" encoding="ISO-8859-1"?> | ||
|
|
||
| <!-- | ||
| *************************************************************************************************** | ||
| This file defines configurable kinematic phase-space cuts that are shared by the generator. | ||
| Physical limits remain in KineUtils/KPhaseSpace; these values are user-configurable cuts layered | ||
| on top of those physical limits. | ||
| *************************************************************************************************** | ||
| --> | ||
|
|
||
| <common_PhaseSpaceCuts_list> | ||
|
|
||
| <param_set name="Default"> | ||
| <param type="double" name="EM-Q2-min"> 0.02 </param> | ||
| </param_set> | ||
|
|
||
| </common_PhaseSpaceCuts_list> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| [--no-copy] | ||
| [--seed seed_number] | ||
| [--input-cross-sections xml_file] | ||
| [--q2-min q2_value] | ||
|
|
||
| // command line args handled by RunOpt: | ||
| [--event-generator-list list_name] // default "Default" | ||
|
|
@@ -59,6 +60,9 @@ | |
| Name (incl. full path) of an XML file with pre-computed | ||
| free-nucleon cross-section values. If loaded, it can speed-up | ||
| cross-section calculation for nuclear targets. | ||
| --q2-min | ||
| Override the minimum Q^2 phase-space cut (in GeV^2). For weak | ||
| interactions, this explicitly opts the run into the Q2 cut. | ||
|
|
||
| --event-generator-list | ||
| List of event generators to load in event generation drivers. | ||
|
|
@@ -87,6 +91,7 @@ | |
| //____________________________________________________________________________ | ||
|
|
||
| #include <cassert> | ||
| #include <cmath> | ||
| #include <cstdlib> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
@@ -100,6 +105,7 @@ | |
| #include "Framework/Conventions/GBuild.h" | ||
| #include "Framework/EventGen/GEVGDriver.h" | ||
| #include "Framework/Interaction/Interaction.h" | ||
| #include "Framework/Interaction/KPhaseSpaceCuts.h" | ||
| #include "Framework/Messenger/Messenger.h" | ||
| #include "Framework/Numerical/RandomGen.h" | ||
| #include "Framework/ParticleData/PDGCodeList.h" | ||
|
|
@@ -140,6 +146,8 @@ bool gOptNoCopy = false; | |
| long int gOptRanSeed = -1; // random number seed | ||
| string gOptInpXSecFile = ""; // input cross-section file | ||
| string gOptOutXSecFile = ""; // output cross-section file | ||
| double gOptQ2Min; // Q2 minimum override value | ||
| bool gOptQ2MinSet = false; // whether --q2-min was specified | ||
|
|
||
| //____________________________________________________________________________ | ||
| int main(int argc, char ** argv) | ||
|
|
@@ -153,6 +161,14 @@ int main(int argc, char ** argv) | |
| } | ||
| RunOpt::Instance()->BuildTune(); | ||
|
|
||
| // Apply Q2 minimum override before physics code queries phase-space cuts. | ||
| if(gOptQ2MinSet) { | ||
| KPhaseSpaceCuts::Instance()->SetQ2MinOverride(gOptQ2Min); | ||
| LOG("gmkspl", pNOTICE) | ||
| << "Overriding Q2 minimum phase-space cut from command line: " | ||
| << gOptQ2Min << " GeV^2"; | ||
| } | ||
|
|
||
| // throw on NaNs and Infs... | ||
| #if defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT) | ||
| feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); | ||
|
|
@@ -202,6 +218,31 @@ int main(int argc, char ** argv) | |
|
|
||
| // Save the splines at the requested XML file | ||
| XSecSplineList * xspl = XSecSplineList::Instance(); | ||
| KPhaseSpaceCuts * cuts = KPhaseSpaceCuts::Instance(); | ||
| bool has_q2_metadata = false; | ||
| double q2_metadata = -1.; | ||
| string q2_metadata_source = ""; | ||
| for(nuiter = neutrinos->begin(); nuiter != neutrinos->end(); ++nuiter) { | ||
| int nupdgc = *nuiter; | ||
| if(!cuts->HasSplineQ2MinCutForProbe(nupdgc)) continue; | ||
|
|
||
| double probe_q2_metadata = cuts->SplineQ2MinCutForProbe(nupdgc); | ||
| string probe_q2_metadata_source = | ||
| cuts->SplineQ2MinCutSourceForProbe(nupdgc); | ||
| if(!has_q2_metadata) { | ||
| has_q2_metadata = true; | ||
| q2_metadata = probe_q2_metadata; | ||
| q2_metadata_source = probe_q2_metadata_source; | ||
| } else if(std::fabs(q2_metadata - probe_q2_metadata) > 1E-12) { | ||
| LOG("gmkspl", pFATAL) | ||
| << "Cannot write one spline Q2 metadata value for mixed probes " | ||
| << "with different configured Q2 cuts."; | ||
| exit(1); | ||
| } | ||
| } | ||
| if(has_q2_metadata) { | ||
| xspl->SetCurrentTuneQ2MinKinematics(q2_metadata, q2_metadata_source); | ||
| } | ||
| bool save_init = !gOptNoCopy; | ||
| xspl->SaveAsXml(gOptOutXSecFile, save_init); | ||
|
|
||
|
|
@@ -329,6 +370,14 @@ void GetCommandLineArgs(int argc, char ** argv) | |
| gOptInpXSecFile = ""; | ||
| } | ||
|
|
||
| // Q2 minimum override | ||
| gOptQ2MinSet = false; | ||
| if(parser.OptionExists("q2-min")) { | ||
| LOG("gmkspl", pINFO) << "Reading Q2 minimum cut override"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would add a more descriptive message like |
||
| gOptQ2Min = parser.ArgAsDouble("q2-min"); | ||
| gOptQ2MinSet = true; | ||
| } | ||
|
|
||
| // | ||
| // print the command-line options | ||
| // | ||
|
|
@@ -340,8 +389,12 @@ void GetCommandLineArgs(int argc, char ** argv) | |
| << "\n Input ROOT geometry : " << gOptGeomFilename | ||
| << "\n Output cross-section file : " << gOptOutXSecFile | ||
| << "\n Input cross-section file : " << gOptInpXSecFile | ||
| << "\n Random number seed : " << gOptRanSeed | ||
| << "\n"; | ||
| << "\n Random number seed : " << gOptRanSeed; | ||
| if(gOptQ2MinSet) { | ||
| LOG("gmkspl", pNOTICE) | ||
| << "\n Q2 minimum override : " << gOptQ2Min << " GeV^2"; | ||
| } | ||
| LOG("gmkspl", pNOTICE) << "\n"; | ||
|
|
||
| LOG("gmkspl", pNOTICE) << *RunOpt::Instance(); | ||
| } | ||
|
|
@@ -358,6 +411,7 @@ void PrintSyntax(void) | |
| << "\n [--no-copy]" | ||
| << "\n [--seed seed_number]" | ||
| << "\n [--input-cross-sections xml_file]" | ||
| << "\n [--q2-min q2_value]" | ||
| << RunOpt::RunOptSyntaxString(false) | ||
| << "\n"; | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As this is a new feature, I would specify where this is by default setup for EM interactions.
Quote the CommonPhaseSpaceCuts.xml file