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