Commit in hps-java/src/main/java/org/lcsim/hps/recon/ecal on MAIN
EcalCrystalFilter.java+551-581.1 -> 1.2
Added noisy crystals analysis from unbiased (trigger) events.

hps-java/src/main/java/org/lcsim/hps/recon/ecal
EcalCrystalFilter.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- EcalCrystalFilter.java	6 Jun 2012 18:17:59 -0000	1.1
+++ EcalCrystalFilter.java	7 Jun 2012 15:06:58 -0000	1.2
@@ -19,6 +19,7 @@
 import org.lcsim.event.RawTrackerHit;
 import org.lcsim.event.base.BaseRawCalorimeterHit;
 import org.lcsim.geometry.Detector;
+import org.lcsim.hps.evio.TriggerData;
 import org.lcsim.hps.monitoring.AIDAFrame;
 import org.lcsim.hps.monitoring.Redrawable;
 import org.lcsim.hps.monitoring.Resettable;
@@ -33,18 +34,53 @@
     private IPlotter plotter2;
     private IPlotter plotter3;
     private IPlotter plotter4;
+    private IPlotter plotterTop;
+    private IPlotter plotterTop2;
+    private IPlotter plotterTop3;
+    private IPlotter plotterTop4;
+    private IPlotter plotterBot;
+    private IPlotter plotterBot2;
+    private IPlotter plotterBot3;
+    private IPlotter plotterBot4;
     private AIDA aida = AIDA.defaultInstance();
     private AIDAFrame plotterFrame;
+    private AIDAFrame plotterFrameTop;
+    private AIDAFrame plotterFrameBot;
+    
+    
     private IHistogram1D aMeanPlot;
     private IHistogram1D aSigmaPlot;
     private IHistogram1D tMeanPlot;
     private IHistogram1D tSigmaPlot;
+    private IHistogram1D aTMeanPlot;
+    private IHistogram1D aTSigmaPlot;
+    private IHistogram1D tTMeanPlot;
+    private IHistogram1D tTSigmaPlot;
+    private IHistogram1D aBMeanPlot;
+    private IHistogram1D aBSigmaPlot;
+    private IHistogram1D tBMeanPlot;
+    private IHistogram1D tBSigmaPlot;
     private IHistogram2D aTOutMeanPlot;
     private IHistogram2D aTOutSigmaPlot;
     private IHistogram2D tTOutMeanPlot;
     private IHistogram2D tTOutSigmaPlot;
+    
+    private IHistogram2D aTTOutMeanPlot;
+    private IHistogram2D aTTOutSigmaPlot;
+    private IHistogram2D tTTOutMeanPlot;
+    private IHistogram2D tTTOutSigmaPlot;
+    
+    private IHistogram2D aBTOutMeanPlot;
+    private IHistogram2D aBTOutSigmaPlot;
+    private IHistogram2D tBTOutMeanPlot;
+    private IHistogram2D tBTOutSigmaPlot;
+    
     private IHistogram1D[][] aPlots = new IHistogram1D[47][11];
     private IHistogram1D[][] tPlots = new IHistogram1D[47][11];
+    private IHistogram1D[][] aTPlots = new IHistogram1D[47][11];
+    private IHistogram1D[][] tTPlots = new IHistogram1D[47][11];
+    private IHistogram1D[][] aBPlots = new IHistogram1D[47][11];
+    private IHistogram1D[][] tBPlots = new IHistogram1D[47][11];
     private JLabel xLabel, yLabel;
     private JComboBox xCombo;
     private JComboBox yCombo;
@@ -60,6 +96,7 @@
     String hotCrystalFileName = "ecal_hotcrystals.txt";
     FileWriter fWriter;
     PrintWriter pWriter;
+    int[] _trigger = new int[2];
 
     public EcalCrystalFilter() {
         int count = 0;
@@ -114,16 +151,37 @@
         aida = AIDA.defaultInstance();
         aida.tree().cd("/");
         
-        aSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude)", 50, 0,200);
-        aMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude)", 50, 0,1000);
-        tSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time)", 50,0,50);
-        tMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time)", 50, 0, 100);
+        aSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Filter", 50, 0,200);
+        aMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Filter", 50, 0,1000);
+        tSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Filter", 50,0,50);
+        tMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time) Filter", 50, 0, 100);
+        
+        aTSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Top Filter", 50, 0,200);
+        aTMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Top Filter", 50, 0,1000);
+        tTSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Top Filter", 50,0,50);
+        tTMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time) Top Filter", 50, 0, 100);
+        
+        aBSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Amplitude) Bottom Filter", 50, 0,200);
+        aBMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Amplitude) Bottom Filter", 50, 0,1000);
+        tBSigmaPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Sigma> (Time) Bottom Filter", 50,0,50);
+        tBMeanPlot = aida.histogram1D(detector.getDetectorName() + " : " + inputCollection + " : <Mean> (Time) Bottom Filter", 50, 0, 100);
+        
         
         aTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Amplitude) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
         aTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Amplitude) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
         tTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Time) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
         tTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Time) Time Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
 
+        aTTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Amplitude) Time Top Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        aTTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Amplitude) Time Top Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        tTTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Time) Time Top Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        tTTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Time) Time Top Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
+        aBTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Amplitude) Time Bottom Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        aBTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Amplitude) Time Bottom Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        tBTOutSigmaPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Sigma (Time) Time Bottom Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+        tBTOutMeanPlot = aida.histogram2D(detector.getDetectorName() + " : " + inputCollection + " : Mean (Time) Time Bottom Outliers", 47, -23.5, 23.5, 11, -5.5, 5.5);
+
         
         for (int x = -23; x <= 23; x++) { // slot
             for (int y = -5; y <= 5; y++) { // crate                
@@ -132,10 +190,17 @@
 //                plots[x + 23][y + 5] = aida.cloud1D("ECAL: x=" + x + "; y=" + y);
                 if (calWindow == 0) {
                     aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
+                    aTPlots[x + 23][y + 5] = aida.histogram1D("Top ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
+                    aBPlots[x + 23][y + 5] = aida.histogram1D("Bottom ECAL Amplitudes: x=" + x + "; y=" + y, 500, -100, maxE);
+                    
                 } else {
                     aPlots[x + 23][y + 5] = aida.histogram1D("ECAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
+                    aTPlots[x + 23][y + 5] = aida.histogram1D("Top CAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
+                    aBPlots[x + 23][y + 5] = aida.histogram1D("Bottom CAL Amplitudes: x=" + x + "; y=" + y, 1024, -0.5, 1023.5);
                 }
                 tPlots[x + 23][y + 5] = aida.histogram1D("ECAL Times: x=" + x + "; y=" + y, 100, 0, 100);
+                tTPlots[x + 23][y + 5] = aida.histogram1D("Top ECAL Times: x=" + x + "; y=" + y, 100, 0, 100);
+                tBPlots[x + 23][y + 5] = aida.histogram1D("Bottom ECAL Times: x=" + x + "; y=" + y, 100, 0, 100);
             }
         }
 
@@ -252,6 +317,210 @@
         
         
         
+        plotterFrameTop = new AIDAFrame();
+        plotterFrameTop.setTitle("HPS Top ECal Crystal Filter Plots");
+
+        //xCombo = new JComboBox(xList);
+        //xCombo.addActionListener(this);
+        //xLabel = new JLabel("x");
+        //xLabel.setLabelFor(xCombo);
+        //plotterFrameTop.getControlsPanel().add(xLabel);
+        //plotterFrameTop.getControlsPanel().add(xCombo);
+        //yCombo = new JComboBox(yList);
+        //yCombo.addActionListener(this);
+        //yLabel = new JLabel("y");
+        //yLabel.setLabelFor(yCombo);
+        //plotterFrameTop.getControlsPanel().add(yLabel);
+        //plotterFrameTop.getControlsPanel().add(yCombo);
+        //blankButton = new JButton("Hide histogram");
+        //plotterFrameTop.getControlsPanel().add(blankButton);
+        //blankButton.addActionListener(this);
+
+        // Setup the plotterTop.
+        plotterTop = aida.analysisFactory().createPlotterFactory().create();
+        plotterTop.setTitle("HPS ECal Amplitude");
+        plotterFrameTop.addPlotter(plotterTop);
+        plotterTop.createRegions(1, 3);
+        plotterTop.setStyle(plotter.style());
+        style = plotterTop.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterTop.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterTop.region(0).plot(aTSigmaPlot);
+        plotterTop.region(1).plot(aTMeanPlot);
+        plotterTop.style().dataStyle().fillStyle().setColor("yellow");
+        
+        // Setup the plotterTop.
+        plotterTop2 = aida.analysisFactory().createPlotterFactory().create();
+        plotterTop2.setTitle("HPS ECal Hit Time ");
+        plotterFrameTop.addPlotter(plotterTop2);
+        plotterTop2.createRegions(1, 3);
+
+        plotterTop2.setStyle(plotter2.style());
+        style = plotterTop2.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterTop2.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterTop2.region(0).plot(tTSigmaPlot);
+        plotterTop2.region(1).plot(tTMeanPlot);
+        
+        
+        // Setup the plotter.
+        plotterTop3 = aida.analysisFactory().createPlotterFactory().create();
+        plotterTop3.setTitle("HPS ECal for Time Outliers ");
+        plotterFrameTop.addPlotter(plotterTop3);
+        plotterTop3.createRegions(1, 3);
+        
+        plotterTop3.setStyle(plotter3.style());
+        style = plotterTop3.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterTop3.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterTop3.region(0).plot(tTTOutSigmaPlot);
+        plotterTop3.region(1).plot(tTTOutMeanPlot);
+        
+         // Setup the plotter.
+        plotterTop4 = aida.analysisFactory().createPlotterFactory().create();
+        plotterTop4.setTitle("HPS ECal Amplitude for Time Outliers ");
+        plotterFrameTop.addPlotter(plotterTop4);
+        plotterTop4.createRegions(1, 3);
+
+        plotterTop4.setStyle(plotter4.style());
+        style = plotterTop4.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterTop4.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterTop4.region(0).plot(aTTOutSigmaPlot);
+        plotterTop4.region(1).plot(aTTOutMeanPlot);
+        
+        plotterTop.region(2).plot(aTPlots[-5 + 23][2 + 5 - 1]);
+        plotterTop2.region(2).plot(tTPlots[-5 + 23][2 + 5 - 1]);
+        plotterTop3.region(2).plot(tTPlots[-5 + 23][2 + 5 - 1]);
+        plotterTop4.region(2).plot(aTPlots[-5 + 23][2 + 5 - 1]);
+        //xCombo.setSelectedIndex(-5 + 23);
+        //yCombo.setSelectedIndex(2 + 5 - 1);
+        
+        
+        
+        plotterFrameTop.pack();
+        if (!hide) {
+            plotterFrameTop.setVisible(true);
+        }
+        
+        
+        
+        
+        
+        
+        
+                
+        
+        
+        plotterFrameBot = new AIDAFrame();
+        plotterFrameBot.setTitle("HPS Bottom ECal Crystal Filter Plots");
+
+        //xCombo = new JComboBox(xList);
+        //xCombo.addActionListener(this);
+        //xLabel = new JLabel("x");
+        //xLabel.setLabelFor(xCombo);
+        //plotterFrameBot.getControlsPanel().add(xLabel);
+        //plotterFrameBot.getControlsPanel().add(xCombo);
+        //yCombo = new JComboBox(yList);
+        //yCombo.addActionListener(this);
+        //yLabel = new JLabel("y");
+        //yLabel.setLabelFor(yCombo);
+        //plotterFrameBot.getControlsPanel().add(yLabel);
+        //plotterFrameBot.getControlsPanel().add(yCombo);
+        //blankButton = new JButton("Hide histogram");
+        //plotterFrameBot.getControlsPanel().add(blankButton);
+        //blankButton.addActionListener(this);
+
+        // Setup the plotterBot.
+        plotterBot = aida.analysisFactory().createPlotterFactory().create();
+        plotterBot.setTitle("HPS ECal Amplitude");
+        plotterFrameBot.addPlotter(plotterBot);
+        plotterBot.createRegions(1, 3);
+        plotterBot.setStyle(plotter.style());
+        style = plotterBot.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterBot.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterBot.region(0).plot(aBSigmaPlot);
+        plotterBot.region(1).plot(aBMeanPlot);
+        plotterBot.style().dataStyle().fillStyle().setColor("yellow");
+        
+        // Setup the plotterBot.
+        plotterBot2 = aida.analysisFactory().createPlotterFactory().create();
+        plotterBot2.setTitle("HPS ECal Hit Time ");
+        plotterFrameBot.addPlotter(plotterBot2);
+        plotterBot2.createRegions(1, 3);
+
+        plotterBot2.setStyle(plotter2.style());
+        style = plotterBot2.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterBot2.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterBot2.region(0).plot(tBSigmaPlot);
+        plotterBot2.region(1).plot(tBMeanPlot);
+        
+        
+        // Setup the plotter.
+        plotterBot3 = aida.analysisFactory().createPlotterFactory().create();
+        plotterBot3.setTitle("HPS ECal for Time Outliers ");
+        plotterFrameBot.addPlotter(plotterBot3);
+        plotterBot3.createRegions(1, 3);
+        
+        plotterBot3.setStyle(plotter3.style());
+        style = plotterBot3.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterBot3.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterBot3.region(0).plot(tBTOutSigmaPlot);
+        plotterBot3.region(1).plot(tBTOutMeanPlot);
+        
+         // Setup the plotter.
+        plotterBot4 = aida.analysisFactory().createPlotterFactory().create();
+        plotterBot4.setTitle("HPS ECal Amplitude for Time Outliers ");
+        plotterFrameBot.addPlotter(plotterBot4);
+        plotterBot4.createRegions(1, 3);
+
+        plotterBot4.setStyle(plotter4.style());
+        style = plotterBot4.region(0).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        style = plotterBot4.region(1).style();
+        style.setParameter("hist2DStyle", "colorMap");
+        style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+        plotterBot4.region(0).plot(aBTOutSigmaPlot);
+        plotterBot4.region(1).plot(aBTOutMeanPlot);
+        
+        plotterBot.region(2).plot(aBPlots[-5 + 23][2 + 5 - 1]);
+        plotterBot2.region(2).plot(tBPlots[-5 + 23][2 + 5 - 1]);
+        plotterBot3.region(2).plot(tBPlots[-5 + 23][2 + 5 - 1]);
+        plotterBot4.region(2).plot(aBPlots[-5 + 23][2 + 5 - 1]);
+        //xCombo.setSelectedIndex(-5 + 23);
+        //yCombo.setSelectedIndex(2 + 5 - 1);
+        
+        
+        
+        plotterFrameBot.pack();
+        if (!hide) {
+            plotterFrameBot.setVisible(true);
+        }
         
         
         
@@ -266,24 +535,36 @@
         //Outliers in time -- threshold is nr of sigma/rms from the mean
         System.out.printf("Crystals with time RMS more than %.1f times the RMS(<RMS>)=%.1f from <RMS>=%.1f for all crystals\n",tTOutNSigmaThr,tSigmaPlot.rms(),tSigmaPlot.mean());
         
-        for (int x = -23; x <= 23; x++) { // slot
-            for (int y = -5; y <= 5; y++) { // crate   
-            
-                
-                if(tTOutSigmaPlot.binEntries(tTOutSigmaPlot.coordToIndexX(x), tTOutSigmaPlot.coordToIndexY(y))>0) {
-                    IIdentifierHelper helper = HPSEcalConditions.getHelper();
-                    IExpandedIdentifier expId = new ExpandedIdentifier(helper.getIdentifierDictionary().getNumberOfFields());
-                    //expId.setValue(helper.getFieldIndex("system"), ecal.getSystemID());
-                    expId.setValue(helper.getFieldIndex("ix"), x);
-                    expId.setValue(helper.getFieldIndex("iy"), y);
-                    Long id = helper.pack(expId).getValue();
-                    
-                    
-                    System.out.printf("[%d,%d]\t%d\t%d\t%d\tTime:%f +- %f\tAmp:%f +- %f\n",x,y,HPSEcalConditions.getCrate(id),HPSEcalConditions.getSlot(id) ,HPSEcalConditions.getChannel(id), tPlots[x + 23][y + 5].mean(), tPlots[x + 23][y + 5].rms(), aPlots[x + 23][y + 5].mean(), aPlots[x + 23][y + 5].rms());
-                    
-                    pWriter.printf("%d %d\n",x,y);
+        for(int iside=0;iside<3;++iside) {
+            System.out.println("-- Side " + iside );
+            pWriter.printf("# Side %d\n",iside);
+            for (int x = -23; x <= 23; x++) { // slot
+                for (int y = -5; y <= 5; y++) { // crate   
+
+                    boolean ok = false;
+                    if(iside==0) {
+                        if(tTOutSigmaPlot.binEntries(tTOutSigmaPlot.coordToIndexX(x), tTOutSigmaPlot.coordToIndexY(y))>0) ok =true;
+                    } else if(iside==1) {
+                        if(tTTOutSigmaPlot.binEntries(tTTOutSigmaPlot.coordToIndexX(x), tTTOutSigmaPlot.coordToIndexY(y))>0) ok =true;
+
+                    } else if(iside==2) {
+                        if(tBTOutSigmaPlot.binEntries(tBTOutSigmaPlot.coordToIndexX(x), tBTOutSigmaPlot.coordToIndexY(y))>0) ok =true;
+                    }
+                    if(ok) {
+                        IIdentifierHelper helper = HPSEcalConditions.getHelper();
+                        IExpandedIdentifier expId = new ExpandedIdentifier(helper.getIdentifierDictionary().getNumberOfFields());
+                        //expId.setValue(helper.getFieldIndex("system"), ecal.getSystemID());
+                        expId.setValue(helper.getFieldIndex("ix"), x);
+                        expId.setValue(helper.getFieldIndex("iy"), y);
+                        Long id = helper.pack(expId).getValue();
+
+
+                        System.out.printf("[%d,%d]\t%d\t%d\t%d\tTime:%f +- %f\tAmp:%f +- %f\n",x,y,HPSEcalConditions.getCrate(id),HPSEcalConditions.getSlot(id) ,HPSEcalConditions.getChannel(id), tPlots[x + 23][y + 5].mean(), tPlots[x + 23][y + 5].rms(), aPlots[x + 23][y + 5].mean(), aPlots[x + 23][y + 5].rms());
+
+                        pWriter.printf("%d %d\n",x,y);
+                    }
+
                 }
-            
             }
         }
     }
@@ -332,59 +613,209 @@
 //        }
     }
 
+    @Override
     public void process(EventHeader event) {
-        if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
-            List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
-            for (RawTrackerHit hit : hits) {
-                int x = hit.getIdentifierFieldValue("ix");
-                int y = hit.getIdentifierFieldValue("iy");
-                if (calWindow > 0) {
-                    for (int i = 0; i < calWindow; i++) {
-                        aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+        
+        getTrigger(event);
+        
+        
+        boolean isTop,isBot,isAll;
+        for(int iside=0; iside<3;++iside) {
+            
+            isAll = false;
+            isTop = false;
+            isBot = false;
+
+            //System.out.println("Side " + iside + " Trigger " + _trigger[0] + "," + _trigger[1]);
+
+            
+            if(iside==0) {
+                isAll =true;
+            }else if (iside==1) {
+                if(_trigger[0]>0) isTop = true;
+                else continue;
+            }
+            else if(iside==2) {
+                if(_trigger[1]>0) isBot = true;
+                else continue;
+            }
+            
+            //System.out.println("isTop " + isTop + " isBot " + isBot);
+            
+            
+            if (event.hasCollection(RawTrackerHit.class, inputCollection)) {
+                List<RawTrackerHit> hits = event.get(RawTrackerHit.class, inputCollection);
+                for (RawTrackerHit hit : hits) {
+                    
+                    
+                    int y = hit.getIdentifierFieldValue("iy");
+                    int x = hit.getIdentifierFieldValue("ix");
+            
+
+                    //System.out.println("RawTrackerHit: iside " + iside + " trigger " + _trigger[0] + ", " + _trigger[1] + " isBot " + isBot + " isTop " + isTop + " iy " + y);
+            
+                    //Only look at the opposite half of what triggered
+                    if(isAll) {
+                    
                     }
-                } else {
-                    for (int i = 0; i < hit.getADCValues().length; i++) {
-                        aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                    if(isTop) {   
+                        if(y>0) continue;
+                    }                 
+                    if(isBot) {
+                        if(y<0) continue;
+                    }
+                    
+                    
+
+                    //System.out.println("RawTrackerHit: ===> fill");
+            
+                    
+                    if (calWindow > 0) {
+                        for (int i = 0; i < calWindow; i++) {
+                            
+                            if(isAll) aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                            if(isTop) aTPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                            if(isBot) aBPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                            
+                        }
+                    } else {
+                        for (int i = 0; i < hit.getADCValues().length; i++) {
+                            if(isAll) aPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                            if(isTop) aTPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                            if(isBot) aBPlots[x + 23][y + 5].fill(hit.getADCValues()[i]);
+                        
+                        }
                     }
                 }
+                if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+                    redraw();
+                }
             }
-            if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
-                redraw();
-            }
-        }
 
-        if (event.hasCollection(BaseRawCalorimeterHit.class, inputCollection)) {
-            List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollection);
-            for (BaseRawCalorimeterHit hit : hits) {
-                int x = hit.getIdentifierFieldValue("ix");
-                int y = hit.getIdentifierFieldValue("iy");
-                aPlots[x + 23][y + 5].fill(hit.getAmplitude());
-                tPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
-            }
-            if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
-                redraw();
-            }
-        }
+            if (event.hasCollection(BaseRawCalorimeterHit.class, inputCollection)) {
+                List<BaseRawCalorimeterHit> hits = event.get(BaseRawCalorimeterHit.class, inputCollection);
+                for (BaseRawCalorimeterHit hit : hits) {
+                    int x = hit.getIdentifierFieldValue("ix");
+                    int y = hit.getIdentifierFieldValue("iy");
+
+                    
+                    //System.out.println("BaseRawCalorimeterHit: iside " + iside + " trigger " + _trigger[0] + ", " + _trigger[1] + " isBot " + isBot + " isTop " + isTop + " iy " + y );
 
-        if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
-            List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
-            for (CalorimeterHit hit : hits) {
-                int x = hit.getIdentifierFieldValue("ix");
-                int y = hit.getIdentifierFieldValue("iy");
-                aPlots[x + 23][y + 5].fill(hit.getRawEnergy());
-                tPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
+                    //Only look at the opposite half of what triggered
+                    if(isAll) {}
+                    if(isTop) {   
+                        if(y>0) continue;
+                    }                 
+                    if(isBot) {
+                        if(y<0) continue;
+                    }
+                    
+                    //System.out.println("BaseRawCalorimeterHit: ===> fill");
+                    
+                    
+                    if(isAll) {
+                        aPlots[x + 23][y + 5].fill(hit.getAmplitude());
+                        tPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
+                    }
+                    if(isTop) {
+                        aTPlots[x + 23][y + 5].fill(hit.getAmplitude());
+                        tTPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
+                    }
+                    if(isBot) {
+                        aBPlots[x + 23][y + 5].fill(hit.getAmplitude());
+                        tBPlots[x + 23][y + 5].fill(hit.getTimeStamp() / 64);
+                    }
+                    
+                }
+                if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+                    redraw();
+                }
             }
-            if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
-                redraw();
+
+            if (event.hasCollection(CalorimeterHit.class, inputCollection)) {
+                List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputCollection);
+                for (CalorimeterHit hit : hits) {
+                    int x = hit.getIdentifierFieldValue("ix");
+                    int y = hit.getIdentifierFieldValue("iy");
+
+                    //System.out.println("CalorimeterHit: iside " + iside + " trigger " + _trigger[0] + ", " + _trigger[1] + " isBot " + isBot + " isTop " + isTop + " iy " + y );
+
+                    
+                    
+                    //Only look at the opposite half of what triggered
+                    if(isAll) {}
+                    if(isTop) {   
+                        if(y>0) continue;
+                    }                 
+                    if(isBot) {
+                        if(y<0) continue;
+                    }
+                    
+                    //System.out.println("CalorimeterHit: ===> fill");
+                    if(isAll) {
+                        aPlots[x + 23][y + 5].fill(hit.getRawEnergy());
+                        tPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
+                    }
+                    if(isTop) {
+                        aTPlots[x + 23][y + 5].fill(hit.getRawEnergy());
+                        tTPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
+                    }
+                    if(isBot) {
+                        aBPlots[x + 23][y + 5].fill(hit.getRawEnergy());
+                        tBPlots[x + 23][y + 5].fill(hit.getTime() / 4.0);
+                    }
+                }
+                if (eventRefreshRate > 0 && ++eventn % eventRefreshRate == 0) {
+                    redraw();
+                }
             }
         }
     }
+    
+    private void clearTrigger() {
+        _trigger[0] = 0; 
+        _trigger[1] = 0;
+    }
+    
+     private void getTrigger(EventHeader event) {
+        
+        clearTrigger();
+        if(event.hasCollection(TriggerData.class, "TriggerBank")) {
+            List<TriggerData> triggerDataList = event.get(TriggerData.class, "TriggerBank");
+            if(triggerDataList.isEmpty() == false) {
+                TriggerData triggerData = triggerDataList.get(0);
+                int topTrig = triggerData.getTopTrig();
+                int botTrig = triggerData.getBotTrig();
+                _trigger[0] = topTrig>0 ? 1 : 0;
+                _trigger[1] = botTrig>0 ? 1 : 0;
+            } else {
+                System.out.println( "Event has EMPTY trigger list!!"); 
+                _trigger[0] = 0; 
+                _trigger[1] = 0;
+            }
+        } 
+        else {
+            System.out.println( "Event has NO trigger bank!!"); 
+            _trigger[0] = 0; 
+            _trigger[1] = 0;
+        }
+    }
+     
 
     @Override
     public void actionPerformed(ActionEvent ae) {
         if (ae.getSource() == blankButton) {
             plotter.region(2).clear();
             plotter2.region(2).clear();
+            /*
+            plotter3.region(2).clear();
+            plotter4.region(2).clear();
+            plotterTop.region(2).clear();
+            plotterTop2.region(2).clear();
+            plotterTop3.region(2).clear();
+            plotterTop4.region(2).clear();
+            
+            */
         } else {
             Integer x, y;
             x = (Integer) xCombo.getSelectedItem();
@@ -399,6 +830,18 @@
             plotter3.region(2).plot(tPlots[x + 23][y + 5]);
             plotter4.region(2).clear();
             plotter4.region(2).plot(aPlots[x + 23][y + 5]);
+/*
+            plotterTop.region(2).clear();
+            plotterTop.region(2).plot(aTPlots[x + 23][y + 5]);
+            plotterTop2.region(2).clear();
+            plotterTop2.region(2).plot(tTPlots[x + 23][y + 5]);
+//            ((PlotterRegion) plotter.region(2)).getPlot().setAllowUserInteraction(false);
+//            ((PlotterRegion) plotter.region(2)).getPlot().setAllowPopupMenus(false);
+            plotterTop3.region(2).clear();
+            plotterTop3.region(2).plot(tTPlots[x + 23][y + 5]);
+            plotterTop4.region(2).clear();
+            plotterTop4.region(2).plot(aTPlots[x + 23][y + 5]);
+*/
         }
     }
 
@@ -412,25 +855,75 @@
         aTOutMeanPlot.reset();
         tTOutSigmaPlot.reset();
         tTOutMeanPlot.reset();
+        aTTOutSigmaPlot.reset();
+        aTTOutMeanPlot.reset();
+        tTTOutSigmaPlot.reset();
+        tTTOutMeanPlot.reset();
+        aBTOutSigmaPlot.reset();
+        aBTOutMeanPlot.reset();
+        tBTOutSigmaPlot.reset();
+        tBTOutMeanPlot.reset();
         for (int x = -23; x <= 23; x++) { // slot
             for (int y = -5; y <= 5; y++) { // crate   
+                System.out.println("redraw x,y " + x + "," + y + " tT " + tTPlots[x + 23][y + 5].entries() + " tB " + tBPlots[x + 23][y + 5].entries());
                 if (aPlots[x + 23][y + 5].entries() > 10) {
                     aSigmaPlot.fill(aPlots[x + 23][y + 5].rms());
                     aMeanPlot.fill(aPlots[x + 23][y + 5].mean());
+                    
+                }
+                if (aTPlots[x + 23][y + 5].entries() > 10) {
+                    
+                    aTSigmaPlot.fill(aTPlots[x + 23][y + 5].rms());
+                    aTMeanPlot.fill(aTPlots[x + 23][y + 5].mean());
+                    
                 }
+                if (aBPlots[x + 23][y + 5].entries() > 10) {
+                    
+                    
+                    aBSigmaPlot.fill(aBPlots[x + 23][y + 5].rms());
+                    aBMeanPlot.fill(aBPlots[x + 23][y + 5].mean());
+                }
+                
                 if (tPlots[x + 23][y + 5].entries() > 10) {
                     tSigmaPlot.fill(tPlots[x + 23][y + 5].rms());
                     tMeanPlot.fill(tPlots[x + 23][y + 5].mean());
                 }
+                
+                if (tTPlots[x + 23][y + 5].entries() > 10) {
+                    
+                    tTSigmaPlot.fill(tTPlots[x + 23][y + 5].rms());
+                    tTMeanPlot.fill(tTPlots[x + 23][y + 5].mean());
+                    
+                }
+                if (tBPlots[x + 23][y + 5].entries() > 10) {
+                    
+                    
+                    tBSigmaPlot.fill(tBPlots[x + 23][y + 5].rms());
+                    tBMeanPlot.fill(tBPlots[x + 23][y + 5].mean());
+                }
             
                 //Outliers in time -- threshold is nr of sigma/rms from the mean
                 
                 if (tPlots[x + 23][y + 5].rms() > (tSigmaPlot.mean()+tSigmaPlot.rms()*tTOutNSigmaThr)  && tPlots[x + 23][y + 5].entries() > 10) {
                     tTOutSigmaPlot.fill(x,y,tPlots[x + 23][y + 5].rms());
                     tTOutMeanPlot.fill(x,y,tPlots[x + 23][y + 5].mean());
-                    
                     aTOutSigmaPlot.fill(x,y,aPlots[x + 23][y + 5].rms());
                     aTOutMeanPlot.fill(x,y,aPlots[x + 23][y + 5].mean());
+                }
+                if (tTPlots[x + 23][y + 5].rms() > (tTSigmaPlot.mean()+tTSigmaPlot.rms()*tTOutNSigmaThr)  && tTPlots[x + 23][y + 5].entries() > 10) {
+                
+                    tTTOutSigmaPlot.fill(x,y,tTPlots[x + 23][y + 5].rms());
+                    tTTOutMeanPlot.fill(x,y,tTPlots[x + 23][y + 5].mean());
+                    aTTOutSigmaPlot.fill(x,y,aTPlots[x + 23][y + 5].rms());
+                    aTTOutMeanPlot.fill(x,y,aTPlots[x + 23][y + 5].mean());
+                }
+                if (tBPlots[x + 23][y + 5].rms() > (tBSigmaPlot.mean()+tBSigmaPlot.rms()*tTOutNSigmaThr)  && tBPlots[x + 23][y + 5].entries() > 10) {
+                
+                    tBTOutSigmaPlot.fill(x,y,tBPlots[x + 23][y + 5].rms());
+                    tBTOutMeanPlot.fill(x,y,tBPlots[x + 23][y + 5].mean());
+                    
+                    aBTOutSigmaPlot.fill(x,y,aBPlots[x + 23][y + 5].rms());
+                    aBTOutMeanPlot.fill(x,y,aBPlots[x + 23][y + 5].mean());
                 
                 }
             
CVSspam 0.2.12


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