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";
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
virtual void Configure(const Registry &config)
const Algorithm * SubAlg(const RgKey ®istry_key) const
STDHEP-like event record entry that can fit a particle or a nucleus.
void SetPosition(const TLorentzVector &v4)
void SetMomentum(const TLorentzVector &p4)
TLorentzVector * GetP4(void) const
TLorentzVector * GetX4(void) const
GENIE's GHEP MC event record.
const Target & Tgt(void) const
Summary information for an interaction.
const XclsTag & ExclTag(void) const
const InitialState & InitState(void) const
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
void Configure(const Registry &config)
~NucleonDecayPrimaryVtxGenerator()
NucleonDecayPrimaryVtxGenerator()
void ProcessEventRecord(GHepRecord *event) const
void GenerateDecayProducts(GHepRecord *event) const
const NuclearModelI * fNuclModel
TGenPhaseSpace fPhaseSpaceGenerator
NucleonDecayMode_t fCurrDecayMode
void AddInitialState(GHepRecord *event) const
void GenerateFermiMomentum(GHepRecord *event) const
void GenerateDecayedNucleonPosition(GHepRecord *event) const
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...
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
static RandomGen * Instance()
Access instance.
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
A registry. Provides the container for algorithm configuration parameters.
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
int HitNucPdg(void) const
void SetHitNucPdg(int pdgc)
int DecayMode(void) const
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
void SwitchOnFastForward(void)
void SetReason(string reason)
static const unsigned int kMaxUnweightDecayIterations
static const unsigned int kRjMaxIterations
int IonPdgCode(int A, int Z)
int IonPdgCodeToZ(int pdgc)
int IonPdgCodeToA(int pdgc)
double Density(double r, int A, double ring=0.)
GHepStatus_t DecayProductStatus(bool in_nucleus, int pdgc)
string AsString(NucleonDecayMode_t ndm, int npdg=0)
PDGCodeList DecayProductList(NucleonDecayMode_t ndm, int npdg=0)
string P4AsString(const TLorentzVector *p)
THE MAIN GENIE PROJECT NAMESPACE
enum genie::EGHepStatus GHepStatus_t
enum genie::ENucleonDecayMode NucleonDecayMode_t