21 #include "Framework/Conventions/GBuild.h" 44 using namespace genie;
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");
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";
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;
444 double dummy_w = -1.;
450 if ( prob > 0. && costh0_max > -1. ) max_momentum = pNi_next;
451 else search_step /= 2.;
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;
virtual double MaxXSec(GHepRecord *evrec) const
virtual GHepParticle * Particle(int position) const
bool fGenerateUniformly
uniform over allowed phase space + event weight?
THE MAIN GENIE PROJECT NAMESPACE
double E(void) const
Get energy.
DMELEvGen_BindingMode_t fHitNucleonBindingMode
virtual Interaction * Summary(void) const
static RandomGen * Instance()
Access instance.
void SetQ2(double Q2, bool selected=false)
Kinematics * KinePtr(void) const
double fSafetyFactor
maxxsec -> maxxsec * safety_factor
int FirstDaughter(void) const
int RecoilNucleonPdg(void) const
recoil nucleon pdg
virtual void AssertXSecLimits(const Interaction *in, double xsec, double xsec_max) const
int CharmHadronPdg(void) const
bool IsStrangeEvent(void) const
bool IsNucleus(void) const
double fMaxXSecDiffTolerance
max{100*(xsec-maxxsec)/.5*(xsec+maxxsec)} if xsec>maxxsec
Defines the EventGeneratorI interface.
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)
virtual int HitNucleonPosition(void) const
const TLorentzVector & HadSystP4(void) const
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
void SetHitNucPosition(double r)
void SetMomentum(const TLorentzVector &p4)
double Mass(void) const
Mass that corresponds to the PDG code.
void BindHitNucleon(Interaction &interaction, const NuclearModelI &nucl_model, double &Eb, DMELEvGen_BindingMode_t hitNucleonBindingMode)
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...
double Pz(void) const
Get Pz.
string AsString(void) const
const XSecAlgorithmI * fXSecModel
Contains minimal information for tagging exclusive processes.
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
double Px(void) const
Get Px.
virtual GHepParticle * Probe(void) const
bool IsCharmEvent(void) const
Summary information for an interaction.
const TLorentzVector & HitNucP4(void) const
int LastDaughter(void) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
const NuclearModelI * fNuclModel
nuclear model
const TLorentzVector & FSLeptonP4(void) const
int StrangeHadronPdg(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void WQ2toXY(double Ev, double M, double W, double Q2, double &x, double &y)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
virtual void Configure(const Registry &config)
void ProcessEventRecord(GHepRecord *event_rec) const
virtual GHepParticle * TargetNucleus(void) const
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Misc GENIE control constants.
const UInt_t kISkipKinematicChk
if set, skip kinematic validity checks
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
void AddTargetNucleusRemnant(GHepRecord *evrec) const
add a recoiled nucleus remnant
void Setx(double x, bool selected=false)
double ComputeMaxXSec(const Interaction *in) const
int fMaxXSecNucleonThrows
void SetRemovalEnergy(double Erm)
static RunningThreadInfo * Instance(void)
void SetRemovalEnergy(double E) const
void SetW(double W, bool selected=false)
void SwitchOnFastForward(void)
static PDGLibrary * Instance(void)
void SetReason(string reason)
virtual TBits * EventFlags(void) const
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
void Configure(const Registry &config)
void SetMomentum3(const TVector3 &mom) const
const TLorentzVector * X4(void) const
A registry. Provides the container for algorithm configuration parameters.
void Sety(double y, bool selected=false)
double CosTheta0Max(const genie::Interaction &interaction)
const UInt_t kIAssumeFreeNucleon
const XclsTag & ExclTag(void) const
double HitNucPosition(void) const
virtual GHepParticle * HitNucleon(void) const
Target * TgtPtr(void) const
double fEMin
min E for which maxxsec is cached - forcing explicit calc.
int IonPdgCode(int A, int Z)
InitialState * InitStatePtr(void) const
virtual bool GenerateNucleon(const Target &) const =0
virtual void AddParticle(const GHepParticle &p)
const InitialState & InitState(void) const
TParticlePDG * Find(int pdgc, bool must_exist=true)
double Q2(bool selected=false) const
void ClearRunningValues(void)
bool GetParamDef(const RgKey &name, T &p, const T &def) const
const Target & Tgt(void) const
virtual int ProbePosition(void) const
static const unsigned int kRjMaxIterations
const EventGeneratorI * RunningThread(void)
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
virtual double Prob(double p, double w, const Target &) const =0
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...
STDHEP-like event record entry that can fit a particle or a nucleus.
DMELEvGen_BindingMode_t StringToDMELBindingMode(const std::string &mode_str)
Keep info on the event generation thread currently on charge. This is used so that event generation m...
virtual int TargetNucleusPosition(void) const
Root of GENIE utility namespaces.
cet::coded_exception< error, detail::translate > exception
const UInt_t kISkipProcessChk
if set, skip process validity checks
virtual void SetDiffXSec(double xsec, KinePhaseSpace_t ps)
enum genie::EGHepStatus GHepStatus_t
Initial State information.
double Py(void) const
Get Py.
const Algorithm * SubAlg(const RgKey ®istry_key) const