Print

Print


Commit in lcsim/src/org/lcsim/digisim on MAIN
DigiSimDriver.java+15-321.17 -> 1.18
GL: cleanup after tests with changing conditions

lcsim/src/org/lcsim/digisim
DigiSimDriver.java 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- DigiSimDriver.java	18 Jan 2006 00:25:54 -0000	1.17
+++ DigiSimDriver.java	18 Jan 2006 20:37:42 -0000	1.18
@@ -16,7 +16,7 @@
  * both parameters and events from the framework.
  *
  * @author Guilherme Lima
- * @version $Id: DigiSimDriver.java,v 1.17 2006/01/18 00:25:54 lima Exp $
+ * @version $Id: DigiSimDriver.java,v 1.18 2006/01/18 20:37:42 lima Exp $
  */
 public class DigiSimDriver extends Driver implements ConditionsListener {
 
@@ -37,49 +37,35 @@
      */
     private void init() {
 	// FIXME: This should be using conditions system
-  	System.out.println("DigiSimDriver.init(): _name=<"+_name+">");
-        System.out.println("DigiSimDriver.init(): _file=<"+_file+">");
+  	System.out.println("DigiSimDriver.init(): detector=<"+_name+">");
 	if(_name == null) return;
 
         if (_file != null)
         {
-            // open released config file from lcsim.jar
-            ConfigReader reader = new ConfigReader(_file);
-            _setup = reader.digiSimParse();
-	    reader.close();
-            calculateDerivedConditions(_setup);
+          // use config file from org.lcsim.digisim
+	  System.out.println("DigiSimDriver.init(): config file=<"+_file+">");
+	  ConfigReader reader = new ConfigReader(_file);
+	  _setup = reader.digiSimParse();
+	  reader.close();
+	  calculateDerivedConditions(_setup);
         }
         else
         {
-            _cachedConditions = getConditionsManager().getCachedConditions(DigiSimSetup.class,"digisim/digisim.steer");
-            // read config file
-	    calculateDerivedConditions(_cachedConditions.getCachedData());
-            _cachedConditions.addConditionsListener(this);
+	  // read released config file from LCDetectors
+          _cachedConditions = getConditionsManager().getCachedConditions(DigiSimSetup.class,"digisim/digisim.steer");
+	  calculateDerivedConditions(_cachedConditions.getCachedData());
+	  _cachedConditions.addConditionsListener(this);
         }
     }
 
     public void conditionsChanged(ConditionsEvent event)
     {
+	// trigger this.init() to be called when next event is available
 	_name = null;
-        if(_file == null) {
-	    calculateDerivedConditions( _cachedConditions.getCachedData() );
-	}
-	else {
-	    // keep user-provided steering file conditions, but
-	    // update digisim config for a new detector geometry
-	    calculateDerivedConditions( _setup );
-	}
     }
 
     private void calculateDerivedConditions(DigiSimSetup setup)
     {
-	System.out.println("DSDriver.calculateDerivedConds: name="+_name+", file="+_file);
-
-// 	// read config file
-//  	if(_file==null) {
-// 	    // use conditions system
-// 	    setup = getConditionsManager().getCachedConditions(DigiSimSetup.class, "digisim/digisim.steer").getCachedData();
-// 	}
 	Map<String,Vector<String>> sections = setup.getSections();
 
 	// find digitizers to be instantiated
@@ -127,7 +113,6 @@
 
 	if(_name==null) {
 	    _name = event.getDetectorName();
-	    System.out.println("Detector name: <"+_name+">");
 	    this.init();
 	}
 
@@ -174,7 +159,7 @@
     {
 	if( file==null || file=="" ) _file = null;
 	else _file = file;
-	// _name="" will flag call to init() when next event is available
+	// _name=null will trigger call to init() when next event is available
 	_name = null;
     }
     
@@ -190,16 +175,14 @@
     /** Name of this DigiSimDriver object */
     private String _name = null;
     /** Name of steering file to read (null means use conditions manager) */
-    private String _file;
+    private String _file = null;
     /** modifiers */
     private Vector<Digitizer> _digitizers;
     
     private CachedConditions<DigiSimSetup> _cachedConditions;
-//     private String _digisimURL = "http://nicadd.niu.edu/digisim/config/";
     private Map<String,Integer> _debugMap = new HashMap<String,Integer>();
 
     private boolean _useConditions = true;
-//     private ConfigReader _confReader = null;
     private DigiSimSetup _setup = null;
 
     // static registration globals
CVSspam 0.2.8