19#include "Framework/Conventions/GBuild.h"
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;
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
virtual void Configure(const Registry &config)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
Defines the EventGeneratorI interface.
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
GENIE's GHEP MC event record.
virtual double Weight(void) const
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
virtual Interaction * Summary(void) const
virtual TBits * EventFlags(void) const
virtual void SetWeight(double wght)
Initial State information.
const Target & Tgt(void) const
double ProbeE(RefFrame_t rf) const
Summary information for an interaction.
string AsString(void) const
const XclsTag & ExclTag(void) const
InitialState * InitStatePtr(void) const
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
const InitialState & InitState(void) const
Kinematics * KinePtr(void) const
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
bool fGenerateUniformly
uniform over allowed phase space + event weight?
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
double fSafetyFactor
ComputeMaxXSec -> ComputeMaxXSec * fSafetyFactor.
virtual double MaxXSec(GHepRecord *evrec, const int nkey=0) const
const XSecAlgorithmI * fXSecModel
void Setx(double x, bool selected=false)
void SetQ2(double Q2, bool selected=false)
void ClearRunningValues(void)
void SetKV(KineVar_t kv, double value)
void Sety(double y, bool selected=false)
void SetW(double W, bool selected=false)
static PDGLibrary * Instance(void)
TParticlePDG * Find(int pdgc, bool must_exist=true)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
static RandomGen * Instance()
Access instance.
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
A registry. Provides the container for algorithm configuration parameters.
Keep info on the event generation thread currently on charge. This is used so that event generation m...
static RunningThreadInfo * Instance(void)
const EventGeneratorI * RunningThread(void)
double Energy(const Interaction *in) const
double ComputeMaxXSec(const Interaction *in) const
double fMinLog1MinusCosTheta
void ProcessEventRecord(GHepRecord *event_rec) const
void CalculateKin_AtharSingleKaon(GHepRecord *event_rec) const
void Configure(const Registry &config)
const TLorentzVector & HitNucP4(void) const
int StrangeHadronPdg(void) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
void SwitchOnFastForward(void)
void SetReason(string reason)
Misc GENIE control constants.
static const unsigned int kRjMaxIterations
Simple functions for loading and reading nucleus dependent keys from config files.
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
const UInt_t kISkipProcessChk
if set, skip process validity checks