lcsim-contrib/src/main/java/org/lcsim/contrib/Partridge/TextFileToStdhep
diff -N GenerateMuons.java
--- GenerateMuons.java 7 May 2009 23:59:44 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,56 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.lcsim.contrib.Partridge.TextFileToStdhep;
-
-import hep.io.stdhep.StdhepEvent;
-import hep.io.stdhep.StdhepWriter;
-import java.io.IOException;
-import java.util.Random;
-
-/**
- *
- * @author partridge
- */
-public class GenerateMuons{
-
- public static void main(String[] args) throws IOException {
- Random generator = new Random();
-
- int nwrit = 200;
- StdhepWriter sw = new StdhepWriter("c:\\muon_1dot5GeV_10-170_200_0.stdhep", "Single muons",
- "Single muons", nwrit);
- sw.setCompatibilityMode(false);
- for (int icross = 0; icross < nwrit; icross++) {
- double pt = 1.5;
- double m = 0.105658;
- double theta = (160. * generator.nextDouble() + 10.) * Math.PI / 180.;
- double phi = 2. * Math.PI * generator.nextDouble();
- int nevhep = icross;
- int nhep = 1;
- int isthep[] = new int[2];
- isthep[0] = 1;
- int idhep[] = new int[2];
- idhep[0] = 13;
- if (generator.nextDouble() > 0.5) idhep[0] = -13;
- int jmohep[] = new int[2];
- for (int i=0; i<2; i++) jmohep[i] = 0;
- int jdahep[] = new int[2];
- for (int i=0; i<2; i++) jdahep[i] = 0;
- double phep[] = new double[5];
- phep[0] = pt * Math.cos(phi);
- phep[1] = pt * Math.sin(phi);
- phep[2] = pt / Math.tan(theta);
- double p2 = pt*pt + phep[2]*phep[2];
- phep[3] = Math.sqrt(p2 + m*m);
- phep[4] = m;
- double vhep[] = new double[4];
- for (int i=0; i<4; i++) vhep[i] = 0.;
- StdhepEvent ev = new StdhepEvent(nevhep, nhep, isthep, idhep, jmohep, jdahep, phep, vhep);
- sw.writeRecord(ev);
- }
- sw.close();
- }
-}
\ No newline at end of file