lcsim/src/org/lcsim/contrib/RobKutschke/TKNHits
diff -u -r1.1 -r1.2
--- TrackerIdentifierIndexCache.java 1 Nov 2007 22:54:25 -0000 1.1
+++ TrackerIdentifierIndexCache.java 6 Nov 2007 00:07:18 -0000 1.2
@@ -7,6 +7,8 @@
import org.lcsim.detector.identifier.IIdentifierDictionary;
import org.lcsim.detector.identifier.IIdentifierDictionary.FieldNotFoundException;
+import org.lcsim.geometry.compact.Subdetector;
+
/**
*
* Class to cache the results of some expensive operations that only need to be
@@ -17,9 +19,9 @@
* not change unless the detector changes.
* <p>
*@author $Author: kutschke $
- *@version $Id: TrackerIdentifierIndexCache.java,v 1.1 2007/11/01 22:54:25 kutschke Exp $
+ *@version $Id: TrackerIdentifierIndexCache.java,v 1.2 2007/11/06 00:07:18 kutschke Exp $
*
- * Date $Date: 2007/11/01 22:54:25 $
+ * Date $Date: 2007/11/06 00:07:18 $
*
*/
@@ -32,9 +34,9 @@
private int[] index = null;
/**
- * The only constructor.
+ * Constructor from a RawTrackerHit.
* <p>
- * The first argument can be any BaseRawTrackerHit object. To the best of my knowledge,
+ * The first argument can be any RawTrackerHit object. To the best of my knowledge,
* all such objects within one event use the same dictionary. The second argument, if true,
* enables some printout.
* <p>
@@ -42,10 +44,31 @@
*
*/
public TrackerIdentifierIndexCache( RawTrackerHit raw, boolean printheader ){
- BaseRawTrackerHit base = (BaseRawTrackerHit)raw;
- IIdentifierHelper help = base.getIdentifierHelper();
- IIdentifierDictionary dict = help.getIdentifierDictionary();
-
+ this( raw.getIdentifierHelper().getIdentifierDictionary(),
+ printheader
+ );
+ }
+
+ /**
+ * Constructor from a subdetector.
+ * <p>
+ * The constructor will stop the job if it does not find the expected fields in the dictionary.
+ *
+ */
+ public TrackerIdentifierIndexCache( Subdetector sd, boolean printheader ){
+ this( sd.getDetectorElement().getIdentifierHelper().getIdentifierDictionary(),
+ printheader
+ );
+ }
+
+ /**
+ * Constructor from a dictionary.
+ * <p>
+ * The constructor will stop the job if it does not find the expected fields in the dictionary.
+ *
+ */
+ public TrackerIdentifierIndexCache( IIdentifierDictionary dict, boolean printheader ){
+
if ( printheader ){
System.out.println ("Setting RawTrackerHit Indices from Dictionary: "
+ dict.getName() + " "
@@ -67,7 +90,7 @@
}
}
}
-
+
/**
* @return the system id: Tracker Barrel/Endcap, Vertex Detector Barrel/Endcap, Forward Tracker
*/