Commit in hps-java/src/main/java/org/lcsim/hps on MAIN | |||
monitoring/svt/SVTSimpleEventDisplay.java | +4 | -1 | 1.8 -> 1.9 |
/SVTPulseFitPlots.java | +4 | -5 | 1.1 -> 1.2 |
evio/TriggerData.java | +72 | added 1.1 | |
/ECalEvioReader.java | +1 | -2 | 1.18 -> 1.19 |
/TestRunEvioToLcio.java | +224 | -215 | 1.16 -> 1.17 |
/LCSimTestRunEventBuilder.java | +67 | -33 | 1.16 -> 1.17 |
monitoring/ecal/EcalHitPlots.java | +117 | -2 | 1.5 -> 1.6 |
+489 | -258 |
add trigger bank to event
diff -u -r1.8 -r1.9 --- SVTSimpleEventDisplay.java 24 May 2012 19:48:40 -0000 1.8 +++ SVTSimpleEventDisplay.java 29 May 2012 22:25:09 -0000 1.9 @@ -21,7 +21,7 @@
* Plots hit counts for all SVT channels at each stage of reconstruction; * can be set to reset after each event for use as an event display *
- * @version $Id: SVTSimpleEventDisplay.java,v 1.8 2012/05/24 19:48:40 meeg Exp $
+ * @version $Id: SVTSimpleEventDisplay.java,v 1.9 2012/05/29 22:25:09 meeg Exp $
*/ public class SVTSimpleEventDisplay extends Driver implements Resettable {
@@ -71,6 +71,7 @@
return region; }
+ @Override
protected void detectorChanged(Detector detector) { plotterFrame = new AIDAFrame(); plotterFrame.setTitle("HPS SVT Hit Counts");
@@ -129,6 +130,7 @@
plotterFrame.setVisible(true); }
+ @Override
public void process(EventHeader event) { // Clear histograms. if (singleEvent) {
@@ -194,6 +196,7 @@
} }
+ @Override
public void endOfData() { plotterFrame.dispose(); }
diff -u -r1.1 -r1.2 --- SVTPulseFitPlots.java 24 May 2012 19:48:40 -0000 1.1 +++ SVTPulseFitPlots.java 29 May 2012 22:25:09 -0000 1.2 @@ -5,8 +5,6 @@
import java.util.List; import java.util.logging.Level; import java.util.logging.Logger;
-import org.lcsim.detector.identifier.IIdentifier; -import org.lcsim.detector.identifier.IIdentifierHelper;
import org.lcsim.detector.tracker.silicon.SiSensor; import org.lcsim.event.EventHeader; import org.lcsim.geometry.Detector;
@@ -151,11 +149,12 @@
aida.histogram1D(sensorName + "_amplitude").fill(fittedAmp); aida.histogram1D(sensorName + "_chisq").fill(fit.getShapeFitParameters().getChiSq());
- double pedestal = HPSSVTCalibrationConstants.getPedestal((SiSensor) fit.getRawTrackerHit().getDetectorElement(), strip); - double tp = HPSSVTCalibrationConstants.getTShaping((SiSensor) fit.getRawTrackerHit().getDetectorElement(), strip);
+ double noise = HPSSVTCalibrationConstants.getNoise(sensor, strip); + double pedestal = HPSSVTCalibrationConstants.getPedestal(sensor, strip); + double tp = HPSSVTCalibrationConstants.getTShaping(sensor, strip);
t0a[module][layer - 1].fill(fit.getT0(), fit.getAmp());
- if (fit.getAmp() > 500) {
+ if (fit.getAmp() > 4 * noise) {
for (int i = 0; i < fit.getRawTrackerHit().getADCValues().length; i++) { shape[module][layer - 1].fill((i * HPSSVTConstants.SAMPLE_INTERVAL - fit.getT0()) / tp, (fit.getRawTrackerHit().getADCValues()[i] - pedestal) / fit.getAmp()); // shape.fill((i * HPSSVTConstants.SAMPLE_INTERVAL - hrth.getT0()) / tp, (hrth.getRawTrackerHit().getADCValues()[i] - pedestal) / hrth.getAmp());
diff -N TriggerData.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ TriggerData.java 29 May 2012 22:25:10 -0000 1.1 @@ -0,0 +1,72 @@
+package org.lcsim.hps.evio; + +import org.lcsim.event.GenericObject; + +/** + * + * @author Sho Uemura <[log in to unmask]> + * @version $Id: TriggerData.java,v 1.1 2012/05/29 22:25:10 meeg Exp $ + */ +public class TriggerData implements GenericObject { + + private int[] bank; + + public TriggerData(int[] bank) { + this.bank = bank; + } + + public int getTime() { + return getIntVal(7); + } + + public int getOrTrig() { + return getIntVal(3); + } + + public int getTopTrig() { + return getIntVal(4); + } + + public int getBotTrig() { + return getIntVal(5); + } + + public int getPairTrig() { + return getIntVal(6); + } + + @Override + public int getNInt() { + return 8; + } + + @Override + public int getNFloat() { + return 0; + } + + @Override + public int getNDouble() { + return 0; + } + + @Override + public int getIntVal(int index) { + return bank[index]; + } + + @Override + public float getFloatVal(int index) { + throw new UnsupportedOperationException("No float values in " + this.getClass().getSimpleName()); + } + + @Override + public double getDoubleVal(int index) { + throw new UnsupportedOperationException("No double values in " + this.getClass().getSimpleName()); + } + + @Override + public boolean isFixedSize() { + return true; + } +}
diff -u -r1.18 -r1.19 --- ECalEvioReader.java 18 May 2012 07:41:49 -0000 1.18 +++ ECalEvioReader.java 29 May 2012 22:25:10 -0000 1.19 @@ -3,7 +3,6 @@
import java.util.ArrayList; import java.util.List; import org.jlab.coda.jevio.*;
-import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.Identifier; import org.lcsim.event.EventHeader; import org.lcsim.event.RawTrackerHit;
@@ -16,7 +15,7 @@
/** * * @author Sho Uemura <[log in to unmask]>
- * @version $Id: ECalEvioReader.java,v 1.18 2012/05/18 07:41:49 meeg Exp $
+ * @version $Id: ECalEvioReader.java,v 1.19 2012/05/29 22:25:10 meeg Exp $
*/ public class ECalEvioReader extends EvioReader { // Names of subdetectors.
diff -u -r1.16 -r1.17 --- TestRunEvioToLcio.java 23 May 2012 23:48:35 -0000 1.16 +++ TestRunEvioToLcio.java 29 May 2012 22:25:10 -0000 1.17 @@ -11,8 +11,6 @@
import org.apache.commons.cli.PosixParser; import org.jlab.coda.jevio.EvioEvent; import org.jlab.coda.jevio.EvioReader;
-import org.lcsim.conditions.ConditionsManager; -import org.lcsim.conditions.ConditionsManager.ConditionsNotFoundException;
import org.lcsim.event.EventHeader; import org.lcsim.hps.monitoring.HPSCalibrationListener; import org.lcsim.hps.monitoring.RunControlDialog;
@@ -33,218 +31,229 @@
*/ public class TestRunEvioToLcio {
- private static final String defaultDetectorName = "HPS-TestRun-v2"; - private static final String defaultSteeringFile = "/org/lcsim/hps/steering/DummyMonitoring.lcsim";
+ private static final String defaultDetectorName = "HPS-TestRun-v2"; + private static final String defaultSteeringFile = "/org/lcsim/hps/steering/DummyMonitoring.lcsim";
- /** - * Defines command line options for this program. - * - * @return The command line options. - */ - private static Options createCommandLineOptions() { - Options options = new Options(); - - options.addOption(new Option("l", true, "The name of the output LCIO file.")); - options.addOption(new Option("d", true, "The name of the detector to use for LCSim conditions.")); - options.addOption(new Option("x", true, "The LCSim XML file to process the LCIO events.")); - options.addOption(new Option("s", true, "Sleep duration between events (in ms)")); - options.addOption(new Option("e", true, "Stop after N events")); - options.addOption(new Option("w", false, "Wait after end of data")); - options.addOption(new Option("r", false, "Show run control window")); - - return options; - } - - /** - * This method will execute the EVIO to LCIO conversion and perform an - * intermediate LCSim job. Then the resultant LCIO events will be written to - * disk. - * - * @param args The command line arguments. - */ - public static void main(String[] args) { - int maxEvents = 0; - int nEvents = 0; - - // Set up command line parsing. - Options options = createCommandLineOptions(); - if (args.length == 0) { - System.out.println("TestRunEvioToLcio [options] [evioFiles]"); - HelpFormatter help = new HelpFormatter(); - help.printHelp(" ", options); - System.exit(1); - } - CommandLineParser parser = new PosixParser(); - - // Parse command line arguments. - CommandLine cl = null; - try { - cl = parser.parse(options, args); - } catch (ParseException e) { - throw new RuntimeException("Problem parsing command line options.", e); - } - - String lcioFileName = null; - LCIOWriter writer = null; - String detectorName = defaultDetectorName; - InputStream steeringStream = null; - int sleepTime = -1; - - // Remind people not to use -e any more - //if (cl.hasOption("e")) { - // System.out.println("Option -e is deprecated; EVIO file name is now a non-option argument"); - //} - - // LCIO output file. - if (cl.hasOption("l")) { - lcioFileName = cl.getOptionValue("l"); - } - - // Name of detector. - if (cl.hasOption("d")) { - detectorName = cl.getOptionValue("d"); - } - - // LCSim XML file to execute inline. - if (cl.hasOption("x")) { - String lcsimXmlName = cl.getOptionValue("x"); - try { - steeringStream = new FileInputStream(lcsimXmlName); - } catch (FileNotFoundException e) { - throw new RuntimeException(e); - } - } - - if (steeringStream == null) { - steeringStream = TestRunEvioToLcio.class.getResourceAsStream(defaultSteeringFile); - } - - // Sleep time. - if (cl.hasOption("s")) { - sleepTime = Integer.valueOf(cl.getOptionValue("s")); - } - - // Sleep time. - if (cl.hasOption("e")) { - maxEvents = Integer.valueOf(cl.getOptionValue("e")); - } - - RunControlDialog runControl = null; - - if (cl.hasOption("r")) { - runControl = new RunControlDialog(); - } - - // LCIO writer. - if (lcioFileName != null) { - try { - writer = new LCIOWriter(new File(lcioFileName)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - // LCSim job manager. - JobControlManager jobManager = new JobControlManager(); - jobManager.setup(steeringStream); - jobManager.configure(); - - try { //TODO: figure out whether this is the right way to do this - ConditionsManager.defaultInstance().setDetector(detectorName, 0); - } catch (ConditionsNotFoundException e) { - throw new RuntimeException(e); - } - - // LCSim event builder. - LCSimEventBuilder eventBuilder = new LCSimTestRunEventBuilder(); - eventBuilder.setDetectorName(detectorName); - - HPSCalibrationListener calibListener = new HPSCalibrationListener(); - calibListener.begin(); - - for (String evioFileName : cl.getArgs()) { - // EVIO input file. - File evioFile = new File(evioFileName); - System.out.println("Opening file " + evioFileName); - // EVIO reader. - EvioReader reader = null; - try { - reader = new EvioReader(evioFile); - } catch (IOException e) { - throw new RuntimeException(e); - } - - // Loop over EVIO events, build LCSim events, process them, and then - // write events to disk. - fileLoop: - while (maxEvents == 0 || nEvents < maxEvents) { - EvioEvent evioEvent = null; - try { - eventLoop: - while (evioEvent == null) { - evioEvent = reader.nextEvent(); - if (evioEvent == null) { - break fileLoop; - } - try { - reader.parseEvent(evioEvent); - } catch (Exception e) { - e.printStackTrace(); - continue eventLoop; - } - } - // Handlers for different event types. - if (EventConstants.isPreStartEvent(evioEvent)) { - int[] data = evioEvent.getIntData(); - int seconds = data[0]; - int runNumber = data[1]; - calibListener.prestart(seconds, runNumber); - } else if (EventConstants.isEndEvent(evioEvent)) { - int[] data = evioEvent.getIntData(); - int seconds = data[0]; - int nevents = data[2]; - calibListener.endRun(seconds, nevents); - } else if (eventBuilder.isPhysicsEvent(evioEvent)) { - EventHeader lcioEvent = eventBuilder.makeLCSimEvent(evioEvent); - if (runControl == null || runControl.process(lcioEvent)) { - jobManager.processEvent(lcioEvent); - if (writer != null) { - writer.write(lcioEvent); - writer.flush(); - } - } - } - } catch (Exception e) { - // Catch all event processing errors and continue. - e.printStackTrace(); - continue; - } finally { - if (sleepTime > 0) { - try { - Thread.sleep(sleepTime); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - } - nEvents++; - } - reader.close(); - } - System.out.println("No more data"); - - if (!cl.hasOption("w")) { - System.out.println("Exiting"); - jobManager.finish(); - } - - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - }
+ /** + * Defines command line options for this program. + * + * @return The command line options. + */ + private static Options createCommandLineOptions() { + Options options = new Options(); + + options.addOption(new Option("l", true, "The name of the output LCIO file.")); + options.addOption(new Option("d", true, "The name of the detector to use for LCSim conditions.")); + options.addOption(new Option("x", true, "The LCSim XML file to process the LCIO events.")); + options.addOption(new Option("s", true, "Sleep duration between events (in ms)")); + options.addOption(new Option("e", true, "Stop after N events")); + options.addOption(new Option("w", false, "Wait after end of data")); + options.addOption(new Option("r", false, "Show run control window")); + + return options; + } + + /** + * This method will execute the EVIO to LCIO conversion and perform an + * intermediate LCSim job. Then the resultant LCIO events will be written to + * disk. + * + * @param args The command line arguments. + */ + public static void main(String[] args) { + int maxEvents = 0; + int nEvents = 0; + + // Set up command line parsing. + Options options = createCommandLineOptions(); + if (args.length == 0) { + System.out.println("TestRunEvioToLcio [options] [evioFiles]"); + HelpFormatter help = new HelpFormatter(); + help.printHelp(" ", options); + System.exit(1); + } + CommandLineParser parser = new PosixParser(); + + // Parse command line arguments. + CommandLine cl = null; + try { + cl = parser.parse(options, args); + } catch (ParseException e) { + throw new RuntimeException("Problem parsing command line options.", e); + } + + String lcioFileName = null; + LCIOWriter writer = null; + String detectorName = defaultDetectorName; + InputStream steeringStream = null; + int sleepTime = -1; + + // Remind people not to use -e any more + //if (cl.hasOption("e")) { + // System.out.println("Option -e is deprecated; EVIO file name is now a non-option argument"); + //} + + // LCIO output file. + if (cl.hasOption("l")) { + lcioFileName = cl.getOptionValue("l"); + } + + // Name of detector. + if (cl.hasOption("d")) { + detectorName = cl.getOptionValue("d"); + } + + // LCSim XML file to execute inline. + if (cl.hasOption("x")) { + String lcsimXmlName = cl.getOptionValue("x"); + try { + steeringStream = new FileInputStream(lcsimXmlName); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + } + + if (steeringStream == null) { + steeringStream = TestRunEvioToLcio.class.getResourceAsStream(defaultSteeringFile); + } + + // Sleep time. + if (cl.hasOption("s")) { + sleepTime = Integer.valueOf(cl.getOptionValue("s")); + } + + // Sleep time. + if (cl.hasOption("e")) { + maxEvents = Integer.valueOf(cl.getOptionValue("e")); + } + + RunControlDialog runControl = null; + + if (cl.hasOption("r")) { + runControl = new RunControlDialog(); + } + + // LCIO writer. + if (lcioFileName != null) { + try { + writer = new LCIOWriter(new File(lcioFileName)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + // LCSim job manager. + JobControlManager jobManager = new JobControlManager(); + jobManager.setup(steeringStream); + jobManager.configure(); + + // LCSim event builder. + LCSimEventBuilder eventBuilder = new LCSimTestRunEventBuilder(); + eventBuilder.setDetectorName(detectorName); + + HPSCalibrationListener calibListener = new HPSCalibrationListener(); + calibListener.begin(); + + for (String evioFileName : cl.getArgs()) { + // EVIO input file. + File evioFile = new File(evioFileName); + System.out.println("Opening file " + evioFileName); + // EVIO reader. + EvioReader reader = null; + try { + reader = new EvioReader(evioFile); + } catch (IOException e) { + throw new RuntimeException(e); + } + + // Loop over EVIO events, build LCSim events, process them, and then + // write events to disk. + fileLoop: + while (maxEvents == 0 || nEvents < maxEvents) { + EvioEvent evioEvent = null; + try { + eventLoop: + while (evioEvent == null) { + evioEvent = reader.nextEvent(); + if (evioEvent == null) { + break fileLoop; + } + try { + reader.parseEvent(evioEvent); + } catch (Exception e) { + e.printStackTrace(); + continue eventLoop; + } + } + // Handlers for different event types. + if (EventConstants.isPreStartEvent(evioEvent)) { + int[] data = evioEvent.getIntData(); + int seconds = data[0]; + int runNumber = data[1]; + calibListener.prestart(seconds, runNumber); + } else if (EventConstants.isEndEvent(evioEvent)) { + int[] data = evioEvent.getIntData(); + int seconds = data[0]; + int nevents = data[2]; + calibListener.endRun(seconds, nevents); + } else if (eventBuilder.isPhysicsEvent(evioEvent)) { + EventHeader lcioEvent = eventBuilder.makeLCSimEvent(evioEvent); + if (runControl == null || runControl.process(lcioEvent)) { +// if (lcioEvent.hasCollection(BaseRawCalorimeterHit.class, "EcalReadoutHits") && !lcioEvent.get(BaseRawCalorimeterHit.class, "EcalReadoutHits").isEmpty()) { +// continue; +// } +// if (lcioEvent.hasCollection(TriggerData.class, "TriggerBank")) { +// List<TriggerData> triggerList = lcioEvent.get(TriggerData.class, "TriggerBank"); +// if (!triggerList.isEmpty()) { +// TriggerData triggerData = triggerList.get(0); +// +// int orTrig = triggerData.getOrTrig(); +// int topTrig = triggerData.getTopTrig(); +// int botTrig = triggerData.getBotTrig(); +// int pairTrig = triggerData.getPairTrig(); +// if (topTrig!=0 && botTrig!=0) { +// System.out.format("%x\t%x\t%x\t%x\n",orTrig, topTrig, botTrig,pairTrig); +// } else {continue;} +// } +// } + jobManager.processEvent(lcioEvent); + if (writer != null) { + writer.write(lcioEvent); + writer.flush(); + } + } + } + } catch (Exception e) { + // Catch all event processing errors and continue. + e.printStackTrace(); + continue; + } finally { + if (sleepTime > 0) { + try { + Thread.sleep(sleepTime); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + + } + nEvents++; + } + reader.close(); + } + System.out.println("No more data"); + + if (!cl.hasOption("w")) { + System.out.println("Exiting"); + jobManager.finish(); + } + + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }
}
\ No newline at end of file
diff -u -r1.16 -r1.17 --- LCSimTestRunEventBuilder.java 2 May 2012 20:31:38 -0000 1.16 +++ LCSimTestRunEventBuilder.java 29 May 2012 22:25:10 -0000 1.17 @@ -1,5 +1,7 @@
package org.lcsim.hps.evio;
+import java.util.ArrayList; +import java.util.List;
import org.jlab.coda.jevio.BaseStructure; import org.jlab.coda.jevio.EvioEvent; import org.jlab.coda.jevio.EvioException;
@@ -8,7 +10,7 @@
import org.lcsim.geometry.Detector; import org.lcsim.geometry.Subdetector; import org.lcsim.geometry.subdetector.HPSEcal3;
-import org.lcsim.geometry.subdetector.HPSTracker;
+//import org.lcsim.geometry.subdetector.HPSTracker;
import org.lcsim.util.loop.LCSimConditionsManagerImplementation; /**
@@ -22,7 +24,7 @@
public class LCSimTestRunEventBuilder implements LCSimEventBuilder { // Names of subdetectors.
- private String trackerName;
+// private String trackerName;
// Detector conditions object. private Detector detector; // Debug flag.
@@ -44,9 +46,10 @@
// Set default detector names by looking for HPS detector types. for (Subdetector subdet : detector.getSubdetectorList()) {
- if (subdet instanceof HPSTracker) { - trackerName = subdet.getName(); - } else if (subdet instanceof HPSEcal3) {
+// if (subdet instanceof HPSTracker) { +// trackerName = subdet.getName(); +// } else + if (subdet instanceof HPSEcal3) {
ecalReader.setEcalName(subdet.getName()); //System.out.println("calorimeterName = " + calorimeterName); }
@@ -62,44 +65,27 @@
ecalReader.setHitCollectionName(ecalHitCollectionName); }
- public void setTrackerName(String trackerName) { - this.trackerName = trackerName; - } - - public String getTrackerReadoutName() { - return detector.getSubdetector(trackerName).getReadout().getName(); - } -
+// public void setTrackerName(String trackerName) { +// this.trackerName = trackerName; +// } +// +// public String getTrackerReadoutName() { +// return detector.getSubdetector(trackerName).getReadout().getName(); +// }
public void setEcalName(String ecalName) { ecalReader.setEcalName(ecalName); }
- public Detector getDetector() { - return detector; - } -
+// public Detector getDetector() { +// return detector; +// }
public EventHeader makeLCSimEvent(EvioEvent evioEvent) throws EvioException { if (!isPhysicsEvent(evioEvent)) { throw new EvioException("Not a physics event: event tag " + evioEvent.getHeader().getTag()); }
- int[] eventID = {0, 0, 0}; - //array of length 3: {event number, trigger code, readout status} - if (evioEvent.getChildCount() > 0) { - for (BaseStructure bank : evioEvent.getChildren()) { - if (bank.getHeader().getTag() == EventConstants.EVENTID_BANK_TAG) { - eventID = bank.getIntData(); - } - } - } - - if (debug) { - System.out.println("Read EVIO event number " + eventID[0]); - } - -
// Create a new LCSimEvent.
- EventHeader lcsimEvent = new BaseLCSimEvent(0, eventID[0], detector.getDetectorName());
+ EventHeader lcsimEvent = getEventData(evioEvent);
// Make RawCalorimeterHit collection, combining top and bottom section of ECal into one list. try {
@@ -122,4 +108,52 @@
public boolean isPhysicsEvent(EvioEvent evioEvent) { return (evioEvent.getHeader().getTag() == EventConstants.PHYSICS_EVENT_TAG); }
+ + public EventHeader getEventData(EvioEvent evioEvent) { + int[] eventID = null; + //array of length 3: {event number, trigger code, readout status} + + List<TriggerData> triggerList = new ArrayList<TriggerData>(); + + if (evioEvent.getChildCount() > 0) { + for (BaseStructure bank : evioEvent.getChildren()) { + if (bank.getHeader().getTag() == EventConstants.EVENTID_BANK_TAG) { + eventID = bank.getIntData(); + } + if (bank.getHeader().getTag() == EventConstants.ECAL_TOP_BANK_TAG || bank.getHeader().getTag() == EventConstants.ECAL_BOTTOM_BANK_TAG) { + for (BaseStructure slotBank : bank.getChildren()) { + if (slotBank.getHeader().getTag() == EventConstants.TRIGGER_BANK_TAG) { + triggerList.add(new TriggerData(slotBank.getIntData())); + } + } + } + } + } + + if (eventID == null) { + System.out.println("No event ID bank found"); + eventID = new int[3]; + } else { + if (debug) { + System.out.println("Read EVIO event number " + eventID[0]); + } + if (eventID[1] != 1) { + System.out.println("Trigger code is usually 1; got " + eventID[1]); + } + if (eventID[2] != 0) { + System.out.println("Readout status is usually 0; got " + eventID[2]); + } + } + + // Create a new LCSimEvent. + EventHeader lcsimEvent = null; + if (triggerList.isEmpty() || triggerList.get(0).getTime() == 0) { + lcsimEvent = new BaseLCSimEvent(0, eventID[0], detector.getDetectorName()); + } else { + lcsimEvent = new BaseLCSimEvent(0, eventID[0], detector.getDetectorName(), ((long) triggerList.get(0).getTime()) * 1000000000); + } + + lcsimEvent.put("TriggerBank", triggerList, TriggerData.class, 0); + return lcsimEvent; + }
}
\ No newline at end of file
diff -u -r1.5 -r1.6 --- EcalHitPlots.java 18 May 2012 08:26:35 -0000 1.5 +++ EcalHitPlots.java 29 May 2012 22:25:10 -0000 1.6 @@ -1,6 +1,7 @@
package org.lcsim.hps.monitoring.ecal; import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
import hep.aida.IPlotter; import java.util.List;
@@ -8,6 +9,7 @@
import org.lcsim.event.EventHeader; import org.lcsim.geometry.Detector;
+import org.lcsim.hps.evio.TriggerData;
import org.lcsim.hps.monitoring.AIDAFrame; import org.lcsim.hps.monitoring.Resettable; import org.lcsim.util.Driver;
@@ -18,12 +20,14 @@
AIDAFrame plotterFrame; String inputCollection = "EcalCalHits"; AIDA aida = AIDA.defaultInstance();
- IPlotter plotter; - IPlotter plotter2;
+ IPlotter plotter, plotter2, plotter3;
IHistogram1D hitCountPlot; IHistogram1D hitTimePlot; IHistogram1D hitEnergyPlot; IHistogram1D hitMaxEnergyPlot;
+ IHistogram1D topTimePlot, botTimePlot, orTimePlot; + IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot; + IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
int eventn = 0; double maxE = 5000; boolean logScale = false;
@@ -80,26 +84,137 @@
plotter2.region(0).plot(hitEnergyPlot); plotter2.region(1).plot(hitMaxEnergyPlot);
+ plotter3 = aida.analysisFactory().createPlotterFactory().create("Hit Times"); + plotter3.setTitle("Hit Times"); + plotterFrame.addPlotter(plotter3); + plotter3.style().dataStyle().errorBarStyle().setVisible(false); + plotter3.createRegions(3, 3); + + topTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Top", 100, 0, 100 * 4.0); + botTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Bottom", 100, 0, 100 * 4.0); + orTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : First Hit Time, Or", 100, 0, 100 * 4.0); + + topTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Top", 32, 0, 32); + botTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Bottom", 32, 0, 32); + orTrigTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Trigger Time, Or", 32, 0, 32); + + topTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Top", 100, 0, 100 * 4.0, 32, 0, 32); + botTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Bottom", 100, 0, 100 * 4.0, 32, 0, 32); + orTimePlot2D = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time vs. Trig Time, Or", 100, 0, 100 * 4.0, 32, 0, 32); + + // Create the plotter regions. + plotter3.region(0).plot(topTimePlot); + plotter3.region(0).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(1).plot(botTimePlot); + plotter3.region(1).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(2).plot(orTimePlot); + plotter3.region(2).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(3).plot(topTrigTimePlot); + plotter3.region(3).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(4).plot(botTrigTimePlot); + plotter3.region(4).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(5).plot(orTrigTimePlot); + plotter3.region(5).style().yAxisStyle().setParameter("scale", "log"); + plotter3.region(6).plot(topTimePlot2D); + plotter3.region(6).style().setParameter("hist2DStyle", "colorMap"); + plotter3.region(6).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter3.region(6).style().zAxisStyle().setParameter("scale", "log"); + plotter3.region(7).plot(botTimePlot2D); + plotter3.region(7).style().setParameter("hist2DStyle", "colorMap"); + plotter3.region(7).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter3.region(7).style().zAxisStyle().setParameter("scale", "log"); + plotter3.region(8).plot(orTimePlot2D); + plotter3.region(8).style().setParameter("hist2DStyle", "colorMap"); + plotter3.region(8).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + plotter3.region(8).style().zAxisStyle().setParameter("scale", "log"); +
plotterFrame.setVisible(true); plotterFrame.pack(); } public void process(EventHeader event) {
+ int orTrigTime = -1; + int topTrigTime = -1; + int botTrigTime = -1; + if (event.hasCollection(TriggerData.class, "TriggerBank")) { + List<TriggerData> triggerList = event.get(TriggerData.class, "TriggerBank"); + if (!triggerList.isEmpty()) { + TriggerData triggerData = triggerList.get(0); + + int orTrig = triggerData.getOrTrig(); + if (orTrig != 0) { + for (int i = 0; i < 32; i++) { + if ((1 << (31 - i) & orTrig) != 0) { + orTrigTime = i; + orTrigTimePlot.fill(i); + break; + } + } + } + int topTrig = triggerData.getTopTrig(); + if (topTrig != 0) { + for (int i = 0; i < 32; i++) { + if ((1 << (31 - i) & topTrig) != 0) { + topTrigTime = i; + topTrigTimePlot.fill(i); + break; + } + } + } + int botTrig = triggerData.getBotTrig(); + if (botTrig != 0) { + for (int i = 0; i < 32; i++) { + if ((1 << (31 - i) & botTrig) != 0) { + botTrigTime = i; + botTrigTimePlot.fill(i); + break; + } + } + } + } + } +
if (event.hasCollection(CalorimeterHit.class, inputCollection)) { List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection); hitCountPlot.fill(hits.size()); double maxEnergy = 0;
+ double topTime = Double.POSITIVE_INFINITY; + double botTime = Double.POSITIVE_INFINITY; + double orTime = Double.POSITIVE_INFINITY;
for (CalorimeterHit hit : hits) { hitEnergyPlot.fill(hit.getRawEnergy()); hitTimePlot.fill(hit.getTime());
+ if (hit.getTime() < orTime) { + orTime = hit.getTime(); + } + if (hit.getIdentifierFieldValue("iy") > 0 && hit.getTime() < topTime) { + topTime = hit.getTime(); + } + if (hit.getIdentifierFieldValue("iy") < 0 && hit.getTime() < botTime) { + botTime = hit.getTime(); + }
if (hit.getRawEnergy() > maxEnergy) { maxEnergy = hit.getRawEnergy(); } }
+ if (orTime != Double.POSITIVE_INFINITY) { + orTimePlot.fill(orTime); + orTimePlot2D.fill(orTime, orTrigTime); + } + if (topTime != Double.POSITIVE_INFINITY) { + topTimePlot.fill(topTime); + topTimePlot2D.fill(topTime, topTrigTime); + } + if (botTime != Double.POSITIVE_INFINITY) { + botTimePlot.fill(botTime); + botTimePlot2D.fill(botTime, botTrigTime); + }
hitMaxEnergyPlot.fill(maxEnergy); } else { hitCountPlot.fill(0); }
+ +
} // public void endOfData() {
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1