Print

Print


Commit in lcsim/src/org/lcsim/recon/pfa/identifier on MAIN
SimpleNeutralParticleMaker.java+25-451.4 -> 1.5
Calibration is now done by an external class (Ron's org.lcsim.recon.cluster.util.ClusterEnergyCalculator)

lcsim/src/org/lcsim/recon/pfa/identifier
SimpleNeutralParticleMaker.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- SimpleNeutralParticleMaker.java	12 Jul 2006 17:37:31 -0000	1.4
+++ SimpleNeutralParticleMaker.java	3 Nov 2006 01:03:51 -0000	1.5
@@ -4,23 +4,30 @@
 import hep.physics.vec.Hep3Vector;
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.VecOp;
+import hep.physics.particle.properties.ParticlePropertyProvider;
+import hep.physics.particle.properties.ParticlePropertyManager;
+import hep.physics.particle.properties.ParticleType;
 import org.lcsim.event.ReconstructedParticle;
 import org.lcsim.event.EventHeader;
 import org.lcsim.util.Driver;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.base.BaseReconstructedParticle;
 import org.lcsim.event.CalorimeterHit;
-
+import org.lcsim.geometry.Detector;
+import org.lcsim.event.MCParticle;
+import org.lcsim.recon.cluster.util.ClusterEnergyCalculator;
 /**
  * Given lists of clusters, make a list of neutral ReconstructedParticles.
  *
- * Currently, PID is predetermined and the energy calibration is ad-hoc.
+ * Currently, PID is predetermined.
  *
- * @version $Id: SimpleNeutralParticleMaker.java,v 1.4 2006/07/12 17:37:31 mcharles Exp $
+ * @version $Id: SimpleNeutralParticleMaker.java,v 1.5 2006/11/03 01:03:51 mcharles Exp $
  */
 
 public class SimpleNeutralParticleMaker extends Driver
 {
+    protected EventHeader m_event;
+
     /**
      * Constructor.
      *
@@ -34,15 +41,16 @@
     public void setInputClusterList(String name){ m_inputClusterListName = name; }
     public void setOutputParticleList(String name){ m_outputParticleListName = name; }
     public void setParticleID(int pdg) { 
-	hep.physics.particle.properties.ParticlePropertyProvider mgr = 
-	    hep.physics.particle.properties.ParticlePropertyManager.getParticlePropertyProvider();
-	hep.physics.particle.properties.ParticleType type = mgr.get(pdg);
+	ParticlePropertyProvider mgr = ParticlePropertyManager.getParticlePropertyProvider();
+	ParticleType type = mgr.get(pdg);
 	m_mass = type.getMass();
     }
 
     // Process one event
     public void process(EventHeader event) 
     {
+	m_event = event;
+
 	// Input, output:
 	List<Cluster> inputClusterList = event.get(Cluster.class, m_inputClusterListName);
 	List<ReconstructedParticle> outputParticleList = new Vector<ReconstructedParticle>();
@@ -65,7 +73,7 @@
 	event.put(m_outputParticleListName, outputParticleList);
     }
 
-    private Hep3Vector computeMomentum(double energy, Cluster clus) {
+    Hep3Vector computeMomentum(double energy, Cluster clus) {
 	// Where is the cluster?
 	Hep3Vector pos = new BasicHep3Vector(clus.getPosition());
 	Hep3Vector unitDirection = VecOp.unit(pos);
@@ -82,7 +90,7 @@
     double m_mass;
 
     // This should be replaced by a central implementation
-    private class LocalReconstructedParticle extends BaseReconstructedParticle
+    class LocalReconstructedParticle extends BaseReconstructedParticle
     {
 	public void setEnergy(double e) {
 	    _fourVec.setT(e);
@@ -98,43 +106,15 @@
 	}
     }
 
-    // Ad-hoc calibration, not general
-    protected double estimateClusterEnergy(Cluster clus) {
-	double clusterEnergySum = 0.0;
-        for (CalorimeterHit hit : clus.getCalorimeterHits()) {
-            org.lcsim.geometry.Subdetector subdet = hit.getSubdetector();
-            if ( ! subdet.isCalorimeter() ) { throw new AssertionError("Cluster hit outside calorimeter"); }
-            String name = subdet.getName();
-            if (name.compareTo("EMBarrel") == 0) {
-                // EM barrel -- OK
-		clusterEnergySum += hit.getCorrectedEnergy();
-		//clusterEnergySum += hit.getRawEnergy() * 86.8;
-            } else if (name.compareTo("EMEndcap") == 0) {
-                // EM endcap -- OK
-		clusterEnergySum += hit.getCorrectedEnergy();
-		//clusterEnergySum += hit.getRawEnergy() * 86.8;
-            } else if (name.compareTo("HADBarrel") == 0) {
-                // Had barrel -- count
-		double rawEnergy = hit.getRawEnergy();
-		boolean goodHit = (hit.getTime() < 100);
-		double energyPerHit = 0.115;
-		if (goodHit) {
-		    clusterEnergySum += energyPerHit;
-		}
-            } else if (name.compareTo("HADEndcap") == 0) {
-                // Had endcap -- count
-		double rawEnergy = hit.getRawEnergy();
-		boolean goodHit = (hit.getTime() < 100);
-		double energyPerHit = 0.115;
-		if (goodHit) {
-		    clusterEnergySum += energyPerHit;
-                }
-            } else {
-                throw new AssertionError("DEBUG: Found non-calorimeterhit in calorimeter '"+subdet+"' with name '"+subdet.getName()+"'");
-            }
-        }
+    // What is the energy of the cluster?
 
-        return clusterEnergySum;
+    protected ClusterEnergyCalculator m_calib = null;
+    protected double estimateClusterEnergy(Cluster clus) {
+	return m_calib.getEnergy(clus);
     }
-    
+    /** Specify what energy calibration to use. */
+    public void setCalibration(ClusterEnergyCalculator calib) { m_calib = calib; }
+
+    boolean m_debug = false;
+    public void setDebug(boolean debug) { m_debug = debug; }
 }
CVSspam 0.2.8