diff --git a/config/AR23_20i/CommonParam.xml b/config/AR23_20i/CommonParam.xml
index ad5f46618..a1d7851aa 100644
--- a/config/AR23_20i/CommonParam.xml
+++ b/config/AR23_20i/CommonParam.xml
@@ -291,6 +291,7 @@ Or changing the name of this parameter set
P31(1910),P33(1920),F35(1905),F37(1950),P11(1710)
+ 0.0924
diff --git a/config/AR23_20i/ModelConfiguration.xml b/config/AR23_20i/ModelConfiguration.xml
index 69e2930a1..06f819393 100644
--- a/config/AR23_20i/ModelConfiguration.xml
+++ b/config/AR23_20i/ModelConfiguration.xml
@@ -120,6 +120,9 @@ STFC, Rutherford Appleton Laboratory
genie::AlvarezRusoCOHPiPXSec/Fast
-->
+
+ genie::AlvarezRusoSalaCOHGammaPXSec/Default
+
genie::BardinIMDRadCorPXSec/Default
genie::IMDAnnihilationPXSec/Default
genie::NuElectronPXSec/Default
diff --git a/config/AR23_20i/TuneGeneratorList.xml b/config/AR23_20i/TuneGeneratorList.xml
index 938e22406..4a65ae8e4 100644
--- a/config/AR23_20i/TuneGeneratorList.xml
+++ b/config/AR23_20i/TuneGeneratorList.xml
@@ -47,7 +47,7 @@ Generator-%d alg No
-->
- 18
+ 19
genie::EventGenerator/QEL-CC
genie::EventGenerator/QEL-NC
genie::EventGenerator/RES-CC
@@ -66,6 +66,7 @@ Generator-%d alg No
genie::EventGenerator/QEL-CC-LAMBDA
genie::EventGenerator/MEC-CC
genie::EventGenerator/MEC-NC
+ genie::EventGenerator/COH-NC-GAMMA
diff --git a/config/AlvarezRusoCOHPiPXSec.xml b/config/AlvarezRusoCOHPiPXSec.xml
index 3efd34a18..ae043ae74 100644
--- a/config/AlvarezRusoCOHPiPXSec.xml
+++ b/config/AlvarezRusoCOHPiPXSec.xml
@@ -39,13 +39,13 @@ CoHAR_mA double yes Coherent axial mass 1.28
- genie::COHXSecAR/Default
+ genie::COHXSecAR/Pion
false
- genie::COHXSecAR/Fast
+ genie::COHXSecAR/Fast_Pion
false
diff --git a/config/AlvarezRusoSalaCOHGammaPXSec.xml b/config/AlvarezRusoSalaCOHGammaPXSec.xml
new file mode 100644
index 000000000..0c2234579
--- /dev/null
+++ b/config/AlvarezRusoSalaCOHGammaPXSec.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ genie::COHDeltaCurrent/Default
+
+
+ genie::COHXSecAR/Gamma
+
+
+
+
+
+
+ genie::COHDeltaCurrent/FermiMomentumTable
+
+
+
+
+
+
+
diff --git a/config/COHDeltaCurrent.xml b/config/COHDeltaCurrent.xml
new file mode 100644
index 000000000..569e0d914
--- /dev/null
+++ b/config/COHDeltaCurrent.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+ genie::DeltaTransitionFormFactor/Default
+ genie::DeltaInMediumCorrections/Default
+
+
+
+
+
+ genie::DeltaInMediumCorrections/FermiMomentumTable
+
+
+
+
+
diff --git a/config/COHGammaIntegrationLimits.xml b/config/COHGammaIntegrationLimits.xml
new file mode 100644
index 000000000..e7451cb58
--- /dev/null
+++ b/config/COHGammaIntegrationLimits.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+ 0.9
+ 150.
+
+ genie::COHProtonFormFactorInterpolation/Default
+
+
+
+
diff --git a/config/COHGammaKinematicsGenerator.xml b/config/COHGammaKinematicsGenerator.xml
new file mode 100644
index 000000000..7e1ee6689
--- /dev/null
+++ b/config/COHGammaKinematicsGenerator.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+ 1.5
+
+ 1.
+
+ 100000
+
+ 11 ; 175 ; 11 ; 3
+
+ 0.4 ; 0.8 ; 0.4 ; 0.01
+
+ genie::COHGammaIntegrationLimits/Default
+
+
+
+
+
+
diff --git a/config/COHKinematicsGenerator.xml b/config/COHKinematicsGenerator.xml
deleted file mode 100644
index 0a01bf804..000000000
--- a/config/COHKinematicsGenerator.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
- Coherent
-
-
-
-
-
diff --git a/config/COHPionKinematicsGenerator.xml b/config/COHPionKinematicsGenerator.xml
new file mode 100644
index 000000000..165417589
--- /dev/null
+++ b/config/COHPionKinematicsGenerator.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+ Coherent
+
+
+
+
+
diff --git a/config/COHProtonFormFactorInterpolation.xml b/config/COHProtonFormFactorInterpolation.xml
new file mode 100644
index 000000000..9bbe1098c
--- /dev/null
+++ b/config/COHProtonFormFactorInterpolation.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+ genie::DeVriesFormFactorMap/Default
+
+
+ false
+
+
+
diff --git a/config/COHXSecAR.xml b/config/COHXSecAR.xml
index 5efacb297..2a12668ff 100644
--- a/config/COHXSecAR.xml
+++ b/config/COHXSecAR.xml
@@ -12,6 +12,17 @@ split-integral bool yes If true, breaks 4d integral into 3d+
gsl-integration-type string yes Algorithm to use for multidimensional integral vegas
gsl-relative-tolerance double yes Desired numerical accuracy for each integral 0.01
gsl-max-eval int yes Max limit of evaluations for multidimensional integral 20000
+
+IsCOHPion bool yes This integrator can be used for both COH Pion and Gamma false
+ISCOHGamma bool yes false
+OmegaPhaseSpace bool Yes Only used for the COH Gamma case false
+ It perform the integration in the dOmega_g dOmega_l
+tPhaseSpace bool Yes Only used for the COH Gamma case false
+ It perform the integration in the t phase space
+ instead of theta_l
+IntegrationLimits algo Maybe Specificies integration limit algorithm
+ It is required for COH gamma configurations
+
....................................................................................................
-->
@@ -23,17 +34,57 @@ gsl-max-eval int yes Max limit of evaluations for multidi
40000
0.01
true
-
+
-
+
+
+ true
+
+
+
+
miser
10000
0.05
+ true
+
+
+
+ true
+
+ false
+
+ false
+ vegas
+
+ 400000
+ 0.005
+
+ genie::COHGammaIntegrationLimits/Default
+
+
+
+
+
+ true
+ true
+ false
+ vegas
+
+ 400000
+ 0.005
+
+
+
+
+
+
+
diff --git a/config/DeVriesFormFactor.xml b/config/DeVriesFormFactor.xml
new file mode 100644
index 000000000..1002ce45a
--- /dev/null
+++ b/config/DeVriesFormFactor.xml
@@ -0,0 +1,980 @@
+
+
+
+
+
+
+
+
+
+
+
+ 1000010030
+
+ 3.5
+ 2.83
+
+
+ 0.25182e-1 ; 0.34215e-1 ; 0.15257e-1
+
+
+
+
+
+ 1000020030
+
+ 5.0
+
+
+ 10.10
+
+
+
+ 0.20020e-1 ; 0.41934e-1 ; 0.36254e-1 ; 0.17941e-1 ; 0.46608e-2 ;
+ 0.46834e-2 ; 0.52042e-2 ; 0.38280e-2 ; 0.25661e-2 ; 0.14182e-2 ;
+ 0.61390e-3 ; 0.22929e-3
+
+
+
+
+
+ 1000060120
+
+ 8.0
+ 2.75
+
+
+ 0.15737e-1 ; 0.38897e-1 ; 0.37085e-1 ; 0.14795e-1 ; -0.44831e-2 ;
+ -0.10057e-1 ; -0.68696e-2 ; -0.28813e-2 ; -0.77229e-3 ; 0.66908e-4 ;
+ 0.10636e-3 ; -0.36864e-4 ; -0.50135e-5 ; 0.94550e-5 ; -0.47687e-5
+
+
+
+
+ 1000070150
+
+ 7.0
+
+ 3.17
+
+
+
+ 0.25491e-1 ; 0.50618e-1 ; 0.29822e-1 ; -0.55196e-2 ; -0.15913e-1 ;
+ -0.76184e-2 ; -0.23992e-2 ; -0.47940e-3
+
+
+
+
+ 1000080160
+
+ 8.0
+ 2.77
+
+
+ 0.20238e-1 ; 0.44793e-1 ; 0.33533e-1 ; 0.35030e-2 ; -0.12293e-1 ;
+ -0.10329e-1 ; 0.34036e-2 ; 0.41627e-3 ; -0.94435e-3 ; 0.25771e-3 ;
+ 0.23759e-3 ; -0.10603e-3 ; 0.41480e-4
+
+
+
+
+ 1000130270
+
+ 7.0
+ 2.70
+
+
+ 0.43418e-1 ; 0.60298e-1 ; 0.28950e-2 ; -0.23522e-1 ; -0.79791e-2 ;
+ 0.23010e-2 ; 0.10794e-2 ; 0.12574e-3 ; -0.13021e-3 ; 0.56563e-4 ;
+ -0.18011e-4 ; 0.42869e-5
+
+
+
+
+ 1000140280
+
+ 8.0
+ 2.64
+
+
+ 0.33495e-1 ; 0.59533e-1 ; 0.20979e-1 ; -0.16900e-1 ; -0.14998e-1 ;
+ 4.93248e-3 ; 0.33266e-2 ; 0.59244e-3 ; 4.40013e-3 ; 0.12242e-3 ;
+ -0.12994e-4 ; -0.92784e-5 ; 0.72595e-5 ; -0.42096e-5
+
+
+
+
+ 1000140290
+
+ 8.0
+ 2.64
+
+
+ 0.33521e-1 ; 0.59679e-1 ; 0.20593e-1 ; -0.18646e-1 ; -0.16550e-1 ;
+ -0.11922e-2 ; 0.28025e-2 ; -0.67353e-4 ; -0.34619e-3 ; 0.17611e-3 ;
+ -0.57173e-5 ; 0.12371e-4
+
+
+
+
+ 1000140300
+
+ 8.5
+ 2.64
+
+
+ 0.28397e-1 ; 0.54163e-1 ; 0.25167e-1 ; -0.12858e-1 ; -0.17592e-1 ;
+ -0.46722e-2 ; 0.24804e-2 ; 0.14760e-2 ; -0.30168e-3 ; 0.48346e-4 ;
+ 0.0 ; -0.51570e-5 ; 0.30261e-5
+
+
+
+
+ 1000150310
+
+ 8.0
+ 2.64
+
+
+ 0.35305e-1 ; 0.59642e-1 ; 0.17274e-1 ; -0.19303e-1 ; 0.13545e-1 ;
+ 0.63209e-3 ; 0.35462e-2 ; 0.83653e-3 ; -0.47904e-3 ; 0.19099e-3 ;
+ -0.69611e-4 ; 0.23196e-4 ; -0.77780e-5
+
+
+
+
+ 1000160320
+
+ 8.0
+ 2.56
+
+
+ 0.37251e-1 ; 0.60248e-1 ; 0.14748e-1 ; -0.18352e-1 ; -0.10347e-1 ;
+ 0.30461e-2 ; 0.35277e-2 ; -0.39834e-4 ; -0.97177e-4 ; 0.92279e-4 ;
+ -0.51931e-4 ; 0.22958e-4 ; -0.86609e-5 ; 0.28879e-5 ; -0.86632e-6
+
+
+
+
+ 1000160340
+
+ 8.0
+ 2.56
+
+
+ 0.37036e-1 ; 0.58506e-1 ; 0.12082e-1 ; -0.19022e-1 ; 0.83421e-2 ;
+ 0.45434e-2 ; 0.28346e-2 ; -0.52304e-3 ; 0.27754e-4 ; 0.59403e-4 ;
+ -0.42794e-4 ; 0.20407e-4 ; -0.79934e-5 ; 0.27354e-5 ; -0.83914e-6
+
+
+
+
+ 1000160360
+
+ 8.0
+ 2.56
+
+
+ 0.37032e-1 ; 0.57939e-1 ; 0.10049e-1 ; -0.19852e-1 ; -0.67176e-2 ;
+ 0.61882e-2 ; 0.37795e-2 ; -0.55272e-3 ; -0.12904e-3 ; 0.15845e-3 ;
+ -0.84063e-4 ; 0.34010e-4 ; -0.11663e-4 ; 0.35204e-5 ; -0.95135e-6
+
+
+
+
+ 1000180400
+
+ 9.0
+ 1.81
+
+
+ 0.30451e-1 ; 0.55337e-1 ; 0.20203e-1 ; -0.16765e-1 ; -0.13578e-1 ;
+ -0.43204e-4 ; 0.91988e-3 ; -0.41205e-3 ; 0.11971e-3 ; -0.19801e-4 ;
+ -0.43204e-5 ; 0.61205e-5 ; -0.37803e-5 ; 0.18001e-5 ; -0.77407e-6
+
+
+
+
+ 1000200400
+
+ 8.0
+ 3.55
+
+
+ 0.44846e-1 ; 0.61326e-1 ; -0.16818e-2 ; -0.26217e-1 ; 0.29725e-2 ;
+ 0.85534e-2 ; 0.35322e-2 ; -0.48258e-3 ; -0.39346e-3 ; 0.20338e-3 ;
+ 0.25461e-4 ; -0.17794e-4 ; 0.67394e-5 ; -0.21033e-5
+
+
+
+
+ 1000200480
+
+ 8.0
+ 3.55
+
+
+ 0.44782e-1 ; 0.59523e-1 ; -0.74148e-2 ; -0.29466e-1 ; -0.28350e-3 ;
+ 0.10829e-1 ; 0.30465e-2 ; -0.10237e-2 ; -0.17830e-3 ; 0.55391e-4 ;
+ -0.22644e-4 ; 0.82671e-5 ; -0.27343e-5 ; 0.82461e-6 ; -0.22780e-6
+
+
+
+
+ 1000220480
+
+ 10.0
+ 2.20
+
+
+ 0.27850e-1 ; 0.55432e-1 ; 0.26369e-1 ; -0.17091e-1 ; -0.21798e-1 ;
+ -0.24889e-2 ; 0.76631e-2 ; 0.34554e-2 ; -0.67471e-3 ; 0.10764e-3 ;
+ -0.16564e-5 ; -0.55566e-5
+
+
+
+
+ 1000220500
+
+ 9.5
+ 2.20
+
+
+ 0.31818e-1 ; 0.58556e-1 ; 0.19637e-1 ; -0.24309e-1 ; -0.18748e-1 ;
+ 0.33741e-2 ; 0.89961e-2 ; 0.37954e-2 ; 0.41238e-3 ; 0.12540e-3
+
+
+
+
+ 1000240500
+
+ 9.0
+ 2.59
+
+
+ 0.39174e-1 ; 0.61822e-1 ; 0.68550e-2 ; -0.30170e-1 ; -0.98745e-2 ;
+ 0.87944e-2 ; 0.68502e-2 ; -0.93609e-3 ; -0.24962e-2 ; -0.15361e-2 ;
+ -0.73687e-3
+
+
+
+
+ 1000240520
+
+ 9.0
+ 2.59
+
+
+ 0.39287e-1 ; 0.62477e-1 ; 0.62482e-2 ; -0.32885e-1 ; -0.10648e-1 ;
+ 0.10520e-1 ; 0.85478e-2 ; -0.24003e-3 ; -0.20499e-2 ; -0.12001e-2 ;
+ -0.56649e-3
+
+
+
+
+ 1000240540
+
+ 9.0
+ 2.59
+
+
+ 0.39002e-1 ; 0.60305e-1 ; 0.45845e-2 ; -0.30723e-1 ; -0.91355e-2 ;
+ 0.93251e-2 ; 0.60583e-2 ; -0.15602e-2 ; -0.76809e-3 ; 0.76809e-3 ;
+ -0.34804e-3
+
+
+
+
+ 1000260540
+
+ 9.0
+ 2.22
+
+
+ 0.42339e-1 ; 0.64428e-1 ; 0.15840e-2 ; -0.35171e-1 ; -0.10116e-1 ;
+ 0.12069e-1 ; 0.62230e-2 ; -0.12045e-2 ; 0.13561e-3 ; 0.10428e-4 ;
+ -0.16980e-4 ; 0.91817e-5 ; 0.39988e-5 ; 0.15731e-5 ; -0.57862e-6 ;
+ 0.20186e-6 ; -0.67892e-7
+
+
+
+
+ 1000260560
+
+ 9.0
+ 2.22
+
+
+ 0.42018e-1 ; 0.62337e-1 ; 0.23995e-3 ; -0.32776e-1 ; -0.79941e-2 ;
+ 0.10844e-1 ; 0.49123e-2 ; -0.22144e-2 ; -0.18146e-3 ; 0.37261e-3 ;
+ -0.23296e-3 ; 0.11494e-3 ; -0.50596e-4 ; 0.20652e-4 ; -0.79428e-5 ;
+ 0.28986e-5 ; -0.10075e-5
+
+
+
+
+ 1000260580
+
+ 9.0
+ 2.22
+
+
+ 0.41791e-1 ; 0.60524e-1 ; -0.14978e-2 ; -0.31183e-1 ; -0.58013e-2 ;
+ 0.10611e-1 ; 0.41629e-2 ; -0.29045e-5 ; 0.54106e-3 ; 0.38689e-3 ;
+ 0.20514e-3 ; -0.95237e-4 ; 0.40707e-4 ; -0.16346e-1 ; 0.62233e-5 ;
+ 0.22568e-5 ; 0.78077e-6
+
+
+
+
+ 1000270590
+
+ 9.0
+ 2.22
+
+
+ 0.43133e-1 ; 0.61249e-1 ; -0.32523e-2 ; -0.32681e-1 ; -0.49583e-2 ;
+ 0.11494e-1 ; 0.55428e-2 ; 0.31398e-3 ; 0.70578e-4 ; 0.53725e-5 ;
+ -0.74650e-6 ; 0.19793e-5 ; -0.28059e-5 ; 0.27183e-5 ; -0.19454e-5 ;
+ 0.10963e-5 ; 0.51114e-6
+
+
+
+
+ 1000280580
+
+ 9.0
+ 2.22
+
+
+ 0.45030e-1 ; 0.65044e-1 ; -0.32843e-2 ; -0.36241e-1 ; -0.67442e-2 ;
+ 0.13146e-1 ; 0.50903e-2 ; -0.20787e-2 ; 0.12901e-3 ; 0.14828e-3 ;
+ -0.11530e-3 ; 0.60881e-4 ; -0.27676e-4 ; 0.11506e-4 ; 0.44764e-5 ;
+ 0.16468e-5 ; -0.57496e-6
+
+
+
+
+ 1000280600
+
+ 9.0
+ 2.22
+
+
+ 0.44855e-1 ; 0.63476e-1 ; -0.51001e-2 ; -0.34496e-1 ; -0.43132e-2 ;
+ 0.12767e-1 ; 0.49935e-2 ; -0.92940e-3 ; 0.28281e-3 ; -0.76557e-4 ;
+ 0.18677e-4 ; 0.36855e-5 ; -0.32276e-6 ; 0.19843e-6 ; 0.16275e-6 ;
+ -0.82891e-7 ; -0.34896e-7
+
+
+
+
+ 1000280620
+
+ 9.0
+ 2.22
+
+
+ 0.44581e-1 ; 0.61478e-1 ; -0.69425e-2 ; -0.33126e-1 ; -0.24964e-2 ;
+ 0.12674e-1 ; 0.37148e-2 ; -0.20881e-2 ; 0.30193e-3 ; 0.57573e-4 ;
+ -0.77965e-4 ; 0.46906e-4 ; -0.22724e-4 ; 0.98243e-5 ; -0.39250e-5 ;
+ 0.14732e-5 ; 0.52344e-6
+
+
+
+
+ 1000280640
+
+ 9.0
+ 2.22
+
+
+ 0.44429e-1 ; 0.60116e-1 ; -0.92003e-2 ; -0.33452e-1 ; -0.52856e-3 ;
+ 0.13156e-1 ; 0.35152e-2 ; -0.21671e-2 ; 0.46497e-4 ; 0.25366e-3 ;
+ -0.18438e-2 ; 0.96874e-4 ; -0.44224e-4 ; 0.18493e-4 ; -0.72361e-5 ;
+ 0.26740e-5 ; -0.93929e-6
+
+
+
+
+ 1000290630
+
+ 9.0
+ 2.22
+
+
+ 0.45598e-1 ; 0.60706e-1 ; -0.78616e-2 ; -0.31638e-1 ; -0.14447e-2 ;
+ 0.10953e-1 ; 0.42578e-2 ; -0.24224e-3 ; -0.30067e-3 ; 0.23903e-3 ;
+ -0.12910e-3 ; 0.60195e-4 ; -0.25755e-4 ; 0.10332e-4 ; -0.39330e-5 ;
+ 0.14254e-5 ; -0.49221e-6
+
+
+
+
+ 1000290650
+
+ 9.0
+ 2.22
+
+
+ 0.45444e-1 ; 0.59544e-1 ; -0.94968e-2 ; -0.31561e-1 ; 0.22898e-3 ;
+ 0.11189e-1 ; 0.37360e-2 ; -0.64873e-3 ; -0.51133e-3 ; 0.43765e-3 ;
+ -0.24276e-3 ; 0.11507e-3 ; -0.49761e-4 ; 0.20140e-4 ; -0.76945e-5 ;
+ 0.28055e-5 ; -0.97411e-6
+
+
+
+
+ 1000300640
+
+ 9.0
+ 2.22
+
+
+ 0.47038e-1 ; 0.61536e-1 ; -0.90045e-2 ; -0.30669e-1 ; -0.78705e-3 ;
+ 0.10034e-1 ; 0.14053e-2 ; -0.20640e-2 ; 0.35105e-3 ; 0.27303e-4 ;
+ -0.63811e-4 ; 0.40893e-4 ; -0.20311e-4 ; 0.88986e-5 ; -0.35849e-5 ;
+ 0.13522e-5 ; -0.38635e-6
+
+
+
+
+ 1000300660
+
+ 9.0
+ 2.22
+
+
+ 0.46991e-1 ; 0.60995e-1 ; -0.96693e-2 ; -0.30457e-1 ; -0.53435e-3 ;
+ 0.97083e-2 ; 0.14091e-2 ; -0.70813e-3 ; 0.20809e-3 ; -0.48275e-4 ;
+ 0.72680e-5 ; 0.91369e-6 ; -0.14874e-5 ; 0.88831e-6 ; -0.41689e-6 ;
+ 0.17283e-6 ; -0.65968e-7
+
+
+
+
+ 1000300680
+
+ 9.0
+ 2.22
+
+
+ 0.46654e-1 ; 0.58827e-1 ; -0.12283e-1 ; -0.29865e-1 ; 0.25669e-2 ;
+ 0.10235e-1 ; 0.31861e-2 ; -0.17351e-3 ; -0.42979e-3 ; 0.33700e-3 ;
+ -0.18435e-3 ; 0.87043e-4 ; -0.37612e-4 ; 0.15220e-4 ; -0.58282e-5 ;
+ 0.21230e-5 ; -0.73709e-6
+
+
+
+
+ 1000300700
+
+ 9.0
+ 2.22
+
+
+ 0.46362e-1 ; 0.57130e-1 ; -0.13877e-1 ; -0.30030e-1 ; 0.35341e-2 ;
+ 0.10113e-1 ; 0.41029e-2 ; 0.76469e-3 ; -0.10138e-2 ; 0.60837e-3 ;
+ -0.29929e-3 ; 0.13329e-3 ; -0.55502e-4 ; 0.21893e-4 ; -0.82286e-5 ;
+ 0.29559e-5 ; -0.10148e-5
+
+
+
+
+ 1000320700
+
+ 10.0
+ 2.90
+
+
+ 0.38182e-1 ; 0.60306e-1 ; 0.64346e-2 ; -0.29427e-1 ; -0.95888e-2 ;
+ 0.87849e-2 ; 0.49187e-2 ; -0.15189e-2 ; -0.17385e-2 ; -0.16794e-3 ;
+ -0.11746e-3 ; 0.65768e-4 ; -0.30691e-4 ; 0.13051e-5 ; -0.52251e-5
+
+
+
+
+ 1000320720
+
+ 10.0
+ 2.90
+
+
+ 0.38083e-1 ; 0.59342e-1 ; 0.47718e-2 ; -0.29953e-1 ; -0.88476e-2 ;
+ 0.96205e-2 ; 0.47901e-2 ; -0.16869e-2 ; -0.15406e-2 ; -0.97230e-4 ;
+ -0.47640e-4 ; -0.15669e-5 ; 0.67076e-5 ; -0.44500e-5 ; 0.22158e-5
+
+
+
+
+ 1000320740
+
+ 10.0
+ 2.90
+
+
+ 0.37989e-1 ; 0.58298e-1 ; 0.27406e-2 ; -0.30666e-1 ; -0.81505e-2 ;
+ 0.10231e-1 ; 0.49382e-2 ; -0.16270e-2 ; -0.13937e-2 ; 0.15476e-3 ;
+ 0.14396e-3 ; -0.73075e-4 ; 0.31998e-4 ; -0.12822e-4 ; 0.48406e-5
+
+
+
+
+ 1000320760
+
+ 10.0
+ 2.90
+
+
+ 0.37951e-1 ; 0.57876e-1 ; 0.15303e-2 ; -0.31822e-1 ; -0.76875e-2 ;
+ 0.11237e-1 ; 0.50780e-2 ; -0.17293e-2 ; -0.15523e-2 ; 0.72439e-4 ;
+ 0.16560e-3 ; -0.86631e-4 ; 0.39159e-4 ; -0.16259e-4 ; 0.63681e-5
+
+
+
+
+ 1000380880
+
+ 9.0
+ 2.50
+
+
+ 0.56435e-1 ; 0.55072e-1 ; -0.33363e-1 ; -0.26061e-1 ; 0.15749e-1 ;
+ 0.75233e-2 ; -0.55044e-2 ; -0.23643e-2 ; 0.39362e-3 ; -0.22733e-3 ;
+ 0.12519e-3 ; -0.61176e-4 ; 0.27243e-4 ; -0.11285e-4 ; 0.43997e-5 ;
+ -0.16248e-5 ; 0.57053e-6
+
+
+
+
+ 1000400900
+
+ 10.0
+ 2.50
+
+
+ 0.46188e-1 ; 0.61795e-1 ; -0.12315e-1 ; -0.36915e-1 ; 0.25175e-2 ;
+ 0.15234e-1 ; -0.55146e-3 ; -0.60631e-2 ; -0.12198e-2 ; 0.36200e-3 ;
+ -0.16466e-3 ; 0.53305e-4 ; -0.50873e-5 ; -0.85658e-5 ; 0.86095e-5
+
+
+
+
+ 1000400920
+
+ 10.0
+ 2.50
+
+
+ 0.45939e-1 ; 0.60104e-1 ; -0.13341e-1 ; -0.35106e-1 ; 0.31760e-2 ;
+ 0.13753e-1 ; -0.82682e-3 ; -0.53001e-2 ; -0.97579e-3 ; 0.26489e-3 ;
+ -0.15873e-3 ; 0.69301e-4 ; -0.22278e-4 ; 0.39533e-5 ; 0.10609e-5
+
+
+
+
+ 1000400940
+
+ 10.0
+ 2.50
+
+
+ 0.45798e-1 ; 0.59245e-1 ; -0.13389e-1 ; -0.33252e-1 ; 0.39888e-2 ;
+ 0.12750e-1 ; -0.15793e-2 ; -0.56692e-2 ; -0.15698e-2 ; 0.54394e-4 ;
+ -0.24032e-4 ; 0.38401e-4 ; -0.31690e-4 ; 0.18481e-4 ; -0.85367e-5
+
+
+
+
+ 1000420920
+
+ 12.0
+ 1.96
+
+
+ 0.30782e-1 ; 0.59896e-1 ; 0.22016e-1 ; -0.28945e-1 ; -0.26707e-1 ;
+ 0.40426e-2 ; 0.14429e-1 ; 0.31696e-2 ; -0.63061e-2 ; -0.45119e-2 ;
+ 0.46236e-3 ; 0.94909e-3 ; -0.38930e-3 ; -0.14808e-3 ; 0.19622e-3 ;
+ -0.40197e-4 ; -0.71949e-4
+
+
+
+
+ 1000420940
+
+ 12.0
+ 1.96
+
+
+ 0.30661e-1 ; 0.58828e-1 ; 0.20396e-1 ; -0.28830e-1 ; -0.25077e-1 ;
+ 0.44768e-2 ; 0.13127e-1 ; 0.19548e-2 ; -0.61403e-2 ; -0.35825e-2 ;
+ 0.73790e-3 ; 0.61882e-3 ; -0.40556e-3 ; -0.55748e-5 ; -0.12453e-3 ;
+ -0.57812e-4 ; -0.21657e-4
+
+
+
+
+ 1000420960
+
+ 12.0
+ 1.96
+
+
+ 0.30564e-1 ; 0.58013e-1 ; 0.19255e-1 ; -0.28372e-1 ; -0.23304e-1 ;
+ 0.49894e-2 ; 0.12126e-1 ; 0.10496e-2 ; -0.62592e-2 ; -0.32814e-2 ;
+ 0.89668e-3 ; 0.50636e-3 ; -0.43412e-3 ; 0.71531e-4 ; 0.76745e-4 ;
+ -0.54316e-4 ; 0.23386e-6
+
+
+
+
+ 1000420980
+
+ 12.0
+ 1.96
+
+
+ 0.30483e-1 ; 0.57207e-1 ; 0.17888e-1 ; -0.28388e-1 ; -0.21778e-1 ;
+ 0.56780e-2 ; 0.11236e-1 ; 0.82176e-3 ; -0.50390e-2 ; -0.23877e-2 ;
+ 0.71492e-3 ; 0.29839e-3 ; -0.31408e-3 ; 0.80177e-3 ; 0.43682e-4 ;
+ -0.51394e-4 ; 0.22293e-4
+
+
+
+
+ 1000421000
+
+ 12.0
+ 1.96
+
+
+ 0.30353e-1 ; 0.56087e-1 ; 0.16057e-1 ; -0.28767e-1 ; -0.20683e-1 ;
+ 0.62429e-2 ; 0.11058e-1 ; 0.11502e-2 ; -0.39395e-2 ; -0.14978e-2 ;
+ 0.76350e-3 ; 0.10554e-3 ; -0.25658e-3 ; 0.10964e-3 ; 0.10015e-4 ;
+ -0.40341e-4 ; 0.25744e-4
+
+
+
+
+ 1000461040
+
+ 11.0
+ 2.38
+
+
+ 0.41210e-1 ; 0.62846e-1 ; -0.21202e-2 ; -0.38359e-1 ; -0.44693e-2 ;
+ 0.16656e-1 ; 0.36873e-2 ; -0.57534e-2 ; -0.32499e-2 ; 0.69844e-3 ;
+ 0.16304e-2 ; 0.59882e-3
+
+
+
+
+ 1000461060
+
+ 11.0
+ 2.38
+
+
+ 0.41056e-1 ; 0.61757e-1 ; -0.29891e-2 ; -0.37356e-1 ; -0.35348e-2 ;
+ 0.16085e-1 ; 0.28502e-2 ; -0.55764e-2 ; -0.15433e-2 ; 0.22281e-2 ;
+ 0.13160e-2 ; 0.16508e-4
+
+
+
+
+ 1000461080
+
+ 11.0
+ 2.38
+
+
+ 0.40754e-1 ; 0.59460e-1 ; -0.54077e-2 ; -0.36305e-1 ; -0.21987e-2 ;
+ 0.15418e-1 ; 0.25927e-2 ; -0.52781e-2 ; -0.19757e-2 ; 0.10339e-2 ;
+ 0.22891e-3 ; -0.33464e-3
+
+
+
+
+ 1000461100
+
+ 11.0
+ 2.40
+
+
+ 0.40668e-1 ; 0.58793e-1 ; -0.61375e-2 ; -0.35983e-1 ; -0.17447e-2 ;
+ 0.14998e-1 ; 0.19994e-2 ; -0.53170e-2 ; -0.14289e-2 ; 0.16033e-2 ;
+ 0.31574e-3 ; -0.42195e-3
+
+
+
+
+ 1000621440
+
+ 9.25
+ 2.50
+
+
+ 0.74734e-1 ; 0.26145e-1 ; -0.63832e-1 ; 0.10432e-1 ; 0.19183e-1 ;
+ -0.12572e-1 ; -0.39707e-2 ; -0.18703e-2 ; 0.12602e-2 ; -0.11902e-2 ;
+ -0.15703e-2
+
+
+
+
+ 1000621480
+
+ 9.25
+ 2.50
+
+
+ 0.73859e-1 ; 0.24023e-1 ; -0.59437e-1 ; 0.10761e-1 ; 0.17022e-1 ;
+ -0.11401e-1 ; -0.18102e-2 ; 0.93011e-3 ; 0.98012e-3 ; -0.12601e-2 ;
+ -0.17402e-2
+
+
+
+
+ 1000621500
+
+ 9.25
+ 2.50
+
+
+ 0.73338e-1 ; 0.24626e-1 ; -0.52773e-1 ; 0.10582e-1 ; 0.15353e-1 ;
+ -0.95624e-2 ; -0.18804e-2 ; -0.79019e-3 ; 0.10102e-2 ; -0.26606e-2 ;
+ -0.18304e-2
+
+
+
+
+ 1000621520
+
+ 9.25
+ 2.50
+
+
+ 0.72646e-1 ; 0.21824e-1 ; -0.54112e-1 ; 0.98321e-2 ; 0.16213e-1 ;
+ -0.65614e-2 ; 0.53611e-2 ; -0.14103e-2 ; -0.99022e-3 ; -0.23005e-2
+
+
+
+
+ 1000621540
+
+ 10.5
+ 2.18
+
+
+ 0.55859e-1 ; 0.44002e-1 ; -0.40342e-1 ; -0.17989e-1 ; 0.19817e-1 ;
+ 0.51643e-2 ; -0.60212e-2 ; -0.23127e-2 ; 0.47024e-3
+
+
+
+
+
+ 1000641540
+
+ 10.0
+ 2.17
+
+
+ 0.63832e-1 ; 0.36983e-1 ; -0.48193e-1 ; -0.51046e-2 ; 0.19805e-1 ;
+ -0.82574e-3 ; -0.46942e-2
+
+
+
+
+ 1000641580
+
+ 10.5
+ 2.17
+
+
+ 0.57217e-1 ; 0.43061e-1 ; -0.41996e-1 ; -0.17203e-1 ; 0.19933e-1 ;
+ 0.51060e-2 ; -0.73665e-2 ; -0.20926e-2 ; 0.21883e-2
+
+
+
+
+ 1000681660
+
+ 11.0
+ 2.28
+
+
+ 0.54426e-1 ; 0.47165e-1 ; -0.38654e-1 ; -0.19672e-1 ; 0.22092e-1 ;
+ 0.78708e-2 ; -0.53005e-2 ; 0.50005e-3 ; 0.52005e-3 ; -0.35003e-3 ;
+ 0.12001e-3
+
+
+
+
+ 1000701740
+
+ 11.0
+ 2.33
+
+
+ 0.54440e-1 ; 0.40034e-1 ; -0.45606e-1 ; -0.20932e-1 ; 0.20455e-1 ;
+ 0.27061e-2 ; -0.60489e-2 ; -0.15918e-3 ; 0.11938e-2
+
+
+
+
+ 1000711750
+
+ 11.0
+ 2.33
+
+
+ 0.55609e-1 ; 0.42243e-1 ; -0.45028e-1 ; -0.19491e-1 ; 0.22514e-1 ;
+ 0.38982e-2 ; -0.72395e-2 ; 0.31822e-3 ; -0.23866e-3
+
+
+
+
+ 1000761920
+
+ 11.0
+ 2.90
+
+
+ 0.59041e-1 ; 0.41498e-1 ; -0.49900e-1 ; -0.10183e-1 ; 0.29067e-1 ;
+ -0.57382e-2 ; -0.92348e-2 ; 0.36170e-2 ; 0.28736e-2 ; 0.24194e-3 ;
+ -0.16766e-2 ; 0.73610e-3
+
+
+
+
+ 1000781960
+
+ 12.0
+ 2.28
+
+
+ 0.50218e-1 ; 0.53722e-1 ; -0.35015e-1 ; -0.34588e-1 ; 0.23564e-1 ;
+ 0.14340e-1 ; -0.13270e-1 ; -0.51212e-2 ; 0.56088e-2 ; 0.14890e-2 ;
+ -0.10928e-2 ; 0.55662e-3 ; -0.50557e-4 ; -0.19708e-3 ; 0.24016e-3
+
+
+
+
+ 1000812030
+
+ 12.0
+ 2.24
+
+
+ 0.51568e-1 ; 0.51562e-1 ; -0.39299e-1 ; -0.30826e-1 ; 0.27491e-1 ;
+ 0.10795e-1 ; -0.15922e-1 ; -0.25527e-2 ; 0.58548e-2 ; 0.19324e-3 ;
+ -0.17925e-3 ; 0.14307e-3 ; -0.91669e-4 ; 0.53497e-4 ; -0.29492e-4 ;
+ 0.15625e-4 ; -0.80141e-5
+
+
+
+
+ 1000812050
+
+ 12.0
+ 2.24
+
+
+ 0.51518e-1 ; 0.51165e-1 ; -0.39559e-1 ; -0.30118e-1 ; 0.27600e-1 ;
+ 0.10412e-1 ; -0.15725e-1 ; -0.26546e-2 ; 0.70184e-2 ; 0.82116e-3 ;
+ -0.51805e-3 ; 0.32560e-3 ; -0.18670e-3 ; 0.10202e-3 ; -0.53857e-4 ;
+ 0.27672e-4 ; -0.13873e-4
+
+
+
+
+ 1000822040
+
+ 12.0
+ 2.24
+
+
+ 0.52102e-1 ; 0.51786e-1 ; -0.39188e-1 ; -0.29242e-1 ; 0.28992e-1 ;
+ 0.11040e-1 ; -0.14591e-1 ; -0.94917e-3 ; 0.71349e-2 ; 0.24780e-3 ;
+ -0.61656e-3 ; 0.42335e-3 ; -0.25250e-3 ; 0.14106e-3 ; -0.75446e-4 ;
+ 0.39143e-4 ; -0.19760e-4
+
+
+
+
+ 1000822060
+
+ 12.0
+ 2.24
+
+
+ 0.52019e-1 ; 0.51190e-1 ; -0.39459e-1 ; -0.28405e-1 ; 0.28862e-1 ;
+ 0.10685e-1 ; -0.14550e-1 ; -0.13519e-2 ; 0.77624e-2 ; -0.41882e-4 ;
+ -0.97010e-3 ; 0.69611e-3 ; -0.42410e-3 ; 0.23857e-3 ; -0.12828e-3 ;
+ 0.66663e-4 ; -0.33718e-4
+
+
+
+
+ 1000822070
+
+ 12.0
+ 2.24
+
+
+ 0.51981e-1 ; 0.51059e-1 ; -0.39447e-1 ; -0.28428e-1 ; 0.28988e-1 ;
+ 0.10329e-1 ; -0.14029e-1 ; -0.46728e-3 ; 0.67984e-2 ; 0.56905e-3 ;
+ -0.50430e-3 ; 0.32796e-3 ; -0.19157e-3 ; 0.10565e-3 ; -0.56200e-4 ;
+ 0.29020e-4 ; -0.14621e-4
+
+
+
+
+ 1000822080
+
+ 11.0
+ 2.24
+
+
+ 0.62732e-1 ; 0.38542e-1 ; -0.55105e-1 ; -0.26990e-2 ; 0.31016e-1 ;
+ -0.99486e-2 ; -0.93012e-2 ; 0.76653e-2 ; 0.20885e-2 ; -0.17840e-2 ;
+ 0.74876e-4 ; 0.32278e-3 ; -0.11353e-3
+
+
+
+
+ 1000832090
+
+ 12.0
+ 2.24
+
+
+ 0.52448e-1 ; 0.50400e-1 ; -0.41014e-1 ; -0.27927e-2 ; 0.29587e-1 ;
+ 0.98017e-2 ; -0.14930e-1 ; -0.31967e-3 ; 0.77252e-2 ; 0.57533e-3 ;
+ -0.82529e-3 ; 0.25728e-3 ; -0.11043e-3 ; 0.51930e-4 ; -0.24767e-4 ;
+ 0.11863e-4 ; -0.56554e-5
+
+
+
+
diff --git a/config/DeVriesFormFactorMap.xml b/config/DeVriesFormFactorMap.xml
new file mode 100644
index 000000000..d853c0b9f
--- /dev/null
+++ b/config/DeVriesFormFactorMap.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+ genie::DeVriesFormFactor/12C ;
+ genie::DeVriesFormFactor/15N ;
+ genie::DeVriesFormFactor/16O ;
+ genie::DeVriesFormFactor/27Al ;
+ genie::DeVriesFormFactor/28Si ;
+ genie::DeVriesFormFactor/29Si ;
+ genie::DeVriesFormFactor/30Si ;
+ genie::DeVriesFormFactor/31P ;
+ genie::DeVriesFormFactor/32S ;
+ genie::DeVriesFormFactor/34S ;
+ genie::DeVriesFormFactor/36S ;
+ genie::DeVriesFormFactor/40Ar ;
+ genie::DeVriesFormFactor/40Ca ;
+ genie::DeVriesFormFactor/48Ca ;
+ genie::DeVriesFormFactor/48Ti ;
+ genie::DeVriesFormFactor/50Ti ;
+ genie::DeVriesFormFactor/50Cr ;
+ genie::DeVriesFormFactor/52Cr ;
+ genie::DeVriesFormFactor/54Cr ;
+ genie::DeVriesFormFactor/54Fe ;
+ genie::DeVriesFormFactor/56Fe ;
+ genie::DeVriesFormFactor/58Fe ;
+ genie::DeVriesFormFactor/59Co ;
+ genie::DeVriesFormFactor/58Ni ;
+ genie::DeVriesFormFactor/60Ni ;
+ genie::DeVriesFormFactor/62Ni ;
+ genie::DeVriesFormFactor/64Ni ;
+ genie::DeVriesFormFactor/63Cu ;
+ genie::DeVriesFormFactor/65Cu ;
+ genie::DeVriesFormFactor/64Zn ;
+ genie::DeVriesFormFactor/66Zn ;
+ genie::DeVriesFormFactor/68Zn ;
+ genie::DeVriesFormFactor/70Zn ;
+ genie::DeVriesFormFactor/70Ge ;
+ genie::DeVriesFormFactor/72Ge ;
+ genie::DeVriesFormFactor/74Ge ;
+ genie::DeVriesFormFactor/76Ge ;
+ genie::DeVriesFormFactor/88Sr ;
+ genie::DeVriesFormFactor/90Zr ;
+ genie::DeVriesFormFactor/92Zr ;
+ genie::DeVriesFormFactor/94Zr ;
+ genie::DeVriesFormFactor/92Mo ;
+ genie::DeVriesFormFactor/94Mo ;
+ genie::DeVriesFormFactor/96Mo ;
+ genie::DeVriesFormFactor/98Mo ;
+ genie::DeVriesFormFactor/100Mo ;
+ genie::DeVriesFormFactor/104Pd ;
+ genie::DeVriesFormFactor/106Pd ;
+ genie::DeVriesFormFactor/108Pd ;
+ genie::DeVriesFormFactor/110Pd ;
+ genie::DeVriesFormFactor/144Sm ;
+ genie::DeVriesFormFactor/148Sm ;
+ genie::DeVriesFormFactor/150Sm ;
+ genie::DeVriesFormFactor/152Sm ;
+ genie::DeVriesFormFactor/154Sm ;
+ genie::DeVriesFormFactor/154Gd ;
+ genie::DeVriesFormFactor/158Gd ;
+ genie::DeVriesFormFactor/166Er ;
+ genie::DeVriesFormFactor/174Yb ;
+ genie::DeVriesFormFactor/175Lu ;
+ genie::DeVriesFormFactor/192Os ;
+ genie::DeVriesFormFactor/196Pt ;
+ genie::DeVriesFormFactor/203Tl ;
+ genie::DeVriesFormFactor/205Tl ;
+ genie::DeVriesFormFactor/204Pb ;
+ genie::DeVriesFormFactor/206Pb ;
+ genie::DeVriesFormFactor/207Pb ;
+ genie::DeVriesFormFactor/208Pb ;
+ genie::DeVriesFormFactor/209Bi
+
+
+
+
+
diff --git a/config/DeltaInMediumCorrections.xml b/config/DeltaInMediumCorrections.xml
new file mode 100644
index 000000000..77d5d7708
--- /dev/null
+++ b/config/DeltaInMediumCorrections.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ NUCL
+
+ 0.08
+ 0.17
+ 2.14
+
+
+
+
+
+
+ FermiGas,NUCL
+
+
+
+
+
+
diff --git a/config/DeltaTransitionFormFactor.xml b/config/DeltaTransitionFormFactor.xml
new file mode 100644
index 000000000..e99479729
--- /dev/null
+++ b/config/DeltaTransitionFormFactor.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+ WeakInt,Resonances
+
+ 0.93
+ 0.3
+ 0.01
+ 0.23
+ 0.71
+
+
+
+
+
+
diff --git a/config/EventGenerator.xml b/config/EventGenerator.xml
index d1a418a16..e63a6d78b 100644
--- a/config/EventGenerator.xml
+++ b/config/EventGenerator.xml
@@ -555,19 +555,30 @@ XSecModel alg Yes Cross section model used at the thread
6
genie::InitialStateAppender/Default
genie::VertexGenerator/Default
- genie::COHKinematicsGenerator/Default
+ genie::COHPionKinematicsGenerator/Default
genie::COHPrimaryLeptonGenerator/Default
genie::COHHadronicSystemGenerator/Default
genie::UnstableParticleDecayer/AfterHadronTransport
genie::COHInteractionListGenerator/NC-PION
+
+
+ 5
+ genie::InitialStateAppender/Default
+ genie::VertexGenerator/Default
+ genie::COHGammaKinematicsGenerator/Default
+ genie::COHPrimaryLeptonGenerator/Default
+ genie::COHHadronicSystemGenerator/Default
+ genie::COHInteractionListGenerator/NC-GAMMA
+
+
6
genie::InitialStateAppender/Default
genie::VertexGenerator/Default
- genie::COHKinematicsGenerator/Default
+ genie::COHPionKinematicsGenerator/Default
genie::COHPrimaryLeptonGenerator/Default
genie::COHHadronicSystemGenerator/Default
genie::UnstableParticleDecayer/AfterHadronTransport
diff --git a/config/EventGeneratorListAssembler.xml b/config/EventGeneratorListAssembler.xml
index 30a19530f..cb219cc34 100644
--- a/config/EventGeneratorListAssembler.xml
+++ b/config/EventGeneratorListAssembler.xml
@@ -185,14 +185,35 @@ Generator-%d alg No
genie::EventGenerator/RES-NC
+
+
+
+
+ 3
+ genie::EventGenerator/COH-CC-PION
+ genie::EventGenerator/COH-NC-PION
+ genie::EventGenerator/COH-NC-GAMMA
+
+
+
+ 1
+ genie::EventGenerator/COH-CC-PION
+
+
+
+ 2
+ genie::EventGenerator/COH-NC-PION
+ genie::EventGenerator/COH-NC-GAMMA
+
+
- 2
+ 2
genie::EventGenerator/COH-CC-PION
genie::EventGenerator/COH-NC-PION
- 1
+ 1
genie::EventGenerator/COH-CC-PION
@@ -201,6 +222,12 @@ Generator-%d alg No
genie::EventGenerator/COH-NC-PION
+
+ 1
+ genie::EventGenerator/COH-NC-GAMMA
+
+
+
2
genie::EventGenerator/DIS-CC
@@ -218,13 +245,14 @@ Generator-%d alg No
- 6
+ 7
genie::EventGenerator/QEL-NC
genie::EventGenerator/RES-NC
genie::EventGenerator/DIS-NC
- genie::EventGenerator/COH-NC-PION
- genie::EventGenerator/MEC-NC
- genie::EventGenerator/DFR-NC
+ genie::EventGenerator/COH-NC-PION
+ genie::EventGenerator/COH-NC-GAMMA
+ genie::EventGenerator/MEC-NC
+ genie::EventGenerator/DFR-NC
diff --git a/config/G18_02a/ModelConfiguration.xml b/config/G18_02a/ModelConfiguration.xml
index c77a4c844..d0ba19232 100644
--- a/config/G18_02a/ModelConfiguration.xml
+++ b/config/G18_02a/ModelConfiguration.xml
@@ -111,13 +111,13 @@ STFC, Rutherford Appleton Laboratory
genie::BergerSehgalCOHPiPXSec2015/Default
genie::BergerSehgalCOHPiPXSec2015/Default
+
-
-
-
+
+
genie::BardinIMDRadCorPXSec/Default
genie::IMDAnnihilationPXSec/Default
genie::NuElectronPXSec/Default
diff --git a/config/G18_02a/TuneGeneratorList.xml b/config/G18_02a/TuneGeneratorList.xml
index 938e22406..57b3599fa 100644
--- a/config/G18_02a/TuneGeneratorList.xml
+++ b/config/G18_02a/TuneGeneratorList.xml
@@ -54,8 +54,8 @@ Generator-%d alg No
genie::EventGenerator/RES-NC
genie::EventGenerator/DIS-CC
genie::EventGenerator/DIS-NC
- genie::EventGenerator/COH-CC-PION
- genie::EventGenerator/COH-NC-PION
+ genie::EventGenerator/COH-CC-PION
+ genie::EventGenerator/COH-NC-PION
genie::EventGenerator/DIS-CC-CHARM
genie::EventGenerator/QEL-CC-CHARM
genie::EventGenerator/NUE-EL
diff --git a/config/Messenger.xml b/config/Messenger.xml
index 52b6ff705..9a5d31caf 100644
--- a/config/Messenger.xml
+++ b/config/Messenger.xml
@@ -59,7 +59,7 @@
NOTICE
NOTICE
NOTICE
- NOTICE
+ INFO
NOTICE
WARN
WARN
@@ -204,7 +204,7 @@
WARN
NOTICE
NOTICE
- WARN
+ NOTICE
NOTICE
WARN
WARN
diff --git a/config/master_config.xml b/config/master_config.xml
index 4ff4ad940..2263ca3fa 100644
--- a/config/master_config.xml
+++ b/config/master_config.xml
@@ -2,6 +2,105 @@
+
+ EventGenerator.xml
+ FermiMover.xml
+ HadronTransporter.xml
+ HAIntranuke.xml
+ HAIntranuke2018.xml
+ HNIntranuke2018.xml
+ HINCLCascadeIntranuke.xml
+ HG4BertCascIntranuke.xml
+ CascadeReweight.xml
+ UnstableParticleDecayer.xml
+ PauliBlocker.xml
+ NucDeExcitationSim.xml
+ NucBindEnergyAggregator.xml
+ InitialStateAppender.xml
+ VertexGenerator.xml
+ QELEventGenerator.xml
+ QELEventGeneratorSM.xml
+ DMELEventGenerator.xml
+ IBDPrimaryLeptonGenerator.xml
+ QELPrimaryLeptonGenerator.xml
+ DISPrimaryLeptonGenerator.xml
+ RESPrimaryLeptonGenerator.xml
+ NuEPrimaryLeptonGenerator.xml
+ DMEOutgoingDarkGenerator.xml
+ COHPrimaryLeptonGenerator.xml
+ DFRPrimaryLeptonGenerator.xml
+ SKPrimaryLeptonGenerator.xml
+ DMELOutgoingDarkGenerator.xml
+ DMDISOutgoingDarkGenerator.xml
+ IBDKinematicsGenerator.xml
+ QELKinematicsGenerator.xml
+ DISKinematicsGenerator.xml
+ RESKinematicsGenerator.xml
+ NuEKinematicsGenerator.xml
+ DMEKinematicsGenerator.xml
+ COHPionKinematicsGenerator.xml
+ COHGammaKinematicsGenerator.xml
+ DFRKinematicsGenerator.xml
+ SKKinematicsGenerator.xml
+ DMELKinematicsGenerator.xml
+ DMDISKinematicsGenerator.xml
+ HELeptonKinematicsGenerator.xml
+ HEDISKinematicsGenerator.xml
+ IBDHadronicSystemGenerator.xml
+ QELHadronicSystemGenerator.xml
+ COHHadronicSystemGenerator.xml
+ DFRHadronicSystemGenerator.xml
+ DISHadronicSystemGenerator.xml
+ RESHadronicSystemGenerator.xml
+ RSPPHadronicSystemGenerator.xml
+ SKHadronicSystemGenerator.xml
+ NuETargetRemnantGenerator.xml
+ DMETargetRemnantGenerator.xml
+ RSPPResonanceSelector.xml
+ AMNuGammaGenerator.xml
+ MECGenerator.xml
+ GLRESGenerator.xml
+ HEDISGenerator.xml
+ HENuElGenerator.xml
+ PhotonCOHGenerator.xml
+ PhotonRESGenerator.xml
+ CEvNSEventGenerator.xml
+ COHDNuEventGenerator.xml
+ QELEventGeneratorSuSA.xml
+ NucleonDecayPrimaryVtxGenerator.xml
+ NNBarOscPrimaryVtxGenerator.xml
+ SpectralFunction2p2h.xml
+ SRCNuclearRecoil.xml
+ BeamHNLGenerator.xml
+ BeamHNLGenerator.xml
+ BeamHNLGenerator.xml
+ BeamHNLGenerator.xml
+
+
+ QELInteractionListGenerator.xml
+ RSPPInteractionListGenerator.xml
+ RESInteractionListGenerator.xml
+ DISInteractionListGenerator.xml
+ NuEInteractionListGenerator.xml
+ DMEInteractionListGenerator.xml
+ COHInteractionListGenerator.xml
+ AMNuGammaInteractionListGenerator.xml
+ MECInteractionListGenerator.xml
+ HELeptonInteractionListGenerator.xml
+ DFRInteractionListGenerator.xml
+ SKInteractionListGenerator.xml
+ DMELInteractionListGenerator.xml
+ DMDISInteractionListGenerator.xml
+ IBDInteractionListGenerator.xml
+ CEvNSInteractionListGenerator.xml
+ COHDNuInteractionListGenerator.xml
+ HEDISInteractionListGenerator.xml
+ Default.xml
+ Default.xml
+ Default.xml
+ InteractionListAssembler.xml
+ EventGeneratorListAssembler.xml
+=======
EventGenerator.xml
FermiMover.xml
@@ -100,168 +199,176 @@
InteractionListAssembler.xml
EventGeneratorListAssembler.xml
-
- PhysInteractionSelector.xml
- ToyInteractionSelector.xml
+
+ PhysInteractionSelector.xml
+ ToyInteractionSelector.xml
-
- PetersonFragm.xml
- CollinsSpillerFragm.xml
+
+ PetersonFragm.xml
+ CollinsSpillerFragm.xml
-
- AGKYLowW2019.xml
- AGKY2019.xml
- Pythia6Hadro2019.xml
- Pythia8Hadro2019.xml
- AGCharm2019.xml
- LeptoHadronization.xml
+
+ AGKYLowW2019.xml
+ AGKY2019.xml
+ Pythia6Hadro2019.xml
+ Pythia8Hadro2019.xml
+ AGCharm2019.xml
+ LeptoHadronization.xml
-
- GRV98LO.xml
- LHAPDF6.xml
- LHAPDF5.xml
- BYPDF.xml
+
+ GRV98LO.xml
+ LHAPDF6.xml
+ LHAPDF5.xml
+ BYPDF.xml
-
- PythiaDecayer.xml
- BaryonResonanceDecayer.xml
- DarkSectorDecayer.xml
+
+ PythiaDecayer.xml
+ BaryonResonanceDecayer.xml
+ DarkSectorDecayer.xml
-
- DipoleELFormFactorsModel.xml
- BBA03ELFormFactorsModel.xml
- BBA05ELFormFactorsModel.xml
- BBA07ELFormFactorsModel.xml
- DipoleAxialFormFactorModel.xml
- ZExpAxialFormFactorModel.xml
- KuzminNaumov2016AxialFormFactorModel.xml
- LwlynSmithFFCC.xml
- LwlynSmithFFDeltaS.xml
- TransverseEnhancementFFModel.xml
- LwlynSmithFFNC.xml
- QPMDISStrucFunc.xml
- BYStrucFunc.xml
- RSHelicityAmplModelCC.xml
- RSHelicityAmplModelNCp.xml
- RSHelicityAmplModelNCn.xml
- RSHelicityAmplModelEMp.xml
- RSHelicityAmplModelEMn.xml
- EngelFormFactor.xml
+
+ DipoleELFormFactorsModel.xml
+ BBA03ELFormFactorsModel.xml
+ BBA05ELFormFactorsModel.xml
+ BBA07ELFormFactorsModel.xml
+ DipoleAxialFormFactorModel.xml
+ ZExpAxialFormFactorModel.xml
+ KuzminNaumov2016AxialFormFactorModel.xml
+ LwlynSmithFFCC.xml
+ LwlynSmithFFDeltaS.xml
+ TransverseEnhancementFFModel.xml
+ LwlynSmithFFNC.xml
+ QPMDISStrucFunc.xml
+ BYStrucFunc.xml
+ RSHelicityAmplModelCC.xml
+ RSHelicityAmplModelNCp.xml
+ RSHelicityAmplModelNCn.xml
+ RSHelicityAmplModelEMp.xml
+ RSHelicityAmplModelEMn.xml
+ DeVriesFormFactor.xml
+ DeVriesFormFactorMap.xml
+ COHProtonFormFactorInterpolation.xml
+ COHDeltaCurrent.xml
+ DeltaInMediumCorrections.xml
+ DeltaTransitionFormFactor.xml
+ DeltaInMediumCorrections.xml
+ EngelFormFactor.xml
+
+ QELXSec.xml
+ NewQELXSec.xml
+ SmithMonizQELCCXSec.xml
+ DISXSec.xml
+ COHDNuXSec.xml
+ COHXSec.xml
+ COHXSecAR.xml
+ CEvNSXSec.xml
+ DFRXSec.xml
+ AlamSimoAtharVacasSKXSec.xml
+ IMDXSec.xml
+ RESXSec.xml
+ MECXSec.xml
+ NuElectronXSec.xml
+ DMElectronXSec.xml
+ DMELXSec.xml
+ DMDISXSec.xml
+ HELeptonXSec.xml
+ HEDISXSec.xml
+ COHGammaIntegrationLimits.xml
+ BostedChristyEMPXSec.xml
-
- QELXSec.xml
- NewQELXSec.xml
- SmithMonizQELCCXSec.xml
- DISXSec.xml
- COHDNuXSec.xml
- COHXSec.xml
- COHXSecAR.xml
- CEvNSXSec.xml
- DFRXSec.xml
- AlamSimoAtharVacasSKXSec.xml
- IMDXSec.xml
- RESXSec.xml
- MECXSec.xml
- NuElectronXSec.xml
- DMElectronXSec.xml
- DMELXSec.xml
- DMDISXSec.xml
- HELeptonXSec.xml
- HEDISXSec.xml
- BostedChristyEMPXSec.xml
+
+ AhrensNCELPXSec.xml
+ AhrensDMELPXSec.xml
+ AlvarezRusoCOHPiPXSec.xml
+ AlvarezRusoSalaCOHGammaPXSec.xml
+ BergerSehgalCOHPiPXSec2015.xml
+ BergerSehgalFMCOHPiPXSec2015.xml
+ BertuzzoDNuCOHPXSec.xml
+ LwlynSmithQELCCPXSec.xml
+ NievesQELCCPXSec.xml
+ SuSAv2QELPXSec.xml
+ SmithMonizQELCCPXSec.xml
+ QPMDMDISPXSec.xml
+ QPMDISPXSec.xml
+ KNOTunedQPMDISPXSec.xml
+ AivazisCharmPXSecLO.xml
+ SlowRsclCharmDISPXSecLO.xml
+ KovalenkoQELCharmPXSec.xml
+ PaisQELLambdaPXSec.xml
+ AlamSimoAtharVacasSKPXSec2014.xml
+ P33PaschosLalakulichPXSec.xml
+ BardinIMDRadCorPXSec.xml
+ IMDAnnihilationPXSec.xml
+ IBDXSecMap.xml
+ StrumiaVissaniIBDPXSec.xml
+ KLVOxygenIBDPXSec.xml
+ PattonCEvNSPXSec.xml
+ NuElectronPXSec.xml
+ DMElectronPXSec.xml
+ GLRESPXSec.xml
+ HENuElPXSec.xml
+ PhotonCOHPXSec.xml
+ PhotonRESPXSec.xml
+ BergerSehgalRESPXSec2014.xml
+ KuzminLyubushkinNaumovRESPXSec2014.xml
+ ReinDFRPXSec.xml
+ ReinSehgalCOHPiPXSec.xml
+ ReinSehgalRESPXSec.xml
+ ReinSehgalSPPPXSec.xml
+ ReinSehgalRESXSec.xml
+ ReinSehgalSPPXSec.xml
+ H3AMNuGammaPXSec.xml
+ EmpiricalMECPXSec2015.xml
+ NievesSimoVacasMECPXSec2016.xml
+ SuSAv2MECPXSec.xml
+ RosenbluthPXSec.xml
+ Default.xml
+ Default.xml
+ Default.xml
+ ReinSehgalRESXSecFast.xml
+ BertuzzoDNuCOHPXSec.xml
+ HybridXSecAlgorithm.xml
+ HEDISPXSec.xml
+ XSecScaleMap.xml
+ MECScaleVsW.xml
+ XSecLinearCombinations.xml
+ QvalueShifter.xml
-
- AhrensNCELPXSec.xml
- AhrensDMELPXSec.xml
- AlvarezRusoCOHPiPXSec.xml
- BergerSehgalCOHPiPXSec2015.xml
- BergerSehgalFMCOHPiPXSec2015.xml
- BertuzzoDNuCOHPXSec.xml
- LwlynSmithQELCCPXSec.xml
- NievesQELCCPXSec.xml
- SuSAv2QELPXSec.xml
- SmithMonizQELCCPXSec.xml
- QPMDMDISPXSec.xml
- QPMDISPXSec.xml
- KNOTunedQPMDISPXSec.xml
- AivazisCharmPXSecLO.xml
- SlowRsclCharmDISPXSecLO.xml
- KovalenkoQELCharmPXSec.xml
- PaisQELLambdaPXSec.xml
- AlamSimoAtharVacasSKPXSec2014.xml
- P33PaschosLalakulichPXSec.xml
- BardinIMDRadCorPXSec.xml
- IMDAnnihilationPXSec.xml
- IBDXSecMap.xml
- StrumiaVissaniIBDPXSec.xml
- KLVOxygenIBDPXSec.xml
- PattonCEvNSPXSec.xml
- NuElectronPXSec.xml
- DMElectronPXSec.xml
- GLRESPXSec.xml
- HENuElPXSec.xml
- PhotonCOHPXSec.xml
- PhotonRESPXSec.xml
- BergerSehgalRESPXSec2014.xml
- KuzminLyubushkinNaumovRESPXSec2014.xml
- ReinDFRPXSec.xml
- ReinSehgalCOHPiPXSec.xml
- ReinSehgalRESPXSec.xml
- ReinSehgalSPPPXSec.xml
- ReinSehgalRESXSec.xml
- ReinSehgalSPPXSec.xml
- H3AMNuGammaPXSec.xml
- EmpiricalMECPXSec2015.xml
- NievesSimoVacasMECPXSec2016.xml
- SuSAv2MECPXSec.xml
- RosenbluthPXSec.xml
- Default.xml
- Default.xml
- Default.xml
- ReinSehgalRESXSecFast.xml
- BertuzzoDNuCOHPXSec.xml
- HybridXSecAlgorithm.xml
- HEDISPXSec.xml
- XSecScaleMap.xml
- MECScaleVsW.xml
- XSecLinearCombinations.xml
- QvalueShifter.xml
+
+ NuclearModelMap.xml
+ FGMBodekRitchie.xml
+ LocalFGM.xml
+ EffectiveSF.xml
+ SpectralFunc1d.xml
+ SpectralFunc.xml
+ SmithMonizUtils.xml
-
- NuclearModelMap.xml
- FGMBodekRitchie.xml
- LocalFGM.xml
- EffectiveSF.xml
- SpectralFunc1d.xml
- SpectralFunc.xml
- SmithMonizUtils.xml
+
+ BetheBlochModel.xml
+ BezrukovBugaevModel.xml
+ KokoulinPetrukhinModel.xml
+ PetrukhinShestakovModel.xml
-
- BetheBlochModel.xml
- BezrukovBugaevModel.xml
- KokoulinPetrukhinModel.xml
- PetrukhinShestakovModel.xml
-
-
- IBDHadronicSystemGenerator.xml
- IBDKinematicsGenerator.xml
- IBDPrimaryLeptonGenerator.xml
- IBDXSecMap.xml
- IBDInteractionListGenerator.xml
- StrumiaVissaniIBDPXSec.xml
- KLVOxygenIBDPXSec.xml
+
+ IBDHadronicSystemGenerator.xml
+ IBDKinematicsGenerator.xml
+ IBDPrimaryLeptonGenerator.xml
+ IBDXSecMap.xml
+ IBDInteractionListGenerator.xml
+ StrumiaVissaniIBDPXSec.xml
+ KLVOxygenIBDPXSec.xml
-
- NievesMECHadronTensorModel.xml
- SuSAv2QELHadronTensorModel.xml
- SuSAv2MECHadronTensorModel.xml
+
+ NievesMECHadronTensorModel.xml
+ SuSAv2QELHadronTensorModel.xml
+ SuSAv2MECHadronTensorModel.xml
-
- GSystUncertaintyTable.xml
+
+ GSystUncertaintyTable.xml
-
- EventLibraryInterface.xml
- EvtLibInteractionListGenerator.xml
- EvtLibPXSec.xml
+
+ EventLibraryInterface.xml
+ EvtLibInteractionListGenerator.xml
+ EvtLibPXSec.xml
diff --git a/src/Apps/gSplineXml2Root.cxx b/src/Apps/gSplineXml2Root.cxx
index 29249200c..cd84b088a 100644
--- a/src/Apps/gSplineXml2Root.cxx
+++ b/src/Apps/gSplineXml2Root.cxx
@@ -22,11 +22,8 @@
-t
the target pdg code (format: 10LZZZAAAI)
-e
- the minimum and maximum energy (in generated plots -- use it to zoom at low E)
- -o
- output ROOT file name
- -w
- write out plots in a postscipt file
+ the minimum and maximum energy (in generated plots -- use it to
+zoom at low E) -o output ROOT file name -w write out plots in a postscipt file
-l
energy bins in log10 scale
-k
@@ -54,12 +51,11 @@
Important Note:
The stored graphs can be used for cross section interpolation.
- Essentially, this _single_ ROOT file can contain _all_ the GENIE cross
- section `functions' you may need.
- For instance, the `xsec.root' file generated in the above example will
- contain a `nu_mu_O16' directory (generated by the last command)
- which will include cross section graphs for all numu + O16 processes.
- To extract the numu+O16 DIS CC cross section graph for hit u valence
+ Essentially, this _single_ ROOT file can contain _all_ the GENIE
+cross section `functions' you may need. For instance, the `xsec.root' file
+generated in the above example will contain a `nu_mu_O16' directory (generated
+by the last command) which will include cross section graphs for all numu + O16
+processes. To extract the numu+O16 DIS CC cross section graph for hit u valence
quarks in a bound proton and evaluate the cross section at energy E,
then type:
@@ -80,86 +76,85 @@
//____________________________________________________________________________
#include
-#include
#include
+#include
#include
-#include
-#include
-#include
-#include
-#include
#include
-#include
+#include
+#include
#include
+#include
+#include
#include
+#include
#include
-#include
+#include
+#include
-#include "Framework/ParticleData/BaryonResonance.h"
-#include "Framework/ParticleData/BaryonResUtils.h"
-#include "Framework/Conventions/XmlParserStatus.h"
-#include "Framework/Conventions/Units.h"
+#include "Framework/Algorithm/AlgConfigPool.h"
#include "Framework/Conventions/Controls.h"
-#include "Framework/EventGen/InteractionList.h"
+#include "Framework/Conventions/Units.h"
+#include "Framework/Conventions/XmlParserStatus.h"
#include "Framework/EventGen/GEVGDriver.h"
+#include "Framework/EventGen/InteractionList.h"
#include "Framework/Interaction/Interaction.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/Numerical/Spline.h"
-#include "Framework/ParticleData/PDGCodes.h"
+#include "Framework/ParticleData/BaryonResUtils.h"
+#include "Framework/ParticleData/BaryonResonance.h"
#include "Framework/ParticleData/PDGCodeList.h"
-#include "Framework/ParticleData/PDGUtils.h"
+#include "Framework/ParticleData/PDGCodes.h"
#include "Framework/ParticleData/PDGLibrary.h"
+#include "Framework/ParticleData/PDGUtils.h"
+#include "Framework/Registry/Registry.h"
#include "Framework/Utils/AppInit.h"
+#include "Framework/Utils/CmdLnArgParser.h"
#include "Framework/Utils/RunOpt.h"
-#include "Framework/Utils/XSecSplineList.h"
#include "Framework/Utils/StringUtils.h"
-#include "Framework/Utils/CmdLnArgParser.h"
-#include "Framework/Registry/Registry.h"
-#include "Framework/Algorithm/AlgConfigPool.h"
-
+#include "Framework/Utils/XSecSplineList.h"
+using std::ostringstream;
using std::string;
using std::vector;
-using std::ostringstream;
using namespace genie;
using namespace genie::utils;
-//Prototypes:
-void LoadSplines (void);
-GEVGDriver GetEventGenDriver (void);
-void SaveToPsFile (void);
-void SaveGraphsToRootFile (void);
-void SaveNtupleToRootFile (void);
-void GetCommandLineArgs (int argc, char ** argv);
-void PrintSyntax (void);
+// Prototypes:
+void LoadSplines(void);
+GEVGDriver GetEventGenDriver(void);
+void SaveToPsFile(void);
+void SaveGraphsToRootFile(void);
+void SaveNtupleToRootFile(void);
+void GetCommandLineArgs(int argc, char **argv);
+void PrintSyntax(void);
PDGCodeList GetPDGCodeListFromString(std::string s);
-//User-specified options:
-string gOptXMLFilename; // input XML filename
-string gOptROOTFilename; // output ROOT filename
-PDGCodeList gOptProbePdgList; // list of probe PDG codes
-PDGCodeList gOptTgtPdgList; // list of target PDG codes
-int gOptProbePdgCode; // probe PDG code (currently being processed)
-int gOptTgtPdgCode; // target PDG code
-bool gWriteOutPlots; // write out a postscript file with plots
-//bool gKeepSplineKnots; // use spline abscissa points rather than equi-spaced
-
-//Globals & constants
+// User-specified options:
+string gOptXMLFilename; // input XML filename
+string gOptROOTFilename; // output ROOT filename
+PDGCodeList gOptProbePdgList; // list of probe PDG codes
+PDGCodeList gOptTgtPdgList; // list of target PDG codes
+int gOptProbePdgCode; // probe PDG code (currently being processed)
+int gOptTgtPdgCode; // target PDG code
+bool gWriteOutPlots; // write out a postscript file with plots
+// bool gKeepSplineKnots; // use spline abscissa points rather than
+// equi-spaced
+
+// Globals & constants
double gEmin;
double gEmax;
bool gInlogE;
-int kNP = 300;
-int kNSplineP = 1000;
-const int kPsType = 111; // ps type: portrait
+int kNP = 300;
+int kNSplineP = 1000;
+const int kPsType = 111; // ps type: portrait
//____________________________________________________________________________
-int main(int argc, char ** argv)
-{
- GetCommandLineArgs(argc,argv);
+int main(int argc, char **argv) {
+ GetCommandLineArgs(argc, argv);
- if ( ! RunOpt::Instance()->Tune() ) {
+ if (!RunOpt::Instance()->Tune()) {
LOG("gslp2root", pFATAL) << " No TuneId in RunOption";
exit(-1);
}
@@ -170,14 +165,16 @@ int main(int argc, char ** argv)
// load the x-section splines xml file specified by the user
LoadSplines();
- if ( ! XSecSplineList::Instance() -> HasSplineFromTune(RunOpt::Instance() -> Tune() -> Name() ) ) {
- LOG("gspl2root", pWARN) << "No splines loaded for tune " << RunOpt::Instance() -> Tune() -> Name() ;
+ if (!XSecSplineList::Instance()->HasSplineFromTune(
+ RunOpt::Instance()->Tune()->Name())) {
+ LOG("gspl2root", pWARN)
+ << "No splines loaded for tune " << RunOpt::Instance()->Tune()->Name();
}
- for (unsigned int indx_p = 0; indx_p < gOptProbePdgList.size(); ++indx_p ) {
- for (unsigned int indx_t = 0; indx_t < gOptTgtPdgList.size(); ++indx_t ) {
+ for (unsigned int indx_p = 0; indx_p < gOptProbePdgList.size(); ++indx_p) {
+ for (unsigned int indx_t = 0; indx_t < gOptTgtPdgList.size(); ++indx_t) {
gOptProbePdgCode = gOptProbePdgList[indx_p];
- gOptTgtPdgCode = gOptTgtPdgList[indx_t];
+ gOptTgtPdgCode = gOptTgtPdgList[indx_t];
// save the cross section plots in a postscript file
SaveToPsFile();
// save the cross section graphs at a root file
@@ -188,20 +185,18 @@ int main(int argc, char ** argv)
return 0;
}
//____________________________________________________________________________
-void LoadSplines(void)
-{
-// load the cross section splines specified at the cmd line
+void LoadSplines(void) {
+ // load the cross section splines specified at the cmd line
- XSecSplineList * splist = XSecSplineList::Instance();
+ XSecSplineList *splist = XSecSplineList::Instance();
XmlParserStatus_t ist = splist->LoadFromXml(gOptXMLFilename);
assert(ist == kXmlOK);
}
//____________________________________________________________________________
-GEVGDriver GetEventGenDriver(void)
-{
-// create an event genartion driver configured for the specified initial state
-// (so that cross section splines will be accessed through that driver as in
-// event generation mode)
+GEVGDriver GetEventGenDriver(void) {
+ // create an event genartion driver configured for the specified initial state
+ // (so that cross section splines will be accessed through that driver as in
+ // event generation mode)
InitialState init_state(gOptTgtPdgCode, gOptProbePdgCode);
@@ -209,77 +204,75 @@ GEVGDriver GetEventGenDriver(void)
evg_driver.SetEventGeneratorList(RunOpt::Instance()->EventGeneratorList());
evg_driver.Configure(init_state);
evg_driver.CreateSplines();
- evg_driver.CreateXSecSumSpline (100, gEmin, gEmax);
+ evg_driver.CreateXSecSumSpline(100, gEmin, gEmax);
return evg_driver;
}
//____________________________________________________________________________
-void SaveToPsFile(void)
-{
- if(!gWriteOutPlots) return;
+void SaveToPsFile(void) {
+ if (!gWriteOutPlots)
+ return;
//-- get the event generation driver
GEVGDriver evg_driver = GetEventGenDriver();
//-- define some marker styles / colors
const unsigned int kNMarkers = 5;
- const unsigned int kNColors = 6;
+ const unsigned int kNColors = 6;
unsigned int markers[kNMarkers] = {20, 28, 29, 27, 3};
- unsigned int colors [kNColors] = {1, 2, 4, 6, 8, 28};
+ unsigned int colors[kNColors] = {1, 2, 4, 6, 8, 28};
//-- create a postscript document for saving cross section plpots
- TCanvas * c = new TCanvas("c","",20,20,500,850);
+ TCanvas *c = new TCanvas("c", "", 20, 20, 500, 850);
c->SetBorderMode(0);
c->SetFillColor(0);
- TLegend * legend = new TLegend(0.01,0.01,0.99,0.99);
+ TLegend *legend = new TLegend(0.01, 0.01, 0.99, 0.99);
legend->SetFillColor(0);
legend->SetBorderSize(0);
//-- get pdglibrary for mapping pdg codes to names
- PDGLibrary * pdglib = PDGLibrary::Instance();
+ PDGLibrary *pdglib = PDGLibrary::Instance();
ostringstream filename;
- filename << "xsec-splines-"
- << pdglib->Find(gOptProbePdgCode)->GetName() << "-"
- << pdglib->Find(gOptTgtPdgCode)->GetName() << ".ps";
- TPostScript * ps = new TPostScript(filename.str().c_str(), kPsType);
+ filename << "xsec-splines-" << pdglib->Find(gOptProbePdgCode)->GetName()
+ << "-" << pdglib->Find(gOptTgtPdgCode)->GetName() << ".ps";
+ TPostScript *ps = new TPostScript(filename.str().c_str(), kPsType);
//-- get the list of interactions that can be simulated by the driver
- const InteractionList * ilist = evg_driver.Interactions();
+ const InteractionList *ilist = evg_driver.Interactions();
unsigned int nspl = ilist->size();
//-- book enough space for xsec plots (last one is the sum)
- TGraph * gr[nspl+1];
+ TGraph *gr[nspl + 1];
- //-- loop over all the simulated interactions & create the cross section graphs
+ //-- loop over all the simulated interactions & create the cross section
+ //graphs
InteractionList::const_iterator ilistiter = ilist->begin();
- unsigned int i=0;
- for(; ilistiter != ilist->end(); ++ilistiter) {
+ unsigned int i = 0;
+ for (; ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
+ const Interaction *interaction = *ilistiter;
LOG("gspl2root", pINFO)
- << "Current interaction: " << interaction->AsString();
-
+ << "Current interaction: " << interaction->AsString();
//-- access the cross section spline
- const Spline * spl = evg_driver.XSecSpline(interaction);
- if(!spl) {
+ const Spline *spl = evg_driver.XSecSpline(interaction);
+ if (!spl) {
LOG("gspl2root", pWARN)
- << "Can't get spline for: " << interaction->AsString();
+ << "Can't get spline for: " << interaction->AsString();
exit(2);
}
//-- set graph color/style
- int icol = TMath::Min( i % kNColors, kNColors-1 );
- int isty = TMath::Min( i / kNMarkers, kNMarkers-1 );
+ int icol = TMath::Min(i % kNColors, kNColors - 1);
+ int isty = TMath::Min(i / kNMarkers, kNMarkers - 1);
int col = colors[icol];
int sty = markers[isty];
- LOG("gspl2root", pINFO)
- << "color = " << col << ", marker = " << sty;
+ LOG("gspl2root", pINFO) << "color = " << col << ", marker = " << sty;
//-- export Spline as TGraph / set color & stype
- gr[i] = spl->GetAsTGraph(kNP,true,true,1.,1./units::cm2);
+ gr[i] = spl->GetAsTGraph(kNP, true, true, 1., 1. / units::cm2);
gr[i]->SetLineColor(col);
gr[i]->SetMarkerColor(col);
gr[i]->SetMarkerStyle(sty);
@@ -289,33 +282,37 @@ void SaveToPsFile(void)
}
//-- now, get the sum...
- const Spline * splsum = evg_driver.XSecSumSpline();
- if(!splsum) {
- LOG("gspl2root", pWARN)
- << "Can't get the cross section sum spline";
- exit(2);
+ const Spline *splsum = evg_driver.XSecSumSpline();
+ if (!splsum) {
+ LOG("gspl2root", pWARN) << "Can't get the cross section sum spline";
+ exit(2);
}
- gr[nspl] = splsum->GetAsTGraph(kNP,true,true,1.,1./units::cm2);
+ gr[nspl] = splsum->GetAsTGraph(kNP, true, true, 1., 1. / units::cm2);
//-- figure out the minimum / maximum xsec in plotted range
double XSmax = -9999;
- double XSmin = 9999;
- double x=0, y=0;
- for(int j=0; jGetPoint(j,x,y);
- XSmax = TMath::Max(XSmax,y);
+ double XSmin = 9999;
+ double x = 0, y = 0;
+ for (int j = 0; j < kNP; j++) {
+ gr[nspl]->GetPoint(j, x, y);
+ XSmax = TMath::Max(XSmax, y);
}
- XSmin = XSmax/100000.;
- XSmax = XSmax*1.2;
+ XSmin = XSmax / 100000.;
+ XSmax = XSmax * 1.2;
- LOG("gspl2root", pINFO) << "Drawing frame: E = (" << gEmin << ", " << gEmax << ")";
- LOG("gspl2root", pINFO) << "Drawing frame: XSec = (" << XSmin << ", " << XSmax << ")";
+ LOG("gspl2root", pINFO) << "Drawing frame: E = (" << gEmin << ", " << gEmax
+ << ")";
+ LOG("gspl2root", pINFO) << "Drawing frame: XSec = (" << XSmin << ", " << XSmax
+ << ")";
//-- ps output: add the 1st page with _all_ xsec spline plots
//
- //c->Draw();
- TH1F * h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
- for(unsigned int ispl = 0; ispl <= nspl; ispl++) if(gr[ispl]) { gr[ispl]->Draw("LP"); }
+ // c->Draw();
+ TH1F *h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ for (unsigned int ispl = 0; ispl <= nspl; ispl++)
+ if (gr[ispl]) {
+ gr[ispl]->Draw("LP");
+ }
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -326,21 +323,22 @@ void SaveToPsFile(void)
//-- plot QEL xsecs only
//
- h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
- i=0;
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- if(interaction->ProcInfo().IsQuasiElastic() && ! interaction->ExclTag().IsCharmEvent()) {
- gr[i]->Draw("LP");
- TString spltitle(interaction->AsString());
- spltitle = spltitle.ReplaceAll(";",1," ",1);
- legend->AddEntry(gr[i], spltitle.Data(),"LP");
+ h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ i = 0;
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ if (interaction->ProcInfo().IsQuasiElastic() &&
+ !interaction->ExclTag().IsCharmEvent()) {
+ gr[i]->Draw("LP");
+ TString spltitle(interaction->AsString());
+ spltitle = spltitle.ReplaceAll(";", 1, " ", 1);
+ legend->AddEntry(gr[i], spltitle.Data(), "LP");
}
i++;
}
legend->SetHeader("QEL Cross Sections");
gr[nspl]->Draw("LP");
- legend->AddEntry(gr[nspl], "sum","LP");
+ legend->AddEntry(gr[nspl], "sum", "LP");
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -349,28 +347,28 @@ void SaveToPsFile(void)
c->SetGridy();
c->Update();
c->Clear();
- c->Range(0,0,1,1);
+ c->Range(0, 0, 1, 1);
legend->Draw();
c->Update();
//-- plot RES xsecs only
//
- h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
legend->Clear();
- i=0;
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- if(interaction->ProcInfo().IsResonant()) {
- gr[i]->Draw("LP");
- TString spltitle(interaction->AsString());
- spltitle = spltitle.ReplaceAll(";",1," ",1);
- legend->AddEntry(gr[i], spltitle.Data(),"LP");
+ i = 0;
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ if (interaction->ProcInfo().IsResonant()) {
+ gr[i]->Draw("LP");
+ TString spltitle(interaction->AsString());
+ spltitle = spltitle.ReplaceAll(";", 1, " ", 1);
+ legend->AddEntry(gr[i], spltitle.Data(), "LP");
}
i++;
}
legend->SetHeader("RES Cross Sections");
gr[nspl]->Draw("LP");
- legend->AddEntry(gr[nspl], "sum","LP");
+ legend->AddEntry(gr[nspl], "sum", "LP");
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -379,28 +377,28 @@ void SaveToPsFile(void)
c->SetGridy();
c->Update();
c->Clear();
- c->Range(0,0,1,1);
+ c->Range(0, 0, 1, 1);
legend->Draw();
c->Update();
//-- plot DIS xsecs only
//
- h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
legend->Clear();
- i=0;
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- if(interaction->ProcInfo().IsDeepInelastic()) {
- gr[i]->Draw("LP");
- TString spltitle(interaction->AsString());
- spltitle = spltitle.ReplaceAll(";",1," ",1);
- legend->AddEntry(gr[i], spltitle.Data(),"LP");
+ i = 0;
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ if (interaction->ProcInfo().IsDeepInelastic()) {
+ gr[i]->Draw("LP");
+ TString spltitle(interaction->AsString());
+ spltitle = spltitle.ReplaceAll(";", 1, " ", 1);
+ legend->AddEntry(gr[i], spltitle.Data(), "LP");
}
i++;
}
legend->SetHeader("DIS Cross Sections");
gr[nspl]->Draw("LP");
- legend->AddEntry(gr[nspl], "sum","LP");
+ legend->AddEntry(gr[nspl], "sum", "LP");
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -409,28 +407,28 @@ void SaveToPsFile(void)
c->SetGridy();
c->Update();
c->Clear();
- c->Range(0,0,1,1);
+ c->Range(0, 0, 1, 1);
legend->Draw();
c->Update();
//-- plot COH xsecs only
//
- h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
legend->Clear();
- i=0;
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- if(interaction->ProcInfo().IsCoherentProduction()) {
- gr[i]->Draw("LP");
- TString spltitle(interaction->AsString());
- spltitle = spltitle.ReplaceAll(";",1," ",1);
- legend->AddEntry(gr[i], spltitle.Data(),"LP");
+ i = 0;
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ if (interaction->ProcInfo().IsCoherentProduction()) {
+ gr[i]->Draw("LP");
+ TString spltitle(interaction->AsString());
+ spltitle = spltitle.ReplaceAll(";", 1, " ", 1);
+ legend->AddEntry(gr[i], spltitle.Data(), "LP");
}
i++;
}
legend->SetHeader("COH Cross Sections");
gr[nspl]->Draw("LP");
- legend->AddEntry(gr[nspl], "sum","LP");
+ legend->AddEntry(gr[nspl], "sum", "LP");
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -439,27 +437,27 @@ void SaveToPsFile(void)
c->SetGridy();
c->Update();
c->Clear();
- c->Range(0,0,1,1);
+ c->Range(0, 0, 1, 1);
legend->Draw();
c->Update();
//-- plot charm xsecs only
//
- h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
- i=0;
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- if(interaction->ExclTag().IsCharmEvent()) {
- gr[i]->Draw("LP");
- TString spltitle(interaction->AsString());
- spltitle = spltitle.ReplaceAll(";",1," ",1);
- legend->AddEntry(gr[i], spltitle.Data(),"LP");
+ h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ i = 0;
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ if (interaction->ExclTag().IsCharmEvent()) {
+ gr[i]->Draw("LP");
+ TString spltitle(interaction->AsString());
+ spltitle = spltitle.ReplaceAll(";", 1, " ", 1);
+ legend->AddEntry(gr[i], spltitle.Data(), "LP");
}
i++;
}
legend->SetHeader("Charm Prod. Cross Sections");
- //gr[nspl]->Draw("LP");
- legend->AddEntry(gr[nspl], "sum","LP");
+ // gr[nspl]->Draw("LP");
+ legend->AddEntry(gr[nspl], "sum", "LP");
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -468,30 +466,30 @@ void SaveToPsFile(void)
c->SetGridy();
c->Update();
c->Clear();
- c->Range(0,0,1,1);
+ c->Range(0, 0, 1, 1);
legend->Draw();
c->Update();
//-- plot ve xsecs only
//
- h = (TH1F*) c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
+ h = (TH1F *)c->DrawFrame(gEmin, XSmin, gEmax, XSmax);
legend->Clear();
- i=0;
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- if(interaction->ProcInfo().IsInverseMuDecay() ||
- interaction->ProcInfo().IsIMDAnnihilation() ||
- interaction->ProcInfo().IsNuElectronElastic()) {
- gr[i]->Draw("LP");
- TString spltitle(interaction->AsString());
- spltitle = spltitle.ReplaceAll(";",1," ",1);
- legend->AddEntry(gr[i], spltitle.Data(),"LP");
+ i = 0;
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ if (interaction->ProcInfo().IsInverseMuDecay() ||
+ interaction->ProcInfo().IsIMDAnnihilation() ||
+ interaction->ProcInfo().IsNuElectronElastic()) {
+ gr[i]->Draw("LP");
+ TString spltitle(interaction->AsString());
+ spltitle = spltitle.ReplaceAll(";", 1, " ", 1);
+ legend->AddEntry(gr[i], spltitle.Data(), "LP");
}
i++;
}
legend->SetHeader("IMD and ve Elastic Cross Sections");
gr[nspl]->Draw("LP");
- legend->AddEntry(gr[nspl], "sum","LP");
+ legend->AddEntry(gr[nspl], "sum", "LP");
h->GetXaxis()->SetTitle("Ev (GeV)");
h->GetYaxis()->SetTitle("#sigma_{nuclear}/Ev (cm^{2}/GeV)");
c->SetLogx();
@@ -500,7 +498,7 @@ void SaveToPsFile(void)
c->SetGridy();
c->Update();
c->Clear();
- c->Range(0,0,1,1);
+ c->Range(0, 0, 1, 1);
legend->Draw();
c->Update();
@@ -508,106 +506,132 @@ void SaveToPsFile(void)
ps->Close();
//-- clean-up
- for(unsigned int j=0; j<=nspl; j++) { if(gr[j]) delete gr[j]; }
+ for (unsigned int j = 0; j <= nspl; j++) {
+ if (gr[j])
+ delete gr[j];
+ }
delete c;
delete ps;
}
//____________________________________________________________________________
-void FormatXSecGraph(TGraph * g)
-{
+void FormatXSecGraph(TGraph *g) {
g->SetTitle("GENIE cross section graph");
g->GetXaxis()->SetTitle("Ev (GeV)");
g->GetYaxis()->SetTitle("#sigma_{nuclear} (10^{-38} cm^{2})");
}
//____________________________________________________________________________
-void SaveGraphsToRootFile(void)
-{
+void SaveGraphsToRootFile(void) {
//-- get the event generation driver
GEVGDriver evg_driver = GetEventGenDriver();
//-- get the list of interactions that can be simulated by the driver
- const InteractionList * ilist = evg_driver.Interactions();
+ const InteractionList *ilist = evg_driver.Interactions();
//-- check whether the splines will be saved in a ROOT file - if not, exit now
- bool save_in_root = gOptROOTFilename.size()>0;
- if(!save_in_root) {
+ bool save_in_root = gOptROOTFilename.size() > 0;
+ if (!save_in_root) {
- LOG("gspl2root", pWARN) << "No Interaction List available" ;
+ LOG("gspl2root", pWARN) << "No Interaction List available";
return;
}
//-- get pdglibrary for mapping pdg codes to names
- PDGLibrary * pdglib = PDGLibrary::Instance();
+ PDGLibrary *pdglib = PDGLibrary::Instance();
//-- check whether the requested filename exists
// if yes, then open the file in 'update' mode
bool exists = !(gSystem->AccessPathName(gOptROOTFilename.c_str()));
- TFile * froot = 0;
- if(exists) froot = new TFile(gOptROOTFilename.c_str(), "UPDATE");
- else froot = new TFile(gOptROOTFilename.c_str(), "RECREATE");
+ TFile *froot = 0;
+ if (exists)
+ froot = new TFile(gOptROOTFilename.c_str(), "UPDATE");
+ else
+ froot = new TFile(gOptROOTFilename.c_str(), "RECREATE");
assert(froot);
//-- create directory
ostringstream dptr;
string probe_name = pdglib->Find(gOptProbePdgCode)->GetName();
- string tgt_name = (gOptTgtPdgCode==1000000010) ?
- "n" : pdglib->Find(gOptTgtPdgCode)->GetName();
+ string tgt_name = (gOptTgtPdgCode == 1000000010)
+ ? "n"
+ : pdglib->Find(gOptTgtPdgCode)->GetName();
dptr << probe_name << "_" << tgt_name;
ostringstream dtitle;
- dtitle << "Cross sections for: "
- << pdglib->Find(gOptProbePdgCode)->GetName() << "+"
- << pdglib->Find(gOptTgtPdgCode)->GetName();
-
- LOG("gspl2root", pINFO)
- << "Will store graphs in root directory = " << dptr.str();
- TDirectory * topdir =
- dynamic_cast (froot->Get(dptr.str().c_str()));
- if(topdir) {
- LOG("gspl2root", pINFO)
- << "Directory: " << dptr.str() << " already exists!! Exiting";
- froot->Close();
- delete froot;
- return;
+ dtitle << "Cross sections for: " << pdglib->Find(gOptProbePdgCode)->GetName()
+ << "+" << pdglib->Find(gOptTgtPdgCode)->GetName();
+
+ LOG("gspl2root", pINFO) << "Will store graphs in root directory = "
+ << dptr.str();
+ TDirectory *topdir =
+ dynamic_cast(froot->Get(dptr.str().c_str()));
+ if (topdir) {
+ LOG("gspl2root", pINFO)
+ << "Directory: " << dptr.str() << " already exists!! Exiting";
+ froot->Close();
+ delete froot;
+ return;
}
- topdir = froot->mkdir(dptr.str().c_str(),dtitle.str().c_str());
+ topdir = froot->mkdir(dptr.str().c_str(), dtitle.str().c_str());
topdir->cd();
- double de = (gInlogE) ? (TMath::Log(gEmax)-TMath::Log(gEmin))/(kNSplineP-1) : (gEmax-gEmin)/(kNSplineP-1);
- double * e = new double[kNSplineP];
- for(int i=0; ibegin();
- for(; ilistiter != ilist->end(); ++ilistiter) {
+ for (; ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
+ const Interaction *interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const XclsTag & xcls = interaction->ExclTag();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const XclsTag &xcls = interaction->ExclTag();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
// graph title
ostringstream title;
- if (proc.IsQuasiElastic() ) { title << "qel"; }
- else if (proc.IsMEC() ) { title << "mec"; }
- else if (proc.IsResonant() ) { title << "res"; }
- else if (proc.IsDeepInelastic() ) { title << "dis"; }
- else if (proc.IsDiffractive() ) { title << "dfr"; }
- else if (proc.IsCoherentProduction() ) {
+ if (proc.IsQuasiElastic()) {
+ title << "qel";
+ } else if (proc.IsMEC()) {
+ title << "mec";
+ } else if (proc.IsResonant()) {
+ title << "res";
+ } else if (proc.IsDeepInelastic()) {
+ title << "dis";
+ } else if (proc.IsDiffractive()) {
+ title << "dfr";
+ } else if (proc.IsCoherentProduction()) {
title << "coh";
- if ( xcls.NSingleGammas() > 0 ) title << "_gamma" ;
- else if ( xcls.NPions() > 0 ) title << "_pion" ;
- else if ( xcls.NRhos() > 0 ) title << "_rho" ;
- else title << "_other" ;
- }
+ if (xcls.NSingleGammas() > 0)
+ title << "_gamma";
+ else if (xcls.NPions() > 0)
+ title << "_pion";
+ else if (xcls.NRhos() > 0)
+ title << "_rho";
+ else
+ title << "_other";
+ } else if (proc.IsCoherentElastic()) {
+ title << "cevns";
+ } else if (proc.IsInverseMuDecay()) {
+ title << "imd";
+ } else if (proc.IsIMDAnnihilation()) {
+ title << "imdanh";
+ } else if (proc.IsNuElectronElastic()) {
+ title << "ve";
+ } else if (proc.IsGlashowResonance()) {
+ title << "glres";
+ }
else if (proc.IsCoherentElastic() ) { title << "cevns"; }
else if (proc.IsInverseMuDecay() ) { title << "imd"; }
else if (proc.IsIMDAnnihilation() ) { title << "imdanh";}
@@ -630,74 +654,126 @@ void SaveGraphsToRootFile(void)
<< " interaction type has not recongnised: spline not added " ;
continue; }
- if(tgt.HitNucIsSet()) {
+ if (proc.IsWeakCC()) {
+ title << "_cc";
+ } else if (proc.IsWeakNC()) {
+ title << "_nc";
+ } else if (proc.IsWeakMix()) {
+ title << "_ccncmix";
+ } else if (proc.IsEM()) {
+ title << "_em";
+ } else if (proc.IsDarkNeutralCurrent()) {
+ title << "_dark";
+ } else {
+ LOG("gspl2root", pWARN)
+ << "Process " << proc
+ << " interaction type has not recongnised: spline not added ";
+ continue;
+ }
+
+ if (tgt.HitNucIsSet()) {
int hitnuc = tgt.HitNucPdg();
- if ( pdg::IsProton (hitnuc) ) { title << "_p"; }
- else if ( pdg::IsNeutron(hitnuc) ) { title << "_n"; }
- else if ( pdg::Is2NucleonCluster(hitnuc) )
- {
- if (hitnuc == kPdgClusterNN) { title << "_nn"; }
- else if (hitnuc == kPdgClusterNP) { title << "_np"; }
- else if (hitnuc == kPdgClusterPP) { title << "_pp"; }
- else {
- LOG("gspl2root", pWARN) << "Can't handle hit 2-nucleon cluster PDG = " << hitnuc;
+ if (pdg::IsProton(hitnuc)) {
+ title << "_p";
+ } else if (pdg::IsNeutron(hitnuc)) {
+ title << "_n";
+ } else if (pdg::Is2NucleonCluster(hitnuc)) {
+ if (hitnuc == kPdgClusterNN) {
+ title << "_nn";
+ } else if (hitnuc == kPdgClusterNP) {
+ title << "_np";
+ } else if (hitnuc == kPdgClusterPP) {
+ title << "_pp";
+ } else {
+ LOG("gspl2root", pWARN)
+ << "Can't handle hit 2-nucleon cluster PDG = " << hitnuc;
}
- }
- else {
+ } else {
LOG("gspl2root", pWARN) << "Can't handle hit nucleon PDG = " << hitnuc;
}
- if(tgt.HitQrkIsSet()) {
- int qrkpdg = tgt.HitQrkPdg();
- bool insea = tgt.HitSeaQrk();
-
- if ( pdg::IsUQuark(qrkpdg) ) { title << "_u"; }
- else if ( pdg::IsDQuark(qrkpdg) ) { title << "_d"; }
- else if ( pdg::IsSQuark(qrkpdg) ) { title << "_s"; }
- else if ( pdg::IsCQuark(qrkpdg) ) { title << "_c"; }
- else if ( pdg::IsBQuark(qrkpdg) ) { title << "_b"; }
- else if ( pdg::IsAntiUQuark(qrkpdg) ) { title << "_ubar"; }
- else if ( pdg::IsAntiDQuark(qrkpdg) ) { title << "_dbar"; }
- else if ( pdg::IsAntiSQuark(qrkpdg) ) { title << "_sbar"; }
- else if ( pdg::IsAntiCQuark(qrkpdg) ) { title << "_cbar"; }
- else if ( pdg::IsAntiBQuark(qrkpdg) ) { title << "_bbar"; }
-
- if(insea) { title << "sea"; }
- else { title << "val"; }
+ if (tgt.HitQrkIsSet()) {
+ int qrkpdg = tgt.HitQrkPdg();
+ bool insea = tgt.HitSeaQrk();
+
+ if (pdg::IsUQuark(qrkpdg)) {
+ title << "_u";
+ } else if (pdg::IsDQuark(qrkpdg)) {
+ title << "_d";
+ } else if (pdg::IsSQuark(qrkpdg)) {
+ title << "_s";
+ } else if (pdg::IsCQuark(qrkpdg)) {
+ title << "_c";
+ } else if (pdg::IsBQuark(qrkpdg)) {
+ title << "_b";
+ } else if (pdg::IsAntiUQuark(qrkpdg)) {
+ title << "_ubar";
+ } else if (pdg::IsAntiDQuark(qrkpdg)) {
+ title << "_dbar";
+ } else if (pdg::IsAntiSQuark(qrkpdg)) {
+ title << "_sbar";
+ } else if (pdg::IsAntiCQuark(qrkpdg)) {
+ title << "_cbar";
+ } else if (pdg::IsAntiBQuark(qrkpdg)) {
+ title << "_bbar";
+ }
+
+ if (insea) {
+ title << "sea";
+ } else {
+ title << "val";
+ }
}
}
- if(proc.IsResonant()) {
- Resonance_t res = xcls.Resonance();
- string resname = res::AsString(res);
- resname = str::FilterString(")", resname);
- resname = str::FilterString("(", resname);
- title << "_" << resname.substr(3,4) << resname.substr(0,3);
+ if (proc.IsResonant()) {
+ Resonance_t res = xcls.Resonance();
+ string resname = res::AsString(res);
+ resname = str::FilterString(")", resname);
+ resname = str::FilterString("(", resname);
+ title << "_" << resname.substr(3, 4) << resname.substr(0, 3);
}
- if(xcls.IsStrangeEvent()) {
- title << "_strange";
- if(!xcls.IsInclusiveStrange()) { title << xcls.StrangeHadronPdg(); }
+ if (xcls.IsStrangeEvent()) {
+ title << "_strange";
+ if (!xcls.IsInclusiveStrange()) {
+ title << xcls.StrangeHadronPdg();
+ }
}
- if(xcls.IsCharmEvent()) {
- title << "_charm";
- if(!xcls.IsInclusiveCharm()) { title << xcls.CharmHadronPdg(); }
+ if (xcls.IsCharmEvent()) {
+ title << "_charm";
+ if (!xcls.IsInclusiveCharm()) {
+ title << xcls.CharmHadronPdg();
+ }
}
- if(xcls.IsFinalQuarkEvent()) {
- int qrkpdg = xcls.FinalQuarkPdg();
- if ( pdg::IsUQuark(qrkpdg) ) { title << "_u"; }
- else if ( pdg::IsDQuark(qrkpdg) ) { title << "_d"; }
- else if ( pdg::IsSQuark(qrkpdg) ) { title << "_s"; }
- else if ( pdg::IsCQuark(qrkpdg) ) { title << "_c"; }
- else if ( pdg::IsBQuark(qrkpdg) ) { title << "_b"; }
- else if ( pdg::IsTQuark(qrkpdg) ) { title << "_t"; }
- else if ( pdg::IsAntiUQuark(qrkpdg) ) { title << "_ubar"; }
- else if ( pdg::IsAntiDQuark(qrkpdg) ) { title << "_dbar"; }
- else if ( pdg::IsAntiSQuark(qrkpdg) ) { title << "_sbar"; }
- else if ( pdg::IsAntiCQuark(qrkpdg) ) { title << "_cbar"; }
- else if ( pdg::IsAntiBQuark(qrkpdg) ) { title << "_bbar"; }
- else if ( pdg::IsAntiTQuark(qrkpdg) ) { title << "_tbar"; }
+ if (xcls.IsFinalQuarkEvent()) {
+ int qrkpdg = xcls.FinalQuarkPdg();
+ if (pdg::IsUQuark(qrkpdg)) {
+ title << "_u";
+ } else if (pdg::IsDQuark(qrkpdg)) {
+ title << "_d";
+ } else if (pdg::IsSQuark(qrkpdg)) {
+ title << "_s";
+ } else if (pdg::IsCQuark(qrkpdg)) {
+ title << "_c";
+ } else if (pdg::IsBQuark(qrkpdg)) {
+ title << "_b";
+ } else if (pdg::IsTQuark(qrkpdg)) {
+ title << "_t";
+ } else if (pdg::IsAntiUQuark(qrkpdg)) {
+ title << "_ubar";
+ } else if (pdg::IsAntiDQuark(qrkpdg)) {
+ title << "_dbar";
+ } else if (pdg::IsAntiSQuark(qrkpdg)) {
+ title << "_sbar";
+ } else if (pdg::IsAntiCQuark(qrkpdg)) {
+ title << "_cbar";
+ } else if (pdg::IsAntiBQuark(qrkpdg)) {
+ title << "_bbar";
+ } else if (pdg::IsAntiTQuark(qrkpdg)) {
+ title << "_tbar";
+ }
}
if(xcls.IsFinalLeptonEvent()) {
int leppdg = TMath::Abs(xcls.FinalLeptonPdg());
@@ -707,12 +783,12 @@ void SaveGraphsToRootFile(void)
else if ( pdg::IsPion(leppdg) ) { title << "_had"; }
}
- const Spline * spl = evg_driver.XSecSpline(interaction);
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
+ for (int i = 0; i < kNSplineP; i++) {
+ xs[i] = spl->Evaluate(e[i]) * (1E+38 / units::cm2);
}
- TGraph * gr = new TGraph(kNSplineP, e, xs);
+ TGraph *gr = new TGraph(kNSplineP, e, xs);
gr->SetName(title.str().c_str());
FormatXSecGraph(gr);
gr->SetTitle(spl->GetName());
@@ -720,73 +796,76 @@ void SaveGraphsToRootFile(void)
topdir->Add(gr);
}
-
//
// totals for (anti-)neutrino scattering
//
bool is_neutrino = pdg::IsNeutralLepton(gOptProbePdgCode);
- if(is_neutrino) {
+ if (is_neutrino) {
//
// add-up all res channels
//
- double * xsresccp = new double[kNSplineP];
- double * xsresccn = new double[kNSplineP];
- double * xsresncp = new double[kNSplineP];
- double * xsresncn = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
- const Spline * spl = evg_driver.XSecSpline(interaction);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
- if (proc.IsResonant() && proc.IsWeakCC() && pdg::IsProton(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if (proc.IsResonant() && proc.IsWeakCC() && pdg::IsNeutron(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if (proc.IsResonant() && proc.IsWeakNC() && pdg::IsProton(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if (proc.IsResonant() && proc.IsWeakNC() && pdg::IsNeutron(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
+ if (proc.IsResonant() && proc.IsWeakCC() &&
+ pdg::IsProton(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsresccp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
+ if (proc.IsResonant() && proc.IsWeakCC() &&
+ pdg::IsNeutron(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsresccn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
+ if (proc.IsResonant() && proc.IsWeakNC() &&
+ pdg::IsProton(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsresncp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
+ if (proc.IsResonant() && proc.IsWeakNC() &&
+ pdg::IsNeutron(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsresncn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
}
- TGraph * gr_resccp = new TGraph(kNSplineP, e, xsresccp);
+ TGraph *gr_resccp = new TGraph(kNSplineP, e, xsresccp);
gr_resccp->SetName("res_cc_p");
FormatXSecGraph(gr_resccp);
topdir->Add(gr_resccp);
- TGraph * gr_resccn = new TGraph(kNSplineP, e, xsresccn);
+ TGraph *gr_resccn = new TGraph(kNSplineP, e, xsresccn);
gr_resccn->SetName("res_cc_n");
FormatXSecGraph(gr_resccn);
topdir->Add(gr_resccn);
- TGraph * gr_resncp = new TGraph(kNSplineP, e, xsresncp);
+ TGraph *gr_resncp = new TGraph(kNSplineP, e, xsresncp);
gr_resncp->SetName("res_nc_p");
FormatXSecGraph(gr_resncp);
topdir->Add(gr_resncp);
- TGraph * gr_resncn = new TGraph(kNSplineP, e, xsresncn);
+ TGraph *gr_resncn = new TGraph(kNSplineP, e, xsresncn);
gr_resncn->SetName("res_nc_n");
FormatXSecGraph(gr_resncn);
topdir->Add(gr_resncn);
@@ -809,16 +888,17 @@ void SaveGraphsToRootFile(void)
xsdisncp[i] = 0;
xsdisncn[i] = 0;
}
- for(ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const XclsTag & xcls = interaction->ExclTag();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const XclsTag &xcls = interaction->ExclTag();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
- const Spline * spl = evg_driver.XSecSpline(interaction);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
- if(xcls.IsCharmEvent()) continue;
+ if (xcls.IsCharmEvent())
+ continue;
if (proc.IsDeepInelastic() && proc.IsWeakCC() && pdg::IsProton(tgt.HitNucPdg())) {
for(int i=0; iSetName("dis_cc_p");
FormatXSecGraph(gr_disccp);
topdir->Add(gr_disccp);
- TGraph * gr_disccn = new TGraph(kNSplineP, e, xsdisccn);
+ TGraph *gr_disccn = new TGraph(kNSplineP, e, xsdisccn);
gr_disccn->SetName("dis_cc_n");
FormatXSecGraph(gr_disccn);
topdir->Add(gr_disccn);
- TGraph * gr_disncp = new TGraph(kNSplineP, e, xsdisncp);
+ TGraph *gr_disncp = new TGraph(kNSplineP, e, xsdisncp);
gr_disncp->SetName("dis_nc_p");
FormatXSecGraph(gr_disncp);
topdir->Add(gr_disncp);
- TGraph * gr_disncn = new TGraph(kNSplineP, e, xsdisncn);
+ TGraph *gr_disncn = new TGraph(kNSplineP, e, xsdisncn);
gr_disncn->SetName("dis_nc_n");
FormatXSecGraph(gr_disncn);
topdir->Add(gr_disncn);
@@ -930,15 +1010,15 @@ void SaveGraphsToRootFile(void)
gr_disccp_charm->SetName("dis_cc_p_charm");
FormatXSecGraph(gr_disccp_charm);
topdir->Add(gr_disccp_charm);
- TGraph * gr_disccn_charm = new TGraph(kNSplineP, e, xsdisccn);
+ TGraph *gr_disccn_charm = new TGraph(kNSplineP, e, xsdisccn);
gr_disccn_charm->SetName("dis_cc_n_charm");
FormatXSecGraph(gr_disccn_charm);
topdir->Add(gr_disccn_charm);
- TGraph * gr_disncp_charm = new TGraph(kNSplineP, e, xsdisncp);
+ TGraph *gr_disncp_charm = new TGraph(kNSplineP, e, xsdisncp);
gr_disncp_charm->SetName("dis_nc_p_charm");
FormatXSecGraph(gr_disncp_charm);
topdir->Add(gr_disncp_charm);
- TGraph * gr_disncn_charm = new TGraph(kNSplineP, e, xsdisncn);
+ TGraph *gr_disncn_charm = new TGraph(kNSplineP, e, xsdisncn);
gr_disncn_charm->SetName("dis_nc_n_charm");
FormatXSecGraph(gr_disncn_charm);
topdir->Add(gr_disncn_charm);
@@ -947,36 +1027,36 @@ void SaveGraphsToRootFile(void)
// add-up all mec channels
//
- double * xsmeccc = new double[kNSplineP];
- double * xsmecnc = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
- const Spline * spl = evg_driver.XSecSpline(interaction);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
- if (proc.IsMEC() && proc.IsWeakCC()) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if (proc.IsMEC() && proc.IsWeakNC()) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
+ if (proc.IsMEC() && proc.IsWeakCC()) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsmeccc[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
+ if (proc.IsMEC() && proc.IsWeakNC()) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsmecnc[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
}
- TGraph * gr_meccc = new TGraph(kNSplineP, e, xsmeccc);
+ TGraph *gr_meccc = new TGraph(kNSplineP, e, xsmeccc);
gr_meccc->SetName("mec_cc");
FormatXSecGraph(gr_meccc);
topdir->Add(gr_meccc);
- TGraph * gr_mecnc = new TGraph(kNSplineP, e, xsmecnc);
+ TGraph *gr_mecnc = new TGraph(kNSplineP, e, xsmecnc);
gr_mecnc->SetName("mec_nc");
FormatXSecGraph(gr_mecnc);
topdir->Add(gr_mecnc);
@@ -985,51 +1065,52 @@ void SaveGraphsToRootFile(void)
// add-up all COH channels
//
- double * xscohcc = new double[kNSplineP];
- double * xscohnc = new double[kNSplineP];
- double * xscohtot = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+
+ const Spline *spl = evg_driver.XSecSpline(interaction);
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
-
- const Spline * spl = evg_driver.XSecSpline(interaction);
-
if (proc.IsCoherentProduction() && proc.IsWeakCC()) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
+ for (int i = 0; i < kNSplineP; i++) {
+ xscohcc[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
}
+
if (proc.IsCoherentProduction() && proc.IsWeakNC()) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if ( proc.IsCoherentProduction() ) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
+ for (int i = 0; i < kNSplineP; i++) {
+ xscohnc[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
}
+ if (proc.IsCoherentProduction()) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xscohtot[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
}
- TGraph * gr_cohcc = new TGraph(kNSplineP, e, xscohcc);
+ TGraph *gr_cohcc = new TGraph(kNSplineP, e, xscohcc);
gr_cohcc->SetName("coh_cc");
FormatXSecGraph(gr_cohcc);
topdir->Add(gr_cohcc);
- TGraph * gr_cohnc = new TGraph(kNSplineP, e, xscohnc);
+ TGraph *gr_cohnc = new TGraph(kNSplineP, e, xscohnc);
gr_cohnc->SetName("coh_nc");
FormatXSecGraph(gr_cohnc);
topdir->Add(gr_cohnc);
- TGraph * gr_cohtot = new TGraph(kNSplineP, e, xscohtot);
+ TGraph *gr_cohtot = new TGraph(kNSplineP, e, xscohtot);
gr_cohtot->SetName("coh");
FormatXSecGraph(gr_cohtot);
topdir->Add(gr_cohtot);
@@ -1086,87 +1167,87 @@ void SaveGraphsToRootFile(void)
//
// total cross sections
//
- double * xstotcc = new double[kNSplineP];
- double * xstotccp = new double[kNSplineP];
- double * xstotccn = new double[kNSplineP];
- double * xstotnc = new double[kNSplineP];
- double * xstotncp = new double[kNSplineP];
- double * xstotncn = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
- const Spline * spl = evg_driver.XSecSpline(interaction);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
bool iscc = proc.IsWeakCC();
bool isnc = proc.IsWeakNC();
- bool offp = pdg::IsProton (tgt.HitNucPdg());
+ bool offp = pdg::IsProton(tgt.HitNucPdg());
bool offn = pdg::IsNeutron(tgt.HitNucPdg());
if (iscc && offp) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotccp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (iscc && offn) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotccn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (isnc && offp) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotncp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (isnc && offn) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotncn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (iscc) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotcc[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (isnc) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotnc[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
}
- TGraph * gr_totcc = new TGraph(kNSplineP, e, xstotcc);
+ TGraph *gr_totcc = new TGraph(kNSplineP, e, xstotcc);
gr_totcc->SetName("tot_cc");
FormatXSecGraph(gr_totcc);
topdir->Add(gr_totcc);
- TGraph * gr_totccp = new TGraph(kNSplineP, e, xstotccp);
+ TGraph *gr_totccp = new TGraph(kNSplineP, e, xstotccp);
gr_totccp->SetName("tot_cc_p");
FormatXSecGraph(gr_totccp);
topdir->Add(gr_totccp);
- TGraph * gr_totccn = new TGraph(kNSplineP, e, xstotccn);
+ TGraph *gr_totccn = new TGraph(kNSplineP, e, xstotccn);
gr_totccn->SetName("tot_cc_n");
FormatXSecGraph(gr_totccn);
topdir->Add(gr_totccn);
- TGraph * gr_totnc = new TGraph(kNSplineP, e, xstotnc);
+ TGraph *gr_totnc = new TGraph(kNSplineP, e, xstotnc);
gr_totnc->SetName("tot_nc");
FormatXSecGraph(gr_totnc);
topdir->Add(gr_totnc);
- TGraph * gr_totncp = new TGraph(kNSplineP, e, xstotncp);
+ TGraph *gr_totncp = new TGraph(kNSplineP, e, xstotncp);
gr_totncp->SetName("tot_nc_p");
FormatXSecGraph(gr_totncp);
topdir->Add(gr_totncp);
- TGraph * gr_totncn = new TGraph(kNSplineP, e, xstotncn);
+ TGraph *gr_totncn = new TGraph(kNSplineP, e, xstotncn);
gr_totncn->SetName("tot_nc_n");
FormatXSecGraph(gr_totncn);
topdir->Add(gr_totncn);
@@ -1198,51 +1279,50 @@ void SaveGraphsToRootFile(void)
}// neutrinos
-
//
// totals for charged lepton scattering
//
bool is_charged_lepton = pdg::IsChargedLepton(gOptProbePdgCode);
-
- if(is_charged_lepton) {
-
+
+ if (is_charged_lepton) {
+
//
// add-up all res channels
//
- double * xsresemp = new double[kNSplineP];
- double * xsresemn = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
- const Spline * spl = evg_driver.XSecSpline(interaction);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
- if (proc.IsResonant() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if (proc.IsResonant() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
+ if (proc.IsResonant() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsresemp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
+ if (proc.IsResonant() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsresemn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
}
- TGraph * gr_resemp = new TGraph(kNSplineP, e, xsresemp);
+ TGraph *gr_resemp = new TGraph(kNSplineP, e, xsresemp);
gr_resemp->SetName("res_em_p");
FormatXSecGraph(gr_resemp);
topdir->Add(gr_resemp);
- TGraph * gr_resemn = new TGraph(kNSplineP, e, xsresemn);
+ TGraph *gr_resemn = new TGraph(kNSplineP, e, xsresemn);
gr_resemn->SetName("res_em_n");
FormatXSecGraph(gr_resemn);
topdir->Add(gr_resemn);
@@ -1251,39 +1331,42 @@ void SaveGraphsToRootFile(void)
// add-up all dis channels
//
- double * xsdisemp = new double[kNSplineP];
- double * xsdisemn = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const XclsTag & xcls = interaction->ExclTag();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
-
- const Spline * spl = evg_driver.XSecSpline(interaction);
-
- if(xcls.IsCharmEvent()) continue;
-
- if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
- if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
- }
- }
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const XclsTag &xcls = interaction->ExclTag();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
+
+ const Spline *spl = evg_driver.XSecSpline(interaction);
+
+ if (xcls.IsCharmEvent())
+ continue;
+
+ if (proc.IsDeepInelastic() && proc.IsEM() &&
+ pdg::IsProton(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsdisemp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
+ if (proc.IsDeepInelastic() && proc.IsEM() &&
+ pdg::IsNeutron(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsdisemn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
+ }
+ }
}
- TGraph * gr_disemp = new TGraph(kNSplineP, e, xsdisemp);
+ TGraph *gr_disemp = new TGraph(kNSplineP, e, xsdisemp);
gr_disemp->SetName("dis_em_p");
FormatXSecGraph(gr_disemp);
topdir->Add(gr_disemp);
- TGraph * gr_disemn = new TGraph(kNSplineP, e, xsdisemn);
+ TGraph *gr_disemn = new TGraph(kNSplineP, e, xsdisemn);
gr_disemn->SetName("dis_em_n");
FormatXSecGraph(gr_disemn);
topdir->Add(gr_disemn);
@@ -1292,37 +1375,40 @@ void SaveGraphsToRootFile(void)
// add-up all charm dis channels
//
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const XclsTag & xcls = interaction->ExclTag();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
-
- const Spline * spl = evg_driver.XSecSpline(interaction);
-
- if(!xcls.IsCharmEvent()) continue;
-
- if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsProton(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const XclsTag &xcls = interaction->ExclTag();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
+
+ const Spline *spl = evg_driver.XSecSpline(interaction);
+
+ if (!xcls.IsCharmEvent())
+ continue;
+
+ if (proc.IsDeepInelastic() && proc.IsEM() &&
+ pdg::IsProton(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsdisemp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
- if (proc.IsDeepInelastic() && proc.IsEM() && pdg::IsNeutron(tgt.HitNucPdg())) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ if (proc.IsDeepInelastic() && proc.IsEM() &&
+ pdg::IsNeutron(tgt.HitNucPdg())) {
+ for (int i = 0; i < kNSplineP; i++) {
+ xsdisemn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
}
- TGraph * gr_disemp_charm = new TGraph(kNSplineP, e, xsdisemp);
+ TGraph *gr_disemp_charm = new TGraph(kNSplineP, e, xsdisemp);
gr_disemp_charm->SetName("dis_em_p_charm");
FormatXSecGraph(gr_disemp_charm);
topdir->Add(gr_disemp_charm);
- TGraph * gr_disemn_charm = new TGraph(kNSplineP, e, xsdisemn);
+ TGraph *gr_disemn_charm = new TGraph(kNSplineP, e, xsdisemn);
gr_disemn_charm->SetName("dis_em_n_charm");
FormatXSecGraph(gr_disemn_charm);
topdir->Add(gr_disemn_charm);
@@ -1330,128 +1416,126 @@ void SaveGraphsToRootFile(void)
//
// total cross sections
//
- double * xstotem = new double[kNSplineP];
- double * xstotemp = new double[kNSplineP];
- double * xstotemn = new double[kNSplineP];
- for(int i=0; ibegin(); ilistiter != ilist->end(); ++ilistiter) {
- const Interaction * interaction = *ilistiter;
- const ProcessInfo & proc = interaction->ProcInfo();
- const InitialState & init = interaction->InitState();
- const Target & tgt = init.Tgt();
+ for (ilistiter = ilist->begin(); ilistiter != ilist->end(); ++ilistiter) {
+ const Interaction *interaction = *ilistiter;
+ const ProcessInfo &proc = interaction->ProcInfo();
+ const InitialState &init = interaction->InitState();
+ const Target &tgt = init.Tgt();
- const Spline * spl = evg_driver.XSecSpline(interaction);
+ const Spline *spl = evg_driver.XSecSpline(interaction);
bool isem = proc.IsEM();
- bool offp = pdg::IsProton (tgt.HitNucPdg());
+ bool offp = pdg::IsProton(tgt.HitNucPdg());
bool offn = pdg::IsNeutron(tgt.HitNucPdg());
if (isem && offp) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotemp[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (isem && offn) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotemn[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
if (isem) {
- for(int i=0; iEvaluate(e[i]) * (1E+38/units::cm2));
+ for (int i = 0; i < kNSplineP; i++) {
+ xstotem[i] += (spl->Evaluate(e[i]) * (1E+38 / units::cm2));
}
}
}
- TGraph * gr_totem = new TGraph(kNSplineP, e, xstotem);
+ TGraph *gr_totem = new TGraph(kNSplineP, e, xstotem);
gr_totem->SetName("tot_em");
FormatXSecGraph(gr_totem);
topdir->Add(gr_totem);
- TGraph * gr_totemp = new TGraph(kNSplineP, e, xstotemp);
+ TGraph *gr_totemp = new TGraph(kNSplineP, e, xstotemp);
gr_totemp->SetName("tot_em_p");
FormatXSecGraph(gr_totemp);
topdir->Add(gr_totemp);
- TGraph * gr_totemn = new TGraph(kNSplineP, e, xstotemn);
+ TGraph *gr_totemn = new TGraph(kNSplineP, e, xstotemn);
gr_totemn->SetName("tot_em_n");
FormatXSecGraph(gr_totemn);
topdir->Add(gr_totemn);
- delete [] e;
- delete [] xs;
- delete [] xsresemp;
- delete [] xsresemn;
- delete [] xsdisemp;
- delete [] xsdisemn;
- delete [] xstotem;
- delete [] xstotemp;
- delete [] xstotemn;
+ delete[] e;
+ delete[] xs;
+ delete[] xsresemp;
+ delete[] xsresemn;
+ delete[] xsdisemp;
+ delete[] xsdisemn;
+ delete[] xstotem;
+ delete[] xstotemp;
+ delete[] xstotemn;
- }// charged leptons
+ } // charged leptons
topdir->Write();
- if(froot) {
+ if (froot) {
froot->Close();
delete froot;
}
}
//____________________________________________________________________________
-void SaveNtupleToRootFile(void)
-{
-/*
- //-- create cross section ntuple
- //
- double brXSec;
- double brEv;
- bool brIsQel;
- bool brIsRes;
- bool brIsDis;
- bool brIsCoh;
- bool brIsImd;
- bool brIsNuEEl;
- bool brIsCC;
- bool brIsNC;
- int brNucleon;
- int brQrk;
- bool brIsSeaQrk;
- int brRes;
- bool brCharm;
- TTree * xsecnt = new TTree("xsecnt",dtitle.str().c_str());
- xsecnt->Branch("xsec", &brXSec, "xsec/D");
- xsecnt->Branch("e", &brEv, "e/D");
- xsecnt->Branch("qel", &brIsQel, "qel/O");
- xsecnt->Branch("res", &brIsRes, "res/O");
- xsecnt->Branch("dis", &brIsDis, "dis/O");
- xsecnt->Branch("coh", &brIsCoh, "coh/O");
- xsecnt->Branch("imd", &brIsImd, "imd/O");
- xsecnt->Branch("veel", &brIsNuEEl, "veel/O");
- xsecnt->Branch("cc", &brIsCC, "cc/O");
- xsecnt->Branch("nc", &brIsNC, "nc/O");
- xsecnt->Branch("nuc", &brNucleon, "nuc/I");
- xsecnt->Branch("qrk", &brQrk, "qrk/I");
- xsecnt->Branch("sea", &brIsSeaQrk, "sea/O");
- xsecnt->Branch("res", &brRes, "res/I");
- xsecnt->Branch("charm", &brCharm, "charm/O");
-*/
+void SaveNtupleToRootFile(void) {
+ /*
+ //-- create cross section ntuple
+ //
+ double brXSec;
+ double brEv;
+ bool brIsQel;
+ bool brIsRes;
+ bool brIsDis;
+ bool brIsCoh;
+ bool brIsImd;
+ bool brIsNuEEl;
+ bool brIsCC;
+ bool brIsNC;
+ int brNucleon;
+ int brQrk;
+ bool brIsSeaQrk;
+ int brRes;
+ bool brCharm;
+ TTree * xsecnt = new TTree("xsecnt",dtitle.str().c_str());
+ xsecnt->Branch("xsec", &brXSec, "xsec/D");
+ xsecnt->Branch("e", &brEv, "e/D");
+ xsecnt->Branch("qel", &brIsQel, "qel/O");
+ xsecnt->Branch("res", &brIsRes, "res/O");
+ xsecnt->Branch("dis", &brIsDis, "dis/O");
+ xsecnt->Branch("coh", &brIsCoh, "coh/O");
+ xsecnt->Branch("imd", &brIsImd, "imd/O");
+ xsecnt->Branch("veel", &brIsNuEEl, "veel/O");
+ xsecnt->Branch("cc", &brIsCC, "cc/O");
+ xsecnt->Branch("nc", &brIsNC, "nc/O");
+ xsecnt->Branch("nuc", &brNucleon, "nuc/I");
+ xsecnt->Branch("qrk", &brQrk, "qrk/I");
+ xsecnt->Branch("sea", &brIsSeaQrk, "sea/O");
+ xsecnt->Branch("res", &brRes, "res/I");
+ xsecnt->Branch("charm", &brCharm, "charm/O");
+ */
}
//____________________________________________________________________________
-void GetCommandLineArgs(int argc, char ** argv)
-{
+void GetCommandLineArgs(int argc, char **argv) {
LOG("gspl2root", pINFO) << "Parsing command line arguments";
// Common run options. Set defaults and read.
- RunOpt::Instance()->ReadFromCommandLine(argc,argv);
+ RunOpt::Instance()->ReadFromCommandLine(argc, argv);
// Parse run options for this app
- CmdLnArgParser parser(argc,argv);
+ CmdLnArgParser parser(argc, argv);
// input XML file name:
- if( parser.OptionExists('f') ) {
+ if (parser.OptionExists('f')) {
LOG("gspl2root", pINFO) << "Reading input XML filename";
gOptXMLFilename = parser.ArgAsString('f');
} else {
@@ -1461,62 +1545,61 @@ void GetCommandLineArgs(int argc, char ** argv)
}
// probe PDG code:
- if( parser.OptionExists('p') ) {
+ if (parser.OptionExists('p')) {
LOG("gspl2root", pINFO) << "Reading probe PDG code";
gOptProbePdgList = GetPDGCodeListFromString(parser.ArgAsString('p'));
} else {
- LOG("gspl2root", pFATAL)
- << "Unspecified probe PDG code - Exiting";
+ LOG("gspl2root", pFATAL) << "Unspecified probe PDG code - Exiting";
PrintSyntax();
exit(1);
}
// target PDG code:
- if( parser.OptionExists('t') ) {
+ if (parser.OptionExists('t')) {
LOG("gspl2root", pINFO) << "Reading target PDG code";
gOptTgtPdgList = GetPDGCodeListFromString(parser.ArgAsString('t'));
} else {
- LOG("gspl2root", pFATAL)
- << "Unspecified target PDG code - Exiting";
+ LOG("gspl2root", pFATAL) << "Unspecified target PDG code - Exiting";
PrintSyntax();
exit(1);
}
// min,max neutrino energy
- if( parser.OptionExists('e') ) {
+ if (parser.OptionExists('e')) {
LOG("gspl2root", pINFO) << "Reading neutrino energy";
string nue = parser.ArgAsString('e');
// is it just a value or a range (comma separated set of values)
- if(nue.find(",") != string::npos) {
- // split the comma separated list
- vector nurange = utils::str::Split(nue, ",");
- assert(nurange.size() == 2);
- gEmin = atof(nurange[0].c_str());
- gEmax = atof(nurange[1].c_str());
+ if (nue.find(",") != string::npos) {
+ // split the comma separated list
+ vector nurange = utils::str::Split(nue, ",");
+ assert(nurange.size() == 2);
+ gEmin = atof(nurange[0].c_str());
+ gEmax = atof(nurange[1].c_str());
} else {
- const Registry * val_reg = AlgConfigPool::Instance() -> CommonList( "Param", "Validation" ) ;
- gEmin = val_reg -> GetDouble( "GVLD-Emin" ) ;
+ const Registry *val_reg =
+ AlgConfigPool::Instance()->CommonList("Param", "Validation");
+ gEmin = val_reg->GetDouble("GVLD-Emin");
gEmax = atof(nue.c_str());
- LOG("gspl2root", pDEBUG)
- << "Unspecified Emin - Setting to " << gEmin << " GeV as per configuration";
+ LOG("gspl2root", pDEBUG) << "Unspecified Emin - Setting to " << gEmin
+ << " GeV as per configuration";
}
} else {
- const Registry * val_reg = AlgConfigPool::Instance() -> CommonList("Param", "Validation" ) ;
- gEmin = val_reg -> GetDouble( "GVLD-Emin" ) ;
+ const Registry *val_reg =
+ AlgConfigPool::Instance()->CommonList("Param", "Validation");
+ gEmin = val_reg->GetDouble("GVLD-Emin");
gEmax = 100;
LOG("gspl2root", pDEBUG)
- << "Unspecified Emin,Emax - Setting to " << gEmin << ",100 GeV ";
-
+ << "Unspecified Emin,Emax - Setting to " << gEmin << ",100 GeV ";
}
- assert(gEmin isvec = utils::str::Split(s,",");
+PDGCodeList GetPDGCodeListFromString(std::string s) {
+ vector isvec = utils::str::Split(s, ",");
// fill in the PDG code list
PDGCodeList list;
vector::const_iterator iter;
- for(iter = isvec.begin(); iter != isvec.end(); ++iter) {
- list.push_back( atoi(iter->c_str()) );
+ for (iter = isvec.begin(); iter != isvec.end(); ++iter) {
+ list.push_back(atoi(iter->c_str()));
}
return list;
-
}
//____________________________________________________________________________
diff --git a/src/Framework/Conventions/KinePhaseSpace.h b/src/Framework/Conventions/KinePhaseSpace.h
index 59ad95638..aacf1b80c 100644
--- a/src/Framework/Conventions/KinePhaseSpace.h
+++ b/src/Framework/Conventions/KinePhaseSpace.h
@@ -72,7 +72,10 @@ typedef enum EKinePhaseSpace {
kPSlog10xlog10Q2fE,
kPSEDNufE, // Used for Dark Neutrinos, two body final state
kPSn1n2fE,
- kPSn1n2n3fE
+ kPSn1n2n3fE,
+ kPSEgTlTgPgfE,
+ kPSEgOlOgfE,
+ kPSEgtTgPgfE
} KinePhaseSpace_t;
class KinePhaseSpace
@@ -95,8 +98,8 @@ class KinePhaseSpace
case(kPSlogyfE) : return "<{logy}|E>"; break;
case(kPSyfEx) : return "<{y}|E,x>"; break;
case(kPSlogyfEx) : return "<{logy}|E,x>"; break;
- case(kPSlogxlogyfE) : return "<{logx,logy}|E>"; break;
case(kPSxyfE) : return "<{x,y}|E>"; break;
+ case(kPSlogxlogyfE) : return "<{logx,logy}|E>"; break;
case(kPSxQ2fE) : return "<{x,Q2}|E>"; break;
case(kPSQ2fE) : return "<{Q2}|E>"; break;
case(kPSQD2fE) : return "<{QD2}|E>"; break;
@@ -120,18 +123,20 @@ class KinePhaseSpace
case(kPSlogQ2logyfE): return "<{Q2,y}|E>"; break;
case(kPSTlctl) : return "<{Tl,cos(theta_l)}|E>"; break;
case(kPSElOlOpifE) : return "<{El,Omega_l,Omega_pi}|E>"; break;
- case(kPSEgTlOgfE) : return "<{Egamma,Theta_l,Omega_gamma}|E>"; break;
case(kPSElOlTpifE) : return "<{El,Omega_l,Theta_pi}|E>"; break;
case(kPSTkTlctl) : return "<{Tk,Tl,cos(theta_l)}|E>"; break;
case(kPSQ2vfE) : return "<{Q2,v}|E>"; break;
- // TODO: update this string when the appropriate kinematic variables are known
case(kPSQELEvGen) : return ""; break;
- case(kPSDMELEvGen) : return ""; break;
case(kPSTAfE) : return "<{TA}|E>"; break;
+ case(kPSEgTlOgfE) : return "<{Egamma,Theta_l,Omega_gamma}|E>"; break;
+ case(kPSDMELEvGen) : return ""; break;
case(kPSlog10xlog10Q2fE) : return "<{log10x,log10Q2}|E>"; break;
case(kPSEDNufE) : return "<{EDNu}|E>"; break;
case(kPSn1n2fE) : return "<{n1,n2}|E>"; break;
case(kPSn1n2n3fE) : return "<{n1,n2,n3}|E>"; break;
+ case(kPSEgTlTgPgfE) : return "<{Egamma,Theta_l,Theta_gamma,Phi_gamma}|E>"; break;
+ case(kPSEgOlOgfE) : return "<{Egamma,Omega_l,Omega_gamma}|E>"; break;
+ case(kPSEgtTgPgfE) : return "<{Egamma,t,Theta_gamma,Phi_gamma}|E>"; break;
}
return "** Undefined kinematic phase space **";
}
diff --git a/src/Framework/Numerical/ComplexMatrix.h b/src/Framework/Numerical/ComplexMatrix.h
new file mode 100644
index 000000000..c27394c2e
--- /dev/null
+++ b/src/Framework/Numerical/ComplexMatrix.h
@@ -0,0 +1,136 @@
+//____________________________________________________________________________
+/*!
+
+ \namespace genie::utils::math
+
+ \brief Utilities for ComplexMatrix definitions
+
+ \author Costas Andreopoulos
+ University of Liverpool & STFC Rutherford Appleton Lab
+
+ \created July, 2020
+
+ \cpright Copyright (c) 2003-2020, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+*/
+//____________________________________________________________________________
+
+#ifndef _COMPLEX_MATRIX_H_
+#define _COMPLEX_MATRIX_H_
+
+#include
+#include
+#include
+
+namespace genie {
+ namespace utils {
+
+ namespace math {
+
+ template< size_t N >
+ class ComplexArray : public std::array< std::complex, N > {
+
+ public:
+ const ComplexArray & operator += ( const ComplexArray & ) ;
+ const ComplexArray & operator *= ( const std::complex & ) ;
+
+ ComplexArray Conj() const ;
+ } ;
+
+ template< size_t N >
+ class ComplexMatrix : public std::array< ComplexArray, N > {
+
+ public:
+ const ComplexMatrix & operator += ( const ComplexMatrix & ) ;
+ const ComplexMatrix & operator *= ( const std::complex & ) ;
+
+ ComplexMatrix Conj() const ;
+
+ };
+
+ // all these classes are templated, so they need the implementation locally
+
+
+ template
+ const ComplexArray & ComplexArray::operator += ( const ComplexArray & v ) {
+
+ for ( unsigned int i = 0 ; i < this->size(); ++i ) {
+ this->at(i) += v[i] ;
+ }
+
+ return *this ;
+ }
+
+ //____________________________________________________________________________
+
+ template
+ const ComplexArray & ComplexArray::operator *= ( const std::complex & c ) {
+
+ for ( unsigned int i = 0 ; i < this->size(); ++i ) {
+ this -> at(i) *= c ;
+ }
+
+ return *this ;
+
+ }
+
+ //____________________________________________________________________________
+ template
+ ComplexArray ComplexArray::Conj() const {
+
+ ComplexArray a;
+ for ( unsigned int i = 0 ; i < this->size(); ++i ) {
+ a[i] = std::conj( this->at(i) ) ;
+ }
+
+ return a ;
+ }
+
+ //____________________________________________________________________________
+
+ template
+ const ComplexMatrix & ComplexMatrix::operator += ( const ComplexMatrix & m ) {
+
+ for ( unsigned int i = 0 ; i < this->size(); ++i ) {
+ this->at(i) += m[i] ;
+ }
+
+ return *this ;
+ }
+
+ //____________________________________________________________________________
+
+ template
+ const ComplexMatrix & ComplexMatrix::operator *= ( const std::complex & c ) {
+
+ for ( unsigned int i = 0 ; i < this->size(); ++i ) {
+ this->at(i) *= c ;
+ }
+
+ return *this ;
+ }
+
+ //____________________________________________________________________________
+ template
+ ComplexMatrix ComplexMatrix::Conj() const {
+
+ ComplexMatrix a;
+ for ( unsigned int i = 0 ; i < this->size(); ++i ) {
+ a[i] = this->at(i).Conj() ;
+ }
+
+ return a ;
+ }
+
+ //____________________________________________________________________________
+
+
+
+
+
+ } // math namespace
+ } // utils namespace
+} // genie namespace
+
+#endif // _COMPLEX_MATRIX_H_
diff --git a/src/Framework/Numerical/GTrace.cxx b/src/Framework/Numerical/GTrace.cxx
new file mode 100644
index 000000000..24aedd413
--- /dev/null
+++ b/src/Framework/Numerical/GTrace.cxx
@@ -0,0 +1,19 @@
+//____________________________________________________________________________
+/*
+ Copyright (c) 2003-2019, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+
+ Author: Marco Roda
+ University of Liverpool
+
+ For documentation see the corresponding header file.
+
+*/
+//____________________________________________________________________________
+
+#include "Framework/Numerical/GTrace.h"
+
+using namespace genie::utils::math;
+
+
diff --git a/src/Framework/Numerical/GTrace.h b/src/Framework/Numerical/GTrace.h
new file mode 100644
index 000000000..97db9bcc2
--- /dev/null
+++ b/src/Framework/Numerical/GTrace.h
@@ -0,0 +1,52 @@
+//____________________________________________________________________________
+/*!
+
+ \class genie::utils::math::GTrace
+
+ \brief Simple math container for 4 x 4 complex objects
+
+ \author Costas Andreopoulos
+ University of Liverpool & STFC Rutherford Appleton Lab
+
+ Marco Roda
+ University of Liverpool
+
+ \created May 15, 2020
+
+ \cpright Copyright (c) 2003-2019, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+*/
+//____________________________________________________________________________
+
+#ifndef _MATH_UTILS_GTRACE_H_
+#define _MATH_UTILS_GTRACE_H_
+
+#include "Framework/Numerical/ComplexMatrix.h"
+
+namespace genie {
+ namespace utils {
+
+ namespace math {
+
+ using GTrace = ComplexMatrix<4> ;
+
+ class GTraceContraction : public std::pair {
+ public:
+
+ GTraceContraction( const GTrace & t ) :
+ std::pair(t.Conj(), t) { ; }
+
+ GTraceContraction( const GTrace & a, const GTrace & b ) :
+ std::pair(a, b) { ; }
+
+ std::complex operator()( uint8_t i, uint8_t j,
+ uint8_t m, uint8_t n) const {
+ return first[i][j] * second[m][n] ; }
+ };
+
+ } // math namespace
+ } // utils namespace
+} // genie namespace
+
+#endif // _MATH_UTILS_GTRACE_H_
diff --git a/src/Framework/Numerical/MathUtils.h b/src/Framework/Numerical/MathUtils.h
index 805a90b75..dab68a976 100644
--- a/src/Framework/Numerical/MathUtils.h
+++ b/src/Framework/Numerical/MathUtils.h
@@ -1,14 +1,14 @@
//____________________________________________________________________________
/*!
-\namespace genie::utils::math
+ \namespace genie::utils::math
-\brief Simple mathematical utilities not found in ROOT's TMath
+ \brief Simple mathematical utilities not found in ROOT's TMath
-\author Costas Andreopoulos
- University of Liverpool & STFC Rutherford Appleton Laboratory
+ \author Costas Andreopoulos
+ University of Liverpool & STFC Rutherford Appleton Laboratory
-\created May 06, 2004
+ \created May 06, 2004
\cpright Copyright (c) 2003-2023, The GENIE Collaboration
For the full text of the license visit http://copyright.genie-mc.org
@@ -19,6 +19,8 @@
#define _MATH_UTILS_H_
#include
+#include
+#include
#include
#include
#include
diff --git a/src/Framework/Utils/XSecSplineList.cxx b/src/Framework/Utils/XSecSplineList.cxx
index dbfba9f50..2313e91de 100644
--- a/src/Framework/Utils/XSecSplineList.cxx
+++ b/src/Framework/Utils/XSecSplineList.cxx
@@ -11,6 +11,8 @@
#include //provides: int feenableexcept(int excepts);
#include //provides: std::isnan()
+#include
+
#include
#include
@@ -36,6 +38,8 @@ using std::endl;
namespace genie {
+ using namespace std::chrono ;
+
//____________________________________________________________________________
ostream & operator << (ostream & stream, const XSecSplineList & list)
{
@@ -239,10 +243,18 @@ void XSecSplineList::CreateSpline(const XSecAlgorithmI * alg,
p4.SetPz(pz);
}
interaction->InitStatePtr()->SetProbeP4(p4);
+
+ steady_clock::time_point start = steady_clock::now();
+
xsec[i] = alg->Integral(interaction);
+
+ steady_clock::time_point end = steady_clock::now();
+
+ duration time_span = duration_cast>(end - start);
+
SLOG("XSecSplLst", pNOTICE)
<< "xsec(E = " << E[i] << ") = "
- << (1E+38/units::cm2)*xsec[i] << " x 1E-38 cm^2";
+ << (1E+38/units::cm2)*xsec[i] << " x 1E-38 cm^2, evaluated in " << time_span.count() << " s";
if ( std::isnan(xsec[i]) ) {
// this sometimes happens near threshold, warn and move on
SLOG("XSecSplLst", pWARN)
diff --git a/src/Physics/Coherent/EventGen/COHGammaKinematicsGenerator.cxx b/src/Physics/Coherent/EventGen/COHGammaKinematicsGenerator.cxx
new file mode 100644
index 000000000..795a378e6
--- /dev/null
+++ b/src/Physics/Coherent/EventGen/COHGammaKinematicsGenerator.cxx
@@ -0,0 +1,466 @@
+//____________________________________________________________________________
+/*
+ Copyright (c) 2003-2019, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+
+ Author: Marco Roda < mroda \at liverpool.ac.uk>
+ University of Liverpool
+
+ For the class documentation see the corresponding header file.
+
+ Important revisions after version 2.0.0 :
+ @ Feb 09, 2009 - CA
+ Moved into the new Coherent package from its previous location (EVGModules
+ package)
+ @ Mar 03, 2009 - CA
+ Renamed COHPiKinematicsGenerator -> COHKinematicsGenerator in
+ anticipation of reusing the code for simulating coherent production of
+ vector mesons.
+ @ May 06, 2009 - CA
+ Fix a problem with the search for the max cross section over the allowed
+ phase space which prevented kinematics to be generated for events near the
+ energy threshold.
+ @ Feb 06, 2013 - CA
+ When the value of the differential cross-section for the selected kinematics
+ is set to the event, set the corresponding KinePhaseSpace_t value too.
+
+*/
+//____________________________________________________________________________
+
+#include
+#include
+#include
+#include
+#include // std::accumulate
+#include
+#include
+
+#include
+#include
+#include "Math/Minimizer.h"
+#include "Math/Factory.h"
+#include
+
+#include "Framework/Algorithm/AlgConfigPool.h"
+#include "Framework/Conventions/Constants.h"
+#include "Framework/Conventions/Controls.h"
+#include "Framework/Conventions/GBuild.h"
+#include "Framework/Conventions/KinePhaseSpace.h"
+#include "Framework/Conventions/Units.h"
+#include "Framework/EventGen/EVGThreadException.h"
+#include "Framework/EventGen/EventGeneratorI.h"
+#include "Framework/EventGen/RunningThreadInfo.h"
+#include "Framework/GHEP/GHepFlags.h"
+#include "Framework/GHEP/GHepRecord.h"
+#include "Framework/Messenger/Messenger.h"
+#include "Framework/Numerical/RandomGen.h"
+#include "Framework/Utils/KineUtils.h"
+#include "Physics/Coherent/EventGen/COHGammaKinematicsGenerator.h"
+#include "Physics/XSectionIntegration/GSLXSecFunc.h"
+
+using namespace genie;
+using namespace genie::constants;
+using namespace genie::controls;
+using namespace genie::utils;
+
+//___________________________________________________________________________
+COHGammaKinematicsGenerator::COHGammaKinematicsGenerator()
+ : KineGeneratorWithCache("genie::COHGammaKinematicsGenerator"),
+ fGammaLimits(nullptr), ftPhaseSpace(true) {}
+//___________________________________________________________________________
+COHGammaKinematicsGenerator::COHGammaKinematicsGenerator(string config)
+ : KineGeneratorWithCache("genie::COHGammaKinematicsGenerator", config),
+ fGammaLimits(nullptr), ftPhaseSpace(true) {}
+//___________________________________________________________________________
+COHGammaKinematicsGenerator::~COHGammaKinematicsGenerator() {}
+//___________________________________________________________________________
+void COHGammaKinematicsGenerator::ProcessEventRecord(GHepRecord *evrec) const {
+ if (fGenerateUniformly) {
+ LOG("COHGammaKinematicsGenerator", pNOTICE)
+ << "Generating kinematics uniformly over the allowed phase space";
+ }
+
+ Interaction *in = evrec->Summary();
+
+ RunningThreadInfo *rtinfo = RunningThreadInfo::Instance();
+ const EventGeneratorI *evg = rtinfo->RunningThread();
+ fXSecModel = evg->CrossSectionAlg();
+
+ if (!fXSecModel->ValidProcess(in)) {
+ std::stringstream message;
+ message << "Cannot calculate kinematics for " << fXSecModel->Id().Name();
+
+ LOG("COHGammaKinematicsGenerator", pFATAL) << message.str();
+
+ exceptions::EVGThreadException ex;
+ ex.SetReason(message.str());
+ ex.SwitchOnFastForward();
+ throw ex;
+ }
+
+ in->SetBit(kISkipProcessChk);
+
+ double xsec_max = (fGenerateUniformly) ? -1 : this->ComputeMaxXSec(in);
+
+ // Initialise a random number generator
+ RandomGen *rnd = RandomGen::Instance();
+
+ //-- For the subsequent kinematic selection with the rejection method:
+ // Calculate the max differential cross section or retrieve it from the
+ // cache. Throw an exception and quit the evg thread if a non-positive
+ // value is found.
+ // If the kinematics are generated uniformly over the allowed phase
+ // space the max xsec is irrelevant
+
+ std::array ranges = {
+ fGammaLimits->EGamma(*in),
+ ftPhaseSpace ? fGammaLimits->t(*in) : fGammaLimits->ThetaLepton(*in),
+ fGammaLimits->ThetaGamma(*in), fGammaLimits->PhiGamma(*in)};
+
+ std::array widths;
+ for (unsigned int i = 0; i < ranges.size(); ++i) {
+ widths[i] = ranges[i].max - ranges[i].min;
+ }
+
+ //------ Try to select a valid set of kinematics
+ unsigned int iter = 0;
+ bool accept=false;
+
+ double xsec=-1 ;
+ std::array point ;
+
+ Interaction local_interaction( * in ) ;
+
+ std::unique_ptr func = nullptr ;
+ if ( ftPhaseSpace ) func.reset( new utils::gsl::d4Xsec_dEgdtdThetagdPhig( fXSecModel, & local_interaction ) );
+ else func.reset( new utils::gsl::d4Xsec_dEgdThetaldThetagdPhig( fXSecModel, & local_interaction ) ) ;
+
+ while(1) {
+ iter++;
+
+ if (iter > fMaxIterations)
+ this->throwOnTooManyIterations(iter, evrec);
+
+ // generate the kinematic point
+ for (unsigned int i = 0; i < ranges.size(); ++i) {
+ point[i] = ranges[i].min + widths[i] * rnd->RndKine().Rndm();
+ }
+
+ // LOG("COHKinematics", pINFO) << "Trying: Gamma(" << g_E_g << ", "
+ // << g_theta_g << ", " << g_phi_g << "), Lep("
+ // << g_theta_l << ")";
+
+ xsec = (*func)(point.data());
+
+ // realized this method assumes E_l
+
+ if (!fGenerateUniformly) {
+ //-- decide whether to accept the current kinematics
+ double t = xsec_max * rnd->RndKine().Rndm();
+
+ LOG("COHKinematics", pINFO) << "Got: xsec = " << xsec << ", t = " << t
+ << " (max_xsec = " << xsec_max << ")";
+
+ double f = 200*(xsec-xsec_max)/(xsec_max+xsec);
+ if ( f>fMaxXSecDiffTolerance ) {
+ xsec_max = xsec * fSafetyFactor;
+ LOG("COHKinematics", pWARN) << "Cross section maximum has been overridden to " << xsec_max ;
+ continue;
+ }
+
+
+ // this->AssertXSecLimits(in, xsec, xsec_max);
+
+#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
+ LOG("COHKinematics", pDEBUG) << "xsec= " << xsec << ", J= 1, Rnd= " << t;
+#endif
+ accept = (t < xsec);
+ } else {
+ accept = (xsec > 0);
+ }
+
+ //-- If the generated kinematics are accepted, finish-up module's job
+
+ if (accept) {
+
+ // update kinematic variables
+ Kinematics *kine = in->KinePtr();
+ const Kinematics &local_kine = local_interaction.Kine();
+
+ kine->Setx(local_kine.x(), true);
+ kine->Sety(local_kine.y(), true);
+ kine->SetQ2(local_kine.Q2(), true);
+ kine->SetW(local_kine.W(), true);
+ kine->Sett(local_kine.t(), true);
+
+ // generate the phase for the lepton
+ double phi_l = 2 * constants::kPi *
+ rnd->RndKine().Rndm(); // final overall roation added
+
+ // add the phase to both lepton and gamma so that the relative is the same
+ TLorentzVector lep(local_kine.FSLeptonP4());
+ lep.SetPhi(phi_l);
+ kine->SetFSLeptonP4(lep);
+
+ TLorentzVector gamma(local_kine.HadSystP4());
+ double phi_g = gamma.Phi();
+ phi_g += phi_l;
+ gamma.SetPhi(phi_g);
+ kine->SetHadSystP4(gamma);
+
+ // for uniform kinematics, compute an event weight as
+ // wght = (phase space volume)*(differential xsec)/(event total xsec)
+ if (fGenerateUniformly) {
+ // Phase space volume needs checking
+ double vol = std::accumulate(widths.begin(), widths.end(), 1.,
+ std::multiplies());
+ double totxsec = evrec->XSec();
+ double wght = (vol / totxsec) * xsec;
+ LOG("COHKinematics", pNOTICE) << "Kinematics wght = " << wght;
+
+ // apply computed weight to the current event weight
+ wght *= evrec->Weight();
+ LOG("COHKinematics", pNOTICE) << "Current event wght = " << wght;
+ evrec->SetWeight(wght);
+ }
+
+ evrec->SetDiffXSec(xsec, kPSEgTlTgPgfE);
+
+ // reset bits
+ in -> ResetBit(kISkipProcessChk);
+ in -> ResetBit(kISkipKinematicChk);
+
+ break ;
+ }//if accept
+
+ }//while still throwing events
+
+ return;
+}
+//___________________________________________________________________________
+double
+COHGammaKinematicsGenerator::ComputeMaxXSec(const Interaction *in) const {
+ // Computes the maximum differential cross section in the requested phase
+ // space. This method overloads KineGeneratorWithCache::ComputeMaxXSec
+ // method and the value is cached at a circular cache branch for retrieval
+ // during subsequent event generation.
+
+#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
+ SLOG("COHKinematics", pDEBUG)
+ << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
+#endif
+
+ std::cout << "Looking for the minimum \n" ;
+
+ std::unique_ptr min( ROOT::Math::Factory::CreateMinimizer("Minuit2" ) );
+
+ // min -> SetPrintLevel(3) ;
+
+ gsl::d4Xsec_dEgdThetaldThetagdPhig f(fXSecModel, in);
+ f.SetFactor(
+ -1.); // Make it return negative of cross-section so we can minimize
+
+ min->SetFunction(f);
+ min->SetMaxFunctionCalls(10000);
+ min->SetTolerance(0.05); // not sure what this does....
+
+ // need min, max, n, and d for all the xsec varables
+ // for COH gamma they are Eg, theta_l theta_gamma, phi_gamma
+ // then set variables and get min
+
+ std::array names = {"E_g", ftPhaseSpace ? "t" : "theta_l",
+ "theta_g", "phi_g"};
+
+ std::array ranges = {
+ fGammaLimits->EGamma(*in),
+ ftPhaseSpace ? fGammaLimits->t(*in) : fGammaLimits->ThetaLepton(*in),
+ fGammaLimits->ThetaGamma(*in), fGammaLimits->PhiGamma(*in)};
+
+ std::array start, steps, temp_point;
+ // Please note that if Minuit2 minimizer is used, the steps are not used
+ // but for consistency we are evaluating it
+
+ double max_xsec = -1. ;
+
+ double e_nu = in->InitState().ProbeE( kRfLab ) ;
+
+ auto scan_points = fMinimScanPoints ;
+ for ( int i = 0; i < scan_points.size() ; ++i ) {
+ scan_points[i] += ceil( e_nu * fScaleScanPoints[i] );
+ }
+
+ unsigned int max_xsec_iteractions = 0 ;
+
+ while ( max_xsec <= 0. ) {
+
+ for( auto & p : scan_points ) {
+ p *= (max_xsec_iteractions+1) ;
+ std::cout << p << std::endl ;
+ }
+
+ for (unsigned int i = 0; i < ranges.size(); ++i) {
+ double width = ranges[i].max - ranges[i].min;
+ steps[i] = width / (scan_points[i] + 1);
+ }
+
+
+
+
+ double xsec = 0;
+
+ // preliimnary scan
+ for (unsigned int i = 1; i <= scan_points[0]; ++i) {
+ temp_point[0] = ranges[0].min + steps[0] * i;
+
+ for (unsigned int j = 1; j <= scan_points[1]; ++j) {
+ temp_point[1] = ranges[1].min + steps[1] * j;
+
+ for (unsigned int k = 1; k <= scan_points[2]; ++k) {
+ temp_point[2] = ranges[2].min + steps[2] * k;
+
+ for (unsigned int l = 1; l <= scan_points[3]; ++l) {
+ temp_point[3] = ranges[3].min + steps[3] * l;
+
+ double temp_xsec = -f(temp_point.data());
+ //std::cout << temp_xsec << std::endl;
+ if (temp_xsec > xsec) {
+ start = temp_point;
+ xsec = temp_xsec;
+ }
+ }
+ }
+ }
+ }
+
+ std::cout << "Minimising using minuit \n";
+ std::cout << xsec << std::endl;
+
+ for (unsigned int i = 0; i < ranges.size(); ++i) {
+ min->SetLimitedVariable(i, names[i],
+ start[i],
+ 1E-6*steps[i],
+ ranges[i].min, ranges[i].max);
+ }
+
+ min->Minimize();
+
+ max_xsec = -min->MinValue(); // back to positive xsec
+ std::cout << max_xsec << std::endl;
+
+ ++ max_xsec_iteractions ;
+ } // while max_xsec <= 0.
+
+ // Apply safety factor, since value retrieved from the cache might
+ // correspond to a slightly different energy.
+ max_xsec *= fSafetyFactor;
+
+#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
+ SLOG("COHKinematics", pDEBUG) << in->AsString();
+ SLOG("COHKinematics", pDEBUG) << "Max xsec in phase space = " << max_xsec;
+ SLOG("COHKinematics", pDEBUG) << "Computed using alg = " << fXSecModel->Id();
+#endif
+
+ return max_xsec;
+}
+//___________________________________________________________________________
+double
+COHGammaKinematicsGenerator::Energy(const Interaction *interaction) const {
+ // Override the base class Energy() method to cache the max xsec for the
+ // neutrino energy in the LAB rather than in the hit nucleon rest frame.
+
+ const InitialState &init_state = interaction->InitState();
+ double E = init_state.ProbeE(kRfLab);
+ return E;
+}
+//___________________________________________________________________________
+void COHGammaKinematicsGenerator::throwOnTooManyIterations(unsigned int iters,
+ GHepRecord* evrec) const
+{
+ LOG("COHKinematics", pWARN)
+ << "*** Could not select valid kinematics after "
+ << iters << " iterations";
+ evrec->EventFlags()->SetBitNumber(kKineGenErr, true);
+ genie::exceptions::EVGThreadException exception;
+ exception.SetReason("Couldn't select kinematics");
+ exception.SwitchOnStepBack() ;
+ exception.SetReturnStep(0) ; // this is the kinematic generator
+ throw exception;
+}
+//___________________________________________________________________________
+void COHGammaKinematicsGenerator::Configure(const Registry &config) {
+ Algorithm::Configure(config);
+ this->LoadConfig();
+}
+//____________________________________________________________________________
+void COHGammaKinematicsGenerator::Configure(string config) {
+ Algorithm::Configure(config);
+ this->LoadConfig();
+}
+//____________________________________________________________________________
+void COHGammaKinematicsGenerator::LoadConfig(void) {
+
+ bool error = false;
+
+ GetParamDef("tPhaseSpace", ftPhaseSpace, false);
+
+ //-- max xsec safety factor (for rejection method) and min cached energy
+ GetParamDef("MaxXSec-SafetyFactor", fSafetyFactor, 1.6);
+ GetParamDef("Cache-MinEnergy", fEMin, -1.0);
+
+ //-- Generate kinematics uniformly over allowed phase space and compute
+ // an event weight?
+ GetParamDef("UniformOverPhaseSpace", fGenerateUniformly, false);
+
+ //-- Maximum allowed fractional cross section deviation from maxim cross
+ // section used in rejection method
+ GetParamDef("MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999.);
+ assert(fMaxXSecDiffTolerance >= 0);
+
+ int max_iter;
+ GetParamDef("MaxIterations", max_iter, (int)kRjMaxIterations);
+ if (max_iter > 0) {
+ fMaxIterations = max_iter;
+ }
+
+ const Algorithm *temp = SubAlg("IntegrationLimits");
+ fGammaLimits = dynamic_cast(temp);
+ if (!fGammaLimits) {
+ LOG("COHGammaKinematicsGenerator", pERROR)
+ << "Gamma integration limits subalgo failed to load";
+ error = true;
+ }
+
+ std::vector scan_points;
+ GetParamVect("MinimScanPoint", scan_points);
+ if (scan_points.size() < fMinimScanPoints.size()) {
+ LOG("COHGammaKinematicsGenerator", pERROR)
+ << "Not enough information for phase space scan";
+ error = true;
+ }
+
+ for (unsigned int i = 0; i < fMinimScanPoints.size(); ++i) {
+ fMinimScanPoints[i] = std::max(1, scan_points[i]);
+ }
+
+ std::vector scale_scan_points;
+ GetParamVect("ScaleScanPoint", scale_scan_points);
+ if (scale_scan_points.size() < fScaleScanPoints.size()) {
+ LOG("COHGammaKinematicsGenerator", pERROR)
+ << "Not enough information for phase space scan";
+ error = true;
+ }
+
+ for (unsigned int i = 0; i < fScaleScanPoints.size(); ++i) {
+ fScaleScanPoints[i] = std::max(0., scale_scan_points[i]);
+ }
+
+
+
+ if (error) {
+ LOG("COHGammaKinematicsGenerator", pFATAL)
+ << "Invalid configuration. Exiting";
+ exit(78);
+ }
+}
+//____________________________________________________________________________
diff --git a/src/Physics/Coherent/EventGen/COHGammaKinematicsGenerator.h b/src/Physics/Coherent/EventGen/COHGammaKinematicsGenerator.h
new file mode 100644
index 000000000..c0264e2a1
--- /dev/null
+++ b/src/Physics/Coherent/EventGen/COHGammaKinematicsGenerator.h
@@ -0,0 +1,71 @@
+//____________________________________________________________________________
+/*!
+
+\class genie::COHGammaKinematicsGenerator
+
+\brief Generates values for the kinematic variables describing coherent
+ neutrino-nucleus pion production events.
+ Is a concrete implementation of the EventRecordVisitorI interface.
+
+\author Costas Andreopoulos
+ University of Liverpool & STFC Rutherford Appleton Lab
+
+\created October 03, 2004
+
+\cpright Copyright (c) 2003-2019, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+*/
+//____________________________________________________________________________
+
+#ifndef _COH_GAMMA_KINEMATICS_GENERATOR_H_
+#define _COH_GAMMA_KINEMATICS_GENERATOR_H_
+
+#include "Physics/Common/KineGeneratorWithCache.h"
+#include "Framework/Utils/Range1.h"
+
+#include "Physics/Coherent/XSection/COHGammaIntegrationLimits.h"
+
+namespace genie {
+
+ class COHGammaKinematicsGenerator : public KineGeneratorWithCache {
+
+ public :
+ COHGammaKinematicsGenerator();
+ COHGammaKinematicsGenerator(string config);
+ ~COHGammaKinematicsGenerator();
+
+ // implement the EventRecordVisitorI interface
+ void ProcessEventRecord(GHepRecord * event_rec) const override ;
+
+ // overload the Algorithm::Configure() methods to load private data
+ // members from configuration options
+ void Configure(const Registry & config) override ;
+ void Configure(string config) override ;
+
+ // methods to load sub-algorithms and config data from the Registry
+ void LoadConfig (void);
+
+ // overload KineGeneratorWithCache method to compute max xsec
+ double ComputeMaxXSec (const Interaction * in) const override ;
+
+ // overload KineGeneratorWithCache method to get energy
+ // This can probably go
+ double Energy (const Interaction * in) const override ;
+
+
+ protected:
+ void throwOnTooManyIterations(unsigned int iters, GHepRecord* evrec) const;
+
+ private:
+
+ const COHGammaIntegrationLimits * fGammaLimits ;
+ std::array fMinimScanPoints ;
+ std::array fScaleScanPoints ;
+ bool ftPhaseSpace ;
+
+ unsigned int fMaxIterations ;
+ };
+
+} // genie namespace
+#endif // _COH_GAMMA_KINEMATICS_GENERATOR_H_
diff --git a/src/Physics/Coherent/EventGen/COHHadronicSystemGenerator.cxx b/src/Physics/Coherent/EventGen/COHHadronicSystemGenerator.cxx
index 147a80395..fecc63833 100644
--- a/src/Physics/Coherent/EventGen/COHHadronicSystemGenerator.cxx
+++ b/src/Physics/Coherent/EventGen/COHHadronicSystemGenerator.cxx
@@ -51,24 +51,35 @@ COHHadronicSystemGenerator::~COHHadronicSystemGenerator()
//___________________________________________________________________________
void COHHadronicSystemGenerator::ProcessEventRecord(GHepRecord * evrec) const
{
- // Access cross section algorithm for running thread
- RunningThreadInfo * rtinfo = RunningThreadInfo::Instance();
- const EventGeneratorI * evg = rtinfo->RunningThread();
- const XSecAlgorithmI *fXSecModel = evg->CrossSectionAlg();
- if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
- CalculateHadronicSystem_ReinSehgal(evrec);
- } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015")) {
- CalculateHadronicSystem_BergerSehgal(evrec);
- } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015")) {
- CalculateHadronicSystem_BergerSehgalFM(evrec);
- } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
- CalculateHadronicSystem_AlvarezRuso(evrec);
+
+ const Interaction * interaction = evrec -> Summary() ;
+ const XclsTag & xcls = interaction -> ExclTag() ;
+
+ if ( xcls.NPions() ==1 ) {
+
+ // Access cross section algorithm for running thread
+ RunningThreadInfo * rtinfo = RunningThreadInfo::Instance();
+ const EventGeneratorI * evg = rtinfo->RunningThread();
+ const XSecAlgorithmI *fXSecModel = evg->CrossSectionAlg();
+ if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
+ CalculateHadronicSystem_ReinSehgal(evrec);
+ } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015")) {
+ CalculateHadronicSystem_BergerSehgal(evrec);
+ } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015")) {
+ CalculateHadronicSystem_BergerSehgalFM(evrec);
+ } else if (fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec") {
+ CalculateHadronicSystem_AlvarezRuso(evrec);
+ }
+ else {
+ LOG("COHHadronicSystemGenerator",pFATAL) <<
+ "ProcessEventRecord >> Cannot calculate hadronic system for " <<
+ fXSecModel->Id().Name();
+ }
}
- else {
- LOG("COHHadronicSystemGenerator",pFATAL) <<
- "ProcessEventRecord >> Cannot calculate hadronic system for " <<
- fXSecModel->Id().Name();
+ else if ( xcls.NSingleGammas() == 1 ) {
+ CalculateHadronicSystem_AlvarezRuso(evrec);
}
+
}
//___________________________________________________________________________
int COHHadronicSystemGenerator::getPionPDGCodeFromXclTag(const XclsTag& xcls_tag) const
@@ -321,51 +332,63 @@ void COHHadronicSystemGenerator::CalculateHadronicSystem_ReinSehgal(GHepRecord *
//___________________________________________________________________________
void COHHadronicSystemGenerator::CalculateHadronicSystem_AlvarezRuso(GHepRecord * evrec) const
{
- Interaction * interaction = evrec->Summary();
+ const Interaction * interaction = evrec->Summary();
const Kinematics & kinematics = interaction -> Kine();
- GHepParticle * nu = evrec->Probe();
- GHepParticle * Ni = evrec->TargetNucleus();
- GHepParticle * fsl = evrec->FinalStatePrimaryLepton();
-
- // Pion
- const TLorentzVector ppi = kinematics.HadSystP4();
- const TVector3 ppi3 = ppi.Vect();
- const double Epi = ppi.E();
- int pion_pdgc=0;
- if ( interaction->ProcInfo().IsWeakCC() ) {
- if( nu->Pdg() > 0 ){ // neutrino
- pion_pdgc = kPdgPiP;
+ const GHepParticle * nu = evrec->Probe();
+ const GHepParticle * Ni = evrec->TargetNucleus();
+ const GHepParticle * fsl = evrec->FinalStatePrimaryLepton();
+
+ const XclsTag & xcls = interaction->ExclTag();
+
+ int other_pdgc = 0 ;
+
+ // Produced Particle
+ if ( xcls.NPions() > 0 ) {
+ if ( interaction->ProcInfo().IsWeakCC() ) {
+ if( nu->Pdg() > 0 ){ // neutrino
+ other_pdgc = kPdgPiP;
+ }
+ else{ // anti-neutrino
+ other_pdgc = kPdgPiM;
+ }
}
- else{ // anti-neutrino
- pion_pdgc = kPdgPiM;
+ else if ( interaction->ProcInfo().IsWeakNC() ) {
+ other_pdgc = kPdgPi0;
+ }
+ else{
+ LOG("COHHadronicSystemGeneratorAR", pFATAL)
+ << "Could not determine pion involved in interaction";
+ exit(1);
}
}
- else if ( interaction->ProcInfo().IsWeakNC() ) {
- pion_pdgc = kPdgPi0;
- }
- else{
- LOG("COHHadronicSystemGeneratorAR", pFATAL)
- << "Could not determine pion involved in interaction";
- exit(1);
+ else if ( xcls.NSingleGammas() > 0 ) {
+ other_pdgc = kPdgGamma ;
}
- //
- // Nucleus
- int nucl_pdgc = Ni->Pdg(); // pdg of final nucleus same as the initial nucleus
- double pxNf = nu->Px() + Ni->Px() - fsl->Px() - ppi3.Px();
- double pyNf = nu->Py() + Ni->Py() - fsl->Py() - ppi3.Py();
- double pzNf = nu->Pz() + Ni->Pz() - fsl->Pz() - ppi3.Pz();
- double ENf = nu->E() + Ni->E() - fsl->E() - Epi;
- //
- // Both
+ // determin the momemntum of the other
+ // including rotations due to incoming particle
+ const TLorentzVector * nu_p4 = evrec->Probe() -> P4() ;
+ TVector3 nu_dir = nu_p4 -> Vect().Unit() ;
+
+ TVector3 other_p3 = kinematics.HadSystP4().Vect();
+ other_p3.RotateUz( nu_dir ) ;
+ TLorentzVector other_p4( other_p3, kinematics.HadSystP4().E() ) ;
+
+ // Both produced particle and recoil nucleus need to know where they are produced
+ // and their mother
const TLorentzVector & vtx = *(nu->X4());
int mom = evrec->TargetNucleusPosition();
-
- //
+
+ evrec->AddParticle( other_pdgc,kIStStableFinalState,
+ mom,-1,-1,-1,
+ other_p4, vtx ) ;
+
+ // evaluate Recoil mmomentum
+ TLorentzVector nucl_p4 = *(nu->P4()) + *(Ni->P4()) - *(fsl->P4()) - other_p4 ;
+
// Fill the records
- evrec->AddParticle(nucl_pdgc,kIStStableFinalState, mom,-1,-1,-1,
- pxNf, pyNf, pzNf, ENf, 0, 0, 0, 0);
+ evrec->AddParticle( Ni->Pdg(),kIStStableFinalState,
+ mom,-1,-1,-1,
+ nucl_p4, vtx ) ;
- evrec->AddParticle(pion_pdgc,kIStStableFinalState, mom,-1,-1,-1,
- ppi3.Px(), ppi3.Py(),ppi3.Pz(),Epi, vtx.X(), vtx.Y(), vtx.Z(), vtx.T());
}
diff --git a/src/Physics/Coherent/EventGen/COHKinematicsGenerator.cxx b/src/Physics/Coherent/EventGen/COHPionKinematicsGenerator.cxx
similarity index 53%
rename from src/Physics/Coherent/EventGen/COHKinematicsGenerator.cxx
rename to src/Physics/Coherent/EventGen/COHPionKinematicsGenerator.cxx
index a30ce32de..38c697fa9 100644
--- a/src/Physics/Coherent/EventGen/COHKinematicsGenerator.cxx
+++ b/src/Physics/Coherent/EventGen/COHPionKinematicsGenerator.cxx
@@ -1,36 +1,40 @@
//____________________________________________________________________________
/*
+
Copyright (c) 2003-2023, The GENIE Collaboration
For the full text of the license visit http://copyright.genie-mc.org
+
+ Costas Andreopoulos
+ University of Liverpool & STFC Rutherford Appleton Laboratory
- Costas Andreopoulos
- University of Liverpool & STFC Rutherford Appleton Laboratory
+
*/
//____________________________________________________________________________
#include
+#include
-#include
-#include
-#include
-#include "Math/Minimizer.h"
#include "Math/Factory.h"
+#include "Math/Minimizer.h"
+#include
+#include
+#include
#include "Framework/Algorithm/AlgConfigPool.h"
-#include "Framework/Conventions/GBuild.h"
#include "Framework/Conventions/Constants.h"
#include "Framework/Conventions/Controls.h"
-#include "Framework/Conventions/Units.h"
-#include "Physics/Coherent/EventGen/COHKinematicsGenerator.h"
+#include "Framework/Conventions/GBuild.h"
#include "Framework/Conventions/KinePhaseSpace.h"
+#include "Framework/Conventions/Units.h"
#include "Framework/EventGen/EVGThreadException.h"
#include "Framework/EventGen/EventGeneratorI.h"
#include "Framework/EventGen/RunningThreadInfo.h"
-#include "Framework/GHEP/GHepRecord.h"
#include "Framework/GHEP/GHepFlags.h"
+#include "Framework/GHEP/GHepRecord.h"
#include "Framework/Messenger/Messenger.h"
#include "Framework/Numerical/RandomGen.h"
#include "Framework/Utils/KineUtils.h"
+#include "Physics/Coherent/EventGen/COHPionKinematicsGenerator.h"
#include "Physics/XSectionIntegration/GSLXSecFunc.h"
using namespace genie;
@@ -39,59 +43,63 @@ using namespace genie::controls;
using namespace genie::utils;
//___________________________________________________________________________
-COHKinematicsGenerator::COHKinematicsGenerator() :
- KineGeneratorWithCache("genie::COHKinematicsGenerator")
-{
+COHPionKinematicsGenerator::COHPionKinematicsGenerator()
+ : KineGeneratorWithCache("genie::COHPionKinematicsGenerator") {
fEnvelope = 0;
}
//___________________________________________________________________________
-COHKinematicsGenerator::COHKinematicsGenerator(string config) :
- KineGeneratorWithCache("genie::COHKinematicsGenerator", config)
-{
+COHPionKinematicsGenerator::COHPionKinematicsGenerator(string config)
+ : KineGeneratorWithCache("genie::COHPionKinematicsGenerator", config) {
fEnvelope = 0;
}
//___________________________________________________________________________
-COHKinematicsGenerator::~COHKinematicsGenerator()
-{
- if(fEnvelope) delete fEnvelope;
+COHPionKinematicsGenerator::~COHPionKinematicsGenerator() {
+ if (fEnvelope)
+ delete fEnvelope;
}
//___________________________________________________________________________
-void COHKinematicsGenerator::ProcessEventRecord(GHepRecord * evrec) const
-{
- if(fGenerateUniformly) {
+void COHPionKinematicsGenerator::ProcessEventRecord(GHepRecord *evrec) const {
+ if (fGenerateUniformly) {
LOG("COHKinematics", pNOTICE)
- << "Generating kinematics uniformly over the allowed phase space";
+ << "Generating kinematics uniformly over the allowed phase space";
}
- //-- Access cross section algorithm for running thread
- RunningThreadInfo * rtinfo = RunningThreadInfo::Instance();
- const EventGeneratorI * evg = rtinfo->RunningThread();
+ const Interaction *interaction = evrec->Summary();
+ const XclsTag &xcls = interaction->ExclTag();
+
+ RunningThreadInfo *rtinfo = RunningThreadInfo::Instance();
+ const EventGeneratorI *evg = rtinfo->RunningThread();
fXSecModel = evg->CrossSectionAlg();
- if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
- CalculateKin_ReinSehgal(evrec);
- } else if (fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015") {
- CalculateKin_BergerSehgal(evrec);
- } else if (fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015") {
- CalculateKin_BergerSehgalFM(evrec);
- } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
- CalculateKin_AlvarezRuso(evrec);
- }
- else {
- LOG("COHKinematicsGenerator",pFATAL) <<
- "ProcessEventRecord >> Cannot calculate kinematics for " <<
- fXSecModel->Id().Name();
+
+ if (xcls.NPions() == 1) {
+
+ //-- Access cross section algorithm for running thread
+ if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
+ CalculateKin_ReinSehgal(evrec);
+ } else if (fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015") {
+ CalculateKin_BergerSehgal(evrec);
+ } else if (fXSecModel->Id().Name() ==
+ "genie::BergerSehgalFMCOHPiPXSec2015") {
+ CalculateKin_BergerSehgalFM(evrec);
+ } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
+ CalculateKin_AlvarezRuso(evrec);
+ } else {
+ LOG("COHPionKinematicsGenerator", pFATAL)
+ << "ProcessEventRecord >> Cannot calculate kinematics for "
+ << fXSecModel->Id().Name();
+ }
}
}
//___________________________________________________________________________
-void COHKinematicsGenerator::CalculateKin_BergerSehgal(GHepRecord * evrec) const
-{
+void COHPionKinematicsGenerator::CalculateKin_BergerSehgal(
+ GHepRecord *evrec) const {
// Get the Primary Interacton object
- Interaction * interaction = evrec->Summary();
+ Interaction *interaction = evrec->Summary();
interaction->SetBit(kISkipProcessChk);
- interaction->SetBit(kISkipKinematicChk); // TODO: Why turn this off?
+ interaction->SetBit(kISkipKinematicChk); // TODO: Why turn this off?
// Initialise a random number generator
- RandomGen * rnd = RandomGen::Instance();
+ RandomGen *rnd = RandomGen::Instance();
//-- For the subsequent kinematic selection with the rejection method:
// Calculate the max differential cross section or retrieve it from the
@@ -102,35 +110,36 @@ void COHKinematicsGenerator::CalculateKin_BergerSehgal(GHepRecord * evrec) const
double xsec_max = this->MaxXSec(evrec);
//-- Get the kinematical limits for the generated x,y
- const KPhaseSpace & kps = interaction->PhaseSpace();
- Range1D_t y = kps.YLim();
- Range1D_t Q2(fQ2Min,fQ2Max);
- assert(y.min>0. && y.max>0. && y.min<1. && y.max<1. && y.minPhaseSpace();
+ Range1D_t y = kps.YLim();
+ Range1D_t Q2(fQ2Min, fQ2Max);
+ assert(y.min > 0. && y.max > 0. && y.min < 1. && y.max < 1. && y.min < y.max);
+
+ const double ymin = y.min + kASmallNum;
+ const double ymax = y.max - kASmallNum;
+ const double dy = ymax - ymin;
const double Q2min = Q2.min + kASmallNum;
const double Q2max = Q2.max - kASmallNum;
- const double dQ2 = Q2max - Q2min;
+ const double dQ2 = Q2max - Q2min;
unsigned int iter = 0;
- bool accept=false;
- double xsec=-1, gy=-1, gQ2=-1;
+ bool accept = false;
+ double xsec = -1, gy = -1, gQ2 = -1;
- while(1) {
+ while (1) {
iter++;
- if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
+ if (iter > kRjMaxIterations)
+ this->throwOnTooManyIterations(iter, evrec);
//-- Select unweighted kinematics using importance sampling method.
// TODO: The importance sampling envelope is not used. Currently,
// we just employ a standard rejection-method approach.
- gy = ymin + dy * rnd->RndKine().Rndm();
+ gy = ymin + dy * rnd->RndKine().Rndm();
gQ2 = Q2min + dQ2 * rnd->RndKine().Rndm();
- LOG("COHKinematics", pINFO) <<
- "Trying: Q^2 = " << gQ2 << ", y = " << gy; /* << ", t = " << gt; */
+ LOG("COHKinematics", pINFO)
+ << "Trying: Q^2 = " << gQ2 << ", y = " << gy; /* << ", t = " << gt; */
interaction->KinePtr()->Sety(gy);
interaction->KinePtr()->SetQ2(gQ2);
@@ -143,36 +152,39 @@ void COHKinematicsGenerator::CalculateKin_BergerSehgal(GHepRecord * evrec) const
accept = (xsec_max * rnd->RndKine().Rndm() < xsec);
//-- If the generated kinematics are accepted, finish-up module's job
- if(accept) {
- LOG("COHKinematics", pNOTICE)
- << "Selected: Q^2 = " << gQ2 << ", y = " << gy; /* << ", t = " << gt; */
-
- // the Berger-Sehgal COH cross section should be a triple differential cross section
- // d^2xsec/dQ2dydt where t is the the square of the 4p transfer to the
- // nucleus. The cross section used for kinematical selection should have
- // the t-dependence integrated out. The t-dependence is of the form
- // ~exp(-bt). Now that the x,y kinematical variables have been selected
- // we can generate a t using the t-dependence as a PDF.
- const InitialState & init_state = interaction->InitState();
- double Ev = init_state.ProbeE(kRfLab);
- double Epi = gy*Ev; // pion energy
- double Epi2 = TMath::Power(Epi,2);
- double pme2 = kPionMass2/Epi2;
- double gx = interaction->KinePtr()->x(); // utils::kinematics::Q2YtoX(Ev,kNucleonMass,gQ2,gy); // gQ2 / ( 2. * gy * kNucleonMass * Ev);
- double xME = kNucleonMass*gx/Epi;
- double tA = 1. + xME - 0.5*pme2;
+ if (accept) {
+ LOG("COHKinematics", pNOTICE) << "Selected: Q^2 = " << gQ2
+ << ", y = " << gy; /* << ", t = " << gt; */
+
+ // the Berger-Sehgal COH cross section should be a triple differential
+ // cross section d^2xsec/dQ2dydt where t is the the square of the 4p
+ // transfer to the nucleus. The cross section used for kinematical
+ // selection should have the t-dependence integrated out. The t-dependence
+ // is of the form ~exp(-bt). Now that the x,y kinematical variables have
+ // been selected we can generate a t using the t-dependence as a PDF.
+ const InitialState &init_state = interaction->InitState();
+ double Ev = init_state.ProbeE(kRfLab);
+ double Epi = gy * Ev; // pion energy
+ double Epi2 = TMath::Power(Epi, 2);
+ double pme2 = kPionMass2 / Epi2;
+ double gx = interaction->KinePtr()
+ ->x(); // utils::kinematics::Q2YtoX(Ev,kNucleonMass,gQ2,gy);
+ // // gQ2 / ( 2. * gy * kNucleonMass * Ev);
+ double xME = kNucleonMass * gx / Epi;
+ double tA = 1. + xME - 0.5 * pme2;
/* Range1D_t tl = kps.TLim(); // this becomes the bounds for t */
- double tB = TMath::Sqrt(1.+ 2*xME) * TMath::Sqrt(1.-pme2);
- double tmin = 2*Epi2 * (tA-tB);
- double tmax = 2*Epi2 * (tA+tB);
- double A = (double) init_state.Tgt().A();
- double A13 = TMath::Power(A,1./3.);
- double R = fRo * A13 * units::fermi; // nuclear radius
- double R2 = TMath::Power(R,2.);
- double b = 0.33333 * R2;
- double tsum = (TMath::Exp(-b*tmin) - TMath::Exp(-b*tmax))/b;
- double rt = tsum * rnd->RndKine().Rndm();
- double gt = -1.*TMath::Log(-1.*b*rt + TMath::Exp(-1.*b*tmin))/b;
+ double tB = TMath::Sqrt(1. + 2 * xME) * TMath::Sqrt(1. - pme2);
+ double tmin = 2 * Epi2 * (tA - tB);
+ double tmax = 2 * Epi2 * (tA + tB);
+ double A = (double)init_state.Tgt().A();
+ double A13 = TMath::Power(A, 1. / 3.);
+ double R = fRo * A13 * units::fermi; // nuclear radius
+ double R2 = TMath::Power(R, 2.);
+ double b = 0.33333 * R2;
+ double tsum = (TMath::Exp(-b * tmin) - TMath::Exp(-b * tmax)) / b;
+ double rt = tsum * rnd->RndKine().Rndm();
+ double gt =
+ -1. * TMath::Log(-1. * b * rt + TMath::Exp(-1. * b * tmin)) / b;
// TODO: If we re-install the fGenerateUniformly option, we
// would compute the event weight here.
@@ -194,18 +206,18 @@ void COHKinematicsGenerator::CalculateKin_BergerSehgal(GHepRecord * evrec) const
return;
}
- }// iterations
+ } // iterations
}
//___________________________________________________________________________
-void COHKinematicsGenerator::CalculateKin_BergerSehgalFM(GHepRecord * evrec) const
-{
+void COHPionKinematicsGenerator::CalculateKin_BergerSehgalFM(
+ GHepRecord *evrec) const {
// Get the Primary Interacton object
- Interaction * interaction = evrec->Summary();
+ Interaction *interaction = evrec->Summary();
interaction->SetBit(kISkipProcessChk);
interaction->SetBit(kISkipKinematicChk);
// Initialise a random number generator
- RandomGen * rnd = RandomGen::Instance();
+ RandomGen *rnd = RandomGen::Instance();
//-- For the subsequent kinematic selection with the rejection method:
// Calculate the max differential cross section or retrieve it from the
@@ -216,41 +228,42 @@ void COHKinematicsGenerator::CalculateKin_BergerSehgalFM(GHepRecord * evrec) con
double xsec_max = this->MaxXSec(evrec);
//-- Get the kinematical limits for the generated x,y
- const KPhaseSpace & kps = interaction->PhaseSpace();
- Range1D_t y = kps.YLim();
- Range1D_t Q2(fQ2Min,fQ2Max);
- assert(y.min>0. && y.max>0. && y.min<1. && y.max<1. && y.minPhaseSpace();
+ Range1D_t y = kps.YLim();
+ Range1D_t Q2(fQ2Min, fQ2Max);
+ assert(y.min > 0. && y.max > 0. && y.min < 1. && y.max < 1. && y.min < y.max);
+
+ const double ymin = y.min + kASmallNum;
+ const double ymax = y.max - kASmallNum;
+ const double dy = ymax - ymin;
const double Q2min = Q2.min + kASmallNum;
const double Q2max = Q2.max - kASmallNum;
- const double dQ2 = Q2max - Q2min;
- const double tmin = kASmallNum;
- const double tmax = fTMax - kASmallNum; // TODO: Choose realistic t bounds
- const double dt = tmax - tmin;
+ const double dQ2 = Q2max - Q2min;
+ const double tmin = kASmallNum;
+ const double tmax = fTMax - kASmallNum; // TODO: Choose realistic t bounds
+ const double dt = tmax - tmin;
//-- Try to select a valid (Q^2,y,t) triple.
unsigned int iter = 0;
- bool accept=false;
- double xsec=-1, gy=-1, gt=-1, gQ2=-1;
+ bool accept = false;
+ double xsec = -1, gy = -1, gt = -1, gQ2 = -1;
- while(1) {
+ while (1) {
iter++;
- if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
+ if (iter > kRjMaxIterations)
+ this->throwOnTooManyIterations(iter, evrec);
//-- Select unweighted kinematics using importance sampling method.
// TODO: The importance sampling envelope is not used. Currently,
// we just employ a standard rejection-method approach.
- gy = ymin + dy * rnd->RndKine().Rndm();
- gt = tmin + dt * rnd->RndKine().Rndm();
+ gy = ymin + dy * rnd->RndKine().Rndm();
+ gt = tmin + dt * rnd->RndKine().Rndm();
gQ2 = Q2min + dQ2 * rnd->RndKine().Rndm();
- LOG("COHKinematics", pINFO) <<
- "Trying: Q^2 = " << gQ2 << ", y = " << gy << ", t = " << gt;
+ LOG("COHKinematics", pINFO)
+ << "Trying: Q^2 = " << gQ2 << ", y = " << gy << ", t = " << gt;
interaction->KinePtr()->Sety(gy);
interaction->KinePtr()->Sett(gt);
@@ -263,9 +276,9 @@ void COHKinematicsGenerator::CalculateKin_BergerSehgalFM(GHepRecord * evrec) con
accept = (xsec_max * rnd->RndKine().Rndm() < xsec);
//-- If the generated kinematics are accepted, finish-up module's job
- if(accept) {
+ if (accept) {
LOG("COHKinematics", pNOTICE)
- << "Selected: Q^2 = " << gQ2 << ", y = " << gy << ", t = " << gt;
+ << "Selected: Q^2 = " << gQ2 << ", y = " << gy << ", t = " << gt;
// TODO: If we re-install the fGenerateUniformly option, we
// would compute the event weight here.
@@ -286,18 +299,18 @@ void COHKinematicsGenerator::CalculateKin_BergerSehgalFM(GHepRecord * evrec) con
return;
}
- }// iterations
+ } // iterations
}
//___________________________________________________________________________
-void COHKinematicsGenerator::CalculateKin_ReinSehgal(GHepRecord * evrec) const
-{
+void COHPionKinematicsGenerator::CalculateKin_ReinSehgal(
+ GHepRecord *evrec) const {
// Get the Primary Interacton object
- Interaction * interaction = evrec->Summary();
+ Interaction *interaction = evrec->Summary();
interaction->SetBit(kISkipProcessChk);
interaction->SetBit(kISkipKinematicChk);
//-- Get the random number generators
- RandomGen * rnd = RandomGen::Instance();
+ RandomGen *rnd = RandomGen::Instance();
//-- For the subsequent kinematic selection with the rejection method:
// Calculate the max differential cross section or retrieve it from the
@@ -308,28 +321,29 @@ void COHKinematicsGenerator::CalculateKin_ReinSehgal(GHepRecord * evrec) const
double xsec_max = (fGenerateUniformly) ? -1 : this->MaxXSec(evrec);
//-- Get the kinematical limits for the generated x,y
- const KPhaseSpace & kps = interaction->PhaseSpace();
+ const KPhaseSpace &kps = interaction->PhaseSpace();
Range1D_t y = kps.YLim();
- assert(y.min>0. && y.max>0. && y.min<1. && y.max<1. && y.min 0. && y.max > 0. && y.min < 1. && y.max < 1. && y.min < y.max);
const double xmin = kASmallNum;
- const double xmax = 1.- kASmallNum;
+ const double xmax = 1. - kASmallNum;
const double ymin = y.min + kASmallNum;
const double ymax = y.max - kASmallNum;
- const double dx = xmax - xmin;
- const double dy = ymax - ymin;
+ const double dx = xmax - xmin;
+ const double dy = ymax - ymin;
//------ Try to select a valid x,y pair
unsigned int iter = 0;
- bool accept=false;
- double xsec=-1, gx=-1, gy=-1;
+ bool accept = false;
+ double xsec = -1, gx = -1, gy = -1;
- while(1) {
+ while (1) {
iter++;
- if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
+ if (iter > kRjMaxIterations)
+ this->throwOnTooManyIterations(iter, evrec);
- if(fGenerateUniformly) {
+ if (fGenerateUniformly) {
//-- Generate a x,y pair uniformly in the kinematically allowed range.
gx = xmin + dx * rnd->RndKine().Rndm();
gy = ymin + dy * rnd->RndKine().Rndm();
@@ -337,16 +351,16 @@ void COHKinematicsGenerator::CalculateKin_ReinSehgal(GHepRecord * evrec) const
} else {
//-- Select unweighted kinematics using importance sampling method.
- if(iter==1) {
+ if (iter == 1) {
LOG("COHKinematics", pNOTICE) << "Initializing the sampling envelope";
double Ev = interaction->InitState().ProbeE(kRfLab);
- fEnvelope->SetRange(xmin,ymin,xmax,ymax);
+ fEnvelope->SetRange(xmin, ymin, xmax, ymax);
fEnvelope->SetParameter(0, xsec_max);
fEnvelope->SetParameter(1, Ev);
}
// Generate W,QD2 using the 2-D envelope as PDF
- fEnvelope->GetRandom2(gx,gy);
+ fEnvelope->GetRandom2(gx, gy);
}
LOG("COHKinematics", pINFO) << "Trying: x = " << gx << ", y = " << gy;
@@ -358,60 +372,59 @@ void COHKinematicsGenerator::CalculateKin_ReinSehgal(GHepRecord * evrec) const
xsec = fXSecModel->XSec(interaction, kPSxyfE);
//-- decide whether to accept the current kinematics
- if(!fGenerateUniformly) {
+ if (!fGenerateUniformly) {
double max = fEnvelope->Eval(gx, gy);
- double t = max * rnd->RndKine().Rndm();
+ double t = max * rnd->RndKine().Rndm();
this->AssertXSecLimits(interaction, xsec, max);
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
- LOG("COHKinematics", pDEBUG)
- << "xsec= " << xsec << ", J= 1, Rnd= " << t;
+ LOG("COHKinematics", pDEBUG) << "xsec= " << xsec << ", J= 1, Rnd= " << t;
#endif
- accept = (t0);
+ accept = (t < xsec);
+ } else {
+ accept = (xsec > 0);
}
//-- If the generated kinematics are accepted, finish-up module's job
- if(accept) {
- LOG("COHKinematics", pNOTICE) << "Selected: x = "<< gx << ", y = "<< gy;
+ if (accept) {
+ LOG("COHKinematics", pNOTICE) << "Selected: x = " << gx << ", y = " << gy;
- // the Rein-Sehgal COH cross section should be a triple differential cross section
- // d^2xsec/dxdydt where t is the the square of the 4p transfer to the
- // nucleus. The cross section used for kinematical selection should have
- // the t-dependence integrated out. The t-dependence is of the form
+ // the Rein-Sehgal COH cross section should be a triple differential cross
+ // section d^2xsec/dxdydt where t is the the square of the 4p transfer to
+ // the nucleus. The cross section used for kinematical selection should
+ // have the t-dependence integrated out. The t-dependence is of the form
// ~exp(-bt). Now that the x,y kinematical variables have been selected
// we can generate a t using the t-dependence as a PDF.
- const InitialState & init_state = interaction->InitState();
- double Ev = init_state.ProbeE(kRfLab);
- double Epi = gy*Ev; // pion energy
- double Epi2 = TMath::Power(Epi,2);
- double pme2 = kPionMass2/Epi2;
- double xME = kNucleonMass*gx/Epi;
- double tA = 1. + xME - 0.5*pme2;
- double tB = TMath::Sqrt(1.+ 2*xME) * TMath::Sqrt(1.-pme2);
- double tmin = 2*Epi2 * (tA-tB);
- double tmax = 2*Epi2 * (tA+tB);
- double A = (double) init_state.Tgt().A();
- double A13 = TMath::Power(A,1./3.);
- double R = fRo * A13 * units::fermi; // nuclear radius
- double R2 = TMath::Power(R,2.);
- double b = 0.33333 * R2;
- double tsum = (TMath::Exp(-b*tmin) - TMath::Exp(-b*tmax))/b;
- double rt = tsum * rnd->RndKine().Rndm();
- double gt = -1.*TMath::Log(-1.*b*rt + TMath::Exp(-1.*b*tmin))/b;
-
- LOG("COHKinematics", pNOTICE)
- << "Selected: t = "<< gt << ", from ["<< tmin << ", "<< tmax << "]";
+ const InitialState &init_state = interaction->InitState();
+ double Ev = init_state.ProbeE(kRfLab);
+ double Epi = gy * Ev; // pion energy
+ double Epi2 = TMath::Power(Epi, 2);
+ double pme2 = kPionMass2 / Epi2;
+ double xME = kNucleonMass * gx / Epi;
+ double tA = 1. + xME - 0.5 * pme2;
+ double tB = TMath::Sqrt(1. + 2 * xME) * TMath::Sqrt(1. - pme2);
+ double tmin = 2 * Epi2 * (tA - tB);
+ double tmax = 2 * Epi2 * (tA + tB);
+ double A = (double)init_state.Tgt().A();
+ double A13 = TMath::Power(A, 1. / 3.);
+ double R = fRo * A13 * units::fermi; // nuclear radius
+ double R2 = TMath::Power(R, 2.);
+ double b = 0.33333 * R2;
+ double tsum = (TMath::Exp(-b * tmin) - TMath::Exp(-b * tmax)) / b;
+ double rt = tsum * rnd->RndKine().Rndm();
+ double gt =
+ -1. * TMath::Log(-1. * b * rt + TMath::Exp(-1. * b * tmin)) / b;
+
+ LOG("COHKinematics", pNOTICE) << "Selected: t = " << gt << ", from ["
+ << tmin << ", " << tmax << "]";
// for uniform kinematics, compute an event weight as
// wght = (phase space volume)*(differential xsec)/(event total xsec)
- if(fGenerateUniformly) {
- double vol = y.max-y.min; // dx=1, dt: irrelevant
+ if (fGenerateUniformly) {
+ double vol = y.max - y.min; // dx=1, dt: irrelevant
double totxsec = evrec->XSec();
- double wght = (vol/totxsec)*xsec;
- LOG("COHKinematics", pNOTICE) << "Kinematics wght = "<< wght;
+ double wght = (vol / totxsec) * xsec;
+ LOG("COHKinematics", pNOTICE) << "Kinematics wght = " << wght;
// apply computed weight to the current event weight
wght *= evrec->Weight();
@@ -428,7 +441,7 @@ void COHKinematicsGenerator::CalculateKin_ReinSehgal(GHepRecord * evrec) const
interaction->KinePtr()->Sety(gy, true);
interaction->KinePtr()->Sett(gt, true);
interaction->KinePtr()->SetW(kPionMass, true);
- interaction->KinePtr()->SetQ2(2*kNucleonMass*gx*gy*Ev, true);
+ interaction->KinePtr()->SetQ2(2 * kNucleonMass * gx * gy * Ev, true);
interaction->KinePtr()->ClearRunningValues();
// set the cross section for the selected kinematics
@@ -436,20 +449,20 @@ void COHKinematicsGenerator::CalculateKin_ReinSehgal(GHepRecord * evrec) const
return;
}
- }// iterations
+ } // iterations
}
//___________________________________________________________________________
-void COHKinematicsGenerator::CalculateKin_AlvarezRuso(GHepRecord * evrec) const
-{
+void COHPionKinematicsGenerator::CalculateKin_AlvarezRuso(
+ GHepRecord *evrec) const {
LOG("COHKinematics", pNOTICE) << "Using AlvarezRuso Model";
// Get the Primary Interacton object
- Interaction * interaction = evrec->Summary();
+ Interaction *interaction = evrec->Summary();
interaction->SetBit(kISkipProcessChk);
interaction->SetBit(kISkipKinematicChk);
// Initialise a random number generator
- RandomGen * rnd = RandomGen::Instance();
+ RandomGen *rnd = RandomGen::Instance();
//-- For the subsequent kinematic selection with the rejection method:
// Calculate the max differential cross section or retrieve it from the
@@ -459,10 +472,14 @@ void COHKinematicsGenerator::CalculateKin_AlvarezRuso(GHepRecord * evrec) const
// space the max xsec is irrelevant
double xsec_max = (fGenerateUniformly) ? -1 : this->MaxXSec(evrec);
- //Set up limits of integration variables
+ // Set up limits of integration variables
// Primary lepton energy
const double E_l_min = interaction->FSPrimLepton()->Mass();
- const double E_l_max = interaction->InitStatePtr()->GetProbeP4(kRfLab)->E() - kPionMass;
+ const TLorentzVector *P4_nu = interaction->InitStatePtr()->GetProbeP4(kRfLab);
+ const double E_l_max = P4_nu->E() - kPionMass;
+ delete P4_nu;
+ P4_nu = nullptr;
+
// Primary lepton angle with respect to the beam axis
const double ctheta_l_min = 0.4;
const double ctheta_l_max = 1.0 - kASmallNum;
@@ -474,23 +491,25 @@ void COHKinematicsGenerator::CalculateKin_AlvarezRuso(GHepRecord * evrec) const
const double phi_max = (2.0 * kPi) - kASmallNum;
//
const double d_E_l = E_l_max - E_l_min;
- const double d_ctheta_l = ctheta_l_max - ctheta_l_min;
+ const double d_ctheta_l = ctheta_l_max - ctheta_l_min;
const double d_ctheta_pi = ctheta_pi_max - ctheta_pi_min;
const double d_phi = phi_max - phi_min;
//------ Try to select a valid set of kinematics
unsigned int iter = 0;
- bool accept=false;
- double xsec=-1, g_E_l=-1, g_theta_l=-1, g_phi_l=-1, g_theta_pi=-1, g_phi_pi=-1;
+ bool accept = false;
+ double xsec = -1, g_E_l = -1, g_theta_l = -1, g_phi_l = -1, g_theta_pi = -1,
+ g_phi_pi = -1;
double g_ctheta_l, g_ctheta_pi;
- while(1) {
+ while (1) {
iter++;
- if(iter > kRjMaxIterations) this->throwOnTooManyIterations(iter,evrec);
+ if (iter > kRjMaxIterations)
+ this->throwOnTooManyIterations(iter, evrec);
- //Select kinematic point
+ // Select kinematic point
g_E_l = E_l_min + d_E_l * rnd->RndKine().Rndm();
- g_ctheta_l = ctheta_l_min + d_ctheta_l * rnd->RndKine().Rndm();
+ g_ctheta_l = ctheta_l_min + d_ctheta_l * rnd->RndKine().Rndm();
g_ctheta_pi = ctheta_pi_min + d_ctheta_pi * rnd->RndKine().Rndm();
g_phi_l = phi_min + d_phi * rnd->RndKine().Rndm();
// random phi is relative to phi_l
@@ -498,76 +517,77 @@ void COHKinematicsGenerator::CalculateKin_AlvarezRuso(GHepRecord * evrec) const
g_theta_l = TMath::ACos(g_ctheta_l);
g_theta_pi = TMath::ACos(g_ctheta_pi);
- LOG("COHKinematics", pINFO) << "Trying: Lep(" <SetKinematics(g_E_l, g_theta_l, g_phi_l, g_theta_pi, g_phi_pi,
interaction, interaction->KinePtr());
// computing cross section for the current kinematics
- xsec = fXSecModel->XSec(interaction,kPSElOlOpifE) / (1E-38 * units::cm2);
+ xsec = fXSecModel->XSec(interaction, kPSElOlOpifE) / (1E-38 * units::cm2);
if (!fGenerateUniformly) {
//-- decide whether to accept the current kinematics
- double t = xsec_max * rnd->RndKine().Rndm();
+ double t = xsec_max * rnd->RndKine().Rndm();
- LOG("COHKinematics", pINFO) << "Got: xsec = " << xsec << ", t = " <<
- t << " (max_xsec = " << xsec_max << ")";
+ LOG("COHKinematics", pINFO) << "Got: xsec = " << xsec << ", t = " << t
+ << " (max_xsec = " << xsec_max << ")";
this->AssertXSecLimits(interaction, xsec, xsec_max);
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
- LOG("COHKinematics", pDEBUG)
- << "xsec= " << xsec << ", J= 1, Rnd= " << t;
+ LOG("COHKinematics", pDEBUG) << "xsec= " << xsec << ", J= 1, Rnd= " << t;
#endif
- accept = (t0);
+ accept = (t < xsec);
+ } else {
+ accept = (xsec > 0);
}
//-- If the generated kinematics are accepted, finish-up module's job
- if(accept) {
- LOG("COHKinematics", pNOTICE) << "Selected: Lepton(" <<
- g_E_l << ", " << g_theta_l << ", " <<
- g_phi_l << ") Pion(" << g_theta_pi << ", " << g_phi_pi << ")";
+ if (accept) {
+ LOG("COHKinematics", pNOTICE)
+ << "Selected: Lepton(" << g_E_l << ", " << g_theta_l << ", "
+ << g_phi_l << ") Pion(" << g_theta_pi << ", " << g_phi_pi << ")";
double E_l = g_E_l;
double theta_l = g_theta_l;
double theta_pi = g_theta_pi;
double phi_l = g_phi_l;
double phi_pi = g_phi_pi;
- const TLorentzVector P4_nu = *(interaction->InitStatePtr()->GetProbeP4(kRfLab));
- double E_nu = P4_nu.E();
- double E_pi= E_nu-E_l;
+ P4_nu = interaction->InitStatePtr()->GetProbeP4(kRfLab);
+ double E_nu = P4_nu->E();
+ double E_pi = E_nu - E_l;
double m_l = interaction->FSPrimLepton()->Mass();
double m_pi = this->pionMass(interaction);
- double p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
- TVector3 lepton_3vector = TVector3(0,0,0);
- lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
- TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
+ double p_l = TMath::Sqrt(E_l * E_l - m_l * m_l);
+ TVector3 lepton_3vector = TVector3(0, 0, 0);
+ lepton_3vector.SetMagThetaPhi(p_l, theta_l, phi_l);
+ TLorentzVector P4_lep = TLorentzVector(lepton_3vector, E_l);
- double p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
- TVector3 pion_3vector = TVector3(0,0,0);
- pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
- TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
+ double p_pi = TMath::Sqrt(E_pi * E_pi - m_pi * m_pi);
+ TVector3 pion_3vector = TVector3(0, 0, 0);
+ pion_3vector.SetMagThetaPhi(p_pi, theta_pi, phi_pi);
+ TLorentzVector P4_pion = TLorentzVector(pion_3vector, E_pi);
- TLorentzVector q = P4_nu - P4_lep;
+ TLorentzVector q = *P4_nu - P4_lep;
double Q2 = -q.Mag2();
- double x = Q2/(2*E_pi*constants::kNucleonMass);
- double y = E_pi/E_nu;
+ double x = Q2 / (2 * E_pi * constants::kNucleonMass);
+ double y = E_pi / E_nu;
- double t = TMath::Abs( (q - P4_pion).Mag2() );
+ delete P4_nu;
+ P4_nu = nullptr;
+
+ double t = TMath::Abs((q - P4_pion).Mag2());
// for uniform kinematics, compute an event weight as
// wght = (phase space volume)*(differential xsec)/(event total xsec)
- if(fGenerateUniformly) {
+ if (fGenerateUniformly) {
// Phase space volume needs checking
- double vol = d_E_l*d_ctheta_l*d_phi*d_ctheta_pi*d_phi;
+ double vol = d_E_l * d_ctheta_l * d_phi * d_ctheta_pi * d_phi;
double totxsec = evrec->XSec();
- double wght = (vol/totxsec)*xsec;
- LOG("COHKinematics", pNOTICE) << "Kinematics wght = "<< wght;
+ double wght = (vol / totxsec) * xsec;
+ LOG("COHKinematics", pNOTICE) << "Kinematics wght = " << wght;
// apply computed weight to the current event weight
wght *= evrec->Weight();
@@ -583,79 +603,81 @@ void COHKinematicsGenerator::CalculateKin_AlvarezRuso(GHepRecord * evrec) const
interaction->KinePtr()->Sety(y, true);
interaction->KinePtr()->Sett(t, true);
interaction->KinePtr()->SetW(kPionMass, true);
- interaction->KinePtr()->SetQ2(2*kNucleonMass*x*y*E_nu, true);
+ interaction->KinePtr()->SetQ2(2 * kNucleonMass * x * y * E_nu, true);
interaction->KinePtr()->ClearRunningValues();
// set the cross section for the selected kinematics
- evrec->SetDiffXSec(xsec,kPSElOlOpifE);
+ evrec->SetDiffXSec(xsec, kPSElOlOpifE);
return;
}
- }//while
+ } // while
}
//___________________________________________________________________________
-void COHKinematicsGenerator::SetKinematics(const double E_l,
- const double theta_l,
- const double phi_l,
- const double theta_pi,
- const double phi_pi,
- const Interaction* interaction,
- Kinematics* kinematics) const
-{
- const TLorentzVector P4_nu = *(interaction->InitStatePtr()->GetProbeP4(kRfLab));
- double E_nu = P4_nu.E();
- double E_pi= E_nu-E_l;
+void COHPionKinematicsGenerator::SetKinematics(
+ const double E_l, const double theta_l, const double phi_l,
+ const double theta_prod, const double phi_prod,
+ const Interaction *interaction, Kinematics *kinematics) const {
+
+ double E_nu = interaction->InitStatePtr()->ProbeE(kRfLab);
+ const TLorentzVector P4_nu(0., 0., E_nu, E_nu);
+
double m_l = interaction->FSPrimLepton()->Mass();
- double m_pi;
- if ( interaction->ProcInfo().IsWeakCC() ) {
- m_pi = constants::kPionMass;
- } else {
- m_pi = constants::kPi0Mass;
- }
- double p_l=0.0;
- if (E_l > m_l) {
- p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
- }
- TVector3 lepton_3vector = TVector3(0,0,0);
- lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
- TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
+ double p_l = TMath::Sqrt(E_l * E_l - m_l * m_l);
+
+ TVector3 lepton_3vector = TVector3(0, 0, 0);
+ lepton_3vector.SetMagThetaPhi(p_l, theta_l, phi_l);
+ TLorentzVector P4_lep = TLorentzVector(lepton_3vector, E_l);
+
+ double E_prod = E_nu - E_l;
+ double m_prod = -1.;
+ // need to check if photon or pion
+ // if pion, charged or neutral
+ if (interaction->ExclTagPtr()->NSingleGammas() > 0) {
+ m_prod = 0.0;
+ } else if (interaction->ExclTagPtr()->NPions() > 0) {
+ if (interaction->ProcInfo().IsWeakCC()) {
+ m_prod = constants::kPionMass;
+ } else {
+ m_prod = constants::kPi0Mass;
+ }
+ } // else if Pion production
- double p_pi=0.0;
- if (E_pi > m_pi) {
- p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
- }
- TVector3 pion_3vector = TVector3(0,0,0);
- pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
- TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
+ double p_prod = TMath::Sqrt(E_prod * E_prod - m_prod * m_prod);
+ TVector3 prod_3vector = TVector3(0, 0, 0);
+ prod_3vector.SetMagThetaPhi(p_prod, theta_prod, phi_prod);
+ TLorentzVector P4_prod = TLorentzVector(prod_3vector, E_prod);
- double Q2 = -(P4_nu-P4_lep).Mag2();
- double x = Q2/(2*E_pi*constants::kNucleonMass);
- double y = E_pi/E_nu;
+ double Q2 = -(P4_nu - P4_lep).Mag2();
+ double x = Q2 / (2 * E_prod * constants::kNucleonMass);
+ double y = E_prod / E_nu;
kinematics->Setx(x);
kinematics->Sety(y);
kinematics::UpdateWQ2FromXY(interaction);
- kinematics->SetFSLeptonP4(P4_lep );
- kinematics->SetHadSystP4 (P4_pion); // use Hadronic System variable to store pion momentum
+ kinematics->SetFSLeptonP4(P4_lep);
+ kinematics->SetHadSystP4(P4_prod); // use Hadronic System variable to store
+ // producted particle momentum
}
//___________________________________________________________________________
-bool COHKinematicsGenerator::CheckKinematics(const double E_l,
- const double /* theta_l */ ,
- const double /* phi_l */ ,
- const double /* theta_pi */ ,
- const double /* phi_pi */ ,
- const Interaction* interaction) const
-{
- const TLorentzVector P4_nu = *(interaction->InitStatePtr()->GetProbeP4(kRfLab));
- double E_nu = P4_nu.E();
- double E_pi= E_nu-E_l;
+bool COHPionKinematicsGenerator::CheckKinematics(
+ const double E_l, const double /* theta_l */,
+ const double /* phi_l */, const double /* theta_pi */,
+ const double /* phi_pi */, const Interaction *interaction) const {
+ const TLorentzVector *P4_nu = interaction->InitStatePtr()->GetProbeP4(kRfLab);
+ double E_nu = P4_nu->E();
+ double E_pi = E_nu - E_l;
double m_l = interaction->FSPrimLepton()->Mass();
double m_pi;
- if ( interaction->ProcInfo().IsWeakCC() ) {
+
+ delete P4_nu;
+ P4_nu = nullptr;
+
+ if (interaction->ProcInfo().IsWeakCC()) {
m_pi = constants::kPionMass;
- }
- else {
+ } else {
m_pi = constants::kPi0Mass;
}
+
if (E_l <= m_l) {
return false;
}
@@ -665,8 +687,7 @@ bool COHKinematicsGenerator::CheckKinematics(const double E_l,
return true;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::ComputeMaxXSec(const Interaction * in) const
-{
+double COHPionKinematicsGenerator::ComputeMaxXSec(const Interaction *in) const {
// Computes the maximum differential cross section in the requested phase
// space. This method overloads KineGeneratorWithCache::ComputeMaxXSec
// method and the value is cached at a circular cache branch for retrieval
@@ -674,22 +695,30 @@ double COHKinematicsGenerator::ComputeMaxXSec(const Interaction * in) const
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("COHKinematics", pDEBUG)
- << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
+ << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
#endif
+
double max_xsec = 0.;
- if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
- max_xsec = MaxXSec_ReinSehgal(in);
- } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015")) {
- max_xsec = MaxXSec_BergerSehgal(in);
- } else if ((fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015")) {
- max_xsec = MaxXSec_BergerSehgalFM(in);
- } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
- max_xsec = MaxXSec_AlvarezRuso(in);
- }
- else {
- LOG("COHKinematicsGenerator",pFATAL) <<
- "ComputeMaxXSec >> Cannot calculate max cross-section for " <<
- fXSecModel->Id().Name();
+
+ const XclsTag &xcls = in->ExclTag();
+
+ if (xcls.NPions() == 1) {
+
+ if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
+ max_xsec = MaxXSec_ReinSehgal(in);
+ } else if ((fXSecModel->Id().Name() ==
+ "genie::BergerSehgalCOHPiPXSec2015")) {
+ max_xsec = MaxXSec_BergerSehgal(in);
+ } else if ((fXSecModel->Id().Name() ==
+ "genie::BergerSehgalFMCOHPiPXSec2015")) {
+ max_xsec = MaxXSec_BergerSehgalFM(in);
+ } else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
+ max_xsec = MaxXSec_AlvarezRuso(in);
+ } else {
+ LOG("COHPionKinematicsGenerator", pFATAL)
+ << "ComputeMaxXSec >> Cannot calculate max cross-section for "
+ << fXSecModel->Id().Name();
+ }
}
// Apply safety factor, since value retrieved from the cache might
@@ -705,89 +734,90 @@ double COHKinematicsGenerator::ComputeMaxXSec(const Interaction * in) const
return max_xsec;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::MaxXSec_BergerSehgal(const Interaction * in) const
-{
+double
+COHPionKinematicsGenerator::MaxXSec_BergerSehgal(const Interaction *in) const {
double max_xsec = 0;
- const int NQ2 = 50;
- const int Ny = 50;
+ const int NQ2 = 50;
+ const int Ny = 50;
- const KPhaseSpace & kps = in->PhaseSpace();
+ const KPhaseSpace &kps = in->PhaseSpace();
Range1D_t Q2r = kps.Q2Lim();
Q2r.max = fQ2Max;
const double logQ2min = TMath::Log10(Q2r.min + kASmallNum);
const double logQ2max = TMath::Log10(Q2r.max);
- const double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
+ const double dlogQ2 = (logQ2max - logQ2min) / (NQ2 - 1);
- for(int i=0; iKinePtr()->SetQ2(Q2);
Range1D_t yr = kps.YLim();
- if ((yr.max < 0) || (yr.max < yr.min) ||
- (yr.max > 1) || (yr.min < 0)) { // forbidden kinematics
+ if ((yr.max < 0) || (yr.max < yr.min) || (yr.max > 1) ||
+ (yr.min < 0)) { // forbidden kinematics
continue;
}
- const double logymin = TMath::Log10(yr.min);
- const double logymax = TMath::Log10(yr.max);
- const double dlogy = (logymax - logymin) /(Ny-1);
+ const double logymin = TMath::Log10(yr.min);
+ const double logymax = TMath::Log10(yr.max);
+ const double dlogy = (logymax - logymin) / (Ny - 1);
- for(int j=0; jKinePtr()->Sety(gy);
- /* Range1D_t tl = kps.TLim(); // TESTING! - this becomes a loop over t */
+ /* Range1D_t tl = kps.TLim(); // TESTING! - this becomes a loop over t
+ */
kinematics::UpdateXFromQ2Y(in);
// Note: We're not stepping through log Q^2, log y - we "unpacked"
double xsec = fXSecModel->XSec(in, kPSQ2yfE);
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
- LOG("COHKinematics", pDEBUG)
- << "xsec(Q2= " << Q2 << ", y= " << gy << ", t = " << gt << ") = " << xsec;
+ LOG("COHKinematics", pDEBUG) << "xsec(Q2= " << Q2 << ", y= " << gy
+ << ", t = " << gt << ") = " << xsec;
#endif
max_xsec = TMath::Max(max_xsec, xsec);
} // y
- } // Q2
+ } // Q2
return max_xsec;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::MaxXSec_BergerSehgalFM(const Interaction * in) const
-{
+double COHPionKinematicsGenerator::MaxXSec_BergerSehgalFM(
+ const Interaction *in) const {
double max_xsec = 0;
// How many sampling bins in each variable for max xsec calculation?
- const int NQ2 = 50;
- const int Ny = 50;
- const int Nt = 50;
+ const int NQ2 = 50;
+ const int Ny = 50;
+ const int Nt = 50;
- const KPhaseSpace & kps = in->PhaseSpace();
+ const KPhaseSpace &kps = in->PhaseSpace();
Range1D_t Q2r = kps.Q2Lim();
Q2r.max = fQ2Max;
const double logQ2min = TMath::Log10(Q2r.min + kASmallNum);
const double logQ2max = TMath::Log10(Q2r.max);
- const double logtmin = TMath::Log10(kASmallNum);
- const double logtmax = TMath::Log10(fTMax - kASmallNum);
- const double dlogQ2 = (logQ2max - logQ2min) /(NQ2-1);
- const double dlogt = (logtmax - logtmin) /(Nt-1);
+ const double logtmin = TMath::Log10(kASmallNum);
+ const double logtmax = TMath::Log10(fTMax - kASmallNum);
+ const double dlogQ2 = (logQ2max - logQ2min) / (NQ2 - 1);
+ const double dlogt = (logtmax - logtmin) / (Nt - 1);
- for(int i=0; iKinePtr()->SetQ2(Q2);
Range1D_t yr = kps.YLim();
- if ((yr.max < 0) || (yr.max < yr.min) ||
- (yr.max > 1) || (yr.min < 0)) { // forbidden kinematics
+ if ((yr.max < 0) || (yr.max < yr.min) || (yr.max > 1) ||
+ (yr.min < 0)) { // forbidden kinematics
continue;
}
- const double logymin = TMath::Log10(yr.min);
- const double logymax = TMath::Log10(yr.max);
- const double dlogy = (logymax - logymin) /(Ny-1);
+ const double logymin = TMath::Log10(yr.min);
+ const double logymax = TMath::Log10(yr.max);
+ const double dlogy = (logymax - logymin) / (Ny - 1);
- for(int j=0; jKinePtr()->Sety(gy);
@@ -795,26 +825,26 @@ double COHKinematicsGenerator::MaxXSec_BergerSehgalFM(const Interaction * in) co
double xsec = fXSecModel->XSec(in, kPSxyfE);
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
- LOG("COHKinematics", pDEBUG)
- << "xsec(Q2= " << Q2 << ", y= " << gy << ", t = " << gt << ") = " << xsec;
+ LOG("COHKinematics", pDEBUG) << "xsec(Q2= " << Q2 << ", y= " << gy
+ << ", t = " << gt << ") = " << xsec;
#endif
max_xsec = TMath::Max(max_xsec, xsec);
} // t
- } // y
- } // Q2
+ } // y
+ } // Q2
return max_xsec;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::MaxXSec_ReinSehgal(const Interaction * in) const
-{
+double
+COHPionKinematicsGenerator::MaxXSec_ReinSehgal(const Interaction *in) const {
double max_xsec = 0;
double Ev = in->InitState().ProbeE(kRfLab);
const int Nx = 50;
const int Ny = 50;
- const KPhaseSpace & kps = in->PhaseSpace();
+ const KPhaseSpace &kps = in->PhaseSpace();
Range1D_t y = kps.YLim();
const double logxmin = TMath::Log10(1E-5);
@@ -822,16 +852,17 @@ double COHKinematicsGenerator::MaxXSec_ReinSehgal(const Interaction * in) const
const double logymin = TMath::Log10(y.min);
const double logymax = TMath::Log10(y.max);
- const double dlogx = (logxmax - logxmin) /(Nx-1);
- const double dlogy = (logymax - logymin) /(Ny-1);
+ const double dlogx = (logxmax - logxmin) / (Nx - 1);
+ const double dlogy = (logymax - logymin) / (Ny - 1);
- for(int i=0; i1.0 && Q2>0.01) continue;
+ double Q2 = 2 * kNucleonMass * gx * gy * Ev;
+ if (Ev > 1.0 && Q2 > 0.01)
+ continue;
in->KinePtr()->Setx(gx);
in->KinePtr()->Sety(gy);
@@ -839,17 +870,17 @@ double COHKinematicsGenerator::MaxXSec_ReinSehgal(const Interaction * in) const
double xsec = fXSecModel->XSec(in, kPSxyfE);
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
LOG("COHKinematics", pDEBUG)
- << "xsec(x= " << gx << ", y= " << gy << ") = " << xsec;
+ << "xsec(x= " << gx << ", y= " << gy << ") = " << xsec;
#endif
max_xsec = TMath::Max(max_xsec, xsec);
- }//y
- }//x
+ } // y
+ } // x
return max_xsec;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::MaxXSec_AlvarezRuso(const Interaction * in) const
-{
+double
+COHPionKinematicsGenerator::MaxXSec_AlvarezRuso(const Interaction *in) const {
// Computes the maximum differential cross section in the requested phase
// space. This method overloads KineGeneratorWithCache::ComputeMaxXSec
// method and the value is cached at a circular cache branch for retrieval
@@ -857,19 +888,20 @@ double COHKinematicsGenerator::MaxXSec_AlvarezRuso(const Interaction * in) const
#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
SLOG("COHKinematics", pDEBUG)
- << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
+ << "Scanning the allowed phase space {K} for the max(dxsec/d{K})";
#endif
double max_xsec = 0.;
double Ev = in->InitState().ProbeE(kRfLab);
- const KPhaseSpace & kps = in->PhaseSpace();
+ const KPhaseSpace &kps = in->PhaseSpace();
Range1D_t y = kps.YLim();
- ROOT::Math::Minimizer * min = ROOT::Math::Factory::CreateMinimizer("Minuit2");
- gsl::d4Xsec_dEldThetaldOmegapi f(fXSecModel,in);
- f.SetFactor(-1.); // Make it return negative of cross-section so we can minimize
+ ROOT::Math::Minimizer *min = ROOT::Math::Factory::CreateMinimizer("Minuit2");
+ gsl::d4Xsec_dEldThetaldOmegapi f(fXSecModel, in);
+ f.SetFactor(
+ -1.); // Make it return negative of cross-section so we can minimize
- min->SetFunction( f );
+ min->SetFunction(f);
min->SetMaxFunctionCalls(10000);
min->SetTolerance(0.05);
@@ -891,17 +923,21 @@ double COHKinematicsGenerator::MaxXSec_AlvarezRuso(const Interaction * in) const
//~ const double min_phipi = kPi;
//~ const double max_phipi = 0.5 * kPi;
const double min_phipi = kASmallNum;
- const double max_phipi = 2*kPi-kASmallNum;
+ const double max_phipi = 2 * kPi - kASmallNum;
const unsigned int n_phipi = 10;
const double d_phipi = (max_phipi - min_phipi) / double(n_phipi - 1);
- min->SetLimitedVariable ( 0 ,"E_lep" , max_el -kASmallNum , d_el , min_el , max_el );
- min->SetLimitedVariable ( 1 ,"theta_l" , min_thetal +kASmallNum , d_thetal , min_thetal , max_thetal );
- min->SetLimitedVariable ( 2 ,"theta_pi" , min_thetapi+kASmallNum , d_thetapi , min_thetapi, max_thetapi );
- min->SetLimitedVariable ( 3 ,"phi_pi" , min_phipi +kASmallNum , d_phipi , min_phipi , max_phipi );
+ min->SetLimitedVariable(0, "E_lep", max_el - kASmallNum, d_el, min_el,
+ max_el);
+ min->SetLimitedVariable(1, "theta_l", min_thetal + kASmallNum, d_thetal,
+ min_thetal, max_thetal);
+ min->SetLimitedVariable(2, "theta_pi", min_thetapi + kASmallNum, d_thetapi,
+ min_thetapi, max_thetapi);
+ min->SetLimitedVariable(3, "phi_pi", min_phipi + kASmallNum, d_phipi,
+ min_phipi, max_phipi);
min->Minimize();
- max_xsec = -min->MinValue(); //back to positive xsec
+ max_xsec = -min->MinValue(); // back to positive xsec
// Apply safety factor, since value retrieved from the cache might
// correspond to a slightly different energy.
@@ -918,20 +954,19 @@ double COHKinematicsGenerator::MaxXSec_AlvarezRuso(const Interaction * in) const
return max_xsec;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::Energy(const Interaction * interaction) const
-{
+double
+COHPionKinematicsGenerator::Energy(const Interaction *interaction) const {
// Override the base class Energy() method to cache the max xsec for the
// neutrino energy in the LAB rather than in the hit nucleon rest frame.
- const InitialState & init_state = interaction->InitState();
+ const InitialState &init_state = interaction->InitState();
double E = init_state.ProbeE(kRfLab);
return E;
}
//___________________________________________________________________________
-double COHKinematicsGenerator::pionMass(const Interaction* in) const
-{
+double COHPionKinematicsGenerator::pionMass(const Interaction *in) const {
double m_pi = 0.0;
- if ( in->ProcInfo().IsWeakCC() ) {
+ if (in->ProcInfo().IsWeakCC()) {
m_pi = constants::kPionMass;
} else {
m_pi = constants::kPi0Mass;
@@ -939,12 +974,10 @@ double COHKinematicsGenerator::pionMass(const Interaction* in) const
return m_pi;
}
//___________________________________________________________________________
-void COHKinematicsGenerator::throwOnTooManyIterations(unsigned int iters,
- GHepRecord* evrec) const
-{
- LOG("COHKinematics", pWARN)
- << "*** Could not select valid kinematics after "
- << iters << " iterations";
+void COHPionKinematicsGenerator::throwOnTooManyIterations(
+ unsigned int iters, GHepRecord *evrec) const {
+ LOG("COHKinematics", pWARN) << "*** Could not select valid kinematics after "
+ << iters << " iterations";
evrec->EventFlags()->SetBitNumber(kKineGenErr, true);
genie::exceptions::EVGThreadException exception;
exception.SetReason("Couldn't select kinematics");
@@ -952,47 +985,54 @@ void COHKinematicsGenerator::throwOnTooManyIterations(unsigned int iters,
throw exception;
}
//___________________________________________________________________________
-void COHKinematicsGenerator::Configure(const Registry & config)
-{
+void COHPionKinematicsGenerator::Configure(const Registry &config) {
Algorithm::Configure(config);
this->LoadConfig();
}
//____________________________________________________________________________
-void COHKinematicsGenerator::Configure(string config)
-{
+void COHPionKinematicsGenerator::Configure(string config) {
Algorithm::Configure(config);
this->LoadConfig();
}
//____________________________________________________________________________
-void COHKinematicsGenerator::LoadConfig(void)
-{
+void COHPionKinematicsGenerator::LoadConfig(void) {
+
+ bool error = false;
+
//-- COH model parameter Ro
- GetParam( "COH-Ro", fRo );
+ GetParam("COH-Ro", fRo);
//-- COH model parameter t_max for t = (q - p_pi)^2
- GetParam( "COH-t-max", fTMax ) ;
+ GetParam("COH-t-max", fTMax);
//-- COH model bounds of integration for Q^2
- GetParam( "COH-Q2-min", fQ2Min ) ;
- GetParam( "COH-Q2-max", fQ2Max ) ;
+ GetParam("COH-Q2-min", fQ2Min);
+ GetParam("COH-Q2-max", fQ2Max);
//-- max xsec safety factor (for rejection method) and min cached energy
- GetParamDef( "MaxXSec-SafetyFactor", fSafetyFactor, 1.6 ) ;
- GetParamDef( "Cache-MinEnergy", fEMin, -1.0 ) ;
+ GetParamDef("MaxXSec-SafetyFactor", fSafetyFactor, 1.6);
+ GetParamDef("Cache-MinEnergy", fEMin, -1.0);
//-- Generate kinematics uniformly over allowed phase space and compute
// an event weight?
- GetParamDef( "UniformOverPhaseSpace", fGenerateUniformly, false ) ;
+ GetParamDef("UniformOverPhaseSpace", fGenerateUniformly, false);
//-- Maximum allowed fractional cross section deviation from maxim cross
// section used in rejection method
- GetParamDef( "MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999. ) ;
- assert(fMaxXSecDiffTolerance>=0);
+ GetParamDef("MaxXSec-DiffTolerance", fMaxXSecDiffTolerance, 999999.);
+ assert(fMaxXSecDiffTolerance >= 0);
//-- Envelope employed when importance sampling is used
// (initialize with dummy range)
- if(fEnvelope) delete fEnvelope;
- fEnvelope = new TF2("CohKinEnvelope",
- kinematics::COHImportanceSamplingEnvelope,0.,1,0.,1,2);
+ if (fEnvelope)
+ delete fEnvelope;
+ fEnvelope =
+ new TF2("CohKinEnvelope", kinematics::COHImportanceSamplingEnvelope, 0.,
+ 1, 0., 1, 2);
// stop ROOT from deleting this object of its own volition
gROOT->GetListOfFunctions()->Remove(fEnvelope);
+
+ if (error) {
+ LOG("COHKinematicsGenerator", pFATAL) << "Invalid configuration. Exiting";
+ exit(78);
+ }
}
//____________________________________________________________________________
diff --git a/src/Physics/Coherent/EventGen/COHKinematicsGenerator.h b/src/Physics/Coherent/EventGen/COHPionKinematicsGenerator.h
similarity index 89%
rename from src/Physics/Coherent/EventGen/COHKinematicsGenerator.h
rename to src/Physics/Coherent/EventGen/COHPionKinematicsGenerator.h
index 0e79657ed..aa3df89ff 100644
--- a/src/Physics/Coherent/EventGen/COHKinematicsGenerator.h
+++ b/src/Physics/Coherent/EventGen/COHPionKinematicsGenerator.h
@@ -1,7 +1,7 @@
//____________________________________________________________________________
/*!
-\class genie::COHKinematicsGenerator
+\class genie::COHPionKinematicsGenerator
\brief Generates values for the kinematic variables describing coherent
neutrino-nucleus pion production events.
@@ -17,22 +17,23 @@
*/
//____________________________________________________________________________
-#ifndef _COH_KINEMATICS_GENERATOR_H_
-#define _COH_KINEMATICS_GENERATOR_H_
+#ifndef _COH_PION_KINEMATICS_GENERATOR_H_
+#define _COH_PION_KINEMATICS_GENERATOR_H_
#include "Physics/Common/KineGeneratorWithCache.h"
#include "Framework/Utils/Range1.h"
+
class TF2;
namespace genie {
- class COHKinematicsGenerator : public KineGeneratorWithCache {
+ class COHPionKinematicsGenerator : public KineGeneratorWithCache {
public :
- COHKinematicsGenerator();
- COHKinematicsGenerator(string config);
- ~COHKinematicsGenerator();
+ COHPionKinematicsGenerator();
+ COHPionKinematicsGenerator(string config);
+ ~COHPionKinematicsGenerator();
// implement the EventRecordVisitorI interface
void ProcessEventRecord(GHepRecord * event_rec) const;
@@ -78,7 +79,9 @@ namespace genie {
double fQ2Min; ///< lower bound of integration for Q^2 in Berger-Sehgal Model
double fQ2Max; ///< upper bound of integration for Q^2 in Berger-Sehgal Model
double fTMax; ///< upper bound for t = (q - p_pi)^2
+
+
};
} // genie namespace
-#endif // _COH_KINEMATICS_GENERATOR_H_
+#endif // _COH_PION_KINEMATICS_GENERATOR_H_
diff --git a/src/Physics/Coherent/EventGen/COHPrimaryLeptonGenerator.cxx b/src/Physics/Coherent/EventGen/COHPrimaryLeptonGenerator.cxx
index dec269278..be2f15793 100644
--- a/src/Physics/Coherent/EventGen/COHPrimaryLeptonGenerator.cxx
+++ b/src/Physics/Coherent/EventGen/COHPrimaryLeptonGenerator.cxx
@@ -46,29 +46,56 @@ COHPrimaryLeptonGenerator::~COHPrimaryLeptonGenerator()
//___________________________________________________________________________
void COHPrimaryLeptonGenerator::ProcessEventRecord(GHepRecord * evrec) const
{
- //-- Access cross section algorithm for running thread
- RunningThreadInfo * rtinfo = RunningThreadInfo::Instance();
- const EventGeneratorI * evg = rtinfo->RunningThread();
- const XSecAlgorithmI *fXSecModel = evg->CrossSectionAlg();
+
+ const Interaction * interaction = evrec -> Summary() ;
+ const XclsTag & xcls = interaction -> ExclTag() ;
- // In Rein and Berger-Sehgal, no modification is required to the standard impl.
- if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
- PrimaryLeptonGenerator::ProcessEventRecord(evrec);
- }
- else if ((fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015")) {
- PrimaryLeptonGenerator::ProcessEventRecord(evrec);
- }
- else if ((fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015")) {
- PrimaryLeptonGenerator::ProcessEventRecord(evrec);
- }
- else if ((fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec")) {
- CalculatePrimaryLepton_AlvarezRuso(evrec);
+ if ( xcls.NPions() ==1 ) {
+
+ //-- Access cross section algorithm for running thread
+ RunningThreadInfo * rtinfo = RunningThreadInfo::Instance();
+ const EventGeneratorI * evg = rtinfo->RunningThread();
+ const XSecAlgorithmI *fXSecModel = evg->CrossSectionAlg();
+
+ // In Rein and Berger-Sehgal, no modification is required to the standard impl.
+ if (fXSecModel->Id().Name() == "genie::ReinSehgalCOHPiPXSec") {
+ PrimaryLeptonGenerator::ProcessEventRecord(evrec);
+ }
+ else if ((fXSecModel->Id().Name() == "genie::BergerSehgalCOHPiPXSec2015")) {
+ PrimaryLeptonGenerator::ProcessEventRecord(evrec);
+ }
+ else if ((fXSecModel->Id().Name() == "genie::BergerSehgalFMCOHPiPXSec2015")) {
+ PrimaryLeptonGenerator::ProcessEventRecord(evrec);
+ }
+ else if ( fXSecModel->Id().Name() == "genie::AlvarezRusoCOHPiPXSec" ) {
+ CalculatePrimaryLepton_AlvarezRuso(evrec);
+ }
+ else {
+ LOG("COHPrimaryLeptonGenerator",pFATAL) <<
+ "ProcessEventRecord >> Cannot calculate primary lepton for " <<
+ fXSecModel->Id().Name();
+ }
}
- else {
- LOG("COHPrimaryLeptonGenerator",pFATAL) <<
- "ProcessEventRecord >> Cannot calculate primary lepton for " <<
- fXSecModel->Id().Name();
+ else if ( xcls.NSingleGammas() == 1 ) {
+
+ const Kinematics & kinematics = interaction->Kine();
+
+ const TLorentzVector * nu_p4 = evrec->Probe() -> P4() ;
+ TVector3 nu_dir = nu_p4 -> Vect().Unit() ;
+
+ TVector3 lep_p3 = kinematics.FSLeptonP4().Vect();
+ lep_p3.RotateUz( nu_dir ) ;
+
+ TLorentzVector lep_p4( lep_p3, kinematics.FSLeptonP4().E() ) ;
+
+ int pdgc = interaction->FSPrimLepton()->PdgCode();
+
+ evrec -> AddParticle( pdgc, kIStStableFinalState,
+ evrec->ProbePosition(), -1, // mothers
+ -1, -1, // daughters
+ lep_p4, * evrec->Probe() -> X4() ) ;
}
+
}
//___________________________________________________________________________
void COHPrimaryLeptonGenerator::CalculatePrimaryLepton_AlvarezRuso(GHepRecord * evrec) const
diff --git a/src/Physics/Coherent/EventGen/LinkDef.h b/src/Physics/Coherent/EventGen/LinkDef.h
index a90535d2a..7a9dfba07 100644
--- a/src/Physics/Coherent/EventGen/LinkDef.h
+++ b/src/Physics/Coherent/EventGen/LinkDef.h
@@ -7,7 +7,8 @@
#pragma link C++ namespace genie;
#pragma link C++ class genie::COHInteractionListGenerator;
-#pragma link C++ class genie::COHKinematicsGenerator;
+#pragma link C++ class genie::COHPionKinematicsGenerator;
+#pragma link C++ class genie::COHGammaKinematicsGenerator;
#pragma link C++ class genie::COHPrimaryLeptonGenerator;
#pragma link C++ class genie::COHHadronicSystemGenerator;
diff --git a/src/Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.cxx b/src/Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.cxx
new file mode 100644
index 000000000..a2054982a
--- /dev/null
+++ b/src/Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.cxx
@@ -0,0 +1,331 @@
+//____________________________________________________________________________
+/*
+ Copyright (c) 2003-2019, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+
+ Author: Marco Roda
+ University of Liverpool
+ Jon Sensenig
+ University of Pennsylvania
+ July 2020
+ For the class documentation see the corresponding header file.
+
+*/
+//____________________________________________________________________________
+
+#include
+
+#include
+
+#include "Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.h"
+#include "Framework/Algorithm/AlgConfigPool.h"
+#include "Physics/XSectionIntegration/XSecIntegratorI.h"
+#include "Framework/Conventions/GBuild.h"
+#include "Framework/Conventions/Constants.h"
+#include "Framework/Conventions/Units.h"
+#include "Framework/Conventions/RefFrame.h"
+#include "Framework/Messenger/Messenger.h"
+#include "Framework/ParticleData/PDGCodes.h"
+#include "Framework/ParticleData/PDGUtils.h"
+#include "Framework/Utils/HadXSUtils.h"
+#include "Framework/Utils/KineUtils.h"
+
+
+
+using namespace genie;
+using namespace genie::constants;
+using namespace genie::utils;
+
+//____________________________________________________________________________
+AlvarezRusoSalaCOHGammaPXSec::AlvarezRusoSalaCOHGammaPXSec() :
+ XSecAlgorithmI("genie::AlvarezRusoSalaCOHGammaPXSec"),
+ fFormFactors( nullptr ),
+ fXSecIntegrator( nullptr )
+{ ; }
+
+//____________________________________________________________________________
+AlvarezRusoSalaCOHGammaPXSec::AlvarezRusoSalaCOHGammaPXSec(string config) :
+ XSecAlgorithmI("genie::AlvarezRusoSalaCOHGammaPXSec", config),
+ fFormFactors( nullptr ),
+ fXSecIntegrator( nullptr )
+{ ; }
+//____________________________________________________________________________
+AlvarezRusoSalaCOHGammaPXSec::~AlvarezRusoSalaCOHGammaPXSec()
+{ ; }
+//____________________________________________________________________________
+double AlvarezRusoSalaCOHGammaPXSec::XSec( const Interaction * interaction,
+ KinePhaseSpace_t kps ) const {
+
+ if(! this -> ValidProcess (interaction) ) return 0.;
+ if(! this -> ValidKinematics (interaction) ) return 0.;
+
+ if ( kps != kPSEgTlOgfE &&
+ kps != kPSEgTlTgPgfE &&
+ kps != kPSEgtTgPgfE &&
+ kps != kPSEgOlOgfE ) {
+
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pERROR )
+ << "Requested cross section with invalid phase space: " << KinePhaseSpace::AsString( kps ) ;
+ return 0. ;
+ } ;
+
+ // the form factor in this interaction is limited to a very narrow region
+ // the most efficient way to evaluate the cross section is to first evaluate
+ // the form factor(s) and only then, if they are not zero, proceed to the evaluation
+ // of the hadronic currents
+
+ const Kinematics & kinematics = interaction -> Kine();
+ double transferred_Q = sqrt( kinematics.t() ) ;
+ int pdg = interaction -> InitState().Tgt().Pdg() ;
+ double proton_ff = fFormFactors -> ProtonFF( transferred_Q, pdg ) ;
+ double neutron_ff = fFormFactors -> NeutronFF( transferred_Q, pdg ) ;
+
+ if ( proton_ff == 0. && neutron_ff == 0. ) return 0. ;
+
+ utils::math::GTraceContraction H( TotalHadronicCurrent( *interaction, proton_ff, neutron_ff ) ) ;
+
+ const InitialState & init_state = interaction -> InitState();
+
+ int nu = init_state.ProbePdg();
+ double contraction = pdg::IsNeutrino(nu) ?
+ NeutrinoHadronContraction( *interaction, H ) :
+ AntiNeutrinoHadronContraction( *interaction, H ) ;
+
+ double pre_factor = ( 4.*constants::kPi*constants::kAem * constants::kGF2 ) / ( 16*pow(2.*constants::kPi, 5) );
+
+ TLorentzVector gamma_p4 = kinematics.HadSystP4() ; // FS gamma momentum
+ TLorentzVector out_lep = kinematics.FSLeptonP4() ;
+
+ double diff_cross_section = pre_factor*contraction*( gamma_p4.E() * out_lep.E() / init_state.ProbeE(kRfLab) );
+
+ if ( kps == kPSEgOlOgfE ) return diff_cross_section ;
+
+ // the system is clearly invariant under z rotations -> phi_lepton translation.
+ // so that integral can be performed simply multiplying by 2 pi
+ diff_cross_section *= 2.*constants::kPi ;
+
+ // Jacobian for dsigma wrt to t
+ if ( kps == kPSEgtTgPgfE ) {
+ double dt_dcos = init_state.ProbeE(kRfLab)-gamma_p4.E()*( cos( gamma_p4.Theta() )-sin( gamma_p4.Theta() )*cos( gamma_p4.Phi()*( out_lep.Z()/out_lep.X() ) ) ) ;
+ diff_cross_section /= ( 2. * out_lep.E() * abs( dt_dcos ) ) ;
+ return diff_cross_section ;
+ }
+ // the remaining possible phase spaces are all functions of Theta_l instead of Cos Theta_l
+ // so the first jacobian correction can be applied here
+ // teh Jacobian simply being sin_Theta_l
+
+
+ diff_cross_section *= sin( out_lep.Theta() ) ;
+
+ if ( kps == kPSEgTlOgfE )
+ return diff_cross_section ;
+
+
+ // if kps == kPSEgTlTgPgfE
+ diff_cross_section *= sin( gamma_p4.Theta() ) ;
+ return diff_cross_section ;
+
+}
+//____________________________________________________________________________
+utils::math::GTrace
+AlvarezRusoSalaCOHGammaPXSec::TotalHadronicCurrent( const Interaction & interaction,
+ double proton_ff, double neutron_ff ) const {
+
+ // sum R's from all currents here
+ utils::math::GTrace R_total;
+ for ( unsigned int i = 0; i < fCurrents.size(); i++ ) {
+ R_total += fCurrents[i] -> R(interaction, proton_ff, neutron_ff );
+ }
+
+ return R_total;
+}
+//____________________________________________________________________________
+double AlvarezRusoSalaCOHGammaPXSec::Integral( const Interaction * interaction) const
+{
+ double xsec = fXSecIntegrator->Integrate(this,interaction);
+ return xsec;
+}
+//____________________________________________________________________________
+bool AlvarezRusoSalaCOHGammaPXSec::ValidProcess(const Interaction * interaction) const
+{
+ if(interaction->TestBit(kISkipProcessChk)) return true;
+
+ const InitialState & init_state = interaction->InitState();
+ int nu = init_state.ProbePdg();
+ if (!pdg::IsNeutrino(nu) && !pdg::IsAntiNeutrino(nu)) return false;
+
+ const ProcessInfo & proc_info = interaction->ProcInfo();
+
+ if ( ! proc_info.IsCoherentProduction() ) return false;
+ if ( ! proc_info.IsWeakNC() ) return false;
+
+ const Target & target = init_state.Tgt();
+ if ( target.A() <= 1 ) return false;
+ if ( ! fFormFactors -> HasNucleus( target.Pdg() ) ) return false ;
+
+ const XclsTag & xcls = interaction -> ExclTag() ;
+ if ( xcls.NSingleGammas() != 1 ) return false ;
+
+ return true;
+}
+//____________________________________________________________________________
+bool AlvarezRusoSalaCOHGammaPXSec::ValidKinematics(const Interaction * interaction) const
+{
+ if(interaction->TestBit(kISkipKinematicChk)) return true;
+
+ const KPhaseSpace& kps = interaction->PhaseSpace();
+
+ if ( ! kps.IsAllowed() ) {
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pDEBUG) << "*** Not in allowed kinematical space";
+ return false;
+ }
+
+ // The cross section is only valid in a small range of W
+ // From the target mass
+ // if we are outside of this range, the cross section is cut
+
+ if ( interaction -> Kine().W() > interaction -> InitState().Tgt().Mass() + fDeltaW )
+ return false ;
+
+ return true;
+}
+//____________________________________________________________________________
+double
+AlvarezRusoSalaCOHGammaPXSec::NeutrinoHadronContraction( const Interaction & i,
+ const utils::math::GTraceContraction & H ) const {
+
+ double k0 = i.InitState().ProbeE(kRfLab); // incident neutrino E
+ TLorentzVector probe( 0., 0., k0, k0 ) ;
+ TLorentzVector out_nu = i.Kine().FSLeptonP4();
+ TLorentzVector t_q = probe - out_nu; // in/out neutrino E difference
+ // FIXME not sure if q is exactly right
+ std::array q = { t_q.E(), t_q.X(), t_q.Y(), t_q.Z() }; // Z boson momentum??
+
+ std::complex lh = -8*k0*((2*k0 - q[0] - q[3])*H(0,0,0,0) + q[1]*H(0,0,0,1) - std::complex(0,1)*q[1]*H(0,0,0,2) +
+ (-2*k0 + q[0] + q[3])*H(0,0,0,3) + q[1]*H(0,1,0,0) + (-q[0] + q[3])*H(0,1,0,1) +
+ std::complex(0,1)*(q[0] - q[3])*H(0,1,0,2) - q[1]*H(0,1,0,3) + std::complex(0,1)*q[1]*H(0,2,0,0) -
+ std::complex(0,1)*(q[0] - q[3])*H(0,2,0,1) + (-q[0] + q[3])*H(0,2,0,2) - std::complex(0,1)*q[1]*H(0,2,0,3) +
+ (-2*k0 + q[0] + q[3])*H(0,3,0,0) - q[1]*H(0,3,0,1) + std::complex(0,1)*q[1]*H(0,3,0,2) +
+ (2*k0 - q[0] - q[3])*H(0,3,0,3) + (-2*k0 + q[0] + q[3])*H(1,0,1,0) - q[1]*H(1,0,1,1) +
+ std::complex(0,1)*q[1]*H(1,0,1,2) + (2*k0 - q[0] - q[3])*H(1,0,1,3) - q[1]*H(1,1,1,0) +
+ (q[0] - q[3])*H(1,1,1,1) - std::complex(0,1)*(q[0] - q[3])*H(1,1,1,2) + q[1]*H(1,1,1,3) -
+ std::complex(0,1)*q[1]*H(1,2,1,0) + std::complex(0,1)*(q[0] - q[3])*H(1,2,1,1) + (q[0] - q[3])*H(1,2,1,2) +
+ std::complex(0,1)*q[1]*H(1,2,1,3) + (2*k0 - q[0] - q[3])*H(1,3,1,0) + q[1]*H(1,3,1,1) -
+ std::complex(0,1)*q[1]*H(1,3,1,2) + (-2*k0 + q[0] + q[3])*H(1,3,1,3) + (-2*k0 + q[0] + q[3])*H(2,0,2,0) -
+ q[1]*H(2,0,2,1) + std::complex(0,1)*q[1]*H(2,0,2,2) + (2*k0 - q[0] - q[3])*H(2,0,2,3) - q[1]*H(2,1,2,0) +
+ (q[0] - q[3])*H(2,1,2,1) - std::complex(0,1)*(q[0] - q[3])*H(2,1,2,2) + q[1]*H(2,1,2,3) -
+ std::complex(0,1)*q[1]*H(2,2,2,0) + std::complex(0,1)*(q[0] - q[3])*H(2,2,2,1) + (q[0] - q[3])*H(2,2,2,2) +
+ std::complex(0,1)*q[1]*H(2,2,2,3) + (2*k0 - q[0] - q[3])*H(2,3,2,0) + q[1]*H(2,3,2,1) -
+ std::complex(0,1)*q[1]*H(2,3,2,2) + (-2*k0 + q[0] + q[3])*H(2,3,2,3) + (-2*k0 + q[0] + q[3])*H(3,0,3,0) -
+ q[1]*H(3,0,3,1) + std::complex(0,1)*q[1]*H(3,0,3,2) + (2*k0 - q[0] - q[3])*H(3,0,3,3) - q[1]*H(3,1,3,0) +
+ (q[0] - q[3])*H(3,1,3,1) - std::complex(0,1)*(q[0] - q[3])*H(3,1,3,2) + q[1]*H(3,1,3,3) -
+ std::complex(0,1)*q[1]*H(3,2,3,0) + std::complex(0,1)*(q[0] - q[3])*H(3,2,3,1) + (q[0] - q[3])*H(3,2,3,2) +
+ std::complex(0,1)*q[1]*H(3,2,3,3) + (2*k0 - q[0] - q[3])*H(3,3,3,0) + q[1]*H(3,3,3,1) -
+ std::complex(0,1)*q[1]*H(3,3,3,2) + (-2*k0 + q[0] + q[3])*H(3,3,3,3));
+ return lh.real();
+}
+//____________________________________________________________________________
+double
+AlvarezRusoSalaCOHGammaPXSec::AntiNeutrinoHadronContraction( const Interaction & i,
+ const utils::math::GTraceContraction & H ) const {
+
+ double k0 = i.InitState().ProbeE(kRfLab); // incident neutrino E
+ TLorentzVector probe( 0., 0., k0, k0 ) ;
+ TLorentzVector out_nu = i.Kine().FSLeptonP4();
+ TLorentzVector t_q = probe - out_nu; // in/out neutrino E difference
+ // FIXME not sure if q is exactly right
+ std::array q = { t_q.E(), t_q.X(), t_q.Y(), t_q.Z() }; // Z boson momentum??
+
+ std::complex lh = -8*k0*((2*k0 - q[0] - q[3])*H(0,0,0,0) + q[1]*H(0,0,0,1) + std::complex(0,1)*q[1]*H(0,0,0,2) +
+ (-2*k0 + q[0] + q[3])*H(0,0,0,3) + q[1]*H(0,1,0,0) + (-q[0] + q[3])*H(0,1,0,1) -
+ std::complex(0,1)*(q[0] - q[3])*H(0,1,0,2) - q[1]*H(0,1,0,3) - std::complex(0,1)*q[1]*H(0,2,0,0) +
+ std::complex(0,1)*(q[0] - q[3])*H(0,2,0,1) + (-q[0] + q[3])*H(0,2,0,2) + std::complex(0,1)*q[1]*H(0,2,0,3) +
+ (-2*k0 + q[0] + q[3])*H(0,3,0,0) - q[1]*H(0,3,0,1) - std::complex(0,1)*q[1]*H(0,3,0,2) +
+ (2*k0 - q[0] - q[3])*H(0,3,0,3) + (-2*k0 + q[0] + q[3])*H(1,0,1,0) - q[1]*H(1,0,1,1) -
+ std::complex(0,1)*q[1]*H(1,0,1,2) + (2*k0 - q[0] - q[3])*H(1,0,1,3) - q[1]*H(1,1,1,0) +
+ (q[0] - q[3])*H(1,1,1,1) + std::complex(0,1)*(q[0] - q[3])*H(1,1,1,2) + q[1]*H(1,1,1,3) +
+ std::complex(0,1)*q[1]*H(1,2,1,0) - std::complex(0,1)*(q[0] - q[3])*H(1,2,1,1) + (q[0] - q[3])*H(1,2,1,2) -
+ std::complex(0,1)*q[1]*H(1,2,1,3) + (2*k0 - q[0] - q[3])*H(1,3,1,0) + q[1]*H(1,3,1,1) +
+ std::complex(0,1)*q[1]*H(1,3,1,2) + (-2*k0 + q[0] + q[3])*H(1,3,1,3) + (-2*k0 + q[0] + q[3])*H(2,0,2,0) -
+ q[1]*H(2,0,2,1) - std::complex(0,1)*q[1]*H(2,0,2,2) + (2*k0 - q[0] - q[3])*H(2,0,2,3) - q[1]*H(2,1,2,0) +
+ (q[0] - q[3])*H(2,1,2,1) + std::complex(0,1)*(q[0] - q[3])*H(2,1,2,2) + q[1]*H(2,1,2,3) +
+ std::complex(0,1)*q[1]*H(2,2,2,0) - std::complex(0,1)*(q[0] - q[3])*H(2,2,2,1) + (q[0] - q[3])*H(2,2,2,2) -
+ std::complex(0,1)*q[1]*H(2,2,2,3) + (2*k0 - q[0] - q[3])*H(2,3,2,0) + q[1]*H(2,3,2,1) +
+ std::complex(0,1)*q[1]*H(2,3,2,2) + (-2*k0 + q[0] + q[3])*H(2,3,2,3) + (-2*k0 + q[0] + q[3])*H(3,0,3,0) -
+ q[1]*H(3,0,3,1) - std::complex(0,1)*q[1]*H(3,0,3,2) + (2*k0 - q[0] - q[3])*H(3,0,3,3) - q[1]*H(3,1,3,0) +
+ (q[0] - q[3])*H(3,1,3,1) + std::complex(0,1)*(q[0] - q[3])*H(3,1,3,2) + q[1]*H(3,1,3,3) +
+ std::complex(0,1)*q[1]*H(3,2,3,0) - std::complex(0,1)*(q[0] - q[3])*H(3,2,3,1) + (q[0] - q[3])*H(3,2,3,2) -
+ std::complex(0,1)*q[1]*H(3,2,3,3) + (2*k0 - q[0] - q[3])*H(3,3,3,0) + q[1]*H(3,3,3,1) +
+ std::complex(0,1)*q[1]*H(3,3,3,2) + (-2*k0 + q[0] + q[3])*H(3,3,3,3));
+ return lh.real();
+}
+//____________________________________________________________________________
+void AlvarezRusoSalaCOHGammaPXSec::Configure(const Registry & config)
+{
+ Algorithm::Configure(config);
+ this->LoadConfig();
+}
+//____________________________________________________________________________
+void AlvarezRusoSalaCOHGammaPXSec::Configure(string config)
+{
+ Algorithm::Configure(config);
+ this->LoadConfig();
+}
+//____________________________________________________________________________
+void AlvarezRusoSalaCOHGammaPXSec::LoadConfig(void)
+{
+
+ fCurrents.clear() ;
+ bool good_configuration = true ;
+
+ // load all the resonance specific currents
+ std::vector current_keys ;
+ GetParamVectKeys( "COH-HadronicCurrents", current_keys ) ;
+
+ for ( unsigned int i = 0 ; i < current_keys.size() ; ++i ) {
+
+ const Algorithm * algo = SubAlg( current_keys[i] ) ;
+
+ const COHHadronicCurrentI * current = dynamic_cast< const COHHadronicCurrentI * >( algo ) ;
+
+ if ( ! current ) {
+ good_configuration = false ;
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pERROR ) << "SubAlgo with key " << current_keys[i] << " not retrieved" ;
+ }
+ else {
+ fCurrents.push_back( current ) ;
+ }
+
+ }
+
+
+ //-- load the form factor
+ fFormFactors =
+ dynamic_cast (this->SubAlg("COH-FormFactor"));
+ if (! fFormFactors ) {
+ good_configuration = false ;
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pERROR ) << "Form factor not retrieved" ;
+ }
+
+
+ //-- load the differential cross section integrator
+ fXSecIntegrator =
+ dynamic_cast (this->SubAlg("XSec-Integrator"));
+ if ( ! fXSecIntegrator ) {
+ good_configuration = false ;
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pERROR ) << "Integrator not retrieved" ;
+ }
+
+
+ GetParam( "AsymptoticMaxGammaEnergy", fDeltaW );
+ if ( fDeltaW <= 0. ) {
+ good_configuration = false ;
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pERROR ) << "Delta W is negative" ;
+ }
+
+ if ( ! good_configuration ) {
+ LOG("AlvarezRusoSalaCOHGammaPXSec", pFATAL ) << "Bad configuration: exiting" ;
+ exit( 78 ) ;
+ }
+}
diff --git a/src/Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.h b/src/Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.h
new file mode 100644
index 000000000..2d3c8ba9f
--- /dev/null
+++ b/src/Physics/Coherent/XSection/AlvarezRusoSalaCOHGammaPXSec.h
@@ -0,0 +1,80 @@
+//____________________________________________________________________________
+/*!
+ \class genie::AlvarezRusoSalaCOHGammaPXSec
+
+ \brief Implementation of the Alvarez-Ruso Sala coherent gamma production model
+ Is a concrete implementation of the XSecAlgorithmI interface.
+
+\ref https://link.aps.org/doi/10.1103/PhysRevC.89.015503
+
+\author Marco Roda
+ University of Liverpool
+
+ Jon Sensenig
+ University of Pennsylvania
+
+\created July, 2020
+
+\cpright Copyright (c) 2003-2020, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+*/
+//____________________________________________________________________________
+
+#ifndef _ALVAREZ_RUSO_SALA_COH_GAMMA_XSEC_H_
+#define _ALVAREZ_RUSO_SALA_COH_GAMMA_XSEC_H_
+
+#include
+
+#include "Framework/EventGen/XSecAlgorithmI.h"
+#include "Physics/XSectionIntegration/XSecIntegratorI.h"
+
+#include "Physics/Coherent/XSection/COHHadronicCurrentI.h"
+#include "Physics/Coherent/XSection/COHFormFactorI.h"
+
+namespace genie {
+
+class AlvarezRusoSalaCOHGammaPXSec : public XSecAlgorithmI {
+
+public:
+ AlvarezRusoSalaCOHGammaPXSec();
+ AlvarezRusoSalaCOHGammaPXSec( string config );
+ virtual ~AlvarezRusoSalaCOHGammaPXSec();
+
+ //-- XSecAlgorithmI interface implementation
+
+ double XSec ( const Interaction * i, KinePhaseSpace_t k) const override ;
+ double Integral ( const Interaction * i) const override ;
+ bool ValidProcess ( const Interaction * i) const override ;
+ bool ValidKinematics ( const Interaction * i) const override ;
+
+
+
+ //-- overload the Algorithm::Configure() methods to load private data
+ // members from configuration options
+ void Configure(const Registry & config) override ;
+ void Configure(string config) override ;
+
+protected:
+ void LoadConfig(void);
+
+ utils::math::GTrace TotalHadronicCurrent ( const Interaction & interaction,
+ double proton_ff, double neutron_ff ) const;
+
+ double NeutrinoHadronContraction ( const Interaction & i, const utils::math::GTraceContraction & ) const ;
+ double AntiNeutrinoHadronContraction ( const Interaction & i, const utils::math::GTraceContraction & ) const ;
+
+private:
+
+ std::vector fCurrents ;
+ const COHFormFactorI * fFormFactors ;
+
+ const XSecIntegratorI * fXSecIntegrator;
+
+ double fDeltaW;
+
+};
+
+} // genie namespace
+
+#endif // _ALVAREZ_RUSO_SALA_COH_GAMMA_XSEC_H_
diff --git a/src/Physics/Coherent/XSection/COHDeltaCurrent.cxx b/src/Physics/Coherent/XSection/COHDeltaCurrent.cxx
new file mode 100644
index 000000000..1e9993723
--- /dev/null
+++ b/src/Physics/Coherent/XSection/COHDeltaCurrent.cxx
@@ -0,0 +1,812 @@
+//____________________________________________________________________________
+/*
+ Copyright (c) 2003-2019, The GENIE Collaboration
+ For the full text of the license visit http://copyright.genie-mc.org
+ or see $GENIE/LICENSE
+
+ Author: Marco Roda
+ University of Liverpool
+
+
+ For the class documentation see the corresponding header file.
+
+*/
+//____________________________________________________________________________
+
+#include "Framework/Messenger/Messenger.h"
+
+#include "Physics/Coherent/XSection/COHDeltaCurrent.h"
+
+using namespace genie;
+using namespace genie::utils::math;
+
+
+COHDeltaCurrent::COHDeltaCurrent() :
+ COHHadronicCurrentI("genie::COHDeltaCurrent")
+{
+
+}
+
+//____________________________________________________________________________
+COHDeltaCurrent::COHDeltaCurrent(string config) :
+ COHHadronicCurrentI("genie::COHDeltaCurrent", config)
+{
+
+}
+
+//____________________________________________________________________________
+COHDeltaCurrent::~COHDeltaCurrent()
+{
+
+}
+
+//____________________________________________________________________________
+void COHDeltaCurrent::Configure(const Registry & config)
+{
+ Algorithm::Configure(config);
+ this->LoadConfig();
+}
+
+//____________________________________________________________________________
+void COHDeltaCurrent::Configure(string config)
+{
+ Algorithm::Configure(config);
+ this->LoadConfig();
+}
+
+//____________________________________________________________________________
+void COHDeltaCurrent::LoadConfig(void)
+{
+
+ bool good_config = true ;
+
+ const Algorithm * delta_trans_algo = SubAlg( "COH-Delta-FormFactor" ) ;
+
+ if ( ! delta_trans_algo ) {
+ good_config = false ;
+ LOG("COHDeltaCurrent", pERROR ) << "Configuration does not know COH-Delta-FormFactor field" ;
+ }
+
+ delta_ff = dynamic_cast( delta_trans_algo ) ;
+
+ if ( ! delta_ff ) {
+ good_config = false ;
+ LOG("COHDeltaCurrent", pERROR ) << "Algo " << delta_trans_algo -> Id().Name() << " is not a DeltaTransitionFormFactor" ;
+ }
+
+ const Algorithm * delta_med_algo = SubAlg( "COH-Delta-Corrections" ) ;
+
+ if ( ! delta_med_algo ) {
+ good_config = false ;
+ LOG("COHDeltaCurrent", pERROR ) << "Configuration does not know COH-Delta-Corrections field" ;
+ }
+
+ Delta_med = dynamic_cast( delta_med_algo ) ;
+
+ if ( ! Delta_med ) {
+ good_config = false ;
+ LOG("COHDeltaCurrent", pERROR ) << "Algo " << delta_med_algo -> Id().Name() << " is not a DeltaInMediumCorrections" ;
+ }
+
+ if ( ! good_config ) {
+ LOG("COHDeltaCurrent", pFATAL ) << "Bad configuration, exit" ;
+ exit( 78 ) ;
+ }
+
+}
+
+//____________________________________________________________________________
+GTrace COHDeltaCurrent::R( const Interaction & i,
+ double proton_ff, double neutron_ff ) const {
+
+ const InitialState & init_state = i.InitState();
+
+ double k0 = init_state.ProbeE( kRfLab ) ;
+ TLorentzVector probe( 0., 0., k0, k0 ) ;
+
+ const Kinematics & kine = i.Kine() ;
+ TLorentzVector out_neutrino = kine.FSLeptonP4() ;
+ TLorentzVector q = probe - out_neutrino ;
+
+
+ // evaluation of the momenta to be used for the propagators
+ TLorentzVector temp = 0.5*( i.Kine().HadSystP4() - q );
+
+ TLorentzVector p_dir( temp.Vect(),
+ sqrt(pow(constants::kNucleonMass,2) + temp.Vect().Mag2() ) );
+
+ TLorentzVector p_crs( -temp.Vect(), p_dir.E() ); // same temporal. opposite sign for the spatial
+
+ double p0 = p_dir.E() ;
+ p_dir += q ;
+ p_crs -= q ;
+
+ int pdg = init_state.Tgt().Pdg() ;
+
+ std::complex D_prop_dir = Delta_med -> AverageDirectPropagator( p_dir.Mag2(), pdg ) ;
+ std::complex D_prop_cross = Delta_med -> AverageCrossPropagator( p_crs.Mag2() ) ;
+
+ GTrace R = DirTrace(i) ;
+ R *= D_prop_dir ;
+
+ GTrace tr_cross = CrsTrace(i) ;
+ tr_cross *= D_prop_cross ;
+
+ // Add trace * propagator from direct and crossed diagrams
+ R += tr_cross ;
+
+ R *= ( proton_ff * constants::kProtonMass + neutron_ff * constants::kNeutronMass ) / ( 2*p0 ) ;
+
+ return R;
+}
+
+//____________________________________________________________________________
+GTrace COHDeltaCurrent::DirTrace( const Interaction & i ) const {
+
+ // these calculations expects the interaction to be in the lab frame with the incoming neutrino parallel to z
+ double k0 = i.InitState().ProbeE( kRfLab ) ;
+ TLorentzVector probe( 0., 0., k0, k0 ) ;
+ TLorentzVector out_neutrino = i.Kine().FSLeptonP4() ;
+ TLorentzVector t_photon = i.Kine().HadSystP4() ;
+
+ TLorentzVector t_q = probe - out_neutrino ;
+ double Q2 = std::abs(t_q.Mag2()) ; // Must be >0
+
+ // this requires Q2
+ double C3v = delta_ff -> C3V( Q2 ) ;
+ double C3vNC = delta_ff -> C3VNC( Q2 ) ;
+ double C5aNC = delta_ff -> C5ANC( Q2 ) ;
+
+ double mDelta = utils::res::Mass( Resonance() ) ;
+ double mDelta2 = pow( mDelta, 2 );
+
+ TVector3 temp = 0.5*( i.Kine().HadSystP4() - t_q ).Vect();
+ double p0 = sqrt(pow(constants::kNucleonMass,2) + temp.Mag2() ) ;
+
+ // the following contractions requires a vector with time coordinate in the 0-th position
+ // that is not the case for TLorentzVector so we need to rearrange it
+ std::array q = { t_q.E(), t_q.X(), t_q.Y(), t_q.Z() } ;
+ std::array kg = { t_photon.E(), t_photon.X(), t_photon.Y(), t_photon.Z() } ;
+ double mn = constants::kNucleonMass ;
+ double mn2 = pow( mn, 2 ) ;
+
+ GTrace tr;
+
+ tr[0][0] = -( C3v*C3vNC*( mDelta*p0 + mn*(p0 + q[0]) )*( 4*mDelta2*q[1]*kg[1] - 4*pow(p0,2)*q[1]*kg[1]
+ + pow(q[1],3)*kg[1] + q[1]*q[3]*q[3]*kg[1]
+ + q[1]*q[1]*kg[1]*kg[1] - q[3]*q[3]*kg[1]*kg[1]
+ - q[3]*q[3]*kg[2]*kg[2]
+ + q[0]*q[0]*( q[1]*q[1] - 3*q[1]*kg[1] + q[3]*( 2*q[3] - 3*kg[3] ) )
+ + q[3]*( 4*mDelta2 - 4*pow(p0,2) + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] )*kg[3]
+ - 8*p0*q[0]*( q[1]*kg[1] + q[3]*kg[3] ) )
+ ) / ( 3.*mDelta2*pow(mn,3) );
+
+ tr[0][1] = ( std::complex(0.,1.)*C3v*C5aNC*mDelta*( mDelta*p0 + mn*( p0 + q[0] ) )*q[3]*kg[2]*( 8*mn2
+ - 2*q[0]*( p0 + q[0] ) + q[1]*( q[1] + kg[1] ) + q[3]*( q[3] + kg[3]) )
+ - C3v*C3vNC*mn*( 16*mDelta2 * mn * q[0] * ( p0 + q[0] ) * kg[1] + 4*pow(mDelta,3)*( 4*p0*q[0]*kg[1]
+ + q[3]*( -( q[3]*kg[1]) + q[1]*kg[3]) ) - 4*mn*(p0 + q[0])*( 4*pow(p0,2)*q[0]*kg[1] + 8*p0*q[0] * q[0]*kg[1]
+ + 4*pow( q[0], 3)*kg[1] - q[0]*q[1] * q[1]*kg[1] + 2*p0*q[3]*(-(q[3]*kg[1]) + q[1]*kg[3])
+ - q[0]*q[1]*( 2*kg[1]*kg[1] + kg[2]*kg[2] + kg[3]*(- q[3] + kg[3]) )
+ - q[0]*kg[1]*( q[0]*q[0] + q[3]*(2*q[3] + kg[3] ) ) )
+ + mDelta*( -16*pow(p0,3)*q[0]*kg[1] - q[3]*(q[3]*kg[1] - q[1]*kg[3])*( -3*q[0]*q[0] + q[1]*q[1]
+ + 2*q[1]*kg[1] + q[3]*( q[3] + 2*kg[3] ) ) - 4*pow(p0,2)*(8*q[0]*q[0]*kg[1] + 3*q[3]*( -( q[3]*kg[1] )
+ + q[1]*kg[3] ) ) + 4*p0*q[0]*( q[0]*q[0]*( q[1] - 3*kg[1] ) + q[1]*q[1]*kg[1] + q[3]*kg[1]*( 4*q[3] + kg[3] )
+ + q[1]*( kg[1]*kg[1] - 3*q[3]*kg[3] ) ) ) )
+ ) / (12.*mDelta2*pow(mn,4));
+
+ tr[0][2] = ( C3v*( std::complex(0.,-1.)*C5aNC*mDelta*( mDelta*p0 + mn*( p0 + q[0] ) )*( q[3]*kg[1]
+ - q[1]*kg[3] )*( 8*mn2 - 2*q[0]*( p0 + q[0] ) + q[1]*( q[1] + kg[1] ) + q[3]*( q[3] + kg[3] ) )
+ + C3vNC*mn*kg[2]*( -16*mDelta2*mn*q[0]*( p0 + q[0] ) + 4*pow(mDelta,3)*( -4*p0*q[0] + q[1]*q[1] + q[3]*q[3])
+ + 4*mn*( p0 + q[0] )*( 4*pow(p0,2)*q[0] + 8*p0*q[0]*q[0] + 3*pow(q[0],3) - 2*p0*(q[1]*q[1] + q[3]*q[3] )
+ - q[0]*q[1]*( 2*q[1] + kg[1] ) - q[0]*q[3]*( 2*q[3] + kg[3] ) )
+ + mDelta*( 16*pow(p0,3)*q[0] + 4*pow(p0,2)*( 8*q[0]*q[0] - 3*( q[1]*q[1] + q[3]*q[3] ) )
+ + (q[1]*q[1] + q[3]*q[3])*( -3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] )
+ + 4*p0*q[0]*( 3*q[0]*q[0] - q[1]*( 4*q[1] + kg[1] ) - q[3]*( 4*q[3] + kg[3]) ) ) ) )
+ ) / ( 12.*mDelta2*pow(mn,4) );
+
+ tr[0][3] = ( C3v*( std::complex(0.,-1.)*C5aNC*mDelta*( mDelta*p0 + mn*( p0 + q[0] ) )*q[1]*kg[2]*( 8*mn2 - 2*q[0]*( p0 + q[0] )
+ + q[1]*( q[1] + kg[1] ) + q[3]*( q[3] + kg[3] ) )
+ + C3vNC*mn*( -16*mDelta2*mn*q[0]*( p0 + q[0] )*kg[3] + 4*pow(mDelta,3)*( -(q[1]*q[3]*kg[1])
+ - 4*p0*q[0]*kg[3] + q[1]*q[1]*kg[3] ) + 4*mn*( p0 + q[0] )*( q[0]*q[3]*( kg[1]*( q[1] + kg[1] ) + kg[2]*kg[2] )
+ + 8*p0*q[0]*q[0]*kg[3] - q[0]*( -4*pow(p0,2) + q[3]*q[3] + q[1]*( 2*q[1] + kg[1] ) )*kg[3]
+ + pow(q[0],3)*( -2*q[3] + 3*kg[3] ) + 2*p0*q[1]*( q[3]*kg[1] - q[1]*kg[3] ) )
+ + mDelta*( 16*pow(p0,3)*q[0]*kg[3] + 4*pow(p0,2)*( 3*q[1]*q[3]*kg[1] + 8*q[0]*q[0]*kg[3] - 3*q[1]*q[1]*kg[3] )
+ + q[1]*( -( q[3]*kg[1] ) + q[1]*kg[3] )*( -3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] )
+ - 4*p0*q[0]*( -( q[3]*(3*q[1]*kg[1] + kg[1]*kg[1] + kg[2]*kg[2] ) ) + q[0]*q[0]*( 2*q[3] - 3*kg[3] )
+ + ( q[3]*q[3] + q[1]*( 4*q[1] + kg[1] ) )*kg[3] ) ) ) )
+ ) / ( 12.*mDelta2*pow(mn,4) );
+
+ tr[1][0] = (C3v*( std::complex(0.,1.)*C5aNC*q[3]*kg[2]*( 8*pow(mDelta,3)*mn*( p0 + q[0] )
+ - 4*mn2*( p0 + q[0] )*( 2*p0*q[0] + q[0]*q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ - 2*mDelta*mn*( p0 + q[0] )*( 8*mn2 + 2*p0*q[0] + q[0]*q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ + mDelta2*( 8*pow(p0,3) + 12*pow(p0,2)*q[0] + 4*p0*q[0]*q[0] + 8*mn2*( -2*p0 + q[0] )
+ + q[0]*( q[1]*q[1] - q[1]*kg[1] + q[3]*( q[3] - kg[3] ) )
+ - 2*p0*( q[1]*q[1] + 2*q[1]*kg[1] + q[3]*( q[3] + 2*kg[3] ) ) ) )
+ - 2*C3vNC*mn*( 16*mDelta2*mn*q[0]*( p0 + q[0] )*q[1] + 4*pow(mDelta,3)*( q[1]*( 4*p0*q[0]
+ - q[0]*q[0] + kg[1]*kg[1] ) + q[3]*kg[1]*kg[3] )
+ + mDelta*( -16*pow(p0,3)*q[0]*q[1] + 4*p0*q[0]*( pow(q[1],3) + 2*q[1]*q[1]*kg[1] - 3*q[1]*kg[1]*kg[1]
+ + q[3]*kg[1]*( q[3] - 3*kg[3] ) + q[1]*q[3]*( q[3] + kg[3] ) )
+ + ( 3*q[0]*q[0] - q[1]*( q[1] + 2*kg[1] ) - q[3]*( q[3] + 2*kg[3] ) )*( q[0]*q[0]*q[1]
+ - kg[1]*( q[1]*kg[1] + q[3]*kg[3] ) ) - 4*pow(p0,2)*( 5*q[0]*q[0]*q[1] + 3*kg[1]*( q[1]*kg[1] + q[3]*kg[3] ) ) )
+ - 4*mn*( p0 + q[0] )*( 4*pow(p0,2)*q[0]*q[1] + 6*p0*q[0]*q[0]*q[1] + 2*p0*kg[1]*( q[1]*kg[1] + q[3]*kg[3] )
+ + q[0]*( 2*q[0]*q[0]*q[1] - pow(q[1],3) - 2*q[1]*q[1]*kg[1] + q[3]*kg[1]*(-q[3] + kg[3] )
+ + q[1]*( kg[1]*kg[1] - q[3]*(q[3] + kg[3] ) ) ) ) ) )
+ ) / ( 24.*mDelta2*pow(mn,4) );
+
+ tr[1][1] = (C3v*( std::complex(0.,1.)*C5aNC*q[3]*kg[2]*( 4*pow(mDelta,3)*mn*( q[1] + kg[1] )
+ + 2*mn2*( q[1] + kg[1] )*( -( q[0]*( 2*p0 + q[0] ) ) + q[1]*kg[1] + q[3]*kg[3] )
+ + mDelta*mn*( q[1] + kg[1] )*( -4*p0*q[0] - 3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3]
+ + 2*q[1]*kg[1] + 2*q[3]*kg[3] )
+ + mDelta2*( q[0]*q[0]*( q[1] - kg[1] ) + 8*mn2*kg[1] - 2*p0*q[0]*kg[1] + q[3]*q[3]*kg[1]
+ + 4*pow(p0,2)*( q[1] + kg[1] ) - q[1]*q[3]*kg[3] ) )
+ - 2*C3vNC*mn*( 16*mDelta2*mn*( p0 + q[0] )*( q[0]*q[0] - q[3]*kg[3] )
+ + 4*pow(mDelta,3)*( -( q[0]*( -4*p0*q[0] + q[0]*q[0] + q[3]*q[3] - kg[1]*kg[1] ) )
+ + 2*( -2*p0 + q[0] )*q[3]*kg[3] )
+ - 4*mn*( p0 + q[0] )*( 4*pow(p0,2)*q[0]*q[0] + 2*pow(q[0],4)
+ - q[0]*q[0]*( q[1]*q[1] + 2*q[1]*kg[1] - kg[1]*kg[1] + 3*q[3]*kg[3] )
+ + q[3]*( -( q[3]*( 2*kg[1]*kg[1] + kg[2]*kg[2] ) )
+ +( q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] )*kg[3] )
+ + 2*p0*q[0]*( 3*q[0]*q[0] + kg[1]*kg[1] - q[3]*( q[3] + 2*kg[3] ) ) )
+ - mDelta*( 16*pow(p0,3)*q[0]*q[0] + 4*pow(p0,2)*q[0]*( 5*q[0]*q[0] - 3*q[3]*q[3] + 3*kg[1]*kg[1] - 2*q[3]*kg[3] )
+ + 4*p0*( -2*q[3]*q[3]*kg[1]*kg[1] - q[0]*q[0]*( 2*q[3]*q[3] +( q[1] - kg[1] )*( q[1] + 3*kg[1] ) )
+ + q[3]*( q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] )*kg[3] )
+ - q[0]*( q[0]*q[0] + q[3]*q[3] - kg[1]*kg[1] - 2*q[3]*kg[3] )*( 3*q[0]*q[0] - q[1]*( q[1] + 2*kg[1] )
+ - q[3]*( q[3] + 2*kg[3] ) ) ) ) )
+ ) / ( 24.*mDelta2*pow(mn,4) );
+
+ tr[1][2] = ( C3v*( -2*C3vNC*mn*kg[2]*( 16*mDelta2*mn*( p0 + q[0] )*q[1] + 4*pow(mDelta,3)*( 4*p0*q[1] + q[0]*( -2*q[1] + kg[1] ) )
+ + 4*mn*( p0 + q[0] )*( pow(q[1],3) + q[1]*q[3]*q[3] + 2*q[1]*q[1]*kg[1] + q[3]*q[3]*kg[1]
+ - 2*p0*q[0]*( 2*q[1] + kg[1] ) -q[0]*q[0]*( 2*q[1] + kg[1] ) + q[1]*q[3]*kg[3] )
+ + mDelta*(-4*pow(p0,2)*q[0]*( 2*q[1] + 3*kg[1] ) + 4*p0*( q[0]*q[0]*( 2*q[1] - 3*kg[1] )
+ + ( q[1]*q[1] + q[3]*q[3] )*( q[1] + 2*kg[1] ) )
+ - q[0]*( 2*q[1] - kg[1] )*( -3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) ) )
+ + std::complex(0.,1.)*C5aNC*( 2*mn2*q[3]*kg[2]*kg[2]*( -( q[0]*( 2*p0 + q[0] ) ) + q[1]*kg[1] + q[3]*kg[3] )
+ + 4*pow(mDelta,3)*mn*( -( q[3]*kg[1]*kg[1] ) + q[0]*q[0]*( q[3] - 2*kg[3] ) - 2*p0*q[0]*kg[3]
+ + ( 8*mn2 + q[3]*q[3] + q[1]*( q[1] + kg[1] ) )*kg[3] )
+ + mDelta2*( -2*p0*q[3]*( 2*p0*( -2*q[0]*q[0] + kg[1]*kg[1] )
+ + q[0]*( -3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + q[1]*kg[1] + kg[1]*kg[1] ) )
+ + q[3]*( -( q[0]*( 4*p0 + q[0] ) ) + q[1]*q[1] + q[3]*q[3])*kg[2]*kg[2]
+ + 2*p0*( -4*pow(p0,2)*q[0] - 2*pow(q[0],3) + q[0]*q[1]*( q[1] + kg[1] )
+ + 2*p0*( -3*q[0]*q[0] + q[3]*q[3] + q[1]*( q[1] + kg[1] ) ) )*kg[3]
+ + 8*mn2*( q[3]*( -2*p0*q[0] + kg[2]*kg[2] ) + 2*p0*( 2*p0 + q[0] )*kg[3] ) )
+ + mDelta*mn*( q[3]*( -pow(q[0],4) - kg[1]*kg[1]*( 3*( q[1]*q[1] + q[3]*q[3] ) + 4*q[1]*kg[1] )
+ - 2*(q[3]*q[3] + q[1]*(q[1] + kg[1] ) )*kg[2]*kg[2]
+ + q[0]*q[0]*( q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 5*kg[1]*kg[1] + 2*kg[2]*kg[2] ) )
+ + ( 2*pow(q[0],4) + pow((q[1]*q[1] + q[3]*q[3]),2) + 3*q[1]*( q[1]*q[1] + q[3] * q[3])*kg[1]
+ + 2*( q[1] - q[3] )*( q[1] + q[3] )*kg[1]*kg[1]
+ - q[0]*q[0]*( 3*( q[1]*q[1] + q[3]*q[3] ) + 5*q[1]*kg[1] ) )*kg[3] + 4*pow(p0,2)*q[0]*q[0]*( q[3] + kg[3] )
+ - 8*mn2*( 2*p0*q[0]*( q[3] + kg[3] ) + q[0]*q[0]*( 2*q[3] + kg[3] )
+ - kg[3]*( q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) )
+ + 2*p0*q[0]*( -( q[1]*q[1]*( q[3] + 2*kg[3] ) ) + q[0]*q[0]*( q[3] + 3*kg[3] )
+ - q[1]*kg[1]*( q[3] + 3*kg[3] ) + q[3]*( 3*kg[1]*kg[1] + kg[2]*kg[2] - q[3]*( q[3] + 3*kg[3] ) ) ) ) ) )
+ ) / ( 24.*mDelta2*pow(mn,4) );
+
+ tr[1][3] = -( C3v*( std::complex(0.,1.)*C5aNC*kg[2]*( 4*pow(mDelta,3)*mn*( 8*mn2 - 2*q[0]*(p0 + q[0]) + q[1]*(q[1] + kg[1]) )
+ - 2*mn2*q[3]*(q[3] + kg[3])*( -(q[0]*(2*p0 + q[0])) + q[1]*kg[1] + q[3]*kg[3] )
+ + mDelta*mn*( 4*pow(p0,2)*q[0]*q[0] + 6*p0*pow(q[0],3) + 2*pow(q[0],4)
+ - 4*p0*q[0]*q[1]*q[1] - 3*q[0]*q[0]*q[1]*q[1] + pow(q[1],4)
+ + q[1]*q[1]*q[3]*q[3] - 6*p0*q[0]*q[1]*kg[1] - 5*q[0]*q[0]*q[1]*kg[1]
+ + 3*pow(q[1],3)*kg[1] + q[1]*q[3] * q[3]*kg[1] + 2*q[1]*q[1]*kg[1]*kg[1]
+ + 2*q[3]*( -(q[0]*(p0 + q[0])) + q[1]*(q[1] + kg[1]))*kg[3]
+ + 8*mn2*( -( q[0]*(2*p0 + q[0]) ) + q[1]*q[1] + 2*q[1]*kg[1] + q[3]*( q[3] + 2*kg[3] ) ) )
+ + mDelta2*( -8*pow(p0,3)*q[0] + 4*pow(p0,2)*( -3*q[0]*q[0] + q[1]*(q[1] + kg[1]) )
+ + 8*mn2*( 2*p0*(2*p0 + q[0]) - q[3]*kg[3] )
+ + 2*p0*q[0]*( -2*q[0] * q[0] + q[1]*(q[1] + kg[1]) + q[3]*(q[3] + 2*kg[3]) )
+ + q[3]*( q[0]*q[0]*(-q[3] + kg[3]) + q[1]*(q[3]*kg[1] - q[1]*kg[3]) ) ) )
+ + 2*C3vNC*mn*( 16*mDelta2*mn*(p0 + q[0])*q[1]*kg[3]
+ + 4*pow(mDelta,3)*( q[0]*q[1]*(q[3] - 2*kg[3]) + 4*p0*q[1]*kg[3] + q[0]*kg[1]*kg[3] )
+ - 4*mn*(p0 + q[0])*( q[1]*q[3]*( 2*kg[1]*kg[1] + kg[2]*kg[2] )
+ - q[1]*( q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] )*kg[3]
+ + q[0]*q[0]*( -(q[3]*(q[1] + kg[1])) + (2*q[1] + kg[1])*kg[3] )
+ + 2*p0*q[0]*( kg[1]*kg[3] + q[1]*(q[3] + 2*kg[3]) ) )
+ + mDelta*( -4*pow(p0,2)*q[0]*( 3*q[1]*q[3] + 2*q[1]*kg[3] + 3*kg[1]*kg[3] )
+ - q[0]*( q[1]*(q[3] - 2*kg[3]) + kg[1]*kg[3] )*( 3*q[0]*q[0] - q[1]*(q[1]
+ + 2*kg[1]) - q[3]*(q[3] + 2*kg[3]) )
+ + 4*p0*( -2*q[1]*q[3]*kg[1] * kg[1]
+ + q[1]*( q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] )*kg[3]
+ + q[0]*q[0]*( -(q[1]*q[3]) + q[3]*kg[1] + 2*q[1]*kg[3] - 3*kg[1]*kg[3] ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[2][0] = ( C3v*( -2*C3vNC*mn*kg[2]*( 4*pow(mDelta,3)*(q[1]*kg[1] + q[3]*kg[3])
+ - 4*mn*(p0 + q[0])*( -( q[0]*(q[1]*q[1] + q[3]*q[3] - q[1]*kg[1] - q[3]*kg[3]) )
+ + 2*p0*(q[1]*kg[1] + q[3]*kg[3]) )
+ + mDelta*( 4*p0*q[0]*( q[1]*q[1] + q[3]*q[3] - 3*q[1]*kg[1] - 3*q[3]*kg[3] )
+ - 12*pow(p0,2)*(q[1]*kg[1] + q[3]*kg[3])
+ + (q[1]*kg[1] + q[3]*kg[3])*( -3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) ) )
+ - std::complex(0.,1.)*C5aNC*(q[3]*kg[1] - q[1]*kg[3])*( 8*pow(mDelta,3)*mn*(p0 + q[0])
+ - 4*mn2*(p0 + q[0])*( 2*p0*q[0] + q[0]*q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ - 2*mDelta*mn*(p0 + q[0])*( 8*mn2 + 2*p0*q[0] + q[0]*q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ + mDelta2*( 8*pow(p0,3) + 12*pow(p0,2)*q[0] + 4*p0*q[0]*q[0] + 8*mn2*(-2*p0 + q[0])
+ + q[0]*( q[1]*q[1] - q[1]*kg[1] + q[3]*(q[3] - kg[3]) )
+ - 2*p0*( q[1]*q[1] + 2*q[1]*kg[1] + q[3]*(q[3] + 2*kg[3]) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[2][1] = ( C3v*( -2*C3vNC*mn*kg[2]*( 4*pow(mDelta,3)*q[0]*kg[1] - 4*mn*(p0 + q[0])*( 2*p0*q[0]*kg[1]
+ + q[0] * q[0]*(-q[1] + kg[1]) + q[3]*(-(q[3]*kg[1]) + q[1]*kg[3]) )
+ + mDelta*( 4*p0*q[0] * q[0]*(q[1] - 3*kg[1]) - 12*pow(p0,2)*q[0]*kg[1]
+ + 8*p0*q[3]*(q[3]*kg[1] - q[1]*kg[3])
+ + q[0]*kg[1]*( -3*q[0] * q[0] + q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) ) )
+ - std::complex(0.,1.)*C5aNC*( 2*mn2*(q[1] + kg[1])*(-(q[3]*kg[1])
+ + q[1]*kg[3])*( 2*p0*q[0] + q[0] * q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ + 4*pow(mDelta,3)*mn*( q[3]*( q[0] * q[0] + q[1]*kg[1] - kg[2] * kg[2] )
+ + ( 8*mn2 - 2*q[0]*(p0 + q[0]) + q[3] * q[3] )*kg[3] )
+ + mDelta2*( -8*pow(p0,3)*q[0]*kg[3] + 2*p0*q[0]*( -( q[3]*(q[1] * q[1] + q[3] * q[3] + q[1]*kg[1]
+ + 2*kg[1] * kg[1] + kg[2] * kg[2] ) ) + q[0] * q[0]*(3*q[3] - 2*kg[3]) + q[1]*(q[1] + 2*kg[1])*kg[3] )
+ + 4*pow(p0,2)*( q[3]*kg[1]*(q[1] + kg[1]) + q[0] * q[0]*(q[3] - 3*kg[3]) + q[3]*kg[3]*(q[3] + kg[3]) )
+ + (q[3]*kg[1] - q[1]*kg[3])*( q[0] * q[0]*(q[1] - kg[1]) + q[3]*(q[3]*kg[1] - q[1]*kg[3]) )
+ + 8*mn2*( 4*pow(p0,2)*kg[3] + 2*p0*q[0]*(-q[3] + kg[3]) + kg[1]*(q[3]*kg[1] - q[1]*kg[3]) ) )
+ + mDelta*mn*( q[3]*( -pow(q[0],4) + kg[1]*( pow(q[1],3) + q[1]*q[3] * q[3]
+ + 2*q[1] * q[1]*kg[1] - 2*q[3] * q[3]*kg[1] )
+ - ( q[1] * q[1] + 3*q[3] * q[3] + 2*q[1]*kg[1] )*kg[2] * kg[2]
+ + q[0] * q[0]*( -q[1] * q[1] + q[3] * q[3] - 3*q[1]*kg[1] + 2*kg[1] * kg[1] + 5*kg[2] * kg[2] ) )
+ + ( 2*pow(q[0],4) - q[0] * q[0]*( 3*q[3] * q[3] + 2*q[1]*kg[1] )
+ + q[3] * q[3]*( q[1] * q[1] + q[3] * q[3] + 4*q[1]*kg[1] - 2*kg[2] * kg[2] ) )*kg[3]
+ + 4*pow(p0,2)*q[0] * q[0]*(q[3] + kg[3])
+ - 8*mn2*( 2*p0*q[0]*(q[3] + kg[3]) + q[0] * q[0]*(2*q[3] + kg[3])
+ - kg[3]*( q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) )
+ + 2*p0*q[0]*( -(q[1] * q[1]*q[3]) - q[1]*kg[1]*(3*q[3] + kg[3]) + q[0] * q[0]*(q[3] + 3*kg[3])
+ + q[3]*( kg[1] * kg[1] + 3*kg[2] * kg[2] - q[3]*(q[3] + 3*kg[3]) ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[2][2] = ( C3v*( std::complex(0.,-1.)*C5aNC*kg[2]*(q[3]*kg[1] - q[1]*kg[3])*( 4*pow(mDelta,3)*mn
+ + mDelta2*( 8*mn2 + 4*pow(p0,2) - 2*p0*q[0] - q[0]*q[0] + q[1]*q[1] + q[3]*q[3] )
+ + 2*mn2*( -(q[0]*(2*p0 + q[0])) + q[1]*kg[1] + q[3]*kg[3] )
+ + mDelta*mn*( -4*p0*q[0] - 3*q[0]*q[0] + q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) )
+ + 2*C3vNC*mn*( -16*mDelta2*mn*(p0 + q[0])*(q[0]*q[0] - q[1]*kg[1] - q[3]*kg[3])
+ + 4*pow(mDelta,3)*( q[0]*( q[0]*q[0] + q[1]*q[1] + q[3]*q[3] - 2*q[1]*kg[1] - kg[2]*kg[2] - 2*q[3]*kg[3] )
+ + 4*p0*( -q[0]*q[0] + q[1]*kg[1] + q[3]*kg[3] ) )
+ + 4*mn*(p0 + q[0])*( 4*pow(p0,2)*q[0]*q[0] + 2*pow(q[0],4) + pow(q[1],3)*kg[1] + q[1]*q[3]*q[3]*kg[1]
+ + q[1]*q[1]*kg[1]*kg[1] - q[3]*q[3]*kg[1]*kg[1] - q[1]*q[1]*kg[2]*kg[2] - 2*q[3]*q[3]*kg[2]*kg[2]
+ + q[3]*( q[1]*q[1] + q[3]*q[3] + 2*q[1]*kg[1] )*kg[3]
+ - q[0]*q[0]*( q[1]*q[1] + 3*q[1]*kg[1] - kg[2]*kg[2] + 3*q[3]*kg[3] )
+ + 2*p0*q[0]*( 3*q[0]*q[0] - q[1]*(q[1] + 2*kg[1]) + kg[2]*kg[2] - q[3]*(q[3] + 2*kg[3]) ) )
+ + mDelta*( 16*pow(p0,3)*q[0]*q[0] + 4*pow(p0,2)*q[0]*( 5*q[0]*q[0] - 3*q[1]*q[1] - 3*q[3]*q[3]
+ - 2*q[1]*kg[1] + 3*kg[2]*kg[2] - 2*q[3]*kg[3] )
+ - q[0]*( q[0]*q[0] + q[1]*q[1] + q[3]*q[3]
+ - 2*q[1]*kg[1] - kg[2]*kg[2] - 2*q[3]*kg[3] )*( 3*q[0]*q[0] - q[1]*(q[1]
+ + 2*kg[1]) - q[3]*(q[3] + 2*kg[3]) )
+ + 4*p0*( pow(q[1],3)*kg[1] + q[1]*q[3]*q[3]*kg[1] + q[3]*q[3]*( -2*kg[2]*kg[2] + q[3]*kg[3] )
+ + q[0]*q[0]*( q[1]*(-4*q[1] + kg[1]) + 3*kg[2]*kg[2] + q[3]*(-2*q[3] + kg[3]) )
+ + q[1]*q[1]*( 2*kg[1]*kg[1] + kg[3]*(q[3] + 2*kg[3]) ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[2][3] = ( C3v*( -2*C3vNC*mn*kg[2]*( 4*pow(mDelta,3)*q[0]*kg[3] - 4*mn*(p0 + q[0])*( 2*p0*q[0]*kg[3]
+ + q[0] * q[0]*(-q[3] + kg[3]) + q[1]*(q[3]*kg[1] - q[1]*kg[3]) )
+ + mDelta*( 4*p0*q[0] * q[0]*(q[3] - 3*kg[3]) - 12*pow(p0,2)*q[0]*kg[3] + 8*p0*q[1]*( -(q[3]*kg[1]) + q[1]*kg[3] )
+ + q[0]*kg[3]*( -3*q[0] * q[0] + q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) ) )
+ + std::complex(0.,1.)*C5aNC*( -2*mn2*(q[3] + kg[3])*( q[3]*kg[1]
+ - q[1]*kg[3] )*( -( q[0]*(2*p0 + q[0]) ) + q[1]*kg[1] + q[3]*kg[3] )
+ + 4*pow(mDelta,3)*mn*( q[0] * q[0]*(q[1] - 2*kg[1]) + 8*mn2*kg[1]
+ - 2*p0*q[0]*kg[1] + q[1]*( q[1]*kg[1] - kg[2] * kg[2] + q[3]*kg[3] ) )
+ + mDelta2*( -8*pow(p0,3)*q[0]*kg[1] + 4*pow(p0,2)*( q[0] * q[0]*(q[1] - 3*kg[1])
+ + q[1]*kg[1]*(q[1] + kg[1]) + q[1]*kg[3]*(q[3] + kg[3]) )
+ + (q[3]*kg[1] - q[1]*kg[3])*( q[0] * q[0]*(-q[3] + kg[3]) + q[1]*(q[3]*kg[1] - q[1]*kg[3]) )
+ + 8*mn2*( 4*pow(p0,2)*kg[1] + 2*p0*q[0]*(-q[1] + kg[1]) + kg[3]*( -(q[3]*kg[1]) + q[1]*kg[3] ) )
+ + 2*p0*q[0]*( -pow(q[1],3) + q[0] * q[0]*(q[1] - 2*kg[1]) + q[3]*kg[1]*(q[3] + 2*kg[3])
+ + q[1]*( 2*kg[1] * kg[1] + kg[2] * kg[2] - q[3]*(q[3] + kg[3]) ) ) )
+ + mDelta*mn*( pow(q[0],4)*q[1] - q[0] * q[0]*pow(q[1],3) + q[0] * q[0]*q[1]*q[3] * q[3] + 2*pow(q[0],4)*kg[1]
+ - 3*q[0] * q[0]*q[1] * q[1]*kg[1] + pow(q[1],4)*kg[1] + q[1] * q[1]*q[3] * q[3]*kg[1]
+ - 2*q[0] * q[0]*q[1]*kg[1] * kg[1] + 2*pow(q[1],3)*kg[1] * kg[1] - 2*q[1]*q[3] * q[3]*kg[1] * kg[1]
+ + 4*pow(p0,2)*q[0] * q[0]*(q[1] + kg[1]) + 3*q[0] * q[0]*q[1]*kg[2] * kg[2] - pow(q[1],3)*kg[2] * kg[2]
+ - 3*q[1]*q[3] * q[3]*kg[2] * kg[2] - 2*q[1] * q[1]*kg[1]*kg[2] * kg[2]
+ - 3*q[0] * q[0]*q[1]*q[3]*kg[3] + pow(q[1],3)*q[3]*kg[3] + q[1]*pow(q[3],3)*kg[3]
+ - 2*q[0] * q[0]*q[3]*kg[1]*kg[3] + 4*q[1] * q[1]*q[3]*kg[1]*kg[3] - 2*q[1]*q[3]*kg[2] * kg[2]*kg[3]
+ - 8*mn2*( 2*p0*q[0]*(q[1] + kg[1]) + q[0] * q[0]*(2*q[1] + kg[1])
+ - kg[1]*( q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) )
+ + 2*p0*q[0]*( -pow(q[1],3) - 3*q[1] * q[1]*kg[1] + 2*q[0] * q[0]*(q[1] + 2*kg[1])
+ - q[1]*( q[3] * q[3] + kg[1] * kg[1] - 2*kg[2] * kg[2] + 3*q[3]*kg[3] )
+ - kg[1]*( kg[1] * kg[1] + kg[2] * kg[2] + kg[3]*(q[3] + kg[3]) ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[3][0] = -( C3v*( std::complex(0.,1.)*C5aNC*q[1]*kg[2]*( 8*pow(mDelta,3)*mn*(p0 + q[0])
+ - 4*mn2*(p0 + q[0])*( 2*p0*q[0] + q[0] * q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ - 2*mDelta*mn*(p0 + q[0])*( 8*mn2 + 2*p0*q[0] + q[0] * q[0] - q[1]*kg[1] - q[3]*kg[3] )
+ + mDelta2*( 8*pow(p0,3) + 12*pow(p0,2)*q[0] + 4*p0*q[0] * q[0] + 8*mn2*(-2*p0 + q[0])
+ + q[0]*( q[1] * q[1] - q[1]*kg[1] + q[3]*(q[3] - kg[3]) )
+ - 2*p0*( q[1] * q[1] + 2*q[1]*kg[1] + q[3]*(q[3] + 2*kg[3]) ) ) )
+ + 2*C3vNC*mn*( 16*mDelta2*mn*q[0]*(p0 + q[0])*q[3]
+ + 4*pow(mDelta,3)*( 4*p0*q[0]*q[3] - q[3]*( kg[1] * kg[1] + kg[2] * kg[2] ) + q[1]*kg[1]*kg[3] )
+ + 4*mn*(p0 + q[0])*( -4*pow(p0,2)*q[0]*q[3] - 8*p0*q[0] * q[0]*q[3] - 3*pow(q[0],3)*q[3]
+ + 2*p0*q[3]*( kg[1] * kg[1] + kg[2] * kg[2] )
+ + q[0]*q[3]*( q[1] * q[1] + q[3] * q[3] + q[1]*kg[1] + kg[1] * kg[1] + kg[2] * kg[2] )
+ - 2*p0*q[1]*kg[1]*kg[3] + q[0]*( q[1] * q[1] + 2*q[3] * q[3] - q[1]*kg[1] )*kg[3] )
+ + mDelta*( -16*pow(p0,3)*q[0]*q[3] - 4*pow(p0,2)*( 8*q[0] * q[0]*q[3]
+ - 3*q[3]*( kg[1] * kg[1] + kg[2] * kg[2] ) + 3*q[1]*kg[1]*kg[3] )
+ - ( q[3]*(kg[1] * kg[1] + kg[2] * kg[2]) - q[1]*kg[1]*kg[3] )*( -3*q[0] * q[0] + q[1] * q[1]
+ + 2*q[1]*kg[1] + q[3]*(q[3] + 2*kg[3]) )
+ + 4*p0*q[0]*( -3*q[0] * q[0]*q[3] + q[1]*kg[1]*(q[3] - 3*kg[3]) + q[1] * q[1]*(q[3] + kg[3])
+ + q[3]*( 3*(kg[1] * kg[1] + kg[2] * kg[2]) + q[3]*(q[3] + 2*kg[3]) ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[3][1] = ( std::complex(0.,1.)*C3v*C5aNC*kg[2]*( -2*mn2*q[1]*(q[1] + kg[1])*( -(q[0]*(2*p0 + q[0]))
+ + q[1]*kg[1] + q[3]*kg[3] ) + 4*pow(mDelta,3)*mn*( 8*mn2 - 2*q[0]*(p0 + q[0]) + q[3]*(q[3] + kg[3]) )
+ - mDelta*mn*( -4*pow(p0,2)*q[0] * q[0] - 2*pow(q[0],4) + q[0] * q[0]*q[3] * q[3]
+ - q[1] * q[1]*q[3] * q[3] - pow(q[3],4)
+ + 2*q[0] * q[0]*q[1]*kg[1] - 2*q[1]*q[3] * q[3]*kg[1]
+ + 2*q[3] * q[3]*kg[1] * kg[1] + 2*q[3] * q[3]*kg[2] * kg[2]
+ - q[3]*( -5*q[0] * q[0] + q[1] * q[1] + 3*q[3] * q[3] + 2*q[1]*kg[1] )*kg[3]
+ + 2*p0*q[0]*( -3*q[0] * q[0] + 2*q[3] * q[3] + q[1]*kg[1] + 3*q[3]*kg[3] )
+ + 8*mn2*( 2*p0*q[0] + q[0] * q[0] - q[1]*(q[1] + 2*kg[1]) - q[3]*(q[3] + 2*kg[3]) ) )
+ + mDelta2*( -8*pow(p0,3)*q[0] + 8*mn2*( 2*p0*(2*p0 + q[0]) - q[1]*kg[1] )
+ + 4*pow(p0,2)*( -3*q[0] * q[0] + q[3]*(q[3] + kg[3]) )
+ + 2*p0*q[0]*( -2*q[0] * q[0] + q[1]*(q[1] + 2*kg[1]) + q[3]*(q[3] + kg[3]) )
+ + q[1]*( q[0] * q[0]*(-q[1] + kg[1]) + q[3]*( -(q[3]*kg[1]) + q[1]*kg[3] ) ) ) )
+ - 2*C3v*C3vNC*mn*( 16*mDelta2*mn*(p0 + q[0])*q[3]*kg[1]
+ + 4*pow(mDelta,3)*( q[0]*q[1]*q[3] + 4*p0*q[3]*kg[1] + q[0]*kg[1]*(-2*q[3] + kg[3]) )
+ - 4*mn*(p0 + q[0])*( 2*p0*q[0]*( q[1]*q[3] + kg[1]*(2*q[3] + kg[3]) )
+ + q[0] * q[0]*( q[1]*(q[3] - kg[3]) + kg[1]*(2*q[3] + kg[3]) )
+ - q[3]*( q[1] * q[1]*kg[1] + q[1]*( 2*kg[1] * kg[1] + kg[2] * kg[2] ) + q[3]*kg[1]*(q[3] + 2*kg[3]) ) )
+ + mDelta*( -4*pow(p0,2)*q[0]*( 3*q[1]*q[3] + 2*q[3]*kg[1] + 3*kg[1]*kg[3] )
+ + q[0]*( q[1]*q[3] + kg[1]*(-2*q[3] + kg[3]) )*( -3*q[0] * q[0] + q[1] * q[1] + 2*q[1]*kg[1] + q[3]*(q[3] + 2*kg[3]) )
+ + 4*p0*( q[0] * q[0]*( -3*q[1]*q[3] + 2*q[3]*kg[1] + q[1]*kg[3] - 3*kg[1]*kg[3] )
+ + q[3]*( q[1] * q[1]*kg[1] + 2*q[1]*(kg[1] * kg[1] + kg[2] * kg[2]) + q[3]*kg[1]*(q[3] + 2*kg[3]) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[3][2] = ( C3v*( -2*C3vNC*mn*kg[2]*( 16*mDelta2*mn*(p0 + q[0])*q[3]
+ - 4*mn*(p0 + q[0])*( -( q[3]*( -2*q[0]*(2*p0 + q[0]) + q[3] * q[3] + q[1]*(q[1] + kg[1]) ) )
+ + ( 2*p0*q[0] + q[0] * q[0] - q[1] * q[1] - 2*q[3] * q[3])*kg[3] )
+ + 4*pow(mDelta,3)*( 4*p0*q[3] + q[0]*(-2*q[3] + kg[3]) )
+ + mDelta*( -4*pow(p0,2)*q[0]*(2*q[3] + 3*kg[3])
+ - q[0]*(2*q[3] - kg[3])*( -3*q[0] * q[0] + q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] )
+ + 4*p0*( q[0] * q[0]*(2*q[3] - 3*kg[3]) + ( q[1] * q[1] + q[3] * q[3] )*(q[3] + 2*kg[3]) ) ) )
+ - std::complex(0.,1.)*C5aNC*( 2*mn2*q[1]*kg[2] * kg[2]*( -(q[0]*(2*p0 + q[0]))
+ + q[1]*kg[1] + q[3]*kg[3]) + 4*pow(mDelta,3)*mn*( 8*mn2*kg[1] - 2*p0*q[0]*kg[1] - 2*q[0] * q[0]*kg[1]
+ + q[1] * q[1]*kg[1] + q[3] * q[3]*kg[1] + q[1]*kg[1] * kg[1] + q[1]*kg[2] * kg[2] + q[3]*kg[1]*kg[3])
+ + mDelta2*( -8*pow(p0,3)*q[0]*kg[1] + q[1]*( -q[0] * q[0] + q[1] * q[1] + q[3] * q[3] )*kg[2] * kg[2]
+ + 8*mn2*( 4*pow(p0,2)*kg[1] + 2*p0*q[0]*(-q[1] + kg[1]) + q[1]*kg[2] * kg[2] )
+ + 4*pow(p0,2)*( q[0] * q[0]*(q[1] - 3*kg[1]) + q[1] * q[1]*kg[1] + q[1]*( kg[1] * kg[1] + kg[2] * kg[2] )
+ + q[3]*kg[1]*(q[3] + kg[3])) + 2*p0*q[0]*( -pow(q[1],3) + 2*q[0] * q[0]*(q[1] - kg[1])
+ + q[3]*kg[1]*(q[3] + kg[3]) - q[1]*( -kg[1] * kg[1] + kg[2] * kg[2] + q[3]*(q[3] + kg[3]) ) ) )
+ + mDelta*mn*( 4*pow(q[0],4)*q[1] - 2*q[0] * q[0]*pow(q[1],3) - 2*q[0] * q[0]*q[1]*q[3] * q[3] + 2*pow(q[0],4)*kg[1]
+ - 5*q[0] * q[0]*q[1] * q[1]*kg[1] + pow(q[1],4)*kg[1] - q[0] * q[0]*q[3] * q[3]*kg[1]
+ + 2*q[1] * q[1]*q[3] * q[3]*kg[1] + pow(q[3],4)*kg[1] - 5*q[0] * q[0]*q[1]*kg[1] * kg[1]
+ + 3*pow(q[1],3)*kg[1] * kg[1] + 3*q[1]*q[3] * q[3]*kg[1] * kg[1]
+ + 2*q[1] * q[1]*pow(kg[1],3) - 2*q[3] * q[3]*pow(kg[1],3) + 4*pow(p0,2)*q[0] * q[0]*(q[1] + kg[1])
+ - 3*q[0] * q[0]*q[1]*kg[2] * kg[2] + pow(q[1],3)*kg[2] * kg[2] + q[1]*q[3] * q[3]*kg[2] * kg[2]
+ + 2*q[1] * q[1]*kg[1]*kg[2] * kg[2] - 2*q[3] * q[3]*kg[1]*kg[2] * kg[2] - 2*q[0] * q[0]*q[1]*q[3]*kg[3]
+ - 5*q[0] * q[0]*q[3]*kg[1]*kg[3] + 3*q[1] * q[1]*q[3]*kg[1]*kg[3] + 3*pow(q[3],3)*kg[1]*kg[3]
+ + 4*q[1]*q[3]*kg[1] * kg[1]*kg[3] + 2*q[1]*q[3]*kg[2] * kg[2]*kg[3]
+ - 8*mn2*( 2*p0*q[0]*(q[1] + kg[1]) + q[0] * q[0]*(2*q[1] + kg[1])
+ - kg[1]*( q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) )
+ + 2*p0*q[0]*( -pow(q[1],3) - 3*q[1] * q[1]*kg[1] + q[0] * q[0]*(4*q[1] + 3*kg[1]) - q[3]*kg[1]*(2*q[3] + 3*kg[3])
+ - q[1]*( 3*kg[1] * kg[1] + 2*kg[2] * kg[2] + q[3]*(q[3] + kg[3]) ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ tr[3][3] = -( C3v*( std::complex(0.,1.)*C5aNC*q[1]*kg[2]*( 4*pow(mDelta,3)*mn*(q[3] + kg[3])
+ + 2*mn2*(q[3] + kg[3])*( -( q[0]*(2*p0 + q[0]) ) + q[1]*kg[1] + q[3]*kg[3] )
+ + mDelta*mn*(q[3] + kg[3])*( -4*p0*q[0] - 3*q[0] * q[0] + q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] + 2*q[3]*kg[3] )
+ + mDelta2*( -(q[1]*q[3]*kg[1]) + q[0] * q[0]*(q[3] - kg[3]) + 8*mn2*kg[3] - 2*p0*q[0]*kg[3] + q[1] * q[1]*kg[3]
+ + 4*pow(p0,2)*(q[3] + kg[3]) ) )
+ + 2*C3vNC*mn*( 16*mDelta2*mn*(p0 + q[0])*( q[0] * q[0] - q[1]*kg[1] )
+ + 4*pow(mDelta,3)*( 4*p0*(q[0] * q[0] - q[1]*kg[1]) - q[0]*( pow(q[1] - kg[1],2) + kg[2] * kg[2] ) )
+ - 4*mn*(p0 + q[0])*( 4*pow(p0,2)*q[0] * q[0] + 3*pow(q[0],4)
+ + 2*p0*q[0]*( 4*q[0] * q[0] - pow(q[1] + kg[1],2) - kg[2] * kg[2] )
+ - q[0] * q[0]*( q[3] * q[3] + (q[1] + kg[1])*(2*q[1] + kg[1]) + kg[2] * kg[2] + 2*q[3]*kg[3] )
+ + q[1]*( q[1] * q[1]*kg[1] + q[1]*( 2*kg[1] * kg[1] + kg[2] * kg[2] ) + q[3]*kg[1]*(q[3] + 2*kg[3]) ) )
+ - mDelta*( 16*pow(p0,3)*q[0] * q[0] + 4*pow(p0,2)*q[0]*( 8*q[0] * q[0] - 3*q[1] * q[1]
+ - 2*q[1]*kg[1] - 3*( kg[1] * kg[1] + kg[2] * kg[2] ) )
+ + q[0]*( pow(q[1] - kg[1],2) + kg[2] * kg[2] )*( -3*q[0] * q[0] + q[1] * q[1] + q[3] * q[3]
+ + 2*q[1]*kg[1] + 2*q[3]*kg[3] ) + 4*p0*( 3*pow(q[0],4) - q[0] * q[0]*( 4*q[1] * q[1]
+ - q[1]*kg[1] + 3*( kg[1] * kg[1] + kg[2] * kg[2] ) + q[3]*(q[3] + 2*kg[3]) )
+ + q[1]*( q[1] * q[1]*kg[1] + 2*q[1]*( kg[1] * kg[1] + kg[2] * kg[2] ) + q[3]*kg[1]*(q[3] + 2*kg[3]) ) ) ) ) )
+ ) / (24.*mDelta2*pow(mn,4));
+
+ return tr;
+
+}
+
+//____________________________________________________________________________
+GTrace COHDeltaCurrent::CrsTrace( const Interaction & i ) const {
+
+
+ // these calculations expects the interaction to be in the lab frame with the incoming neutrino parallel to z
+ double k0 = i.InitState().ProbeE( kRfLab ) ;
+ TLorentzVector probe( 0., 0., k0, k0 ) ;
+ TLorentzVector out_neutrino = i.Kine().FSLeptonP4() ;
+ TLorentzVector t_photon = i.Kine().HadSystP4() ;
+
+ TLorentzVector t_q = probe - out_neutrino ;
+ double Q2 = std::abs(t_q.Mag2()) ; // Must be >0
+
+ // this requires Q2
+ double C3v = delta_ff -> C3V( Q2 ) ;
+ double C3vNC = delta_ff -> C3VNC( Q2 ) ;
+ double C5aNC = delta_ff -> C5ANC( Q2 ) ;
+
+ double mDelta = utils::res::Mass( Resonance() ) ;
+ double mDelta2 = pow( mDelta, 2 );
+
+ TVector3 temp = 0.5*( i.Kine().HadSystP4() - t_q ).Vect();
+ double p0 = sqrt(pow(constants::kNucleonMass,2) + temp.Mag2() ) ;
+
+ // the following contractions requires a vector with time coordinate in the 0-th position
+ // that is not the case for TLorentzVector so we need to rearrange it
+ std::array q = { t_q.E(), t_q.X(), t_q.Y(), t_q.Z() } ;
+ std::array kg = { t_photon.E(), t_photon.X(), t_photon.Y(), t_photon.Z() } ;
+
+ double mn = constants::kNucleonMass ;
+ double mn2 = pow( mn, 2 ) ;
+
+ GTrace tr;
+
+ tr[0][0] = -( C3v*C3vNC*( (mDelta + mn)*p0 - mn*q[0] )*( 4*mDelta2*q[1]*kg[1] - 4*pow(p0,2)*q[1]*kg[1] + pow(q[1],3)*kg[1]
+ + q[1]*q[3] * q[3]*kg[1] + q[1] * q[1]*kg[1] * kg[1] - q[3] * q[3]*kg[1] * kg[1] - q[3] * q[3]*kg[2] * kg[2]
+ + q[0] * q[0]*( q[1] * q[1] - 3*q[1]*kg[1] + q[3]*(2*q[3] - 3*kg[3]) ) + q[3]*( 4*mDelta2 - 4*pow(p0,2)
+ + q[1] * q[1] + q[3] * q[3] + 2*q[1]*kg[1] )*kg[3] + 8*p0*q[0]*(q[1]*kg[1] + q[3]*kg[3]) )
+ ) / (3.*mDelta2*pow(mn,3));
+
+ tr[0][1] = -( C3v*( std::complex(0.,1.)*C5aNC*mDelta*( (mDelta + mn)*p0 - mn*q[0] )*q[3]*kg[2]*( 8*mn2
+ + 2*(p0 - q[0])*q[0] + q[1]*(q[1] + kg[1]) + q[3]*(q[3] + kg[3]) )
+ + C3vNC*mn*( 16*mDelta2*mn*(p0 - q[0])*q[0]*kg[1] + 4*pow(mDelta,3)*( 4*p0*q[0]*kg[1] + q[3]*(q[3]*kg[1]
+ - q[1]*kg[3]) ) + 4*mn*(p0 - q[0])*( pow(q[0],3)*(q[1] - 3*kg[1]) + 8*p0*q[0] * q[0]*kg[1]
+ + 2*p0*q[3]*(-(q[3]*kg[1]) + q[1]*kg[3]) + q[0]*( -4*pow(p0,2)*kg[1] + 2*q[3] * q[3]*kg[1]
+ + q[1]*kg[1]*(q[1] + kg[1]) + q[3]*(-q[1] + kg[1])*kg[3] ) )
+ + mDelta*( -16*pow(p0,3)*q[0]*kg[1] + q[3]*(q[3]*kg[1] - q[1]*kg[3])*( -3*q[0] * q[0] + q[1] * q[1]
+ + 2*q[1]*kg[1] + q[3]*(q[3] + 2*kg[3]) ) + 4*pow(p0,2)*( 8*q[0] * q[0]*kg[1]
+ + 3*q[3]*( -(q[3]*kg[1]) + q[1]*kg[3] ) ) +
+ 4*p0*q[0]*( q[0] * q[0]*(q[1] - 3*kg[1]) + q[1] * q[1]*kg[1] + q[3]*kg[1]*(4*q[3] + kg[3]) + q[1]*(kg[1] * kg[1] - 3*q[3]*kg[3]) ) ) ) )
+ ) / (12.*mDelta2*pow(mn,4));
+
+ tr[0][2] = ( std::complex