GENIE-MC / Generator

The popular GENIE Generator product is used by nearly all accelerator neutrino experiments and it plays a key role in the exploitation of neutrino data. The Generator implements a modern software framework and it includes state-of-the-art physics modules. It captures the latest results of the GENIE global analysis of neutrino scattering data and includes several tunes that were produced using the proprietary Comparisons and Tuning products. The GENIE physics model is universal and comprehensive: It handles all neutrinos and targets, and all processes relevant from MeV to PeV energy scales. The Generator includes several tools (flux drivers, detector geometry navigators, specialized event generation apps, event reweighting engines) to simulate complex experimental setups in full detail and to support generator-related analysis tasks.
http://www.genie-mc.org
42 stars 92 forks source link

Incorrect xsec_max in RES importance sampling #282

Open physcxia opened 1 year ago

physcxia commented 1 year ago

In the importance sampling of RESKinematicsGenerator, the maximal cross section xsec_max is being passed to the envelope function in the following line:

https://github.com/GENIE-MC/Generator/blob/25df35f9ca97b6eeab79308b6b49974ffb01d4ef/src/Physics/Resonance/EventGen/RESKinematicsGenerator.cxx#L187

The envelope represents a distribution of the transformed kinematic variable $Q_D^2$. However, the variable xsec_max is calculated as the maximal differential cross section, $\frac{d\sigma^{\max}}{dWdQ^2}$, with original $Q^2$,

https://github.com/GENIE-MC/Generator/blob/25df35f9ca97b6eeab79308b6b49974ffb01d4ef/src/Physics/Resonance/EventGen/RESKinematicsGenerator.cxx#L104

which has incorrect dimension and numerically may be much less than the maximal differential cross section in $Q_D^2$, $\frac{d\sigma^{\max}}{dWdQ_D^2}$, as expected by the envelope.

The phase space kPSWQD2fE instead of kPSWQ2fE should be used in ComputeMaxXSec,

https://github.com/GENIE-MC/Generator/blob/25df35f9ca97b6eeab79308b6b49974ffb01d4ef/src/Physics/Resonance/EventGen/RESKinematicsGenerator.cxx#L370

Could someone help investigate this issue?

candreop commented 1 year ago

Thanks for the report, Chen. This is somewhat old code, so we will need to refresh our memory about how the importance sampliing envelope was constructed and investigate further. We will try to do this asap. In the mean time, if you are concerned that the actual differential cross-section overshoots the importance sampling envelope and, therefore, the generation of kinematics distorts the inputs cross-section modek, you can use the safety check implemented in KineGeneratorWithCache::AssertXSecLimits() - See https://github.com/GENIE-MC/Generator/blob/25df35f9ca97b6eeab79308b6b49974ffb01d4ef/src/Physics/Common/KineGeneratorWithCache.cxx. You can enable this check by setting the MaxXSec-DiffTolerance in https://github.com/GENIE-MC/Generator/blob/master/config/RESKinematicsGenerator.xml

candreop commented 1 year ago

Follow up by Chen Xia:

Following your suggestions, we set MaxXSec-DiffTolerance = 0.1 and tested with the following command using GENIE R-3_04_00:

gevgen -n 10000 -e 5.0 -p 12 -t 1000260560 --cross-sections ./genie_xsec/v3_04_00/NULL/G1802a00000-k250-e1000/data/gxspl-NUsmall.xml --seed 171872 --event-generator-list NCRES

This test was passed.

However, we found an issue with the test code implemented in RESKinematicGenerator.cxx, which is at Line 215:

this->AssertXSecLimits(interaction, xsec, max);

This comparison between xsec and max is incorrect because xsec is the differential cross section in terms of Q^2, but the max is the value of the envelope which is a function of QD^2.

We have tried to correct this line as follows:

this->AssertXSecLimits(interaction, xsec*J, max);

where the Jacobian J is inserted. In this case, the test was failed even if setting a large tolerance of MaxXSec-DiffTolerance = 100.

We would greatly appreciate any further guidance or assistance you can provide regarding this matter.