Commit in hps-java/src/main on MAIN | |||
resources/org/lcsim/hps/steering/ECalMonitoring.lcsim | +9 | 1.1 -> 1.2 | |
/TestRunMonitoring.lcsim | +1 | -1 | 1.9 -> 1.10 |
java/org/lcsim/hps/monitoring/ecal/EcalPedestalPlots.java | +2 | -1 | 1.3 -> 1.4 |
/EcalEventMonitor.java | +47 | -7 | 1.5 -> 1.6 |
java/org/lcsim/hps/recon/ecal/HPSEcalClusterer.java | +140 | -135 | 1.17 -> 1.18 |
/HPSEcalRawConverter.java | +68 | -99 | 1.2 -> 1.3 |
/HPSEcalRawConverterDriver.java | +75 | -91 | 1.2 -> 1.3 |
java/org/lcsim/hps/monitoring/AIDAFrame.java | +1 | -2 | 1.3 -> 1.4 |
+343 | -336 |
convert raw FADC hits to CalorimeterHits; show clusters on ECal event monitor
diff -u -r1.1 -r1.2 --- ECalMonitoring.lcsim 2 May 2012 16:53:29 -0000 1.1 +++ ECalMonitoring.lcsim 4 May 2012 16:35:44 -0000 1.2 @@ -7,12 +7,16 @@
</control> <execute> <driver name="EventMarkerDriver"/>
+ <driver name="EcalRawConverter"/> + <driver name="EcalClusterer"/>
<driver name="EcalPedestalPlots"/> <driver name="EcalDaqPlots"/> <driver name="EcalMonitoringPlots"/> <driver name="EcalEventMonitor"/> </execute> <drivers>
+ <driver name="EcalRawConverter" type="org.lcsim.hps.recon.ecal.HPSEcalRawConverterDriver"> + </driver>
<driver name="EcalDaqPlots" type="org.lcsim.hps.monitoring.ecal.EcalDaqPlots"> </driver> <driver name="EcalMonitoringPlots" type="org.lcsim.hps.monitoring.ecal.EcalMonitoringPlots"/>
@@ -33,5 +37,10 @@
type="org.lcsim.job.EventMarkerDriver"> <eventInterval>1</eventInterval> </driver>
+ <driver name="EcalClusterer" + type="org.lcsim.hps.recon.ecal.HPSEcalClusterer"> + <ecalName>Ecal</ecalName> + <ecalCollectionName>EcalCalHits</ecalCollectionName> + </driver>
</drivers> </lcsim>
diff -u -r1.9 -r1.10 --- TestRunMonitoring.lcsim 30 Apr 2012 18:46:59 -0000 1.9 +++ TestRunMonitoring.lcsim 4 May 2012 16:35:44 -0000 1.10 @@ -20,7 +20,7 @@
</driver> <driver name="EcalMonitoringPlots" type="org.lcsim.hps.monitoring.ecal.EcalMonitoringPlots"/> <driver name="EcalEventMonitor" type="org.lcsim.hps.monitoring.ecal.EcalEventMonitor">
- <eventRefreshRate>10</eventRefreshRate>
+ <eventRefreshRate>1</eventRefreshRate>
</driver> <driver name="SVTOccupancyPlots" type="org.lcsim.hps.monitoring.svt.SensorOccupancyPlotsDriver"> <rawTrackerHitCollectionName>SVTRawTrackerHits</rawTrackerHitCollectionName>
diff -u -r1.3 -r1.4 --- EcalPedestalPlots.java 4 May 2012 02:24:43 -0000 1.3 +++ EcalPedestalPlots.java 4 May 2012 16:35:44 -0000 1.4 @@ -88,7 +88,8 @@
private void setupPlots() { // Setup the plotter.
- plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Pedestal Plots");
+ plotter = aida.analysisFactory().createPlotterFactory().create(); + plotter.setTitle("HPS ECal Pedestal Plots");
plotterFrame = new AIDAFrame(); plotterFrame.addPlotter(plotter); plotterFrame.setVisible(true);
diff -u -r1.5 -r1.6 --- EcalEventMonitor.java 4 May 2012 02:24:43 -0000 1.5 +++ EcalEventMonitor.java 4 May 2012 16:35:44 -0000 1.6 @@ -12,6 +12,7 @@
import java.util.List; import javax.swing.JButton; import javax.swing.JCheckBox;
+import org.lcsim.event.CalorimeterHit;
import org.lcsim.event.EventHeader; import org.lcsim.event.RawCalorimeterHit;
@@ -19,6 +20,7 @@
import org.lcsim.geometry.Detector; import org.lcsim.geometry.IDDecoder; import org.lcsim.hps.monitoring.AIDAFrame;
+import org.lcsim.hps.recon.ecal.HPSEcalCluster;
import org.lcsim.hps.recon.ecal.HPSEcalConditions; import org.lcsim.util.Driver; import org.lcsim.util.aida.AIDA;
@@ -27,9 +29,11 @@
String subdetectorName = "Ecal"; String inputCollectionName = "EcalReadoutHits";
+ String clusterCollectionName = "EcalClusters";
AIDA aida = AIDA.defaultInstance(); IPlotter plotter; IHistogram2D hitPlot;
+ IHistogram2D clusterPlot;
IDDecoder dec; Detector detector; int eventRefreshRate = 1;
@@ -78,16 +82,19 @@
aida.tree().cd("/"); hitPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollectionName + " : Mean ADC Value", 47, -23.5, 23.5, 11, -5.5, 5.5);
- // Setup the plotter. - plotter = aida.analysisFactory().createPlotterFactory().create("HPS ECal Event Monitor");
+ clusterPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollectionName + " : Energy", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ String title = "HPS ECal Event Monitor"; + // Setup the plotter. + plotter = aida.analysisFactory().createPlotterFactory().create(); + plotter.setTitle(title);
plotterFrame = new AIDAFrame(); plotterFrame.addPlotter(plotter); plotterFrame.setVisible(true);
- plotterFrame.setTitle("HPS ECal Event Monitor");
+ plotterFrame.setTitle(title);
// Create the plotter regions.
- plotter.createRegion();
+ plotter.createRegions(1, 2);
plotter.style().statisticsBoxStyle().setVisible(false); IPlotterStyle style = plotter.region(0).style(); style.setParameter("hist2DStyle", "colorMap");
@@ -97,6 +104,14 @@
((PlotterRegion) plotter.region(0)).getPlot().setAllowUserInteraction(false); ((PlotterRegion) plotter.region(0)).getPlot().setAllowPopupMenus(false);
+ style = plotter.region(1).style(); + style.setParameter("hist2DStyle", "colorMap"); + style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow"); + style.zAxisStyle().setParameter("scale", "lin"); + plotter.region(1).plot(clusterPlot); + ((PlotterRegion) plotter.region(1)).getPlot().setAllowUserInteraction(false); + ((PlotterRegion) plotter.region(1)).getPlot().setAllowPopupMenus(false); +
if (singleEvent) { nextButton = new JButton("next"); nextButton.addActionListener(this);
@@ -149,6 +164,24 @@
plotNextEvent = false; } }
+ if (event.hasCollection(HPSEcalCluster.class, clusterCollectionName)) { + System.out.println("Found cluster collection"); + if (++eventn % eventRefreshRate != 0) { + return; + } + clusterPlot.reset(); + List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollectionName); + for (HPSEcalCluster cluster : clusters) { + System.out.println("Found cluster"); + dec.setID(cluster.getSeedHit().getCellID()); + CalorimeterHit seedHit = cluster.getSeedHit(); + + clusterPlot.fill(seedHit.getIdentifierFieldValue("ix"), seedHit.getIdentifierFieldValue("iy"), cluster.getEnergy()); + } + if (singleEvent) { + plotNextEvent = false; + } + }
} }
@@ -160,6 +193,10 @@
if (hitPlot != null) { hitPlot.reset(); }
+ if (clusterPlot != null) { + clusterPlot.reset(); + } +
if (plotterFrame != null) { plotterFrame.dispose(); }
@@ -176,11 +213,14 @@
@Override public void itemStateChanged(ItemEvent ie) { if (ie.getSource() == logScaleBox) {
- IPlotterStyle style = plotter.region(0).style();
+ IPlotterStyle style1 = plotter.region(0).style();
+ IPlotterStyle style2 = plotter.region(1).style();
if (ie.getStateChange() == ItemEvent.DESELECTED) {
- style.zAxisStyle().setParameter("scale", "lin");
+ style1.zAxisStyle().setParameter("scale", "lin");
+ style2.zAxisStyle().setParameter("scale", "lin");
} else {
- style.zAxisStyle().setParameter("scale", "log");
+ style1.zAxisStyle().setParameter("scale", "log");
+ style2.zAxisStyle().setParameter("scale", "log");
} // plotter.region(0).plot(hitPlot); }
diff -u -r1.17 -r1.18 --- HPSEcalClusterer.java 22 Nov 2011 01:12:41 -0000 1.17 +++ HPSEcalClusterer.java 4 May 2012 16:35:44 -0000 1.18 @@ -7,7 +7,6 @@
import java.util.Set; import org.lcsim.event.CalorimeterHit;
-import org.lcsim.event.Cluster;
import org.lcsim.event.EventHeader; import org.lcsim.geometry.Detector; import org.lcsim.geometry.subdetector.HPSEcal3.NeighborMap;
@@ -24,141 +23,147 @@
* @author Jeremy McCormick <[log in to unmask]> * @author Tim Nelson <[log in to unmask]> *
- * @version $Id: HPSEcalClusterer.java,v 1.17 2011/11/22 01:12:41 meeg Exp $
+ * @version $Id: HPSEcalClusterer.java,v 1.18 2012/05/04 16:35:44 meeg Exp $
*/ public class HPSEcalClusterer extends Driver {
- HPSEcal3 ecal; - String ecalCollectionName; - String ecalName; - String clusterCollectionName = "EcalClusters"; - // Minimum E for cluster seed. - double seedEMin = .05; - // Minimum E to add hit to cluster. - double addEMin = .03; - // Odd or even number of crystals in X. - boolean oddX; - // Map of crystals to their neighbors. - NeighborMap neighborMap = null; - - public HPSEcalClusterer() { - } - - public void setClusterCollectionName(String clusterCollectionName) { - this.clusterCollectionName = clusterCollectionName; - } - - public void setSeedEMin(double seedEMin) { - this.seedEMin = seedEMin; - } - - public void setAddEMin(double addEMin) { - this.addEMin = addEMin; - } - - public void setEcalCollectionName(String ecalCollectionName) { - this.ecalCollectionName = ecalCollectionName; - } - - public void setEcalName(String ecalName) { - this.ecalName = ecalName; - } - - public void startOfData() { - if (ecalCollectionName == null) - throw new RuntimeException("The parameter ecalCollectionName was not set!"); - - if (ecalName == null) - throw new RuntimeException("The parameter ecalName was not set!"); - } - - public void detectorChanged(Detector detector) { - // Get the Subdetector. - ecal = (HPSEcal3) detector.getSubdetector(ecalName); - - // Cache ref to neighbor map. - neighborMap = ecal.getNeighborMap(); - - //System.out.println(ecal.getName()); - //System.out.println(" nx="+ecal.nx()); - //System.out.println(" ny="+ecal.ny()); - //System.out.println(" beamgap="+ecal.beamGap()); - //System.out.println(" dface="+ecal.distanceToFace()); - - //System.out.println(neighborMap.toString()); - } - - public void process(EventHeader event) { - //System.out.println(this.getClass().getCanonicalName() + " - process"); - - // Get the list of raw ECal hits. - List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName); - if (hits == null) - throw new RuntimeException("Event is missing ECal raw hits collection!"); - - // Make a hit map for quick lookup by ID. - Map<Long, CalorimeterHit> hitMap = new HashMap<Long, CalorimeterHit>(); - for (CalorimeterHit hit : hits) { - hitMap.put(hit.getCellID(), hit); - } - - // Put Cluster collection into event. - int flag = 1 << LCIOConstants.CLBIT_HITS; - event.put(clusterCollectionName, createClusters(hitMap), Cluster.class, flag); - } - - public List<Cluster> createClusters(Map<Long, CalorimeterHit> map) { - - // New Cluster list to be added to event. - List<Cluster> clusters = new ArrayList<Cluster>(); - - // Loop over ECal hits to find cluster seeds. - for (CalorimeterHit hit : map.values()) { - // Cut on min seed E. - if (hit.getRawEnergy() < seedEMin) - continue; - - // Get neighbor crystal IDs. - Set<Long> neighbors = neighborMap.get(hit.getCellID()); - - if (neighbors == null) - throw new RuntimeException("Oops! Set of neighbors is null!"); - - // List for neighboring hits. - List<CalorimeterHit> neighborHits = new ArrayList<CalorimeterHit>(); - - // Loop over neighbors to make hit list for cluster. - boolean isSeed = true; - for (Long neighborId : neighbors) { - // Find the neighbor hit in the event if it exists. - CalorimeterHit neighborHit = map.get(neighborId); - - // Was this neighbor cell hit? - if (neighborHit != null) { - // Check if neighbor cell has more energy. - if (neighborHit.getRawEnergy() > hit.getRawEnergy()) { - // Neighbor has more energy, so cell is not a seed. - isSeed = false; - break; - } - - // Add to cluster if above min E. - if (neighborHit.getRawEnergy() >= addEMin) { - neighborHits.add(neighborHit); - } - } - } - - // Did we find a seed? - if (isSeed) { - // Make a cluster from the hit list. - HPSEcalCluster cluster = new HPSEcalCluster(hit); - for (CalorimeterHit clusHit : neighborHits) { - cluster.addHit(clusHit); - } - clusters.add(cluster); - } - } - return clusters; - }
+ HPSEcal3 ecal; + String ecalCollectionName; + String ecalName; + String clusterCollectionName = "EcalClusters"; + // Minimum E for cluster seed. + double seedEMin = .05; + // Minimum E to add hit to cluster. + double addEMin = .03; + // Odd or even number of crystals in X. + boolean oddX; + // Map of crystals to their neighbors. + NeighborMap neighborMap = null; + + public HPSEcalClusterer() { + } + + public void setClusterCollectionName(String clusterCollectionName) { + this.clusterCollectionName = clusterCollectionName; + } + + public void setSeedEMin(double seedEMin) { + this.seedEMin = seedEMin; + } + + public void setAddEMin(double addEMin) { + this.addEMin = addEMin; + } + + public void setEcalCollectionName(String ecalCollectionName) { + this.ecalCollectionName = ecalCollectionName; + } + + public void setEcalName(String ecalName) { + this.ecalName = ecalName; + } + + public void startOfData() { + if (ecalCollectionName == null) { + throw new RuntimeException("The parameter ecalCollectionName was not set!"); + } + + if (ecalName == null) { + throw new RuntimeException("The parameter ecalName was not set!"); + } + } + + public void detectorChanged(Detector detector) { + // Get the Subdetector. + ecal = (HPSEcal3) detector.getSubdetector(ecalName); + + // Cache ref to neighbor map. + neighborMap = ecal.getNeighborMap(); + + //System.out.println(ecal.getName()); + //System.out.println(" nx="+ecal.nx()); + //System.out.println(" ny="+ecal.ny()); + //System.out.println(" beamgap="+ecal.beamGap()); + //System.out.println(" dface="+ecal.distanceToFace()); + + //System.out.println(neighborMap.toString()); + } + + public void process(EventHeader event) { + //System.out.println(this.getClass().getCanonicalName() + " - process"); + + // Get the list of raw ECal hits. + List<CalorimeterHit> hits = event.get(CalorimeterHit.class, ecalCollectionName); + if (hits == null) { + throw new RuntimeException("Event is missing ECal raw hits collection!"); + } + + // Make a hit map for quick lookup by ID. + Map<Long, CalorimeterHit> hitMap = new HashMap<Long, CalorimeterHit>(); + for (CalorimeterHit hit : hits) { + hitMap.put(hit.getCellID(), hit); + } + + // Put Cluster collection into event. + int flag = 1 << LCIOConstants.CLBIT_HITS; + event.put(clusterCollectionName, createClusters(hitMap), HPSEcalCluster.class, flag); + System.out.println("Made clusters"); + } + + public List<HPSEcalCluster> createClusters(Map<Long, CalorimeterHit> map) { + + // New Cluster list to be added to event. + List<HPSEcalCluster> clusters = new ArrayList<HPSEcalCluster>(); + + // Loop over ECal hits to find cluster seeds. + for (CalorimeterHit hit : map.values()) { + // Cut on min seed E. + if (hit.getRawEnergy() < seedEMin) { + continue; + } + + // Get neighbor crystal IDs. + Set<Long> neighbors = neighborMap.get(hit.getCellID()); + + if (neighbors == null) { + throw new RuntimeException("Oops! Set of neighbors is null!"); + } + + // List for neighboring hits. + List<CalorimeterHit> neighborHits = new ArrayList<CalorimeterHit>(); + + // Loop over neighbors to make hit list for cluster. + boolean isSeed = true; + for (Long neighborId : neighbors) { + // Find the neighbor hit in the event if it exists. + CalorimeterHit neighborHit = map.get(neighborId); + + // Was this neighbor cell hit? + if (neighborHit != null) { + // Check if neighbor cell has more energy. + if (neighborHit.getRawEnergy() > hit.getRawEnergy()) { + // Neighbor has more energy, so cell is not a seed. + isSeed = false; + break; + } + + // Add to cluster if above min E. + if (neighborHit.getRawEnergy() >= addEMin) { + neighborHits.add(neighborHit); + } + } + } + + // Did we find a seed? + if (isSeed) { + // Make a cluster from the hit list. + HPSEcalCluster cluster = new HPSEcalCluster(hit); + for (CalorimeterHit clusHit : neighborHits) { + cluster.addHit(clusHit); + } + clusters.add(cluster); + } + } + return clusters; + }
}
\ No newline at end of file
diff -u -r1.2 -r1.3 --- HPSEcalRawConverter.java 3 May 2012 00:17:54 -0000 1.2 +++ HPSEcalRawConverter.java 4 May 2012 16:35:44 -0000 1.3 @@ -1,113 +1,82 @@
-/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */
package org.lcsim.hps.recon.ecal;
-import hep.physics.vec.Hep3Vector; -import org.lcsim.detector.IDetectorElement;
import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.RawCalorimeterHit;
import org.lcsim.event.RawTrackerHit;
-import org.lcsim.geometry.IDDecoder; -import org.lcsim.geometry.Subdetector;
+/** + * + * @version $Id: HPSEcalRawConverterDriver.java,v 1.2 2012/05/03 00:17:54 + * phansson Exp $ + */ +public class HPSEcalRawConverter {
-public class HPSEcalRawConverter {
+ boolean debug = false; + double period = 4.0; + double dt = 0.0; + + public HPSEcalRawConverter() { + } + + public int getPedestal(RawTrackerHit hit) { + if (!HPSEcalConditions.pedestalsLoaded()) { + HPSEcalConditions.loadPedestals(); + } + return HPSEcalConditions.physicalToPedestal(hit.getCellID()); + }
- boolean debug = false; - double scale = 0.01; - double pedestal = 0.0; - double period = 4.0; - double dt = 0.0; - IDDecoder dec; - Subdetector ecal; - - - - public HPSEcalRawConverter(Subdetector ecal) { - this.ecal = ecal; - //this.dec = ecal.getIDDecoder();
+ public int getPedestal(RawCalorimeterHit hit) { + if (!HPSEcalConditions.pedestalsLoaded()) { + HPSEcalConditions.loadPedestals();
}
+ return HPSEcalConditions.physicalToPedestal(hit.getCellID()); + }
- public double getPedestal() { - return pedestal; - } - - public void setPedestal(double pedestal) { - this.pedestal = pedestal; - } - - public double getScale() { - return scale; - } - - public void setScale(double scale) { - this.scale = scale; - } - - public IDDecoder getIDDecoder() { - return dec; - } - - public void setIDDecoder(IDDecoder dec) { - this.dec = dec; - } - - public void setSubDetector(Subdetector d) { - this.ecal = d; - } - - public int AtoD(double amplitude, long cellID) { - return (int) Math.floor((amplitude + pedestal) / scale); - } - - public double DtoA(int amplitude, long cellID) { - return scale * (amplitude + 0.5) + pedestal; - } - - public int getPedestal(RawTrackerHit hit) { - //HPSEcalConditions cond = new HPSEcalConditions(); - if (!HPSEcalConditions.pedestalsLoaded()) { - HPSEcalConditions.loadPedestals(); - } - return HPSEcalConditions.physicalToPedestal(hit.getCellID()); -
+ //public short sumADC(RawTrackerHit hit, double scale, double pedestal) { + public short sumADC(RawTrackerHit hit) { + //Sum all pedestal subtracted ADC values + //return scale * (amplitude + 0.5) + pedestal; + if (debug) { + System.out.println("Summing ADC for hit: " + hit.toString());
}
- - - //public short sumADC(RawTrackerHit hit, double scale, double pedestal) { - public short sumADC(RawTrackerHit hit) { - //Sum all pedestal subtracted ADC values - //return scale * (amplitude + 0.5) + pedestal; - if ( debug ) { - System.out.println("Summing ADC for hit: " + hit.toString()); - } - int pedestal = getPedestal(hit); - short sum = 0; - short samples[] = hit.getADCValues(); - for ( int isample=0; isample<6; ++isample) { - sum += (samples[isample] - pedestal); - if ( debug ) { - System.out.println("Sample " + isample + " " + samples[isample] + " pedestal " + pedestal + " (" + sum + ")"); - }
+ int pedestal = getPedestal(hit); + short sum = 0; + short samples[] = hit.getADCValues(); + for (int isample = 0; isample < samples.length; ++isample) { + sum += (samples[isample] - pedestal); + if (debug) { + System.out.println("Sample " + isample + " " + samples[isample] + " pedestal " + pedestal + " (" + sum + ")");
}
- return sum; - - } - - - public CalorimeterHit HitDtoA(RawTrackerHit hit) { - double time = 0.0; - long id = hit.getCellID(); - int type = 0; - double rawEnergy = (double) sumADC(hit); - Hep3Vector pvec = hit.getDetectorElement().getGeometry().getPosition(); - double [] pos = new double[3]; - pos[0] = pvec.x(); - pos[1] = pvec.y(); - pos[2] = pvec.z(); - CalorimeterHit h = new HPSRawCalorimeterHit(rawEnergy+0.0000001, null, time, id, 0); - return h;
}
+ return sum; + + }
+ public CalorimeterHit HitDtoA(RawTrackerHit hit) { + double time = 0.0; + long id = hit.getCellID(); + double rawEnergy = (double) sumADC(hit); +// Hep3Vector pvec = hit.getDetectorElement().getGeometry().getPosition(); +// double [] pos = new double[3]; +// pos[0] = pvec.x(); +// pos[1] = pvec.y(); +// pos[2] = pvec.z(); + CalorimeterHit h = new HPSRawCalorimeterHit(rawEnergy + 0.0000001, null, time, id, 0); + //+0.0000001 is a horrible hack to ensure rawEnergy!=BaseCalorimeterHit.UNSET_CORRECTED_ENERGY + return h; + } + + public CalorimeterHit HitDtoA(RawCalorimeterHit hit, int window) { + double time = 0.0; + long id = hit.getCellID(); + double rawEnergy = (double) hit.getAmplitude() - window * getPedestal(hit); +// Hep3Vector pvec = hit.getDetectorElement().getGeometry().getPosition(); +// double [] pos = new double[3]; +// pos[0] = pvec.x(); +// pos[1] = pvec.y(); +// pos[2] = pvec.z(); + CalorimeterHit h = new HPSRawCalorimeterHit(rawEnergy + 0.0000001, null, time, id, 0); + //+0.0000001 is a horrible hack to ensure rawEnergy!=BaseCalorimeterHit.UNSET_CORRECTED_ENERGY + return h; + }
}
diff -u -r1.2 -r1.3 --- HPSEcalRawConverterDriver.java 3 May 2012 00:17:54 -0000 1.2 +++ HPSEcalRawConverterDriver.java 4 May 2012 16:35:44 -0000 1.3 @@ -1,107 +1,91 @@
-/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */
package org.lcsim.hps.recon.ecal; import java.util.ArrayList; import java.util.List; import org.lcsim.event.CalorimeterHit; import org.lcsim.event.EventHeader;
+import org.lcsim.event.RawCalorimeterHit;
import org.lcsim.event.RawTrackerHit; import org.lcsim.geometry.Detector;
-import org.lcsim.geometry.Subdetector;
import org.lcsim.util.Driver; /** *
- * @author Sho Uemura <[log in to unmask]> - * @version $Id: HPSEcalRawConverterDriver.java,v 1.2 2012/05/03 00:17:54 phansson Exp $
+ * @version $Id: HPSEcalRawConverterDriver.java,v 1.2 2012/05/03 00:17:54 + * phansson Exp $
*/ public class HPSEcalRawConverterDriver extends Driver {
- HPSEcalRawConverter converter = null; - Subdetector ecal; - String rawCollectionName = "EcalReadoutHits"; - String ecalName; - String ecalReadoutName = "EcalHits"; - String ecalCollectionName = "EcalCalHits"; - boolean debug = false; - - - public HPSEcalRawConverterDriver() { - converter = new HPSEcalRawConverter(null); - - } - - public void setPedestal(double pedestal) { - converter.setPedestal(pedestal); - } - - public void setScale(double scale) { - converter.setScale(scale); - } - - public void setEcalCollectionName(String ecalCollectionName) { - this.ecalCollectionName = ecalCollectionName; - } - - public void setEcalName(String ecalName) { - this.ecalName = ecalName; - } - - public void setRawCollectionName(String rawCollectionName) { - this.rawCollectionName = rawCollectionName; - } - - - - - @Override - public void startOfData() { - if (ecalCollectionName == null) { - throw new RuntimeException("The parameter ecalCollectionName was not set!"); - } - - if (ecalName == null) { - throw new RuntimeException("The parameter ecalName was not set!"); - } - } - - @Override - public void detectorChanged(Detector detector) { - // Get the Subdetector. - ecal = (Subdetector) detector.getSubdetector(ecalName); - //converter.setIDDecoder(ecal.getIDDecoder()); - converter.setSubDetector(ecal); - } - - @Override - public void process(EventHeader event) { - // Get the list of ECal hits. - List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName); - if (hits == null) { - throw new RuntimeException("Event is missing ECal \"tracker hits\" collection!"); - } - - ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>(); - - for (RawTrackerHit hit : hits) { - newHits.add(converter.HitDtoA(hit)); - } - int flags = 0; - event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName); - String s = ecalCollectionName; //"EcalCalHits"; - - System.out.println(" char: " + event.hasCollection(CalorimeterHit.class, "EcalCalHits")); - System.out.println(" str: " + event.hasCollection(CalorimeterHit.class, ecalCollectionName)); - - List<CalorimeterHit> ll = event.get(CalorimeterHit.class,s); - - System.out.println("ll size " + ll.size()); - List<List<CalorimeterHit>> lll = event.get(CalorimeterHit.class); - System.out.println("lll size " + lll.size()); - - - }
+ HPSEcalRawConverter converter = null; + String rawCollectionName = "EcalReadoutHits"; + String ecalReadoutName = "EcalHits"; + String ecalCollectionName = "EcalCalHits"; + int integralWindow = 30; + boolean debug = false; + + public HPSEcalRawConverterDriver() { + converter = new HPSEcalRawConverter(); + } + + public void setEcalCollectionName(String ecalCollectionName) { + this.ecalCollectionName = ecalCollectionName; + } + + public void setRawCollectionName(String rawCollectionName) { + this.rawCollectionName = rawCollectionName; + } + + @Override + public void startOfData() { + if (ecalCollectionName == null) { + throw new RuntimeException("The parameter ecalCollectionName was not set!"); + } + } + + @Override + public void detectorChanged(Detector detector) { + } + + @Override + public void process(EventHeader event) { + ArrayList<CalorimeterHit> newHits = new ArrayList<CalorimeterHit>(); + + // Get the list of ECal hits. + if (event.hasCollection(RawTrackerHit.class, rawCollectionName)) { + List<RawTrackerHit> hits = event.get(RawTrackerHit.class, rawCollectionName); + + for (RawTrackerHit hit : hits) { + newHits.add(converter.HitDtoA(hit)); + } +// String s = ecalCollectionName; //"EcalCalHits"; +// +// System.out.println(" char: " + event.hasCollection(CalorimeterHit.class, "EcalCalHits")); +// System.out.println(" str: " + event.hasCollection(CalorimeterHit.class, ecalCollectionName)); +// +// List<CalorimeterHit> ll = event.get(CalorimeterHit.class,s); +// +// System.out.println("ll size " + ll.size()); +// List<List<CalorimeterHit>> lll = event.get(CalorimeterHit.class); +// System.out.println("lll size " + lll.size()); + } + if (event.hasCollection(RawCalorimeterHit.class, rawCollectionName)) { + List<RawCalorimeterHit> hits = event.get(RawCalorimeterHit.class, rawCollectionName); + + for (RawCalorimeterHit hit : hits) { + newHits.add(converter.HitDtoA(hit, integralWindow)); + } +// String s = ecalCollectionName; //"EcalCalHits"; +// +// System.out.println(" char: " + event.hasCollection(CalorimeterHit.class, "EcalCalHits")); +// System.out.println(" str: " + event.hasCollection(CalorimeterHit.class, ecalCollectionName)); +// +// List<CalorimeterHit> ll = event.get(CalorimeterHit.class,s); +// +// System.out.println("ll size " + ll.size()); +// List<List<CalorimeterHit>> lll = event.get(CalorimeterHit.class); +// System.out.println("lll size " + lll.size()); + } + int flags = 0; + event.put(ecalCollectionName, newHits, CalorimeterHit.class, flags, ecalReadoutName); + }
}
diff -u -r1.3 -r1.4 --- AIDAFrame.java 4 May 2012 02:24:43 -0000 1.3 +++ AIDAFrame.java 4 May 2012 16:35:44 -0000 1.4 @@ -8,7 +8,7 @@
/** * * @author Sho Uemura <[log in to unmask]>
- * @version $Id: AIDAFrame.java,v 1.3 2012/05/04 02:24:43 meeg Exp $
+ * @version $Id: AIDAFrame.java,v 1.4 2012/05/04 16:35:44 meeg Exp $
*/ public class AIDAFrame extends JFrame {
@@ -18,7 +18,6 @@
public AIDAFrame() { tabbedPane = new JTabbedPane();
-// this.setContentPane(tabbedFrame);
this.getContentPane().setLayout(new BorderLayout()); menubar = new JMenuBar();
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