25 kHadronTensorGridFlag_COUNT = 2
30 double real_sqrt(
double x) {
31 if (x < 0.)
return 0.;
32 else return std::sqrt(x);
37 const std::string& table_file_name)
38 : fGrid(&fq0Points, &fqmagPoints, &fEntries)
41 std::ifstream in_file( table_file_name.c_str() );
46 std::getline(in_file, dummy);
49 std::string type_name;
50 int Z,
A, num_q0, num_q_mag;
53 in_file >> Z >> A >> type_name >> num_q0 >> num_q_mag;
60 in_file >> q_mag_flag;
65 std::cout<<
"TabulatedLabFrameHadronTensor: reading hadron tensor table" << std::endl;
66 std::cout<<
"table_file_name: " << table_file_name << std::endl;
67 std::cout<<
"Z: " << Z << std::endl;
68 std::cout<<
"A: " << A << std::endl;
69 std::cout<<
"num_q0: " << num_q0 << std::endl;
70 std::cout<<
"num_q_mag: " << num_q_mag << std::endl;
72 double W00, ReW0z, Wxx, ImWxy, Wzz;
75 for (
long j = 0; j < num_q0; ++j) {
76 for (
long k = 0; k < num_q_mag; ++k) {
84 in_file >> W00 >> ReW0z >> Wxx >> ImWxy >> Wzz;
107 double q0,
double q_mag)
const
109 TableEntry entry = fGrid.interpolate(q0, q_mag);
110 return std::complex<double>(entry.
W00, 0.);
114 double q0,
double q_mag)
const
116 TableEntry entry = fGrid.interpolate(q0, q_mag);
120 return std::complex<double>(entry.
ReW0z, 0.);
124 double q0,
double q_mag)
const
126 TableEntry entry = fGrid.interpolate(q0, q_mag);
127 return std::complex<double>(entry.
Wxx, 0.);
131 double q0,
double q_mag)
const
133 TableEntry entry = fGrid.interpolate(q0, q_mag);
135 return std::complex<double>(0., entry.
ImWxy);
139 double q0,
double q_mag)
const
141 TableEntry entry = fGrid.interpolate(q0, q_mag);
143 return std::complex<double>(entry.
Wzz, 0.);
147 double q_mag,
double Mi)
const
149 TableEntry entry = fGrid.interpolate(q0, q_mag);
150 return W1(q0, q_mag, entry) / Mi;
154 double q_mag,
double Mi)
const
156 TableEntry entry = fGrid.interpolate(q0, q_mag);
157 return W2(q0, q_mag, entry) / Mi;
161 double q_mag,
double )
const
163 TableEntry entry = fGrid.interpolate(q0, q_mag);
164 return W3(q0, q_mag, entry);
168 double q_mag,
double Mi)
const
170 TableEntry entry = fGrid.interpolate(q0, q_mag);
171 return W4(q0, q_mag, entry) * Mi;
175 double q_mag,
double )
const
177 TableEntry entry = fGrid.interpolate(q0, q_mag);
178 return W5(q0, q_mag, entry);
182 double ,
double )
const
188 int flag, std::ifstream& in_file, std::vector<double>& vec_to_fill)
192 if (flag >= kHadronTensorGridFlag_COUNT) {
193 LOG(
"TabulatedLabFrameHadronTensor",
pERROR)
194 <<
"Invalid hadron tensor grid flag value \"" << flag
195 <<
"\" encountered.";
198 else if (flag == kStartAndStep) {
199 double start_val, step;
200 in_file >> start_val >> step;
201 for (
int k = 0; k < num_points; ++k)
202 vec_to_fill.push_back( start_val + (k * step) );
204 else if (flag == kExplicitValues) {
206 for (
int k = 0; k < num_points; ++k) {
208 vec_to_fill.push_back( val );
217 return entry.
Wxx / 2.;
223 double temp_1 = ( std::pow(q0, 2) / std::pow(q_mag, 2) )
224 * (entry.
Wzz - entry.
Wxx);
225 double temp_2 = 2. * q0 * entry.
ReW0z / q_mag;
226 return ( entry.
W00 + entry.
Wxx + temp_1 - temp_2 ) / 2.;
232 return ( entry.
ImWxy / q_mag );
238 return ( entry.
Wzz - entry.
Wxx ) / ( 2. * std::pow(q_mag, 2) );
244 return ( entry.
ReW0z - q0 * (entry.
Wzz - entry.
Wxx) / q_mag ) / q_mag;
257 const Interaction* interaction,
double Q_value)
const
260 if ( !interaction )
return 0.;
269 return dSigma_dT_dCosTheta(probe_pdg, E_probe, m_probe, Tl, cos_l, ml,
274 double E_probe,
double m_probe,
double Tl,
double cos_l,
double ml,
275 double Q_value)
const
286 double q0 = E_probe - El;
290 double q0_corrected = q0 - Q_value;
293 double k_initial = real_sqrt( std::pow(E_probe, 2) - std::pow(m_probe, 2) );
296 double k_final = real_sqrt( std::pow(Tl, 2) + 2*ml*Tl );
299 double q_mag2 = std::pow(k_initial, 2) + std::pow(k_final, 2)
300 - 2.*k_initial*k_final*cos_l;
301 double q_mag = real_sqrt( q_mag2 );
305 TableEntry entry = fGrid.interpolate(q0_corrected, q_mag);
309 double s2_half = (1. - cos_l) / 2.;
310 double c2_half = 1. - s2_half;
314 int abs_probe_pdg = std::abs(probe_pdg);
320 double q2 = std::pow(q0, 2) - q_mag2;
322 double mott = std::pow(
326 double l_part = std::pow(q2 / q_mag2, 2) * entry.
W00;
329 double t_part = ( (2. * s2_half / c2_half) - (q2 / q_mag2) ) * entry.
Wxx;
338 double w1 = this->W1(q0, q_mag, entry);
339 double w2 = this->W2(q0, q_mag, entry);
340 double w4 = this->W4(q0, q_mag, entry);
341 double w5 = this->W5(q0, q_mag, entry);
344 double w3 = this->W3(q0, q_mag, entry);
345 if (probe_pdg < 0) w3 *= -1;
347 double part_1 = (2. * w1 * s2_half) + (w2 * c2_half)
348 - (w3 * (E_probe + El) * s2_half);
350 double part_2 = (w1 * cos_l) - (w2/2. * cos_l)
351 + (w3/2. * (El + k_final - (E_probe + El)*cos_l))
352 + (w4/2. * (std::pow(ml, 2)*cos_l + 2*El*(El + k_final)*s2_half))
353 - (w5/2. * (El + k_final));
355 double all_terms = part_1 + std::pow(ml, 2)
356 * part_2 / (El * (El + k_final));
366 const Interaction* interaction,
double Q_value)
const
369 if ( !interaction )
return 0.;
378 return dSigma_dT_dCosTheta_rosenbluth(probe_pdg, E_probe, m_probe, Tl, cos_l, ml,
383 double E_probe,
double m_probe,
double Tl,
double cos_l,
double ml,
384 double Q_value)
const
395 double q0 = E_probe - El;
399 double q0_corrected = q0 - Q_value;
402 double k_initial = real_sqrt( std::pow(E_probe, 2) - std::pow(m_probe, 2) );
405 double k_final = real_sqrt( std::pow(Tl, 2) + 2*ml*Tl );
408 double q_mag2 = std::pow(k_initial, 2) + std::pow(k_final, 2)
409 - 2.*k_initial*k_final*cos_l;
410 double q_mag = real_sqrt( q_mag2 );
414 TableEntry entry = fGrid.interpolate(q0_corrected, q_mag);
418 double s2_half = (1. - cos_l) / 2.;
419 double c2_half = 1. - s2_half;
423 int abs_probe_pdg = std::abs(probe_pdg);
426 double q2 = std::pow(q0, 2) - q_mag2;
440 double l_part = std::pow(q2 / q_mag2, 2) * entry.
W00 * c2_half;
443 double t_part = ( 2.*s2_half - (q2*c2_half / q_mag2) ) * entry.
Wxx;
458 double v0=4.*El*E_probe+q2;
463 double Vud = temp_reg->
GetDouble(
"CKM-Vud" );
465 double Vud2 = std::pow(Vud, 2);
470 double xdelta=ml/sqrt(-q2);
471 double xrho=-q2/q_mag2;
472 double xrhop=q_mag/(El+E_probe);
473 double tan2th2=-q2/v0;
476 double VCC=1-std::pow(xdelta, 2)*tan2th2;
477 double VCL=q0/q_mag+tan2th2*std::pow(xdelta, 2)/xrhop;
478 double VLL=std::pow(q0, 2)/q_mag2+std::pow(xdelta, 2)*tan2th2*(1.+2.*q0/q_mag/xrhop+xrho*std::pow(xdelta, 2));
479 double VT=xrho/2.+tan2th2-tan2th2*std::pow(xdelta, 2)/xrhop*(q0/q_mag+std::pow(xdelta, 2)*xrho*xrhop/2.);
480 double VTP=tan2th2/xrhop*(1-q0/q_mag*xrhop*std::pow(xdelta, 2));
484 double RCC=entry.
W00;
485 double RCL=-entry.
ReW0z;
486 double RLL=entry.
Wzz;
487 double RT=2.*entry.
Wxx;
488 double RTP=-entry.
ImWxy;
489 if (probe_pdg < 0) RTP *= -1;
495 xsec= sig0*(VCC*RCC+2.*VCL*RCL+VLL*RLL+VT*RT+2.*VTP*RTP);
std::vector< TableEntry > fEntries
virtual std::complex< double > tz(double q0, double q_mag) const
The tensor element .
virtual std::complex< double > tt(double q0, double q_mag) const
The tensor element .
TParticlePDG * Probe(void) const
RgDbl GetDouble(RgKey key) const
virtual ~TabulatedLabFrameHadronTensor()
std::vector< double > fqmagPoints
Registry * CommonList(const string &file_id, const string &set_name) const
Summary information for an interaction.
virtual std::complex< double > zz(double q0, double q_mag) const
The tensor element .
virtual double dSigma_dT_dCosTheta(const Interaction *interaction, double Q_value) const
virtual double W2(double q0, double q_mag, double Mi) const
virtual double W4(double q0, double q_mag, double Mi) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
virtual double W1(double q0, double q_mag, double Mi) const
The structure function .
int A() const
Mass number of the target nucleus.
const Kinematics & Kine(void) const
double GetKV(KineVar_t kv) const
void read1DGridValues(int num_points, int flag, std::ifstream &in_file, std::vector< double > &vec_to_fill)
virtual double W6(double q0, double q_mag, double Mi) const
std::vector< double > fq0Points
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
virtual std::complex< double > xx(double q0, double q_mag) const
The tensor element .
void set_pdg(int pdg)
Set the target nucleus PDG code.
virtual double W5(double q0, double q_mag, double Mi) const
virtual double dSigma_dT_dCosTheta_rosenbluth(const Interaction *interaction, double Q_value) const
virtual std::complex< double > xy(double q0, double q_mag) const
The tensor element .
A registry. Provides the container for algorithm configuration parameters.
int IonPdgCode(int A, int Z)
int Z() const
Atomic number of the target nucleus.
const InitialState & InitState(void) const
double ProbeE(RefFrame_t rf) const
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
TabulatedLabFrameHadronTensor(const std::string &table_file_name)
static AlgConfigPool * Instance()
virtual double W3(double q0, double q_mag, double Mi) const