14 #include <TClonesArray.h> 31 #ifdef __GENIE_PYTHIA6_ENABLED__ 32 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6) 33 #include <TMCParticle.h> 35 #include <TMCParticle6.h> 37 #endif // __GENIE_PYTHIA6_ENABLED__ 39 using namespace genie;
68 #ifdef __GENIE_PYTHIA6_ENABLED__ 85 LongLorentzVector p4_Wlong( p4_nu.Px()+p4_el.Px(), p4_nu.Py()+p4_el.Py(), p4_nu.Pz()+p4_el.Pz(), p4_nu.E()+p4_el.E() );
87 long double Wmass = p4_Wlong.
M();
88 LOG(
"GLRESGenerator",
pINFO) <<
"Wmass : " << Wmass;
91 LOG(
"GLRESGenerator",
pWARN) <<
"Low invariant mass, W = " << Wmass <<
" GeV!!";
94 exception.
SetReason(
"Could not simulate the hadronic system");
109 long double y = interaction->
Kine().
y(
true);
114 long double El = y*Ev;
116 LOG(
"GLRESGenerator",
pINFO) <<
"Ev = " << Ev <<
", y = " << y <<
", -> El = " << El;
119 long double El2 = powl(El,2);
121 long double ml2 = powl(ml,2);
122 long double pl = sqrtl(El2-ml2);
125 long double costh = (El-0.5*(Q2+ml2)/Ev)/pl;
126 long double sinth = sqrtl( 1-powl(costh,2.) );
131 LOG(
"GLRESGenerator",
pINFO) <<
"Q2 = " << Q2 <<
", cos(theta) = " << costh <<
", phi = " << phi;
133 long double plx = pl*sinth*cosl(phi);
134 long double ply = pl*sinth*sinl(phi);
135 long double plz = pl*costh;
140 LongLorentzVector p4nulong( p4_Wlong.Px()-p4lplong.
Px(), p4_Wlong.Py()-p4lplong.
Py(), p4_Wlong.Pz()-p4lplong.
Pz(), p4_Wlong.E()-p4lplong.
E() );
142 TLorentzVector p4_W ( (
double)p4_Wlong.Px(), (double)p4_Wlong.Py(), (double)p4_Wlong.Pz(), (double)p4_Wlong.E() );
143 TLorentzVector p4_lpout( (
double)p4lplong.
Px(), (double)p4lplong.
Py(), (double)p4lplong.
Pz(), (double)p4lplong.
E() );
144 TLorentzVector p4_nuout( (
double)p4nulong.Px(), (double)p4nulong.Py(), (double)p4nulong.Pz(), (double)p4nulong.E() );
155 event->Summary()->KinePtr()->SetFSLeptonP4(p4_lpout);
160 char p6frame[10], p6nu[10], p6tgt[10];
161 strcpy(p6frame,
"CMS" );
162 strcpy(p6nu,
"nu_ebar");
163 strcpy(p6tgt,
"e-" );
166 int mstp61 =
fPythia->GetMSTP(61);
167 int mstp71 =
fPythia->GetMSTP(71);
168 int mdme206 =
fPythia->GetMDME(206,1);
169 int mdme207 =
fPythia->GetMDME(207,1);
170 int mdme208 =
fPythia->GetMDME(208,1);
171 double pmas1_W =
fPythia->GetPMAS(24,1);
172 double pmas2_W =
fPythia->GetPMAS(24,2);
173 double pmas2_t =
fPythia->GetPMAS(6,2);
183 fPythia->Pyinit(p6frame, p6nu, p6tgt, (
double)Wmass);
189 fPythia->SetMDME(206,1,mdme206);
190 fPythia->SetMDME(207,1,mdme207);
191 fPythia->SetMDME(208,1,mdme208);
192 fPythia->SetPMAS(24,1,pmas1_W);
193 fPythia->SetPMAS(24,2,pmas2_W);
202 TClonesArray * pythia_particles = (TClonesArray *)
fPythia->ImportParticles(
"All");
205 int np = pythia_particles->GetEntries();
207 TClonesArray * particle_list =
new TClonesArray(
"genie::GHepParticle", np);
208 particle_list->SetOwner(
true);
211 long double beta = p4_Wlong.P()/p4_Wlong.E();
214 TIter particle_iter(pythia_particles);
215 while( (p = (TMCParticle *) particle_iter.Next()) ) {
217 int pdgc = p->GetKF();
219 int parent = p->GetParent();
221 if ( ks==21 ) {
continue; }
225 p4long.Rotate(p4_Wlong);
227 TLorentzVector p4( (
double)p4long.Px(), (double)p4long.Py(), (double)p4long.Pz(), (double)p4long.E() );
230 if ( (ks==1 || ks==4) && p4.E() <
massPDG ) {
231 LOG(
"GLRESGenerator",
pWARN) <<
"Putting at rest one stable particle generated by PYTHIA because E < m";
232 LOG(
"GLRESGenerator",
pWARN) <<
"PDG = " << pdgc <<
" // State = " << ks;
233 LOG(
"GLRESGenerator",
pWARN) <<
"E = " << p4.E() <<
" // |p| = " << TMath::Sqrt(p4.P());
234 LOG(
"GLRESGenerator",
pWARN) <<
"p = [ " << p4.Px() <<
" , " << p4.Py() <<
" , " << p4.Pz() <<
" ]";
235 LOG(
"GLRESGenerator",
pWARN) <<
"m = " << p4.M() <<
" // mpdg = " <<
massPDG;
236 p4.SetXYZT(0,0,0,massPDG);
243 int firstmother = -1;
249 if ( TMath::Abs(pdgc)<7 ) {
251 firstchild = p->GetFirstChild() - 6;
252 lastchild = p->GetLastChild() - 6;
254 else if ( TMath::Abs(pdgc)==24 ) {
256 firstchild = p->GetFirstChild() - 6;
257 lastchild = p->GetLastChild() - 6;
259 else if ( pdgc==22 ) {
264 firstmother = parent - 6;
265 firstchild = (p->GetFirstChild()==0) ? p->GetFirstChild() - 1 : p->GetFirstChild() - 6;
266 lastchild = (p->GetLastChild()==0) ? p->GetLastChild() - 1 : p->GetLastChild() - 6;
269 double vx = nu->
X4()->X() + p->GetVx()*1e12;
270 double vy = nu->
X4()->Y() + p->GetVy()*1e12;
271 double vz = nu->
X4()->Z() + p->GetVz()*1e12;
273 TLorentzVector
pos( vx, vy, vz, vt );
275 event->AddParticle(pdgc, ist, firstmother, lastmother, firstchild, lastchild, p4, pos );
283 <<
"Calling GENIE/PYTHIA6 without enabling PYTHIA6";
304 #ifdef __GENIE_PYTHIA6_ENABLED__ 305 fPythia = TPythia6::Instance();
314 int warnings;
GetParam(
"Warnings", warnings ) ;
315 int errors;
GetParam(
"Errors", errors ) ;
316 int qrk_mass;
GetParam(
"QuarkMass", qrk_mass ) ;
317 fPythia->SetMSTU(26, warnings);
319 fPythia->SetMSTJ(93, qrk_mass);
321 #endif // __GENIE_PYTHIA6_ENABLED__
double beta(double KE, const simb::MCParticle *part)
THE MAIN GENIE PROJECT NAMESPACE
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
double Q2(const Interaction *const i)
#define __GENIE_PYTHIA6_ENABLED__
static RandomGen * Instance()
Access instance.
const TLorentzVector * P4(void) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
void Boost(long double bz)
static const double kElectronMass
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Simple mathematical utilities not found in ROOT's TMath.
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
double y(bool selected=false) const
Summary information for an interaction.
static constexpr double millimeter
An exception thrown by EventRecordVisitorI when the normal processing sequence has to be disrupted (f...
TPythia6 * fPythia
PYTHIA6 wrapper class.
static constexpr double second
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void Configure(const Registry &config)
const Kinematics & Kine(void) const
virtual void Configure(const Registry &config)
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
double massPDG(int PDGcode)
void SwitchOnFastForward(void)
static PDGLibrary * Instance(void)
void SetReason(string reason)
const TLorentzVector * X4(void) const
A registry. Provides the container for algorithm configuration parameters.
void ProcessEventRecord(GHepRecord *event) const
const InitialState & InitState(void) const
TParticlePDG * Find(int pdgc, bool must_exist=true)
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
void Rotate(LongLorentzVector axis)
double ProbeE(RefFrame_t rf) const
GENIE's GHEP MC event record.
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.
def parent(G, child, parent_type)
bool IsElectron(int pdgc)
cet::coded_exception< error, detail::translate > exception
Event finding and building.
enum genie::EGHepStatus GHepStatus_t
Initial State information.