package tfa; import mmc.*; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.util.StringTokenizer; /** * This class evaluates the energy of muons/taus after passing through a given distance or their range. * Reads from and outputs to standard input/output. Originally thought of as a front-end for Frejus experiment. */ public class Frejus{ public static void main(String[] args){ double vcut=-1.0; double ecut=-1.0; String med="Frejus Rock"; String type="mu"; double elow=PhysicsModel.elow; double ebig=PhysicsModel.ebig; boolean SDEC=false; boolean RECC=false; boolean timef=false; boolean conti=false; boolean lpmef=false; boolean debug=false; int bspar=1; int pncrs=1; int pncbb=1; int pncsh=1; double crsci=1; double crscb=1; double crscp=1; double crsce=1; double crscd=1; double rho=1; int romb=5; boolean raw=false; String intr="all"; int bnum=0; String param="Frejus", pbad=""; boolean pflag; for(int n=0; n0){ pbad=bnum==1?pbad+" is":"s"+pbad+" are"; Output.err.println("Warning: Parameter"+pbad+" not recognized"); } if(bspar<1 || bspar>4){ Output.err.println("Warning: bs is not a valid number"); bspar=1; } if(pncrs<1 || pncrs>4 || (pncrs==2 && !(type.equals("mu") || type.equals("tau")))){ Output.err.println("Warning: ph is not a valid number"); pncrs=1; } if(((pncrs==1 || pncrs==2) && (pncbb<1 || pncbb>4)) || (pncrs==3 && (pncbb<1 || pncbb>2)) || (pncrs==4 && pncbb!=1)){ Output.err.println("Warning: bb is not a valid number"); pncbb=1; } if(((pncrs==1 || pncrs==2) && (pncsh!=1)) || ((pncrs>2) && (pncsh<1 || pncsh>2))){ Output.err.println("Warning: sh is not a valid number"); pncsh=1; } if(romb<2 || romb>6){ Output.err.println("Warning: romb is not a valid number"); romb=5; } PhysicsModel.elow=elow; PhysicsModel.ebig=ebig; Propagate p = new Propagate(med, ecut, vcut, type, rho); Output.DEBUG=debug; p.sdec=SDEC; // To enable stopped muon decay p.recc=RECC; // To enable printout of continuous energy losses p.contiCorr=conti; // To randomize the continuous energy losses, use only for small vcut p.exactTime=timef; // To compute local time of the particle exactly p.s.lpm=lpmef; // Enable lpm and dielectric suppression effects p.s.b.form=bspar; // Choose parametrization of the bremsstrahlung cross section p.s.n.form=pncrs; // Choose parametrization of the photon-nucleon cross section p.s.n.bb=pncbb; // Choose parametrization of the photon-nucleon cross section p.s.n.shadow=pncsh; // Choose parametrization of the photon-nucleon cross section p.s.ci=crsci; // Cross section multiplicative modifier p.s.cb=crscb; // Cross section multiplicative modifier p.s.cp=crscp; // Cross section multiplicative modifier p.s.ce=crsce; // Cross section multiplicative modifier p.s.cd=crscd; // Cross section multiplicative modifier Propagate.g=romb; Output.raw=raw; p.interpolate(intr, ".frejus"); Output.err.println("Enter the following: energy in [GeV] and distance to travel x in [m]."); Output.err.println("The last entry in the output is the final energy in [GeV] (if > 0)"); Output.err.println("or distance traveled to the point of disappearance in [m] (if < 0)."); Output.err.println(" --- *** Enter your parameters now *** ---"); try{ LineNumberReader file = new LineNumberReader(new InputStreamReader(Output.in)); String line; StringTokenizer t; double e, x, result; while((line=file.readLine())!=null){ t = new StringTokenizer(line); if(!t.hasMoreTokens()) continue; e=Double.parseDouble(t.nextToken()); x=Double.parseDouble(t.nextToken()); result=p.propagateTo(x*1.e2, e*1.e3); line+=" "+Output.f(result>0?result*1.e-3:result*1.e-2); if(timef) line+=" "+Output.f(p.p.t); Output.out.println(line); } }catch(Exception error){ Output.err.println("Program finished with exception: "+error.toString()); throw new mmcException("input error"); } } }