Author: [log in to unmask] Date: Fri Aug 28 13:07:08 2015 New Revision: 3444 Log: Minor changes to argument interface. Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/CrawlerConfig.java java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/CrawlerConfig.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/CrawlerConfig.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/CrawlerConfig.java Fri Aug 28 13:07:08 2015 @@ -348,7 +348,7 @@ * * @return <code>true</code> if the run database should be updated */ - boolean updateRunLog() { + boolean updateRunDatabase() { return updateRunLog; } Modified: java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java ============================================================================= --- java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java (original) +++ java/trunk/record-util/src/main/java/org/hps/record/evio/crawler/RunProcessor.java Fri Aug 28 13:07:08 2015 @@ -35,7 +35,7 @@ * Setup logger. */ private static final Logger LOGGER = LogUtil.create(RunProcessor.class, new DefaultLogFormatter(), Level.FINE); - + /** * The cache manager. */ @@ -74,7 +74,7 @@ /** * Set to <code>true</code> to use file caching. */ - private boolean useFileCache; + private final boolean useFileCache; /** * Create a run processor. @@ -82,14 +82,14 @@ * @param runSummary the run summary object for the run * @return the run processor */ - RunProcessor(final JCacheManager cacheManager, final RunSummaryImpl runSummary, boolean useFileCache) { + RunProcessor(final JCacheManager cacheManager, final RunSummaryImpl runSummary, final boolean useFileCache) { this.runSummary = runSummary; this.cacheManager = cacheManager; // Set whether file caching from MSS is enabled. this.useFileCache = useFileCache; - + // Sort the list of EVIO files. Collections.sort(runSummary.getEvioFiles(), new EvioFileSequenceComparator()); @@ -106,7 +106,7 @@ scalersProcessor.setResetEveryEvent(false); evioLoop.addEvioEventProcessor(scalersProcessor); - // Add processor for extracting TI time offset. + // Add processor for extracting TI time offset. triggerTimeProcessor = new TiTimeOffsetEvioProcessor(); evioLoop.addEvioEventProcessor(triggerTimeProcessor); } @@ -134,41 +134,20 @@ } /** - * Process the run by executing the registered {@link org.hps.record.evio.EvioEventProcessor}s and extracting the - * start and end dates. - * <p> - * This method will also execute file caching from MSS, if enabled by the {@link #useFileCache} option. - * - * @throws Exception if there is an error processing a file - */ - void processRun() throws Exception { - - LOGGER.info("processing " + this.runSummary.getEvioFiles().size() + " files from run " - + this.runSummary.getRun()); - - // Cache files from MSS if this is enabled. - if (this.useFileCache) { - LOGGER.info("caching files from MSS"); - this.cacheFiles(); - } - - // Run processors over all files. - LOGGER.info("looping over all events"); - evioLoop.loop(-1); - - // Get run start date. - LOGGER.info("processing first file"); - this.processFirstFile(); - - // Get run end date. - LOGGER.info("processing last file"); - this.processLastFile(); - - // Update run summary from processors. - LOGGER.info("updating run summary"); - this.updateRunSummary(); - - LOGGER.info("done processing run " + this.runSummary.getRun()); + * Extract meta data from first file in run. + */ + private void processFirstFile() { + final File firstEvioFile = runSummary.getEvioFiles().get(0); + LOGGER.info("getting meta data for " + firstEvioFile.getPath()); + final EvioFileMetaDataReader metaDataReader = new EvioFileMetaDataReader(); + final EvioFileMetaData metaData = metaDataReader.getMetaData(firstEvioFile); + LOGGER.info(metaData.toString()); + if (metaData.getStartDate() == null) { + throw new IllegalStateException("The start date is not set in the EVIO file meta data from " + + firstEvioFile.getPath()); + } + LOGGER.info("setting unix start time to " + metaData.getStartDate().getTime() + " from meta data"); + runSummary.setStartDate(metaData.getStartDate()); } /** @@ -190,20 +169,41 @@ } /** - * Extract meta data from first file in run. - */ - private void processFirstFile() { - final File firstEvioFile = runSummary.getEvioFiles().get(0); - LOGGER.info("getting meta data for " + firstEvioFile.getPath()); - final EvioFileMetaDataReader metaDataReader = new EvioFileMetaDataReader(); - final EvioFileMetaData metaData = metaDataReader.getMetaData(firstEvioFile); - LOGGER.info(metaData.toString()); - if (metaData.getStartDate() == null) { - throw new IllegalStateException("The start date is not set in the EVIO file meta data from " - + firstEvioFile.getPath()); - } - LOGGER.info("setting unix start time to " + metaData.getStartDate().getTime() + " from meta data"); - runSummary.setStartDate(metaData.getStartDate()); + * Process the run by executing the registered {@link org.hps.record.evio.EvioEventProcessor}s and extracting the + * start and end dates. + * <p> + * This method will also execute file caching from MSS, if enabled by the {@link #useFileCache} option. + * + * @throws Exception if there is an error processing a file + */ + void processRun() throws Exception { + + LOGGER.info("processing " + this.runSummary.getEvioFiles().size() + " files from run " + + this.runSummary.getRun()); + + // Cache files from MSS if this is enabled. + if (this.useFileCache) { + LOGGER.info("caching files from MSS"); + this.cacheFiles(); + } + + // Run processors over all files. + LOGGER.info("looping over all events"); + evioLoop.loop(-1); + + // Get run start date. + LOGGER.info("processing first file"); + this.processFirstFile(); + + // Get run end date. + LOGGER.info("processing last file"); + this.processLastFile(); + + // Update run summary from processors. + LOGGER.info("updating run summary"); + this.updateRunSummary(); + + LOGGER.info("done processing run " + this.runSummary.getRun()); } /** @@ -225,12 +225,12 @@ // Add trigger config from the trigger time processor. LOGGER.info("updating trigger config"); - TriggerConfig triggerConfig = new TriggerConfig(); + final TriggerConfig triggerConfig = new TriggerConfig(); this.triggerTimeProcessor.updateTriggerConfig(triggerConfig); - LOGGER.info("tiTimeOffset: " + triggerConfig.get(TriggerConfigVariable.TI_TIME_OFFSET.name())); - System.out.println("tiTimeOffset: " + triggerConfig.get(TriggerConfigVariable.TI_TIME_OFFSET.name())); + LOGGER.info("tiTimeOffset: " + triggerConfig.get(TriggerConfigVariable.TI_TIME_OFFSET)); + System.out.println("tiTimeOffset: " + triggerConfig.get(TriggerConfigVariable.TI_TIME_OFFSET)); runSummary.setTriggerConfigInt(triggerConfig); - + LOGGER.getHandlers()[0].flush(); - } + } }