32 double parent_mass=0.;
33 G4ParticleTable* pTable=G4ParticleTable::GetParticleTable();
36 parent_mass=pTable->FindParticle(parent_name)->GetPDGMass()/CLHEP::GeV;
38 double parent_energy = sqrt(nudata->
pdPx*nudata->
pdPx +
41 parent_mass*parent_mass);
42 double gamma = parent_energy / parent_mass;
43 double gamma_sqr = gamma*gamma;
44 double beta_mag = sqrt((gamma_sqr-1.)/gamma_sqr);
46 double enuzr = nudata->
Necm;
48 double rad = sqrt((xdet[0]-nudata->
Vx)*(xdet[0]-nudata->
Vx) +
49 (xdet[1]-nudata->
Vy)*(xdet[1]-nudata->
Vy) +
50 (xdet[2]-nudata->
Vz)*(xdet[2]-nudata->
Vz));
52 double parentp = sqrt((nudata->
pdPx*nudata->
pdPx)+
55 double costh_pardet = (nudata->
pdPx*(xdet[0]-nudata->
Vx) +
56 nudata->
pdPy*(xdet[1]-nudata->
Vy) +
57 nudata->
pdPz*(xdet[2]-nudata->
Vz))/(parentp*rad);
59 if (costh_pardet>1.) costh_pardet = 1.;
60 else if (costh_pardet<-1.) costh_pardet = -1.;
61 double theta_pardet = acos(costh_pardet);
63 double emrat = 1./(gamma*(1. - beta_mag * cos(theta_pardet)));
65 nu_energy = emrat*enuzr;
67 double sangdet = (
rdet*
rdet /(rad*rad)/ 4.);
69 nu_wght = sangdet * emrat * emrat;
79 beta[0]=nudata->
pdPx / parent_energy;
80 beta[1]=nudata->
pdPy / parent_energy;
81 beta[2]=nudata->
pdPz / parent_energy;
83 p_nu[0] = (xdet[0]- nudata->
Vx) * nu_energy / rad;
84 p_nu[1] = (xdet[1]- nudata->
Vy) * nu_energy / rad;
85 p_nu[2] = (xdet[2]- nudata->
Vz) * nu_energy / rad;
87 double partial = gamma*(beta[0]*p_nu[0]+
90 partial = nu_energy-partial / (gamma+1.);
92 for (
int i=0;
i<3;
i++) p_dcm_nu[
i]=p_nu[
i]-beta[
i]*gamma*partial;
94 for (
int i=0;
i<3;
i++) p_dcm_nu[3]+=p_dcm_nu[
i]*p_dcm_nu[
i];
95 p_dcm_nu[3]=sqrt(p_dcm_nu[3]);
98 gamma=nudata->
ppenergy / parent_mass;
102 partial = gamma*(beta[0]*nudata->
muparpx+
105 partial = nudata->
mupare - partial / (gamma+1.);
107 p_pcm_mp[0]=nudata->
muparpx-beta[0]*gamma*partial;
108 p_pcm_mp[1]=nudata->
muparpy-beta[1]*gamma*partial;
109 p_pcm_mp[2]=nudata->
muparpz-beta[2]*gamma*partial;
111 for (
int i=0;
i<3;
i++) p_pcm_mp[3]+=p_pcm_mp[
i]*p_pcm_mp[
i];
112 p_pcm_mp[3]=sqrt(p_pcm_mp[3]);
114 double wt_ratio = 1.;
117 if (p_pcm_mp[3] != 0. ) {
119 double costh = (p_dcm_nu[0]*p_pcm_mp[0]+
120 p_dcm_nu[1]*p_pcm_mp[1]+
121 p_dcm_nu[2]*p_pcm_mp[2])/(p_dcm_nu[3]*p_pcm_mp[3]);
123 if (costh>1.) costh = 1.;
124 else if (costh<-1.) costh = -1.;
132 double mumass = pTable->FindParticle(
"mu+")->GetPDGMass()/CLHEP::GeV;
133 double xnu = 2.* enuzr / mumass;
134 wt_ratio = ( (3.-2.*xnu) - (1.-2.*xnu)*costh ) / (3.-2.*xnu);
136 cout <<
"NuWeight:: Bad neutrino type"<<
endl;
LBNEParticleCode_t IntToEnum(G4int particleInt)
G4String AsString(LBNEParticleCode_t pCode)
QTextStream & endl(QTextStream &s)