Author: [log in to unmask] Date: Fri Jun 19 13:57:37 2015 New Revision: 3167 Log: Use the same hacked date format class to avoid mismatch in PDT correction. Modified: java/trunk/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java Modified: java/trunk/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java ============================================================================= --- java/trunk/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java (original) +++ java/trunk/conditions/src/main/java/org/hps/conditions/run/RunSpreadsheet.java Fri Jun 19 13:57:37 2015 @@ -135,13 +135,13 @@ return records; } - private static final AnotherSimpleDateFormat DATE_FORMAT = new AnotherSimpleDateFormat("MM/dd/yyyy H:mm"); - //private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy H:mm"); + public static final AnotherSimpleDateFormat DATE_FORMAT = new AnotherSimpleDateFormat("MM/dd/yyyy H:mm"); private static final TimeZone TIME_ZONE = TimeZone.getTimeZone("EST"); @SuppressWarnings("serial") - private static class AnotherSimpleDateFormat extends SimpleDateFormat { + public + static class AnotherSimpleDateFormat extends SimpleDateFormat { public AnotherSimpleDateFormat(String formatstring) { super(formatstring); //Calendar c = Calendar.getInstance(TIME_ZONE,Locale.US); Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java ============================================================================= --- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java (original) +++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasConditionsLoader.java Fri Jun 19 13:57:37 2015 @@ -203,18 +203,7 @@ RunMap runmap = getRunMapFromSpreadSheet(path); -// final RunSpreadsheet runSheet = new RunSpreadsheet(new File(path)); -// -// // Find the run ranges that have the same fields values. -// final List<RunRange> ranges = RunRange.findRunRanges(runSheet, FIELDS); -// logger.info("Found " + ranges.size() + " ranges."); -// for(RunRange range : ranges) logger.info(range.toString()); -// // find the run records (has converted dates and stuff) for these ranges -// RunMap runmap = runSheet.getRunMap(ranges); -// logger.info("Found " + runmap.size() + " runs in the run map."); - - - + // Load MYA dump SvtBiasMyaDumpReader biasMyaReader = new SvtBiasMyaDumpReader(cl.getOptionValue("m")); logger.info("Got " + biasMyaReader.getRanges().size() + " bias ranges"); @@ -225,37 +214,7 @@ List<SvtBiasRunRange> biasRunRanges = getBiasRunRanges(runmap,biasMyaReader); -// List<SvtBiasRunRange> biasRunRanges = new ArrayList<SvtBiasRunRange>(); -// // loop over runs from CSV -// RunData prev = null; -// for(Entry<Integer,RunData> entry : runmap.entrySet()) { -// int run = entry.getKey(); -// RunData data = entry.getValue(); -// logger.info("Processing " + run + " " + data.toString()); -// -// //check that data is ok -// if (isValid(data)) { -// if(prev!=null) { -// if(isValid(prev)) { -// if(prev.getEndDate().after(data.getStartDate())) { -// throw new RuntimeException("prev end date after run started?: " + prev.toString() + " " + data.toString()); -// } else if(prev.getStartDate().after(data.getEndDate())) { -// throw new RuntimeException("prev start date before run ended?: " + prev.toString() + " " + data.toString()); -// } -// } -// } -// -// // find the bias ranges applicable to this run -// SvtBiasMyaRanges overlaps = biasMyaReader.findOverlappingRanges(data.getStartDate(), data.getEndDate()); -// logger.fine("Found " + overlaps.size() + " overlapping bias ranges"); -// logger.fine(overlaps.toString()); -// -// biasRunRanges.add(new SvtBiasRunRange(data,overlaps)); -// prev = data; -// -// } -// } - + // fill graphs if(cl.hasOption("s")) { Modified: java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java ============================================================================= --- java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java (original) +++ java/trunk/conditions/src/main/java/org/hps/conditions/svt/SvtBiasMyaDumpReader.java Fri Jun 19 13:57:37 2015 @@ -13,6 +13,7 @@ import java.util.logging.Level; import java.util.logging.Logger; +import org.hps.conditions.run.RunSpreadsheet; import org.hps.conditions.run.RunSpreadsheet.RunData; import org.hps.util.BasicLogFormatter; import org.lcsim.util.log.LogUtil; @@ -33,8 +34,8 @@ } - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - private static final TimeZone timeZone = TimeZone.getTimeZone("EST"); + private static final SimpleDateFormat DATE_FORMAT = new RunSpreadsheet.AnotherSimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + //private static final TimeZone timeZone = TimeZone.getTimeZone("EST"); private static final double BIASVALUEON = 178.0; private List<SvtBiasMyaEntry> myaEntries = new ArrayList<SvtBiasMyaEntry>(); private SvtBiasMyaRanges biasRanges = new SvtBiasMyaRanges(); @@ -107,7 +108,7 @@ if(arr.length<3) { throw new ParseException("this line is not correct.",0); } - DATE_FORMAT.setTimeZone(timeZone); + Date date = DATE_FORMAT.parse(arr[0] + " " + arr[1]); double value = Double.parseDouble(arr[2]); SvtBiasMyaEntry entry = new SvtBiasMyaEntry(file.getName(), date, value); @@ -140,14 +141,14 @@ if( e.getValue() > BIASVALUEON) { if (range==null) { - logger.fine("BIAS ON: " + e.toString()); + logger.info("BIAS ON: " + e.toString()); range = new SvtBiasMyaRange(); range.setStart(e); } } else { //close it if (range!=null) { - logger.fine("BIAS TURNED OFF: " + e.toString()); + logger.info("BIAS TURNED OFF: " + e.toString()); range.setEnd(e); this.biasRanges.add(range); range = null;