package mmc; /** * medium definition */ public class Medium extends PhysicsModel{ public int num; // number of components public double[] Z; // nucleus charge public double[] A; // atomic number public double[] n; // number of atoms in a molecule public double totZ; // sum of charges of all nuclei public double ZA; // public double I; // ionization potential [eV] public double C1, C, a; // ionization formula constants public double m, X0, X1, d0; // ionization formula constants (continued) public double r; // refraction index public double B[]; // radiation logarithm constant B public double P[]; // radiation logarithm constant bPrime public double Xo; // radiation length [cm] public double rho; // multiplicative density correction factor public double Ro; // mass density [g/cm3] public double No; // molecule density [number/cm3] public double M[]; // average nucleon weight in a nucleus [MeV] public String E[]; // element name public String name; // medium name protected double ecut; // cutoff energy [MeV] protected double vcut; // relative cutoff energy private double vCut; // relative cutoff energy - call setCut(E) to set this private Integral L; // Needed for calculation of the public double[] mN; // Woods-Saxon potential factor public double MM; // average all-component nucleon weight public double totA; // sum of nucleons of all nuclei //----------------------------------------------------------------------------------------------------// /** * initialize medium by its name and proposed values of energy cut (ecut) and fractional energy cut (vcut). * The cuts ecut and vcut to be used must satisfy ecut>0 and 0<=vcut<=1; If both values satisfy * these inequalities, the higher of E*vcut and ecut is used. If only one value satisfies the inequalities, * only that one value is used. If both values are outside these intervals, vcut=1 is assumed. */ public Medium(String w, double ecut, double vcut, double rho){ name=w; this.rho=rho>0?rho:1; if(w.equalsIgnoreCase("water")) initWater(); else if(w.equalsIgnoreCase("ice")) initIce(); else if(w.equalsIgnoreCase("salt")) initSalt(); else if(w.equalsIgnoreCase("standard rock")) initStandardrock(); else if(w.equalsIgnoreCase("frejus rock")) initFrejusrock(); else if(w.equalsIgnoreCase("iron")) initIron(); else if(w.equalsIgnoreCase("hydrogen")) initHydrogen(); else if(w.equalsIgnoreCase("lead")) initLead(); else if(w.equalsIgnoreCase("uranium")) initUranium(); else if(w.equalsIgnoreCase("air")) initAir(); else if(w.equalsIgnoreCase("mineral oil")) initParaffin(); else if(w.equalsIgnoreCase("antares water")) initAntaresWater(); else { Output.err.println("Warning (in Medium/Medium): unknown medium: \""+w+"\", defaulting to water"); name="water"; initWater(); } this.ecut=ecut; this.vcut=vcut; vCut=1.; } //----------------------------------------------------------------------------------------------------// /** * calculate radiation length for simple elements */ public double radl(double Z){ switch(1){ case 1: // Tsai { double Lr, fZ, Lp, Z3, a=Alpha*Z; a*=a; fZ=a*(1/(1+a)+0.20206+a*(-0.0369+a*(0.0083-0.002*a))); switch((int)Math.round(Z)){ case 1: Lr=5.31; Lp=6.144; break; case 2: Lr=4.79; Lp=5.621; break; case 3: Lr=4.74; Lp=5.805; break; case 4: Lr=4.71; Lp=5.924; break; default: { Z3=Math.pow(Z, -1./3); Lr=Math.log(184.15*Z3); Lp=Math.log(1194.*Z3*Z3); } } return Z*(Z*(Lr-fZ)+Lp); } default: // Dahl return Z*(Z+1)*Math.log(287./Math.sqrt(Z)); } } //----------------------------------------------------------------------------------------------------// /* * initialization of arrays */ private void inita(int i){ num=i; Z = new double[num]; A = new double[num]; n = new double[num]; B = new double[num]; P = new double[num]; M = new double[num]; E = new String[num]; } //----------------------------------------------------------------------------------------------------// /* * initialization code, common to all media */ private void initr(){ int i; boolean flag=false; double aux1=0, aux2=0, aux3=0, aux4=0; Ro*=rho; for(i=0;i0){ aux=ecut/E; if(vcut>0 && vcut<=1){ if(aux>vcut) vCut=aux; else vCut=vcut; } else vCut=aux; } else{ if(vcut>0 && vcut<=1) vCut=vcut; else vCut=1.; } return vCut; } //----------------------------------------------------------------------------------------------------// private double r0; /** * Woods-Saxon potential calculation - interface to Integral */ public double function(double r){ final double a=0.54; return r*r/(1+Math.exp((r-r0)/a)); } }