27 #ifdef __GENIE_APFEL_ENABLED__
28 #include "APFEL/APFEL.h"
30 #include "LHAPDF/LHAPDF.h"
31 #ifdef __GENIE_LHAPDF6_ENABLED__
35 using namespace genie;
36 using namespace genie::constants;
53 if ( gSystem->Getenv(
"HEDIS_SF_DATA_PATH")==NULL ) basedir =
string(gSystem->Getenv(
"GENIE")) +
"/data/evgen/hedis-sf";
54 else basedir = string(gSystem->Getenv(
"HEDIS_SF_DATA_PATH"));
55 LOG(
"HEDISStrucFunc",
pWARN) <<
"Base directory: " << basedir;
57 if ( gSystem->AccessPathName( basedir.c_str(), kReadPermission ) ) {
58 LOG(
"HEDISStrucFunc",
pFATAL) <<
"Base directory doesnt exist or you dont have read permission.";
59 LOG(
"HEDISStrucFunc",
pFATAL) <<
"Remember!!!";
60 LOG(
"HEDISStrucFunc",
pFATAL) <<
"Path to base directory is defined with the enviroment variable HEDIS_SF_DATA_PATH.";
61 LOG(
"HEDISStrucFunc",
pFATAL) <<
"If not defined, default location is $GENIE/data/evgen/hedis-sf";
69 LOG(
"HEDISStrucFunc",
pWARN) <<
"SF are (or will be) in following directory: " << SFname;
70 if ( gSystem->AccessPathName( SFname.c_str(), kReadPermission ) ) {
71 LOG(
"HEDISStrucFunc",
pWARN) <<
"Bad news! Directory doesnt exists.";
72 LOG(
"HEDISStrucFunc",
pWARN) <<
"HEDIS package requires computation of SF";
73 LOG(
"HEDISStrucFunc",
pWARN) <<
"This will be SLOW!!!!!";
74 if ( gSystem->mkdir(SFname.c_str())==0 ) {
75 LOG(
"HEDISStrucFunc",
pINFO) <<
"Creating Metafile with input information";
76 std::ofstream meta_stream((SFname+
"/Inputs.txt").c_str());
81 LOG(
"HEDISStrucFunc",
pFATAL) <<
"You dont have write permission in the following directory:";
83 LOG(
"HEDISStrucFunc",
pFATAL) <<
"Remember!!!";
84 LOG(
"HEDISStrucFunc",
pFATAL) <<
"Path to base directory is defined with the enviroment variable HEDIS_SF_DATA_PATH.";
85 LOG(
"HEDISStrucFunc",
pFATAL) <<
"If not defined, default location is $GENIE/data/evgen/hedis-sf";
90 LOG(
"HEDISStrucFunc",
pWARN) <<
"Good news! Directory already exists.";
91 LOG(
"HEDISStrucFunc",
pWARN) <<
"Precomputed SF stored in that directory will be used";
92 LOG(
"HEDISStrucFunc",
pINFO) <<
"Comparing info from Metafile and selected Tune (CommonParam.xml)";
94 std::ifstream meta_stream((SFname+
"/Inputs.txt").c_str(), std::ios::in);
98 LOG(
"HEDISStrucFunc",
pINFO) <<
"Info from MetaFile and Tune match";
101 LOG(
"HEDISStrucFunc",
pFATAL) <<
"Info from MetaFile and Tune doesnt match";
102 LOG(
"HEDISStrucFunc",
pFATAL) <<
"MetaFile Path : " << SFname <<
"/Inputs.txt";
103 LOG(
"HEDISStrucFunc",
pFATAL) <<
"From Tune : ";
105 LOG(
"HEDISStrucFunc",
pFATAL) <<
"From MetaFile : ";
111 fSF.Sin2ThW = fSF.Rho==0. ? fSF.Sin2ThW : 1.-fSF.MassW*fSF.MassW/fSF.MassZ/fSF.MassZ/(1+fSF.Rho);
112 LOG(
"HEDISStrucFunc",
pINFO) <<
"Weingber angle computation:";
113 LOG(
"HEDISStrucFunc",
pINFO) <<
"Rho = " << fSF.Rho;
114 LOG(
"HEDISStrucFunc",
pINFO) <<
"Sin2ThW = " << fSF.Sin2ThW;
117 #ifdef __GENIE_LHAPDF6_ENABLED__
118 LOG(
"HEDISStrucFunc",
pINFO) <<
"Initialising LHAPDF6...";
119 pdf = LHAPDF::mkPDF(fSF.LHAPDFset, fSF.LHAPDFmember);
123 LOG(
"HEDISStrucFunc",
pINFO) <<
"PDF info:";
124 LOG(
"HEDISStrucFunc",
pINFO) <<
"OrderQCD = " << pdf->orderQCD();
125 LOG(
"HEDISStrucFunc",
pINFO) <<
"FlavorScheme = " << pdf->info().get_entry(
"FlavorScheme");
126 LOG(
"HEDISStrucFunc",
pINFO) <<
"NumFlavors = " << pdf->info().get_entry(
"NumFlavors");
128 LOG(
"HEDISStrucFunc",
pINFO) <<
"MZ = " << pdf->info().get_entry(
"MZ");
129 for (
int i=1; i<7; i++) {
130 mPDFQrk[i] = pdf->quarkMass(i);
134 #ifdef __GENIE_LHAPDF5_ENABLED__
135 LOG(
"HEDISStrucFunc",
pINFO) <<
"Initialising LHAPDF5...";
136 LHAPDF::initPDFByName(fSF.LHAPDFset, LHAPDF::LHGRID, fSF.LHAPDFmember);
139 Q2PDFmax = LHAPDF::getQ2max(0);
140 LOG(
"HEDISStrucFunc",
pINFO) <<
"PDF info:";
142 for (
int i=1; i<7; i++) {
143 mPDFQrk[i] = LHAPDF::getQMass(i);
149 if ( fSF.XGridMin <
xPDFmin ) {
150 LOG(
"HEDISStrucFunc",
pWARN) <<
"Lower boundary in X is smaller than input PDF";
152 LOG(
"HEDISStrucFunc",
pWARN) <<
"xGridMin = " << fSF.XGridMin;
153 LOG(
"HEDISStrucFunc",
pWARN) <<
"DANGER: An extrapolation will be done!!!!!";
155 else if ( fSF.Q2GridMin <
Q2PDFmin ) {
156 LOG(
"HEDISStrucFunc",
pWARN) <<
"Lower boundary in Q2 is smaller than input PDF";
158 LOG(
"HEDISStrucFunc",
pWARN) <<
"Q2GridMin = " << fSF.Q2GridMin;
159 LOG(
"HEDISStrucFunc",
pWARN) <<
"DANGER: An extrapolation will be done!!!!!";
161 else if ( fSF.Q2GridMax > Q2PDFmax ) {
162 LOG(
"HEDISStrucFunc",
pWARN) <<
"Upper boundary in Q2 is bigger than input PDF";
164 LOG(
"HEDISStrucFunc",
pWARN) <<
"Q2GridMax = " << fSF.Q2GridMax;
165 LOG(
"HEDISStrucFunc",
pWARN) <<
"DANGER: An extrapolation will be done!!!!!";
169 double dlogq2 = TMath::Abs( TMath::Log10(fSF.Q2GridMin)-TMath::Log10(fSF.Q2GridMax) ) / fSF.NGridQ2;
170 double dlogx = TMath::Abs( TMath::Log10(fSF.XGridMin)-TMath::Log10(1.) ) / fSF.NGridX;
171 LOG(
"HEDISStrucFunc",
pINFO) <<
"Grid x,Q2 :" << fSF.NGridX <<
" , " << fSF.NGridQ2;
172 for (
double logq2 = TMath::Log10(fSF.Q2GridMin); logq2<TMath::Log10(fSF.Q2GridMax); logq2+= dlogq2 ) {
173 double q2 = TMath::Power( 10, logq2 + 0.5*dlogq2 );
174 if (q2>fSF.Q2GridMax)
continue;
175 sf_q2_array.push_back(q2);
176 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"q2: " << sf_q2_array.back();
178 for (
double logx = TMath::Log10(fSF.XGridMin); logx<TMath::Log10(1.); logx+= dlogx ) {
179 double x = TMath::Power( 10, logx + 0.5*dlogx );
180 if ( x>1. )
continue;
181 sf_x_array.push_back(x);
182 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"x: " << sf_x_array.back();
186 int nx = sf_q2_array.size();
187 int ny = sf_x_array.size();
191 for (
int i=0; i<nx; i++) x[i] = sf_q2_array[i];
192 for (
int j=0; j<ny; j++) y[j] = sf_x_array[j];
194 vector<InteractionType_t> inttype;
197 vector<InitialState> init_state;
205 for(InteractionList::iterator in=ilist->begin(); in!=ilist->end(); ++in) {
207 string sfFile = SFname +
"/QrkSF_LO_" + QrkSFName(*in) +
".dat";
209 LOG(
"HEDISStrucFunc",
pINFO) <<
"Checking if file " << sfFile <<
" exists...";
210 if ( gSystem->AccessPathName( sfFile.c_str()) ) {
211 LOG(
"HEDISStrucFunc",
pWARN) <<
"File doesnt exist. SF table will be computed.";
212 CreateQrkSF( *in, sfFile );
214 else if ( atoi(gSystem->GetFromPipe((
"wc -w "+sfFile+
" | awk '{print $1}'").c_str()))!=kSFT3*nx*ny ) {
215 LOG(
"HEDISStrucFunc",
pWARN) <<
"File does not contain all the need points. SF table will be recomputed.";
216 gSystem->Exec((
"rm "+sfFile).c_str());
217 CreateQrkSF( *in, sfFile );
219 std::ifstream sf_stream(sfFile.c_str(), std::ios::in);
221 for(
int sf = 1; sf < kSFnumber; ++sf) {
223 for (
int ij=0; ij<nx*ny; ij++ ) sf_stream >> z[ij];
230 #ifdef __GENIE_APFEL_ENABLED__
232 LOG(
"HEDISStrucFunc",
pINFO) <<
"Initialising APFEL..." ;
233 APFEL::SetPDFSet(fSF.LHAPDFset);
234 APFEL::SetReplica(fSF.LHAPDFmember);
235 if (fSF.Scheme==
"BGR") {
236 APFEL::SetMassScheme(
"FONLL-B");
239 else if (fSF.Scheme==
"CSMS") {
240 APFEL::SetMassScheme(
"ZM-VFNS");
243 else if (fSF.Scheme==
"GGHR") {
244 APFEL::SetMassScheme(
"FFNS5");
246 APFEL::SetMaxFlavourPDFs(5);
247 APFEL::SetMaxFlavourAlpha(5);
250 LOG(
"HEDISStrucFunc",
pERROR) <<
"Mass Scheme is not set properly";
253 APFEL::SetQLimits(TMath::Sqrt(fSF.Q2GridMin),TMath::Sqrt(fSF.Q2GridMax));
254 APFEL::SetMaxFlavourPDFs(6);
255 APFEL::SetMaxFlavourAlpha(6);
256 APFEL::SetNumberOfGrids(3);
257 APFEL::SetGridParameters(1,90,3,fSF.XGridMin);
258 APFEL::SetGridParameters(2,50,5,1
e-1);
259 APFEL::SetGridParameters(3,40,5,8
e-1);
260 APFEL::SetPerturbativeOrder(1);
261 APFEL::SetAlphaQCDRef(pdf->alphasQ(fSF.MassZ),fSF.MassZ);
263 APFEL::SetWMass(fSF.MassW);
264 APFEL::SetZMass(fSF.MassZ);
265 APFEL::SetSin2ThetaW(fSF.Sin2ThW);
266 APFEL::SetCKM(fSF.Vud, fSF.Vus, fSF.Vub,
267 fSF.Vcd, fSF.Vcs, fSF.Vcb,
268 fSF.Vtd, fSF.Vts, fSF.Vtb);
273 for(InteractionList::iterator in=ilist->begin(); in!=ilist->end(); ++in) {
275 if ( nch==NucSFCode(*in) )
continue;
276 nch = NucSFCode(*in);
278 string sfFile = SFname +
"/NucSF_NLO_" + NucSFName(*in) +
".dat";
280 LOG(
"HEDISStrucFunc",
pINFO) <<
"Checking if file " << sfFile <<
" exists...";
281 if ( gSystem->AccessPathName( sfFile.c_str()) ) {
282 #ifdef __GENIE_APFEL_ENABLED__
283 LOG(
"HEDISStrucFunc",
pWARN) <<
"File doesnt exist. SF table will be computed.";
284 CreateNucSF( *in, sfFile );
286 LOG(
"HEDISStrucFunc",
pERROR) <<
"File doesnt exist. APFEL is needed for NLO SF";
290 else if ( atoi(gSystem->GetFromPipe((
"wc -w "+sfFile+
" | awk '{print $1}'").c_str()))!=kSFT3*nx*ny ) {
291 #ifdef __GENIE_APFEL_ENABLED__
292 LOG(
"HEDISStrucFunc",
pWARN) <<
"File does not contain all the need points. SF table will be recomputed.";
293 gSystem->Exec((
"rm "+sfFile).c_str());
294 CreateNucSF( *in, sfFile );
296 LOG(
"HEDISStrucFunc",
pERROR) <<
"File does not contain all the need points. APFEL is needed for NLO SF";
300 std::ifstream sf_stream(sfFile.c_str(), std::ios::in);
302 for(
int sf = 1; sf < kSFnumber; ++sf) {
304 for (
int ij=0; ij<nx*ny; ij++ ) sf_stream >> z[ij];
310 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"Creating LO " << sfFile;
312 for(InteractionList::iterator in2=ilist->begin(); in2!=ilist->end(); ++in2) {
313 if (NucSFCode(*in2)==nch) qcodes.push_back(QrkSFCode(*in2));
316 for(
int sf = 1; sf < kSFnumber; ++sf) {
319 for (
int i=0; i<nx; i++) {
321 for (
int j=0; j<ny; j++) {
324 for(vector<int>::const_iterator iq=qcodes.begin(); iq!=qcodes.end(); ++iq)
347 if(fgInstance == 0) {
348 LOG(
"HEDISStrucFunc",
pINFO) <<
"Late initialization";
373 if ( ispr ) { qrkd = 1 ; qrku = 2; }
374 else { qrkd = 2 ; qrku = 1; }
381 double sign3 = isnu ? +1. : -1.;
384 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; }
385 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; }
386 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; }
387 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 2 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = 2*fSF.Vud*fSF.Vud; }
388 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 4 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = 2*fSF.Vcd*fSF.Vcd; }
389 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 6 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vtd*fSF.Vtd; Cp3 = 2*fSF.Vtd*fSF.Vtd; }
390 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 2 ) { qpdf1 = 3; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = 2*fSF.Vus*fSF.Vus; }
391 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 4 ) { qpdf1 = 3; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = 2*fSF.Vcs*fSF.Vcs; }
392 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 6 ) { qpdf1 = 3; Cp2 = 2*fSF.Vts*fSF.Vts; Cp3 = 2*fSF.Vts*fSF.Vts; }
393 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 2 ) { qpdf1 = 5; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = 2*fSF.Vub*fSF.Vub; }
394 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 4 ) { qpdf1 = 5; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = 2*fSF.Vcb*fSF.Vcb; }
395 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 6 ) { qpdf1 = 5; Cp2 = 2*fSF.Vtb*fSF.Vtb; Cp3 = 2*fSF.Vtb*fSF.Vtb; }
396 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-1 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = -2*fSF.Vud*fSF.Vud; }
397 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-3 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = -2*fSF.Vus*fSF.Vus; }
398 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-5 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = -2*fSF.Vub*fSF.Vub; }
399 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-1 ) { qpdf1 = -4; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = -2*fSF.Vcd*fSF.Vcd; }
400 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-3 ) { qpdf1 = -4; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = -2*fSF.Vcs*fSF.Vcs; }
401 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-5 ) { qpdf1 = -4; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = -2*fSF.Vcb*fSF.Vcb; }
404 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; }
405 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; }
406 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; }
407 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 1 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = 2*fSF.Vud*fSF.Vud; }
408 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 3 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = 2*fSF.Vus*fSF.Vus; }
409 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 5 ) { qpdf1 = -qrku; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = 2*fSF.Vub*fSF.Vub; }
410 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 1 ) { qpdf1 = 4; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = 2*fSF.Vcd*fSF.Vcd; }
411 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 3 ) { qpdf1 = 4; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = 2*fSF.Vcs*fSF.Vcs; }
412 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 5 ) { qpdf1 = 4; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = 2*fSF.Vcb*fSF.Vcb; }
413 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-2 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vud*fSF.Vud; Cp3 = -2*fSF.Vud*fSF.Vud; }
414 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-4 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vcd*fSF.Vcd; Cp3 = -2*fSF.Vcd*fSF.Vcd; }
415 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-6 ) { qpdf1 = -qrkd; Cp2 = 2*fSF.Vtd*fSF.Vtd; Cp3 = -2*fSF.Vtd*fSF.Vtd; }
416 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-2 ) { qpdf1 = -3; Cp2 = 2*fSF.Vus*fSF.Vus; Cp3 = -2*fSF.Vus*fSF.Vus; }
417 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-4 ) { qpdf1 = -3; Cp2 = 2*fSF.Vcs*fSF.Vcs; Cp3 = -2*fSF.Vcs*fSF.Vcs; }
418 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-6 ) { qpdf1 = -3; Cp2 = 2*fSF.Vts*fSF.Vts; Cp3 = -2*fSF.Vts*fSF.Vts; }
419 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-2 ) { qpdf1 = -5; Cp2 = 2*fSF.Vub*fSF.Vub; Cp3 = -2*fSF.Vub*fSF.Vub; }
420 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-4 ) { qpdf1 = -5; Cp2 = 2*fSF.Vcb*fSF.Vcb; Cp3 = -2*fSF.Vcb*fSF.Vcb; }
421 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-6 ) { qpdf1 = -5; Cp2 = 2*fSF.Vtb*fSF.Vtb; Cp3 = -2*fSF.Vtb*fSF.Vtb; }
425 double c2u = TMath::Power( 1./2. - 4./3.*fSF.Sin2ThW,2) + 1./4.;
426 double c2d = TMath::Power(-1./2. + 2./3.*fSF.Sin2ThW,2) + 1./4.;
427 double c3u = 1./2. - 4./3.*fSF.Sin2ThW;
428 double c3d = 1./2. - 2./3.*fSF.Sin2ThW;
429 if ( pdg_iq== 1 && !sea_iq && pdg_fq== 1 ) { qpdf1 = qrkd; qpdf2 = -qrkd; Cp2 = c2d; Cp3 = c3d; }
430 else if ( pdg_iq== 2 && !sea_iq && pdg_fq== 2 ) { qpdf1 = qrku; qpdf2 = -qrku; Cp2 = c2u; Cp3 = c3u; }
431 else if ( pdg_iq== 1 && sea_iq && pdg_fq== 1 ) { qpdf1 = -qrkd; Cp2 = c2d; Cp3 = c3d; }
432 else if ( pdg_iq== 2 && sea_iq && pdg_fq== 2 ) { qpdf1 = -qrku; Cp2 = c2u; Cp3 = c3u; }
433 else if ( pdg_iq== 3 && sea_iq && pdg_fq== 3 ) { qpdf1 = 3; Cp2 = c2d; Cp3 = c3d; }
434 else if ( pdg_iq== 4 && sea_iq && pdg_fq== 4 ) { qpdf1 = 4; Cp2 = c2u; Cp3 = c3u; }
435 else if ( pdg_iq== 5 && sea_iq && pdg_fq== 5 ) { qpdf1 = 5; Cp2 = c2d; Cp3 = c3d; }
436 else if ( pdg_iq==-1 && sea_iq && pdg_fq==-1 ) { qpdf1 = -qrkd; Cp2 = c2d; Cp3 = -c3d; }
437 else if ( pdg_iq==-2 && sea_iq && pdg_fq==-2 ) { qpdf1 = -qrku; Cp2 = c2u; Cp3 = -c3u; }
438 else if ( pdg_iq==-3 && sea_iq && pdg_fq==-3 ) { qpdf1 = -3; Cp2 = c2d; Cp3 = -c3d; }
439 else if ( pdg_iq==-4 && sea_iq && pdg_fq==-4 ) { qpdf1 = -4; Cp2 = c2u; Cp3 = -c3u; }
440 else if ( pdg_iq==-5 && sea_iq && pdg_fq==-5 ) { qpdf1 = -5; Cp2 = c2d; Cp3 = -c3d; }
444 std::ofstream sf_stream(sfFile.c_str());
447 for(
int sf = 1; sf < 4; sf++) {
448 for (
unsigned int i=0; i<sf_q2_array.size(); i++ ) {
449 double Q2 = sf_q2_array[i];
450 for (
unsigned int j=0; j<sf_x_array.size(); j++ ) {
451 double x = sf_x_array[j];
456 if (fSF.QrkThrs==1) {
457 if ( Q2*(1/z-1)+mass_nucl*mass_nucl <= TMath::Power(mass_nucl+
mPDFQrk[TMath::Abs(pdg_fq)],2) ) { sf_stream << 0. <<
" ";
continue; }
460 else if (fSF.QrkThrs==2) {
461 if ( Q2*(1/z-1)+mass_nucl*mass_nucl <= TMath::Power(mass_nucl+
mPDFQrk[TMath::Abs(pdg_fq)],2) ) { sf_stream << 0. <<
" ";
continue; }
465 else if (fSF.QrkThrs==3) {
470 double xPDF = TMath::Max( z,
xPDFmin );
471 double Q2PDF = TMath::Max( Q2,
Q2PDFmin );
472 Q2PDF = TMath::Min( Q2PDF,
Q2PDFmax );
475 #ifdef __GENIE_LHAPDF6_ENABLED__
476 double fPDF = fmax( pdf->xfxQ2(qpdf1, xPDF, Q2PDF)/z , 0.);
477 if (qpdf2!= -999) fPDF -= fmax( pdf->xfxQ2(qpdf2, xPDF, Q2PDF)/z , 0.);
479 #ifdef __GENIE_LHAPDF5_ENABLED__
480 double fPDF = fmax( LHAPDF::xfx(xPDF, TMath::Sqrt(Q2PDF), qpdf1)/z , 0.);
481 if (qpdf2!= -999) fPDF -= fmax( LHAPDF::xfx(xPDF, TMath::Sqrt(Q2PDF), qpdf2)/z , 0.);
486 if ( sf==1 ) tmp = fPDF*Cp2/2;
487 else if ( sf==2 ) tmp = fPDF*Cp2*z;
488 else if ( sf==3 ) tmp = fPDF*Cp3*sign3;
491 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"QrkSFLO" << sf <<
"[x=" << x <<
"," << Q2 <<
"] = " << tmp;
492 sf_stream << tmp <<
" ";
502 #ifdef __GENIE_APFEL_ENABLED__
513 if ( isnu ) APFEL::SetProjectileDIS(
"neutrino");
514 else APFEL::SetProjectileDIS(
"antineutrino");
515 if ( iscc ) APFEL::SetProcessDIS(
"CC");
516 else APFEL::SetProcessDIS(
"NC");
517 if ( ispr ) APFEL::SetTargetDIS(
"proton");
518 else APFEL::SetTargetDIS(
"neutron");
520 APFEL::InitializeAPFEL_DIS();
523 int nx = sf_x_array.size();
524 int nq2 = sf_q2_array.size();
525 double xlist[nx*nq2];
526 double q2list[nx*nq2];
527 double F2list[nx*nq2];
528 double FLlist[nx*nq2];
529 double xF3list[nx*nq2];
532 for (
unsigned int i=0; i<sf_q2_array.size(); i++ ) {
533 double Q2 = sf_q2_array[i];
534 double Q = TMath::Sqrt(Q2);
536 double norm = iscc ? 1. : 2./TMath::Power( Q2/(Q2 + TMath::Power(APFEL::GetZMass(),2))/4/APFEL::GetSin2ThetaW()/(1-APFEL::GetSin2ThetaW()), 2 );
537 APFEL::SetAlphaQCDRef(pdf->alphasQ(Q),Q);
538 APFEL::ComputeStructureFunctionsAPFEL(Q,Q);
539 for (
unsigned int j=0; j<sf_x_array.size(); j++ ) {
540 double x = sf_x_array[j];
543 FLlist[nlist] = norm*APFEL::FLtotal(x);
544 F2list[nlist] = norm*APFEL::F2total(x);
545 xF3list[nlist] = norm*APFEL::F3total(x);
551 std::ofstream sf_stream(sfFile.c_str());
553 double sign3 = isnu ? +1. : -1.;
555 for(
int sf = 1; sf < 4; sf++) {
556 for (
int i=0; i<nx*nq2; i++) {
558 if ( sf==1 ) tmp = (F2list[i]-FLlist[i])/2/xlist[i];
559 else if ( sf==2 ) tmp = F2list[i];
560 else if ( sf==3 ) tmp = sign3 * xF3list[i] / xlist[i];
562 LOG(
"HEDISStrucFunc",
pDEBUG) <<
"NucSFNLO" << sf <<
"[x=" << xlist[i] <<
"," << q2list[i] <<
"] = " << tmp;
563 sf_stream << tmp <<
" ";
613 int code = QrkSFCode(in);
615 sf.
F1 = fQrkSFLOTables[code].Table[kSFT1]->Evaluate(Q2,x);
616 sf.
F2 = fQrkSFLOTables[code].Table[kSFT2]->Evaluate(Q2,x);
617 sf.
F3 = fQrkSFLOTables[code].Table[kSFT3]->Evaluate(Q2,x);
623 int code = NucSFCode(in);
625 sf.
F1 = fNucSFLOTables[code].Table[kSFT1]->Evaluate(Q2,x);
626 sf.
F2 = fNucSFLOTables[code].Table[kSFT2]->Evaluate(Q2,x);
627 sf.
F3 = fNucSFLOTables[code].Table[kSFT3]->Evaluate(Q2,x);
633 int code = NucSFCode(in);
635 sf.
F1 = fNucSFNLOTables[code].Table[kSFT1]->Evaluate(Q2,x);
636 sf.
F2 = fNucSFNLOTables[code].Table[kSFT2]->Evaluate(Q2,x);
637 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)
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)
HEDISStrucFunc(SF_info sfinfo)
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
static HEDISStrucFunc * Instance(SF_info sfinfo)
Summary information for an interaction.
#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()
InteractionList * CreateHEDISlist(vector< InitialState > vinit, vector< InteractionType_t > vinttype) const
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...
static const double kProtonMass
Initial State information.