GENIEGenerator
Loading...
Searching...
No Matches
RESHadronicSystemGenerator.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
11// #include <RVersion.h>
12// #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6)
13// #include <TMCParticle.h>
14// #else
15// #include <TMCParticle6.h>
16// #endif
17
34// #include "Physics/Decay/DecayModelI.h"
36
37using namespace genie;
38using namespace genie::constants;
39
40//___________________________________________________________________________
42HadronicSystemGenerator("genie::RESHadronicSystemGenerator")
43{
44
45}
46//___________________________________________________________________________
48HadronicSystemGenerator("genie::RESHadronicSystemGenerator", config)
49{
50
51}
52//___________________________________________________________________________
57//___________________________________________________________________________
59{
60// This method generates the final state hadronic system
61
62 // Get the right resonance PDG code so that the selected resonance
63 // conserves charge
64 int pdgc = GetResonancePdgCode(evrec);
65
66 // Add the selected resonance
67 this->AddResonance(evrec,pdgc);
68
69 // Decay the resonance (and its decay products, if they include resonances)
70 fResonanceDecayer->ProcessEventRecord(evrec);
71
72 // Add the baryon resonance decay products at the event record
73 //this->AddResonanceDecayProducts(evrec,pdgc);
74
75 // Handle resonance decay channels to other resonances or short-living
76 // partices
77 //LOG("RESHadronicVtx", pNOTICE)
78 // << "Decay any resonance in the initial resonance decay products";
79 //this->PreHadronTransportDecays(evrec);
80}
81//___________________________________________________________________________
83{
84// In the RES thread the resonance is specifed when selecting interaction
85// This method adds it to the GHEP record.
86
87 Interaction * interaction = evrec->Summary();
88
89 // Get resonance id
90 const XclsTag & xcls = interaction->ExclTag();
91 assert(xcls.KnownResonance());
92 Resonance_t res = xcls.Resonance();
93
94 // Get resonance charge
95 int q_res = this->ResonanceCharge(evrec);
96
97 // Find resonance PDG code from resonance charge and id
98 int pdgc = utils::res::PdgCode(res, q_res);
99
100 LOG("RESHadronicVtx", pNOTICE)
101 << "Selected event has RES with PDGC = " << pdgc << ", Q = " << q_res;
102
103 return pdgc;
104}
105//___________________________________________________________________________
107 GHepRecord * evrec, int pdgc) const
108{
109 //-- Compute RES p4 = p4(neutrino) + p4(hit nucleon) - p4(primary lepton)
110 TLorentzVector p4 = this->Hadronic4pLAB(evrec);
111
112 //-- Add the resonance at the EventRecord
114 int mom = evrec->HitNucleonPosition();
115
116 //-- Get vtx position
117 GHepParticle * neutrino = evrec->Probe();
118 const TLorentzVector & vtx = *(neutrino->X4());
119
120 evrec->AddParticle(pdgc, ist, mom,-1,-1,-1, p4, vtx);
121}
122//___________________________________________________________________________
123// void RESHadronicSystemGenerator::AddResonanceDecayProducts(
124// GHepRecord * evrec, int pdgc) const
125// {
126// // Decay the baryon resonance, take the decay products, boost them in the LAB
127// // and add them in the GHEP record.
128// // Unlike the SPP thread where the resonance decay products are determined
129// // from the selected SPP channel, in the RES thread we can any of the the
130// // resonance's kinematically available(the RES is not on the mass shell)decay
131// // channels
132//
133// // find the resonance position
134// int irpos = evrec->ParticlePosition(pdgc, kIStPreDecayResonantState, 0);
135// assert(irpos>0);
136//
137// // access the GHEP entry
138// GHepParticle * resonance = evrec->Particle(irpos);
139// assert(resonance);
140//
141// // resonance location
142// const TLorentzVector & x4 = *(resonance->X4());
143//
144// // prepare the decayer inputs
145// DecayerInputs_t dinp;
146// dinp.PdgCode = pdgc;
147// dinp.P4 = resonance->P4();
148//
149// // do the decay
150// TClonesArray * decay_products = fResonanceDecayer->Decay(dinp);
151// if(!decay_products) {
152// LOG("RESHadronicVtx", pWARN) << "Got an empty decay product list!";
153// LOG("RESHadronicVtx", pWARN)
154// << "Quitting the current event generation thread";
155//
156// evrec->EventFlags()->SetBitNumber(kHadroSysGenErr, true);
157//
158// genie::exceptions::EVGThreadException exception;
159// exception.SetReason("Not enough phase space for hadronizer");
160// exception.SwitchOnFastForward();
161// throw exception;
162//
163// return;
164// }
165//
166// // get the decay weight (if any)
167// double wght = fResonanceDecayer->Weight();
168//
169// // update the event weight
170// evrec->SetWeight(wght * evrec->Weight());
171//
172// // decide the istatus of decay products
173// GHepParticle * nuc = evrec->TargetNucleus();
174// GHepStatus_t dpist = (nuc) ? kIStHadronInTheNucleus : kIStStableFinalState;
175//
176// // if the list is not empty, boost and copy the decay products in GHEP
177// if(decay_products) {
178//
179// // first, mark the resonance as decayed
180// resonance->SetStatus(kIStDecayedState);
181//
182// // loop over the daughter and add them to the event record
183// TMCParticle * dpmc = 0;
184// TObjArrayIter decay_iter(decay_products);
185//
186// while( (dpmc = (TMCParticle *) decay_iter.Next()) ) {
187//
188// int dppdg = dpmc->GetKF();
189// double px = dpmc->GetPx();
190// double py = dpmc->GetPy();
191// double pz = dpmc->GetPz();
192// double E = dpmc->GetEnergy();
193// TLorentzVector p4(px,py,pz,E);
194//
195// //-- Only add the decay products - the mother particle already exists
196// if(dpmc->GetKS()==1) {
197// evrec->AddParticle(dppdg,dpist,irpos,-1,-1,-1, p4, x4);
198// }
199// }
200//
201// // done, release the original list
202// decay_products->Delete();
203// delete decay_products;
204// }// !=0
205// }
206//___________________________________________________________________________
208{
209 Algorithm::Configure(config);
210 this->LoadConfig();
211}
212//___________________________________________________________________________
214{
215 Algorithm::Configure(config);
216 this->LoadConfig();
217}
218//___________________________________________________________________________
220{
222 //fPreINukeDecayer = 0;
223
224 // Get the specified decayers
226 dynamic_cast<const EventRecordVisitorI *> (this->SubAlg("Decayer"));
227 assert(fResonanceDecayer);
228 // fPreINukeDecayer =
229 // dynamic_cast<const EventRecordVisitorI *> (this->SubAlg("PreTransportDecayer"));
230 // assert(fPreINukeDecayer);
231}
232//___________________________________________________________________________
#define pNOTICE
Definition Messenger.h:61
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
const Algorithm * SubAlg(const RgKey &registry_key) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
STDHEP-like event record entry that can fit a particle or a nucleus.
const TLorentzVector * X4(void) const
GENIE's GHEP MC event record.
Definition GHepRecord.h:45
virtual GHepParticle * Probe(void) const
virtual Interaction * Summary(void) const
virtual void AddParticle(const GHepParticle &p)
virtual int HitNucleonPosition(void) const
TLorentzVector Hadronic4pLAB(GHepRecord *event_rec) const
int ResonanceCharge(GHepRecord *event_rec) const
Summary information for an interaction.
Definition Interaction.h:56
const XclsTag & ExclTag(void) const
Definition Interaction.h:72
void ProcessEventRecord(GHepRecord *event_rec) const
void AddResonance(GHepRecord *evrec, int pdgc) const
const EventRecordVisitorI * fResonanceDecayer
int GetResonancePdgCode(GHepRecord *evrec) const
A registry. Provides the container for algorithm configuration parameters.
Definition Registry.h:65
Contains minimal information for tagging exclusive processes.
Definition XclsTag.h:39
Resonance_t Resonance(void) const
Definition XclsTag.h:69
bool KnownResonance(void) const
Definition XclsTag.h:68
Basic constants.
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
@ kIStPreDecayResonantState
Definition GHepStatus.h:36
enum genie::EResonance Resonance_t
enum genie::EGHepStatus GHepStatus_t