LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  February 2015

HPS-SVN February 2015

Subject:

r2183 - in /java/trunk: monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/ steering-files/src/main/resources/org/hps/steering/users/baltzell/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Tue, 24 Feb 2015 22:00:58 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (201 lines)

Author: [log in to unmask]
Date: Tue Feb 24 14:00:51 2015
New Revision: 2183

Log:
adding ECal pedestal monitoring

Added:
    java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/EcalPedestalMonitor.java
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalMonitor.lcsim
    java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalViewer.lcsim

Added: java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/EcalPedestalMonitor.java
 =============================================================================
--- java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/EcalPedestalMonitor.java	(added)
+++ java/trunk/monitoring-app/src/main/java/org/hps/monitoring/subsys/ecal/EcalPedestalMonitor.java	Tue Feb 24 14:00:51 2015
@@ -0,0 +1,133 @@
+package org.hps.monitoring.subsys.ecal;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hps.conditions.database.TableConstants;
+import org.hps.conditions.ecal.EcalChannel;
+import org.hps.conditions.ecal.EcalConditions;
+import org.hps.monitoring.plotting.MonitoringPlotFactory;
+import org.hps.monitoring.plotting.StripChartUtil;
+import org.jfree.chart.JFreeChart;
+import org.jfree.data.time.Millisecond;
+import org.jfree.data.time.TimeSeries;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+import hep.aida.IPlotterFactory;
+/*
+ * Reads output of org.hps.recon.ecal.RunningPedestalDriver and makes strip charts.
+ * Baltzell
+ */
+public class EcalPedestalMonitor extends Driver {
+
+    int maxAge = 999999999;
+    int maxCount = 100000;
+    int rangeSize = 100000;
+   
+    final int crates[]={1,2};
+    final int slots[]={3,4,5,6,7,8,9,14,15,16,17,18,19,20};
+    
+    String collectionName = "EcalRunningPedestals";
+    
+//    static {
+//        org.hps.monitoring.plotting.MonitoringAnalysisFactory.register();
+//    }
+    MonitoringPlotFactory plotFactory = (MonitoringPlotFactory) AIDA.defaultInstance()
+            .analysisFactory().createPlotterFactory("ECal Pedestal Monitoring");
+
+    Map<Integer, Map<Integer, JFreeChart>> stripCharts = new HashMap<Integer, Map<Integer, JFreeChart>>();
+    Map<Integer, Map<Integer, TimeSeries>> stripCharts2 = new HashMap<Integer, Map<Integer, TimeSeries>>();
+
+    private EcalConditions ecalConditions = null;
+    
+    public void startOfData() {
+        //plotFactory.createStripChart("X","Y",maxAge,maxCount,rangeSize);
+        plotFactory.create().show();
+    }
+
+    @Override
+    public void detectorChanged(Detector detector) {
+        ecalConditions = ConditionsManager.defaultInstance()
+                .getCachedConditions(EcalConditions.class,TableConstants.ECAL_CONDITIONS)
+                .getCachedData();
+        /*
+        for (EcalChannel cc : ecalConditions.getChannelCollection()) {
+            final int crate = cc.getCrate();
+            final int slot = cc.getSlot();
+            if (!stripCharts.containsKey(crate)) {
+                stripCharts.put(crate,new HashMap<Integer, JFreeChart>());
+            }
+            if (!stripCharts2.containsKey(crate)) {
+                stripCharts2.put(crate,new HashMap<Integer, TimeSeries>());
+            }
+            if (!stripCharts.get(crate).containsKey(slot)) {
+                String name = String.format("C%dS%02d",crate,slot);
+                JFreeChart stripChart = plotFactory.createStripChart(name,"asdf",
+                        maxAge,maxCount,rangeSize);
+                stripCharts.get(crate).put(slot,stripChart);
+                stripCharts2.get(crate).put(slot,StripChartUtil.getTimeSeries(stripChart));
+            }
+        }
+        */
+        // put them in order:
+        for (int crate : crates) {
+            stripCharts.put(crate,new HashMap<Integer, JFreeChart>());
+            stripCharts2.put(crate,new HashMap<Integer, TimeSeries>());
+            for (int slot : slots) {
+                String name = String.format("C%dS%02d",crate,slot);
+                JFreeChart stripChart = plotFactory.createStripChart(name,"asdf",
+                        maxAge,maxCount,rangeSize);
+                stripCharts.get(crate).put(slot,stripChart);
+                stripCharts2.get(crate).put(slot,StripChartUtil.getTimeSeries(stripChart));
+            }
+        }
+    }
+
+    @Override
+    public void process(EventHeader event) {
+
+        if (!event.hasItem(collectionName)) {
+            return;
+        }
+
+        // get the running pedestals:
+        Map<EcalChannel, Double> peds = (Map<EcalChannel, Double>) event.get(collectionName);
+
+        // tally slot pedestals:
+        Map<Integer, Map<Integer, Double>> pedsum = new HashMap<Integer, Map<Integer, Double>>();
+        Map<Integer, Map<Integer, Integer>> npedsum = new HashMap<Integer, Map<Integer, Integer>>();
+        for (EcalChannel cc : peds.keySet()) {
+            final Double ped = peds.get(cc);
+            final int crate = cc.getCrate();
+            final int slot = cc.getSlot();
+            if (!pedsum.containsKey(crate)) {
+                pedsum.put(crate,new HashMap<Integer, Double>());
+            }
+            if (!npedsum.containsKey(crate)) {
+                npedsum.put(crate,new HashMap<Integer, Integer>());
+            }
+            if (!pedsum.get(crate).containsKey(slot)) {
+                pedsum.get(crate).put(slot,0.0);
+            }
+            if (!npedsum.get(crate).containsKey(slot)) {
+                npedsum.get(crate).put(slot,0);
+            }
+            npedsum.get(crate).put(slot,npedsum.get(crate).get(slot) + 1);
+            pedsum.get(crate).put(slot,pedsum.get(crate).get(slot) + ped);
+        }
+
+        // fill strip charts:
+        for (int crate : pedsum.keySet()) {
+            for (int slot : pedsum.get(crate).keySet()) {
+
+                final double ped = pedsum.get(crate).get(slot) / npedsum.get(crate).get(slot);
+                stripCharts2.get(crate).get(slot).add(new Millisecond(new Date()),ped);
+            }
+        }
+
+    }
+}

Added: java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalMonitor.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalMonitor.lcsim	(added)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalMonitor.lcsim	Tue Feb 24 14:00:51 2015
@@ -0,0 +1,20 @@
+<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+    xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
+    <execute>
+        <driver name="EcalRawConverter" />
+        <driver name="EcalRunningPedestal"/>
+        <driver name="EcalPedestalMonitor"/>
+        <driver name="CleanupDriver" />
+    </execute>
+    <drivers>
+        <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
+        </driver>
+        <driver name="EcalRunningPedestal" type="org.hps.recon.ecal.ECalRunningPedestalDriver">
+            <minLookbackEvents>10</minLookbackEvents>
+            <maxLookbackEvents>50</maxLookbackEvents>
+        </driver>
+        <driver name="EcalPedestalMonitor" type="org.hps.monitoring.subsys.ecal.EcalPedestalMonitor">
+        </driver>
+        <driver name="CleanupDriver" type="org.lcsim.recon.tracking.digitization.sisim.config.ReadoutCleanupDriver" />
+    </drivers>
+</lcsim>

Added: java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalViewer.lcsim
 =============================================================================
--- java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalViewer.lcsim	(added)
+++ java/trunk/steering-files/src/main/resources/org/hps/steering/users/baltzell/EcalPedestalViewer.lcsim	Tue Feb 24 14:00:51 2015
@@ -0,0 +1,18 @@
+<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+    xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd">
+    <execute>
+        <driver name="EcalRawConverter" />
+        <driver name="EcalPedestalCalculator"/>
+        <driver name="EcalPedestalViewer"/>
+        <driver name="CleanupDriver" />
+    </execute>
+    <drivers>
+        <driver name="EcalRawConverter" type="org.hps.recon.ecal.EcalRawConverterDriver">
+        </driver>
+        <driver name="EcalPedestalCalculator" type="org.hps.recon.ecal.EcalPedestalCalculator">
+        </driver>
+        <driver name="EcalPedestalViewer" type="org.hps.monitoring.ecal.plots.EcalPedestalViewer">
+        </driver>
+        <driver name="CleanupDriver" type="org.lcsim.recon.tracking.digitization.sisim.config.ReadoutCleanupDriver" />
+    </drivers>
+</lcsim>

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use