21#include "Framework/Conventions/GBuild.h"
69 LOG(
"DMELEvent",
pDEBUG) <<
"Generating QE event kinematics...";
85 LOG(
"DMELEvent",
pFATAL) <<
"No hit nucleon was set";
98 bool have_nucleus = (nucleus != 0);
103 double hitNucPos = nucleon->
X4()->Vect().Mag();
116 if ( have_nucleus ) {
118 int nucleon_pdgc = nucleon->
Pdg();
120 int Z = (is_p) ? nucleus->
Z()-1 : nucleus->
Z();
121 int A = nucleus->
A() - 1;
122 TParticlePDG * fnucleus = 0;
127 <<
"No particle with [A = " << A <<
", Z = " << Z
128 <<
", pdgc = " << ipdgc <<
"] in PDGLibrary!";
138 unsigned int iter = 0;
143 LOG(
"DMELEvent",
pINFO) <<
"Attempt #: " << iter;
146 <<
"Couldn't select a valid (pNi, Eb, cos_theta_0, phi_0) tuple after "
147 << iter <<
" iterations";
150 exception.
SetReason(
"Couldn't select kinematics");
164 fNuclModel->SetMomentum3( TVector3(0., 0., 0.) );
173 double cos_theta0_max = std::min(1.,
CosTheta0Max(*interaction));
177 if ( cos_theta0_max <= -1. )
continue;
185 double costheta = rnd->
RndKine().Uniform(-1., cos_theta0_max);
186 double phi = rnd->
RndKine().Uniform( 2.*
kPi );
190 LOG(
"DMELEvent",
pDEBUG) <<
"cth0 = " << costheta <<
", phi0 = " << phi;
197 double t = xsec_max * rnd->
RndKine().Rndm();
199#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
201 <<
"xsec= " << xsec <<
", Rnd= " << t;
208 LOG(
"DMELEvent",
pINFO) <<
"*Selected* Q^2 = " <<
gQ2 <<
" GeV^2";
220 LOG(
"DMELKinematics",
pNOTICE) <<
"E = " << E <<
", M = "<< M;
238 LOG(
"DMELEvent",
pNOTICE) <<
"Selected: W = "<< gW;
256 TLorentzVector x4l(*(evrec->
Probe())->X4());
267 LOG(
"DMELEvent",
pNOTICE) <<
"pn: " << p4ptr.X() <<
", "
268 << p4ptr.Y() <<
", " << p4ptr.Z() <<
", " << p4ptr.E();
277 LOG(
"DMELEvent",
pDEBUG) <<
"Reject current throw...";
281 LOG(
"DMELEvent",
pINFO) <<
"Done generating QE event kinematics!";
288 LOG(
"DMELEvent",
pINFO) <<
"Adding final state nucleus";
296 bool have_nucleus = nucleus != 0;
297 if (!have_nucleus)
return;
299 int A = nucleus->
A();
300 int Z = nucleus->
Z();
305 for(
int id = fd;
id <= ld;
id++) {
310 int pdgc = particle->
Pdg();
315 if (is_p || is_n) A--;
317 Px += particle->
Px();
318 Py += particle->
Py();
319 Pz += particle->
Pz();
324 TParticlePDG * remn = 0;
329 <<
"No particle with [A = " << A <<
", Z = " << Z
330 <<
", pdgc = " << ipdgc <<
"] in PDGLibrary!";
334 double Mi = nucleus->
Mass();
342 <<
"Adding nucleus [A = " << A <<
", Z = " << Z
343 <<
", pdgc = " << ipdgc <<
"]";
347 ipdgc,
kIStStableFinalState, imom,-1,-1,-1, Px,Py,Pz,E, 0,0,0,0);
371 RgKey nuclkey =
"NuclearModel";
396 std::string binding_mode;
397 GetParamDef(
"HitNucleonBindingMode", binding_mode, std::string(
"UseNuclearModel") );
413 LOG(
"DMELEvent",
pINFO) <<
"Computing maximum cross section to throw against";
415 double xsec_max = -1;
416 double dummy_Eb = 0.;
429 double max_momentum = 0.010;
430 double search_step = 0.1;
431 const double STEP_STOP = 1
e-6;
432 while ( search_step > STEP_STOP ) {
433 double pNi_next = max_momentum + search_step;
436 fNuclModel->SetMomentum3( TVector3(0., 0., -pNi_next) );
444 double dummy_w = -1.;
445 double prob =
fNuclModel->Prob(pNi_next, dummy_w, tgt,
450 if ( prob > 0. && costh0_max > -1. ) max_momentum = pNi_next;
451 else search_step /= 2.;
456 fNuclModel->SetMomentum3( TVector3(0., 0., -max_momentum) );
468 const double acceptable_fraction_of_safety_factor = 0.2;
469 const int max_n_layers = 100;
470 const int N_theta = 10;
471 const int N_phi = 10;
472 double phi_at_xsec_max = -1;
473 double costh_at_xsec_max = 0;
474 double this_nuc_xsec_max = -1;
476 double costh_range_min = -1.;
478 double phi_range_min = 0.;
479 double phi_range_max = 2*TMath::Pi();
480 for (
int ilayer = 0 ; ilayer < max_n_layers ; ilayer++) {
481 double last_layer_xsec_max = this_nuc_xsec_max;
482 double costh_increment = (costh_range_max-costh_range_min) / N_theta;
483 double phi_increment = (phi_range_max-phi_range_min) / N_phi;
485 for (
int itheta = 0; itheta < N_theta; itheta++){
486 double costh = costh_range_min + itheta * costh_increment;
487 for (
int iphi = 0; iphi < N_phi; iphi++) {
488 double phi = phi_range_min + iphi * phi_increment;
496 if (xs > this_nuc_xsec_max){
497 phi_at_xsec_max = phi;
498 costh_at_xsec_max = costh;
499 this_nuc_xsec_max = xs;
506 costh_range_min = costh_at_xsec_max - costh_increment;
507 costh_range_max = costh_at_xsec_max + costh_increment;
508 phi_range_min = phi_at_xsec_max - phi_increment;
509 phi_range_max = phi_at_xsec_max + phi_increment;
511 double improvement_factor = this_nuc_xsec_max/last_layer_xsec_max;
512 if (ilayer && (improvement_factor-1) < acceptable_fraction_of_safety_factor * (
fSafetyFactor-1)) {
516 if (this_nuc_xsec_max > xsec_max) {
517 xsec_max = this_nuc_xsec_max;
518 LOG(
"DMELEvent",
pINFO) <<
"best estimate for xsec_max = " << xsec_max;
527#ifdef __GENIE_LOW_LEVEL_MESG_ENABLED__
529 SLOG(
"DMELEvent",
pDEBUG) <<
"Max xsec in phase space = " << max_xsec;
533 LOG(
"DMELEvent",
pINFO) <<
"Computed maximum cross section to throw against - value is " << xsec_max;
#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
const Algorithm * SubAlg(const RgKey ®istry_key) const
void ProcessEventRecord(GHepRecord *event_rec) const
DMELEvGen_BindingMode_t fHitNucleonBindingMode
void Configure(const Registry &config)
double ComputeMaxXSec(const Interaction *in) const
int fMaxXSecNucleonThrows
const NuclearModelI * fNuclModel
nuclear model
void AddTargetNucleusRemnant(GHepRecord *evrec) const
add a recoiled nucleus remnant
Defines the EventGeneratorI interface.
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
STDHEP-like event record entry that can fit a particle or a nucleus.
void SetMomentum(const TLorentzVector &p4)
void SetRemovalEnergy(double Erm)
double Mass(void) const
Mass that corresponds to the PDG code.
const TLorentzVector * X4(void) const
int LastDaughter(void) const
double Px(void) const
Get Px.
double E(void) const
Get energy.
double Pz(void) const
Get Pz.
double Py(void) const
Get Py.
int FirstDaughter(void) const
GENIE's GHEP MC event record.
virtual int ProbePosition(void) const
virtual GHepParticle * Probe(void) const
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
virtual GHepParticle * TargetNucleus(void) const
virtual Interaction * Summary(void) const
virtual TBits * EventFlags(void) const
virtual void AddParticle(const GHepParticle &p)
virtual int TargetNucleusPosition(void) const
virtual GHepParticle * Particle(int position) const
virtual int HitNucleonPosition(void) const
virtual GHepParticle * HitNucleon(void) const
Initial State information.
const Target & Tgt(void) const
double ProbeE(RefFrame_t rf) const
Target * TgtPtr(void) const
Summary information for an interaction.
string AsString(void) const
const XclsTag & ExclTag(void) const
InitialState * InitStatePtr(void) const
int RecoilNucleonPdg(void) const
recoil nucleon pdg
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)
double Q2(bool selected=false) const
const TLorentzVector & HadSystP4(void) const
const TLorentzVector & FSLeptonP4(void) const
void ClearRunningValues(void)
void Sety(double y, bool selected=false)
void SetW(double W, bool selected=false)
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
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)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
void SetHitNucPosition(double r)
const TLorentzVector & HitNucP4(void) const
double HitNucPosition(void) const
bool IsNucleus(void) const
Contains minimal information for tagging exclusive processes.
bool IsStrangeEvent(void) const
bool IsCharmEvent(void) const
int StrangeHadronPdg(void) const
int CharmHadronPdg(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
int IonPdgCode(int A, int Z)
Simple functions for loading and reading nucleus dependent keys from config files.
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
Root of GENIE utility namespaces.
double CosTheta0Max(const genie::Interaction &interaction)
DMELEvGen_BindingMode_t StringToDMELBindingMode(const std::string &mode_str)
void BindHitNucleon(Interaction &interaction, const NuclearModelI &nucl_model, double &Eb, DMELEvGen_BindingMode_t hitNucleonBindingMode)
double ComputeFullDMELPXSec(Interaction *interaction, const NuclearModelI *nucl_model, const XSecAlgorithmI *xsec_model, double cos_theta_0, double phi_0, double &Eb, DMELEvGen_BindingMode_t hitNucleonBindingMode, double min_angle_EM=0., bool bind_nucleon=true)
THE MAIN GENIE PROJECT NAMESPACE
enum genie::EGHepStatus GHepStatus_t
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
const UInt_t kISkipProcessChk
if set, skip process validity checks
const UInt_t kIAssumeFreeNucleon