270 LOG(
"NNBarOsc",
pINFO) <<
"Generating decay...";
273 LOG(
"NNBarOsc",
pINFO) <<
"Decay product IDs: " << pdgv;
274 assert ( pdgv.
size() > 1);
276 LOG(
"NNBarOsc",
pINFO) <<
"Performing a phase space decay...";
282 double * mass =
new double[pdgv.
size()];
284 for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
285 int pdgc = *pdg_iter;
292 <<
"Decaying N = " << pdgv.
size() <<
" particles / total mass = " << sum;
293 int initial_nucleus_id = 0;
294 int oscillating_neutron_id = 1;
295 int annihilation_nucleon_id = 2;
298 GHepParticle * initial_nucleus =
event->Particle(initial_nucleus_id);
299 assert(initial_nucleus);
300 GHepParticle * oscillating_neutron =
event->Particle(oscillating_neutron_id);
301 assert(oscillating_neutron);
302 GHepParticle * annihilation_nucleon =
event->Particle(annihilation_nucleon_id);
303 assert(annihilation_nucleon);
309 TLorentzVector * p4_1 = oscillating_neutron->
GetP4();
310 TLorentzVector * p4_2 = annihilation_nucleon->
GetP4();
311 TLorentzVector * p4d =
new TLorentzVector(*p4_1 + *p4_2);
312 TVector3
boost = p4d->BoostVector();
316 TLorentzVector * v4d = annihilation_nucleon->
GetX4();
331 <<
"Not enough energy to generate decay products! Selecting a new final state.";
335 int initial_nucleus_pdg = initial_nucleus->
Pdg();
338 if (nucleus_pdg.size() != 10) {
340 <<
"Expecting the nuclear PDG code to be a 10-digit integer, but it is " << nucleus_pdg <<
", which is " 341 << nucleus_pdg.size() <<
" digits long. Drop me an email at jezhewes@gmail.com ; exiting...";
345 int n_nucleons = std::stoi(nucleus_pdg.substr(6,3)) - 1;
346 int n_protons = std::stoi(nucleus_pdg.substr(3,3));
347 double proton_frac = ((double)n_protons) / ((double) n_nucleons);
348 double neutron_frac = 1 - proton_frac;
351 const int n_modes = 16;
352 double br [n_modes] = { 0.010, 0.080, 0.100, 0.220,
353 0.360, 0.160, 0.070, 0.020,
354 0.015, 0.065, 0.110, 0.280,
355 0.070, 0.240, 0.100, 0.100 };
357 for (
int i = 0; i < n_modes; i++) {
360 br[i] *= proton_frac;
363 br[i] *= neutron_frac;
369 double p = rnd->
RndNum().Rndm();
372 double threshold = 0;
373 for (
int j = 0; j < n_modes; j++) {
387 event->AttachSummary(interaction);
392 LOG(
"NNBarOsc",
pINFO) <<
"Decay product IDs: " << pdgv;
393 assert ( pdgv.
size() > 1);
396 LOG(
"NNBarOsc",
pINFO) <<
"Performing a phase space decay...";
399 mass =
new double[pdgv.
size()];
401 for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
402 int pdgc = *pdg_iter;
409 <<
"Decaying N = " << pdgv.
size() <<
" particles / total mass = " << sum;
418 <<
" *** Phase space decay is not permitted \n" 419 <<
" Total particle mass = " << sum <<
"\n" 427 exception.
SetReason(
"Decay not permitted kinematically");
435 for(
int i=0; i<200; i++) {
437 wmax = TMath::Max(wmax,w);
443 <<
"Max phase space gen. weight @ current hadronic system: " << wmax;
448 bool accept_decay=
false;
457 <<
"Couldn't generate an unweighted phase space decay after " 458 << itry <<
" attempts";
465 exception.
SetReason(
"Couldn't select decay after N attempts");
472 <<
"Decay weight = " << w <<
" > max decay weight = " << wmax;
474 double gw = wmax * rnd->
RndHadro().Rndm();
475 accept_decay = (gw<=
w);
478 <<
"Decay weight = " << w <<
" / R = " << gw
479 <<
" - accepted: " << accept_decay;
484 TLorentzVector v4(*v4d);
486 for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
487 int pdgc = *pdg_iter;
492 event->AddParticle(pdgc, ist, oscillating_neutron_id,-1,-1,-1, *p4fin, v4);
TLorentzVector * GetX4(void) const
NNBarOscMode_t fCurrDecayMode
static RandomGen * Instance()
Access instance.
GHepStatus_t DecayProductStatus(bool in_nucleus, int pdgc)
string P4AsString(const TLorentzVector *p)
static const unsigned int kMaxUnweightDecayIterations
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Summary information for an interaction.
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...
enum genie::ENNBarOscMode NNBarOscMode_t
TLorentzVector * GetP4(void) const
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
int DecayMode(void) const
TRandom3 & RndNum(void) const
rnd number generator used by MC integrators & other numerical methods
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
PDGCodeList DecayProductList(NNBarOscMode_t ndm)
void SwitchOnFastForward(void)
static PDGLibrary * Instance(void)
void SetReason(string reason)
void SetHitNucPdg(int pdgc)
const XclsTag & ExclTag(void) const
TParticlePDG * Find(int pdgc, bool must_exist=true)
STDHEP-like event record entry that can fit a particle or a nucleus.
std::string to_string(ModuleType const mt)
TGenPhaseSpace fPhaseSpaceGenerator
cet::coded_exception< error, detail::translate > exception
static Interaction * NOsc(int tgt, int annihilation_mode=-1)
enum genie::EGHepStatus GHepStatus_t
void SetSeed(long int seed)