Author: [log in to unmask] Date: Wed Mar 11 08:21:19 2015 New Revision: 2409 Log: updating EcalPedestalViewer for use inside monitoring app (w/ dummy plots to get it to work) Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java Modified: java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java ============================================================================= --- java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java (original) +++ java/trunk/monitoring-drivers/src/main/java/org/hps/monitoring/ecal/plots/EcalPedestalViewer.java Wed Mar 11 08:21:19 2015 @@ -31,7 +31,7 @@ public class EcalPedestalViewer extends Driver implements CrystalListener, ActionListener { // this has to match the one in EcalPedstalCalculator: - private String histoNameFormat = "Ecal/Pedestals/Mode7/ped%3d"; + private String histoNameFormat = "Ecal/Pedestals/Mode7/ped%03d"; private AIDA aida = AIDA.defaultInstance(); private IPlotter plotter; @@ -39,12 +39,33 @@ private IPlotterStyle pstyle; private PEventViewer viewer; + static final String[] colors={"red","black","blue","green","yellow","pink","cyan","magenta","brown"}; + static final int nRows=3; + static final int nColumns=3; + private int theRegion=0; + @Override public void detectorChanged(Detector detector) { plotterFactory = aida.analysisFactory().createPlotterFactory("ECal Peds"); plotter = plotterFactory.create("ECal Peds"); - plotter.createRegions(1,1); + plotter.createRegions(nColumns,nRows); + // Plot dummmy histos, else null plotter regions later: + for (int ii=0; ii<nColumns*nRows; ii++) { + plotter.region(ii).plot(aida.histogram1D("ASDF"+ii,100,11e9,11e11)); + } plotter.show(); + + pstyle=plotterFactory.createPlotterStyle(); + pstyle.xAxisStyle().labelStyle().setBold(true); + pstyle.yAxisStyle().labelStyle().setBold(true); + pstyle.xAxisStyle().tickLabelStyle().setBold(true); + pstyle.yAxisStyle().tickLabelStyle().setBold(true); + pstyle.xAxisStyle().lineStyle().setColor("black"); + pstyle.yAxisStyle().lineStyle().setColor("black"); + pstyle.xAxisStyle().lineStyle().setThickness(2); + pstyle.yAxisStyle().lineStyle().setThickness(2); + pstyle.dataStyle().errorBarStyle().setThickness(0); + pstyle.legendBoxStyle().setVisible(false); } @Override @@ -78,8 +99,12 @@ if (hist==null) { System.err.println("Running the Driver?"); } else { - plotter.region(0).clear(); - plotter.region(0).plot(hist,pstyle); + hist.setTitle(String.format("(%d,%d)",ecalPoint.x,ecalPoint.y)); + pstyle.dataStyle().lineStyle().setParameter("color", colors[theRegion%colors.length]); + plotter.region(theRegion).clear(); + plotter.region(theRegion).plot(hist,pstyle); + plotter.region(theRegion).refresh(); + theRegion=(theRegion+1)%(nColumns*nRows); } }