14 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6)
15 #include <TMCParticle.h>
17 #include <TMCParticle6.h>
19 #include <TClonesArray.h>
36 using namespace genie;
37 using namespace genie::constants;
38 using namespace genie::utils::math;
78 TVector3 unit_nu = nu->
P4()->Vect().Unit();
88 long double costh = n1;
89 long double sinth = sqrtl(1-costh*costh);
91 long double mlout = 0;
95 long double mlout2 = mlout*mlout;
97 long double mL = mlout+
kMw;
98 long double Delta = sqrtl( powl(2.*Ev*Mtgt-mL*mL,2)-4.*powl(Mtgt*mL,2) );
99 long double s12_min = Ev/(2.*Ev+Mtgt)*(mL*mL+2.*Ev*Mtgt-Delta);
100 long double s12_max = Ev/(2.*Ev+Mtgt)*(mL*mL+2.*Ev*Mtgt+Delta);
101 long double s12 = expl( logl(s12_min)+(logl(s12_max)-logl(s12_min))*n2);
102 long double Q2_min = powl(s12,2)*Mtgt/(2.*Ev*(2.*Ev*Mtgt-s12));
103 long double Q2_max = s12 - mL*mL;
104 double Q2 = expl( logl(Q2_min) + (logl(Q2_max)-logl(Q2_min))*n3 );
105 double s_r = s12 -
Q2;
107 long double EW = (s_r+
kMw2-mlout2)/sqrtl(s_r)/2.;
108 long double El = (s_r-
kMw2+mlout2)/sqrtl(s_r)/2.;
109 long double p = sqrtl( EW*EW -
kMw2 );
112 long double bz = 4.*Ev*Mtgt*Q2/(Q2+s_r)/(2.*Ev*Mtgt-Q2) - (2.*Ev*Mtgt+
Q2)/(2.*Ev*Mtgt-Q2);
113 long double by = sqrtl(Mtgt*powl(Q2+s_r,2)/(2.*Ev*Q2*(s_r+Q2-2.*Ev*Mtgt))+1.);
118 TLorentzVector p4l_o(p4_lout.
Px(),p4_lout.
Py(),p4_lout.
Pz(),p4_lout.
E());
119 p4l_o.RotateX((
double)acosl(by)-
kPi/2.);
124 double phi = 2 *
kPi * rnd->
RndLep().Rndm();
129 p4l_o.RotateUz(unit_nu);
144 int def61 =
fPythia->GetMSTP(61);
145 int def71 =
fPythia->GetMSTP(71);
149 fPythia->Py1ent( -1, pdgboson, EW, acosl(costh),
kPi/2. );
156 TClonesArray * pythia_particles = (TClonesArray *)
fPythia->ImportParticles(
"All");
157 int np = pythia_particles->GetEntries();
160 TMCParticle * particle = 0;
161 TIter piter(pythia_particles);
162 while( (particle = (TMCParticle *) piter.Next()) ) {
164 int pdgc = particle->GetKF();
165 int ks = particle->GetKS();
167 LongLorentzVector p4longo(particle->GetPx(), particle->GetPy(), particle->GetPz(), particle->GetEnergy());
171 TLorentzVector p4o(p4longo.Px(),p4longo.Py(),p4longo.Pz(),p4longo.E());
172 p4o.RotateX((
double)acosl(by)-
kPi/2.);
174 p4o.RotateUz(unit_nu);
177 if ( (ks==1 || ks==4) && p4o.E() < part->Mass() ) {
178 LOG(
"PhotonCOHGenerator",
pWARN) <<
"Putting at rest one stable particle generated by PYTHIA because E < m";
179 LOG(
"PhotonCOHGenerator",
pWARN) <<
"PDG = " << pdgc <<
" // State = " << ks;
180 LOG(
"PhotonCOHGenerator",
pWARN) <<
"E = " << p4o.E() <<
" // |p| = " << TMath::Sqrt(p4o.P());
181 LOG(
"PhotonCOHGenerator",
pWARN) <<
"p = [ " << p4o.Px() <<
" , " << p4o.Py() <<
" , " << p4o.Pz() <<
" ]";
182 LOG(
"PhotonCOHGenerator",
pWARN) <<
"m = " << p4o.M() <<
" // mpdg = " << part->Mass();
183 p4o.SetXYZT(0,0,0,part->Mass());
190 int firstmother = -1;
195 if (particle->GetParent()==0) {
199 firstmother = particle->GetParent() + 3;
200 if (particle->GetFirstChild()!=0) firstchild = particle->GetFirstChild() + 3;
201 if (particle->GetLastChild() !=0) lastchild = particle->GetLastChild() + 3;
205 double lightspeed = 299792458e3;
206 double vx = nu->
X4()->X() + particle->GetVx()*1e12;
207 double vy = nu->
X4()->Y() + particle->GetVy()*1e12;
208 double vz = nu->
X4()->Z() + particle->GetVz()*1e12;
209 double vt = nu->
X4()->T() + particle->GetTime()/lightspeed;
210 TLorentzVector pos( vx, vy, vz, vt );
212 evrec->
AddParticle(pdgc, ist, firstmother, lastmother, firstchild, lastchild, p4o, pos );
217 pythia_particles->Clear(
"C");
237 double wmin;
GetParam(
"Xsec-Wmin", wmin ) ;
238 int warnings;
GetParam(
"Warnings", warnings ) ;
239 int errors;
GetParam(
"Errors", errors ) ;
240 int qrk_mass;
GetParam(
"QuarkMass", qrk_mass ) ;
242 fPythia->SetMSTU(26, warnings);
244 fPythia->SetMSTJ(93, qrk_mass);
bool IsNeutrino(int pdgc)
void BoostY(long double by)
TRandom3 & RndLep(void) const
rnd number generator used by final state primary lepton generators
double Q2(const Interaction *const i)
virtual Interaction * Summary(void) const
static RandomGen * Instance()
Access instance.
const TLorentzVector * P4(void) const
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the 'Visito...
bool IsAntiNuTau(int pdgc)
void Initialize(void) const
static const double kElectronMass
A singleton holding random number generator classes. All random number generation in GENIE should tak...
TPythia6 * fPythia
PYTHIA6 wrapper class.
virtual GHepParticle * Probe(void) const
static const double kTauMass
Summary information for an interaction.
#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)
static const double kNeutronMass
void ProcessEventRecord(GHepRecord *evrec) const
double GetKV(KineVar_t kv) const
bool IsAntiNuMu(int pdgc)
static const double kMuonMass
static PDGLibrary * Instance(void)
void BoostZ(long double bz)
const TLorentzVector * X4(void) const
A registry. Provides the container for algorithm configuration parameters.
virtual void AddParticle(const GHepParticle &p)
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
const Target & Tgt(void) 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.
static const double kProtonMass
enum genie::EGHepStatus GHepStatus_t
Initial State information.