Print

Print


Author: [log in to unmask]
Date: Thu Oct  8 22:19:56 2015
New Revision: 3676

Log:
Call the initialize method on the subdetector's detector element so setup occurs properly (especially needed for HPS ECal to setup properly).

Modified:
    projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java

Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java
 =============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java	(original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/DetectorConverter.java	Thu Oct  8 22:19:56 2015
@@ -85,7 +85,6 @@
     }
 
     public DetectorConverter() {
-        //System.out.println("DetectorConverter initializing ...");
     }
 
     public void registerSubdetectorConverters() {
@@ -100,7 +99,6 @@
         for (Class<? extends AbstractSubdetectorConverter> converter : converters) {
             try {
                 if (!Modifier.isAbstract(converter.getModifiers())) {
-                    //System.out.println("adding subdet converter: " + converter);
                     this.addSubdetectorConverter(converter.newInstance());
                 }
             } catch (InstantiationException | IllegalAccessException e) {
@@ -145,19 +143,14 @@
     private void convertSubdetectors(Detector detector) {
         // Process all Subdetectors in the Detector.
         for (Subdetector subdetector : detector.getSubdetectors().values()) {
-            // System.out.println("subdetector: " + subdetector.getName());
 
             // Find a converter for this type.
             ISubdetectorConverter cnv = getSubdetectorConverter(subdetector.getClass());
 
             if (cnv != null) {
-                // System.out.println("found cnv handling: " +
+
                 // cnv.getSubdetectorType().getCanonicalName());
-                DetectorElement subdetectorDE = (DetectorElement) cnv.makeSubdetectorDetectorElement(detector,
-                        subdetector);
-
-                // System.out.println("made subdet DE: " +
-                // subdetectorDE.getName());
+                DetectorElement subdetectorDE = (DetectorElement) cnv.makeSubdetectorDetectorElement(detector, subdetector);
 
                 // Make the IdentifierHelper for this Subdetector.
                 IIdentifierHelper helper = cnv.makeIdentifierHelper(subdetector, sysMap);
@@ -169,8 +162,9 @@
                     throw new RuntimeException(x);
                 }
 
-                if (subdetectorDE != null)
+                if (subdetectorDE != null) {
                     subdetectorDE.setIdentifierHelper(helper);
+                }
 
                 // Build the Subdetector's geometry and associated
                 // DetectorElement(s).
@@ -191,19 +185,17 @@
 
                     // Make the Subdetector IdentifierHelper from the IDDecoder
                     // and assign to the Subdetector's DetectorElement.
-                    if (helper != null && subdetectorDE.getIdentifierHelper() == null)
+                    if (helper != null && subdetectorDE.getIdentifierHelper() == null) {
                         subdetDE.setIdentifierHelper(helper);
+                    }
 
                     // Make the identifiers for this Subdetector.
                     cnv.makeIdentifiers(subdetector);
                 }
-            }
-            // else
-            // {
-            // System.out.println("no converter found for " +
-            // subdetector.getName());
-            // }
-            // System.out.println();
+                
+                // Initialize the subdetector detector element (no op for most classes).
+                subdetectorDE.initialize();
+            }
         }
     }
 

########################################################################
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