31 using namespace genie;
92 TLorentzVector v4(0,0,0,0);
105 TLorentzVector p4i(0,0,0,Mi);
106 event->AddParticle(ipdg,stis,-1,-1,-1,-1, p4i, v4);
111 TLorentzVector p4n(0,0,0,mn);
112 event->AddParticle(dpdg,stdc, 0,-1,-1,-1, p4n, v4);
121 TLorentzVector p4f(0,0,0,Mf);
122 event->AddParticle(rpdg,stfs,0,-1,-1,-1, p4f, v4);
138 if(dpdg != ipdg_short) {
140 <<
"Couldn't generate given decay ("
142 <<
" for given initial state (PDG = " << ipdg_short <<
")";
144 exception.
SetReason(
"Decay-mode / Initial-state mismatch!");
150 TLorentzVector p4i(0,0,0,mn);
151 event->AddParticle(dpdg,stis,-1,-1,-1,-1, p4i, v4);
153 event->AddParticle(dpdg,stdc,0,-1,-1,-1, p4i, v4);
161 int A = initial_nucleus->
A();
169 double dA = (double)A;
170 double R = R0 * TMath::Power(dA, 1./3.);
173 <<
"Generating vertex according to a realistic nuclear density profile";
179 for(
double r = 0; r < rmax; r+=dr) {
185 TLorentzVector vtx(0,0,0,0);
186 unsigned int iter = 0;
193 <<
"Couldn't generate a vertex position after " << iter <<
" iterations";
195 exception.
SetReason(
"Couldn't generate vertex");
200 double r = rmax * rnd->
RndFsi().Rndm();
201 double t = ymax * rnd->
RndFsi().Rndm();
205 <<
"y = " << y <<
" > ymax = " << ymax <<
" for r = " << r <<
", A = " <<
A;
207 bool accept = (t < y);
210 double cosphi = TMath::Cos(phi);
211 double sinphi = TMath::Sin(phi);
212 double costheta = -1 + 2 * rnd->
RndFsi().Rndm();
213 double sintheta = TMath::Sqrt(1-costheta*costheta);
214 vtx.SetX(r*sintheta*cosphi);
215 vtx.SetY(r*sintheta*sinphi);
216 vtx.SetZ(r*costheta);
223 assert(decayed_nucleon);
231 int A = initial_nucleus->
A();
238 assert(decayed_nucleon);
239 assert(remnant_nucleus);
249 <<
"Generated nucleon momentum: ("
250 << p3.Px() <<
", " << p3.Py() <<
", " << p3.Pz() <<
"), "
251 <<
"|p| = " << p3.Mag();
253 <<
"Generated nucleon removal energy: w = " << w;
255 double pF2 = p3.Mag2();
260 double EN = Mi - TMath::Sqrt(pF2 + Mf*Mf);
262 TLorentzVector p4nucleon( p3.Px(), p3.Py(), p3.Pz(), EN);
263 TLorentzVector p4remnant(-1*p3.Px(), -1*p3.Py(), -1*p3.Pz(), Mi-EN);
272 LOG(
"NucleonDecay",
pINFO) <<
"Generating decay...";
275 LOG(
"NucleonDecay",
pINFO) <<
"Decay product IDs: " << pdgv;
276 assert ( pdgv.size() > 1);
278 LOG(
"NucleonDecay",
pINFO) <<
"Performing a phase space decay...";
282 vector<int>::const_iterator pdg_iter;
284 double * mass =
new double[pdgv.size()];
286 for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
287 int pdgc = *pdg_iter;
294 <<
"Decaying N = " << pdgv.size() <<
" particles / total mass = " << sum;
296 int decayed_nucleon_id = 1;
297 GHepParticle * decayed_nucleon =
event->Particle(decayed_nucleon_id);
298 assert(decayed_nucleon);
299 TLorentzVector * p4d = decayed_nucleon->
GetP4();
300 TLorentzVector * v4d = decayed_nucleon->
GetX4();
309 <<
" *** Phase space decay is not permitted \n"
310 <<
" Total particle mass = " << sum <<
"\n"
318 exception.
SetReason(
"Decay not permitted kinematically");
326 for(
int idec=0; idec<200; idec++) {
328 wmax = TMath::Max(wmax,w);
334 <<
"Max phase space gen. weight @ current hadronic system: " << wmax;
339 bool accept_decay=
false;
348 <<
"Couldn't generate an unweighted phase space decay after "
349 << itry <<
" attempts";
356 exception.
SetReason(
"Couldn't select decay after N attempts");
363 <<
"Decay weight = " << w <<
" > max decay weight = " << wmax;
365 double gw = wmax * rnd->
RndHadro().Rndm();
366 accept_decay = (gw<=w);
369 <<
"Decay weight = " << w <<
" / R = " << gw
370 <<
" - accepted: " << accept_decay;
375 TLorentzVector v4(*v4d);
377 for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
378 int pdgc = *pdg_iter;
382 event->AddParticle(pdgc, ist, decayed_nucleon_id,-1,-1,-1, *p4fin, v4);
411 RgKey nuclkey =
"NuclearModel";
TGenPhaseSpace fPhaseSpaceGenerator
TLorentzVector * GetX4(void) const
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
void ProcessEventRecord(GHepRecord *event) const
void GenerateDecayedNucleonPosition(GHepRecord *event) const
double RemovalEnergy(void) const
static RandomGen * Instance()
Access instance.
int HitNucPdg(void) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
double Density(double r, int A, double ring=0.)
int IonPdgCodeToA(int pdgc)
string P4AsString(const TLorentzVector *p)
static const unsigned int kMaxUnweightDecayIterations
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
double Mass(Resonance_t res)
resonance mass (GeV)
void SetMomentum(const TLorentzVector &p4)
void Configure(const Registry &config)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
const TVector3 & Momentum3(void) const
~NucleonDecayPrimaryVtxGenerator()
NucleonDecayPrimaryVtxGenerator()
Summary information for an interaction.
void SetPosition(const TLorentzVector &v4)
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...
static constexpr double A
TLorentzVector * GetP4(void) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
virtual void Configure(const Registry &config)
int DecayMode(void) const
PDGCodeList DecayProductList(NucleonDecayMode_t ndm, int npdg=0)
GHepStatus_t DecayProductStatus(bool in_nucleus, int pdgc)
void GenerateFermiMomentum(GHepRecord *event) const
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
void SwitchOnFastForward(void)
NucleonDecayMode_t fCurrDecayMode
static PDGLibrary * Instance(void)
void SetReason(string reason)
const NuclearModelI * fNuclModel
void AddInitialState(GHepRecord *event) const
A registry. Provides the container for algorithm configuration parameters.
void SetHitNucPdg(int pdgc)
const XclsTag & ExclTag(void) const
enum genie::ENucleonDecayMode NucleonDecayMode_t
int IonPdgCode(int A, int Z)
string AsString(NucleonDecayMode_t ndm, int npdg=0)
const InitialState & InitState(void) const
int IonPdgCodeToZ(int pdgc)
TParticlePDG * Find(int pdgc, bool must_exist=true)
void GenerateDecayProducts(GHepRecord *event) const
const Target & Tgt(void) const
static const unsigned int kRjMaxIterations
virtual bool GenerateNucleon(const Target &) const =0
GENIE's GHEP MC event record.
static constexpr double m
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.
enum genie::EGHepStatus GHepStatus_t
const Algorithm * SubAlg(const RgKey ®istry_key) const