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;
40 using namespace genie::constants;
41 using namespace genie::utils::math;
68 #ifdef __GENIE_PYTHIA6_ENABLED__
80 TVector3 unit_nu = nu->
P4()->Vect().Unit();
91 long double costhCM = n1;
92 long double sinthCM = sqrtl(1-costhCM*costhCM);
94 long double t =
born->
GetT(mlin,mlout,s,n1);
96 long double omx = powl(n2, 1.0/zeta );
97 long double s_r = s*( 1.-omx );
100 long double EnuinCM = (s_r-mlin*mlin)/sqrtl(s_r)/2.;
101 long double beta = (powl(Enuin,2)-powl(EnuinCM,2))/(powl(Enuin,2)+powl(EnuinCM,2));
109 long double ElpoutCM = (s_r+mlout*mlout)/sqrtl(s_r)/2.;
110 long double EnuoutCM = (s_r-mlout*mlout)/sqrtl(s_r)/2.;
112 LongLorentzVector p4_nuout( 0., -EnuoutCM*sinthCM, -EnuoutCM*costhCM, EnuoutCM );
117 TLorentzVector p4lp_o( (
double)p4_lpout.
Px(), (double)p4_lpout.
Py(), (double)p4_lpout.
Pz(), (double)p4_lpout.
E() );
118 TLorentzVector p4nu_o( (
double)p4_nuout.
Px(), (double)p4_nuout.
Py(), (double)p4_nuout.
Pz(), (double)p4_nuout.
E() );
122 double phi = 2*
kPi * rnd->RndLep().Rndm();
127 p4lp_o.RotateUz(unit_nu);
128 p4nu_o.RotateUz(unit_nu);
144 event->Summary()->KinePtr()->SetFSLeptonP4(p4lp_o);
149 char p6frame[10],p6nu[10],p6tgt[10];
150 strcpy(p6frame,
"CMS" );
151 strcpy(p6nu,
"nu_ebar" );
152 strcpy(p6tgt,
"e-" );
154 int def61 =
fPythia->GetMSTP(61);
155 int def71 =
fPythia->GetMSTP(71);
156 int def206 =
fPythia->GetMDME(206,1);
157 int def207 =
fPythia->GetMDME(207,1);
158 int def208 =
fPythia->GetMDME(208,1);
165 fPythia->Pyinit(p6frame, p6nu, p6tgt, sqrtl(s_r));
170 fPythia->SetMDME(206,1,def206);
171 fPythia->SetMDME(207,1,def207);
172 fPythia->SetMDME(208,1,def208);
176 TClonesArray * pythia_particles = (TClonesArray *)
fPythia->ImportParticles(
"All");
177 int np = pythia_particles->GetEntries();
180 TMCParticle * particle = 0;
181 TIter piter(pythia_particles);
182 while( (particle = (TMCParticle *) piter.Next()) ) {
184 int pdgc = particle->GetKF();
185 int ks = particle->GetKS();
187 if ( ks==21 ) {
continue; }
189 LongLorentzVector p4longo(particle->GetPx(), particle->GetPy(), particle->GetPz(), particle->GetEnergy());
192 TLorentzVector p4o( (
double)p4longo.Px(), (double)p4longo.Py(), (double)p4longo.Pz(), (double)p4longo.E() );
193 p4o.RotateUz(unit_nu);
196 if ( (ks==1 || ks==4) && p4o.E() < part->Mass() ) {
197 LOG(
"GLRESGenerator",
pWARN) <<
"Putting at rest one stable particle generated by PYTHIA because E < m";
198 LOG(
"GLRESGenerator",
pWARN) <<
"PDG = " << pdgc <<
" // State = " << ks;
199 LOG(
"GLRESGenerator",
pWARN) <<
"E = " << p4o.E() <<
" // |p| = " << TMath::Sqrt(p4o.P());
200 LOG(
"GLRESGenerator",
pWARN) <<
"p = [ " << p4o.Px() <<
" , " << p4o.Py() <<
" , " << p4o.Pz() <<
" ]";
201 LOG(
"GLRESGenerator",
pWARN) <<
"m = " << p4o.M() <<
" // mpdg = " << part->Mass();
202 p4o.SetXYZT(0,0,0,part->Mass());
209 int firstmother = -1;
214 if ( particle->GetParent() < 10 ) {
215 if ( TMath::Abs(pdgc)<7 ) {
217 firstchild = particle->GetFirstChild() - 6;
218 lastchild = particle->GetLastChild() - 6;
220 else if ( TMath::Abs(pdgc)==24 ) {
222 firstchild = particle->GetFirstChild() - 6;
223 lastchild = particle->GetLastChild() - 6;
225 else if ( pdgc==22 ) {
230 firstmother = particle->GetParent() - 6;
231 firstchild = (particle->GetFirstChild()==0) ? particle->GetFirstChild() - 1 : particle->GetFirstChild() - 6;
232 lastchild = (particle->GetLastChild()==0) ? particle->GetLastChild() - 1 : particle->GetLastChild() - 6;
235 double lightspeed = 299792458e3;
236 double vx = nu->
X4()->X() + particle->GetVx()*1e12;
237 double vy = nu->
X4()->Y() + particle->GetVy()*1e12;
238 double vz = nu->
X4()->Z() + particle->GetVz()*1e12;
239 double vt = nu->
X4()->T() + particle->GetTime()/lightspeed;
240 TLorentzVector pos( vx, vy, vz, vt );
242 event->AddParticle(pdgc, ist, firstmother, lastmother, firstchild, lastchild, p4o, pos );
247 pythia_particles->Clear(
"C");
253 <<
"Calling GENIE/PYTHIA6 without enabling PYTHIA6";
275 #ifdef __GENIE_PYTHIA6_ENABLED__
276 fPythia = TPythia6::Instance();
282 double wmin;
GetParam(
"Xsec-Wmin", wmin ) ;
283 int warnings;
GetParam(
"Warnings", warnings ) ;
284 int errors;
GetParam(
"Errors", errors ) ;
285 int qrk_mass;
GetParam(
"QuarkMass", qrk_mass ) ;
287 fPythia->SetMSTU(26, warnings);
289 fPythia->SetMSTJ(93, qrk_mass);
294 #endif // __GENIE_PYTHIA6_ENABLED__
bool IsNeutrino(int pdgc)
double GetT(double mlin, double mlout, double s, double costhCM)
static RandomGen * Instance()
Access instance.
const TLorentzVector * P4(void) const
#define __GENIE_PYTHIA6_ENABLED__
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
static constexpr double s
static const double kElectronMass
A singleton holding random number generator classes. All random number generation in GENIE should tak...
int FSPrimLeptonPdg(void) const
final state primary lepton pdg
Summary information for an interaction.
TPythia6 * fPythia
PYTHIA6 wrapper class.
#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)
bool IsAntiMuon(int pdgc)
double GetKV(KineVar_t kv) const
bool IsPositron(int pdgc)
double GetS(double mlin, double Enuin)
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
Born level nu-electron cross section.
static PDGLibrary * Instance(void)
void BoostZ(long double bz)
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
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.
bool IsElectron(int pdgc)
enum genie::EGHepStatus GHepStatus_t
Initial State information.