GENIEGenerator
Loading...
Searching...
No Matches
GSLXSecFunc.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8
9 Changes required to implement the GENIE Boosted Dark Matter module
10 were installed by Josh Berger (Univ. of Wisconsin)
11
12 Changes required to implement the GENIE Dark Neutrino module
13 were installed by Iker de Icaza (Univ. of Sussex)
14*/
15//____________________________________________________________________________
16
17#include <cassert>
18
19#include <TMath.h>
20
23#include "Framework/Conventions/GBuild.h"
33
34using namespace genie;
35
36//____________________________________________________________________________
38 const XSecAlgorithmI * m, const Interaction * i, double scale) :
39ROOT::Math::IBaseFunctionOneDim(),
40fModel(m),
42fScale(scale)
43{
44
45}
51{
52 return 1;
53}
55{
56// inputs:
57// Q2 [GeV^2]
58// outputs:
59// differential cross section [10^-38 cm^2 / GeV^2]
60//
61 double Q2 = xin;
62 fInteraction->KinePtr()->SetQ2(Q2);
63 double xsec = fModel->XSec(fInteraction, kPSQ2fE);
64#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
65 LOG("GSLXSecFunc", pDEBUG) << "xsec(Q2 = " << Q2 << ") = " << xsec;
66#endif
67 return fScale*xsec/(1E-38 * units::cm2);
68}
69ROOT::Math::IBaseFunctionOneDim *
75//____________________________________________________________________________
77 const XSecAlgorithmI * m, const Interaction * i) :
78ROOT::Math::IBaseFunctionOneDim(),
79fModel(m),
81{
82
83}
89{
90 return 1;
91}
93{
94// inputs:
95// y [-]
96// outputs:
97// differential cross section [10^-38 cm^2]
98//
99 double y = xin;
100 fInteraction->KinePtr()->Sety(y);
101 double xsec = fModel->XSec(fInteraction, kPSyfE);
102#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
103 LOG("GXSecFunc", pDEBUG) << "xsec(y = " << y << ") = " << xsec;
104#endif
105 return xsec/(1E-38 * units::cm2);
106}
107ROOT::Math::IBaseFunctionOneDim *
113//____________________________________________________________________________
115 const XSecAlgorithmI * m, const Interaction * i,
116 double DNuMass, double scale) :
117 ROOT::Math::IBaseFunctionOneDim(),
118 fModel(m),
119 fInteraction(i),
120 fDNuMass(DNuMass),
121 fScale(scale)
122{
123
124}
130{
131 return 1;
132}
134{
135// inputs:
136// DNuEnergy [GeV]
137// outputs:
138// differential cross section [10^-38 cm^2 / GeV]
139//
140
141 double DNuEnergy = xin;
142 double fDNuMass2 = fDNuMass*fDNuMass;
143
144 Kinematics * kinematics = fInteraction->KinePtr();
145 const TLorentzVector * P4_nu = fInteraction->InitStatePtr()->GetProbeP4(kRfLab);
146 double E_nu = P4_nu->E();
147 double M_target = fInteraction->InitState().Tgt().Mass();
148
149 double ETimesM = E_nu * M_target;
150 double EPlusM = E_nu + M_target;
151
152 double p_DNu = TMath::Sqrt(DNuEnergy*DNuEnergy - fDNuMass2);
153 double cos_theta_DNu = (DNuEnergy*(EPlusM) - ETimesM - 0.5*fDNuMass2) / (E_nu * p_DNu);
154 double theta_DNu = TMath::ACos(cos_theta_DNu);
155 TVector3 DNu_3vector = TVector3(0,0,0);
156 DNu_3vector.SetMagThetaPhi(p_DNu, theta_DNu, 0.);
157 TLorentzVector P4_DNu = TLorentzVector(DNu_3vector, DNuEnergy);
158 kinematics->SetFSLeptonP4(P4_DNu);
159
160 TVector3 target_3vector = P4_nu->Vect() - DNu_3vector;
161 double E_target = E_nu + M_target - DNuEnergy;
162 TLorentzVector P4_target = TLorentzVector(target_3vector , E_target);
163 kinematics->SetHadSystP4(P4_target);
164 kinematics->SetQ2(2.*M_target*(E_target-M_target));
165
166 delete P4_nu;
167 double xsec = fModel->XSec(fInteraction, kPSEDNufE);
168#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
169 LOG("GSLXSecFunc", pDEBUG) << "xsec(DNuEnergy = " << DNuEnergy << ") = " << xsec;
170#endif
171
172 return fScale*xsec/(1E-38 * units::cm2);
173}
174ROOT::Math::IBaseFunctionOneDim *
181{
182 // look at valid angles section at tech note
183 const double E = fInteraction->InitState().ProbeE(kRfLab);
184 const double M = fInteraction->InitState().Tgt().Mass();
185 const double M2 = M * M;
186 double fDNuMass2 = fDNuMass*fDNuMass;
187
188 const double A = M2 + 2.*M*E;
189 const double B = (M+E) * (E*M + 0.5*fDNuMass2);
190 const double C = E*E *(M2 + fDNuMass2) + E*M*fDNuMass2 + 0.25*fDNuMass2*fDNuMass2;
191 const double D = sqrt(B*B - A*C);
192 // Range1D_t DNuEnergy((B - D)/A, (B + D)/A);
193 // 12_04_2025 applying an upper bound on Ttarget at 1 GeV^2/2M --> lower bound on the integration range
194 // Otherwise the integral does funny things.
195 const double Tmax = std::min(E - ((B - D) / A), (1. / (2 * M)));
196 Range1D_t DNuEnergy(E - Tmax, (B + D) / A);
197 return DNuEnergy;
198}
199//____________________________________________________________________________
201 const XSecAlgorithmI * m, const Interaction * i) :
202ROOT::Math::IBaseFunctionMultiDim(),
203fModel(m),
205{
206
207}
213{
214 return 2;
215}
216double genie::utils::gsl::d2XSec_dxdy_E::DoEval(const double * xin) const
217{
218// inputs:
219// x [-]
220// y [-]
221// outputs:
222// differential cross section [10^-38 cm^2]
223//
224 double x = xin[0];
225 double y = xin[1];
226 fInteraction->KinePtr()->Setx(x);
227 fInteraction->KinePtr()->Sety(y);
229 double xsec = fModel->XSec(fInteraction, kPSxyfE);
230 return xsec/(1E-38 * units::cm2);
231}
232ROOT::Math::IBaseFunctionMultiDim *
238//____________________________________________________________________________
240 const XSecAlgorithmI * m, const Interaction * i) :
241ROOT::Math::IBaseFunctionMultiDim(),
242fModel(m),
244{
245
246}
252{
253 return 2;
254}
255double genie::utils::gsl::d2XSec_dQ2dy_E::DoEval(const double * xin) const
256{
257// inputs:
258// Q2 [-]
259// y [-]
260// outputs:
261// differential cross section [10^-38 cm^2]
262//
263 double Q2 = xin[0];
264 double y = xin[1];
265 fInteraction->KinePtr()->SetQ2(Q2);
266 fInteraction->KinePtr()->Sety(y);
268 double xsec = fModel->XSec(fInteraction, kPSQ2yfE);
269 return xsec/(1E-38 * units::cm2);
270}
271ROOT::Math::IBaseFunctionMultiDim *
277//____________________________________________________________________________
279 const XSecAlgorithmI * m, const Interaction * i, double scale) :
280ROOT::Math::IBaseFunctionMultiDim(),
281fModel(m),
282fInteraction(i),
283fScale(scale)
284{
285
286}
292{
293 return 2;
294}
296{
297// inputs:
298// log10(x) [-]
299// log10(Q2) [-]
300// outputs:
301// differential cross section [10^-38 cm^2]
302//
303 fInteraction->KinePtr()->Setx(TMath::Power(10,xin[0]));
304 fInteraction->KinePtr()->SetQ2(TMath::Power(10,xin[1]));
306 double xsec = fModel->XSec(fInteraction, kPSlog10xlog10Q2fE);
307 return fScale*xsec/(1E-38 * units::cm2);
308}
309ROOT::Math::IBaseFunctionMultiDim *
315//____________________________________________________________________________
317 const XSecAlgorithmI * m, const Interaction * i) :
318ROOT::Math::IBaseFunctionMultiDim(),
319fModel(m),
321{
322
323}
329{
330 return 3;
331}
332double genie::utils::gsl::d2XSec_dQ2dydt_E::DoEval(const double * xin) const
333{
334// inputs:
335// Q2 [-]
336// y [-]
337// t [-]
338// outputs:
339// differential cross section [10^-38 cm^2]
340//
341 //double E = fInteraction->InitState().ProbeE(kRfLab);
342 double Q2 = xin[0];
343 double y = xin[1];
344 double t = xin[2];
345 fInteraction->KinePtr()->SetQ2(Q2);
346 fInteraction->KinePtr()->Sety(y);
347 fInteraction->KinePtr()->Sett(t);
349 double xsec = fModel->XSec(fInteraction, kPSQ2yfE);
350 return xsec/(1E-38 * units::cm2);
351}
352ROOT::Math::IBaseFunctionMultiDim *
358//____________________________________________________________________________
360 const XSecAlgorithmI * m, const Interaction * i) :
361ROOT::Math::IBaseFunctionMultiDim(),
362fModel(m),
364{
365
366}
372{
373 return 3;
374}
375double genie::utils::gsl::d3XSec_dxdydt_E::DoEval(const double * xin) const
376{
377// inputs:
378// x [-]
379// y [-]
380// t [-]
381// outputs:
382// differential cross section [10^-38 cm^2]
383//
384 //double E = fInteraction->InitState().ProbeE(kRfLab);
385 double x = xin[0];
386 double y = xin[1];
387 double t = xin[2];
388 fInteraction->KinePtr()->Setx(x);
389 fInteraction->KinePtr()->Sety(y);
390 fInteraction->KinePtr()->Sett(t);
391 double xsec = fModel->XSec(fInteraction, kPSxytfE);
392 return xsec/(1E-38 * units::cm2);
393}
394ROOT::Math::IBaseFunctionMultiDim *
400//____________________________________________________________________________
402 const XSecAlgorithmI * m, const Interaction * i) :
403ROOT::Math::IBaseFunctionMultiDim(),
404fModel(m),
406{
407
408}
414{
415 return 2;
416}
417double genie::utils::gsl::d2XSec_dWdQ2_E::DoEval(const double * xin) const
418{
419// inputs:
420// W [GeV]
421// Q2 [GeV^2]
422// outputs:
423// differential cross section [10^-38 cm^2/GeV^3]
424//
425 double W = xin[0];
426 double Q2 = xin[1];
427 fInteraction->KinePtr()->SetW(W);
428 fInteraction->KinePtr()->SetQ2(Q2);
429 if(fInteraction->ProcInfo().IsDeepInelastic() ||
430 fInteraction->ProcInfo().IsDarkMatterDeepInelastic()) {
431 double x=0,y=0;
432 double E = fInteraction->InitState().ProbeE(kRfHitNucRest);
433 double M = fInteraction->InitState().Tgt().HitNucP4Ptr()->M();
434
435 kinematics::WQ2toXY(E,M,W,Q2,x,y);
436 fInteraction->KinePtr()->Setx(x);
437 fInteraction->KinePtr()->Sety(y);
438 }
439 double xsec = fModel->XSec(fInteraction, kPSWQ2fE);
440 return xsec/(1E-38 * units::cm2);
441}
442ROOT::Math::IBaseFunctionMultiDim *
448//____________________________________________________________________________
450 const XSecAlgorithmI * m, const Interaction * i, double x) :
451ROOT::Math::IBaseFunctionOneDim(),
452fModel(m),
453fInteraction(i),
454fx(x)
455{
456
457}
463{
464 return 1;
465}
467{
468// inputs:
469// y [-]
470// outputs:
471// differential cross section [10^-38 cm^2]
472//
473 double y = xin;
474 fInteraction->KinePtr()->Setx(fx);
475 fInteraction->KinePtr()->Sety(y);
476 double xsec = fModel->XSec(fInteraction, kPSxyfE);
477 return xsec/(1E-38 * units::cm2);
478}
479ROOT::Math::IBaseFunctionOneDim *
485//____________________________________________________________________________
487 const XSecAlgorithmI * m, const Interaction * i, double y) :
488ROOT::Math::IBaseFunctionOneDim(),
489fModel(m),
490fInteraction(i),
491fy(y)
492{
493
494}
500{
501 return 1;
502}
504{
505// inputs:
506// x [-]
507// outputs:
508// differential cross section [10^-38 cm^2]
509//
510 double x = xin;
511 fInteraction->KinePtr()->Setx(x);
512 fInteraction->KinePtr()->Sety(fy);
513 double xsec = fModel->XSec(fInteraction, kPSxyfE);
514 return xsec/(1E-38 * units::cm2);
515}
516ROOT::Math::IBaseFunctionOneDim *
522//____________________________________________________________________________
524 const XSecAlgorithmI * m, const Interaction * i, double W) :
525ROOT::Math::IBaseFunctionOneDim(),
526fModel(m),
527fInteraction(i),
528fW(W)
529{
530
531}
537{
538 return 1;
539}
541{
542// inputs:
543// Q2 [GeV^2]
544// outputs:
545// differential cross section [10^-38 cm^2/GeV^3]
546//
547 double Q2 = xin;
548 fInteraction->KinePtr()->SetW(fW);
549 fInteraction->KinePtr()->SetQ2(Q2);
550 double xsec = fModel->XSec(fInteraction, kPSWQ2fE);
551 return xsec/(1E-38 * units::cm2);
552}
553ROOT::Math::IBaseFunctionOneDim *
559//____________________________________________________________________________
561 const XSecAlgorithmI * m, const Interaction * i, double Q2) :
562ROOT::Math::IBaseFunctionOneDim(),
563fModel(m),
564fInteraction(i),
565fQ2(Q2)
566{
567
568}
574{
575 return 1;
576}
578{
579// inputs:
580// W [GeV]
581// outputs:
582// differential cross section [10^-38 cm^2/GeV^3]
583//
584 double W = xin;
585 fInteraction->KinePtr()->SetW(W);
586 fInteraction->KinePtr()->SetQ2(fQ2);
587 double xsec = fModel->XSec(fInteraction,kPSWQ2fE);
588 return xsec/(1E-38 * units::cm2);
589}
590ROOT::Math::IBaseFunctionOneDim *
596//____________________________________________________________________________
597//
598// This just returns the 5-D differential cross section
599//
601 const XSecAlgorithmI * m, const Interaction * i) :
602ROOT::Math::IBaseFunctionMultiDim(),
603fModel(m),
604fInteraction(i),
605flip(false)
606{
607
608}
612
613unsigned int genie::utils::gsl::d5XSecAR::NDim(void) const
614{
615 return 5;
616}
617double genie::utils::gsl::d5XSecAR::DoEval(const double * xin) const
618{
619// inputs:
620// x [-]
621// y [-]
622// outputs:
623// differential cross section [10^-38 cm^2]
624//
625
626 Kinematics * kinematics = fInteraction->KinePtr();
627 const TLorentzVector * P4_nu = fInteraction->InitStatePtr()->GetProbeP4(kRfLab);
628 double E_nu = P4_nu->E();
629
630 double E_l = xin[0];
631 double theta_l = xin[1];
632 double phi_l = xin[2];
633 double theta_pi = xin[3];
634 double phi_pi = xin[4];
635
636 double E_pi= E_nu-E_l;
637
638 double y = E_pi/E_nu;
639
640 double m_l = fInteraction->FSPrimLepton()->Mass();
641 if (E_l < m_l) {
642 return 0.;
643 }
644
645 double m_pi;
646 if ( fInteraction->ProcInfo().IsWeakCC() ) {
648 }
649 else {
650 m_pi = constants::kPi0Mass;
651 }
652
653
654 double p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
655 TVector3 lepton_3vector = TVector3(0,0,0);
656 lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
657 TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
658
659 double p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
660 TVector3 pion_3vector = TVector3(0,0,0);
661 pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
662 TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
663
664 double Q2 = -(*P4_nu-P4_lep).Mag2();
665
666 double x = Q2/(2*E_pi*constants::kNucleonMass);
667
668 Range1D_t xlim = fInteraction->PhaseSpace().XLim();
669
670 if ( x < xlim.min || x > xlim.max ) {
671 return 0.;
672 }
673
674 kinematics->Setx(x);
675 kinematics->Sety(y);
677
678 kinematics->SetFSLeptonP4(P4_lep );
679 kinematics->SetHadSystP4 (P4_pion); // use Hadronic System variable to store pion momentum
680
681 double xsec = fModel->XSec(fInteraction);
682 if (xsec>0 && flip) {
683 xsec = xsec*-1.0;
684 }
685 delete P4_nu;
686 //return xsec/(1E-38 * units::cm2);
687 return xsec;
688}
689
690ROOT::Math::IBaseFunctionMultiDim *
696
697//____________________________________________________________________________
698//
699// This is the original 5-D cross-section that Steve D coded
700//
702 const XSecAlgorithmI * m, const Interaction * i) :
703ROOT::Math::IBaseFunctionMultiDim(),
704fModel(m),
706{
707
708}
714{
715 return 5;
716}
718{
719// inputs:
720// x [-]
721// y [-]
722// outputs:
723// differential cross section [10^-38 cm^2]
724//
725 Kinematics * kinematics = fInteraction->KinePtr();
726 const TLorentzVector * P4_nu = fInteraction->InitStatePtr()->GetProbeP4(kRfLab);
727 double E_nu = P4_nu->E();
728
729 double E_l = xin[0];
730 double theta_l = xin[1];
731 double phi_l = xin[2];
732 double theta_pi = xin[3];
733 double phi_pi = xin[4];
734
735 double E_pi= E_nu-E_l;
736
737 double y = E_pi/E_nu;
738
739 double m_l = fInteraction->FSPrimLepton()->Mass();
740 if (E_l < m_l) {
741 return 0.;
742 }
743
744 double m_pi;
745 if ( fInteraction->ProcInfo().IsWeakCC() ) {
747 }
748 else {
749 m_pi = constants::kPi0Mass;
750 }
751
752 double p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
753 TVector3 lepton_3vector = TVector3(0,0,0);
754 lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
755 TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
756
757 double p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
758 TVector3 pion_3vector = TVector3(0,0,0);
759 pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
760 TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
761
762 double Q2 = -(*P4_nu-P4_lep).Mag2();
763
764 double x = Q2/(2*E_pi*constants::kNucleonMass);
765
766 Range1D_t xlim = fInteraction->PhaseSpace().XLim();
767
768 if ( x < xlim.min || x > xlim.max ) {
769 return 0.;
770 }
771
772 kinematics->Setx(x);
773 kinematics->Sety(y);
775
776 kinematics->SetFSLeptonP4(P4_lep );
777 kinematics->SetHadSystP4 (P4_pion); // use Hadronic System variable to store pion momentum
778
779 delete P4_nu;
780
781 double xsec = fModel->XSec(fInteraction)*TMath::Sin(theta_l)*TMath::Sin(theta_pi);
782 return xsec/(1E-38 * units::cm2);
783}
784
785ROOT::Math::IBaseFunctionMultiDim *
791
792//____________________________________________________________________________
793//
794// This is the same as the 5d space that Steve D coded,
795// But we remove the integration of phi_l
796//
797
799 const XSecAlgorithmI * m, const Interaction * i) :
800ROOT::Math::IBaseFunctionMultiDim(),
801fModel(m),
803{
804
805}
811{
812 return 4;
813}
815{
816// inputs:
817// El [GeV]
818// theta l [rad]
819// theta pi [rad]
820// phi pi [rad]
821// outputs:
822// differential cross section [10^-38 cm^2]
823//
824 Kinematics * kinematics = fInteraction->KinePtr();
825 const TLorentzVector * P4_nu = fInteraction->InitStatePtr()->GetProbeP4(kRfLab);
826 double E_nu = P4_nu->E();
827
828 double E_l = xin[0];
829 double theta_l = xin[1];
830 double phi_l = 0.0;
831 double theta_pi = xin[2];
832 double phi_pi = xin[3];
833
834 double sin_theta_l = TMath::Sin(theta_l);
835 double sin_theta_pi = TMath::Sin(theta_pi);
836
837 double E_pi= E_nu-E_l;
838
839 double y = E_pi/E_nu;
840
841 double m_l = fInteraction->FSPrimLepton()->Mass();
842 if (E_l < m_l) {
843 return 0.;
844 }
845
846 double m_pi;
847 if ( fInteraction->ProcInfo().IsWeakCC() ) {
849 }
850 else {
851 m_pi = constants::kPi0Mass;
852 }
853
854 double p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
855 TVector3 lepton_3vector = TVector3(0,0,0);
856 lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
857 TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
858
859 double p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
860 TVector3 pion_3vector = TVector3(0,0,0);
861 pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
862 TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
863
864 double Q2 = -(*P4_nu-P4_lep).Mag2();
865
866 double x = Q2/(2*E_pi*constants::kNucleonMass);
867
868 Range1D_t xlim = fInteraction->PhaseSpace().XLim();
869
870 if ( x < xlim.min || x > xlim.max ) {
871 return 0.;
872 }
873
874 kinematics->Setx(x);
875 kinematics->Sety(y);
877
878 kinematics->SetFSLeptonP4(P4_lep );
879 kinematics->SetHadSystP4 (P4_pion); // use Hadronic System variable to store pion momentum
880
881 delete P4_nu;
882
883 double xsec = sin_theta_l * sin_theta_pi * fModel->XSec(fInteraction,kPSElOlTpifE);
884 return fFactor * xsec/(1E-38 * units::cm2);
885}
886ROOT::Math::IBaseFunctionMultiDim *
893{
894 fFactor = factor;
895}
900//____________________________________________________________________________
902 const XSecAlgorithmI * m, const Interaction * i) :
903ROOT::Math::IBaseFunctionMultiDim(),
904fModel(m),
905fInteraction(i),
906fElep(-1)
907{
908
909}
915{
916 return 3;
917}
919{
920// inputs:
921// theta l [rad]
922// phi_l [rad]
923// phi pi [rad]
924// outputs:
925// differential cross section [10^-38 cm^2]
926//
927 Kinematics * kinematics = fInteraction->KinePtr();
928 const TLorentzVector * P4_nu = fInteraction->InitStatePtr()->GetProbeP4(kRfLab);
929 double E_nu = P4_nu->E();
930
931 double E_l = fElep;
932
933 double theta_l = xin[0];
934 double phi_l = xin[1];
935 double theta_pi = xin[2];
936 double phi_pi = 0;
937
938 double sin_theta_l = TMath::Sin(theta_l);
939 double sin_theta_pi = TMath::Sin(theta_pi);
940
941 double E_pi= E_nu-E_l;
942
943 double y = E_pi/E_nu;
944
945 double m_l = fInteraction->FSPrimLepton()->Mass();
946 if (E_l < m_l) {
947 return 0.;
948 }
949
950 double m_pi;
951 if ( fInteraction->ProcInfo().IsWeakCC() ) {
953 }
954 else {
955 m_pi = constants::kPi0Mass;
956 }
957
958 double p_l = TMath::Sqrt(E_l*E_l - m_l*m_l);
959 TVector3 lepton_3vector = TVector3(0,0,0);
960 lepton_3vector.SetMagThetaPhi(p_l,theta_l,phi_l);
961 TLorentzVector P4_lep = TLorentzVector(lepton_3vector , E_l );
962
963 double p_pi = TMath::Sqrt(E_pi*E_pi - m_pi*m_pi);
964 TVector3 pion_3vector = TVector3(0,0,0);
965 pion_3vector.SetMagThetaPhi(p_pi,theta_pi,phi_pi);
966 TLorentzVector P4_pion = TLorentzVector(pion_3vector , E_pi);
967
968 double Q2 = -(*P4_nu-P4_lep).Mag2();
969
970 double x = Q2/(2*E_pi*constants::kNucleonMass);
971
972 Range1D_t xlim = fInteraction->PhaseSpace().XLim();
973
974 if ( x < xlim.min || x > xlim.max ) {
975 return 0.;
976 }
977
978 kinematics->Setx(x);
979 kinematics->Sety(y);
981
982 kinematics->SetFSLeptonP4(P4_lep );
983 kinematics->SetHadSystP4 (P4_pion); // use Hadronic System variable to store pion momentum
984
985 delete P4_nu;
986
987 double xsec = (sin_theta_l * sin_theta_pi) * fModel->XSec(fInteraction,kPSElOlTpifE);
988 return xsec/(1E-38 * units::cm2);
989}
997//____________________________________________________________________________
999{
1000 fElep = E_lepton;
1001}
1002//____________________________________________________________________________
1004 const XSecAlgorithmI * m, const Interaction * i,
1005 string gsl_nd_integrator_type, double gsl_relative_tolerance,
1006 unsigned int max_n_calls) :
1007ROOT::Math::IBaseFunctionOneDim(),
1008fModel(m),
1009fInteraction(i),
1010integrator(utils::gsl::IntegrationNDimTypeFromString(gsl_nd_integrator_type),1, gsl_relative_tolerance, max_n_calls),
1011fGSLIntegratorType(gsl_nd_integrator_type),
1012fGSLRelTol(gsl_relative_tolerance),
1013fGSLMaxCalls(max_n_calls)
1014{
1016
1017 integrator.SetRelTolerance(gsl_relative_tolerance);
1018 integrator.SetFunction(*func);
1019
1021
1024}
1030{
1031 double Elep = xin;
1032 func->SetE_lep(Elep);
1033 double xsec = integrator.Integral(&kine_min[0], &kine_max[0]) ;
1034 LOG("GSLXSecFunc",pINFO) << "dXSec_dElep_AR >> "<<func->NDim()<<"d integral done. (Elep = " <<Elep<< " , dxsec/dElep = "<<xsec << ")";
1035 return xsec;
1036}
1043//____________________________________________________________________________
1045 const ROOT::Math::IBaseFunctionMultiDim * fn,
1046 bool * ifLog, double * mins, double * maxes) :
1047 fFn(fn),
1048 fIfLog(ifLog),
1049 fMins(mins),
1050 fMaxes(maxes)
1051{
1052}
1056//____________________________________________________________________________
1057
1058// ROOT::Math::IBaseFunctionMultiDim interface
1060{
1061 return fFn->NDim();
1062}
1063//____________________________________________________________________________
1064double genie::utils::gsl::dXSec_Log_Wrapper::DoEval (const double * xin) const
1065{
1066 double * toEval = new double[this->NDim()];
1067 double a,b,x;
1068 for (unsigned int i = 0 ; i < this->NDim() ; i++ )
1069 {
1070 if (fIfLog[i]) {
1071 a = fMins[i];
1072 b = fMaxes[i];
1073 x = xin[i];
1074 toEval[i] = a + (b-a)/(constants::kNapierConst-1.) * (exp(x/(b-a)) - 1.);
1075 }
1076 else {
1077 toEval[i] = xin[i];
1078 }
1079 }
1080 double val = (*fFn)(toEval);
1081 delete[] toEval;
1082 return val;
1083}
1084ROOT::Math::IBaseFunctionMultiDim * genie::utils::gsl::dXSec_Log_Wrapper::Clone (void) const
1085{
1087}
1088
1089//_____________________________________________________________________________
1091 const XSecAlgorithmI * m, const Interaction * i, double scale) :
1092ROOT::Math::IBaseFunctionMultiDim(),
1093fModel(m),
1094fInteraction(i),
1095fScale(scale)
1096{
1097
1098}
1099//____________________________________________________________________________
1104//____________________________________________________________________________
1106{
1107 return 2;
1108}
1109//____________________________________________________________________________
1110double genie::utils::gsl::d2Xsec_dn1dn2_E::DoEval(const double * xin) const
1111{
1112// inputs:
1113// n1
1114// n2
1115// outputs:
1116// differential cross section (hbar=c=1 units)
1117//
1118
1119 double n1 = xin[0];
1120 double n2 = xin[1];
1121
1122 Kinematics * kinematics = fInteraction->KinePtr();
1123 kinematics->SetKV(kKVn1, n1);
1124 kinematics->SetKV(kKVn2, n2);
1125
1126 double xsec = fModel->XSec(fInteraction, kPSn1n2fE);
1127 return fScale*xsec/(1E-38 * units::cm2);
1128}
1129//____________________________________________________________________________
1130ROOT::Math::IBaseFunctionMultiDim *
1136//_____________________________________________________________________________
1138 const XSecAlgorithmI * m, const Interaction * i, double scale) :
1139ROOT::Math::IBaseFunctionMultiDim(),
1140fModel(m),
1141fInteraction(i),
1142fScale(scale)
1143{
1144
1145}
1146//____________________________________________________________________________
1151//____________________________________________________________________________
1153{
1154 return 3;
1155}
1156//____________________________________________________________________________
1158{
1159// inputs:
1160// n1
1161// n2
1162// n3
1163// outputs:
1164// differential cross section (hbar=c=1 units)
1165//
1166
1167 double n1 = xin[0];
1168 double n2 = xin[1];
1169 double n3 = xin[2];
1170
1171 Kinematics * kinematics = fInteraction->KinePtr();
1172 kinematics->SetKV(kKVn1, n1);
1173 kinematics->SetKV(kKVn2, n2);
1174 kinematics->SetKV(kKVn3, n3);
1175
1176 double xsec = fModel->XSec(fInteraction, kPSn1n2n3fE);
1177 return fScale*xsec/(1E-38 * units::cm2);
1178}
1179//____________________________________________________________________________
1180ROOT::Math::IBaseFunctionMultiDim *
#define pINFO
Definition Messenger.h:62
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Summary information for an interaction.
Definition Interaction.h:56
Generated/set kinematical variables for an event.
Definition Kinematics.h:39
A simple [min,max] interval for doubles.
Definition Range1.h:43
Cross Section Calculation Interface.
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
d2XSec_dQ2dy_E(const XSecAlgorithmI *m, const Interaction *i)
const Interaction * fInteraction
unsigned int NDim(void) const
double DoEval(const double *xin) const
const XSecAlgorithmI * fModel
double DoEval(const double *xin) const
unsigned int NDim(void) const
d2XSec_dQ2dydt_E(const XSecAlgorithmI *m, const Interaction *i)
const XSecAlgorithmI * fModel
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
unsigned int NDim(void) const
d2XSec_dWdQ2_EQ2(const XSecAlgorithmI *m, const Interaction *i, double Q2)
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
double DoEval(double xin) const
const XSecAlgorithmI * fModel
double DoEval(double xin) const
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
d2XSec_dWdQ2_EW(const XSecAlgorithmI *m, const Interaction *i, double W)
const XSecAlgorithmI * fModel
unsigned int NDim(void) const
const XSecAlgorithmI * fModel
const Interaction * fInteraction
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
double DoEval(const double *xin) const
unsigned int NDim(void) const
d2XSec_dWdQ2_E(const XSecAlgorithmI *m, const Interaction *i)
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
double DoEval(const double *xin) const
d2XSec_dlog10xdlog10Q2_E(const XSecAlgorithmI *m, const Interaction *i, double scale=1.)
d2XSec_dxdy_E(const XSecAlgorithmI *m, const Interaction *i)
const Interaction * fInteraction
double DoEval(const double *xin) const
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
unsigned int NDim(void) const
const XSecAlgorithmI * fModel
unsigned int NDim(void) const
double DoEval(double xin) const
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
const Interaction * fInteraction
const XSecAlgorithmI * fModel
d2XSec_dxdy_Ex(const XSecAlgorithmI *m, const Interaction *i, double x)
unsigned int NDim(void) const
const Interaction * fInteraction
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
const XSecAlgorithmI * fModel
double DoEval(double xin) const
d2XSec_dxdy_Ey(const XSecAlgorithmI *m, const Interaction *i, double x)
double DoEval(const double *xin) const
d2Xsec_dn1dn2_E(const XSecAlgorithmI *m, const Interaction *i, double scale=1.)
unsigned int NDim(void) const
const XSecAlgorithmI * fModel
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
double DoEval(const double *xin) const
d2Xsec_dn1dn2dn3_E(const XSecAlgorithmI *m, const Interaction *i, double scale=1.)
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
unsigned int NDim(void) const
double DoEval(const double *xin) const
const XSecAlgorithmI * fModel
d3XSec_dxdydt_E(const XSecAlgorithmI *m, const Interaction *i)
double DoEval(const double *xin) const
d3Xsec_dOmegaldThetapi(const XSecAlgorithmI *m, const Interaction *i)
void SetE_lep(double E_lepton) const
d3Xsec_dOmegaldThetapi * Clone(void) const
double DoEval(const double *xin) const
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
d4Xsec_dEldThetaldOmegapi(const XSecAlgorithmI *m, const Interaction *i)
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
double DoEval(const double *xin) const
const Interaction * fInteraction
d5XSecAR(const XSecAlgorithmI *m, const Interaction *i)
unsigned int NDim(void) const
const XSecAlgorithmI * fModel
double DoEval(const double *xin) const
d5Xsec_dEldOmegaldOmegapi(const XSecAlgorithmI *m, const Interaction *i)
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
ROOT::Math::IBaseFunctionMultiDim * Clone(void) const
const ROOT::Math::IBaseFunctionMultiDim * fFn
dXSec_Log_Wrapper(const ROOT::Math::IBaseFunctionMultiDim *fn, bool *ifLog, double *min, double *maxes)
double DoEval(const double *xin) const
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
Range1D_t IntegrationRange(void) const
const Interaction * fInteraction
Definition GSLXSecFunc.h:99
const XSecAlgorithmI * fModel
Definition GSLXSecFunc.h:98
dXSec_dEDNu_E(const XSecAlgorithmI *m, const Interaction *i, double DNuMass, double scale=1.)
double DoEval(double xin) const
unsigned int NDim(void) const
const genie::utils::gsl::d3Xsec_dOmegaldThetapi * func
dXSec_dElep_AR * Clone(void) const
const XSecAlgorithmI * fModel
double DoEval(double xin) const
const Interaction * fInteraction
ROOT::Math::IntegratorMultiDim integrator
dXSec_dQ2_E(const XSecAlgorithmI *m, const Interaction *i, double scale=1.)
double DoEval(double xin) const
const Interaction * fInteraction
Definition GSLXSecFunc.h:54
unsigned int NDim(void) const
const XSecAlgorithmI * fModel
Definition GSLXSecFunc.h:53
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
dXSec_dy_E(const XSecAlgorithmI *m, const Interaction *i)
const Interaction * fInteraction
Definition GSLXSecFunc.h:76
const XSecAlgorithmI * fModel
Definition GSLXSecFunc.h:75
ROOT::Math::IBaseFunctionOneDim * Clone(void) const
double DoEval(double xin) const
unsigned int NDim(void) const
const double a
static const double kASmallNum
Definition Controls.h:40
static constexpr double cm2
Definition Units.h:69
Simple utilities for integrating GSL in the GENIE framework.
ROOT::Math::IntegrationMultiDim::Type IntegrationNDimTypeFromString(string type)
Definition GSLUtils.cxx:59
Kinematical utilities.
void UpdateWQ2FromXY(const Interaction *in)
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
void UpdateWYFromXQ2(const Interaction *in)
void UpdateXFromQ2Y(const Interaction *in)
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
@ kPSlog10xlog10Q2fE
@ kKVn2
Definition KineVar.h:62
@ kKVn1
Definition KineVar.h:61
@ kKVn3
Definition KineVar.h:63
@ kRfHitNucRest
Definition RefFrame.h:30
@ kRfLab
Definition RefFrame.h:26