Print

Print


Commit in hps-java/src/main on MAIN
java/org/lcsim/hps/monitoring/EcalDaqPlots.java+107added 1.1
resources/org/lcsim/hps/steering/TestRunMonitoring.lcsim+8-31.2 -> 1.3
+115-3
1 added + 1 modified, total 2 files
add ecal daq plots to default monitoring setup

hps-java/src/main/java/org/lcsim/hps/monitoring
EcalDaqPlots.java added at 1.1
diff -N EcalDaqPlots.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EcalDaqPlots.java	13 Apr 2012 00:07:25 -0000	1.1
@@ -0,0 +1,107 @@
+package org.lcsim.hps.monitoring;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
+import hep.aida.ref.plotter.PlotterRegion;
+
+import jas.hist.JASHist;
+
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.compact.Subdetector;
+import org.lcsim.hps.recon.ecal.HPSEcalDaqIDConverter;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class EcalDaqPlots extends Driver implements Resettable {
+    
+    String subdetectorName;
+    String inputCollection;
+    HPSEcalDaqIDConverter idMap;
+    IPlotter plotter;
+    AIDA aida;
+    Detector detector;
+    
+    public EcalDaqPlots() {}
+    
+    public void setSubdetectorName(String subdetectorName) {
+        this.subdetectorName = subdetectorName;
+    }
+    
+    public void setInputCollection(String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+    
+    public void detectorChanged(Detector detector) {
+        
+        this.detector = detector;
+        
+        if (subdetectorName == null) {
+            throw new RuntimeException("The subdetectorName parameter was not set.");
+        }
+        
+        if (inputCollection == null) {
+            throw new RuntimeException("The inputCollection parameter was not set.");
+        }
+        
+        Subdetector subdetector = detector.getSubdetector(subdetectorName);
+        idMap = new HPSEcalDaqIDConverter();
+        idMap.fillDaqCellMap(subdetector);
+        
+        setupPlots();
+    }
+    
+    private void setupPlots() {
+        aida = AIDA.defaultInstance();
+        aida.tree().cd("/");
+        plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECAL DAQ Plots");
+        IPlotterStyle pstyle = plotter.style();
+        pstyle.dataStyle().fillStyle().setColor("orange");
+        pstyle.dataStyle().markerStyle().setColor("orange");
+        pstyle.dataStyle().errorBarStyle().setVisible(false);
+        plotter.createRegions(7, 4);
+        int region = 0;
+        for (int i=0; i<14; i++) { // slot
+            for (int j=1; j<3; j++) { // crate                
+                System.out.println("creating plot: " + "ECAL: Crate " + j + "; Slot " + i + " in region " + region);
+                IHistogram1D hist = aida.histogram1D("ECAL: Crate " + j + "; Slot " + i, 16, 0, 16);
+                plotter.region(region).plot(hist);
+                JASHist jhist = ((PlotterRegion)plotter.region(region)).getPlot();
+                jhist.setAllowUserInteraction(false);
+                jhist.setAllowPopupMenus(false);
+                region++;
+            }
+        }
+        plotter.show();
+    }
+    
+    public void endOfData() {
+        if (plotter != null)
+            plotter.hide();
+    }    
+    
+    public void reset() {
+        if (plotter != null) {
+            plotter.hide();
+            plotter.destroyRegions();
+            detectorChanged(detector);
+        }
+    }
+    
+    public void process(EventHeader event) {
+        List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, inputCollection);
+        for (RawCalorimeterHit hit : hits) {
+            Long daqId = idMap.physicalToDaqID(hit.getCellID());
+            int crate = HPSEcalDaqIDConverter.getCrate(daqId);
+            int slot = HPSEcalDaqIDConverter.getSlot(daqId);
+            int channel = HPSEcalDaqIDConverter.getChannel(daqId);
+            System.out.println("crate="+crate+"; slot="+slot+"; channel="+channel);
+            System.out.println("filling plot: " + "ECAL: Crate " + crate + "; Slot " + slot);
+            aida.histogram1D("ECAL: Crate " + crate + "; Slot " + slot).fill(channel);
+        }
+    }
+}

hps-java/src/main/resources/org/lcsim/hps/steering
TestRunMonitoring.lcsim 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- TestRunMonitoring.lcsim	6 Apr 2012 00:10:43 -0000	1.2
+++ TestRunMonitoring.lcsim	13 Apr 2012 00:07:25 -0000	1.3
@@ -13,12 +13,17 @@
         <driver name="SVTSetupDriver"/>
         <driver name="HPSSVTDAQMaps"/>
         <driver name="SVTDataToRawTrackerHitDriver"/>
+        <driver name="EcalDaqPlots"/>
         <driver name="EcalMonitoringPlots"/>
-        <driver name="OccupancyPlots"/>
+        <driver name="SVTOccupancyPlots"/>
     </execute>    
     <drivers>
-        <driver name="EcalMonitoringPlots" type="org.lcsim.hps.monitoring.EcalMonitoringPlots"/>        
-        <driver name="OccupancyPlots" type="org.lcsim.hps.monitoring.SensorOccupancyPlotsDriver">
+        <driver name="EcalDaqPlots" type="org.lcsim.hps.monitoring.EcalDaqPlots">
+            <subdetectorName>Ecal</subdetectorName>
+            <inputCollection>EcalRawHits</inputCollection>
+        </driver>
+        <driver name="EcalMonitoringPlots" type="org.lcsim.hps.monitoring.EcalMonitoringPlots"/>
+        <driver name="SVTOccupancyPlots" type="org.lcsim.hps.monitoring.SensorOccupancyPlotsDriver">
             <rawTrackerHitCollectionName>SVTRawTrackerHits</rawTrackerHitCollectionName>
             <eventRefreshRate>1</eventRefreshRate>
         </driver>
CVSspam 0.2.12


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