Print

Print


Author: [log in to unmask]
Date: Thu Feb 19 15:23:03 2015
New Revision: 2170

Log:
Allow EcalTimeShiftCollection to be an optional condition.

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

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	Thu Feb 19 15:23:03 2015
@@ -99,11 +99,15 @@
 
         // Get the ECal time shifts from the conditions database and add them to
         // the conditions set.
-        EcalTimeShiftCollection timeShifts = getEcalTimeShiftCollection(databaseConditionsManager);
-        for (EcalTimeShift timeShift : timeShifts) {
-            ChannelId channelId = new ChannelId(new int[] {timeShift.getChannelId()});
-            EcalChannel channel = channels.findChannel(channelId);
-            conditions.getChannelConstants(channel).setTimeShift(timeShift);
+        if (databaseConditionsManager.hasConditionsRecord("ecal_time_shifts")) {
+            EcalTimeShiftCollection timeShifts = getEcalTimeShiftCollection(databaseConditionsManager);
+            for (EcalTimeShift timeShift : timeShifts) {
+                ChannelId channelId = new ChannelId(new int[] {timeShift.getChannelId()});
+                EcalChannel channel = channels.findChannel(channelId);
+                conditions.getChannelConstants(channel).setTimeShift(timeShift);
+            }   
+        } else {
+            DatabaseConditionsManager.getLogger().warning("no ecal_time_shifts collection found");
         }
 
         // Return the conditions object to caller.