82 LOG(
"QELEvent",
pINFO) <<
"Generating QE event kinematics...";
86 <<
"Generating kinematics uniformly over the allowed phase space";
91 const InitialState & init_state = interaction -> InitState();
96 if(! evrec->HitNucleon())
98 LOG(
"QELEvent",
pFATAL) <<
"No hit nucleon was set";
107 double hitNucPos = nucleon->
X4()->Vect().Mag();
119 bool isHeavyNucleus = tgt->
A()>=3;
129 double vmax= isHeavyNucleus?this->
MaxDiffv(evrec) : 0.;
134 unsigned int iter = 0;
139 LOG(
"QELEvent",
pINFO) <<
"Attempt #: " << iter;
143 <<
"Couldn't select a valid kinematics after " << iter <<
" iterations";
144 evrec->EventFlags()->SetBitNumber(
kKineGenErr,
true);
146 exception.
SetReason(
"Couldn't select kinematics");
152 double xsec_max = 0.;
153 double pth = rnd->
RndKine().Rndm();
157 xsec_max = xsec_max1;
162 xsec_max = xsec_max2;
170 v = vmax * rnd->
RndKine().Rndm();
187 double t = xsec_max * rnd->
RndKine().Rndm();
189 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 190 LOG(
"QELEvent",
pDEBUG)<<
"xsec= " << xsec <<
", J= " <<
J <<
", Rnd= " <<
t;
210 double qv = TMath::Sqrt(v*v+gQ2);
211 TLorentzVector transferMom(0, 0, qv, v);
217 TLorentzVector * tempTLV = evrec->Probe()->GetP4();
218 TLorentzVector neutrinoMom = *tempTLV;
222 double theta = neutrinoMom.Vect().Theta();
223 double phi = neutrinoMom.Vect().Phi();
224 double theta_k =
sm_utils-> GetTheta_k(v, qv);
225 double costheta_k = TMath::Cos(theta_k);
226 double sintheta_k = TMath::Sin(theta_k);
228 double theta_p =
sm_utils-> GetTheta_p(kF, v, qv, E_p);
229 double costheta_p = TMath::Cos(theta_p);
230 double sintheta_p = TMath::Sin(theta_p);
231 double fi_p = 2 * TMath::Pi() * rnd->
RndGen().Rndm();
232 double cosfi_p = TMath::Cos(fi_p);
233 double sinfi_p = TMath::Sin(fi_p);
234 double psi = 2 * TMath::Pi() * rnd->
RndGen().Rndm();
237 TLorentzVector neutrinoMomZ(neutrinoMom.P()*sintheta_k, 0, neutrinoMom.P()*costheta_k, neutrinoMom.E());
240 TLorentzVector outLeptonMom = neutrinoMomZ-transferMom;
243 TLorentzVector inNucleonMom(kF*sintheta_p*cosfi_p, kF*sintheta_p*sinfi_p, kF*costheta_p, E_p);
246 TLorentzVector outNucleonMom = inNucleonMom+transferMom;
250 TVector3 yvec (0.0, 1.0, 0.0);
251 TVector3 zvec (0.0, 0.0, 1.0);
252 TVector3 unit_nudir = neutrinoMom.Vect().Unit();
254 outLeptonMom.Rotate(theta-theta_k, yvec);
255 outLeptonMom.Rotate(phi, zvec);
257 inNucleonMom.Rotate(theta-theta_k, yvec);
258 inNucleonMom.Rotate(phi, zvec);
260 outNucleonMom.Rotate(theta-theta_k, yvec);
261 outNucleonMom.Rotate(phi, zvec);
263 outLeptonMom.Rotate(psi, unit_nudir);
264 inNucleonMom.Rotate(psi, unit_nudir);
265 outNucleonMom.Rotate(psi, unit_nudir);
269 p4->SetPx( inNucleonMom.Px() );
270 p4->SetPy( inNucleonMom.Py() );
271 p4->SetPz( inNucleonMom.Pz() );
272 p4->SetE ( inNucleonMom.E() );
277 LOG(
"QELEvent",
pNOTICE) <<
"Selected: W = "<< gW;
293 evrec->SetDiffXSec(xsec,
fkps);
297 double totxsec = evrec->XSec();
298 double wght = (vol/totxsec)*xsec;
299 LOG(
"QELEvent",
pNOTICE) <<
"Kinematics wght = "<< wght;
302 wght *= evrec->Weight();
303 LOG(
"QELEvent",
pNOTICE) <<
"Current event wght = " << wght;
304 evrec->SetWeight(wght);
306 TLorentzVector x4l(*(evrec->Probe())->X4());
321 evrec->AddParticle(outNucleon);
324 LOG(
"QELEvent",
pNOTICE) <<
"pn: " << inNucleonMom.X() <<
", " <<inNucleonMom.Y() <<
", " <<inNucleonMom.Z() <<
", " <<inNucleonMom.E();
329 if(evrec->Summary()->InitState().Tgt().IsNucleus())
334 LOG(
"QELEvent",
pINFO) <<
"Done generating QE event kinematics!";
void SetInteraction(const Interaction *i)
Range1D_t Q2QES_SM_lim(void) const
virtual double MaxXSec(GHepRecord *evrec) const
SmithMonizUtils * sm_utils
double fQ2Min
Q2-threshold for seeking the second maximum.
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double J(double q0, double q3, double Enu, double ml)
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
Kinematics * KinePtr(void) const
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
int RecoilNucleonPdg(void) const
recoil nucleon pdg
A simple [min,max] interval for doubles.
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
bool IsNucleus(void) const
double MaxDiffv(GHepRecord *evrec) const
Defines the EventGeneratorI interface.
Generated/set kinematical variables for an event.
void SetHitNucPosition(double r)
void SetMomentum(const TLorentzVector &p4)
Range1D_t vQES_SM_lim(double Q2) const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
const XSecAlgorithmI * fXSecModel
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
double GetBindingEnergy(void) const
Summary information for an interaction.
const TLorentzVector & HitNucP4(void) const
Range1D_t kFQES_SM_lim(double nu, double Q2) const
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 WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
bool fGenerateNucleonInNucleus
generate struck nucleon in nucleus
double MaxXSec2(GHepRecord *evrec) const
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
void Setx(double x, bool selected=false)
void SetKV(KineVar_t kv, double value)
void SetRemovalEnergy(double Erm)
static RunningThreadInfo * Instance(void)
void SetW(double W, bool selected=false)
void SwitchOnFastForward(void)
TLorentzVector * HitNucP4Ptr(void) const
static PDGLibrary * Instance(void)
void SetReason(string reason)
void AddTargetNucleusRemnant(GHepRecord *evrec) const
add a recoiled nucleus remnant
double PhaseSpaceVolume(KinePhaseSpace_t ps) const
const TLorentzVector * X4(void) const
void Sety(double y, bool selected=false)
Target * TgtPtr(void) const
TRandom3 & RndGen(void) const
rnd number generator for generic usage
TParticlePDG * Find(int pdgc, bool must_exist=true)
void ClearRunningValues(void)
const Target & Tgt(void) const
static const unsigned int kRjMaxIterations
const EventGeneratorI * RunningThread(void)
void SetPrimaryLeptonPolarization(GHepRecord *ev)
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
enum genie::EGHepStatus GHepStatus_t
Initial State information.