14 #include <Math/IFunction.h> 15 #include <Math/GSLMinimizer1D.h> 16 #include <Math/BrentMinimizer1D.h> 38 using namespace genie;
81 const InitialState & init_state = interaction -> InitState();
83 const double Q2min = Q2.
min;
84 const double Q2max = Q2.
max;
85 const double dQ2 = Q2max - Q2min;
98 <<
"Option to generate kinematics uniformly not supported";
125 ROOT::Math::IBaseFunctionOneDim * xsec_func =
127 ROOT::Math::BrentMinimizer1D minimizer;
128 minimizer.SetFunction(*xsec_func,Q2min,Q2max);
129 minimizer.Minimize(1000,1,1E-5);
130 double Q2_for_xsec_max = minimizer.XMinimum();
135 <<
"Maximizing dsig(Q2;E = " << E <<
"GeV)/dQ2 gave a value of " 136 << xsec_max/(
units::cm2) <<
" cm2/GeV^2 at Q2 = " 137 << Q2_for_xsec_max <<
" GeV^2";
140 unsigned int iter = 0;
145 <<
"*** Could not select a valid Q2 after " << iter <<
" iterations";
146 event->EventFlags()->SetBitNumber(
kKineGenErr,
true);
148 exception.
SetReason(
"Couldn't select kinematics");
153 gQ2 = Q2min + dQ2 * rnd->
RndKine().Rndm();
160 if(gxsec > xsec_max) {
161 double frac = TMath::Abs(gxsec-xsec_max)/xsec_max;
164 <<
"Current computed cross-section (" << gxsec/(
units::cm2)
165 <<
" cm2/GeV^2) exceeds the maximum cross-section (" 166 << xsec_max/(
units::cm2) <<
" beyond the specified tolerance";
174 <<
"dxsec/dQ2 = " << gxsec/(
units::cm2) <<
" cm2/GeV^2" 175 <<
"J = 1, rnd = " << t;
176 bool accept = (t<gxsec);
181 LOG(
"CEvNS",
pNOTICE) <<
"Selected Q2 = " << gQ2 <<
" GeV^2";
192 event->SetDiffXSec(gxsec,
kPSQ2fE);
200 int target_pdgc = target->
Pdg();
203 double Ev = probe->
E();
204 double Q2 =
event->Summary()->Kine().Q2(
true);
206 const TLorentzVector & vtx = *(probe->
X4());
207 TLorentzVector x4l(vtx);
211 double y = Q2/(2*M*Ev);
212 double El = (1-
y)*Ev;
215 <<
"Final state neutrino energy: E = " << El <<
" GeV";
221 double plp = El - 0.5*(Q2+ml2)/Ev;
222 double plt = TMath::Sqrt(TMath::Max(0.,El*El-plp*plp-ml2));
225 <<
"Final state neutrino momentum components: |p//| = " 226 << plp <<
" GeV, [pT] = " << plt <<
" GeV";
230 double phi = 2*
kPi * rnd->
RndLep().Rndm();
231 double pltx = plt * TMath::Cos(phi);
232 double plty = plt * TMath::Sin(phi);
235 TVector3 unit_nudir = probe->
P4()->Vect().Unit();
239 TVector3 p3l(pltx,plty,plp);
240 p3l.RotateUz(unit_nudir);
243 TLorentzVector p4l(p3l,El);
252 event->Summary()->KinePtr()->SetFSLeptonP4(p4l);
261 const TLorentzVector & p4probe = * ( probe -> P4() );
262 const TLorentzVector & p4target = * ( target -> P4() );
263 const TLorentzVector & p4fsl = * ( fsl -> P4() );
265 const TLorentzVector & p4recoil = p4probe + p4target - p4fsl;
270 const TLorentzVector & vtx = *(probe->
X4());
275 event->TargetNucleusPosition(),
276 -1,-1,-1, p4recoil, vtx);
double fMaxXSecDiffTolerance
const XSecAlgorithmI * fXSecModel
const KPhaseSpace & PhaseSpace(void) const
THE MAIN GENIE PROJECT NAMESPACE
double E(void) const
Get energy.
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
double Q2(const Interaction *const i)
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
const TLorentzVector * P4(void) const
Kinematics * KinePtr(void) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
int FirstDaughter(void) const
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
A simple [min,max] interval for doubles.
Defines the EventGeneratorI interface.
string P4AsString(const TLorentzVector *p)
Range1D_t Q2Lim(void) const
Q2 limits.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
void AddRecoilNucleus(GHepRecord *event) const
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 Configure(const Registry &config)
static constexpr double cm2
virtual void Configure(const Registry &config)
virtual GHepParticle * TargetNucleus(void) const
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Misc GENIE control constants.
void AddFinalStateNeutrino(GHepRecord *event) const
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
void GenerateKinematics(GHepRecord *event) const
static RunningThreadInfo * Instance(void)
void SwitchOnFastForward(void)
static PDGLibrary * Instance(void)
void SetReason(string reason)
const TLorentzVector * X4(void) const
A registry. Provides the container for algorithm configuration parameters.
void ProcessEventRecord(GHepRecord *event) const
TParticlePDG * Find(int pdgc, bool must_exist=true)
void ClearRunningValues(void)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
static const unsigned int kRjMaxIterations
const EventGeneratorI * RunningThread(void)
double ProbeE(RefFrame_t rf) const
GENIE's GHEP MC event record.
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...
Root of GENIE utility namespaces.
cet::coded_exception< error, detail::translate > exception
const UInt_t kISkipProcessChk
if set, skip process validity checks
Event finding and building.
Initial State information.