Commit in lcsim/src/org/lcsim/contrib/SteveKuhlmann on MAIN
MakeClusterIDInputLCSIM.java+71added 1.1
This code is also needed to run ClusterID

lcsim/src/org/lcsim/contrib/SteveKuhlmann
MakeClusterIDInputLCSIM.java added at 1.1
diff -N MakeClusterIDInputLCSIM.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MakeClusterIDInputLCSIM.java	17 Aug 2005 20:28:05 -0000	1.1
@@ -0,0 +1,71 @@
+/*
+ * MakeClusterIDInputLCSIM.java
+ *
+ * Created on Au 15, 2002, 3:22 PM
+ */
+
+
+import hep.analysis.*;
+import org.lcsim.event.*;
+import org.lcsim.recon.cluster.util.*;
+
+import java.lang.Exception;
+/**
+ *
+ * @author  grb
+ */
+public class MakeClusterIDInputLCSIM
+{   
+   public MakeClusterIDInputLCSIM()
+   {
+   }
+   
+   public double[] getInput(BasicCluster c)
+   {
+      TensorClusterPropertyCalculator cpc = new TensorClusterPropertyCalculator();
+      cpc.calculateProperties(c.getCalorimeterHits());
+      double[] input = new double[15]; for(int i=0; i<15; i++) {input[i]=0.;}
+      double clusEtot = c.getEnergy();
+      int nhits = c.getCalorimeterHits().size();
+      double[] NE = cpc.getNormalizedEigenvalues();
+//      // Now find angular separation between IP and direction of principal axis #1
+//      // from ceneter of energy of cluster.
+      double[][] PA = cpc.getPrincipleAxis();
+//      // Parameterize principal axis through origin by x = c1*t, y = c2*t, z= c3*t
+//      // where cs are direction cosines from PA.
+//      // Find t where distance between principal axis and center of cluster energy
+//      // is a minimum.
+      double[] CE = c.getPosition();
+      double CEstar = Math.abs(CE[0]) + Math.abs(CE[1]) + Math.abs(CE[2]);
+      double num = 0.0;
+      double den = 0.0;
+      for ( int i = 0 ; i < 3 ; i++ )
+      {
+         num += CE[i]*PA[0][i];
+         den += PA[0][i]*PA[0][i];
+      }
+      double t = num/den;
+      // Now find separation distance and angular separation.
+      double sep = 0.0;
+      for ( int i = 0; i < 3 ; i++ )
+      {
+         sep += (PA[0][i]*t - CE[i])*(PA[0][i]*t - CE[i]);
+      }
+      sep = Math.sqrt(sep);
+      double radius = Math.sqrt(CE[0]*CE[0]+CE[1]*CE[1]);
+      double angsep = Math.asin(sep/radius);
+//      double[] contribE = c.getContributedEnergy();
+// //     MCParticle[] contribPart = c.getMCParticles();
+// //     int pdgid = Math.abs(contribPart[0].getType().getPDGID());
+      input[0] = NE[0];
+      input[1] = NE[1];
+      input[2] = NE[2];
+      input[3] = NE[0]/NE[1];
+      input[4] = NE[1]/NE[2];
+      input[10] = angsep*10000;
+      input[12] = nhits;
+      input[13] = clusEtot;
+      input[14] = CE[2];
+      return input;
+   }
+}
CVSspam 0.2.8