Author: [log in to unmask]
Date: Tue Dec 16 18:19:40 2014
New Revision: 3459
Log:
Add Comparators for time and raw energy. Improve the javadoc.
Modified:
projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/CalorimeterHit.java
Modified: projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/CalorimeterHit.java
=============================================================================
--- projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/CalorimeterHit.java (original)
+++ projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/CalorimeterHit.java Tue Dec 16 18:19:40 2014
@@ -3,67 +3,107 @@
import java.util.Comparator;
/**
- * A hit in a calorimeter.
+ * <p>
+ * This class represents a hit in a calorimeter detector which has an energy
+ * deposition in GeV, a time in nanoseconds, and an ID identifying its cell
+ * or channel in the detector.
+ * <p>
* The super-interface gives access to subdetector, identifiers, iddecoder, etc.
* @see org.lcsim.event.Hit
- * @author tonyj
+ *
+ * @author Tony Johnson <[log in to unmask]>
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: CalorimeterHit.java,v 1.14 2013/02/01 01:55:51 jeremy Exp $
*/
-public interface CalorimeterHit
-extends HitWithPosition
-{
+public interface CalorimeterHit extends HitWithPosition {
+
/**
- * Raw energy deposited in calorimeter cell.
+ * Get the raw energy deposition in GeV.
+ * @return The raw energy deposition.
*/
public double getRawEnergy();
/**
- * Corrected energy deposited in calorimeter cell.
+ * Get the corrected energy deposition in GeV.
+ * @return The corrected energy deposition
*/
public double getCorrectedEnergy();
/**
- * The energy error.
+ * Get the energy error. (Units???)
+ * @return The energy error.
*/
public double getEnergyError();
/**
- * The ID of the cell. This can be converted to a physical
- * position using a IDDecoder object obtained from the hit
+ * Get the ID of the cell or channel.
+ * This can be converted to a physical position using a IDDecoder object obtained from the hit
* or from the collection's MetaData object.
+ * @return The cell or channel ID of the hit.
*/
public long getCellID();
/**
- * Returns time of the earliest energy contrib time in ns.
- * @return Hit time in ns.
+ * Get the time of the <b>earliest</b> energy contribution to this hit in nanoseconds.
+ * @return The hit time in nanoseconds.
*/
public double getTime();
/**
- * The position of the hit. If the hit position is stored in the source
- * LCIO file this will be returned. Otherwise the IDDecoder is used to get
- * the hit position from the hit ID.
+ * Get the position of the hit in millimeters with the global coordinate system.
+ * If the hit position is stored in the LCIO data, this will be returned directly.
+ * Otherwise the IDDecoder is used to get the hit position from the hit ID.
+ * @return The position in millimeters as a double array of length 3.
*/
public double[] getPosition();
/**
- * The type of the hit.
+ * Get the type of the hit.
* Mapping of integer types to type names through collection parameters
* "CalorimeterHitTypeNames" and "CalorimeterHitTypeValues".
- * @return
+ * @return The type of the hit.
*/
public int getType();
/**
- * Perform comparison between corrected energy of calorimeter hits.
+ * CalorimeterHit corrected energy comparator.
*/
- public static class CalorimeterHitEnergyComparator implements Comparator<CalorimeterHit> {
-
+ public static class CorrectedEnergyComparator implements Comparator<CalorimeterHit> {
+ /**
+ * Compare the corrected energy of the hits using the <code>Double.compare</code> method.
+ * @return -1 if o1's energy is less than o2's, 1 if o1's is greater than o2's, and 0 if equal.
+ */
@Override
public int compare(CalorimeterHit o1, CalorimeterHit o2) {
return Double.compare(o1.getCorrectedEnergy(), o2.getCorrectedEnergy());
}
}
+
+ /**
+ * CalorimeterHit raw energy comparator.
+ */
+ public static class RawEnergyComparator implements Comparator<CalorimeterHit> {
+ /**
+ * Compare the raw energy of the hits using the <code>Double.compare</code> method.
+ * @return -1 if o1's energy is less than o2's, 1 if o1's is greater than o2's, and 0 if equal.
+ */
+ @Override
+ public int compare(CalorimeterHit o1, CalorimeterHit o2) {
+ return Double.compare(o1.getRawEnergy(), o2.getRawEnergy());
+ }
+ }
+
+ /**
+ * CalorimeterHit time comparator.
+ */
+ static class TimeComparator implements Comparator<CalorimeterHit> {
+ /**
+ * Compare the time of the hits using the <code>Double.compare</code> method.
+ * @return -1 if o1's time is less than o2's, 1 if o1's is greater than o2's, and 0 if equal.
+ */
+ @Override
+ public int compare(CalorimeterHit o1, CalorimeterHit o2) {
+ return Double.compare(o1.getTime(), o2.getTime());
+ }
+ }
+
}
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1
|