Print

Print


Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/Partridge/Atlas on MAIN
MCCheck.java+44added 1.1
Plot MC eta distributions

lcsim-contrib/src/main/java/org/lcsim/contrib/Partridge/Atlas
MCCheck.java added at 1.1
diff -N MCCheck.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MCCheck.java	6 Mar 2009 23:52:17 -0000	1.1
@@ -0,0 +1,44 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.Partridge.Atlas;
+
+import hep.physics.vec.Hep3Vector;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author partridge
+ */
+public class MCCheck extends Driver {
+
+    private AIDA aida = AIDA.defaultInstance();
+
+    public MCCheck() {
+
+    }
+
+    public void process(EventHeader event) {
+        List<MCParticle> mclist = event.getMCParticles();
+        for (MCParticle mcp : mclist) {
+            Hep3Vector p = mcp.getMomentum();
+            double cth = p.z() / p.magnitude();
+            double theta = Math.acos(cth);
+            double eta = -Math.log(Math.tan(theta/2.));
+            if (mcp.getGeneratorStatus() == mcp.FINAL_STATE) {
+                aida.histogram1D("Eta distribution - all particles",50,-2.5,2.5).fill(eta, 1.);
+                if (mcp.getCharge() != 0) {
+                    String name = mcp.getType().getName();
+                    aida.histogram1D("Eta Distribution - Charged Particles",50,-2.5,2.5).fill(eta, 1.);
+                    aida.histogram1D("Eta Distribution for "+name,50,-2.5,2.5).fill(eta, 1.);
+                }
+            }
+        }
+    }
+}
CVSspam 0.2.8