595 int FullDeltaNodelta = 1;
606 TLorentzVector v4(*event->
Probe()->
X4());
607 TLorentzVector tempp4(0.,0.,0.,0.);
611 double CosthMax = 1.0;
612 double CosthMin = -1.0;
629 TMax = Enu - LepMass;
639 TMin = TMath::Sqrt(TMath::Power(LepMass, 2) + TMath::Power((Enu -
fQ3Max), 2)) - LepMass;
640 CosthMin = TMath::Sqrt(1 - TMath::Power((
fQ3Max / Enu ), 2));
645 Range1D_t ctl_range ( CosthMin, CosthMax ) ;
646 double XSecMax =
GetXSecMaxTlctl( *interaction, Tl_range, ctl_range ) ;
652 unsigned int iter = 0;
660 <<
"Couldn't select a valid Tmu, CosTheta pair after " 661 << iter <<
" iterations";
662 event->EventFlags()->SetBitNumber(
kKineGenErr,
true);
664 exception.
SetReason(
"Couldn't select lepton kinematics");
670 T = TMin + (TMax-TMin)*rnd->
RndKine().Rndm();
671 Costh = CosthMin + (CosthMax-CosthMin)*rnd->
RndKine().Rndm();
677 if (Q3 >
fQ3Max) continue ;
679 Plep = TMath::Sqrt( T * (T + (2.0 * LepMass)));
688 if (FullDeltaNodelta == 1){
712 if (XSec > XSecMax) {
713 LOG(
"MEC",
pERROR) <<
"XSec is > XSecMax for nucleus " << TgtPDG <<
" " 714 << XSec <<
" > " << XSecMax
715 <<
" don't let this happen.";
717 assert(XSec <= XSecMax);
718 accept = XSec > XSecMax*rnd->
RndKine().Rndm();
719 LOG(
"MEC",
pINFO) <<
"Xsec, Max, Accept: " << XSec <<
", " 720 << XSecMax <<
", " << accept;
733 double myrand = rnd->
RndKine().Rndm();
734 double pnFraction = XSecPN / XSec;
735 LOG(
"MEC",
pDEBUG) <<
"Test for pn: xsec_pn = " << XSecPN
736 <<
"; xsec = " << XSec
737 <<
"; pn_fraction = " << pnFraction
738 <<
"; random number val = " << myrand;
740 if (myrand <= pnFraction) {
743 1, -1, -1, -1, tempp4, v4);
747 if (rnd->
RndKine().Rndm() <= XSecDeltaPN / XSecPN) {
755 1, -1, -1, -1, tempp4, v4);
760 1, -1, -1, -1, tempp4, v4);
766 (XSecDelta - XSecDeltaPN) / (XSec - XSecPN)) {
798 double PlepZ = Plep * Costh;
799 double PlepXY = Plep * TMath::Sqrt(1. - TMath::Power(Costh,2));
802 double phi= 2 *
kPi * rnd->
RndLep().Rndm();
804 double PlepX = PlepXY * TMath::Cos(phi);
805 double PlepY = PlepXY * TMath::Sin(phi);
809 TVector3 unit_nudir =
event->Probe()->P4()->Vect().Unit();
810 TVector3 p3l(PlepX, PlepY, PlepZ);
811 p3l.RotateUz(unit_nudir);
814 Elep = TMath::Sqrt(LepMass*LepMass + PlepX*PlepX + PlepY*PlepY + PlepZ*PlepZ);
815 TLorentzVector p4l(p3l,Elep);
819 int momidx =
event->ProbePosition();
824 double gy = Q0 / Enu;
842 LOG(
"MEC",
pDEBUG) <<
"~~~ LEPTON DONE ~~~";
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.
A simple [min,max] interval for doubles.
Generated/set kinematical variables for an event.
double GetXSecMaxTlctl(const Interaction &inter, const Range1D_t &Tl_range, const Range1D_t &ctl_range) const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
void SetResonance(Resonance_t res)
double XYtoW(double Ev, double M, double x, double y)
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)
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)
XclsTag * ExclTagPtr(void) const
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 SetHitNucPdg(int pdgc)
void Sety(double y, bool selected=false)
Target * TgtPtr(void) const
const XSecAlgorithmI * fXSecModel
InitialState * InitStatePtr(void) const
const InitialState & InitState(void) const
static const unsigned int kRjMaxIterations
void SetPrimaryLeptonPolarization(GHepRecord *ev)
double ProbeE(RefFrame_t rf) const
cet::coded_exception< error, detail::translate > exception