80 const InitialState & init_state = interaction -> InitState();
94 <<
"Option to generate kinematics uniformly not supported";
103 Range1D_t DNuEnergy = xsec_func.IntegrationRange();
104 double dDNuE = DNuEnergy.
max - DNuEnergy.
min;
105 ROOT::Math::BrentMinimizer1D minimizer;
106 minimizer.SetFunction( xsec_func, DNuEnergy.
min, DNuEnergy.
max);
107 minimizer.Minimize(1000, 1, 1
E-5);
108 double DNuE_for_xsec_max = minimizer.XMinimum();
109 double xsec_max = -1. * xsec_func(DNuE_for_xsec_max);
112 unsigned int iter = 0;
117 <<
"*** Could not select a valid DNuE after " << iter <<
" iterations";
118 event->EventFlags()->SetBitNumber(
kKineGenErr,
true);
120 exception.
SetReason(
"Couldn't select kinematics");
125 gDNuE = DNuEnergy.
min + dDNuE * rnd->
RndKine().Rndm();
126 LOG(
"COHDNu",
pINFO) <<
"Trying: E_N = " << gDNuE;
129 gxsec = -1. * xsec_func(gDNuE);
131 if(gxsec > xsec_max) {
132 double frac = TMath::Abs(gxsec-xsec_max)/xsec_max;
135 <<
"Current computed cross-section (" << gxsec/(
units::cm2)
136 <<
" cm2/GeV^2) exceeds the maximum cross-section (" 137 << xsec_max/(
units::cm2) <<
" beyond the specified tolerance";
145 <<
"dxsec/dQ2 = " << gxsec/(
units::cm2) <<
" cm2/GeV^2" 146 <<
"J = 1, rnd = " << t;
147 bool accept = (t<gxsec);
158 double ETimesM = E_nu * M_target;
159 double EPlusM = E_nu + M_target;
161 double p_DNu = TMath::Sqrt(gDNuE*gDNuE -
fDNuMass2);
162 double cos_theta_DNu = (gDNuE*EPlusM - ETimesM - 0.5*
fDNuMass2) / (E_nu * p_DNu);
163 double theta_DNu = TMath::ACos(cos_theta_DNu);
167 TVector3 unit_nudir = probe->
P4()->Vect().Unit();
169 TVector3 DNu_3vector = TVector3(0,0,0);
171 DNu_3vector.SetMagThetaPhi(p_DNu, theta_DNu, phi);
172 DNu_3vector.RotateUz(unit_nudir);
173 TLorentzVector P4_DNu = TLorentzVector(DNu_3vector, gDNuE);
177 double gQ2 = -(P4_DNu - *(probe->
P4())).M2();
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
const TLorentzVector * P4(void) const
Kinematics * KinePtr(void) const
A simple [min,max] interval for doubles.
Defines the EventGeneratorI interface.
const XSecAlgorithmI * fXSecModel
A singleton holding random number generator classes. All random number generation in GENIE should tak...
double fMaxXSecDiffTolerance
Summary information for an interaction.
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void SetFSLeptonP4(const TLorentzVector &p4)
static constexpr double cm2
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
static RunningThreadInfo * Instance(void)
void SwitchOnFastForward(void)
void SetReason(string reason)
const InitialState & InitState(void) const
void ClearRunningValues(void)
const Target & Tgt(void) const
static const unsigned int kRjMaxIterations
const EventGeneratorI * RunningThread(void)
double ProbeE(RefFrame_t rf) const
STDHEP-like event record entry that can fit a particle or a nucleus.
Keep info on the event generation thread currently on charge. This is used so that event generation m...
cet::coded_exception< error, detail::translate > exception
const UInt_t kISkipProcessChk
if set, skip process validity checks
Initial State information.