GLRESGenerator.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  @ Dec 14, 2009 - CA
14  Was first added in v2.5.1
15  @ Apr 24, 2010 - CA
16  Add code to decay the off-the-mass-shell W- using PYTHIA6.
17  First complete version of the GLRES event thread.
18 */
19 //____________________________________________________________________________
20 
21 #include <cstring>
22 
23 #include <RVersion.h>
24 #include <TClonesArray.h>
25 #include <TMath.h>
26 
37 
38 using namespace genie;
39 using namespace genie::constants;
40 
41 //___________________________________________________________________________
43 EventRecordVisitorI("genie::GLRESGenerator")
44 {
45 
46 }
47 //___________________________________________________________________________
49 EventRecordVisitorI("genie::GLRESGenerator", config)
50 {
51 
52 }
53 //___________________________________________________________________________
55 {
56 
57 }
58 //___________________________________________________________________________
60 {
61  GHepParticle * nu = event -> Probe();
62  GHepParticle * el = event -> HitElectron();
63  assert(nu);
64  assert(el);
65 
66  // Pick electron velocity
67  //
68  //... neglect for now
69 
70  //
71  // Add remnant nucleus
72  //
73  GHepParticle * target = event -> TargetNucleus();
74  if(target) {
75  int pdgc = target->Pdg();
76  TLorentzVector p4 ( * target->P4() );
77  TLorentzVector x4 ( * target->X4() );
78  event->AddParticle(pdgc, kIStStableFinalState, 1,-1,-1,-1, p4, x4);
79  }
80 
81  //
82  // Add resonance
83  //
84 
85  TLorentzVector p4_nu (* nu->P4());
86  TLorentzVector p4_el (* el->P4());
87 
88  TLorentzVector x4(* el->X4());
89 
90  TLorentzVector p4_W = p4_nu + p4_el;
91 
92  event->AddParticle(kPdgWM, kIStDecayedState, 0,-1,-1,-1, p4_W, x4);
93 
94  //
95  // Decay resonance and add decay products
96  //
97 
98  double mass = p4_W.M();
99  char p6frame[10], p6nu[10], p6tgt[10];
100  strcpy(p6frame, "CMS" );
101  strcpy(p6nu, "nu_ebar");
102  strcpy(p6tgt, "e-" );
103  fPythia->Pyinit(p6frame, p6nu, p6tgt, mass);
104  fPythia->Pyevnt();
105  fPythia->Pylist(1);
106 
107  // get LUJETS record
108  fPythia->GetPrimaries();
109  TClonesArray * pythia_particles =
110  (TClonesArray *) fPythia->ImportParticles("All");
111 
112  // copy PYTHIA container to a new TClonesArray so as to transfer ownership
113  // of the container and of its elements to the calling method
114  int np = pythia_particles->GetEntries();
115  assert(np>0);
116  TClonesArray * particle_list = new TClonesArray("genie::GHepParticle", np);
117  particle_list->SetOwner(true);
118 
119  // Vector defining rotation from LAB to LAB' (z:= \vec{resonance momentum})
120  TVector3 unitvq = p4_W.Vect().Unit();
121 
122  // Boost velocity LAB' -> Resonance rest frame
123  TVector3 beta(0,0,p4_W.P()/p4_W.Energy());
124 
125  GHepParticle * p = 0;
126  TIter piter(pythia_particles);
127  while( (p = (GHepParticle *) piter.Next()) ) {
128  int pdgc = p->Pdg();
129  int ist = p->Status();
130  if(ist == 1) {
131  TLorentzVector p4o(p->Px(), p->Py(), p->Pz(), p->Energy());
132  p4o.Boost(beta);
133  TVector3 p3 = p4o.Vect();
134  p3.RotateUz(unitvq);
135  TLorentzVector p4(p3,p4o.Energy());
136  event->AddParticle(pdgc, kIStStableFinalState, 4,-1,-1,-1, p4, x4);
137  }
138  }
139 
140 }
141 //___________________________________________________________________________
143 {
144  Algorithm::Configure(config);
145  this->LoadConfig();
146 }
147 //____________________________________________________________________________
149 {
150  Algorithm::Configure(config);
151  this->LoadConfig();
152 }
153 //____________________________________________________________________________
155 {
156  fPythia = TPythia6::Instance();
157 
158  // sync GENIE/PYTHIA6 seed number
160 }
161 //____________________________________________________________________________
162 
Basic constants.
const XML_Char * target
Definition: expat.h:268
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
const TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
const char * p
Definition: xmltok.h:285
const int kPdgWM
Definition: PDGCodes.h:169
Definition: config.py:1
Double_t beta
int Pdg(void) const
Definition: GHepParticle.h:64
TPythia6 * fPythia
PYTHIA6 wrapper class.
void Configure(const Registry &config)
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
const TLorentzVector * X4(void) const
Definition: GHepParticle.h:80
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
void ProcessEventRecord(GHepRecord *event) const
assert(nhit_max >=nhit_nbins)
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