57#ifdef __GENIE_PYTHIA6_ENABLED__
63#ifdef __GENIE_PYTHIA6_ENABLED__
74 TVector3 unit_nu = nu->
P4()->Vect().Unit();
80 long double s =
born->GetS(mlin,Enuin);
85 long double costhCM = n1;
86 long double sinthCM = sqrtl(1-costhCM*costhCM);
88 long double t =
born->GetT(mlin,mlout,s,n1);
90 long double omx = powl(n2, 1.0/zeta );
91 long double s_r = s*( 1.-omx );
94 long double EnuinCM = (s_r-mlin*mlin)/sqrtl(s_r)/2.;
95 long double beta = (powl(Enuin,2)-powl(EnuinCM,2))/(powl(Enuin,2)+powl(EnuinCM,2));
103 long double ElpoutCM = (s_r+mlout*mlout)/sqrtl(s_r)/2.;
104 long double EnuoutCM = (s_r-mlout*mlout)/sqrtl(s_r)/2.;
106 LongLorentzVector p4_nuout( 0., -EnuoutCM*sinthCM, -EnuoutCM*costhCM, EnuoutCM );
111 TLorentzVector p4lp_o( (
double)p4_lpout.
Px(), (
double)p4_lpout.
Py(), (
double)p4_lpout.
Pz(), (
double)p4_lpout.
E() );
112 TLorentzVector p4nu_o( (
double)p4_nuout.
Px(), (
double)p4_nuout.
Py(), (
double)p4_nuout.
Pz(), (
double)p4_nuout.
E() );
116 double phi = 2*
kPi * rnd->
RndLep().Rndm();
121 p4lp_o.RotateUz(unit_nu);
122 p4nu_o.RotateUz(unit_nu);
138 event->Summary()->KinePtr()->SetFSLeptonP4(p4lp_o);
143 char p6frame[10],p6nu[10],p6tgt[10];
144 strcpy(p6frame,
"CMS" );
145 strcpy(p6nu,
"nu_ebar" );
146 strcpy(p6tgt,
"e-" );
148 int def61 = fPythia->GetMSTP(61);
149 int def71 = fPythia->GetMSTP(71);
150 int def206 = fPythia->GetMDME(206,1);
151 int def207 = fPythia->GetMDME(207,1);
152 int def208 = fPythia->GetMDME(208,1);
153 fPythia->SetMSTP(61,0);
154 fPythia->SetMSTP(71,0);
155 fPythia->SetMDME(206,1,0);
156 fPythia->SetMDME(207,1,0);
157 fPythia->SetMDME(208,1,0);
159 fPythia->Pyinit(p6frame, p6nu, p6tgt, sqrtl(s_r));
162 fPythia->SetMSTP(61,def61);
163 fPythia->SetMSTP(71,def71);
164 fPythia->SetMDME(206,1,def206);
165 fPythia->SetMDME(207,1,def207);
166 fPythia->SetMDME(208,1,def208);
169 fPythia->GetPrimaries();
170 TClonesArray * pythia_particles = (TClonesArray *) fPythia->ImportParticles(
"All");
171 int np = pythia_particles->GetEntries();
174 TMCParticle * particle = 0;
175 TIter piter(pythia_particles);
176 while( (particle = (TMCParticle *) piter.Next()) ) {
178 int pdgc = particle->GetKF();
179 int ks = particle->GetKS();
181 if ( ks==21 ) {
continue; }
183 LongLorentzVector p4longo(particle->GetPx(), particle->GetPy(), particle->GetPz(), particle->GetEnergy());
186 TLorentzVector p4o( (
double)p4longo.
Px(), (
double)p4longo.
Py(), (
double)p4longo.
Pz(), (
double)p4longo.
E() );
187 p4o.RotateUz(unit_nu);
190 if ( (ks==1 || ks==4) && p4o.E()<massPDG ) {
191 LOG(
"GLRESGenerator",
pWARN) <<
"Putting at rest one stable particle generated by PYTHIA because E < m";
192 LOG(
"GLRESGenerator",
pWARN) <<
"PDG = " << pdgc <<
" // State = " << ks;
193 LOG(
"GLRESGenerator",
pWARN) <<
"E = " << p4o.E() <<
" // |p| = " << TMath::Sqrt(p4o.P());
194 LOG(
"GLRESGenerator",
pWARN) <<
"p = [ " << p4o.Px() <<
" , " << p4o.Py() <<
" , " << p4o.Pz() <<
" ]";
195 LOG(
"GLRESGenerator",
pWARN) <<
"m = " << p4o.M() <<
" // mpdg = " << massPDG;
196 p4o.SetXYZT(0,0,0,massPDG);
203 int firstmother = -1;
208 if ( particle->GetParent() < 10 ) {
209 if ( TMath::Abs(pdgc)<7 ) {
211 firstchild = particle->GetFirstChild() - 6;
212 lastchild = particle->GetLastChild() - 6;
214 else if ( TMath::Abs(pdgc)==24 ) {
216 firstchild = particle->GetFirstChild() - 6;
217 lastchild = particle->GetLastChild() - 6;
219 else if ( pdgc==22 ) {
224 firstmother = particle->GetParent() - 6;
225 firstchild = (particle->GetFirstChild()==0) ? particle->GetFirstChild() - 1 : particle->GetFirstChild() - 6;
226 lastchild = (particle->GetLastChild()==0) ? particle->GetLastChild() - 1 : particle->GetLastChild() - 6;
229 double vx = nu->
X4()->X() + particle->GetVx()*1e12;
230 double vy = nu->
X4()->Y() + particle->GetVy()*1e12;
231 double vz = nu->
X4()->Z() + particle->GetVz()*1e12;
233 TLorentzVector pos( vx, vy, vz, vt );
235 event->AddParticle(pdgc, ist, firstmother, lastmother, firstchild, lastchild, p4o, pos );
240 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