hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.1 -r1.2
--- MultScatAnalysis.java 9 Jun 2012 01:56:51 -0000 1.1
+++ MultScatAnalysis.java 11 Jun 2012 00:03:35 -0000 1.2
@@ -56,10 +56,13 @@
private static int crystalCols;
private static int crystalRows;
int ecalClusterSel;
+ boolean hide = true;
private String outputPlotFileName = "test.aida";
private String trackCollectionName = "MatchedTracks";
private String ecalClusterCollectionName = "EcalClusters";
+ private String inputEcalHitCollection = "EcalCalHits";
+
EcalTrackMatch trkMatchTool;
@@ -91,7 +94,7 @@
//Ecal geometry
crystalX = (13.3 + 16.0) / 2;
crystalY = (13.3 + 16.0) / 2;
- beamGap = 20.0;
+ beamGap = 37.0;//20.0;
crystalCols = 46;
crystalRows = 5;
@@ -164,14 +167,15 @@
IHistogram htag10 = aida.histogram1D("toptrig_cl_ecal_n_bottom" , 7, 0, 7);
plotter_trig_tag2.createRegion().plot(htag10);
- plotterFrameTrig.pack();
- plotterFrameTrig.setVisible(true);
-
+ if(!hide) {
+ plotterFrameTrig.pack();
+ plotterFrameTrig.setVisible(true);
+ }
plotterFrame = new AIDAFrame();
- plotterFrame.setTitle("ECal");
+ plotterFrame.setTitle("General");
@@ -516,6 +520,8 @@
IPlotter plotter_ecal_pos = af.createPlotterFactory().create();
IPlotter plotter_ecal_e = af.createPlotterFactory().create();
IPlotter plotter_ecal_hitmap = af.createPlotterFactory().create();
+ IPlotter plotter_ecal_crhitmap = af.createPlotterFactory().create();
+ IPlotter plotter_ecal_cramp = af.createPlotterFactory().create();
IPlotter plotter_ecal_cls = af.createPlotterFactory().create();
IPlotter plotter_ecal_clsx = af.createPlotterFactory().create();
@@ -524,17 +530,23 @@
IPlotter plotter_cltrkmatchEeff = af.createPlotterFactory().create();
IPlotter plotter_clEoverP = af.createPlotterFactory().create();
plotter_ecal_e.createRegions(2,3,0);
- plotter_ecal_e.setTitle("Ecal e");
+ plotter_ecal_e.setTitle("Ecal Cluster Energy");
+ plotter_ecal_cramp.createRegions(2,3,0);
+ plotter_ecal_cramp.setTitle("Ecal Crystal Hit Map");
+ //plotter_ecal_crhitmap.style().statisticsBoxStyle().setVisible(false);
+ plotter_ecal_crhitmap.createRegions(2,3,0);
+ plotter_ecal_crhitmap.setTitle("Ecal Crystal Hit Map");
+ plotter_ecal_crhitmap.style().statisticsBoxStyle().setVisible(false);
plotter_ecal_hitmap.createRegions(2,3,0);
- plotter_ecal_hitmap.setTitle("Ecal hitmap");
+ plotter_ecal_hitmap.setTitle("Ecal Cluster Hit Map");
plotter_ecal_hitmap.style().statisticsBoxStyle().setVisible(false);
plotter_ecal_pos.createRegions(2,3,0);
- plotter_ecal_pos.setTitle("Ecal hitmap");
+ plotter_ecal_pos.setTitle("Ecal Cluster Position");
plotter_ecal_pos.style().statisticsBoxStyle().setVisible(false);
plotter_ecal_cls.createRegions(2,3,0);
- plotter_ecal_cls.setTitle("Ecal cl size");
+ plotter_ecal_cls.setTitle("Ecal Cluster size");
plotter_ecal_clsx.createRegions(2,3,0);
- plotter_ecal_clsx.setTitle("Ecal cl sizeX");
+ plotter_ecal_clsx.setTitle("Ecal Cluster size");
plotter_cltrkmatch.createRegions(3,3,0);
plotter_cltrkmatch.setTitle("Ecal track match");
plotter_cltrkmatchE.createRegions(3,3,0);
@@ -545,6 +557,8 @@
plotter_clEoverP.setTitle("EoverP");
plotterFrame.addPlotter(plotter_ecal_e);
+ plotterFrame.addPlotter(plotter_ecal_crhitmap);
+ plotterFrame.addPlotter(plotter_ecal_cramp);
plotterFrame.addPlotter(plotter_ecal_hitmap);
plotterFrame.addPlotter(plotter_ecal_pos);
plotterFrame.addPlotter(plotter_ecal_cls);
@@ -757,6 +771,108 @@
}
+ IHistogram hcramp_t = aida.histogram1D("Crystal amplitude top", 100, 0, 2000);
+ IHistogram hcramp_b = aida.histogram1D("Crystal amplitude bottom", 100, 0, 2000);
+ IHistogram hcramp_a = aida.histogram1D("Crystal amplitude all", 100, 0, 2000);
+
+
+
+ IPlotterStyle style;
+
+
+ plotter_ecal_cramp.createRegions(1,3,0);
+ plotter_ecal_cramp.region(0).plot(hcramp_t);
+ plotter_ecal_cramp.region(1).plot(hcramp_b);
+ plotter_ecal_cramp.region(2).plot(hcramp_a);
+ plotter_ecal_cramp.style().dataStyle().fillStyle().setColor("yellow");
+
+
+
+
+
+ IHistogram hcrhm_t = aida.histogram2D("Crystal hit map top", 51, -25.5, 25.5, 6, -0.5, 5.5);
+ IHistogram hcrhm_b = aida.histogram2D("Crystal hit map bottom", 51, -25.5, 25.5, 6, -5.5, 0.5);
+ IHistogram hcrhm_a = aida.histogram2D("Crystal hit map all", 51, -25.5, 25.5, 11, -5.5, 5.5);
+
+
+ plotter_ecal_crhitmap.createRegions(1,3,0);
+ plotter_ecal_crhitmap.region(0).plot(hcrhm_t);
+ plotter_ecal_crhitmap.region(1).plot(hcrhm_b);
+ plotter_ecal_crhitmap.region(2).plot(hcrhm_a);
+
+
+
+
+ for(int i=0;i<3;++i) {
+ style = plotter_ecal_crhitmap.region(i).style();
+ style.setParameter("hist2DStyle", "colorMap");
+ style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ ((PlotterRegion) plotter_ecal_crhitmap.region(i)).getPlot().setAllowUserInteraction(true);
+ ((PlotterRegion) plotter_ecal_crhitmap.region(i)).getPlot().setAllowPopupMenus(true);
+ }
+
+
+ IHistogram hhm_t = aida.histogram2D("Cluster hit map top", 51, -25.5, 25.5, 6, -0.5, 5.5);
+ IHistogram hhm_b = aida.histogram2D("Cluster hit map bottom", 51, -25.5, 25.5, 6, -5.5, 0.5);
+ IHistogram hhm_a = aida.histogram2D("Cluster hit map all", 51, -25.5, 25.5, 11, -5.5, 5.5);
+
+
+ IHistogram hshm_t = aida.histogram2D("Cluster hit map sel top", 51, -25.5, 25.5, 6, -0.5, 5.5);
+ IHistogram hshm_b = aida.histogram2D("Cluster hit map sel bottom", 51, -25.5, 25.5, 6, -5.5, 0.5);
+ IHistogram hshm_a = aida.histogram2D("Cluster hit map sel all", 51, -25.5, 25.5, 11, -5.5, 5.5);
+
+
+ plotter_ecal_hitmap.region(0).plot(hhm_t);
+ plotter_ecal_hitmap.region(1).plot(hhm_b);
+ plotter_ecal_hitmap.region(2).plot(hhm_a);
+ plotter_ecal_hitmap.region(3).plot(hshm_t);
+ plotter_ecal_hitmap.region(4).plot(hshm_b);
+ plotter_ecal_hitmap.region(5).plot(hshm_a);
+
+
+
+ for(int i=0;i<6;++i) {
+ style = plotter_ecal_hitmap.region(i).style();
+ style.setParameter("hist2DStyle", "colorMap");
+ style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ ((PlotterRegion) plotter_ecal_hitmap.region(i)).getPlot().setAllowUserInteraction(true);
+ ((PlotterRegion) plotter_ecal_hitmap.region(i)).getPlot().setAllowPopupMenus(true);
+ }
+
+
+
+
+
+
+ IHistogram hhp_t = aida.histogram2D("Cluster hit pos top", 25, -400, 400, 25, 0, 100);
+ IHistogram hhp_b = aida.histogram2D("Cluster hit pos bottom", 25, -400, 400, 25, -100, 0);
+ IHistogram hhp_a = aida.histogram2D("Cluster hit pos all", 25, -400, 400, 25, -100, 100);
+ IHistogram hshp_t = aida.histogram2D("Cluster hit pos sel top", 25, -400, 400, 25, 0, 100);
+ IHistogram hshp_b = aida.histogram2D("Cluster hit pos sel bottom", 25, -400, 400, 25, -100, 0);
+ IHistogram hshp_a = aida.histogram2D("Cluster hit pos sel all", 25, -400, 400, 25, -100, 100);
+
+
+ plotter_ecal_pos.region(0).plot(hhp_t);
+ plotter_ecal_pos.region(1).plot(hhp_b);
+ plotter_ecal_pos.region(2).plot(hhp_a);
+ plotter_ecal_pos.region(3).plot(hshp_t);
+ plotter_ecal_pos.region(4).plot(hshp_b);
+ plotter_ecal_pos.region(5).plot(hshp_a);
+
+
+
+ for(int i=0;i<6;++i) {
+ style = plotter_ecal_pos.region(i).style();
+ style.setParameter("hist2DStyle", "colorMap");
+ style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
+ ((PlotterRegion) plotter_ecal_pos.region(i)).getPlot().setAllowUserInteraction(true);
+ ((PlotterRegion) plotter_ecal_pos.region(i)).getPlot().setAllowPopupMenus(true);
+ }
+
+
+
+
+
String side;
@@ -766,22 +882,9 @@
IHistogram h11 = aida.histogram1D("Cluster energy " + side , 100, 0, 2500);
- IHistogram h2,h22,h3,h33;
- if(iSide==0) h2 = aida.histogram2D("Cluster hit map sel " + side, 51, -25.5, 25.5, 6, -0.5, 5.5);
- else if(iSide==1) h2 = aida.histogram2D("Cluster hit map sel " + side, 51, -25.5, 25.5, 6, -5.5, 0.5);
- else h2 = aida.histogram2D("Cluster hit map sel " + side, 51, -25.5, 25.5, 11, -5.5, 5.5);
-
- if(iSide==0) h3 = aida.histogram2D("Cluster hit pos sel " + side, 25, -400, 400, 25, 0, 100);
- else if(iSide==1) h3 = aida.histogram2D("Cluster hit pos sel " + side, 25, -400, 400, 25, -100, 0);
- else h3 = aida.histogram2D("Cluster hit pos sel " + side, 25, -400, 400, 25, -100, 100);
-
- if(iSide==0) h22 = aida.histogram2D("Cluster hit map " + side, 51, -25.5, 25.5, 6, -0.5, 5.5);
- else if(iSide==1) h22 = aida.histogram2D("Cluster hit map " + side, 26, -25.5, 0.5, 6, -5.5, 0.5);
- else h22 = aida.histogram2D("Cluster hit map " + side, 51, -25.5, 25.5, 11, -5.5, 5.5);
-
- if(iSide==0) h33 = aida.histogram2D("Cluster hit pos " + side, 25, -400, 400, 25, 0, 100);
- else if(iSide==1) h33 = aida.histogram2D("Cluster hit pos " + side, 25, -400, 400, 25, -100, 0);
- else h33 = aida.histogram2D("Cluster hit pos " + side, 25, -400, 400, 25, -100, 100);
+
+
+
@@ -814,18 +917,12 @@
IHistogram hEoverP = aida.histogram1D("allcl_clEoverP_" + side ,25,0,2);
IHistogram hEoverPsel = aida.histogram1D("selcl_clEoverP_" + side ,25,0,2);
-
-
-
plotter_ecal_e.region(iSide+3).plot(h1);
- plotter_ecal_hitmap.region(iSide).plot(h2);
- plotter_ecal_pos.region(iSide).plot(h3);
plotter_ecal_cls.region(iSide).plot(h4);
plotter_ecal_clsx.region(iSide).plot(h5);
plotter_ecal_e.region(iSide).plot(h11);
- plotter_ecal_hitmap.region(iSide+3).plot(h22);
- plotter_ecal_pos.region(iSide+3).plot(h33);
+
plotter_ecal_cls.region(iSide+3).plot(h44);
plotter_ecal_clsx.region(iSide+3).plot(h55);
@@ -896,24 +993,13 @@
- IPlotterStyle style = plotter_ecal_e.region(iSide).style();
+ style = plotter_ecal_e.region(iSide).style();
//style.setParameter("hist2DStyle", "colorMap");
//style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
((PlotterRegion) plotter_ecal_e.region(iSide)).getPlot().setAllowUserInteraction(true);
((PlotterRegion) plotter_ecal_e.region(iSide)).getPlot().setAllowPopupMenus(true);
- style = plotter_ecal_hitmap.region(iSide).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- ((PlotterRegion) plotter_ecal_hitmap.region(iSide)).getPlot().setAllowUserInteraction(true);
- ((PlotterRegion) plotter_ecal_hitmap.region(iSide)).getPlot().setAllowPopupMenus(true);
-
- style = plotter_ecal_pos.region(iSide).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- ((PlotterRegion) plotter_ecal_pos.region(iSide)).getPlot().setAllowUserInteraction(true);
- ((PlotterRegion) plotter_ecal_pos.region(iSide)).getPlot().setAllowPopupMenus(true);
-
+
style = plotter_ecal_cls.region(iSide).style();
style.setParameter("hist2DStyle", "colorMap");
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
@@ -934,18 +1020,8 @@
((PlotterRegion) plotter_ecal_e.region(iSide+3)).getPlot().setAllowUserInteraction(true);
((PlotterRegion) plotter_ecal_e.region(iSide+3)).getPlot().setAllowPopupMenus(true);
- style = plotter_ecal_hitmap.region(iSide+3).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- ((PlotterRegion) plotter_ecal_hitmap.region(iSide+3)).getPlot().setAllowUserInteraction(true);
- ((PlotterRegion) plotter_ecal_hitmap.region(iSide+3)).getPlot().setAllowPopupMenus(true);
-
- style = plotter_ecal_pos.region(iSide+3).style();
- style.setParameter("hist2DStyle", "colorMap");
- style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- ((PlotterRegion) plotter_ecal_pos.region(iSide+3)).getPlot().setAllowUserInteraction(true);
- ((PlotterRegion) plotter_ecal_pos.region(iSide+3)).getPlot().setAllowPopupMenus(true);
-
+
+
style = plotter_ecal_cls.region(iSide+3).style();
style.setParameter("hist2DStyle", "colorMap");
style.dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
@@ -962,10 +1038,11 @@
}
-
- plotterFrame.pack();
- plotterFrame.setVisible(true);
-
+ if(!hide) {
+
+ plotterFrame.pack();
+ plotterFrame.setVisible(true);
+ }
@@ -1123,6 +1200,29 @@
}
+
+
+ if (event.hasCollection(CalorimeterHit.class, inputEcalHitCollection)) {
+ List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputEcalHitCollection);
+ for (CalorimeterHit hit : hits) {
+ int x = hit.getIdentifierFieldValue("ix");
+ int y = hit.getIdentifierFieldValue("iy");
+
+ if(y>0) aida.histogram2D("Crystal hit map top").fill(x,y);
+ else aida.histogram2D("Crystal hit map bottom").fill(x,y);
+ aida.histogram2D("Crystal hit map all").fill(x,y);
+
+ aida.histogram1D("Crystal amplitude all").fill(hit.getRawEnergy());
+ if(y>0) aida.histogram1D("Crystal amplitude top").fill(hit.getRawEnergy());
+ else aida.histogram1D("Crystal amplitude bottom").fill(hit.getRawEnergy());
+
+ }
+ }
+
+
+
+
+
int[] cl_count = {0,0,0};
int[] cl_sel_count = {0,0,0};
@@ -1722,9 +1822,13 @@
double y = pos[1];
int position[] = new int[2];
position[0] = (int)Math.floor(x/crystalX);
-
+ //Subtract the beam gap distance and normalize to Y size
position[1] = (int) Math.floor( (y - beamGap * Math.signum(y) ) / crystalY);
- return position;
+ // For positive crystals I need to add one after floor as we start crystal index from 1
+ if(y>0) position[1] = position[1] + 1;
+ //System.out.println("x " + x + " crystalX " + crystalX + " -> " + position[0]);
+ //System.out.println("y " + y + " crystalY " + crystalY + " -> " + position[1]);
+ return position;
}