Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/SteveMagill on MAIN
CalibClusterToRPDriver.java+88added 1.1

lcsim-contrib/src/main/java/org/lcsim/contrib/SteveMagill
CalibClusterToRPDriver.java added at 1.1
diff -N CalibClusterToRPDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CalibClusterToRPDriver.java	14 Feb 2012 19:36:52 -0000	1.1
@@ -0,0 +1,88 @@
+package org.lcsim.contrib.SteveMagill;
+
+import hep.aida.ITree;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.particle.properties.ParticlePropertyManager;
+import hep.physics.particle.properties.ParticleType;
+import java.util.*;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.base.BaseReconstructedParticle;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.recon.cluster.util.*;
+import static java.lang.Math.sqrt;
+import org.lcsim.event.ParticleID;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.base.BaseParticleID;
+/*
+ * SimpleClusterToReconstructedParticleExampleDriver.java
+ *
+ * Created on March 29, 2007, 1:52 PM
+ *
+ * $Id: CalibClusterToRPDriver.java,v 1.1 2012/02/14 19:36:52 magill Exp $
+ */
+
+/**
+ *
+ * @author Norman Graf
+ */
+public class CalibClusterToRPDriver extends Driver
+{
+    private AIDA aida = AIDA.defaultInstance();
+    private ITree _tree;
+    private String _clusternames;
+    private String _allrecoparticles;
+    private double _cfactor;
+    
+    /** Creates a new instance of SimpleClusterToReconstructedParticleExampleDriver */
+    public CalibClusterToRPDriver(double cfactor)
+    {
+        _tree = aida.tree();
+        _cfactor = cfactor;
+    }
+    
+    protected void process(EventHeader event)
+    {
+
+        // array of ReconstructedParticles to add to the event...
+        List<ReconstructedParticle> rpList = new ArrayList<ReconstructedParticle>();
+
+        //  get clusters
+        List<BasicCluster> cclusters = event.get(BasicCluster.class,_clusternames);
+        for (BasicCluster cclus : cclusters)
+        {
+            double ClE = _cfactor*cclus.getEnergy();
+//            aida.cloud1D("Cluster E in RP routine").fill(ClE);
+            double[] pos = cclus.getPosition();
+            double norm = sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);
+            double p = ClE/norm;
+            Hep3Vector mom = new BasicHep3Vector(p*pos[0], p*pos[1], p*pos[2]);
+            BaseReconstructedParticle rp = new BaseReconstructedParticle(ClE, mom);
+            rp.setMass(0.);
+            rp.setCharge(0.);
+            //  classify as photon type for now until better estimate
+            ParticleType photype = ParticlePropertyManager.getParticlePropertyProvider().get(22);
+            ParticleID id = new BaseParticleID(photype);
+            rp.addParticleID(id);
+            rp.setParticleIdUsed(id);
+            rp.addCluster(cclus);
+            rpList.add(rp);
+        }
+        
+        // add the list of rps to the event...
+        event.put(_allrecoparticles,rpList, ReconstructedParticle.class,0);
+        //some simple histograms...
+//        aida.cloud1D("Number of AllRecoParticles found").fill(rpList.size());
+        
+    }
+    
+  public void setClusterNames(String cnames)
+  {
+      _clusternames = cnames;
+  }
+  public void setRecoParticleName(String allRPname)
+  {
+      _allrecoparticles = allRPname;
+  }
+}
\ No newline at end of file
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1