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  November 2014

HPS-SVN November 2014

Subject:

r1589 - in /java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots: EcalChannelADCSumPlotsDriver.java EcalChannelEnergyPlotsDriver.java

From:

[log in to unmask]

Reply-To:

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

Date:

Wed, 26 Nov 2014 00:28:18 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (219 lines)

Author: [log in to unmask]
Date: Tue Nov 25 16:28:14 2014
New Revision: 1589

Log:
Add Drivers for plotting ECAL channel data.

Added:
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelADCSumPlotsDriver.java   (with props)
    java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelEnergyPlotsDriver.java   (with props)

Added: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelADCSumPlotsDriver.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelADCSumPlotsDriver.java	(added)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelADCSumPlotsDriver.java	Tue Nov 25 16:28:14 2014
@@ -0,0 +1,104 @@
+package org.hps.monitoring.ecal.plots;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+import hep.aida.IPlotterStyle;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hps.conditions.database.TableConstants;
+import org.hps.conditions.ecal.EcalChannel;
+import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
+import org.hps.conditions.ecal.EcalConditions;
+import org.hps.recon.ecal.EcalRawConverter;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * This Driver will create a histogram for every crystal in the ECAL and plot the sum of
+ * its ADC values for the raw hit, minus the channel's pedestal value from the conditions system.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class EcalChannelADCSumPlotsDriver extends Driver {
+
+    EcalConditions conditions = null;
+    EcalChannelCollection channels = null;
+    EcalRawConverter ecalRawConverter = null;
+
+    List<List<IPlotter>> plotterLists = new ArrayList<List<IPlotter>>();
+
+    AIDA aida = AIDA.defaultInstance();
+    IAnalysisFactory analysisFactory = aida.analysisFactory();
+
+    public void detectorChanged(Detector detector) {
+
+        conditions = ConditionsManager.defaultInstance().getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
+        
+        ecalRawConverter = new EcalRawConverter();
+        ecalRawConverter.setDetector(null);
+
+        channels = conditions.getChannelCollection();
+
+        Set<Integer> crates = new HashSet<Integer>();
+        Set<Integer> slots = new HashSet<Integer>();
+        Set<Integer> channels = new HashSet<Integer>();
+
+        for (EcalChannel channel : conditions.getChannelCollection()) {
+            if (channel == null) {
+                throw new RuntimeException("EcalChannel in collection is null.");
+            }
+            crates.add(channel.getCrate());
+            slots.add(channel.getSlot());
+            channels.add(channel.getChannel());
+        }
+                                
+        for (Integer crate : crates) {
+            IPlotterFactory plotterFactory = analysisFactory.createPlotterFactory("ECAL Sum ADC - Crate " + crate);
+            IPlotterStyle style = plotterFactory.createPlotterStyle();
+            style.dataStyle().lineStyle().setVisible(false);
+            style.legendBoxStyle().setVisible(false);
+            int plottersIndex = crate - 1;
+            plotterLists.add(new ArrayList<IPlotter>());
+            List<IPlotter> plotters = plotterLists.get(plottersIndex);
+            for (Integer slot : slots) {
+                IPlotter plotter = plotterFactory.create("Slot " + slot);
+                plotters.add(plotter);
+                plotter.createRegions(4, 4);
+                for (Integer channel : channels) {
+                    String adcSumPlotName = "Sum ADC Values : " + crate + " : " + slot + " : " + channel;
+                    IHistogram1D adcSumHistogram = aida.histogram1D(adcSumPlotName, 600, -6000., 6000.);
+                    plotter.region(channel).plot(adcSumHistogram, style);
+                }
+                plotter.show();
+            }
+        }
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(RawTrackerHit.class, "EcalReadoutHits")) {
+            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, "EcalReadoutHits");
+            for (RawTrackerHit hit : hits) {
+                EcalChannel channel = channels.findGeometric(hit.getCellID());
+                if (channel != null) {
+                    try {
+                        aida.histogram1D("Sum ADC Values : " + channel.getCrate() + " : " + channel.getSlot() + " : " + channel.getChannel())
+                            .fill(ecalRawConverter.sumADC(hit));
+                    } catch (IllegalArgumentException e) {
+                        e.printStackTrace();
+                    }
+                } else {
+                    System.err.println("EcalChannel not found for cell ID 0x" + String.format("%08d", Long.toHexString(hit.getCellID())));
+                }
+            }
+        }
+    }
+}

Added: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelEnergyPlotsDriver.java
 =============================================================================
--- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelEnergyPlotsDriver.java	(added)
+++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalChannelEnergyPlotsDriver.java	Tue Nov 25 16:28:14 2014
@@ -0,0 +1,92 @@
+package org.hps.monitoring.ecal.plots;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+import hep.aida.IPlotterStyle;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hps.conditions.database.TableConstants;
+import org.hps.conditions.ecal.EcalChannel;
+import org.hps.conditions.ecal.EcalChannel.EcalChannelCollection;
+import org.hps.conditions.ecal.EcalConditions;
+import org.lcsim.conditions.ConditionsManager;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.EventHeader;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * This Driver will create a histogram for every channel in the ECAL and plot its corrected energy.
+ * @author Jeremy McCormick <[log in to unmask]>
+ */
+public class EcalChannelEnergyPlotsDriver extends Driver {
+
+    EcalConditions conditions = null;
+    EcalChannelCollection channels = null;
+
+    List<List<IPlotter>> plotterLists = new ArrayList<List<IPlotter>>();
+
+    AIDA aida = AIDA.defaultInstance();
+    IAnalysisFactory analysisFactory = aida.analysisFactory();
+
+    public void detectorChanged(Detector detector) {
+        
+        conditions = ConditionsManager.defaultInstance().getCachedConditions(EcalConditions.class, TableConstants.ECAL_CONDITIONS).getCachedData();
+        
+        channels = conditions.getChannelCollection();
+
+        Set<Integer> crates = new HashSet<Integer>();
+        Set<Integer> slots = new HashSet<Integer>();
+        Set<Integer> channels = new HashSet<Integer>();
+
+        for (EcalChannel channel : conditions.getChannelCollection()) {
+            crates.add(channel.getCrate());
+            slots.add(channel.getSlot());
+            channels.add(channel.getChannel());
+        }
+                
+                        
+        for (Integer crate : crates) {
+            IPlotterFactory plotterFactory = analysisFactory.createPlotterFactory("ECAL Energy - Crate " + crate);
+            IPlotterStyle style = plotterFactory.createPlotterStyle();
+            style.dataStyle().lineStyle().setVisible(false);
+            style.legendBoxStyle().setVisible(false);
+            int plottersIndex = crate - 1;
+            plotterLists.add(new ArrayList<IPlotter>());
+            List<IPlotter> plotters = plotterLists.get(plottersIndex);
+            for (Integer slot : slots) {
+                IPlotter plotter = plotterFactory.create("Slot " + slot);
+                plotters.add(plotter);
+                plotter.createRegions(4, 4);
+                for (Integer channel : channels) {
+                                        
+                    String energyPlotName = "Crystal Energy : " + crate + " : " + slot + " : " + channel;
+                    IHistogram1D energyHistogram = aida.histogram1D(energyPlotName, 200, -1., 1.);
+                    
+                    plotter.region(channel).plot(energyHistogram, style);
+                }
+                plotter.show();
+            }
+        }
+    }
+
+    public void process(EventHeader event) {
+        if (event.hasCollection(CalorimeterHit.class, "EcalCalHits")) {
+            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, "EcalCalHits");
+            for (CalorimeterHit hit : hits) {
+                EcalChannel channel = channels.findGeometric(hit.getCellID());
+                if (channel != null) {
+                    aida.histogram1D("Crystal Energy : " + channel.getCrate() + " : " + channel.getSlot() + " : " + channel.getChannel())
+                        .fill(hit.getCorrectedEnergy());
+                }                   
+            }
+        }
+    }
+}

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