112 TLorentzVector v4(*event->
Probe()->
X4());
113 TLorentzVector tempp4(0.,0.,0.,0.);
116 bool have_nucleus = nucleus != 0;
120 double CosthMax = 1.0;
121 double CosthMin = -1.0;
138 TMax = Enu - LepMass;
148 TMin = TMath::Sqrt(TMath::Power(LepMass, 2) + TMath::Power((Enu -
fQ3Max), 2)) - LepMass;
149 CosthMin = TMath::Sqrt(1 - TMath::Power((
fQ3Max / Enu ), 2));
157 unsigned int iter = 0;
162 if ( NuPDG == 11 ) maxIter *= 1000;
165 double XSecMax = this->
MaxXSec( event );
167 LOG(
"Kinematics",
pDEBUG) <<
"Max XSec = " << XSecMax;
175 <<
"Couldn't select a valid Tmu, CosTheta pair after " 176 << iter <<
" iterations";
177 event->EventFlags()->SetBitNumber(
kKineGenErr,
true);
179 exception.
SetReason(
"Couldn't select lepton kinematics");
185 T = TMin + (TMax-TMin)*rnd->
RndKine().Rndm();
186 Costh = CosthMin + (CosthMax-CosthMin)*rnd->
RndKine().Rndm();
189 Plep = TMath::Sqrt( T * (T + (2.0 * LepMass)));
190 Q3 = TMath::Sqrt(Plep*Plep + Enu*Enu - 2.0 * Plep * Enu * Costh);
193 Q0 = Enu - (T + LepMass);
201 LOG(
"QELEvent",
pDEBUG) <<
" Anu elastic case. T, Costh: " << T <<
", " << Costh ;
202 LOG(
"QELEvent",
pDEBUG) <<
" Anu elastic case. Q0, Q3: " << Q0 <<
", " << Q3 ;
207 if ( Q3 < fQ3Max && Q2 >= Q2min ){
211 LOG(
"QELEvent",
pDEBUG) <<
" T, Costh, Q2: " << T <<
", " << Costh <<
", " <<
Q2;
216 if (XSec > XSecMax) {
220 LOG(
"QELEvent",
pERROR) <<
" T, Costh, Q2: " << T <<
", " << Costh <<
", " <<
Q2;
221 LOG(
"QELEvent",
pERROR) <<
"XSec is > XSecMax for nucleus " << TgtPDG <<
" " 222 << XSec <<
" > " << XSecMax
223 <<
" don't let this happen.";
227 accept = XSec > XSecMax*rnd->
RndKine().Rndm();
228 LOG(
"QELEvent",
pINFO) <<
"Xsec, Max, Accept: " << XSec <<
", " 229 << XSecMax <<
", " << accept;
244 double PlepZ = Plep * Costh;
245 double PlepXY = Plep * TMath::Sqrt(1. - TMath::Power(Costh,2));
248 double phi= 2 *
kPi * rnd->
RndLep().Rndm();
250 double PlepX = PlepXY * TMath::Cos(phi);
251 double PlepY = PlepXY * TMath::Sin(phi);
255 TVector3 unit_nudir =
event->Probe()->P4()->Vect().Unit();
256 TVector3 p3l(PlepX, PlepY, PlepZ);
257 p3l.RotateUz(unit_nudir);
260 Elep = TMath::Sqrt(LepMass*LepMass + PlepX*PlepX + PlepY*PlepY + PlepZ*PlepZ);
261 TLorentzVector p4l(p3l,Elep);
265 int momidx =
event->ProbePosition();
271 double gy = Q0 / Enu;
284 LOG(
"QELEvent",
pDEBUG) <<
"~~~ LEPTON DONE ~~~";
virtual double MaxXSec(GHepRecord *evrec) const
bool GetTlCostlFromq0q3(double q0, double q3, double Enu, double ml, double &Tl, double &costl)
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
static const double kNucleonMass
double Q2(const Interaction *const i)
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.
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
Generated/set kinematical variables for an event.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
double XYtoW(double Ev, double M, double x, double y)
const XSecAlgorithmI * fXSecModel
static const double kMinQ2Limit
virtual GHepParticle * Probe(void) 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 SetFSLeptonP4(const TLorentzVector &p4)
static constexpr double cm2
bool Getq0q3FromTlCostl(double Tl, double costl, double Enu, double ml, double &q0, double &q3)
static int max(int a, int b)
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
void Setx(double x, bool selected=false)
void SetKV(KineVar_t kv, double value)
void SetW(double W, bool selected=false)
void SwitchOnFastForward(void)
void SetReason(string reason)
double Q2YtoX(double Ev, double M, double Q2, double y)
const TLorentzVector * X4(void) const
void Sety(double y, bool selected=false)
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
int IonPdgCodeToZ(int pdgc)
static const unsigned int kRjMaxIterations
double ProbeE(RefFrame_t rf) const
STDHEP-like event record entry that can fit a particle or a nucleus.
cet::coded_exception< error, detail::translate > exception