Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN | |||
TrigRateDriver.java | +87 | -88 | 1.3 -> 1.4 |
Added more distributions: angle, hitY vs col
diff -u -r1.3 -r1.4 --- TrigRateDriver.java 17 Jul 2012 20:13:12 -0000 1.3 +++ TrigRateDriver.java 22 Aug 2012 18:42:42 -0000 1.4 @@ -40,9 +40,8 @@
protected Subdetector ecal; private String ecalName = "Ecal";
+ private double targetZPosition = -674; //mm
- private static int crystalCols; - private static int crystalRows;
private boolean hideFrame = true; private String outputPlotFileName = "trigRate.aida";
@@ -59,21 +58,24 @@
IHistogramFactory hf = aida.histogramFactory(); private AIDAFrame plotterFrame; private AIDAFrame plotterFrameTrig;
+ + private static int nThr = 3; + private int eThr[] = {0,600,800};
+
IPlotter plotter_trig_tag; IHistogram1D clusterEnergy[][] = new IHistogram1D[47][11]; IHistogram2D meanClusterEnergy;
+ IHistogram1D hityCol[][] = new IHistogram1D[nThr][47]; +
private int trigger[] = {0,0};
- private static int nThr = 5; - private int eThr[] = {400,500,600,700,800}; -
private int refreshRate = 1000; // Cluster energy correction
- double C_ep = 1.0; //1.0/0.3;
+ //double C_ep = 1.0; //1.0/0.3;
@@ -87,36 +89,33 @@
// Cache ref to decoder. dec = ecal.getIDDecoder();
- //Ecal geometry - - crystalCols = 46; - crystalRows = 5; - - - - -
plotterFrame = new AIDAFrame(); plotterFrame.setTitle("TrigRateFrame"); IPlotterStyle style;
-
IPlotter plotter_hitmap_gr = af.createPlotterFactory().create();
- plotter_hitmap_gr.createRegions(2,6,0); - plotter_hitmap_gr.setTitle("Cluster hit map gr");
+ plotter_hitmap_gr.createRegions(2,nThr+1,0); + plotter_hitmap_gr.setTitle("Cluster hit map");
plotter_hitmap_gr.style().statisticsBoxStyle().setVisible(false); plotterFrame.addPlotter(plotter_hitmap_gr); IPlotter plotter_hitY_gr = af.createPlotterFactory().create();
- plotter_hitY_gr.createRegions(2,6,0); - plotter_hitY_gr.setTitle("Cluster hit Y gr");
+ plotter_hitY_gr.createRegions(2,nThr+1,0); + plotter_hitY_gr.setTitle("Cluster hit Y");
plotter_hitY_gr.style().statisticsBoxStyle().setVisible(false); plotterFrame.addPlotter(plotter_hitY_gr);
+ IPlotter plotter_hitTheta_gr = af.createPlotterFactory().create(); + plotter_hitTheta_gr.createRegions(2,nThr+1,0); + plotter_hitTheta_gr.setTitle("Cluster hit theta"); + plotter_hitTheta_gr.style().statisticsBoxStyle().setVisible(false); + plotterFrame.addPlotter(plotter_hitTheta_gr); + +
IPlotter plotter_ep_gr = af.createPlotterFactory().create();
- plotter_ep_gr.createRegions(2,6,0); - plotter_ep_gr.setTitle("Cluster Eoverp gr");
+ plotter_ep_gr.createRegions(2,nThr+1,0); + plotter_ep_gr.setTitle("Cluster E over p");
plotter_ep_gr.style().statisticsBoxStyle().setVisible(false); plotterFrame.addPlotter(plotter_ep_gr);
@@ -127,26 +126,37 @@
double ymin = iside == 0 ? -0.5 : -5.5; double ymax = iside == 0 ? 5.5 : 0.5;
- IHistogram h = aida.histogram2D("Cluster hit map good region " + side, 26, -25.5, 0.5, 6, ymin, ymax);
+ IHistogram h = aida.histogram2D("Hit map " + side, 26, -25.5, 0.5, 6, ymin, ymax);
plotter_hitmap_gr.region((nThr+1)*iside).plot(h);
- IHistogram hy = aida.histogram1D("Cluster hit Y good region " + side, 7, -0.5, 6.5);
+ IHistogram hy = aida.histogram1D("Hit Y " + side, 7, -0.5, 6.5);
plotter_hitY_gr.region((nThr+1)*iside).plot(hy);
- IHistogram hep = aida.histogram1D("Cluster Eoverp good region " + side, 50, 0, 2);
+ IHistogram hth = aida.histogram1D("Hit theta " + side, 10, 0, 80); + plotter_hitTheta_gr.region((nThr+1)*iside).plot(hth); + + IHistogram hep = aida.histogram1D("Cluster Eoverp " + side, 50, 0, 2);
plotter_ep_gr.region((nThr+1)*iside).plot(hep); for(int i=0;i<nThr;++i) { int reg = ((nThr+1)*iside)+(i+1); if(debug) System.out.println("reg " + reg);
- h = aida.histogram2D("Cluster E>" + eThr[i] + "GeV hit map good region " + side, 26, -25.5, 0.5, 6, ymin, ymax);
+ h = aida.histogram2D("Hit map E>" + eThr[i] + "MeV " + side, 26, -25.5, 0.5, 6, ymin, ymax);
plotter_hitmap_gr.region(reg).plot(h);
- hy = aida.histogram1D("Cluster E>" + eThr[i] + "GeV hit Y good region " + side, 7, -0.5,6.5);
+ hy = aida.histogram1D("Hit Y E>" + eThr[i] + "MeV " + side, 7, -0.5,6.5);
plotter_hitY_gr.region(reg).plot(hy);
+ + hth = aida.histogram1D("Hit theta E>" + eThr[i] + "MeV " + side, 20, 0,80); + plotter_hitTheta_gr.region(reg).plot(hth); + + + for(int icol=-23;icol<=23;++icol) { + hityCol[i][icol+23] = aida.histogram1D("Hit Y E>" + eThr[i] + "MeV " + side + " col"+icol, 7, -0.5,6.5); + }
- hep = aida.histogram1D("Cluster E>" + eThr[i] + "GeV Eoverp good region " + side, 50, 0,2);
+ hep = aida.histogram1D("Eoverp E>" + eThr[i] + "MeV " + side, 50, 0,2);
plotter_ep_gr.region(reg).plot(hep);
@@ -185,7 +195,7 @@
plotterFrame.addPlotter(plotter_clE);
-
+
if(!hideFrame) {
@@ -256,60 +266,53 @@
for(HPSEcalCluster cl : clusters) {
- - - int[] crystalPair = getCrystalPair(cl); -
- - boolean clusterGoodRegion = false; - //if(crystalPair[0]<0 && crystalPair[1]>0) clusterGoodRegion = true; - if(crystalPair[0]<0) clusterGoodRegion = true; -// if(crystalPair[0]<0 && crystalPair[1]>1) clusterGoodRegion = true; -// if(crystalPair[0]<0 && crystalPair[1]<-1) clusterGoodRegion = true; - - if(debug) { - if(crystalPair[1]<-1) { - System.out.println("BOTTOM " + clusterGoodRegion);
+ int[] clusterPosIdx = new int[2]; + clusterPosIdx[0] = cl.getSeedHit().getIdentifierFieldValue("ix"); + clusterPosIdx[1] = cl.getSeedHit().getIdentifierFieldValue("iy"); + //Uses shower max position -> update ix,iy above? --> FIX THIS! + double clusterPosY = cl.getPosition()[1]; + double clusterPosZ = cl.getPosition()[2]; + String side = clusterPosIdx[1]>0 ? "top" : "bottom"; + int hitY = clusterPosIdx[1]>0 ? clusterPosIdx[1] : (-1*clusterPosIdx[1]); + double hitTheta = Math.atan(clusterPosY/(clusterPosZ-targetZPosition)); + //x-check + if(hitTheta<0) { + if(!"bottom".equals(side)) { + throw new RuntimeException("Hit theta was inconsistent with side!");
}
+ hitTheta *= -1;
}
- - clusterEnergy[crystalPair[0]+23][crystalPair[1]+5].fill(cl.getEnergy()); - - - double clEnergyCorr = cl.getEnergy()*C_ep; - - if(clusterGoodRegion) { - - - String side = crystalPair[1]>0 ? "top" : "bottom"; - aida.histogram2D("Cluster hit map good region " + side).fill(crystalPair[0], crystalPair[1]); - int hitY = crystalPair[1]>0 ? crystalPair[1] : (-1*crystalPair[1]); - aida.histogram1D("Cluster hit Y good region " + side).fill(hitY); - double eoverp = -1; - if(doTracking) { - trkMatchTool.setCluster(cl); - trkMatchTool.match(tracks); - if(trkMatchTool.isMatchedY(20)) { - eoverp = cl.getEnergy()/(trkMatchTool.getMatchedTrack().getPX()*1000); - } - } - if(eoverp>0) aida.histogram1D("Cluster Eoverp good region " + side).fill(eoverp); - - if(debug) System.out.println("Ep = " + eoverp + " doTracking " + doTracking); - - - for(int i=0;i<nThr;++i){ - if(cl.getEnergy()>eThr[i]) { - aida.histogram2D("Cluster E>" + eThr[i] + "GeV hit map good region " + side).fill(crystalPair[0], crystalPair[1]); - aida.histogram1D("Cluster E>" + eThr[i] + "GeV hit Y good region " + side).fill(hitY); - if(eoverp>0) aida.histogram1D("Cluster E>" + eThr[i] + "GeV Eoverp good region " + side).fill(eoverp); - }
+ clusterEnergy[clusterPosIdx[0]+23][clusterPosIdx[1]+5].fill(cl.getEnergy()); + aida.histogram2D("Hit map " + side).fill(clusterPosIdx[0], clusterPosIdx[1]); + aida.histogram1D("Hit Y " + side).fill(hitY); + aida.histogram1D("Hit theta " + side).fill(hitTheta*1000.0); //mrad
+ double eoverp = -1; + if(doTracking) { + trkMatchTool.setCluster(cl); + trkMatchTool.match(tracks); + if(trkMatchTool.isMatchedY(20)) { + eoverp = cl.getEnergy()/(trkMatchTool.getMatchedTrack().getPX()*1000); + } + } + if(eoverp>0) aida.histogram1D("Eoverp " + side).fill(eoverp); + + if(debug) System.out.println("Ep = " + eoverp + " doTracking " + doTracking); + + for(int i=0;i<nThr;++i){ + if(cl.getEnergy()>eThr[i]) { + aida.histogram2D("Hit map E>" + eThr[i] + "MeV " + side).fill(clusterPosIdx[0], clusterPosIdx[1]); + aida.histogram1D("Hit Y E>" + eThr[i] + "MeV " + side).fill(hitY); + aida.histogram1D("Hit theta E>" + eThr[i] + "MeV " + side).fill(hitTheta*1000.0); //mrad + if(eoverp>0) aida.histogram1D("Eoverp E>" + eThr[i] + "MeV " + side).fill(eoverp); + hityCol[i][clusterPosIdx[0]+23].fill(clusterPosIdx[1]);
}
+
}
-
+ +
}
@@ -380,37 +383,33 @@
- public int[] getCrystalPair(HPSEcalCluster cluster) { - int[] pos = new int[2]; - pos[0] = cluster.getSeedHit().getIdentifierFieldValue("ix"); - pos[1] = cluster.getSeedHit().getIdentifierFieldValue("iy"); - - //System.out.println("cluster ix,iy " + pos[0] + "," + pos[1] + " from pos " + cluster.getSeedHit().getPositionVec().toString()); - return pos; - //getCrystalPair(cluster.getPosition()); - }
private void redraw() {
+ //System.out.println("redraw"); + if(meanClusterEnergy.entries()>0) {
meanClusterEnergy.reset();
+ //System.out.println("redraw cluster energy");
for(int irow=-5;irow<=5;++irow) { for(int icol=-23;icol<=23;++icol) {
+ //System.out.println(irow+" "+icol);
if(clusterEnergy[icol+23][irow+5].entries()>5) { meanClusterEnergy.fill(icol,irow,clusterEnergy[icol+23][irow+5].mean()); } } }
+ }
} public void endOfData() {
- - redraw(); -
+ if(nevents>0){ + redraw(); + }
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