package mmc; /** * class contains functions necessary for calculation of bremsstrahlung losses */ public class BremsStochastic extends Bremsstrahlung{ private Integral[] I; private double H[], sum; //----------------------------------------------------------------------------------------------------// /** * initializes an integral class separate from that in Propagate */ public BremsStochastic(Bremsstrahlung cros){ super(cros); int i; I = new Integral[m.num]; for(i=0; irand){ if(jt){ setEnergy(i); if(vUp==vMax) return p.e*vUp; return p.e*(vUp*Math.exp(J[i].findLimit(p.e, this.rnd*H[i])*Math.log(vMax/vUp))); } else{ cros.component=i; return p.e*I[i].getUpperLimit(); } } } Output.err.println("Error (in BremsStochastic/e): sum was not initialized correctly"); return 0; } //----------------------------------------------------------------------------------------------------// public Interpolate J[]; public boolean jt=false; private double rnd; /** * 2d parametrization - interface to Interpolate */ public double functionInt(double e, double v){ p.setEnergy(e); setEnergy(cros.component); if(vUp==vMax) return 0; v=vUp*Math.exp(v*Math.log(vMax/vUp)); return I[cros.component].integrateWithLog(vUp, v, this); } //----------------------------------------------------------------------------------------------------// public Interpolate Jo[]; /** * 1d parametrization - interface to Interpolate */ public double functionInt(double e){ return J[cros.component].interpolate(e, 1); } }