java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalHitPlots.java 2014-03-07 21:43:02 UTC (rev 286)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalHitPlots.java 2014-03-08 16:14:43 UTC (rev 287)
@@ -3,6 +3,7 @@
import hep.aida.IHistogram1D;
import hep.aida.IHistogram2D;
import hep.aida.IPlotter;
+import hep.aida.IPlotterStyle;
import hep.aida.IPlotterFactory;
import hep.aida.ref.plotter.PlotterUtilities;
@@ -17,6 +18,7 @@
import org.lcsim.hps.evio.TriggerData;
import org.lcsim.hps.monitoring.deprecated.Resettable;
import org.lcsim.hps.monitoring.deprecated.Redrawable;
+import org.lcsim.hps.users.celentan.EcalMonitoringUtils;
import org.lcsim.hps.recon.ecal.ECalUtils;
import org.lcsim.util.Driver;
import org.lcsim.util.aida.AIDA;
@@ -45,7 +47,8 @@
IHistogram1D topTrigTimePlot, botTrigTimePlot, orTrigTimePlot;
IHistogram2D topTimePlot2D, botTimePlot2D, orTimePlot2D;
// IHistogram2D topX, botX, topY, botY;
- IHistogram2D edgePlot;
+ IHistogram2D hitNumberPlot;
+ IHistogram2D occupancyPlot;
//Plotter5
@@ -95,13 +98,20 @@
// Setup plots.
hitCountPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count In Event", 10, -0.5, 9.5);
hitTimePlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time", 100, 0 * 4.0, 100 * 4.0);
-
+ hitNumberPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count");
+ occupancyPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy");
+
// Create the plotter regions.
- plotter.createRegions(1, 2);
- plotter.region(0).plot(hitCountPlot);
+ plotter.createRegions(2, 2);
+ plotter.region(3).plot(hitCountPlot);
plotter.region(1).plot(hitTimePlot);
-
-
+ plotter.region(0).plot(hitNumberPlot);
+ IPlotterStyle style = plotter.region(2).style();
+ style.setParameter("hist2DStyle", "colorMap");
+ style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ style.zAxisStyle().setParameter("scale", "log");
+ plotter.region(2).plot(occupancyPlot);
+
// Setup the plotter.
plotter2 = plotterFactory.create("Hit Energies");
plotter2.setTitle("Hit Energies");
@@ -129,8 +139,8 @@
channelEnergyPlot=new ArrayList<IHistogram1D>();
channelTimePlot=new ArrayList<IHistogram1D>();
for(int id = 0; id < (47*11); id = id +1){
- int row=this.getRowFromHistoID(id);
- int column=this.getColumnFromHistoID(id);
+ int row=EcalMonitoringUtils.getRowFromHistoID(id);
+ int column=EcalMonitoringUtils.getColumnFromHistoID(id);
//create the histograms
channelEnergyPlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Energy : " + (row) + " "+ (column)+ ": "+id, 1000, -0.1, maxEch));
channelTimePlot.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Hit Time : " + (row) + " "+ (column)+ ": "+id, 100, 0, 400));
@@ -180,23 +190,23 @@
}
}
- plotter4 = plotterFactory.create("Edges");
- plotter4.setTitle("Edges");
+ // plotter4 = plotterFactory.create("Edges");
+ // plotter4.setTitle("Edges");
// plotterFrame.addPlotter(plotter4);
- plotter4.style().setParameter("hist2DStyle", "colorMap");
- plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ // plotter4.style().setParameter("hist2DStyle", "colorMap");
+ // plotter4.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
// plotter4.style().zAxisStyle().setParameter("scale", "log");
- plotter4.createRegion();
+ // plotter4.createRegion();
- edgePlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count");
- plotter4.region(0).plot(edgePlot);
+ //
+ // plotter4.region(0).plot(edgePlot);
if (!hide) {
plotter.show();
plotter2.show();
plotter3.show();
- plotter4.show();
+ // plotter4.show();
// plotter5.show(); Andrea: not yet.
}
//plotterFrame.setVisible(true);
@@ -274,7 +284,7 @@
column=hit.getIdentifierFieldValue("ix");
row=hit.getIdentifierFieldValue("iy");
if ((hit.getIdentifierFieldValue("ix")!=0)&&(hit.getIdentifierFieldValue("iy")!=0)){
- id = this.getHistoIDFromRowColumn(row,column);
+ id = EcalMonitoringUtils.getHistoIDFromRowColumn(row,column);
channelEnergyPlot.get(id).fill(hit.getCorrectedEnergy());
}
@@ -344,27 +354,7 @@
//plotterFrame.dispose();
}
- public int getRowFromHistoID(int id){
- return (5-(id%11));
- }
-
- public int getColumnFromHistoID(int id){
- return ((id/11)-23);
- }
- public int getHistoIDFromRowColumn(int row,int column){
- return (-row+5)+11*(column+23);
- }
-
- public Boolean isInHole(int row,int column){
- Boolean ret;
- ret=false;
- if ((row==1)||(row==-1)){
- if ((column<=-2)&&(column>=-8)) ret=true;
- }
- return ret;
- }
-
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
java/trunk/users/src/main/java/org/lcsim/hps/users/celentan
--- java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalMonitoringPlots.java 2014-03-07 21:43:02 UTC (rev 286)
+++ java/trunk/users/src/main/java/org/lcsim/hps/users/celentan/EcalMonitoringPlots.java 2014-03-08 16:14:43 UTC (rev 287)
@@ -1,12 +1,14 @@
package org.lcsim.hps.users.celentan;
import hep.aida.IHistogram2D;
+import hep.aida.IHistogram1D;
import hep.aida.IPlotter;
import hep.aida.IPlotterStyle;
import java.util.List;
+import java.util.ArrayList;
+
import org.lcsim.event.CalorimeterHit;
-
import org.lcsim.event.EventHeader;
import org.lcsim.event.RawTrackerHit;
import org.lcsim.event.base.BaseRawCalorimeterHit;
@@ -25,6 +27,10 @@
IPlotter plotter;
IHistogram2D hitCountFillPlot;
IHistogram2D hitCountDrawPlot;
+
+ IHistogram2D occupancyDrawPlot;
+ ArrayList<IHistogram1D> occupancyPlots;
+
IHistogram2D clusterCountFillPlot;
IHistogram2D clusterCountDrawPlot;
int eventRefreshRate = 1;
@@ -53,11 +59,20 @@
aida.tree().cd("/");
hitCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Hit Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
hitCountFillPlot = makeCopy(hitCountDrawPlot);
+ occupancyDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy", 47, -23.5, 23.5, 11, -5.5, 5.5);
clusterCountDrawPlot = aida.histogram2D(detector.getDetectorName() + " : " + clusterCollection + " : Cluster Center Count", 47, -23.5, 23.5, 11, -5.5, 5.5);
clusterCountFillPlot = makeCopy(clusterCountDrawPlot);
+ occupancyPlots=new ArrayList<IHistogram1D>();
+ for (int ii=0;ii<(11*47);ii++){
+ int row=EcalMonitoringUtils.getRowFromHistoID(ii);
+ int column=EcalMonitoringUtils.getColumnFromHistoID(ii);
+ occupancyPlots.add(aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : Occupancy : " + (row) + " "+ (column)+ ": "+ii, 101,0,1));
+ }
+
+
// Create the plotter regions.
- plotter.createRegions(1, 2);
+ plotter.createRegions(2, 2);
plotter.style().statisticsBoxStyle().setVisible(false);
IPlotterStyle style = plotter.region(0).style();
style.setParameter("hist2DStyle", "colorMap");
@@ -67,30 +82,78 @@
style.setParameter("hist2DStyle", "colorMap");
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
plotter.region(1).plot(clusterCountDrawPlot);
+ style = plotter.region(2).style();
+ style.setParameter("hist2DStyle", "colorMap");
+ style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ style.zAxisStyle().setParameter("scale", "log");
+ plotter.region(2).plot(occupancyDrawPlot);
+
+
if (!hide) {
plotter.show();
}
}
-
+
public void process(EventHeader event) {
+ int nhits=0;
+ int chits[]=new int[11*47];
if (event.hasCollection(BaseRawCalorimeterHit.class, inputCollection)) {
List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollection);
for (BaseRawCalorimeterHit hit : hits) {
- hitCountFillPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+ int column=hit.getIdentifierFieldValue("ix");
+ int row=hit.getIdentifierFieldValue("iy");
+ int id=EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
+ hitCountFillPlot.fill(column,row);
+ chits[id]++;
+ nhits++;
}
}
if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
- for (RawTrackerHit hit : hits) {
- hitCountFillPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+ for (RawTrackerHit hit : hits) {
+ int column=hit.getIdentifierFieldValue("ix");
+ int row=hit.getIdentifierFieldValue("iy");
+ int id=EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
+ hitCountFillPlot.fill(column,row);
+ chits[id]++;
+ nhits++;
}
}
if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
for (CalorimeterHit hit : hits) {
- hitCountFillPlot.fill(hit.getIdentifierFieldValue("ix"), hit.getIdentifierFieldValue("iy"));
+ int column=hit.getIdentifierFieldValue("ix");
+ int row=hit.getIdentifierFieldValue("iy");
+ int id=EcalMonitoringUtils.getHistoIDFromRowColumn(row, column);
+ hitCountFillPlot.fill(column,row);
+ chits[id]++;
+ nhits++;
}
}
+
+
+
+
+
+ for (int ii=0;ii<(11*47);ii++){
+ if (nhits>0) occupancyPlots.get(ii).fill(chits[ii]*1./(nhits ));
+ else occupancyPlots.get(ii).fill(0);
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
if (event.hasCollection(HPSEcalCluster.class, clusterCollection)) {
List<HPSEcalCluster> clusters = event.get(HPSEcalCluster.class, clusterCollection);
//if (clusters.size()>1)
@@ -114,6 +177,11 @@
hitCountDrawPlot.reset();
clusterCountFillPlot.reset();
clusterCountDrawPlot.reset();
+
+ occupancyDrawPlot.reset();
+ for (int id=0;id<(47*11);id++){
+ occupancyPlots.get(id).reset();
+ }
}
@Override
@@ -121,8 +189,15 @@
hitCountDrawPlot.reset();
hitCountDrawPlot.add(hitCountFillPlot);
clusterCountDrawPlot.reset();
- clusterCountDrawPlot.add(clusterCountFillPlot);
- }
+ clusterCountDrawPlot.add(clusterCountFillPlot);
+ occupancyDrawPlot.reset();
+ for (int id=0;id<(47*11);id++){
+ int row=EcalMonitoringUtils.getRowFromHistoID(id);
+ int column=EcalMonitoringUtils.getColumnFromHistoID(id);
+ double mean=occupancyPlots.get(id).mean();
+ if ((row!=0)&&(column!=0)&&(!EcalMonitoringUtils.isInHole(row, column))) occupancyDrawPlot.fill(column,row,mean);
+ }
+ }
@Override
public void setEventRefreshRate(int eventRefreshRate) {