Commit in hps-java/src/main/java/org/lcsim/hps/util on MAIN
ConvertToStdhep.java+26-181.2 -> 1.3
a few changes to the converter

hps-java/src/main/java/org/lcsim/hps/util
ConvertToStdhep.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ConvertToStdhep.java	13 Jun 2011 17:12:57 -0000	1.2
+++ ConvertToStdhep.java	5 Dec 2011 19:54:13 -0000	1.3
@@ -25,22 +25,22 @@
 
 public class ConvertToStdhep {
 
-    static boolean expDecay = false;
-    static boolean flatDecay = false;
-    static boolean trident = false;
-    static double _declength = 0.0;//A' decay length (mm)
-    static double _xoff = 0.03;
-    static double _yoff = 0;
-    static double _zoff = 0;
-    static double sigx = 0.0;        // Luminous region size in x (mm)
+    static boolean expDecay = false;  //set a ctau decay length
+    static boolean flatDecay = false; //decay uniformily in some range
+    static boolean trident = false;  //are these trident events or A' signal events
+    static double _declength = 0.0;   //A' decay length (mm)
+    static double _xoff = 0.0;   //set the x,y,z origin offsets...
+    static double _yoff = 0.0;
+    static double _zoff = 0.03;
+    static double sigx = 0.01;        // Luminous region size in x (mm)
     static double sigy = 0.01;        // Luminous region size in y (mm)
-    static double sigz = 0.01;         // Luminous region size in z (mm)
+    static double sigz = 0.0;         // Luminous region size in z (mm)
     static double aMass = 0.05;  //Aprime mass (GeV)
     static double maxLen = 200; // maximum decay length (mm)
     static double _ecm = 5.5; //GeV
-    static int nInFiles = 100;
+    static int nInFiles = 100;  //number of input files
     static StdhepWriter sw;
-    static int nmax = 500000;
+    static int nmax = 500000;  //maximum number of events to write to 1 stdhep file (new one opens if n>nmax)
     static String fileType = "lhe";
 //        static String fileType="dat";
 
@@ -61,8 +61,6 @@
 
        String fDir = "/nfs/slac/g/hps/mgraham/DarkPhoton/MadGraph/Events1pt1Ap20MeV/";
         String fileLabel = "ap1.1gev20mevall";
-
-
         String inLabel = "W1pt1GeV_Ap20MeV_";
         String inPost = "_unweighted_events.lhe";
 
@@ -70,6 +68,7 @@
         String outDir = "/nfs/slac/g/hps/mgraham/DarkPhoton/SignalEvents/";
         int nread = -1;
         int nOutFile = 0;
+        
         for (int i = 0; i < nInFiles; i++) {
             int fnum = i + 1;
             String snum = "_" + fnum;
@@ -135,7 +134,6 @@
 
         int nwrit = (int) nmax;
 
-
         sw = new StdhepWriter(outfile, "Imported Stdhep Events",
                 "From file", nwrit);
         sw.setCompatibilityMode(false);
@@ -237,8 +235,7 @@
     }
 
     private static void closeStdHepFile() throws IOException {
-
-        sw.close();
+        if(sw!=null) sw.close();
         System.out.println("Ok...done!");
     }
 
@@ -375,9 +372,15 @@
             phep[5 * i + 4] = 0.51109989000E-03;
             if (npart == 0 && !trident) {
                 phep[5 * i + 4] = aMass;
+                /*
                 ApMom[0] = phep[5 * i + 2];
                 ApMom[1] = phep[5 * i + 1];
                 ApMom[2] = phep[5 * i + 0];
+                 * 
+                 */
+                 ApMom[0] = phep[5 * i + 0];
+                ApMom[1] = phep[5 * i + 1];
+                ApMom[2] = phep[5 * i + 2];
             }
             for (int j = 0; j < 4; j++)
                 vhep[4 * i + j] = beam[j];
@@ -394,8 +397,10 @@
                 }
             double px = phep[5 * i + 0];
             double pz = phep[5 * i + 2];
-            phep[5 * i + 0] = pz;
-            phep[5 * i + 2] = px;
+//            phep[5 * i + 0] = pz;// these two are from back in the lcsim/jlab coordinate system days
+//            phep[5 * i + 2] = px;//
+             phep[5 * i + 0] = px;
+            phep[5 * i + 2] = pz;
             //                                if (i == 0 || i == nhep - 1) {
 /*
             System.out.println(i + " st: " + isthep[i] + " id: " + idhep[i] +
@@ -482,10 +487,13 @@
                     }
 
                 // swap x and z axes...
+                /*Don't do this anymore!  We do stuff in JLAB frame now...
                 double px = phep[5 * i + 0];
                 double pz = phep[5 * i + 2];
                 phep[5 * i + 0] = pz;
                 phep[5 * i + 2] = px;
+
+                 */
             //                                if (i == 0 || i == nhep - 1) {
 //                    System.out.println(i + " st: " + isthep[i] + " id: " + idhep[i] +
 //                            " jmo: " + jmohep[2 * i] + " " + jmohep[2 * i + 1] +
CVSspam 0.2.12