Print

Print


Commit in lcsim/src/org/lcsim/recon/pfa/structural on MAIN
FuzzyQNeutralHadronClusterEnergyCalculator.java+95added 1.1
FuzzyQPhotonClusterEnergyCalculator.java+87added 1.1
+182
2 added files
MJC: Modify Ron's new calibrations to allow for fuzzy hits

lcsim/src/org/lcsim/recon/pfa/structural
FuzzyQNeutralHadronClusterEnergyCalculator.java added at 1.1
diff -N FuzzyQNeutralHadronClusterEnergyCalculator.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FuzzyQNeutralHadronClusterEnergyCalculator.java	27 Mar 2008 18:15:28 -0000	1.1
@@ -0,0 +1,95 @@
+package org.lcsim.recon.pfa.structural;
+
+import java.util.*;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.conditions.*;
+import org.lcsim.recon.cluster.util.*;
+
+/**
+  * Custom calibration designed for neutral hadrons which allows
+  * for hits to be weighted -- i.e. to be shared among multiple
+  * clusters such that the total weight adds up to 1. This is
+  * an extension of Ron's QNeutralHadronClusterEnergyCalculator
+  * class.
+  * 
+  * @version $Id: FuzzyQNeutralHadronClusterEnergyCalculator.java,v 1.1 2008/03/27 18:15:28 mcharles Exp $
+  */
+
+public class FuzzyQNeutralHadronClusterEnergyCalculator extends QNeutralHadronClusterEnergyCalculator
+{
+    /** Simple constructor. */
+    public FuzzyQNeutralHadronClusterEnergyCalculator() {
+        super();
+    }
+
+    /** Find the energy of this cluster. */
+    public double getEnergy(Cluster c)
+    {
+        if (_mgr == null)
+        {
+            init();
+        }
+        double EmeasEst = 0.;
+        for(CalorimeterHit hit:c.getCalorimeterHits())
+        {
+            double hitWeight = 1.0;
+            if (hit instanceof FuzzyCalorimeterHit) {
+                hitWeight = ((FuzzyCalorimeterHit)(hit)).getWeight();
+            }
+            int index = -1;
+            IDDecoder idc = hit.getIDDecoder();
+            idc.setID(hit.getCellID());
+            int detector_index = idc.getValue("system");
+            if(detector_index == 2)
+            {
+                int layer = idc.getValue("layer");
+                if(layer < nFrontLayersEcal)
+                {
+                    index = 0;
+                    EmeasEst += hitWeight * (hit.getRawEnergy()/sf[index]);
+                }
+                else
+                {
+                    index = 1;
+                    EmeasEst += hitWeight * (hit.getRawEnergy()/sf[index]);
+                }
+            }
+            else if(detector_index == 6)
+            {
+                int layer = idc.getValue("layer");
+                if(layer < nFrontLayersEcal)
+                {
+                    index = 2;
+                    EmeasEst += hitWeight * (hit.getRawEnergy()/sf[index]);
+                }
+                else
+                {
+                    index = 3;
+                    EmeasEst += hitWeight * (hit.getRawEnergy()/sf[index]);
+                }
+            }
+            else if(detector_index == 3)
+            {
+                double[] pos = hit.getPosition();
+                double R = Math.sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);
+                double ctheta = Math.abs(pos[2])/R;
+                double st = Math.sqrt(1.-ctheta*ctheta);
+                EmeasEst += hitWeight * ((1./(1. + alpha*(1./st - 1.)))/sf[4]);
+            }
+            else if(detector_index == 7)
+            {
+                double[] pos = hit.getPosition();
+                double R = Math.sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);
+                double st = Math.abs(pos[2])/R;
+                EmeasEst += hitWeight * ((1./(1. + alpha*(1./st - 1.)))/sf[5]);
+            }
+        }
+//
+// Now invert
+//
+        double Emeas = linext(EmeasEst);
+        return Emeas;
+    }
+}

lcsim/src/org/lcsim/recon/pfa/structural
FuzzyQPhotonClusterEnergyCalculator.java added at 1.1
diff -N FuzzyQPhotonClusterEnergyCalculator.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ FuzzyQPhotonClusterEnergyCalculator.java	27 Mar 2008 18:15:28 -0000	1.1
@@ -0,0 +1,87 @@
+package org.lcsim.recon.pfa.structural;
+
+import java.util.*;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.geometry.IDDecoder;
+import org.lcsim.conditions.*;
+import org.lcsim.recon.cluster.util.QPhotonClusterEnergyCalculator;
+
+/**
+  * Custom calibration designed for photons which allows
+  * for hits to be weighted -- i.e. to be shared among multiple
+  * clusters such that the total weight adds up to 1. This is
+  * an extension of Ron's QPhotonClusterEnergyCalculator class.
+  *
+  * @version $Id: FuzzyQPhotonClusterEnergyCalculator.java,v 1.1 2008/03/27 18:15:28 mcharles Exp $
+  */
+
+public class FuzzyQPhotonClusterEnergyCalculator extends QPhotonClusterEnergyCalculator
+{
+    /** Simple constructor. */
+    public FuzzyQPhotonClusterEnergyCalculator() {
+	super();
+    }
+
+    /** Find the energy of this cluster. */
+    public double getEnergy(Cluster c)
+    {
+        if (_mgr == null)
+        {
+            init();
+        }
+        double EmeasEst = 0.;
+        for(CalorimeterHit hit:c.getCalorimeterHits())
+        {
+	    double hitWeight = 1.0;
+	    if (hit instanceof FuzzyCalorimeterHit) {
+		hitWeight = ((FuzzyCalorimeterHit)(hit)).getWeight();
+	    }
+            int index = -1;
+            IDDecoder idc = hit.getIDDecoder();
+            idc.setID(hit.getCellID());
+            int detector_index = idc.getValue("system");
+            double[] pos = hit.getPosition();
+            double R = Math.sqrt(pos[0]*pos[0]+pos[1]*pos[1]+pos[2]*pos[2]);
+            double ctheta = Math.abs(pos[2])/R;
+            double st = Math.sqrt(1.-ctheta*ctheta);
+            double cb = 1. + alpha*(1./st - 1.);
+            double ce = 1. + alpha*(1./ctheta - 1.);
+            double cc = cb;
+            if(detector_index == 2)
+            {
+                int layer = idc.getValue("layer");
+                if(layer < nFrontLayersEcal)
+                {
+                    index = 0;
+                }
+                else
+                {
+                    index = 1;
+                }
+            }
+            else if(detector_index == 6)
+            {
+                cc = ce;
+                int layer = idc.getValue("layer");
+                if(layer < nFrontLayersEcal)
+                {
+                    index = 2;
+                }
+                else
+                {
+                    index = 3;
+                }
+            }
+            if(index > -1)
+            {
+                EmeasEst += hitWeight * ((hit.getRawEnergy()/sf[index])/cc);
+            }
+        }
+//
+// Now invert
+//
+        double Emeas = linext(EmeasEst);
+        return Emeas;
+    }
+}
CVSspam 0.2.8