package gen; import mmc.*; import java.util.Random; /** * Parton distribution functions necessary for neutrino interaction cross sections are calculated here. * cteq library is called if the parameterization table ".cteqPDF_raw.data" is not found. */ public class CteqPDF extends PhysicsModel{ public static String tdir=""; public static CteqPDF Ctq; private int num=3; private double xn=1.e-6; private double xm=1.; private double xq1=xn, xq2=xn*2; public double Qn=0.2262; public double Qm=5.7471e4; private int f; private static native void SetCtq6(int set); private static native double Ctq6Pdf(int p, double x, double q); private static boolean loaded=false; private static int pdf=1; //----------------------------------------------------------------------------------------------------// /** * Initialize cteq library. Must be compiled and located within the ld library path. */ private static void CteqLoad(){ if(!loaded){ loaded=true; try{ System.loadLibrary("cteq"); }catch(Error error){ throw new Error("failed to load cteq library"); } Output.err.print("cteq library loaded ... "); try{ SetCtq6(pdf); }catch(Error error){ throw new Error("failed to initialize cteq library"); } } } //----------------------------------------------------------------------------------------------------// /** * Initialize class with the default PDF set. */ public CteqPDF(){ this(1); } //----------------------------------------------------------------------------------------------------// /** * Initialize class with PDF set specified with i. */ public CteqPDF(int i){ pdf=i; Ctq=this; } //----------------------------------------------------------------------------------------------------// /** * Calculates 3 linear combinations of PDFs. This is the function called by neutrino interaction classes. */ public double PDF(int f, double x, double q){ if(q