57#ifdef __GENIE_PYTHIA6_ENABLED__
63#ifdef __GENIE_PYTHIA6_ENABLED__
74 TVector3 unit_nu = nu->
P4()->Vect().Unit();
76 int probepdg = init_state.
ProbePdg();
82 long double s =
born->GetS(Mtarget,Enuin);
87 long double costhCM = n1;
88 long double sinthCM = sqrtl(1-costhCM*costhCM);
90 long double xmin =
fQ2PDFmin/2./Enuin/Mtarget;
91 long double x = expl( logl(xmin) + (logl(1.0)-logl(xmin))*n2 );
92 long double s_r = s*x;
95 long double EnuinCM = sqrtl(s_r)/2.;
96 long double beta = (powl(Enuin,2)-powl(EnuinCM,2))/(powl(Enuin,2)+powl(EnuinCM,2));
104 long double ElpoutCM = (s_r+mlout*mlout)/sqrtl(s_r)/2.;
105 long double EnuoutCM = (s_r-mlout*mlout)/sqrtl(s_r)/2.;
107 LongLorentzVector p4_nuout( 0., -EnuoutCM*sinthCM, -EnuoutCM*costhCM, EnuoutCM );
112 TLorentzVector p4lp_o( (
double)p4_lpout.
Px(), (
double)p4_lpout.
Py(), (
double)p4_lpout.
Pz(), (
double)p4_lpout.
E() );
113 TLorentzVector p4nu_o( (
double)p4_nuout.
Px(), (
double)p4_nuout.
Py(), (
double)p4_nuout.
Pz(), (
double)p4_nuout.
E() );
117 double phi = 2*
kPi * rnd->
RndLep().Rndm();
122 p4lp_o.RotateUz(unit_nu);
123 p4nu_o.RotateUz(unit_nu);
139 event->Summary()->KinePtr()->SetFSLeptonP4(p4lp_o);
145 strcpy(p6frame,
"CMS" );
147 char p6nu[10], p6tgt[10];
148 if (
pdg::IsNeutrino(probepdg)) { strcpy(p6nu,
"nu_e"); strcpy(p6tgt,
"e+"); }
149 else { strcpy(p6nu,
"nu_ebar"); strcpy(p6tgt,
"e-"); }
151 int def61 = fPythia->GetMSTP(61);
152 int def71 = fPythia->GetMSTP(71);
153 int def206 = fPythia->GetMDME(206,1);
154 int def207 = fPythia->GetMDME(207,1);
155 int def208 = fPythia->GetMDME(208,1);
156 fPythia->SetMSTP(61,0);
157 fPythia->SetMSTP(71,0);
158 fPythia->SetMDME(206,1,0);
159 fPythia->SetMDME(207,1,0);
160 fPythia->SetMDME(208,1,0);
162 fPythia->Pyinit(p6frame, p6nu, p6tgt, sqrtl(s_r));
165 fPythia->SetMSTP(61,def61);
166 fPythia->SetMSTP(71,def71);
167 fPythia->SetMDME(206,1,def206);
168 fPythia->SetMDME(207,1,def207);
169 fPythia->SetMDME(208,1,def208);
172 fPythia->GetPrimaries();
173 TClonesArray * pythia_particles = (TClonesArray *) fPythia->ImportParticles(
"All");
174 int np = pythia_particles->GetEntries();
177 TMCParticle * particle = 0;
178 TIter piter(pythia_particles);
179 while( (particle = (TMCParticle *) piter.Next()) ) {
181 int pdgc = particle->GetKF();
182 int ks = particle->GetKS();
184 if ( ks==21 ) {
continue; }
186 LongLorentzVector p4longo(particle->GetPx(), particle->GetPy(), particle->GetPz(), particle->GetEnergy());
189 TLorentzVector p4o( (
double)p4longo.
Px(), (
double)p4longo.
Py(), (
double)p4longo.
Pz(), (
double)p4longo.
E() );
190 p4o.RotateUz(unit_nu);
193 if ( (ks==1 || ks==4) && p4o.E() < part->Mass() ) {
194 LOG(
"PhotonRESGenerator",
pWARN) <<
"Putting at rest one stable particle generated by PYTHIA because E < m";
195 LOG(
"PhotonRESGenerator",
pWARN) <<
"PDG = " << pdgc <<
" // State = " << ks;
196 LOG(
"PhotonRESGenerator",
pWARN) <<
"E = " << p4o.E() <<
" // |p| = " << TMath::Sqrt(p4o.P());
197 LOG(
"PhotonRESGenerator",
pWARN) <<
"p = [ " << p4o.Px() <<
" , " << p4o.Py() <<
" , " << p4o.Pz() <<
" ]";
198 LOG(
"PhotonRESGenerator",
pWARN) <<
"m = " << p4o.M() <<
" // mpdg = " << part->Mass();
199 p4o.SetXYZT(0,0,0,part->Mass());
206 int firstmother = -1;
211 if ( particle->GetParent() < 10 ) {
212 if ( TMath::Abs(pdgc)<7 ) {
214 firstchild = particle->GetFirstChild() - 6;
215 lastchild = particle->GetLastChild() - 6;
217 else if ( TMath::Abs(pdgc)==24 ) {
219 firstchild = particle->GetFirstChild() - 6;
220 lastchild = particle->GetLastChild() - 6;
222 else if ( pdgc==22 ) {
227 firstmother = particle->GetParent() - 6;
228 firstchild = (particle->GetFirstChild()==0) ? particle->GetFirstChild() - 1 : particle->GetFirstChild() - 6;
229 lastchild = (particle->GetLastChild()==0) ? particle->GetLastChild() - 1 : particle->GetLastChild() - 6;
232 double lightspeed = 299792458e3;
233 double vx = nu->
X4()->X() + particle->GetVx()*1e12;
234 double vy = nu->
X4()->Y() + particle->GetVy()*1e12;
235 double vz = nu->
X4()->Z() + particle->GetVz()*1e12;
236 double vt = nu->
X4()->T() + particle->GetTime()/lightspeed;
237 TLorentzVector pos( vx, vy, vz, vt );
239 event->AddParticle(pdgc, ist, firstmother, lastmother, firstchild, lastchild, p4o, pos );
244 pythia_particles->Clear(
"C");
STDHEP-like event record entry that can fit a particle or a nucleus.
const TLorentzVector * P4(void) const
const TLorentzVector * X4(void) const