hps-java/src/main/java/org/lcsim/hps/analysis/ecal
diff -u -r1.5 -r1.6
--- HPSMCParticlePlotsDriver.java 21 Sep 2012 18:36:34 -0000 1.5
+++ HPSMCParticlePlotsDriver.java 12 Oct 2012 06:02:59 -0000 1.6
@@ -1,6 +1,7 @@
package org.lcsim.hps.analysis.ecal;
import hep.aida.*;
+import hep.aida.ref.plotter.PlotterRegion;
import java.util.ArrayList;
import java.util.Comparator;
@@ -17,14 +18,14 @@
* Diagnostic plots for HPS ECal.
*
* @author Jeremy McCormick <[log in to unmask]>
- * @version $Id: HPSMCParticlePlotsDriver.java,v 1.5 2012/09/21 18:36:34 phansson Exp $
+ * @version $Id: HPSMCParticlePlotsDriver.java,v 1.6 2012/10/12 06:02:59 phansson Exp $
*/
public class HPSMCParticlePlotsDriver extends Driver {
AIDA aida = AIDA.defaultInstance();
private AIDAFrame pFrame;
IAnalysisFactory af = aida.analysisFactory();
- public boolean hideFrame = false;
+ public boolean _hideFrame = false;
// MCParticle plots.
ICloud1D primaryEPlot;
ICloud1D fsCountPlot;
@@ -66,6 +67,11 @@
}
}
+ public void setHideFrame(boolean hideFrame) {
+ this._hideFrame = hideFrame;
+ }
+
+
@Override
public void startOfData() {
fsCountPlot = aida.cloud1D("MCParticle: Number of Final State Particles");
@@ -114,7 +120,7 @@
fsElectronThetaPlot = aida.cloud1D("MCParticle: FS Electron Theta");
fsElectronThetaPlot.annotation().addItem("xAxisLabel", "Particle angle [rad]");
- fsElectronThetayPlot = aida.histogram1D("MCParticle: FS Electron Thetay",100,0,1.0);
+ fsElectronThetayPlot = aida.histogram1D("MCParticle: FS Electron Thetay",100,0,0.1);
fsElectronThetayPlot.annotation().addItem("xAxisLabel", "Particle Thetay angle [rad]");
fsElectronThetayTrigPlot = aida.histogram1D("MCParticle: FS Electron Thetay Trig",100,0,1.0);
@@ -149,12 +155,27 @@
pFrame.setTitle("Truth MC Particle Plots");
IPlotter pPlotter = af.createPlotterFactory().create("MCParticle Plots");
pPlotter.setTitle("MCParticle Event Types");
- pPlotter.createRegions(1,2);
- pPlotter.region(0).plot(fsCountEventTypePlot);
- pPlotter.region(1).plot(fsCountVsEventPlot);
+ pPlotter.createRegions(2,2);
+ pPlotter.region(0).plot(fsCountTypePlot);
+ pPlotter.region(1).plot(fsCountEventTypePlot);
+ //pPlotter.region(1).plot(fsCountVsEventPlot);
+ pPlotter.region(2).plot(fsEPlot);
+ pPlotter.region(2).plot(fsGammaEPlot,"mode=overlay");
+ pPlotter.region(2).plot(fsElectronEPlot,"mode=overlay");
+ pPlotter.region(2).plot(fsPositronEPlot,"mode=overlay");
+ pPlotter.region(2).style().dataStyle().fillStyle().setVisible(false);
+ pPlotter.region(3).plot(fsElectronThetayPlot);
+ pPlotter.region(3).plot(fsPositronThetayPlot,"mode=overlay");
+ pPlotter.region(3).plot(fsGammaThetayPlot,"mode=overlay");
+ pPlotter.region(3).style().dataStyle().fillStyle().setVisible(false);
+ for(int i=0;i<4;++i) {
+ ((PlotterRegion) pPlotter.region(i)).getPlot().setAllowPopupMenus(true);
+ ((PlotterRegion) pPlotter.region(i)).getPlot().setAllowUserInteraction(true);
+ }
+
pFrame.addPlotter(pPlotter);
pFrame.pack();
- pFrame.setVisible(!hideFrame);
+ pFrame.setVisible(!_hideFrame);
@@ -187,7 +208,7 @@
double fsE = fs.getEnergy();
double theta = Math.atan2(Math.sqrt(fs.getPX() * fs.getPX() + fs.getPY() * fs.getPY()), fs.getPZ());
- double thetay = Math.atan2(fs.getPX(), fs.getPZ());
+ double thetay = Math.atan2(fs.getPY(), fs.getPZ());
int fsPdg = fs.getPDGID();
fsEPlot.fill(fsE);
fsCountTypePlot.fill(fsPdg);
@@ -256,9 +277,12 @@
if(ne==1 && np==0 & ng==1) return 5;
if(ne==0 && np==1 & ng==1) return 6;
if(ne==1 && np==1 & ng==1) return 7;
- if(ne>1) return 8;
- if(np>1) return 9;
- if(ng>1) return 10;
+ if(ne==2 && np==1) return 8;
+ if(ne==2 && np==1 & ng ==0 ) return 9;
+ if(ne==2 && np==1 & ng ==1 ) return 10;
+ if(ne>2) return 11;
+ if(np>1) return 12;
+ if(ng>1) return 13;
return 0;
}
@@ -314,4 +338,10 @@
}
return fsParticles;
}
+
+
+ public void endOfData() {
+ if(this._hideFrame) pFrame.dispose();
+
+ }
}