Commit in hps-java/src/main/java/org/lcsim/hps/util on MAIN | |||
ConvertToStdhep.java | +22 | -6 | 1.7 -> 1.8 |
Fix decay length calculation.
diff -u -r1.7 -r1.8 --- ConvertToStdhep.java 8 Jan 2013 21:03:45 -0000 1.7 +++ ConvertToStdhep.java 17 Jan 2013 16:40:46 -0000 1.8 @@ -6,7 +6,8 @@
/** *
- * @author mgraham
+ * @author Mathew Thomas Graham <[log in to unmask]> + * $Id: ConvertToStdhep.java,v 1.8 2013/01/17 16:40:46 omoreno Exp $
*/ import java.io.FileReader; import java.io.IOException;
@@ -75,7 +76,7 @@
options.addOption(new Option("x", true, "Beam sigma in x")); options.addOption(new Option("y", true, "Beam sigma in y")); options.addOption(new Option("s", false, "Filter Events"));
- options.addOption(new Option("u", false, "Is muonic decay?"));
+ options.addOption(new Option("u", false, "Is muonic decay?"));
return options; }
@@ -441,6 +442,8 @@
return Math.exp(-x / (gamma * _declength)); }
+ /* + * Old code written by Matt
static private double findMaxWeight() { Random generator = new Random(); int ntrials = 100000;
@@ -468,8 +471,17 @@
tmpwght = expWeight(dl, gamma) / MaxWeight; } return dl;
- }
+ }*/
+ static private double getDecayLength(double gamma){ + Random generator = new Random(); + double a = generator.nextDouble(); + double l = -gamma*_declength*Math.log(1-a); + return l; + } + + /* + * Old code written by Matt
static private double getDecayLength(double MaxWeight) { Random generator = new Random(); double maxlength = maxLen;
@@ -481,7 +493,7 @@
tmpwght = expWeight(dl) / MaxWeight; } return dl;
- }
+ }*/
static private void writeDATEvent(StreamTokenizer tok, double[] beam, double decLen, int nevhep) throws IOException { List<Double> vals = getNumbersInLine(tok);
@@ -610,9 +622,12 @@
double decLen = 0; double maxWght = 0;
+ /* + * No longer needed + *
if (expDecay) { maxWght = findMaxWeight();
- }
+ }*/
int isthep[] = new int[nhep]; int idhep[] = new int[nhep]; int jmohep[] = new int[2 * nhep];
@@ -680,7 +695,8 @@
if (!trident && (Math.abs(idhepTmp) == 611 || Math.abs(idhepTmp) == 622)) { double gamma = ApEnergy / ApMass; if (expDecay) {
- decLen = getDecayLength(maxWght, gamma);
+ decLen = getDecayLength(gamma); + // decLen = getDecayLength(maxWght, gamma);
} if (flatDecay) { decLen = generator.nextDouble() * maxLen;
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1