hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.10 -r1.11
--- ecalGainAna.java 25 Feb 2013 22:39:26 -0000 1.10
+++ ecalGainAna.java 1 Nov 2013 19:23:53 -0000 1.11
@@ -9,6 +9,7 @@
import org.lcsim.geometry.util.DetectorLocator;
import org.lcsim.hps.recon.ecal.ECalUtils;
import org.lcsim.hps.recon.ecal.EcalConditions;
+import org.lcsim.util.aida.AIDA;
/**
*
@@ -95,9 +96,11 @@
ITree sim = null;
ITree real = null;
+ ITree outTree = null;
try {
sim = af.createTreeFactory().create(cmd.getArgs()[0]);
real = af.createTreeFactory().create(cmd.getArgs()[1]);
+ outTree = af.createTreeFactory().createTree(outName + ".aida", null, ITreeFactory.RECREATE);
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -137,27 +140,28 @@
EcalConditions.detectorChanged(DetectorLocator.findDetector(detectorName), "Ecal");
EcalConditions.loadCalibration();
- IHistogramFactory hf = af.createHistogramFactory(null);
+ IHistogramFactory hf = af.createHistogramFactory(outTree);
- IHistogram2D corrPlotSim = hf.createHistogram2D("Weighted E over p - simulation", 47, -23.5, 23.5, 11, -5.5, 5.5);
- IHistogram2D corrPlotReal = hf.createHistogram2D("Weighted E over p - data", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ IHistogram2D corrPlotSim = hf.createHistogram2D("Weighted E over p - simulation", 46, -23, 23, 11, -5.5, 5.5);
+ IHistogram2D corrPlotReal = hf.createHistogram2D("Weighted E over p - data", 46, -23, 23, 11, -5.5, 5.5);
for (int x = -23; x <= 23; x++) {
+ int ix = x > 0 ? x + 22 : x + 23;
for (int y = -5; y <= 5; y++) {
double ep;
- if (weightPlotSim.binHeight(x + 23, y + 5) > minCount / 4.0) {
- ep = weightPlotSim.binHeight(x + 23, y + 5) / sumPlotSim.binHeight(x + 23, y + 5);
+ if (weightPlotSim.binHeight(ix, y + 5) > minCount / 4.0) {
+ ep = weightPlotSim.binHeight(ix, y + 5) / sumPlotSim.binHeight(ix, y + 5);
if (ep > 1.0) {
ep = 1.0;
}
- corrPlotSim.fill(x, y, ep);
+ corrPlotSim.fill(x - 0.5 * Math.signum(x), y, ep);
}
- if (weightPlotReal.binHeight(x + 23, y + 5) > minCount / 4.0) {
- ep = weightPlotReal.binHeight(x + 23, y + 5) / sumPlotReal.binHeight(x + 23, y + 5);
+ if (weightPlotReal.binHeight(ix, y + 5) > minCount / 4.0) {
+ ep = weightPlotReal.binHeight(ix, y + 5) / sumPlotReal.binHeight(ix, y + 5);
if (ep > 1.0) {
ep = 1.0;
}
- corrPlotReal.fill(x, y, ep);
+ corrPlotReal.fill(x - 0.5 * Math.signum(x), y, ep);
}
}
}
@@ -221,7 +225,7 @@
- IHistogram2D ecalPlot = hf.createHistogram2D("ECal map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ IHistogram2D ecalPlot = hf.createHistogram2D("ECal map", 46, -23, 23, 11, -5.5, 5.5);
plotter.region(0).plot(ecalPlot);
@@ -259,7 +263,7 @@
for (int y = -5; y <= 5; y++) {
Double gain = EcalConditions.physicalToGain(EcalConditions.makePhysicalID(x, y));
if (gain != null) {
- ecalPlot.fill(x, y, gain);
+ ecalPlot.fill(x - 0.5 * Math.signum(x), y, gain);
// gainsPlot.fill(x, y, HPSECalUtils.getHVGroup(x, y));
}
}
@@ -276,7 +280,7 @@
for (int x = -23; x <= 23; x++) {
for (int y = -5; y <= 5; y++) {
- ecalPlot.fill(x, y, pePlotsSim[x + 23][y + 5][0].allEntries());
+ ecalPlot.fill(x - 0.5 * Math.signum(x), y, pePlotsSim[x + 23][y + 5][0].allEntries());
}
}
@@ -291,7 +295,7 @@
for (int x = -23; x <= 23; x++) {
for (int y = -5; y <= 5; y++) {
- ecalPlot.fill(x, y, pePlotsReal[x + 23][y + 5][0].allEntries());
+ ecalPlot.fill(x - 0.5 * Math.signum(x), y, pePlotsReal[x + 23][y + 5][0].allEntries());
}
}
@@ -342,7 +346,7 @@
//// gain *= (peHVSim.mean() / peHVReal.mean());
// }
gainStream.format("%d\t%d\t%f\n", x, y, gain);
- ecalPlot.fill(x, y, gain);
+ ecalPlot.fill(x - 0.5 * Math.signum(x), y, gain);
// System.out.printf("%d\t%d\t%d\t%f\t%f\n", x, y, pePlotsSim[x + 23][y + 5][0].allEntries(), pePlotsSim[x + 23][y + 5][0].mean(), pePlotsSim[x + 23][y + 5][0].rms());
}
}
@@ -354,6 +358,8 @@
plotter.region(0).refresh();
try {
plotter.writeToFile(outName + "_gains_final.png", "png");
+ outTree.commit();
+ outTree.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.16 -r1.17
--- ECalGainDriver.java 31 Oct 2013 00:11:02 -0000 1.16
+++ ECalGainDriver.java 1 Nov 2013 19:23:53 -0000 1.17
@@ -96,7 +96,7 @@
plotter_hitmap_gr.style().statisticsBoxStyle().setVisible(false);
pePlotterFrame.addPlotter(plotter_hitmap_gr);
- hitmap = aida.histogram2D("Cluster hit map", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ hitmap = aida.histogram2D("Cluster hit map", 46, -23, 23, 11, -5.5, 5.5);
plotter_hitmap_gr.region(0).plot(hitmap);
style = plotter_hitmap_gr.region(0).style();
@@ -131,9 +131,9 @@
pePlotterFrame.addPlotter(plotter);
- mpePlot = aida.histogram2D("<E over p>", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ mpePlot = aida.histogram2D("<E over p>", 46, -23, 23, 11, -5.5, 5.5);
plotter.region(0).plot(mpePlot);
- spePlot = aida.histogram2D("RMS(E over p)", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ spePlot = aida.histogram2D("RMS(E over p)", 46, -23, 23, 11, -5.5, 5.5);
plotter.region(1).plot(spePlot);
plotter.region(0).style().statisticsBoxStyle().setVisible(false);
plotter.region(0).style().setParameter("hist2DStyle", "colorMap");
@@ -142,8 +142,8 @@
plotter.region(1).style().setParameter("hist2DStyle", "colorMap");
plotter.region(1).style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
- weightPlot = aida.histogram2D("Weights for correction factor", 47, -23.5, 23.5, 11, -5.5, 5.5);
- sumPlot = aida.histogram2D("Sum for correction factor", 47, -23.5, 23.5, 11, -5.5, 5.5);
+ weightPlot = aida.histogram2D("Weights for correction factor", 46, -23, 23, 11, -5.5, 5.5);
+ sumPlot = aida.histogram2D("Sum for correction factor", 46, -23, 23, 11, -5.5, 5.5);
for (int iE = 0; iE <= 4; ++iE) {
for (int irow = -5; irow <= 5; ++irow) {
@@ -383,8 +383,8 @@
double weight = hit.getRawEnergy() / bestCl.getEnergy();
int ix = hit.getIdentifierFieldValue("ix");
int iy = hit.getIdentifierFieldValue("iy");
- weightPlot.fill(ix, iy, weight);
- sumPlot.fill(ix, iy, weight * PoverE);
+ weightPlot.fill(ix - 0.5 * Math.signum(ix), iy, weight);
+ sumPlot.fill(ix - 0.5 * Math.signum(ix), iy, weight * PoverE);
}
if (debug) {
@@ -419,7 +419,7 @@
h_PE_b[ebin].fill(Eoverp);
}
- hitmap.fill(pos[0], pos[1]);
+ hitmap.fill(pos[0] - 0.5 * Math.signum(pos[0]), pos[1]);
pePlots[pos[0] + 23][pos[1] + 5][0].fill(Eoverp);
@@ -507,8 +507,8 @@
for (int icol = -23; icol <= 23; ++icol) {
//System.out.println(" redraw irow " + irow + " icol " + icol + " entries " + pePlots[icol+23][irow+5].entries());
if (pePlots[icol + 23][irow + 5][0].entries() > 10) {
- mpePlot.fill(icol, irow, pePlots[icol + 23][irow + 5][0].mean());
- spePlot.fill(icol, irow, pePlots[icol + 23][irow + 5][0].rms());
+ mpePlot.fill(icol - 0.5 * Math.signum(icol), irow, pePlots[icol + 23][irow + 5][0].mean());
+ spePlot.fill(icol - 0.5 * Math.signum(icol), irow, pePlots[icol + 23][irow + 5][0].rms());
}
}
}
hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.2 -r1.3
--- DumpAIDATextFiles.java 31 Oct 2013 00:08:53 -0000 1.2
+++ DumpAIDATextFiles.java 1 Nov 2013 19:23:53 -0000 1.3
@@ -18,7 +18,7 @@
/**
*
* @author phansson Dumps all histograms in AIDA files to a standard text format
- * @version $Id: DumpAIDATextFiles.java,v 1.2 2013/10/31 00:08:53 meeg Exp $
+ * @version $Id: DumpAIDATextFiles.java,v 1.3 2013/11/01 19:23:53 meeg Exp $
*/
public class DumpAIDATextFiles {
@@ -80,13 +80,14 @@
String htxt = "IHistogram1D \"" + h.title() + "\" " + h.axis().bins() + " " + h.axis().lowerEdge() + " " + h.axis().upperEdge();
for (int ibin = 0; ibin < h.axis().bins(); ++ibin) {
htxt += " " + h.binEntries(ibin);
+ htxt += " " + h.binHeight(ibin);
}
return htxt;
}
public String convertHist2D(IHistogram2D h) {
//Type title bincontent
- String htxt = "IHistogram2D \"" + h.title() + "\" " + h.xAxis().bins() + " " + h.xAxis().lowerEdge() + " " + h.xAxis().upperEdge() + h.yAxis().bins() + " " + h.yAxis().lowerEdge() + " " + h.yAxis().upperEdge();
+ String htxt = "IHistogram2D \"" + h.title() + "\" " + h.xAxis().bins() + " " + h.xAxis().lowerEdge() + " " + h.xAxis().upperEdge() + " " + h.yAxis().bins() + " " + h.yAxis().lowerEdge() + " " + h.yAxis().upperEdge();
for (int xbin = 0; xbin < h.xAxis().bins(); ++xbin) {
for (int ybin = 0; ybin < h.yAxis().bins(); ++ybin) {
htxt += " " + h.binEntries(xbin, ybin);