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  October 2015

HPS-SVN October 2015

Subject:

r3822 - in /java/trunk: detector-model/src/main/java/org/hps/detector/ecal/ detector-model/src/main/java/org/hps/detector/svt/ detector-model/src/main/java/org/lcsim/detector/converter/compact/ detector-model/src/test/java/org/hps/detector/ecal/ detector-model/src/test/java/org/lcsim/detector/converter/compact/ ecal-recon/src/main/java/org/hps/recon/ecal/ ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/ users/src/main/java/org/hps/users/jeremym/

From:

[log in to unmask]

Reply-To:

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

Date:

Fri, 9 Oct 2015 05:33:09 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (660 lines)

Author: [log in to unmask]
Date: Thu Oct  8 22:33:03 2015
New Revision: 3822

Log:
Move around some detector classes so the packages make more sense.

Added:
    java/trunk/detector-model/src/main/java/org/hps/detector/ecal/CrystalRange.java
    java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystal.java
      - copied, changed from r3816, java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java
    java/trunk/detector-model/src/main/java/org/hps/detector/ecal/HPSEcalAPI.java
      - copied, changed from r3808, java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalAPI.java
    java/trunk/detector-model/src/main/java/org/hps/detector/ecal/HPSEcalDetectorElement.java
      - copied, changed from r3816, java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalDetectorElement.java
    java/trunk/detector-model/src/test/java/org/hps/detector/ecal/
    java/trunk/detector-model/src/test/java/org/hps/detector/ecal/HPSEcalAPITest.java
      - copied, changed from r3808, java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSEcalAPITest.java
Removed:
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalAPI.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalDetectorElement.java
    java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSEcalAPITest.java
Modified:
    java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystalChannelMap.java
    java/trunk/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java
    java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcal3Converter.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/CalorimeterHitUtilities.java
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterPropertyCalculator.java
    java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalDaqPlots.java
    java/trunk/users/src/main/java/org/hps/users/jeremym/ClusterHitCheckDriver.java
    java/trunk/users/src/main/java/org/hps/users/jeremym/EcalRawModeMipAnalysisDriver.java

Added: java/trunk/detector-model/src/main/java/org/hps/detector/ecal/CrystalRange.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/hps/detector/ecal/CrystalRange.java	(added)
+++ java/trunk/detector-model/src/main/java/org/hps/detector/ecal/CrystalRange.java	Thu Oct  8 22:33:03 2015
@@ -0,0 +1,55 @@
+package org.hps.detector.ecal;
+
+import org.jdom.Element;
+
+public class CrystalRange {
+
+    int xIndexMax;
+    int xIndexMin;
+    int yIndexMax;
+    int yIndexMin;
+
+    public CrystalRange(final Element elem) throws Exception {
+        xIndexMin = xIndexMax = yIndexMin = yIndexMax = 0;
+
+        if (elem.getAttribute("ixmin") != null) {
+            xIndexMin = elem.getAttribute("ixmin").getIntValue();
+        } else {
+            throw new RuntimeException("Missing ixmin parameter.");
+        }
+
+        if (elem.getAttribute("ixmax") != null) {
+            xIndexMax = elem.getAttribute("ixmax").getIntValue();
+        } else {
+            throw new RuntimeException("Missing ixmax parameter.");
+        }
+
+        if (elem.getAttribute("iymin") != null) {
+            yIndexMin = elem.getAttribute("iymin").getIntValue();
+        } else {
+            throw new RuntimeException("Missing ixmax parameter.");
+        }
+
+        if (elem.getAttribute("iymax") != null) {
+            yIndexMax = elem.getAttribute("iymax").getIntValue();
+        } else {
+            throw new RuntimeException("Missing iymax parameter.");
+        }
+    }
+    
+    public int getXIndexMax() {
+        return xIndexMax;
+    }
+    
+    public int getYIndexMax() {
+        return yIndexMax;
+    }
+    
+    public int getXIndexMin() {
+        return xIndexMin;
+    }
+    
+    public int getYIndexMin() {
+        return yIndexMin;
+    }
+}

Copied: java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystal.java (from r3816, java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java)
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java	(original)
+++ java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystal.java	Thu Oct  8 22:33:03 2015
@@ -1,4 +1,4 @@
-package org.lcsim.detector.converter.compact;
+package org.hps.detector.ecal;
 
 import hep.physics.vec.BasicHep3Vector;
 import hep.physics.vec.Hep3Vector;
@@ -11,13 +11,12 @@
 import org.lcsim.detector.solids.Trd;
 
 /**
- * This class implements behavior specific to the ECal crystals of the HPS experiment, 
- * which includes access to time dependent conditions as well as DAQ setup information.
+ * This class implements the geometry API for ECal crystals in the HPS experiment. 
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public class EcalCrystal extends DetectorElement {
     
-    Hep3Vector positionFront;
+    private Hep3Vector positionFront;
 
     /**
      * Class constructor.
@@ -26,7 +25,7 @@
      * @param path The physical path.
      * @param id The component's ID.
      */
-    EcalCrystal(String name, IDetectorElement parent, String path, IIdentifier id) {
+    public EcalCrystal(String name, IDetectorElement parent, String path, IIdentifier id) {
         super(name, parent, path, id);
     }
     

Modified: java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystalChannelMap.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystalChannelMap.java	(original)
+++ java/trunk/detector-model/src/main/java/org/hps/detector/ecal/EcalCrystalChannelMap.java	Thu Oct  8 22:33:03 2015
@@ -5,8 +5,6 @@
 
 import org.hps.conditions.ecal.EcalChannel;
 import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
-import org.lcsim.detector.converter.compact.EcalCrystal;
-import org.lcsim.detector.converter.compact.HPSEcalAPI;
 
 /**
  * This is a convenience utility for associating the geometric crystal objects with the conditions system channel

Copied: java/trunk/detector-model/src/main/java/org/hps/detector/ecal/HPSEcalAPI.java (from r3808, java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalAPI.java)
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalAPI.java	(original)
+++ java/trunk/detector-model/src/main/java/org/hps/detector/ecal/HPSEcalAPI.java	Thu Oct  8 22:33:03 2015
@@ -1,4 +1,4 @@
-package org.lcsim.detector.converter.compact;
+package org.hps.detector.ecal;
 
 import hep.physics.vec.Hep3Vector;
 
@@ -74,7 +74,7 @@
     EcalCrystal getCrystal(IIdentifier id);
     
     /**
-     * Get the crystal at the given position in global coordinates or null if position
+     * Get the crystal at the given position in global coordinates or <code>null</code> if position
      * is not inside a crystal's volume.
      * @param position The position of the crystal.
      * @return The crystal at the given position or null if position is not inside crystal.

Copied: java/trunk/detector-model/src/main/java/org/hps/detector/ecal/HPSEcalDetectorElement.java (from r3816, java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalDetectorElement.java)
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcalDetectorElement.java	(original)
+++ java/trunk/detector-model/src/main/java/org/hps/detector/ecal/HPSEcalDetectorElement.java	Thu Oct  8 22:33:03 2015
@@ -1,4 +1,4 @@
-package org.lcsim.detector.converter.compact;
+package org.hps.detector.ecal;
 
 import hep.physics.vec.Hep3Vector;
 
@@ -10,7 +10,7 @@
 
 import org.lcsim.detector.IDetectorElement;
 import org.lcsim.detector.IDetectorElementContainer;
-import org.lcsim.detector.converter.compact.HPSEcal3Converter.CrystalRange;
+import org.lcsim.detector.converter.compact.SubdetectorDetectorElement;
 import org.lcsim.detector.identifier.IExpandedIdentifier;
 import org.lcsim.detector.identifier.IIdentifier;
 import org.lcsim.detector.identifier.IIdentifierHelper;
@@ -32,18 +32,18 @@
  */
 public final class HPSEcalDetectorElement extends SubdetectorDetectorElement implements HPSEcalAPI {
         
-    Map<EcalCrystal, List<EcalCrystal>> neighborMap;
-    
-    int xIndexMax = Integer.MIN_VALUE;
-    int xIndexMin = Integer.MAX_VALUE;
-    int yIndexMax = Integer.MIN_VALUE;
-    int yIndexMin = Integer.MAX_VALUE;
-    
-    List<Integer> xIndices;
-    List<Integer> yIndices;
-    
-    CrystalRange beamGap;
-                         
+    private Map<EcalCrystal, List<EcalCrystal>> neighborMap;
+    
+    private int xIndexMax = Integer.MIN_VALUE;
+    private int xIndexMin = Integer.MAX_VALUE;
+    private int yIndexMax = Integer.MIN_VALUE;
+    private int yIndexMin = Integer.MAX_VALUE;
+    
+    private List<Integer> xIndices;
+    private List<Integer> yIndices;
+    
+    private CrystalRange beamGap;
+                            
     public HPSEcalDetectorElement(String name, IDetectorElement parent) {
         super(name, parent);
     }
@@ -52,7 +52,7 @@
      * Set the index range for the beam gap.
      * @param beamGap The beam gap index range.
      */
-    void setBeamGapIndices(CrystalRange beamGap) {
+    public void setBeamGapIndices(CrystalRange beamGap) {
         this.beamGap = beamGap;
     }
     
@@ -126,22 +126,29 @@
                                          
     @Override
     public EcalCrystal getCrystal(int xIndex, int yIndex) {
+        //System.out.println("getCrystal: " + xIndex + " " + yIndex);
+        /*
+        for (EcalCrystal crystal : this.getCrystals()) {
+            if (crystal.getX() == xIndex && crystal.getY() == yIndex) {
+                //System.out.println("found crystal at " + xIndex + " " + yIndex);
+                return crystal;
+            }
+        } 
+        */       
+        //return null;
         IIdentifierHelper helper = getIdentifierHelper();
         IExpandedIdentifier expId = helper.createExpandedIdentifier();
         expId.setValue(helper.getFieldIndex("ix"), xIndex);
         expId.setValue(helper.getFieldIndex("iy"), yIndex);
         expId.setValue(helper.getFieldIndex("system"), getSystemID());
+        System.out.println("getting crystal at x, y, system: " + xIndex + " " + yIndex + " " + getSystemID());
         return getCrystal(helper.pack(expId));
     }
-
+    
     @Override
     public EcalCrystal getCrystal(IIdentifier id) {
         IDetectorElementContainer de = findDetectorElement(id);
-        if (de == null || de.isEmpty()) {
-            return null;
-        } else {
-            return (EcalCrystal) de.get(0);
-        }
+        return de.isEmpty() ? null : (EcalCrystal) de.get(0);
     }    
           
     @Override
@@ -185,17 +192,11 @@
                 yIndexMin = crystal.getY();
             }
         }
-        //System.out.println("computed index boundaries ...");
-        //System.out.println("maxIndexX = " + xIndexMax);
-        //System.out.println("minIndexX = " + xIndexMin);
-        //System.out.println("maxIndexY = " + yIndexMax);
-        //System.out.println("minIndexY = " + yIndexMin);
-        
+                
         xIndices = new ArrayList<Integer>();
         for (int ix = xIndexMin; ix <= xIndexMax; ix++) {
             if (ix == 0)
                 continue;
-            //System.out.println("adding ix = " + ix);
             xIndices.add(ix);
         }
         
@@ -203,7 +204,6 @@
         for (int iy = yIndexMin; iy <= yIndexMax; iy++) {
             if (iy == 0)
                 continue;
-            //System.out.println("adding iy = " + iy);
             yIndices.add(iy);
         }
     }
@@ -226,20 +226,22 @@
      * which automatically takes care of edge crystals and missing crystals from the beam gap
      * without explicitly needing to check those indices for validity.
      */
-    void createNeighborMap() {
+    private void createNeighborMap() {
         neighborMap = new HashMap<EcalCrystal, List<EcalCrystal>>();
         for (EcalCrystal crystal : getCrystals()) {            
-            //System.out.println("find neighbors for " + crystal.getName() + " @ " + crystal.getX() + " " + crystal.getY());            
-            List<EcalCrystal> neighborCrystals = new ArrayList<EcalCrystal>();                        
+            System.out.println("finding neighbors for " + crystal.getName() + " @ " + crystal.getX() + " " + crystal.getY());
+            List<EcalCrystal> neighborCrystals = new ArrayList<EcalCrystal>();
             for (NeighborDirection neighborDirection : NeighborDirection.values()) {
                 int[] xy = getNeighborIndices(crystal, neighborDirection);
                 EcalCrystal neighborCrystal = getCrystal(xy[0], xy[1]);
                 if (neighborCrystal != null) {
-                    //System.out.println("  adding neighbor @ " + neighborCrystal.getX() + " " + neighborCrystal.getY());
+                    System.out.println("  adding neighbor @ " + neighborCrystal.getX() + " " + neighborCrystal.getY());
                     neighborCrystals.add(neighborCrystal);
                 } 
             }            
+            System.out.println("found " + neighborCrystals.size() + " neighbors");
             neighborMap.put(crystal, neighborCrystals);            
+            System.out.println();
         }
     }
               
@@ -249,7 +251,7 @@
      * @param direction The direction of the neighbor from integer encoding.
      * @return The neighbor indices.
      */   
-    int[] getNeighborIndices(EcalCrystal crystal, NeighborDirection direction) {
+    private static int[] getNeighborIndices(EcalCrystal crystal, NeighborDirection direction) {
         int[] xy = new int[2];
         int ix = crystal.getX();
         int iy = crystal.getY();

Modified: java/trunk/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java	(original)
+++ java/trunk/detector-model/src/main/java/org/hps/detector/svt/SvtDetectorSetup.java	Thu Oct  8 22:33:03 2015
@@ -84,7 +84,6 @@
      */
     @Override
     public void conditionsChanged(final ConditionsEvent event) {
-        LOGGER.info("conditions changed hook activated");
         if (this.enabled) {
             final DatabaseConditionsManager manager = (DatabaseConditionsManager) event.getConditionsManager();
             final Subdetector subdetector = manager.getDetectorObject().getSubdetector(this.svtName);
@@ -101,7 +100,7 @@
                     this.loadDefault(subdetector, svtConditions);
                 }
             } else {
-                LOGGER.warning("no SVT detector was found so SvtDetectorSetup was NOT activated");
+                LOGGER.warning("no SVT detector was found so setup was NOT activated");
                 this.enabled = false;
             }
         } else {

Modified: java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcal3Converter.java
 =============================================================================
--- java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcal3Converter.java	(original)
+++ java/trunk/detector-model/src/main/java/org/lcsim/detector/converter/compact/HPSEcal3Converter.java	Thu Oct  8 22:33:03 2015
@@ -9,6 +9,9 @@
 import java.util.List;
 import java.util.logging.Logger;
 
+import org.hps.detector.ecal.CrystalRange;
+import org.hps.detector.ecal.EcalCrystal;
+import org.hps.detector.ecal.HPSEcalDetectorElement;
 import org.jdom.DataConversionException;
 import org.jdom.Element;
 import org.lcsim.detector.IDetectorElement;
@@ -34,65 +37,29 @@
 
 public class HPSEcal3Converter extends AbstractSubdetectorConverter {
 
-    private static Logger LOGGER = Logger.getLogger(HPSEcal3Converter.class.toString());
-    
-    static class CrystalRange {
-
-        int xIndexMax;
-        int xIndexMin;
-        int yIndexMax;
-        int yIndexMin;
-
-        CrystalRange(final Element elem) throws Exception {
-            xIndexMin = xIndexMax = yIndexMin = yIndexMax = 0;
-
-            if (elem.getAttribute("ixmin") != null) {
-                xIndexMin = elem.getAttribute("ixmin").getIntValue();
-            } else {
-                throw new RuntimeException("Missing ixmin parameter.");
-            }
-
-            if (elem.getAttribute("ixmax") != null) {
-                xIndexMax = elem.getAttribute("ixmax").getIntValue();
-            } else {
-                throw new RuntimeException("Missing ixmax parameter.");
-            }
-
-            if (elem.getAttribute("iymin") != null) {
-                yIndexMin = elem.getAttribute("iymin").getIntValue();
-            } else {
-                throw new RuntimeException("Missing ixmax parameter.");
-            }
-
-            if (elem.getAttribute("iymax") != null) {
-                yIndexMax = elem.getAttribute("iymax").getIntValue();
-            } else {
-                throw new RuntimeException("Missing iymax parameter.");
-            }
-        }
-    }
-
-    static final double crystalToleranceX = 0.2;
+    private static Logger LOGGER = Logger.getLogger(HPSEcal3Converter.class.getPackage().getName());
+        
+    private static final double crystalToleranceX = 0.2;
     // Tolerance factor for separating crystals to avoid overlaps.
-    static final double crystalToleranceY = 0.35;
+    private static final double crystalToleranceY = 0.35;
 
     // Margin for mother volume.
-    static final double margin = 1.1;
+    //private static final double margin = 1.1;
 
     // Tolerance factor for moving crystals to appropriate place in mom volume.
-    static final double tolerance = 0.0;
-
-    IIdentifierDictionary dict;
-    IIdentifierHelper helper;
-
-    List<CrystalRange> ranges = new ArrayList<CrystalRange>();
+    private static final double tolerance = 0.0;
+
+    private IIdentifierDictionary dict;
+    private IIdentifierHelper helper;
+
+    private List<CrystalRange> ranges = new ArrayList<CrystalRange>();
 
     private boolean checkRange(final int ix, final int iy, final List<CrystalRange> ranges) {
         if (ranges.size() == 0) {
             return true;
         }
         for (final CrystalRange range : ranges) {
-            if (ix >= range.xIndexMin && ix <= range.xIndexMax && iy >= range.yIndexMin && iy <= range.yIndexMax) {
+            if (ix >= range.getXIndexMin() && ix <= range.getXIndexMax() && iy >= range.getYIndexMin() && iy <= range.getYIndexMax()) {
                 return false;
             }
 
@@ -356,9 +323,6 @@
             ycorrtot += ycorr;
             zcorrtoty += zcorry;
         }
-
-        // Initialize state of ECal detector element.
-        ((HPSEcalDetectorElement) subdet.getDetectorElement()).initialize();
     }
 
     /**

Copied: java/trunk/detector-model/src/test/java/org/hps/detector/ecal/HPSEcalAPITest.java (from r3808, java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSEcalAPITest.java)
 =============================================================================
--- java/trunk/detector-model/src/test/java/org/lcsim/detector/converter/compact/HPSEcalAPITest.java	(original)
+++ java/trunk/detector-model/src/test/java/org/hps/detector/ecal/HPSEcalAPITest.java	Thu Oct  8 22:33:03 2015
@@ -1,28 +1,111 @@
-package org.lcsim.detector.converter.compact;
+package org.hps.detector.ecal;
 
 import java.io.InputStream;
 import java.util.List;
+import java.util.Set;
 
 import junit.framework.TestCase;
 
+import org.lcsim.detector.DetectorElementStore;
+import org.lcsim.detector.IDetectorElementStore;
+import org.lcsim.detector.identifier.IExpandedIdentifier;
+import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.identifier.IIdentifierHelper;
 import org.lcsim.geometry.Detector;
 import org.lcsim.geometry.GeometryReader;
+import org.lcsim.geometry.subdetector.HPSEcal3;
+import org.lcsim.geometry.subdetector.HPSEcal3.NeighborMap;
 
 /**
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public class HPSEcalAPITest extends TestCase {
-
-    public void testHPSEcalAPI() throws Exception {
-
+ 
+    private HPSEcalDetectorElement api = null;
+    private HPSEcal3 ecal = null;
+    
+    public void setUp() throws Exception {
         final GeometryReader geometryReader = new GeometryReader();
         final InputStream in = this.getClass().getResourceAsStream("/org/lcsim/geometry/subdetector/HPSEcal3Test.xml");
         final Detector detector = geometryReader.read(in);
-
-        final HPSEcalDetectorElement ecal = (HPSEcalDetectorElement) detector.getSubdetector("Ecal")
-                .getDetectorElement();
-
-        final HPSEcalAPI api = ecal;
+        ecal = (HPSEcal3) detector.getSubdetector("Ecal");
+        api = (HPSEcalDetectorElement) ecal.getDetectorElement();
+    }
+    
+    public void testIdentifiers() {
+        IIdentifierHelper helper = api.getIdentifierHelper();
+        for (EcalCrystal crystal : api.getCrystals()) {
+            IExpandedIdentifier expandedId = helper.createExpandedIdentifier();
+            expandedId.setValue(helper.getFieldIndex("ix"), crystal.getX());
+            expandedId.setValue(helper.getFieldIndex("iy"), crystal.getY());
+            expandedId.setValue(helper.getFieldIndex("system"), api.getSystemID());
+            IIdentifier id = helper.pack(expandedId);
+            if (id.getValue() != crystal.getIdentifier().getValue()) {
+                throw new RuntimeException("Reencoded ID " + id.getValue() + " does not match crystal ID " + crystal.getIdentifier().getValue());
+            }            
+            
+            IDetectorElementStore deStore = DetectorElementStore.getInstance();           
+            if (deStore.find(crystal.getIdentifier()).size() == 0) {
+                throw new RuntimeException("Failed to find crystal ID in store.");
+            } else {
+                System.out.println("found " + crystal.getIdentifier() + " in store");
+            }
+            
+            if (deStore.find(id).size() == 0) {
+                throw new RuntimeException("Failed to find repacked ID in store.");
+            } else {
+                System.out.println("found repacked ID " + id + " in store");
+            }
+            System.out.println();
+        }        
+    }
+    
+    public void testNeighborMap() {
+        System.out.println();
+        NeighborMap neighborMap = ecal.getNeighborMap();
+        for (EcalCrystal crystal : api.getCrystals()) {
+            System.out.println("crystal: " + crystal.getName());
+            System.out.println("crystal ID: " + crystal.getIdentifier().getValue());
+            List<EcalCrystal> neighborCrystals = api.getNeighbors(crystal);
+            System.out.println("neighbors: " + neighborCrystals.size());
+            if (neighborCrystals.size() == 0) {
+                throw new RuntimeException("Crystal has 0 neighbors.");
+            }
+            for (EcalCrystal neighborCrystal : neighborCrystals) {
+                System.out.print(neighborCrystal.getIdentifier().getValue() + " ");
+            }
+            System.out.println();
+            if (!neighborMap.containsKey(crystal.getIdentifier().getValue())) {
+                throw new RuntimeException("Neighbor map does not contain ID.");
+            }
+            Set<Long> neighborIds = neighborMap.get(crystal.getIdentifier().getValue());
+            System.out.println("neighbor IDs: " + neighborIds.size());
+            for (long id : neighborIds) {
+                System.out.print(id + " ");
+            }            
+            System.out.println();
+            for (long id : neighborIds) {
+                System.out.println("checking neighbor ID: " + id);
+                boolean foundId = false;
+                for (EcalCrystal neighborCrystal : neighborCrystals) {
+                    if (neighborCrystal.getIdentifier().getValue() == id) {
+                        foundId = true;
+                        System.out.println("found match in neighbor crystals");
+                        break;
+                    } else {
+                        System.out.println("crystal ID " + neighborCrystal.getIdentifier().getValue() + " does not match " + id);
+                    }
+                }
+                if (!foundId) {
+                    throw new RuntimeException("Failed to find neighbor ID in map for " + crystal.getName());
+                }
+            }
+            System.out.println();
+        }
+        
+    }
+    
+    public void testHPSEcalAPI() throws Exception {
 
         assertEquals("The max X index is wrong.", 23, api.getXIndexMax());
         assertEquals("The min X index is wrong.", -23, api.getXIndexMin());

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/CalorimeterHitUtilities.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/CalorimeterHitUtilities.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/CalorimeterHitUtilities.java	Thu Oct  8 22:33:03 2015
@@ -1,7 +1,7 @@
 package org.hps.recon.ecal;
 
+import org.hps.detector.ecal.EcalCrystal;
 import org.lcsim.detector.IGeometryInfo;
-import org.lcsim.detector.converter.compact.EcalCrystal;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader.LCMetaData;
 import org.lcsim.event.base.BaseCalorimeterHit;

Modified: 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	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ReconClusterPropertyCalculator.java	Thu Oct  8 22:33:03 2015
@@ -4,7 +4,7 @@
 
 import java.util.List;
 
-import org.lcsim.detector.converter.compact.EcalCrystal;
+import org.hps.detector.ecal.EcalCrystal;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.base.AbstractClusterPropertyCalculator;

Modified: java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java
 =============================================================================
--- java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java	(original)
+++ java/trunk/ecal-recon/src/test/java/org/hps/recon/ecal/cluster/ClustererTest.java	Thu Oct  8 22:33:03 2015
@@ -17,8 +17,8 @@
 import junit.framework.TestCase;
 
 import org.hps.conditions.database.DatabaseConditionsManager;
+import org.hps.detector.ecal.EcalCrystal;
 import org.hps.recon.ecal.CalorimeterHitUtilities;
-import org.lcsim.detector.converter.compact.EcalCrystal;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;

Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalDaqPlots.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalDaqPlots.java	(original)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalDaqPlots.java	Thu Oct  8 22:33:03 2015
@@ -12,7 +12,7 @@
 import org.hps.conditions.database.DatabaseConditionsManager;
 import org.hps.conditions.ecal.EcalChannel;
 import org.hps.conditions.ecal.EcalConditions;
-import org.lcsim.detector.converter.compact.EcalCrystal;
+import org.hps.detector.ecal.EcalCrystal;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.EventHeader;
 import org.lcsim.geometry.Detector;

Modified: java/trunk/users/src/main/java/org/hps/users/jeremym/ClusterHitCheckDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/jeremym/ClusterHitCheckDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/jeremym/ClusterHitCheckDriver.java	Thu Oct  8 22:33:03 2015
@@ -3,7 +3,7 @@
 import java.util.List;
 import java.util.logging.Level;
 
-import org.lcsim.detector.converter.compact.EcalCrystal;
+import org.hps.detector.ecal.EcalCrystal;
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
 import org.lcsim.event.EventHeader;

Modified: java/trunk/users/src/main/java/org/hps/users/jeremym/EcalRawModeMipAnalysisDriver.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/jeremym/EcalRawModeMipAnalysisDriver.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/jeremym/EcalRawModeMipAnalysisDriver.java	Thu Oct  8 22:33:03 2015
@@ -13,7 +13,7 @@
 import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
 import org.hps.conditions.ecal.EcalChannelConstants;
 import org.hps.conditions.ecal.EcalConditions;
-import org.lcsim.detector.converter.compact.EcalCrystal;
+import org.hps.detector.ecal.EcalCrystal;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.EventHeader.LCMetaData;
 import org.lcsim.event.RawTrackerHit;

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