GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::NucleonDecayPrimaryVtxGenerator Class Reference

Utilities for simulating nucleon decay. More...

#include <NucleonDecayPrimaryVtxGenerator.h>

Inheritance diagram for genie::NucleonDecayPrimaryVtxGenerator:
Inheritance graph
[legend]
Collaboration diagram for genie::NucleonDecayPrimaryVtxGenerator:
Collaboration graph
[legend]

Public Member Functions

 NucleonDecayPrimaryVtxGenerator ()
 
 NucleonDecayPrimaryVtxGenerator (string config)
 
 ~NucleonDecayPrimaryVtxGenerator ()
 
void ProcessEventRecord (GHepRecord *event) const
 
void Configure (const Registry &config)
 
void Configure (string config)
 
- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void FindConfig (void)
 
virtual const RegistryGetConfig (void) const
 
RegistryGetOwnedConfig (void)
 
virtual const AlgIdId (void) const
 Get algorithm ID. More...
 
virtual AlgStatus_t GetStatus (void) const
 Get algorithm status. More...
 
virtual bool AllowReconfig (void) const
 
virtual AlgCmp_t Compare (const Algorithm *alg) const
 Compare with input algorithm. More...
 
virtual void SetId (const AlgId &id)
 Set algorithm ID. More...
 
virtual void SetId (string name, string config)
 
const AlgorithmSubAlg (const RgKey &registry_key) const
 
void AdoptConfig (void)
 
void AdoptSubstructure (void)
 
virtual void Print (ostream &stream) const
 Print algorithm info. More...
 

Private Member Functions

void LoadConfig (void)
 
void AddInitialState (GHepRecord *event) const
 
void GenerateDecayedNucleonPosition (GHepRecord *event) const
 
void GenerateFermiMomentum (GHepRecord *event) const
 
void GenerateDecayProducts (GHepRecord *event) const
 

Private Attributes

int fCurrInitStatePdg
 
NucleonDecayMode_t fCurrDecayMode
 
int fCurrDecayedNucleon
 
bool fNucleonIsBound
 
TGenPhaseSpace fPhaseSpaceGenerator
 
const NuclearModelIfNuclModel
 

Additional Inherited Members

- Static Public Member Functions inherited from genie::Algorithm
static string BuildParamVectKey (const std::string &comm_name, unsigned int i)
 
static string BuildParamVectSizeKey (const std::string &comm_name)
 
static string BuildParamMatKey (const std::string &comm_name, unsigned int i, unsigned int j)
 
static string BuildParamMatRowSizeKey (const std::string &comm_name)
 
static string BuildParamMatColSizeKey (const std::string &comm_name)
 
- Protected Member Functions inherited from genie::EventRecordVisitorI
 EventRecordVisitorI ()
 
 EventRecordVisitorI (string name)
 
 EventRecordVisitorI (string name, string config)
 
- Protected Member Functions inherited from genie::Algorithm
 Algorithm ()
 
 Algorithm (string name)
 
 Algorithm (string name, string config)
 
void Initialize (void)
 
void DeleteConfig (void)
 
void DeleteSubstructure (void)
 
RegistryExtractLocalConfig (const Registry &in) const
 
RegistryExtractLowerConfig (const Registry &in, const string &alg_key) const
 Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key. More...
 
template<class T >
bool GetParam (const RgKey &name, T &p, bool is_top_call=true) const
 
template<class T >
bool GetParamDef (const RgKey &name, T &p, const T &def) const
 
template<class T >
int GetParamVect (const std::string &comm_name, std::vector< T > &v, bool is_top_call=true) const
 Handle to load vectors of parameters. More...
 
int GetParamVectKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
template<class T >
int GetParamMat (const std::string &comm_name, TMatrixT< T > &mat, bool is_top_call=true) const
 Handle to load matrix of parameters. More...
 
template<class T >
int GetParamMatSym (const std::string &comm_name, TMatrixTSym< T > &mat, bool is_top_call=true) const
 
int GetParamMatKeys (const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
 
int AddTopRegistry (Registry *rp, bool owns=true)
 add registry with top priority, also update ownership More...
 
int AddLowRegistry (Registry *rp, bool owns=true)
 add registry with lowest priority, also update ownership More...
 
int MergeTopRegistry (const Registry &r)
 
int AddTopRegisties (const vector< Registry * > &rs, bool owns=false)
 Add registries with top priority, also udated Ownerships. More...
 
- Protected Attributes inherited from genie::Algorithm
bool fAllowReconfig
 
bool fOwnsSubstruc
 true if it owns its substructure (sub-algs,...) More...
 
AlgId fID
 algorithm name and configuration set More...
 
vector< Registry * > fConfVect
 
vector< bool > fOwnerships
 ownership for every registry in fConfVect More...
 
AlgStatus_t fStatus
 algorithm execution status More...
 
AlgMapfOwnedSubAlgMp
 local pool for owned sub-algs (taken out of the factory pool) More...
 

Detailed Description

Utilities for simulating nucleon decay.

Author
Costas Andreopoulos <c.andreopoulos cern.ch> University of Liverpool
Created:
November 03, 2011
License:
Copyright (c) 2003-2024, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 30 of file NucleonDecayPrimaryVtxGenerator.h.

Constructor & Destructor Documentation

NucleonDecayPrimaryVtxGenerator::NucleonDecayPrimaryVtxGenerator ( )

Definition at line 34 of file NucleonDecayPrimaryVtxGenerator.cxx.

34  :
35 EventRecordVisitorI("genie::NucleonDecayPrimaryVtxGenerator")
36 {
37 
38 }
NucleonDecayPrimaryVtxGenerator::NucleonDecayPrimaryVtxGenerator ( string  config)

Definition at line 40 of file NucleonDecayPrimaryVtxGenerator.cxx.

41  :
42 EventRecordVisitorI("genie::NucleonDecayPrimaryVtxGenerator",config)
43 {
44 
45 }
NucleonDecayPrimaryVtxGenerator::~NucleonDecayPrimaryVtxGenerator ( )

Definition at line 47 of file NucleonDecayPrimaryVtxGenerator.cxx.

48 {
49 
50 }

Member Function Documentation

void NucleonDecayPrimaryVtxGenerator::AddInitialState ( GHepRecord event) const
private

Definition at line 72 of file NucleonDecayPrimaryVtxGenerator.cxx.

References genie::units::A, genie::utils::nucleon_decay::AsString(), fCurrDecayedNucleon, fCurrDecayMode, fCurrInitStatePdg, genie::PDGLibrary::Find(), fNucleonIsBound, genie::PDGLibrary::Instance(), genie::pdg::IonPdgCode(), genie::pdg::IonPdgCodeToA(), genie::pdg::IonPdgCodeToZ(), genie::kIStDecayedState, genie::kIStInitialState, genie::kIStStableFinalState, genie::kPdgNeutron, genie::kPdgProton, genie::kPdgTgtFreeN, genie::kPdgTgtFreeP, LOG, pWARN, genie::exceptions::EVGThreadException::SetReason(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by ProcessEventRecord().

74 {
75 //
76 // Add initial state in the event record.
77 //
78 // If the decayed nucleon is one bound in a nucleus, the event record is
79 // initialized as follows:
80 // id: 0, nucleus (kIStInitialState)
81 // |
82 // |---> { id: 1, nucleon (kIStDecayedState)
83 // { id: 2, remnant nucleus (kIStStableFinalState)
84 //
85 // If the decayed nucleon is a free one, the event record is initialized as
86 // follows:
87 // id: 0, nucleon (kIStInitialState)
88 // |
89 // |---> id: 1, nucleon (kIStDecayedState)
90 //
91 
92  TLorentzVector v4(0,0,0,0);
93 
97 
98  int ipdg = fCurrInitStatePdg;
99 
100  // Decayed nucleon is a bound one.
101  if(fNucleonIsBound)
102  {
103  // add initial nucleus
104  double Mi = PDGLibrary::Instance()->Find(ipdg)->Mass();
105  TLorentzVector p4i(0,0,0,Mi);
106  event->AddParticle(ipdg,stis,-1,-1,-1,-1, p4i, v4);
107 
108  // add decayed nucleon
109  int dpdg = fCurrDecayedNucleon;
110  double mn = PDGLibrary::Instance()->Find(dpdg)->Mass();
111  TLorentzVector p4n(0,0,0,mn);
112  event->AddParticle(dpdg,stdc, 0,-1,-1,-1, p4n, v4);
113 
114  // add nuclear remnant
115  int A = pdg::IonPdgCodeToA(ipdg);
116  int Z = pdg::IonPdgCodeToZ(ipdg);
117  A--;
118  if(dpdg == kPdgProton) { Z--; }
119  int rpdg = pdg::IonPdgCode(A, Z);
120  double Mf = PDGLibrary::Instance()->Find(rpdg)->Mass();
121  TLorentzVector p4f(0,0,0,Mf);
122  event->AddParticle(rpdg,stfs,0,-1,-1,-1, p4f, v4);
123  }
124 
125  // Decayed nucleon is a free one
126  else
127  {
128  // Initial state is either a neutron or a proton.
129  // Convert the initial state PDG code from the ion convention (10LZZZAAAI)
130  // to the usual code for neutrons or protons
131  int ipdg_short = -1;
132  if(ipdg == kPdgTgtFreeP) ipdg_short = kPdgProton;
133  if(ipdg == kPdgTgtFreeN) ipdg_short = kPdgNeutron;
134 
135  // Decayed nucleon code
136  int dpdg = fCurrDecayedNucleon;
137 
138  if(dpdg != ipdg_short) {
139  LOG("NucleonDecay", pWARN)
140  << "Couldn't generate given decay ("
142  << " for given initial state (PDG = " << ipdg_short << ")";
144  exception.SetReason("Decay-mode / Initial-state mismatch!");
145  exception.SwitchOnFastForward();
146  throw exception;
147  }
148  // add initial nucleon
149  double mn = PDGLibrary::Instance()->Find(ipdg)->Mass();
150  TLorentzVector p4i(0,0,0,mn);
151  event->AddParticle(dpdg,stis,-1,-1,-1,-1, p4i, v4);
152  // add decayed nucleon
153  event->AddParticle(dpdg,stdc,0,-1,-1,-1, p4i, v4);
154  }
155 }
int IonPdgCodeToA(int pdgc)
Definition: PDGUtils.cxx:63
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...
Definition: Messenger.h:96
static constexpr double A
Definition: Units.h:74
const int kPdgTgtFreeN
Definition: PDGCodes.h:200
const int kPdgTgtFreeP
Definition: PDGCodes.h:199
#define pWARN
Definition: Messenger.h:60
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:71
string AsString(NucleonDecayMode_t ndm, int npdg=0)
int IonPdgCodeToZ(int pdgc)
Definition: PDGUtils.cxx:55
const int kPdgProton
Definition: PDGCodes.h:81
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
const int kPdgNeutron
Definition: PDGCodes.h:83
enum genie::EGHepStatus GHepStatus_t
void NucleonDecayPrimaryVtxGenerator::Configure ( const Registry config)
virtual

Configure the algorithm with an external registry The registry is merged with the top level registry if it is owned, Otherwise a copy of it is added with the highest priority

Reimplemented from genie::Algorithm.

Definition at line 392 of file NucleonDecayPrimaryVtxGenerator.cxx.

References genie::Algorithm::Configure(), and LoadConfig().

393 {
394  Algorithm::Configure(config);
395  this->LoadConfig();
396 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NucleonDecayPrimaryVtxGenerator::Configure ( string  config)
virtual

Configure the algorithm from the AlgoConfigPool based on param_set string given in input An algorithm contains a vector of registries coming from different xml configuration files, which are loaded according a very precise prioriy This methods will load a number registries in order of priority: 1) "Tunable" parameter set from CommonParametes. This is loaded with the highest prioriry and it is designed to be used for tuning procedure Usage not expected from the user. 2) For every string defined in "CommonParame" the corresponding parameter set will be loaded from CommonParameter.xml 3) parameter set specified by the config string and defined in the xml file of the algorithm 4) if config is not "Default" also the Default parameter set from the same xml file will be loaded Effectively this avoids the repetion of a parameter when it is not changed in the requested configuration

Reimplemented from genie::Algorithm.

Definition at line 398 of file NucleonDecayPrimaryVtxGenerator.cxx.

References genie::Algorithm::Configure(), and LoadConfig().

399 {
400  Algorithm::Configure(config);
401  this->LoadConfig();
402 }
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
void NucleonDecayPrimaryVtxGenerator::GenerateDecayedNucleonPosition ( GHepRecord event) const
private

Definition at line 157 of file NucleonDecayPrimaryVtxGenerator.cxx.

References genie::units::A, genie::GHepParticle::A(), genie::utils::nuclear::Density(), genie::RandomGen::Instance(), genie::constants::kPi, genie::controls::kRjMaxIterations, LOG, pERROR, pINFO, pWARN, genie::RandomGen::RndFsi(), genie::GHepParticle::SetPosition(), genie::exceptions::EVGThreadException::SetReason(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by ProcessEventRecord().

159 {
160  GHepParticle * initial_nucleus = event->Particle(0);
161  int A = initial_nucleus->A();
162  if(A <= 2) {
163  return;
164  }
165 
166  RandomGen * rnd = RandomGen::Instance();
167 
168  double R0 = 1.3;
169  double dA = (double)A;
170  double R = R0 * TMath::Power(dA, 1./3.);
171 
172  LOG("NucleonDecay", pINFO)
173  << "Generating vertex according to a realistic nuclear density profile";
174 
175  // get inputs to the rejection method
176  double ymax = -1;
177  double rmax = 3*R;
178  double dr = R/40.;
179  for(double r = 0; r < rmax; r+=dr) {
180  ymax = TMath::Max(ymax, r*r * utils::nuclear::Density(r,A));
181  }
182  ymax *= 1.2;
183 
184  // select a vertex using the rejection method
185  TLorentzVector vtx(0,0,0,0);
186  unsigned int iter = 0;
187  while(1) {
188  iter++;
189 
190  // throw an exception if it hasn't find a solution after many attempts
191  if(iter > controls::kRjMaxIterations) {
192  LOG("NucleonDecay", pWARN)
193  << "Couldn't generate a vertex position after " << iter << " iterations";
195  exception.SetReason("Couldn't generate vertex");
196  exception.SwitchOnFastForward();
197  throw exception;
198  }
199 
200  double r = rmax * rnd->RndFsi().Rndm();
201  double t = ymax * rnd->RndFsi().Rndm();
202  double y = r*r * utils::nuclear::Density(r,A);
203  if(y > ymax) {
204  LOG("NucleonDecay", pERROR)
205  << "y = " << y << " > ymax = " << ymax << " for r = " << r << ", A = " << A;
206  }
207  bool accept = (t < y);
208  if(accept) {
209  double phi = 2*constants::kPi * rnd->RndFsi().Rndm();
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);
217  vtx.SetT(0.);
218  break;
219  }
220  } // while 1
221 
222  GHepParticle * decayed_nucleon = event->Particle(1);
223  assert(decayed_nucleon);
224  decayed_nucleon->SetPosition(vtx);
225 }
TRandom3 & RndFsi(void) const
rnd number generator used by intranuclear cascade monte carlos
Definition: RandomGen.h:59
#define pERROR
Definition: Messenger.h:59
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
double Density(double r, int A, double ring=0.)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
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...
Definition: Messenger.h:96
static constexpr double A
Definition: Units.h:74
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
int A(void) const
static const unsigned int kRjMaxIterations
Definition: Controls.h:26
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void NucleonDecayPrimaryVtxGenerator::GenerateDecayProducts ( GHepRecord event) const
private

accept_decay

Definition at line 269 of file NucleonDecayPrimaryVtxGenerator.cxx.

References genie::utils::nucleon_decay::DecayProductList(), genie::utils::nucleon_decay::DecayProductStatus(), fCurrDecayedNucleon, fCurrDecayMode, genie::PDGLibrary::Find(), fNucleonIsBound, fPhaseSpaceGenerator, genie::GHepParticle::GetP4(), genie::GHepParticle::GetX4(), genie::RandomGen::Instance(), genie::PDGLibrary::Instance(), genie::controls::kMaxUnweightDecayIterations, LOG, genie::units::m, genie::utils::print::P4AsString(), pERROR, pINFO, pNOTICE, pWARN, genie::RandomGen::RndHadro(), genie::exceptions::EVGThreadException::SetReason(), and genie::exceptions::EVGThreadException::SwitchOnFastForward().

Referenced by ProcessEventRecord().

271 {
272  LOG("NucleonDecay", pINFO) << "Generating decay...";
273 
275  LOG("NucleonDecay", pINFO) << "Decay product IDs: " << pdgv;
276  assert ( pdgv.size() > 1);
277 
278  LOG("NucleonDecay", pINFO) << "Performing a phase space decay...";
279 
280  // Get the decay product masses
281 
282  vector<int>::const_iterator pdg_iter;
283  int i = 0;
284  double * mass = new double[pdgv.size()];
285  double sum = 0;
286  for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
287  int pdgc = *pdg_iter;
288  double m = PDGLibrary::Instance()->Find(pdgc)->Mass();
289  mass[i++] = m;
290  sum += m;
291  }
292 
293  LOG("NucleonDecay", pINFO)
294  << "Decaying N = " << pdgv.size() << " particles / total mass = " << sum;
295 
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();
301 
302  LOG("NucleonDecay", pINFO)
303  << "Decaying system p4 = " << utils::print::P4AsString(p4d);
304 
305  // Set the decay
306  bool permitted = fPhaseSpaceGenerator.SetDecay(*p4d, pdgv.size(), mass);
307  if(!permitted) {
308  LOG("NucleonDecay", pERROR)
309  << " *** Phase space decay is not permitted \n"
310  << " Total particle mass = " << sum << "\n"
311  << " Decaying system p4 = " << utils::print::P4AsString(p4d);
312  // clean-up
313  delete [] mass;
314  delete p4d;
315  delete v4d;
316  // throw exception
318  exception.SetReason("Decay not permitted kinematically");
319  exception.SwitchOnFastForward();
320  throw exception;
321  }
322 
323  // Get the maximum weight
324  //double wmax = fPhaseSpaceGenerator.GetWtMax();
325  double wmax = -1;
326  for(int idec=0; idec<200; idec++) {
327  double w = fPhaseSpaceGenerator.Generate();
328  wmax = TMath::Max(wmax,w);
329  }
330  assert(wmax>0);
331  wmax *= 2;
332 
333  LOG("NucleonDecay", pNOTICE)
334  << "Max phase space gen. weight @ current hadronic system: " << wmax;
335 
336  // Generate an unweighted decay
337  RandomGen * rnd = RandomGen::Instance();
338 
339  bool accept_decay=false;
340  unsigned int itry=0;
341  while(!accept_decay)
342  {
343  itry++;
344 
346  // report, clean-up and return
347  LOG("NucleonDecay", pWARN)
348  << "Couldn't generate an unweighted phase space decay after "
349  << itry << " attempts";
350  // clean up
351  delete [] mass;
352  delete p4d;
353  delete v4d;
354  // throw exception
356  exception.SetReason("Couldn't select decay after N attempts");
357  exception.SwitchOnFastForward();
358  throw exception;
359  }
360  double w = fPhaseSpaceGenerator.Generate();
361  if(w > wmax) {
362  LOG("NucleonDecay", pWARN)
363  << "Decay weight = " << w << " > max decay weight = " << wmax;
364  }
365  double gw = wmax * rnd->RndHadro().Rndm();
366  accept_decay = (gw<=w);
367 
368  LOG("NucleonDecay", pINFO)
369  << "Decay weight = " << w << " / R = " << gw
370  << " - accepted: " << accept_decay;
371 
372  } //!accept_decay
373 
374  // Insert final state products into a TClonesArray of GHepParticle's
375  TLorentzVector v4(*v4d);
376  int idp = 0;
377  for(pdg_iter = pdgv.begin(); pdg_iter != pdgv.end(); ++pdg_iter) {
378  int pdgc = *pdg_iter;
379  TLorentzVector * p4fin = fPhaseSpaceGenerator.GetDecay(idp);
380  GHepStatus_t ist =
382  event->AddParticle(pdgc, ist, decayed_nucleon_id,-1,-1,-1, *p4fin, v4);
383  idp++;
384  }
385 
386  // Clean-up
387  delete [] mass;
388  delete p4d;
389  delete v4d;
390 }
TLorentzVector * GetX4(void) const
#define pERROR
Definition: Messenger.h:59
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
string P4AsString(const TLorentzVector *p)
Definition: PrintUtils.cxx:27
static const unsigned int kMaxUnweightDecayIterations
Definition: Controls.h:61
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
A list of PDG codes.
Definition: PDGCodeList.h:32
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...
Definition: Messenger.h:96
TLorentzVector * GetP4(void) const
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
PDGCodeList DecayProductList(NucleonDecayMode_t ndm, int npdg=0)
GHepStatus_t DecayProductStatus(bool in_nucleus, int pdgc)
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
Definition: RandomGen.h:53
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
#define pNOTICE
Definition: Messenger.h:61
static constexpr double m
Definition: Units.h:71
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
enum genie::EGHepStatus GHepStatus_t
void NucleonDecayPrimaryVtxGenerator::GenerateFermiMomentum ( GHepRecord event) const
private

Definition at line 227 of file NucleonDecayPrimaryVtxGenerator.cxx.

References genie::units::A, genie::GHepParticle::A(), genie::PDGLibrary::Find(), fNuclModel, genie::NuclearModelI::GenerateNucleon(), genie::PDGLibrary::Instance(), LOG, genie::utils::res::Mass(), genie::NuclearModelI::Momentum3(), genie::GHepParticle::Pdg(), pINFO, genie::NuclearModelI::RemovalEnergy(), genie::Target::SetHitNucPdg(), and genie::GHepParticle::SetMomentum().

Referenced by ProcessEventRecord().

229 {
230  GHepParticle * initial_nucleus = event->Particle(0);
231  int A = initial_nucleus->A();
232  if(A <= 2) {
233  return;
234  }
235 
236  GHepParticle * decayed_nucleon = event->Particle(1);
237  GHepParticle * remnant_nucleus = event->Particle(2);
238  assert(decayed_nucleon);
239  assert(remnant_nucleus);
240 
241  // generate a Fermi momentum & removal energy
242  Target tgt(initial_nucleus->Pdg());
243  tgt.SetHitNucPdg(decayed_nucleon->Pdg());
245  TVector3 p3 = fNuclModel->Momentum3();
246  double w = fNuclModel->RemovalEnergy();
247 
248  LOG("FermiMover", pINFO)
249  << "Generated nucleon momentum: ("
250  << p3.Px() << ", " << p3.Py() << ", " << p3.Pz() << "), "
251  << "|p| = " << p3.Mag();
252  LOG("NucleonDecay", pINFO)
253  << "Generated nucleon removal energy: w = " << w;
254 
255  double pF2 = p3.Mag2(); // (fermi momentum)^2
256 
257  double Mi = PDGLibrary::Instance()->Find(initial_nucleus->Pdg())-> Mass(); // initial nucleus mass
258  double Mf = PDGLibrary::Instance()->Find(remnant_nucleus->Pdg())-> Mass(); // remnant nucleus mass
259 
260  double EN = Mi - TMath::Sqrt(pF2 + Mf*Mf);
261 
262  TLorentzVector p4nucleon( p3.Px(), p3.Py(), p3.Pz(), EN);
263  TLorentzVector p4remnant(-1*p3.Px(), -1*p3.Py(), -1*p3.Pz(), Mi-EN);
264 
265  decayed_nucleon->SetMomentum(p4nucleon);
266  remnant_nucleus->SetMomentum(p4remnant);
267 }
double RemovalEnergy(void) const
Definition: NuclearModelI.h:65
double Mass(Resonance_t res)
resonance mass (GeV)
void SetMomentum(const TLorentzVector &p4)
const TVector3 & Momentum3(void) const
Definition: NuclearModelI.h:75
int Pdg(void) const
Definition: GHepParticle.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static constexpr double A
Definition: Units.h:74
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:40
#define pINFO
Definition: Messenger.h:62
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
void SetHitNucPdg(int pdgc)
Definition: Target.cxx:171
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
int A(void) const
virtual bool GenerateNucleon(const Target &) const =0
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void NucleonDecayPrimaryVtxGenerator::LoadConfig ( void  )
private

Definition at line 404 of file NucleonDecayPrimaryVtxGenerator.cxx.

References fNuclModel, and genie::Algorithm::SubAlg().

Referenced by Configure().

405 {
406 // AlgConfigPool * confp = AlgConfigPool::Instance();
407 // const Registry * gc = confp->GlobalParameterList();
408 
409  fNuclModel = 0;
410 
411  RgKey nuclkey = "NuclearModel";
412  fNuclModel = dynamic_cast<const NuclearModelI *> (this->SubAlg(nuclkey));
413  assert(fNuclModel);
414 }
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
Definition: NuclearModelI.h:46
string RgKey
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:345
void NucleonDecayPrimaryVtxGenerator::ProcessEventRecord ( GHepRecord event) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 52 of file NucleonDecayPrimaryVtxGenerator.cxx.

References AddInitialState(), genie::utils::nucleon_decay::AsString(), genie::XclsTag::DecayMode(), genie::Interaction::ExclTag(), fCurrDecayedNucleon, fCurrDecayMode, fCurrInitStatePdg, fNucleonIsBound, GenerateDecayedNucleonPosition(), GenerateDecayProducts(), GenerateFermiMomentum(), genie::Target::HitNucPdg(), genie::Interaction::InitState(), genie::pdg::IonPdgCodeToA(), LOG, genie::Target::Pdg(), pNOTICE, and genie::InitialState::Tgt().

54 {
55  Interaction * interaction = event->Summary();
56  fCurrInitStatePdg = interaction->InitState().Tgt().Pdg();
58  fCurrDecayedNucleon = interaction->InitState().Tgt().HitNucPdg();
59 
60  LOG("NucleonDecay", pNOTICE)
62  << " for an initial state with code: " << fCurrInitStatePdg;
63 
65 
66  this->AddInitialState(event);
67  this->GenerateDecayedNucleonPosition(event);
68  this->GenerateFermiMomentum(event);
69  this->GenerateDecayProducts(event);
70 }
void GenerateDecayedNucleonPosition(GHepRecord *event) const
int HitNucPdg(void) const
Definition: Target.cxx:304
int Pdg(void) const
Definition: Target.h:71
int IonPdgCodeToA(int pdgc)
Definition: PDGUtils.cxx:63
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
int DecayMode(void) const
Definition: XclsTag.h:70
const XclsTag & ExclTag(void) const
Definition: Interaction.h:72
enum genie::ENucleonDecayMode NucleonDecayMode_t
string AsString(NucleonDecayMode_t ndm, int npdg=0)
const InitialState & InitState(void) const
Definition: Interaction.h:69
#define pNOTICE
Definition: Messenger.h:61
const Target & Tgt(void) const
Definition: InitialState.h:66

Member Data Documentation

int genie::NucleonDecayPrimaryVtxGenerator::fCurrDecayedNucleon
mutableprivate
NucleonDecayMode_t genie::NucleonDecayPrimaryVtxGenerator::fCurrDecayMode
mutableprivate
int genie::NucleonDecayPrimaryVtxGenerator::fCurrInitStatePdg
mutableprivate

Definition at line 53 of file NucleonDecayPrimaryVtxGenerator.h.

Referenced by AddInitialState(), and ProcessEventRecord().

bool genie::NucleonDecayPrimaryVtxGenerator::fNucleonIsBound
mutableprivate
const NuclearModelI* genie::NucleonDecayPrimaryVtxGenerator::fNuclModel
private

Definition at line 59 of file NucleonDecayPrimaryVtxGenerator.h.

Referenced by GenerateFermiMomentum(), and LoadConfig().

TGenPhaseSpace genie::NucleonDecayPrimaryVtxGenerator::fPhaseSpaceGenerator
mutableprivate

Definition at line 57 of file NucleonDecayPrimaryVtxGenerator.h.

Referenced by GenerateDecayProducts().


The documentation for this class was generated from the following files: