LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  February 2015

HPS-SVN February 2015

Subject:

r2107 - in /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster: HardwareClusterPropertyCalculator.java ReconClusterPropertyCalculator.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 11 Feb 2015 19:51:16 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (125 lines)

Author: [log in to unmask]
Date: Wed Feb 11 11:51:12 2015
New Revision: 2107

Log:
Adding HPS specific cluster property calculators.  (Not used in reconstruction right now.)

Added:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/HardwareClusterPropertyCalculator.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterPropertyCalculator.java

Added: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/HardwareClusterPropertyCalculator.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/HardwareClusterPropertyCalculator.java	(added)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/HardwareClusterPropertyCalculator.java	Wed Feb 11 11:51:12 2015
@@ -0,0 +1,42 @@
+package org.hps.recon.ecal.cluster;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hps.recon.ecal.cluster.ClusterUtilities.UniqueEnergyComparator;
+import static org.hps.recon.ecal.cluster.ClusterUtilities.isHardwareCluster;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.base.AbstractClusterPropertyCalculator;
+
+/**
+ * Cluster property calculator for hardware clusters.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class HardwareClusterPropertyCalculator extends AbstractClusterPropertyCalculator {
+
+    @Override
+    public void calculateProperties(List<CalorimeterHit> hits) {        
+        reset();        
+        List<CalorimeterHit> sortedHits = new ArrayList<CalorimeterHit>(hits);
+        Collections.sort(sortedHits, new UniqueEnergyComparator());   
+        CalorimeterHit seedHit = sortedHits.get(0);
+        this.position = new double[] {seedHit.getPosition()[0], seedHit.getPosition()[1], seedHit.getPosition()[2]};
+    }
+
+    @Override
+    public void calculateProperties(Cluster cluster) {        
+        reset();       
+        if (isHardwareCluster(cluster)) {
+            setPositionFromSeedHit(cluster);
+        } else {
+            throw new IllegalArgumentException("The cluster has the wrong type: " + ClusterType.getClusterType(cluster.getType()).toString());
+        }
+    }
+    
+    void setPositionFromSeedHit(Cluster cluster) {
+        CalorimeterHit seedHit = ClusterUtilities.findSeedHit(cluster);
+        this.position = new double[] {seedHit.getPosition()[0], seedHit.getPosition()[1], seedHit.getPosition()[2]};
+    }          
+}

Added: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterPropertyCalculator.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterPropertyCalculator.java	(added)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterPropertyCalculator.java	Wed Feb 11 11:51:12 2015
@@ -0,0 +1,60 @@
+package org.hps.recon.ecal.cluster;
+
+import hep.physics.vec.Hep3Vector;
+
+import java.util.List;
+
+import org.lcsim.detector.converter.compact.EcalCrystal;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.base.AbstractClusterPropertyCalculator;
+
+class ReconClusterPropertyCalculator extends AbstractClusterPropertyCalculator {
+
+    public void calculateProperties(List<CalorimeterHit> hits) {
+        // This is unsupported because the cluster's energy is required for the position algorithm. 
+        throw new IllegalArgumentException("This method is not supported for recon clustering.");
+    }
+    
+    /**
+     * Calculates the position of each cluster with no correction for particle type, 
+     * as documented in HPS Note 2014-001.
+     * @param cluster The input Cluster.
+     */
+    public void calculateProperties(Cluster cluster) {
+        
+        reset();
+        
+        // Calculate the position of the cluster.
+        calculatePosition(cluster);
+    }
+
+    private void calculatePosition(Cluster cluster) {
+        final double w0 = 3.1;
+        double xCl = 0.0;
+        // calculated cluster y position
+        double yCl = 0.0;
+        double eNumX = 0.0;
+        double eNumY = 0.0;
+        double eDen = 0.0;
+        List<CalorimeterHit> clusterHits = cluster.getCalorimeterHits();
+        for (CalorimeterHit hit : clusterHits) {
+            
+            EcalCrystal crystal = (EcalCrystal) hit.getDetectorElement();
+            Hep3Vector crystalPosition = crystal.getPositionFront();
+            
+            eNumX += Math.max(0.0, (w0 + Math.log(hit.getCorrectedEnergy() / cluster.getEnergy()))) * (crystalPosition.x() / 10.0);
+            eNumY += Math.max(0.0, (w0 + Math.log(hit.getCorrectedEnergy() / cluster.getEnergy()))) * (crystalPosition.y() / 10.0);
+            eDen += Math.max(0.0, (w0 + Math.log(hit.getCorrectedEnergy() / cluster.getEnergy())));
+
+        } // end for iteration through clusterHits
+
+        xCl = eNumX / eDen;
+        yCl = eNumY / eDen;
+
+        position[0] = xCl * 10.0;// mm
+        position[1] = yCl * 10.0;// mm        
+        CalorimeterHit seedHit = clusterHits.get(0);
+        this.position[2] = ((EcalCrystal)seedHit.getDetectorElement()).getPositionFront().z();
+    }    
+}

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use