Commit in lcsim/src/org/lcsim/contrib/SteveKuhlmann on MAIN
ZPoleMCFilter.java+79added 1.1
Z pole MC filter

lcsim/src/org/lcsim/contrib/SteveKuhlmann
ZPoleMCFilter.java added at 1.1
diff -N ZPoleMCFilter.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ZPoleMCFilter.java	6 Dec 2005 16:48:07 -0000	1.1
@@ -0,0 +1,79 @@
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.SimCalorimeterHit;
+import org.lcsim.recon.cluster.util.BasicCluster;
+import org.lcsim.util.Driver;
+
+/*
+ * ZPoleMCFilter
+ */
+
+public class ZPoleMCFilter extends Driver
+{
+     
+    protected void process(EventHeader event)
+    {
+      int npho=0;  int nneu=0;  int nchar=0;
+      double phoE = 0;  double neuE = 0;  double charE = 0; double totE=0;
+      List<MCParticle> mcobs = event.getMCParticles();
+      for (MCParticle mcob : mcobs)
+      {
+          //  must be final state particle
+          if (mcob.getGeneratorStatus() != mcob.FINAL_STATE) continue;
+          // must be charged particle
+          int iqob = (int)mcob.getCharge();
+          double mcppx = mcob.getPX();
+          double mcppy = mcob.getPY();
+          double mcppz = mcob.getPZ();
+          double mcpE = mcob.getEnergy();
+          double mckE = mcob.getEnergy()-mcob.getMass();
+          double mcpmt = Math.sqrt(mcppx*mcppx+mcppy*mcppy+mcppz*mcppz);
+          double mcpct = mcppz/mcpmt;
+          double mcppt = Math.sqrt(mcppx*mcppx+mcppy*mcppy);
+          if (Math.abs(mcpct)>0.8) continue;
+          if (iqob == 0)
+          {
+              int pid = Math.abs(mcob.getType().getPDGID());
+              // if photon, count up number, E
+              if (pid == 22)
+              {
+                  npho++;
+                  phoE += mcpE;
+              }
+              // if neutron or Klong, count up
+              if (pid == 2112 | pid==130 || pid==310 || pid==311)
+              {
+                  nneu++;
+                  neuE += mcpE;
+              }
+          } else
+          {
+              // its charged
+              int pid = Math.abs(mcob.getType().getPDGID());
+              if (mcppt > 0.9525)
+              {
+                  nchar++;
+                  charE += mcpE;
+              }
+          }
+      }
+      totE = neuE+charE+phoE;
+      if (totE > 85)
+      {
+        BTrMipClustersNoMCCut   test2  = new BTrMipClustersNoMCCut();
+        add(test2); 
+        super.process(event);
+        remove(test2);
+      }
+
+    }
+    public String toString()
+    {
+        return "ZPoleMCFilter";
+    }
+}
CVSspam 0.2.8