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

#include <AMNuGammaGenerator.h>

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

Public Member Functions

 AMNuGammaGenerator ()
 
 AMNuGammaGenerator (string config)
 
 ~AMNuGammaGenerator ()
 
void ProcessEventRecord (GHepRecord *event_rec) const
 
- Public Member Functions inherited from genie::EventRecordVisitorI
virtual ~EventRecordVisitorI ()
 
- Public Member Functions inherited from genie::Algorithm
virtual ~Algorithm ()
 
virtual void Configure (const Registry &config)
 
virtual void Configure (string config)
 
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 AddPhoton (GHepRecord *event_rec) const
 
void AddFinalStateNeutrino (GHepRecord *event_rec) const
 
void AddTargetRemnant (GHepRecord *event_rec) const
 
void AddRecoilNucleon (GHepRecord *event_rec) const
 

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

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

Definition at line 25 of file AMNuGammaGenerator.h.

Constructor & Destructor Documentation

AMNuGammaGenerator::AMNuGammaGenerator ( )

Definition at line 28 of file AMNuGammaGenerator.cxx.

28  :
29 EventRecordVisitorI("genie::AMNuGammaGenerator")
30 {
31 
32 }
AMNuGammaGenerator::AMNuGammaGenerator ( string  config)

Definition at line 34 of file AMNuGammaGenerator.cxx.

34  :
35 EventRecordVisitorI("genie::AMNuGammaGenerator", config)
36 {
37 
38 }
AMNuGammaGenerator::~AMNuGammaGenerator ( )

Definition at line 40 of file AMNuGammaGenerator.cxx.

41 {
42 
43 }

Member Function Documentation

void AMNuGammaGenerator::AddFinalStateNeutrino ( GHepRecord event_rec) const
private

Definition at line 112 of file AMNuGammaGenerator.cxx.

References genie::GHepRecord::AddParticle(), genie::GHepParticle::FirstDaughter(), genie::kIStStableFinalState, LOG, genie::GHepParticle::P4(), genie::GHepRecord::Particle(), genie::GHepParticle::Pdg(), pINFO, genie::GHepRecord::Probe(), and genie::GHepParticle::X4().

Referenced by ProcessEventRecord().

113 {
114 // Adding the final state neutrino
115 // Just use 4-momentum conservation (init_neutrino = photon + final_neutrino)
116 
117  LOG("AMNuGammaGenerator", pINFO) << "Adding final state neutrino";
118 
119  GHepParticle * nu = evrec->Probe(); // incoming v
120  GHepParticle * gamma = evrec->Particle(nu->FirstDaughter()); // gamma
121  assert(nu);
122  assert(gamma);
123 
124  const TLorentzVector & vtx = *(nu->X4()); // vtx
125 
126  const TLorentzVector & p4nu_lab = *(nu->P4());
127  const TLorentzVector & p4gamma_lab = *(gamma->P4());
128  TLorentzVector p4_lab = p4nu_lab - p4gamma_lab;
129 
130  GHepParticle p(nu->Pdg(), kIStStableFinalState, 0,-1,-1,-1, p4_lab, vtx);
131  evrec->AddParticle(p);
132 }
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
int FirstDaughter(void) const
Definition: GHepParticle.h:68
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
#define pINFO
Definition: Messenger.h:62
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void AMNuGammaGenerator::AddPhoton ( GHepRecord event_rec) const
private

Definition at line 53 of file AMNuGammaGenerator.cxx.

References genie::GHepRecord::AddParticle(), genie::GHepRecord::HitNucleon(), genie::RandomGen::Instance(), genie::kIStStableFinalState, genie::kPdgGamma, genie::constants::kPi, LOG, genie::GHepParticle::P4(), pINFO, genie::GHepRecord::Probe(), genie::RandomGen::RndKine(), and genie::GHepParticle::X4().

Referenced by ProcessEventRecord().

54 {
55 // Adding the final state photon
56 //
57  LOG("AMNuGammaGenerator", pINFO) << "Adding final state photon";
58 
60 
61  // Get boost vector for transforms between LAB <-> NRF (nucleon rest frame)
62  GHepParticle * nuc = evrec->HitNucleon();
63  const TLorentzVector & p4nuc_lab = *(nuc->P4());
64  TVector3 beta = p4nuc_lab.BoostVector();
65 
66  // Get the neutrino 4-momentum at the LAB
67  GHepParticle * nu = evrec->Probe();
68  const TLorentzVector & p4v_lab = *(nu->P4());
69 
70  // Get the neutrino 4-momentum at the NRF
71  TLorentzVector p4v_nrf = p4v_lab;
72  p4v_nrf.Boost(-1.*beta);
73 
74  // Generate the photon cos(theta) with respect to the neutrino direction
75  // (at NRF) and a uniform azimuthal angle phi
76  double costheta_gamma = -1.0 + 2.0 * rnd->RndKine().Rndm();
77  double phi_gamma = 2.0 * kPi * rnd->RndKine().Rndm();
78 
79  // Generate the fraction of the neutrino energy taken by the photon
80  double efrac_gamma = rnd->RndKine().Rndm();
81 
82  // Calculate the photon energy at the NRF
83  double Ev_nrf = p4v_nrf.Energy();
84  double Egamma_nrf = Ev_nrf * efrac_gamma;
85 
86  // Calculate the photon momentum components at a rotated NRF (NRF')
87  // where z is along the neutrino direction
88  double sintheta_gamma = TMath::Sqrt(1-TMath::Power(costheta_gamma,2));
89  double pgamma_nrf_p = Egamma_nrf * costheta_gamma; // p(//)
90  double pgamma_nrf_t = Egamma_nrf * sintheta_gamma; // p(-|)
91  double px = pgamma_nrf_t * TMath::Sin(phi_gamma);
92  double py = pgamma_nrf_t * TMath::Cos(phi_gamma);
93  double pz = pgamma_nrf_p;
94 
95  // Take a unit vector along the neutrino direction @ the NRF
96  TVector3 unit_nudir = p4v_nrf.Vect().Unit();
97 
98  // Rotate the photon momentum vector from NRF' -> NRF
99  TVector3 p3gamma_nrf(px,py,pz);
100  p3gamma_nrf.RotateUz(unit_nudir);
101 
102  // Get the photon 4-momentum back at the LAB
103  TLorentzVector p4gamma_lab(p3gamma_nrf, Egamma_nrf);
104  p4gamma_lab.Boost(beta);
105 
106  // Add the photon at the event record
107  const TLorentzVector & vtx = *(nu->X4());
108  GHepParticle p(kPdgGamma,kIStStableFinalState,0,-1,-1,-1,p4gamma_lab,vtx);
109  evrec->AddParticle(p);
110 }
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
const int kPdgGamma
Definition: PDGCodes.h:189
#define pINFO
Definition: Messenger.h:62
TRandom3 & RndKine(void) const
rnd number generator used by kinematics generators
Definition: RandomGen.h:50
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
void AMNuGammaGenerator::AddRecoilNucleon ( GHepRecord event_rec) const
private

p.SetRemovalEnergy(w);

Definition at line 134 of file AMNuGammaGenerator.cxx.

References genie::GHepRecord::AddParticle(), genie::PDGLibrary::Find(), genie::GHepRecord::HitNucleon(), genie::GHepRecord::HitNucleonPosition(), genie::PDGLibrary::Instance(), genie::kIStHadronInTheNucleus, genie::kIStStableFinalState, LOG, genie::units::m, genie::GHepParticle::P4(), genie::GHepParticle::Pdg(), pINFO, genie::GHepRecord::Probe(), genie::GHepRecord::TargetNucleus(), and genie::GHepParticle::X4().

Referenced by ProcessEventRecord().

135 {
136 // Adding the recoil nucleon.
137 // Recoil is negligible at the H3 model. However, for nuclear targets, the
138 // hit nucleon was off-the-mass-shell (bound). Doing some magic here to bring
139 // it back on-the-mass-shell so that it can be INTRANUKE'ed and appear in
140 // the final state. The nucleon will keep its original (Fermi) 3-momentum but
141 // take some energy back from the remnant nucleus. No such tweaking takes
142 // place for free nucleon targets.
143 
144  LOG("AMNuGammaGenerator", pINFO) << "Adding recoil nucleon";
145 
146  // Get the interaction target
147  GHepParticle * tgt_nucleus = evrec->TargetNucleus();
148  bool is_nuclear_target = (tgt_nucleus!=0);
149 
150  // Get the hit nucleon
151  GHepParticle * hitnuc = evrec->HitNucleon();
152  assert(hitnuc);
153 
154  // Get the hit nucleon pdg code (= recoil nucleon pdg code)
155  int pdgc = hitnuc->Pdg();
156 
157  // Get the hit nucleon 4-momentum (LAB)
158  const TLorentzVector & p4n = *(hitnuc->P4());
159  TLorentzVector p4(p4n);
160 
161  // Tweak the 4-momentum to bring the recoil nucleon on-the-mass-shell
162  // (for nuclear targets only)
163  if (is_nuclear_target) {
164  double p = p4.Vect().Mag();
165  double m = PDGLibrary::Instance()->Find(pdgc)->Mass();
166  double E = TMath::Sqrt(m*m+p*p);
167  p4.SetE(E);
168  }
169 
170  // Get the vtx position
171  GHepParticle * neutrino = evrec->Probe();
172  const TLorentzVector & vtx = *(neutrino->X4());
173 
174  // Add the recoil nucleon at the event record
175  GHepStatus_t ist = (is_nuclear_target) ?
177  int mom = evrec->HitNucleonPosition();
178 
179  LOG("AMNuGammaGenerator", pINFO)
180  << "Adding recoil baryon [pdgc = " << pdgc << "]";
181 
182  GHepParticle p(pdgc, ist, mom,-1,-1,-1, p4, vtx);
183 // double w = hitnuc->RemovalEnergy();
184 /// p.SetRemovalEnergy(w);
185  evrec->AddParticle(p);
186 }
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
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
#define pINFO
Definition: Messenger.h:62
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:79
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
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 AMNuGammaGenerator::AddTargetRemnant ( GHepRecord event_rec) const
private

Definition at line 188 of file AMNuGammaGenerator.cxx.

References genie::units::A, genie::GHepParticle::A(), genie::GHepRecord::AddParticle(), genie::PDGLibrary::Find(), genie::GHepParticle::FirstDaughter(), genie::GHepRecord::HitNucleon(), genie::PDGLibrary::Instance(), genie::pdg::IonPdgCode(), genie::pdg::IsProton(), genie::kIStStableFinalState, LOG, genie::GHepParticle::P4(), genie::GHepRecord::Particle(), pDEBUG, genie::GHepParticle::Pdg(), pFATAL, pINFO, genie::GHepParticle::Px(), genie::GHepParticle::Py(), genie::GHepParticle::Pz(), genie::GHepRecord::TargetNucleus(), genie::GHepRecord::TargetNucleusPosition(), and genie::GHepParticle::Z().

189 {
190 // Add the remnant nuclear target at the GHEP record
191 
192  LOG("AMNuGammaGenerator", pINFO) << "Adding final state nucleus";
193 
194  // Skip for non nuclear targets
195  GHepParticle * nucleus = evrec->TargetNucleus();
196  if (!nucleus) {
197  LOG("AMNuGammaGenerator", pDEBUG)
198  << "No nucleus in the initial state - no remnant nucleus to add in the f/s";
199  return;
200  }
201 
202  // Compute A,Z for final state nucleus & get its PDG code and its mass
203  //GHepParticle * nucleon = evrec->HitNucleon();
204 
205  GHepParticle * hit_nucleon = evrec->HitNucleon(); // hit
206  GHepParticle * rec_nucleon = evrec->Particle(hit_nucleon->FirstDaughter()); // recoil
207 
208  assert(rec_nucleon);
209  int npdgc = rec_nucleon->Pdg();
210  bool is_p = pdg::IsProton(npdgc);
211  int A = nucleus->A();
212  int Z = nucleus->Z();
213  if (is_p) Z--;
214  A--;
215  int ipdgc = pdg::IonPdgCode(A, Z);
216  TParticlePDG * remnant = PDGLibrary::Instance()->Find(ipdgc);
217  if(!remnant) {
218  LOG("AMNuGammaGenerator", pFATAL)
219  << "No particle with [A = " << A << ", Z = " << Z
220  << ", pdgc = " << ipdgc << "] in PDGLibrary!";
221  assert(remnant);
222  }
223 
224  // Figure out the remnant 4-momentum
225  double Mf = remnant->Mass();
226  double Mf2 = TMath::Power(Mf,2);
227  double px = -1.* rec_nucleon->Px();
228  double py = -1.* rec_nucleon->Py();
229  double pz = -1.* rec_nucleon->Pz();
230  double E = TMath::Sqrt(Mf2 + rec_nucleon->P4()->Vect().Mag2());
231  E += (hit_nucleon->P4()->E() - rec_nucleon->P4()->E());
232 
233  //-- Add the nucleus to the event record
234  LOG("AMNuGammaGenerator", pINFO)
235  << "Adding nucleus [A = " << A << ", Z = " << Z
236  << ", pdgc = " << ipdgc << "]";
237  int mom = evrec->TargetNucleusPosition();
238  evrec->AddParticle(
239  ipdgc,kIStStableFinalState, mom,-1,-1,-1, px,py,pz,E, 0,0,0,0);
240 }
int Z(void) const
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:78
int FirstDaughter(void) const
Definition: GHepParticle.h:68
#define pFATAL
Definition: Messenger.h:56
double Pz(void) const
Get Pz.
Definition: GHepParticle.h:90
double Px(void) const
Get Px.
Definition: GHepParticle.h:88
int Pdg(void) const
Definition: GHepParticle.h:63
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:336
#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
static PDGLibrary * Instance(void)
Definition: PDGLibrary.cxx:68
int IonPdgCode(int A, int Z)
Definition: PDGUtils.cxx:71
TParticlePDG * Find(int pdgc, bool must_exist=true)
Definition: PDGLibrary.cxx:86
int A(void) const
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:39
#define pDEBUG
Definition: Messenger.h:63
double Py(void) const
Get Py.
Definition: GHepParticle.h:89
void AMNuGammaGenerator::ProcessEventRecord ( GHepRecord event_rec) const
virtual

Implements genie::EventRecordVisitorI.

Definition at line 45 of file AMNuGammaGenerator.cxx.

References AddFinalStateNeutrino(), AddPhoton(), and AddRecoilNucleon().

46 {
47  this->AddPhoton(evrec);
48  this->AddFinalStateNeutrino(evrec);
49  this->AddRecoilNucleon(evrec);
50 //this->AddTargetRemnant(evrec);
51 }
void AddPhoton(GHepRecord *event_rec) const
void AddFinalStateNeutrino(GHepRecord *event_rec) const
void AddRecoilNucleon(GHepRecord *event_rec) const

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