19 #include "Framework/Conventions/GBuild.h" 
   36 using namespace genie;
 
   37 using namespace genie::constants;
 
   38 using namespace genie::controls;
 
   39 using namespace genie::utils;
 
   63           << 
"Generating kinematics uniformly over the allowed phase space";
 
   94   TVector3 beta = pnuc4.BoostVector();
 
   97   double enu = P4_nu.E(); 
 
  103   const double Tkmax = enu - mk - ml;
 
  104   const double Tlmax = enu - mk - ml;
 
  108     LOG(
"SKKinematics", 
pWARN) << 
"No available phase space";
 
  111     exception.
SetReason(
"No available phase space");
 
  116   const double Tkmin = 0.0;
 
  117   const double Tlmin = 0.0;
 
  120   const double xmax =  0.69314718056; 
 
  121   const double phikqmin = 0.0;
 
  122   const double phikqmax = 2.0 * 
kPi;
 
  123   const double dtk = Tkmax - Tkmin;
 
  124   const double dtl = Tlmax - Tlmin;
 
  125   const double dx = xmax - xmin;
 
  126   const double dphikq = phikqmax - phikqmin;
 
  130   unsigned int iter = 0;
 
  135   double costhetal = -1; 
 
  142              << 
"*** Could not select a valid (tk, tl, costhetal) triplet after " 
  143                                                << iter << 
" iterations";
 
  146         exception.
SetReason(
"Couldn't select kinematics");
 
  152        tk = Tkmin + dtk * rnd->
RndKine().Rndm();
 
  153        tl = Tlmin + dtl * rnd->
RndKine().Rndm();
 
  154        double x = xmin + dx * rnd->
RndKine().Rndm(); 
 
  155        costhetal = 1.0 - TMath::Exp(x);
 
  156        phikq = phikqmin + dphikq * rnd->
RndKine().Rndm();
 
  158        tk = Tkmin + dtk * rnd->
RndKine().Rndm();
 
  159        tl = Tlmin + dtl * rnd->
RndKine().Rndm();
 
  160        double x = xmin + dx * rnd->
RndKine().Rndm(); 
 
  161        costhetal = 1.0 - TMath::Exp(x);
 
  162        phikq = phikqmin + dphikq * rnd->
RndKine().Rndm();
 
  165      LOG(
"SKKinematics", 
pDEBUG) << 
"Trying: Tk = " << tk << 
", Tl = " << tl << 
", cosThetal = " << costhetal << 
", phikq = " << phikq;
 
  175      double pl = TMath::Sqrt(el*el - ml*ml);
 
  177      TVector3 lepton_3vector = TVector3(0,0,0);
 
  178      lepton_3vector.SetMagThetaPhi(pl,TMath::ACos(costhetal),0.0);
 
  179      TLorentzVector P4_lep( lepton_3vector, tl+ml );
 
  180      TLorentzVector q = P4_nu - P4_lep;
 
  181      double Q2 = -q.Mag2();
 
  182      double xbj = Q2/(2*M*q.E());
 
  183      double y = q.E()/P4_nu.E();
 
  184      double W2 = (pnuc4+q).Mag2();
 
  193         double max = xsec_max;
 
  194         double t   = max * rnd->
RndKine().Rndm();
 
  195         double J   = TMath::Abs(1. - costhetal);
 
  199         if( xsec*J > xsec_max ) { 
 
  201              << 
"!!!!!!XSEC ABOVE MAX!!!!! xsec= " << xsec << 
", J= " << J << 
", xsec*J = " << xsec*J << 
" max= " << xsec_max;
 
  204         accept = (t< J*xsec);
 
  220           LOG(
"SKKinematics", 
pNOTICE) << 
"Current event wght = " << wght;
 
  223         LOG(
"SKKinematics", 
pWARN) << 
"\nLepton energy (rest frame) = " << el << 
" kaon = " << tl + mk;
 
  234         interaction->
KinePtr()->
SetW(TMath::Sqrt(W2), 
true);
 
  254 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 
  256           << 
"Scanning the allowed phase space {K} for the max(dxsec/d{K})";
 
  266   const int Nctl = 100;
 
  275   const double Tkmax = enu - mk - ml;
 
  276   const double Tlmax = enu - mk - ml;
 
  277   const double Tkmin = 0.0;
 
  278   const double Tlmin = 0.0;
 
  282   const double xmax =  0.69314718056; 
 
  283   const double dtk = (Tkmax - Tkmin)/Ntk;
 
  284   const double dtl = (Tlmax - Tlmin)/Ntl;
 
  285   const double dx = (xmax - xmin)/Nctl;
 
  288   for(
int i = 1; i < Ntk; i++) {
 
  289     double tk = Tkmin + dtk*i;
 
  290     for(
int j = 1; j < Ntl; j++) {
 
  291       double tl = Tlmin + dtl*j;
 
  292       for(
int k = 0; k < Nctl; k++) {
 
  293         double log_1_minus_cosine_theta_lepton = xmin + dx*k;
 
  295         double ctl = 1.0 - TMath::Exp(log_1_minus_cosine_theta_lepton);
 
  313         if( xsec > max_xsec ) {
 
  323   LOG(
"SKKinematics", 
pINFO) << 
"Max XSec is " << max_xsec << 
" for enu = " << enu << 
" tk = " << max_tk << 
" tl = " << max_tl << 
" cosine theta = " << max_ctl;
 
  329 #ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__ 
  331   SLOG(
"SKKinematics", 
pDEBUG) << 
"Max xsec in phase space = " << max_xsec;
 
virtual void SetWeight(double wght)
bool fGenerateUniformly
uniform over allowed phase space + event weight? 
double J(double q0, double q3, double Enu, double ml)
void Configure(const Registry &config)
double Q2(const Interaction *const i)
virtual Interaction * Summary(void) const 
static RandomGen * Instance()
Access instance. 
void SetQ2(double Q2, bool selected=false)
Kinematics * KinePtr(void) const 
double fSafetyFactor
ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor. 
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const 
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec 
Defines the EventGeneratorI interface. 
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const 
virtual double Weight(void) const 
Abstract class. Provides a data caching mechanism for for concrete implementations of the EventRecord...
A singleton holding random number generator classes. All random number generation in GENIE should tak...
string AsString(void) const 
const XSecAlgorithmI * fXSecModel
int FSPrimLeptonPdg(void) const 
final state primary lepton pdg 
Summary information for an interaction. 
const TLorentzVector & HitNucP4(void) const 
double ComputeMaxXSec(const Interaction *in) const 
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
int StrangeHadronPdg(void) const 
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
virtual void Configure(const Registry &config)
void ProcessEventRecord(GHepRecord *event_rec) const 
TRandom3 & RndKine(void) const 
rnd number generator used by kinematics generators 
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks 
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction. 
void Setx(double x, bool selected=false)
void SetKV(KineVar_t kv, double value)
static RunningThreadInfo * Instance(void)
virtual const AlgId & Id(void) const 
Get algorithm ID. 
void SetW(double W, bool selected=false)
void SwitchOnFastForward(void)
static PDGLibrary * Instance(void)
void SetReason(string reason)
virtual TBits * EventFlags(void) const 
A registry. Provides the container for algorithm configuration parameters. 
void Sety(double y, bool selected=false)
const XclsTag & ExclTag(void) const 
double fEMin
min E for which maxxsec is cached - forcing explicit calc. 
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
InitialState * InitStatePtr(void) const 
const InitialState & InitState(void) const 
double fMinLog1MinusCosTheta
TParticlePDG * Find(int pdgc, bool must_exist=true)
double Energy(const Interaction *in) const 
void ClearRunningValues(void)
bool GetParamDef(const RgKey &name, T &p, const T &def) const 
const Target & Tgt(void) const 
static const unsigned int kRjMaxIterations
void CalculateKin_AtharSingleKaon(GHepRecord *event_rec) const 
const EventGeneratorI * RunningThread(void)
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
double ProbeE(RefFrame_t rf) const 
GENIE's GHEP MC event record. 
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
Keep info on the event generation thread currently on charge. This is used so that event generation m...
TLorentzVector * GetProbeP4(RefFrame_t rf=kRfHitNucRest) const 
const UInt_t kISkipProcessChk
if set, skip process validity checks 
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
Initial State information.