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  July 2015

HPS-SVN July 2015

Subject:

r3291 - in /java/trunk/conditions/src/main/java/org/hps/conditions/ecal: EcalChannelConstants.java EcalConditionsConverter.java TestRunEcalConditionsConverter.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 28 Jul 2015 22:49:44 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (394 lines)

Author: [log in to unmask]
Date: Tue Jul 28 15:49:43 2015
New Revision: 3291

Log:
Add EcalPulseWidth to EcalConditions and EcalChannelConstants.  HPSJAVA-560

Modified:
    java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java
    java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java
    java/trunk/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalChannelConstants.java	Tue Jul 28 15:49:43 2015
@@ -12,17 +12,17 @@
 public final class EcalChannelConstants {
 
     /**
-     * True if channel is bad and should not be used for reconstruction.
+     * <code>true</code> if channel is bad and should not be used for reconstruction.
      */
     private boolean badChannel = false;
 
     /**
-     * The channel {@link EcalCalibration} conditions.
+     * The channel's {@link EcalCalibration} conditions (pedestal and noise).
      */
     private EcalCalibration calibration = null;
 
     /**
-     * The channel {@link EcalGain} conditions.
+     * The channel {@link EcalGain} conditions (per channel gain value).
      */
     private EcalGain gain = null;
 
@@ -30,6 +30,11 @@
      * The channel {@link EcalTimeShift} conditions.
      */
     private EcalTimeShift timeShift = null;
+    
+    /**
+     * The channel's {@link EcalPulseWidth} conditions.
+     */
+    private EcalPulseWidth pulseWidth = null;
 
     /**
      * Class constructor, which is package protected.
@@ -38,36 +43,45 @@
     }
 
     /**
-     * Get the calibration.
+     * Get the channel calibration.
      *
-     * @return The calibration.
+     * @return the channel calibration
      */
     public EcalCalibration getCalibration() {
         return this.calibration;
     }
 
     /**
-     * Get the gain.
+     * Get the channel gain.
      *
-     * @return The gain.
+     * @return the channel gain
      */
     public EcalGain getGain() {
         return this.gain;
+    }
+    
+    /**
+     * Get the pulse width or <code>null</code> if it does not exist.
+     * 
+     * @return the pulse width
+     */
+    public EcalPulseWidth getPulseWidth() {
+        return this.pulseWidth;
     }
 
     /**
      * Get the time shift.
      *
-     * @return The time shift.
+     * @return the time shift
      */
     public EcalTimeShift getTimeShift() {
         return this.timeShift;
     }
 
     /**
-     * True if this is a bad channel.
+     * <code>true</code> if this is a bad channel.
      *
-     * @return True if channel is bad.
+     * @return <code>true</code> if channel is bad
      */
     public boolean isBadChannel() {
         return this.badChannel;
@@ -94,7 +108,7 @@
     /**
      * Set the gain.
      *
-     * @param gain the new gain object
+     * @param gain the channel gain
      */
     void setGain(final EcalGain gain) {
         this.gain = gain;
@@ -103,9 +117,18 @@
     /**
      * Set the time shift.
      *
-     * @param timeShift the new time shift
+     * @param timeShift the time shift
      */
     void setTimeShift(final EcalTimeShift timeShift) {
         this.timeShift = timeShift;
     }
+    
+    /**
+     * Set the pulse width.
+     * 
+     * @param pulseWidth the pulse width
+     */
+    void setPulseWidth(final EcalPulseWidth pulseWidth) {
+        this.pulseWidth = pulseWidth;
+    }
 }

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/EcalConditionsConverter.java	Tue Jul 28 15:49:43 2015
@@ -8,6 +8,7 @@
 import org.hps.conditions.ecal.EcalChannel.ChannelId;
 import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
 import org.hps.conditions.ecal.EcalGain.EcalGainCollection;
+import org.hps.conditions.ecal.EcalPulseWidth.EcalPulseWidthCollection;
 import org.hps.conditions.ecal.EcalTimeShift.EcalTimeShiftCollection;
 import org.lcsim.conditions.ConditionsConverter;
 import org.lcsim.conditions.ConditionsManager;
@@ -27,7 +28,7 @@
  * @see EcalTimeShift
  */
 public class EcalConditionsConverter implements ConditionsConverter<EcalConditions> {
-
+    
     /**
      * Create combined ECAL conditions object containing all data for the current run.
      *
@@ -36,34 +37,29 @@
      */
     @Override
     public final EcalConditions getData(final ConditionsManager manager, final String name) {
+       
+        // Get the ECal channel map from the conditions database.
+        final EcalChannelCollection channels = this.getEcalChannelCollection();
 
-        final DatabaseConditionsManager databaseConditionsManager = (DatabaseConditionsManager) manager;
-
-        // Get the ECal channel map from the conditions database
-        final EcalChannelCollection channels = this.getEcalChannelCollection(databaseConditionsManager);
-
-        // Create the ECal conditions object that will be used to encapsulate
-        // ECal conditions collections
-        final Detector detector = databaseConditionsManager.getDetectorObject();
-        final EcalConditions conditions = new EcalConditions(detector.getSubdetector(databaseConditionsManager
+        // Create the ECal conditions object that will be used to encapsulate ECal conditions collections.
+        final Detector detector = getDatabaseConditionsManager().getDetectorObject();
+        final EcalConditions conditions = new EcalConditions(detector.getSubdetector(getDatabaseConditionsManager()
                 .getEcalName()));
 
         // Set the channel map.
         conditions.setChannelCollection(channels);
 
-        // Get the ECal gains from the conditions database and add them to the
-        // conditions set
-        final EcalGainCollection gains = this.getEcalGainCollection(databaseConditionsManager);
+        // Get the ECal gains from the conditions database and add them to the conditions set
+        final EcalGainCollection gains = this.getEcalGainCollection();
         for (final EcalGain gain : gains) {
             final ChannelId channelId = new ChannelId(new int[] {gain.getChannelId()});
             final EcalChannel channel = channels.findChannel(channelId);
             conditions.getChannelConstants(channel).setGain(gain);
         }
 
+        // Get the bad channel collections and merge them together.
         final ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> badChannelSeries = this
-                .getEcalBadChannelSeries(databaseConditionsManager);
-        // FIXME: How to get EcalBadChannelCollection here instead for the collection type?
-        // API of ConditionsSeries and ConditionsSeriesConverter needs to be changed!
+                .getEcalBadChannelSeries();
         for (final ConditionsObjectCollection<EcalBadChannel> badChannels : badChannelSeries) {
             for (final EcalBadChannel badChannel : badChannels) {
                 final ChannelId channelId = new ChannelId(new int[] {badChannel.getChannelId()});
@@ -72,26 +68,38 @@
             }
         }
 
-        // Get the ECal calibrations from the conditions database and add them
-        // to the conditions set.
-        final EcalCalibrationCollection calibrations = this.getEcalCalibrationCollection(databaseConditionsManager);
+        // Get the ECal calibrations from the conditions database and add them to the conditions set.
+        final EcalCalibrationCollection calibrations = this.getEcalCalibrationCollection();
         for (final EcalCalibration calibration : calibrations) {
             final ChannelId channelId = new ChannelId(new int[] {calibration.getChannelId()});
             final EcalChannel channel = channels.findChannel(channelId);
             conditions.getChannelConstants(channel).setCalibration(calibration);
         }
 
-        // Get the ECal time shifts from the conditions database and add them to
-        // the conditions set.
-        if (databaseConditionsManager.hasConditionsRecord("ecal_time_shifts")) {
-            final EcalTimeShiftCollection timeShifts = this.getEcalTimeShiftCollection(databaseConditionsManager);
+        // Get the ECal time shifts from the conditions database and add them to the conditions set.
+        if (getDatabaseConditionsManager().hasConditionsRecord("ecal_time_shifts")) {
+            final EcalTimeShiftCollection timeShifts = this.getEcalTimeShiftCollection();
             for (final EcalTimeShift timeShift : timeShifts) {
                 final ChannelId channelId = new ChannelId(new int[] {timeShift.getChannelId()});
                 final EcalChannel channel = channels.findChannel(channelId);
                 conditions.getChannelConstants(channel).setTimeShift(timeShift);
             }
         } else {
-            DatabaseConditionsManager.getLogger().warning("no ecal_time_shifts collection found");
+            // If time shifts do not exist it is not a fatal error.
+            DatabaseConditionsManager.getLogger().warning("no conditions found for EcalTimeShiftCollection");
+        }
+        
+        // Set the channel pulse width if it exists in the database.
+        if (getDatabaseConditionsManager().hasConditionsRecord("ecal_pulse_widths")) {
+            final EcalPulseWidthCollection pulseWidths = this.getEcalPulseWidthCollection();
+            for (final EcalPulseWidth pulseWidth : pulseWidths) {
+                final ChannelId channelId = new ChannelId(new int[] {pulseWidth.getChannelId()});
+                final EcalChannel channel = channels.findChannel(channelId);
+                conditions.getChannelConstants(channel).setPulseWidth(pulseWidth);
+            }
+        } else {
+            // If pulse widths do not exist it is not a fatal error.
+            DatabaseConditionsManager.getLogger().warning("no conditions found for EcalPulseWidthCollection");
         }
 
         // Return the conditions object to caller.
@@ -104,9 +112,8 @@
      * @param manager the conditions manager
      * @return the collections of ECAL bad channel objects
      */
-    protected ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> getEcalBadChannelSeries(
-            final DatabaseConditionsManager manager) {
-        return manager.getConditionsSeries(EcalBadChannelCollection.class, "ecal_bad_channels");
+    protected ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> getEcalBadChannelSeries() {
+        return getDatabaseConditionsManager().getConditionsSeries(EcalBadChannelCollection.class, "ecal_bad_channels");
     }
 
     /**
@@ -115,8 +122,8 @@
      * @param manager the conditions manager
      * @return the collection of ECAL channel calibration objects
      */
-    protected EcalCalibrationCollection getEcalCalibrationCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalCalibrationCollection.class, "ecal_calibrations").getCachedData();
+    protected EcalCalibrationCollection getEcalCalibrationCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalCalibrationCollection.class, "ecal_calibrations").getCachedData();
     }
 
     /**
@@ -125,8 +132,8 @@
      * @param manager the conditions manager
      * @return the default ECAL channel object collection
      */
-    protected EcalChannelCollection getEcalChannelCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();
+    protected EcalChannelCollection getEcalChannelCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalChannelCollection.class, "ecal_channels").getCachedData();
     }
 
     /**
@@ -135,8 +142,8 @@
      * @param manager the conditions manager
      * @return the ECAL channel gain collection
      */
-    protected EcalGainCollection getEcalGainCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalGainCollection.class, "ecal_gains").getCachedData();
+    protected EcalGainCollection getEcalGainCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalGainCollection.class, "ecal_gains").getCachedData();
     }
 
     /**
@@ -145,8 +152,18 @@
      * @param manager the conditions manager
      * @return the collection of ECAL time shift objects
      */
-    protected EcalTimeShiftCollection getEcalTimeShiftCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalTimeShiftCollection.class, "ecal_time_shifts").getCachedData();
+    protected EcalTimeShiftCollection getEcalTimeShiftCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalTimeShiftCollection.class, "ecal_time_shifts").getCachedData();
+    }
+    
+    /**
+     * Get the default {@link EcalPulseWith} collection.
+     *
+     * @param manager the conditions manager
+     * @return the collection of ECAL pulse widths
+     */
+    protected EcalPulseWidthCollection getEcalPulseWidthCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalPulseWidthCollection.class, "ecal_pulse_widths").getCachedData();
     }
 
     /**
@@ -158,4 +175,13 @@
     public final Class<EcalConditions> getType() {
         return EcalConditions.class;
     }
+    
+    /**
+     * Get the current instance of the conditions manager.
+     * 
+     * @return the current instance of the conditions manager
+     */
+    protected final DatabaseConditionsManager getDatabaseConditionsManager() {
+        return DatabaseConditionsManager.getInstance();
+    }
 }

Modified: java/trunk/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java
 =============================================================================
--- java/trunk/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java	(original)
+++ java/trunk/conditions/src/main/java/org/hps/conditions/ecal/TestRunEcalConditionsConverter.java	Tue Jul 28 15:49:43 2015
@@ -1,7 +1,6 @@
 package org.hps.conditions.ecal;
 
 import org.hps.conditions.api.ConditionsSeries;
-import org.hps.conditions.database.DatabaseConditionsManager;
 import org.hps.conditions.ecal.EcalBadChannel.EcalBadChannelCollection;
 import org.hps.conditions.ecal.EcalCalibration.EcalCalibrationCollection;
 import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
@@ -25,9 +24,8 @@
      * @return the Test Run bad channel collections
      */
     @Override
-    protected ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> getEcalBadChannelSeries(
-            final DatabaseConditionsManager manager) {
-        return manager.getConditionsSeries(EcalBadChannelCollection.class, "test_run_ecal_bad_channels");
+    protected ConditionsSeries<EcalBadChannel, EcalBadChannelCollection> getEcalBadChannelSeries() {
+        return getDatabaseConditionsManager().getConditionsSeries(EcalBadChannelCollection.class, "test_run_ecal_bad_channels");
     }
 
     /**
@@ -37,8 +35,8 @@
      * @return the Test Run ECAL calibration collection
      */
     @Override
-    protected EcalCalibrationCollection getEcalCalibrationCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalCalibrationCollection.class, "test_run_ecal_calibrations")
+    protected EcalCalibrationCollection getEcalCalibrationCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalCalibrationCollection.class, "test_run_ecal_calibrations")
                 .getCachedData();
     }
 
@@ -49,8 +47,8 @@
      * @return the Test Run ECAL channel collection
      */
     @Override
-    protected EcalChannelCollection getEcalChannelCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalChannelCollection.class, "test_run_ecal_channels").getCachedData();
+    protected EcalChannelCollection getEcalChannelCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalChannelCollection.class, "test_run_ecal_channels").getCachedData();
     }
 
     /**
@@ -60,8 +58,8 @@
      * @return the Test Run ECAL gain collection
      */
     @Override
-    protected EcalGainCollection getEcalGainCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalGainCollection.class, "test_run_ecal_gains").getCachedData();
+    protected EcalGainCollection getEcalGainCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalGainCollection.class, "test_run_ecal_gains").getCachedData();
     }
 
     /**
@@ -71,7 +69,7 @@
      * @return the Test Run ECAL time shift collection
      */
     @Override
-    protected EcalTimeShiftCollection getEcalTimeShiftCollection(final DatabaseConditionsManager manager) {
-        return manager.getCachedConditions(EcalTimeShiftCollection.class, "test_run_ecal_time_shifts").getCachedData();
+    protected EcalTimeShiftCollection getEcalTimeShiftCollection() {
+        return getDatabaseConditionsManager().getCachedConditions(EcalTimeShiftCollection.class, "test_run_ecal_time_shifts").getCachedData();
     }
 }

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