|
5 | 5 | import java.util.logging.Level; |
6 | 6 | import java.util.logging.Logger; |
7 | 7 |
|
| 8 | +import org.hps.conditions.trigger.TiTimeOffset; |
8 | 9 | import org.hps.record.epics.EpicsData; |
9 | 10 | import org.hps.record.epics.EpicsEvioProcessor; |
10 | 11 | import org.hps.record.evio.EvioEventUtilities; |
|
17 | 18 | import org.hps.record.triggerbank.SSPData; |
18 | 19 | import org.hps.record.triggerbank.TDCData; |
19 | 20 | import org.hps.record.triggerbank.TIData; |
20 | | -import org.hps.rundb.RunManager; |
21 | 21 | import org.jlab.coda.jevio.EvioEvent; |
22 | 22 | import org.lcsim.conditions.ConditionsEvent; |
| 23 | +import org.lcsim.conditions.ConditionsManager; |
23 | 24 | import org.lcsim.event.EventHeader; |
24 | 25 |
|
25 | 26 | /** |
@@ -99,38 +100,11 @@ public void conditionsChanged(final ConditionsEvent conditionsEvent) { |
99 | 100 | svtEventFlagger.initialize(); |
100 | 101 |
|
101 | 102 | // Set TI time offset from run database. |
102 | | - setTiTimeOffsetForRun(conditionsEvent.getConditionsManager().getRun()); |
| 103 | + ConditionsManager mgr = conditionsEvent.getConditionsManager(); |
| 104 | + TiTimeOffset t = mgr.getCachedConditions(TiTimeOffset.class, "ti_time_offsets").getCachedData(); |
| 105 | + currentTiTimeOffset = t.getValue(); |
103 | 106 | } |
104 | 107 |
|
105 | | - /** |
106 | | - * Get TI time offset from the run database, if available. |
107 | | - * @param run the run number |
108 | | - */ |
109 | | - private void setTiTimeOffsetForRun(int run) { |
110 | | - currentTiTimeOffset = null; |
111 | | - RunManager runManager = RunManager.getRunManager(); |
112 | | - if (runManager.getRun() != null) { |
113 | | - if (runManager.runExists()) { |
114 | | - currentTiTimeOffset = runManager.getRunSummary().getTiTimeOffset(); |
115 | | - LOGGER.info("TI time offset set to " + currentTiTimeOffset + " for run " |
116 | | - + run + " from database"); |
117 | | - } else { |
118 | | - LOGGER.warning("Run " + run |
119 | | - + " does not exist in the run database."); |
120 | | - } |
121 | | - } else { |
122 | | - LOGGER.info("Run manager is not initialized; TI time offset not available."); |
123 | | - } |
124 | | - /* Make sure connection is closed immediately. --JM */ |
125 | | - try { |
126 | | - LOGGER.info("Closing run manager db connection ..."); |
127 | | - RunManager.getRunManager().closeConnection(); |
128 | | - LOGGER.info("Run manager db connection was closed."); |
129 | | - } catch (Exception e) { |
130 | | - e.printStackTrace(); |
131 | | - } |
132 | | - } |
133 | | - |
134 | 108 | /** |
135 | 109 | * Get the time from the TI data with time offset applied from run database. |
136 | 110 | * |
|
0 commit comments