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  November 2014

HPS-SVN November 2014

Subject:

r1560 - in /java/trunk/conditions/src/main/java/org/hps/conditions: AbstractConditionsDriver.java ConditionsDriver.java TestRunConditionsDriver.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 18 Nov 2014 00:28:58 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (132 lines)

Author: [log in to unmask]
Date: Mon Nov 17 16:28:55 2014
New Revision: 1560

Log:
Rewrite the ConditionsDriver API and remove unnecessary Driver classes.  Now it can be used to override the defaults but is not needed by default.

Removed:
    java/trunk/conditions/src/main/java/org/hps/conditions/AbstractConditionsDriver.java
    java/trunk/conditions/src/main/java/org/hps/conditions/TestRunConditionsDriver.java
Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ConditionsDriver.java	Mon Nov 17 16:28:55 2014
@@ -1,38 +1,92 @@
 package org.hps.conditions;
 
-import static org.hps.conditions.database.TableConstants.SVT_CONDITIONS;
-
 import org.hps.conditions.database.DatabaseConditionsManager;
-import org.hps.conditions.svt.SvtConditions;
-import org.hps.conditions.svt.SvtDetectorSetup;
-import org.lcsim.geometry.Detector;
+import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
+import org.lcsim.util.Driver;
 
 /**
- * This {@link org.lcsim.util.Driver} is a subclass of
- * {@link AbstractConditionsDriver} which creates the default
- * {@link DatabaseConditionsManager} for using database conditions
- * at runtime.
+ * This {@link org.lcsim.util.Driver} can be used to customize the behavior
+ * of the {@link DatabaseConditionsManager}.  It allows the setting of a 
+ * detector name and run number, if the user wishes to override the default
+ * behavior of the conditions system, which generally reads this information
+ * from the LCSim events.  It is not necessary to run this Driver in order
+ * to activate the database conditions system. 
  *
- * @author Omar Moreno <[log in to unmask]>
  * @author Jeremy McCormick <[log in to unmask]>
  */
-public class ConditionsDriver extends AbstractConditionsDriver {
+public class ConditionsDriver extends Driver {
 
+    String detectorName = null;
+    DatabaseConditionsManager conditionsManager = DatabaseConditionsManager.getInstance();
+    boolean freeze;
+    
     /**
-     * Default constructor which uses super class constructor for initialization.
+     * Default constructor.
      */
     public ConditionsDriver() {
-        super();
     }
-
+    
     /**
-     * Load the {@link SvtConditions} set onto the <code>HpsSiSensor</code> objects.
-     * @param detector The detector to update.
+     * Set the name of the detector to use.
+     * 
+     * @param detectorName The name of the detector.
      */
-    @Override
-    protected void loadSvtConditions(Detector detector) {
-        SvtConditions conditions = manager.getCachedConditions(SvtConditions.class, SVT_CONDITIONS).getCachedData();
-        SvtDetectorSetup loader = new SvtDetectorSetup();
-        loader.load(detector.getSubdetector(svtSubdetectorName), conditions);
+    public void setDetectorName(String detectorName) {
+        this.detectorName = detectorName;
+    }
+    
+    /**
+     * Set whether or not the conditions system should be "frozen" after the 
+     * detector name and run number are set.  When frozen, the conditions system
+     * will ignore subsequent calls to {@link org.lcsim.conditions.ConditionsManager#setDetector(String, int)}
+     * and instead use the user supplied detector and run for the whole job.
+     * 
+     * @param freeze True to freeze the conditions system after it is setup.
+     */
+    public void setFreeze(boolean freeze) {
+        this.freeze = freeze;
+    }
+    
+    /**
+     * Set a custom run number to setup the conditions system.
+     * In the case where the actual event stream has run numbers that differ from this one,
+     * most likely the Driver should be configured to be frozen after setup using
+     * {@link #setFreeze(boolean)}.  
+     * 
+     * The method {@link #setDetectorName(String)} needs to be called before this one
+     * or an exception will be thrown.
+     * 
+     * @param runNumber The user supplied run number for the job.
+     */
+    public void setRunNumber(int runNumber) {
+        if (this.detectorName == null) {
+            throw new RuntimeException("The detector name must be set before the run number.");
+        }
+        try {
+            conditionsManager.setDetector(detectorName, runNumber);
+        } catch (ConditionsNotFoundException e) {
+            throw new RuntimeException("Error setting conditions.", e);
+        }
+        if (freeze) {
+            conditionsManager.freeze();
+        }
+    }            
+    
+    /**
+     * Set the name of the ECAL subdetector which the conditions manager will use for loading conditions
+     * onto the detector.
+     * @param ecalName The name of the ECAL subdetector.
+     */
+    public void setEcalName(String ecalName) {
+        conditionsManager.setEcalName(ecalName);
+    }
+    
+    /**
+     * Set the name of the SVT subdetector which the conditions manager will use for loading conditions
+     * onto the detector.
+     * @param svtName The name of the SVT subdetector.
+     */
+    public void setSvtName(String svtName) {
+        conditionsManager.setSvtName(svtName);
     }
 }

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