27 #ifdef __GENIE_APFEL_ENABLED__ 28 #include "APFEL/APFEL.h" 30 #include "LHAPDF/LHAPDF.h" 31 #ifdef __GENIE_LHAPDF6_ENABLED__ 35 using namespace genie;
52 if (basedir==
"") basedir=
string(gSystem->Getenv(
"GENIE")) +
"/data/evgen/hedis-sf";
53 LOG(
"HEDISStrucFunc",
pERROR) <<
"Base diretory: " << basedir;
55 if ( gSystem->AccessPathName( basedir.c_str(), kWritePermission ) ) {
56 LOG(
"HEDISStrucFunc",
pERROR) <<
"Base diretory doesnt exist or you dont have write permission.";
64 LOG(
"HEDISStrucFunc",
pINFO) <<
"SF are (or will be) in following directory: " << SFname;
65 if ( gSystem->mkdir(SFname.c_str())==0 ) {
66 LOG(
"HEDISStrucFunc",
pWARN) <<
"Bad news! Directory doesnt exists.";
67 LOG(
"HEDISStrucFunc",
pWARN) <<
"HEDIS package requires computation of SF";
68 LOG(
"HEDISStrucFunc",
pWARN) <<
"This will be SLOW!!!!!";
69 LOG(
"HEDISStrucFunc",
pINFO) <<
"Creating Metafile with input information";
70 std::ofstream meta_stream((SFname+
"/Inputs.txt").c_str());
75 LOG(
"HEDISStrucFunc",
pWARN) <<
"Good news! Directory already exists.";
76 LOG(
"HEDISStrucFunc",
pWARN) <<
"Precomputed SF stored in that directory will be used";
77 LOG(
"HEDISStrucFunc",
pINFO) <<
"Comparing info from Metafile and selected Tune (CommonParam.xml)";
79 std::ifstream meta_stream((SFname+
"/Inputs.txt").c_str(), std::ios::in);
83 LOG(
"HEDISStrucFunc",
pINFO) <<
"Info from MetaFile and Tune match";
86 LOG(
"HEDISStrucFunc",
pERROR) <<
"Info from MetaFile and Tune doesnt match";
87 LOG(
"HEDISStrucFunc",
pERROR) <<
"MetaFile Path : " << SFname <<
"/Inputs.txt";
88 LOG(
"HEDISStrucFunc",
pERROR) <<
"From Tune : ";
90 LOG(
"HEDISStrucFunc",
pERROR) <<
"From MetaFile : ";
96 fSF.Sin2ThW = fSF.Rho==0. ? fSF.Sin2ThW : 1.-fSF.MassW*fSF.MassW/fSF.MassZ/fSF.MassZ/(1+fSF.Rho);
97 LOG(
"HEDISStrucFunc",
pINFO) <<
"Weingber angle computation:";
98 LOG(
"HEDISStrucFunc",
pINFO) <<
"Rho = " << fSF.Rho;
99 LOG(
"HEDISStrucFunc",
pINFO) <<
"Sin2ThW = " << fSF.Sin2ThW;
102 #ifdef __GENIE_LHAPDF6_ENABLED__ 103 LOG(
"HEDISStrucFunc",
pINFO) <<
"Initialising LHAPDF6...";
104 pdf = LHAPDF::mkPDF(fSF.LHAPDFset, fSF.LHAPDFmember);
108 LOG(
"HEDISStrucFunc",
pINFO) <<
"PDF info:";
109 LOG(
"HEDISStrucFunc",
pINFO) <<
"OrderQCD = " << pdf->orderQCD();
110 LOG(
"HEDISStrucFunc",
pINFO) <<
"FlavorScheme = " << pdf->info().get_entry(
"FlavorScheme");
111 LOG(
"HEDISStrucFunc",
pINFO) <<
"NumFlavors = " << pdf->info().get_entry(
"NumFlavors");
113 LOG(
"HEDISStrucFunc",
pINFO) <<
"MZ = " << pdf->info().get_entry(
"MZ");
114 for (
int i=1; i<7; i++) {
115 mPDFQrk[i] = pdf->quarkMass(i);
116 LOG(
"HEDISStrucFunc",
pINFO) <<
"M" << i <<
" = " << mPDFQrk[i];
119 #ifdef __GENIE_LHAPDF5_ENABLED__ 120 LOG(
"HEDISStrucFunc",
pINFO) <<
"Initialising LHAPDF5...";
121 LHAPDF::initPDFByName(fSF.LHAPDFset, LHAPDF::LHGRID, fSF.LHAPDFmember);
124 Q2PDFmax = LHAPDF::getQ2max(0);
125 LOG(
"HEDISStrucFunc",
pINFO) <<
"PDF info:";
127 for (
int i=1; i<7; i++) {
128 mPDFQrk[i] = LHAPDF::getQMass(i);
129 LOG(
"HEDISStrucFunc",
pINFO) <<
"M" << i <<
" = " << mPDFQrk[i];
134 if ( fSF.XGridMin <
xPDFmin ) {
135 LOG(
"HEDISStrucFunc",
pWARN) <<
"Lower boundary in X is smaller than input PDF";
137 LOG(
"HEDISStrucFunc",
pWARN) <<
"xGridMin = " << fSF.XGridMin;
138 LOG(
"HEDISStrucFunc",
pWARN) <<
"DANGER: An extrapolation will be done!!!!!";
140 else if ( fSF.Q2GridMin <
Q2PDFmin ) {
141 LOG(
"HEDISStrucFunc",
pWARN) <<
"Lower boundary in Q2 is smaller than input PDF";
143 LOG(
"HEDISStrucFunc",
pWARN) <<
"Q2GridMin = " << fSF.Q2GridMin;
144 LOG(
"HEDISStrucFunc",
pWARN) <<
"DANGER: An extrapolation will be done!!!!!";
146 else if ( fSF.Q2GridMax > Q2PDFmax ) {
147 LOG(
"HEDISStrucFunc",
pWARN) <<
"Upper boundary in Q2 is bigger than input PDF";
149 LOG(
"HEDISStrucFunc",
pWARN) <<
"Q2GridMax = " << fSF.Q2GridMax;
150 LOG(
"HEDISStrucFunc",
pWARN) <<
"DANGER: An extrapolation will be done!!!!!";
154 double dlogq2 = TMath::Abs( TMath::Log10(fSF.Q2GridMin)-TMath::Log10(fSF.Q2GridMax) ) / fSF.NGridQ2;
155 double dlogx = TMath::Abs( TMath::Log10(fSF.XGridMin)-TMath::Log10(1.) ) / fSF.NGridX;
156 LOG(
"HEDISStrucFunc",
pINFO) <<
"Grid x,Q2 :" << fSF.NGridX <<
" , " << fSF.NGridQ2;
157 for (
double logq2 = TMath::Log10(fSF.Q2GridMin); logq2<TMath::Log10(fSF.Q2GridMax); logq2+= dlogq2 ) {
158 double q2 = TMath::Power( 10, logq2 + 0.5*dlogq2 );
159 if (q2>fSF.Q2GridMax)
continue;
160 sf_q2_array.push_back(q2);
161 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"q2: " << sf_q2_array.back();
163 for (
double logx = TMath::Log10(fSF.XGridMin); logx<TMath::Log10(1.); logx+= dlogx ) {
164 double x = TMath::Power( 10, logx + 0.5*dlogx );
165 if ( x>1. )
continue;
166 sf_x_array.push_back(x);
167 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"x: " << sf_x_array.back();
171 int nx = sf_q2_array.size();
172 int ny = sf_x_array.size();
176 for (
int i=0; i<nx; i++) x[i] = sf_q2_array[i];
177 for (
int j=0; j<ny; j++) y[j] = sf_x_array[j];
179 vector<InteractionType_t> inttype;
182 vector<InitialState> init_state;
192 string sfFile = SFname +
"/QrkSF_LO_" + QrkSFName(*in) +
".dat";
194 LOG(
"HEDISStrucFunc",
pINFO) <<
"Checking if file " << sfFile <<
" exists...";
195 if ( gSystem->AccessPathName( sfFile.c_str()) ) {
196 LOG(
"HEDISStrucFunc",
pWARN) <<
"File doesnt exist. SF table will be computed.";
197 CreateQrkSF( *in, sfFile );
199 else if ( atoi(gSystem->GetFromPipe((
"wc -w "+sfFile+
" | awk '{print $1}'").c_str()))!=kSFT3*nx*ny ) {
200 LOG(
"HEDISStrucFunc",
pWARN) <<
"File does not contain all the need points. SF table will be recomputed.";
201 gSystem->Exec((
"rm "+sfFile).c_str());
202 CreateQrkSF( *in, sfFile );
204 std::ifstream sf_stream(sfFile.c_str(), std::ios::in);
206 for(
int sf = 1; sf < kSFnumber; ++sf) {
208 for (
int ij=0; ij<nx*ny; ij++ ) sf_stream >> z[ij];
215 #ifdef __GENIE_APFEL_ENABLED__ 217 LOG(
"HEDISStrucFunc",
pINFO) <<
"Initialising APFEL..." ;
218 APFEL::SetPDFSet(fSF.LHAPDFset);
219 APFEL::SetReplica(fSF.LHAPDFmember);
220 if (fSF.Scheme==
"BGR") {
221 APFEL::SetMassScheme(
"FONLL-B");
222 APFEL::SetPoleMasses(mPDFQrk[4],mPDFQrk[5],mPDFQrk[6]);
224 else if (fSF.Scheme==
"CSMS") {
225 APFEL::SetMassScheme(
"ZM-VFNS");
226 APFEL::SetPoleMasses(mPDFQrk[4],mPDFQrk[5],mPDFQrk[5]+0.1);
229 LOG(
"HEDISStrucFunc",
pERROR) <<
"Mass Scheme is not set properly";
232 APFEL::SetQLimits(TMath::Sqrt(fSF.Q2GridMin),TMath::Sqrt(fSF.Q2GridMax));
233 APFEL::SetMaxFlavourPDFs(6);
234 APFEL::SetMaxFlavourAlpha(6);
235 APFEL::SetNumberOfGrids(3);
236 APFEL::SetGridParameters(1,90,3,fSF.XGridMin);
237 APFEL::SetGridParameters(2,50,5,1
e-1);
238 APFEL::SetGridParameters(3,40,5,8
e-1);
239 APFEL::SetPerturbativeOrder(1);
240 APFEL::SetAlphaQCDRef(pdf->alphasQ(fSF.MassZ),fSF.MassZ);
242 APFEL::SetWMass(fSF.MassW);
243 APFEL::SetZMass(fSF.MassZ);
244 APFEL::SetSin2ThetaW(fSF.Sin2ThW);
245 APFEL::SetCKM(fSF.Vud, fSF.Vus, fSF.Vub,
246 fSF.Vcd, fSF.Vcs, fSF.Vcb,
247 fSF.Vtd, fSF.Vts, fSF.Vtb);
254 if ( nch==NucSFCode(*in) )
continue;
255 nch = NucSFCode(*in);
257 string sfFile = SFname +
"/NucSF_NLO_" + NucSFName(*in) +
".dat";
259 LOG(
"HEDISStrucFunc",
pINFO) <<
"Checking if file " << sfFile <<
" exists...";
260 if ( gSystem->AccessPathName( sfFile.c_str()) ) {
261 #ifdef __GENIE_APFEL_ENABLED__ 262 LOG(
"HEDISStrucFunc",
pWARN) <<
"File doesnt exist. SF table will be computed.";
263 CreateNucSF( *in, sfFile );
265 LOG(
"HEDISStrucFunc",
pERROR) <<
"File doesnt exist. APFEL is needed for NLO SF";
269 else if ( atoi(gSystem->GetFromPipe((
"wc -w "+sfFile+
" | awk '{print $1}'").c_str()))!=kSFT3*nx*ny ) {
270 #ifdef __GENIE_APFEL_ENABLED__ 271 LOG(
"HEDISStrucFunc",
pWARN) <<
"File does not contain all the need points. SF table will be recomputed.";
272 gSystem->Exec((
"rm "+sfFile).c_str());
273 CreateNucSF( *in, sfFile );
275 LOG(
"HEDISStrucFunc",
pERROR) <<
"File does not contain all the need points. APFEL is needed for NLO SF";
279 std::ifstream sf_stream(sfFile.c_str(), std::ios::in);
281 for(
int sf = 1; sf < kSFnumber; ++sf) {
283 for (
int ij=0; ij<nx*ny; ij++ ) sf_stream >> z[ij];
289 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"Creating LO " << sfFile;
292 if (NucSFCode(*in2)==nch) qcodes.push_back(QrkSFCode(*in2));
295 for(
int sf = 1; sf < kSFnumber; ++sf) {
298 for (
int i=0; i<nx; i++) {
300 for (
int j=0; j<ny; j++) {
326 if(fgInstance == 0) {
327 LOG(
"HEDISStrucFunc",
pINFO) <<
"Late initialization";
352 if ( ispr ) { qrkd = 1 ; qrku = 2; }
353 else { qrkd = 2 ; qrku = 1; }
360 double sign3 = isnu ? +1. : -1.;
363 if ( pdg_iq== 1 && !sea_iq && pdg_fq== 2 ) { qpdf1 = qrkd; qpdf2 = -qrkd; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = 2*fSF.Vud*fSF.Vud; }
364 else if ( pdg_iq== 1 && !sea_iq && pdg_fq== 4 ) { qpdf1 = qrkd; qpdf2 = -qrkd; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = 2*fSF.Vcd*fSF.Vcd; }
365 else if ( pdg_iq== 1 && !sea_iq && pdg_fq== 6 ) { qpdf1 = qrkd; qpdf2 = -qrkd; Cp2 = 2*fSF.Vtd*fSF.Vtd; Cp3 = 2*fSF.Vtd*fSF.Vtd; }
366 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 2 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = 2*fSF.Vud*fSF.Vud; }
367 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 4 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = 2*fSF.Vcd*fSF.Vcd; }
368 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 6 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vtd*fSF.Vtd; Cp3 = 2*fSF.Vtd*fSF.Vtd; }
369 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 2 ) { qpdf1 = 3; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = 2*fSF.Vus*fSF.Vus; }
370 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 4 ) { qpdf1 = 3; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = 2*fSF.Vcs*fSF.Vcs; }
371 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 6 ) { qpdf1 = 3; Cp2 = 2*fSF.Vts*fSF.Vts; Cp3 = 2*fSF.Vts*fSF.Vts; }
372 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 2 ) { qpdf1 = 5; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = 2*fSF.Vub*fSF.Vub; }
373 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 4 ) { qpdf1 = 5; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = 2*fSF.Vcb*fSF.Vcb; }
374 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 6 ) { qpdf1 = 5; Cp2 = 2*fSF.Vtb*fSF.Vtb; Cp3 = 2*fSF.Vtb*fSF.Vtb; }
375 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-1 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = -2*fSF.Vud*fSF.Vud; }
376 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-3 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = -2*fSF.Vus*fSF.Vus; }
377 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-5 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = -2*fSF.Vub*fSF.Vub; }
378 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-1 ) { qpdf1 = -4; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = -2*fSF.Vcd*fSF.Vcd; }
379 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-3 ) { qpdf1 = -4; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = -2*fSF.Vcs*fSF.Vcs; }
380 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-5 ) { qpdf1 = -4; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = -2*fSF.Vcb*fSF.Vcb; }
383 if ( pdg_iq== 2 && !sea_iq && pdg_fq== 1 ) { qpdf1 = qrku; qpdf2 = -qrku; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = 2*fSF.Vud*fSF.Vud; }
384 else if ( pdg_iq== 2 && !sea_iq && pdg_fq== 3 ) { qpdf1 = qrku; qpdf2 = -qrku; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = 2*fSF.Vus*fSF.Vus; }
385 else if ( pdg_iq== 2 && !sea_iq && pdg_fq== 5 ) { qpdf1 = qrku; qpdf2 = -qrku; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = 2*fSF.Vub*fSF.Vub; }
386 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 1 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = 2*fSF.Vud*fSF.Vud; }
387 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 3 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = 2*fSF.Vus*fSF.Vus; }
388 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 5 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = 2*fSF.Vub*fSF.Vub; }
389 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 1 ) { qpdf1 = 4; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = 2*fSF.Vcd*fSF.Vcd; }
390 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 3 ) { qpdf1 = 4; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = 2*fSF.Vcs*fSF.Vcs; }
391 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 5 ) { qpdf1 = 4; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = 2*fSF.Vcb*fSF.Vcb; }
392 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-2 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = -2*fSF.Vud*fSF.Vud; }
393 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-4 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = -2*fSF.Vcd*fSF.Vcd; }
394 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-6 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vtd*fSF.Vtd; Cp3 = -2*fSF.Vtd*fSF.Vtd; }
395 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-2 ) { qpdf1 = -3; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = -2*fSF.Vus*fSF.Vus; }
396 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-4 ) { qpdf1 = -3; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = -2*fSF.Vcs*fSF.Vcs; }
397 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-6 ) { qpdf1 = -3; Cp2 = 2*fSF.Vts*fSF.Vts; Cp3 = -2*fSF.Vts*fSF.Vts; }
398 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-2 ) { qpdf1 = -5; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = -2*fSF.Vub*fSF.Vub; }
399 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-4 ) { qpdf1 = -5; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = -2*fSF.Vcb*fSF.Vcb; }
400 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-6 ) { qpdf1 = -5; Cp2 = 2*fSF.Vtb*fSF.Vtb; Cp3 = -2*fSF.Vtb*fSF.Vtb; }
404 double c2u = TMath::Power( 1./2. - 4./3.*fSF.Sin2ThW,2) + 1./4.;
405 double c2d = TMath::Power(-1./2. + 2./3.*fSF.Sin2ThW,2) + 1./4.;
406 double c3u = 1./2. - 4./3.*fSF.Sin2ThW;
407 double c3d = 1./2. - 2./3.*fSF.Sin2ThW;
408 if ( pdg_iq== 1 && !sea_iq && pdg_fq== 1 ) { qpdf1 = qrkd; qpdf2 = -qrkd; Cp2 = c2d; Cp3 = c3d; }
409 else if ( pdg_iq== 2 && !sea_iq && pdg_fq== 2 ) { qpdf1 = qrku; qpdf2 = -qrku; Cp2 = c2u; Cp3 = c3u; }
410 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 1 ) { qpdf1 = -qrkd; Cp2 = c2d; Cp3 = c3d; }
411 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 2 ) { qpdf1 = -qrku; Cp2 = c2u; Cp3 = c3u; }
412 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 3 ) { qpdf1 = 3; Cp2 = c2d; Cp3 = c3d; }
413 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 4 ) { qpdf1 = 4; Cp2 = c2u; Cp3 = c3u; }
414 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 5 ) { qpdf1 = 5; Cp2 = c2d; Cp3 = c3d; }
415 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-1 ) { qpdf1 = -qrkd; Cp2 = c2d; Cp3 = -c3d; }
416 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-2 ) { qpdf1 = -qrku; Cp2 = c2u; Cp3 = -c3u; }
417 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-3 ) { qpdf1 = -3; Cp2 = c2d; Cp3 = -c3d; }
418 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-4 ) { qpdf1 = -4; Cp2 = c2u; Cp3 = -c3u; }
419 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-5 ) { qpdf1 = -5; Cp2 = c2d; Cp3 = -c3d; }
423 std::ofstream sf_stream(sfFile.c_str());
426 for(
int sf = 1; sf < 4; sf++) {
427 for (
unsigned int i=0; i<sf_q2_array.size(); i++ ) {
428 double Q2 = sf_q2_array[i];
429 for (
unsigned int j=0; j<sf_x_array.size(); j++ ) {
430 double x = sf_x_array[j];
435 if (fSF.QrkThrs==1) {
436 if ( Q2*(1/z-1)+mass_nucl*mass_nucl <= TMath::Power(mass_nucl+mPDFQrk[TMath::Abs(pdg_fq)],2) ) { sf_stream << 0. <<
" ";
continue; }
439 else if (fSF.QrkThrs==2) {
440 if ( Q2*(1/z-1)+mass_nucl*mass_nucl <= TMath::Power(mass_nucl+mPDFQrk[TMath::Abs(pdg_fq)],2) ) { sf_stream << 0. <<
" ";
continue; }
441 z *= 1+mPDFQrk[TMath::Abs(pdg_fq)]*mPDFQrk[TMath::Abs(pdg_fq)]/
Q2;
444 else if (fSF.QrkThrs==3) {
445 z *= 1+mPDFQrk[TMath::Abs(pdg_fq)]*mPDFQrk[TMath::Abs(pdg_fq)]/
Q2;
449 double xPDF = TMath::Max( z,
xPDFmin );
450 double Q2PDF = TMath::Max( Q2,
Q2PDFmin );
451 Q2PDF = TMath::Min( Q2PDF,
Q2PDFmax );
454 #ifdef __GENIE_LHAPDF6_ENABLED__ 455 double fPDF = fmax( pdf->xfxQ2(qpdf1, xPDF, Q2PDF)/
z , 0.);
456 if (qpdf2!= -999) fPDF -= fmax( pdf->xfxQ2(qpdf2, xPDF, Q2PDF)/
z , 0.);
458 #ifdef __GENIE_LHAPDF5_ENABLED__ 459 double fPDF = fmax( LHAPDF::xfx(xPDF, TMath::Sqrt(Q2PDF), qpdf1)/z , 0.);
460 if (qpdf2!= -999) fPDF -= fmax( LHAPDF::xfx(xPDF, TMath::Sqrt(Q2PDF), qpdf2)/z , 0.);
465 if ( sf==1 ) tmp = fPDF*Cp2/2;
466 else if ( sf==2 ) tmp = fPDF*Cp2*
z;
467 else if ( sf==3 ) tmp = fPDF*Cp3*sign3;
470 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"QrkSFLO" << sf <<
"[x=" << x <<
"," << Q2 <<
"] = " <<
tmp;
471 sf_stream << tmp <<
" ";
481 #ifdef __GENIE_APFEL_ENABLED__ 492 if ( isnu ) APFEL::SetProjectileDIS(
"neutrino");
493 else APFEL::SetProjectileDIS(
"antineutrino");
494 if ( iscc ) APFEL::SetProcessDIS(
"CC");
495 else APFEL::SetProcessDIS(
"NC");
496 if ( ispr ) APFEL::SetTargetDIS(
"proton");
497 else APFEL::SetTargetDIS(
"neutron");
499 APFEL::InitializeAPFEL_DIS();
502 int nx = sf_x_array.size();
503 int nq2 = sf_q2_array.size();
504 double xlist[nx*nq2];
505 double q2list[nx*nq2];
506 double F2list[nx*nq2];
507 double FLlist[nx*nq2];
508 double xF3list[nx*nq2];
511 for (
unsigned int i=0; i<sf_q2_array.size(); i++ ) {
512 double Q2 = sf_q2_array[i];
513 double Q = TMath::Sqrt(Q2);
515 double norm = iscc ? 1. : 2./TMath::Power( Q2/(Q2 + TMath::Power(APFEL::GetZMass(),2))/4/APFEL::GetSin2ThetaW()/(1-APFEL::GetSin2ThetaW()), 2 );
516 APFEL::SetAlphaQCDRef(pdf->alphasQ(Q),Q);
517 APFEL::ComputeStructureFunctionsAPFEL(Q,Q);
518 for (
unsigned int j=0; j<sf_x_array.size(); j++ ) {
519 double x = sf_x_array[j];
522 FLlist[nlist] = norm*APFEL::FLtotal(x);
523 F2list[nlist] = norm*APFEL::F2total(x);
524 xF3list[nlist] = norm*APFEL::F3total(x);
530 std::ofstream sf_stream(sfFile.c_str());
532 double sign3 = isnu ? +1. : -1.;
534 for(
int sf = 1; sf < 4; sf++) {
535 for (
int i=0; i<nx*nq2; i++) {
537 if ( sf==1 ) tmp = (F2list[i]-FLlist[i])/2/xlist[i];
538 else if ( sf==2 ) tmp = F2list[i];
539 else if ( sf==3 ) tmp = sign3 * xF3list[i] / xlist[i];
541 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"NucSFNLO" << sf <<
"[x=" << xlist[i] <<
"," << q2list[i] <<
"] = " <<
tmp;
542 sf_stream << tmp <<
" ";
592 int code = QrkSFCode(in);
594 sf.
F1 = fQrkSFLOTables[
code].Table[kSFT1]->Evaluate(Q2,x);
595 sf.
F2 = fQrkSFLOTables[
code].Table[kSFT2]->Evaluate(Q2,x);
596 sf.
F3 = fQrkSFLOTables[
code].Table[kSFT3]->Evaluate(Q2,x);
602 int code = NucSFCode(in);
604 sf.
F1 = fNucSFLOTables[
code].Table[kSFT1]->Evaluate(Q2,x);
605 sf.
F2 = fNucSFLOTables[
code].Table[kSFT2]->Evaluate(Q2,x);
606 sf.
F3 = fNucSFLOTables[
code].Table[kSFT3]->Evaluate(Q2,x);
612 int code = NucSFCode(in);
614 sf.
F1 = fNucSFNLOTables[
code].Table[kSFT1]->Evaluate(Q2,x);
615 sf.
F2 = fNucSFNLOTables[
code].Table[kSFT2]->Evaluate(Q2,x);
616 sf.
F3 = fNucSFNLOTables[
code].Table[kSFT3]->Evaluate(Q2,x);
static constexpr double cm
TuneId * Tune(void) const
bool HitSeaQrk(void) const
bool IsWeakCC(void) const
bool IsNeutrino(int pdgc)
THE MAIN GENIE PROJECT NAMESPACE
static HEDISStrucFunc * fgInstance
double Q2(const Interaction *const i)
int HitNucPdg(void) const
Concrete implementations of the InteractionListGeneratorI interface. Generate a list of all the Inter...
int HitQrkPdg(void) const
double HitNucMass(void) const
SF_xQ2 EvalNucSFLO(const Interaction *in, double x, double Q2)
std::map< int, double > mPDFQrk
int NucSFCode(const Interaction *in)
int QrkSFCode(const Interaction *in)
string QrkSFName(const Interaction *in)
enum genie::HEDISStrucFunc::StrucFuncType HEDISStrucFuncType_t
Summary information for an interaction.
static QChar PDF((ushort) 0x202c)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void CreateNucSF(const Interaction *in, string sfFile)
void DummyMethodAndSilentCompiler()
CodeOutputInterface * code
HEDISStrucFunc(string basedir, SF_info sfinfo)
InteractionList * CreateHEDISlist(vector< InitialState > vinit, vector< InteractionType_t > vinttype) const
auto norm(Vector const &v)
Return norm of the specified vector.
int FinalQuarkPdg(void) const
static RunOpt * Instance(void)
void CreateQrkSF(const Interaction *in, string sfFile)
const XclsTag & ExclTag(void) const
string NucSFName(const Interaction *in)
A vector of Interaction objects.
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
SF_xQ2 EvalQrkSFLO(const Interaction *in, double x, double Q2)
const Target & Tgt(void) const
SF_xQ2 EvalNucSFNLO(const Interaction *in, double x, double Q2)
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
std::string to_string(ModuleType const mt)
static const double kProtonMass
static HEDISStrucFunc * Instance(string basedir, SF_info sfinfo)
Initial State information.