-
Notifications
You must be signed in to change notification settings - Fork 112
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
base: master
Are you sure you want to change the base?
Changes from 8 commits
6b38a56
3f3481f
96be82b
2f4ed24
472ff9b
dd2fe53
83ea8a9
28a9ba2
e5a6e4b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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> |
| 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
Author
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. Also agreed, added more descriptive wording + value. |
||
| 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"; | ||
|
|
||
|
|
||
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
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.
Agreed. Updated the help text here and in
gEvGen.cxxto say that the default EM cut is configured inCommonPhaseSpaceCuts.xmlasEM-Q2-min.