LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  February 2016

HPS-SVN February 2016

Subject:

r4188 - in /java/trunk/users/src/main/java/org/hps/users/spaul: ./ feecc/ moller/

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Mon, 8 Feb 2016 04:22:04 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (1268 lines)

Author: [log in to unmask]
Date: Sun Feb  7 20:22:03 2016
New Revision: 4188

Log:
made some changes and added new classes

Added:
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java
    java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java
Modified:
    java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java
    java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/StyleUtil.java	Sun Feb  7 20:22:03 2016
@@ -1,9 +1,16 @@
 package org.hps.users.spaul;
 
+import java.awt.Component;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
 import java.util.Arrays;
 import java.util.Random;
 
+import javax.imageio.ImageIO;
+
 import hep.aida.*;
+import hep.aida.ref.plotter.PlotterUtilities;
 
 public class StyleUtil {
 	
@@ -27,14 +34,16 @@
 		r.style().yAxisStyle().labelStyle().setFontSize(16);
 		r.style().yAxisStyle().tickLabelStyle().setFontSize(14);
 		//	r.style().statisticsBoxStyle().set;
-		//System.out.println(Arrays.toString());
+		//debugPrint());
 		r.style().legendBoxStyle().textStyle().setFontSize(16);
+		r.style().statisticsBoxStyle().textStyle().setFontSize(16);
 		
 		//r.style().dataStyle().showInLegendBox(false);
+		
 		r.style().legendBoxStyle().boxStyle().foregroundStyle().setOpacity(1.0);
 		r.style().dataStyle().fillStyle().setParameter("colorMapScheme", "rainbow");
 		r.style().dataStyle().fillStyle().setParameter("showZeroHeightBins", "false");
-		System.out.println(Arrays.toString(r.style().statisticsBoxStyle().boxStyle().backgroundStyle().availableParameters()));
+		//debugPrint(r.style().dataStyle().availableParameters()));
 		//r.style().dataStyle().setParameter("showDataInStatisticsBox", "false");
 		r.style().setParameter("hist2DStyle", "colorMap");
 		//r.style().dataBoxStyle()
@@ -62,15 +71,38 @@
 		region.style().dataStyle().lineStyle().setParameter("colorRotateMethod", "regionOverlayIndex");
 		region.style().dataStyle().lineStyle().setParameter("colorRotate", "black, red, green, blue");
 		region.style().dataStyle().lineStyle().setParameter("thickness", "3");
+		region.style().dataStyle().outlineStyle().setParameter("colorRotateMethod", "regionOverlayIndex");
+		//debug = true;
+		debugPrint(region.style().dataStyle().outlineStyle().availableParameters());
+		region.style().dataStyle().outlineStyle().setParameter("colorRotate", "black, red, green, blue");
+		region.style().dataStyle().outlineStyle().setParameter("thickness", "3");
 		region.style().dataStyle().errorBarStyle().setVisible(false);
-		System.out.println(Arrays.toString(region.style().dataStyle().lineStyle().availableParameterOptions("colorRotateMethod")));
+		debugPrint(region.style().dataStyle().lineStyle().availableParameterOptions("colorRotateMethod"));
+	}
+	public static void setSize(IPlotter p, int width, int height){
+		p.setParameter("plotterWidth", width +"");
+		p.setParameter("plotterHeight", height +"");
 	}
 	
+	public static void setLog(IPlotterRegion r){
+
+		r.style().yAxisStyle().setParameter("scale", "log");
+		r.style().gridStyle().setUnits(100);
+		debugPrint(r.style().gridStyle().availableParameters()); 
+		
+	}
+	static boolean debug = false;
+	static void debugPrint(String[] stuff){
+		if(debug){
+			System.out.println(Arrays.toString(stuff));
+		}
+	}
 	public static void main(String arg[]){
 		IAnalysisFactory af = IAnalysisFactory.create();
 		IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
 		
 		IPlotter p = af.createPlotterFactory().create();
+		debugPrint(p.availableParameters());
 		p.createRegions(1, 2);
 		IHistogram1D h1 = hf.createHistogram1D("blah", 100, -5, 5);
 		IHistogram1D h2 = hf.createHistogram1D("bleh", 100, -5, 5);
@@ -99,9 +131,65 @@
 		
 		p.show();
 		
+		p = af.createPlotterFactory().create();
+		debugPrint(p.availableParameters());
+		p.createRegions(1, 2);
+		
+		p.region(0).plot(h1);
+		setLog(p.region(0));
+		
+		
+		
+		p.show();
 	}
 	public static void hideLegendAndStats(IPlotterRegion r){
 		r.style().statisticsBoxStyle().setVisible(false);
 		r.style().legendBoxStyle().setVisible(false);
 	}
+	public static IPlotterStyle smoothCurveStyle(IPlotterFactory pf) {
+		IPlotterStyle style = pf.createPlotterStyle();
+		debugPrint(style.dataStyle().availableParameters());
+		
+		style.dataStyle().markerStyle().setVisible(false);
+		
+		return style;
+	}
+	public static void writeToFile(IPlotter plotter, String filename, String filetype){
+		//JFrame frame = new JFrame()
+		//if(plotter.)
+		//plotter.hide();
+		//plotter.show();
+		//PlotterUtilities.writeToFile(plotter, filename, filetype, null);
+		try {
+			
+			
+			//PlotterUtilities.writeToFile(plotter, filename, filetype, null);
+			Thread.sleep(1000);
+			Component c = PlotterUtilities.componentForPlotter(plotter);
+			int width = Integer.parseInt(plotter.parameterValue("plotterWidth"));
+			int height = Integer.parseInt(plotter.parameterValue("plotterHeight"));
+			if(width <= 0){
+				width = 300;
+				plotter.setParameter("plotterWidth", Integer.toString(width));
+			}
+			if(height <= 0){
+				height = 300;
+
+				plotter.setParameter("plotterHeight", Integer.toString(height));
+			}
+			
+			c.setSize(width, height);
+			BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+			Graphics2D graphics2D = image.createGraphics();
+			c.paint(graphics2D);
+			ImageIO.write(image,filetype, new File(filename));
+			Runtime.getRuntime().exec("open " + filename);
+			System.out.println("saved");
+			
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+	}
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/SumEverything.java	Sun Feb  7 20:22:03 2016
@@ -74,6 +74,8 @@
 		run(new File(indir).listFiles(), out);
 	}
 	static void run(File[] files, String out) throws IllegalArgumentException, IOException{
+		
+		long timeStart = System.currentTimeMillis();
 		IAnalysisFactory af = IAnalysisFactory.create();
 		ITreeFactory tf = af.createTreeFactory();
 		new File(out).delete();
@@ -120,9 +122,12 @@
 							System.err.println("couldn't find object called " + name +  " in file " + s);
 							throw e;
 						}
-						if(o instanceof IHistogram1D)
+						if(o instanceof IHistogram1D){
+							if(((IHistogram1D)o).allEntries() != 0)
 							((IHistogram1D)outtree.find(name)).add((IHistogram1D)o);
+						}
 						if(o instanceof IHistogram2D)
+							if(((IHistogram2D)o).allEntries() != 0)
 							((IHistogram2D)outtree.find(name)).add((IHistogram2D)o);
 					}
 					//outtree.unmount("/tmp");
@@ -131,7 +136,7 @@
 
 				tree.close();
 				j++;
-				System.out.println(j + " files have been read");
+				System.out.println(j + " files have been read (" +(System.currentTimeMillis()-timeStart)/j + " ms per event");
 
 			} catch(IllegalArgumentException e){
 				//print the filename
@@ -141,6 +146,7 @@
 			}
 
 			outtree.commit();
+			System.out.println("summed file " + out +" commited.  Total time = " + (System.currentTimeMillis()-timeStart)/1000 + " seconds");
 		}
 	}
 

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java	Sun Feb  7 20:22:03 2016
@@ -36,7 +36,8 @@
 
 			IDataPointSetFactory dpsf = af.createDataPointSetFactory(treeNew);
 
-			IPlotter p = af.createPlotterFactory().create(outpaths[config]);
+			IPlotterFactory pf = af.createPlotterFactory();
+			IPlotter p = pf.create(outpaths[config]);
 
 
 			int Nsets = arg.length/10;
@@ -152,7 +153,9 @@
 
 				//p.region(0).plot(dps_iso);
 			}
-			p.region(0).plot(dpsTheory);
+			
+			IPlotterStyle style = StyleUtil.smoothCurveStyle(pf);
+			p.region(0).plot(dpsTheory, style);
 			StyleUtil.stylize(p.region(0), "Form Factors", "Q^2 (GeV^2)", "|F(Q^2)|^2");
 			p.show();
 		}

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/FEESpectrumGenerator.java	Sun Feb  7 20:22:03 2016
@@ -145,7 +145,7 @@
 			
 			thetaHist = hf.createHistogram1D("theta", "theta", thetaBins);
 			
-			EHist = hf.createHistogram1D("energy", 50, 0, 1.3);
+			EHist = hf.createHistogram1D("energy", 200, 0, 1.3);
 			IPlotter p = af.createPlotterFactory().create();
 			p.createRegions(2,1);
 			p.region(0).plot(thetaHist);
@@ -166,8 +166,9 @@
 			
 			if(phep[3] > .5*E){
 				StdhepEvent event = new StdhepEvent(nevhep, nhep, isthep, idhep, jmohep, jdahep, phep, vhep);
+				double smear = .02;
 				if(display)
-					EHist.fill(phep[3]*(1+random.nextGaussian()*.045));
+					EHist.fill(phep[3]*(1+random.nextGaussian()*smear));
 				writer.writeRecord(event);
 			}
 			else{ // if the event has enough energy loss,

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/MakeHistograms.java	Sun Feb  7 20:22:03 2016
@@ -59,7 +59,7 @@
 			String input = arg[0];
 			String output = arg[1];
 			cb = new CustomBinning(new File(arg[2]));
-			if(arg.length == 5)
+			if(arg[arg.length -1].equals("display"))
 				display = true;
 			IAnalysisFactory af = IAnalysisFactory.create();
 			ITree tree = af.createTreeFactory().create(output,"xml",false,true);
@@ -73,7 +73,10 @@
 			hack.setDetectorName("HPS-EngRun2015-Nominal-v3");
 			hack.setFreeze(true);
 			hack.setRunNumber(Integer.parseInt(arg[3]));
+			
 			hack.initialize();
+			beamTiltY = Double.parseDouble(arg[4]);
+			beamTiltX = Double.parseDouble(arg[5]);
 			LCIOReader reader = new LCIOReader(new File(input));
 			//reader.open(input);
 			//reader.
@@ -98,13 +101,14 @@
 
 	static IHistogram2D h1, h2, h2a, h2b, h2c;
 	static IHistogram2D h4,h4a;
-	static IHistogram1D h3, h3a, h3_t, h3_b;
+	static IHistogram1D h3, /*h3a,*/ h3_t, h3_b;
 	static IHistogram1D h5, h5a; 
-	static IHistogram2D h6, h6a;
+	//static IHistogram2D h6, h6a;
 	static IHistogram1D h7, h7a;
 	static IHistogram1D h8;
 	static IHistogram1D h9_t, h9_b;
 	static IHistogram1D h10_t, h10_b;
+	private static IHistogram1D h4y;
 
 	private static void extractHistograms(ITree tree0) {
 		h1 = (IHistogram2D) tree0.find("theta vs energy");
@@ -115,7 +119,7 @@
 		h2c = (IHistogram2D) tree0.find("theta vs phi alt");
 
 		h3 = (IHistogram1D) tree0.find("theta");
-		h3a = (IHistogram1D) tree0.find("theta isolated ");
+		//h3a = (IHistogram1D) tree0.find("theta isolated ");
 		h3_t = (IHistogram1D) tree0.find("theta top");
 		h3_b = (IHistogram1D) tree0.find("theta bottom");
 		
@@ -125,8 +129,8 @@
 		h5 = (IHistogram1D) tree0.find("energy top");
 		h5 = (IHistogram1D) tree0.find("energy bottom");
 
-		h6 = (IHistogram2D) tree0.find("cluster");
-		h6a = (IHistogram2D) tree0.find("cluster matched");
+//		h6 = (IHistogram2D) tree0.find("cluster");
+//		h6a = (IHistogram2D) tree0.find("cluster matched");
 		h7 = (IHistogram1D) tree0.find("y top");
 		h7a = (IHistogram1D) tree0.find("y bottom");
 		h8 = (IHistogram1D) tree0.find("seed energy");
@@ -176,7 +180,7 @@
 		h2c = hf.createHistogram2D("theta vs phi alt", "theta vs phi alt", thetaBins, phiBins);
 
 		h3 = hf.createHistogram1D("theta", "theta", thetaBins);
-		h3a = hf.createHistogram1D("theta isolated ", "theta isolated", thetaBins);
+//		h3a = hf.createHistogram1D("theta isolated ", "theta isolated", thetaBins);
 
 		h3_t = hf.createHistogram1D("theta top", "theta top", thetaBins);
 		h3_b = hf.createHistogram1D("theta bottom", "theta bottom", thetaBins);
@@ -184,7 +188,8 @@
 		
 		h4 = hf.createHistogram2D("px\\/pz vs py\\/pz", 300, -.16, .24, 300, -.2, .2);
 		h4a = hf.createHistogram2D("px\\/pz vs py\\/pz cut", 300, -.16, .24, 300, -.2, .2);
-
+		h4y = hf.createHistogram1D("py\\pz", 1200, -.06, .06);
+		
 		h5 = hf.createHistogram1D("energy top", 75, 0, 1.5);
 		h5a = hf.createHistogram1D("energy bottom", 75, 0, 1.5);
 		
@@ -192,8 +197,8 @@
 		h9_t = hf.createHistogram1D("pz top", 75, 0, 1.5);
 		h9_b = hf.createHistogram1D("pz bottom", 75, 0, 1.5);
 		
-		h6 = hf.createHistogram2D("cluster", 47, -23.5, 23.5, 11, -5.5, 5.5);
-		h6a = hf.createHistogram2D("cluster matched", 47, -23.5, 23.5, 11, -5.5, 5.5);
+//		h6 = hf.createHistogram2D("cluster", 47, -23.5, 23.5, 11, -5.5, 5.5);
+//		h6a = hf.createHistogram2D("cluster matched", 47, -23.5, 23.5, 11, -5.5, 5.5);
 
 		h7 = hf.createHistogram1D("y top", 500, 0, 100);
 
@@ -210,12 +215,15 @@
 		p.createRegions(2,2);
 		p.region(0).plot(h2);
 		StyleUtil.stylize(p.region(0), "theta", "phi");
-		p.region(1).plot(h3a);
+//		p.region(1).plot(h3a);
 		StyleUtil.stylize(p.region(1), "theta", "# of particles");
-		p.region(2).plot(h3);
-		StyleUtil.stylize(p.region(2), "theta", "# of particles");
+		p.region(2).plot(h9_t);
+		p.region(2).plot(h9_b);
+		StyleUtil.noFillHistogramBars(p.region(2));
+		StyleUtil.stylize(p.region(2), "pztilt" ,"pztilt", "# of particles");
 		p.region(3).plot(h5);
 		p.region(3).plot(h5a);
+		StyleUtil.noFillHistogramBars(p.region(3));
 		StyleUtil.stylize(p.region(3), "energy", "# of particles");
 
 		p.show();
@@ -252,9 +260,9 @@
 
 		IPlotter p6 = pf.create("efficiency");
 		p6.createRegions(1,2);
-		p6.region(0).plot(h6);
+//		p6.region(0).plot(h6);
 		StyleUtil.stylize(p6.region(0), "ix", "iy");
-		p6.region(1).plot(h6a);
+//		p6.region(1).plot(h6a);
 		StyleUtil.stylize(p6.region(1), "ix", "iy");
 		p6.show();
 
@@ -279,15 +287,22 @@
 		p9.region(0).plot(h3_b);
 		StyleUtil.stylize(p9.region(0), "theta", "theta", "# of particles");
 		StyleUtil.noFillHistogramBars(p9.region(0));
-				StyleUtil.stylize(p6.region(1), "ix", "iy");
+				//StyleUtil.stylize(p6.region(1), "ix", "iy");
 		p9.show();
 		
 		IPlotter p10 = pf.create("seed energy");
 		//p6.createRegions(1,2);
+		p10.createRegions(2,1);
 		p10.region(0).plot(h8);
 		StyleUtil.stylize(p10.region(0), "seed energy", "seed energy (GeV)", "# of particles");
+		
+		p10.region(1).plot(h10_t);
+		p10.region(1).plot(h10_b);
+		StyleUtil.noFillHistogramBars(p10.region(1));
+		StyleUtil.stylize(p10.region(1), "clust size", "n ecal hits", "# of particles");
+		
 		//StyleUtil.noFillHistogramBars(p10.region(0));
-				StyleUtil.stylize(p6.region(1), "ix", "iy");
+				//StyleUtil.stylize(p6.region(1), "ix", "iy");
 		p10.show();
 
 	}
@@ -307,80 +322,37 @@
 		List<ReconstructedParticle> particles = event.get(ReconstructedParticle.class, "FinalStateParticles");
 		particles = RemoveDuplicateParticles.removeDuplicateParticles(particles);
 		outer : for(ReconstructedParticle p : particles){
-			//check if this is a duplicate particle (ie, different track same cluster)
-			/*for(ParticleInfo cand : candidates){
-				if(p.getEnergy() == cand.E && cand.isGood == true)
-					continue outer;
-			}*/
+			
 
 			boolean isGood = addParticle(p);
-			if(!isGood){
-				if(p.getClusters().size()!= 0)
-					candidates.add(new ParticleInfo(0, p.getEnergy(), p.getClusters().get(0).getCalorimeterHits().get(0).getTime(), false));
-
-			}
-
-		}
-		for(ParticleInfo c : candidates){
-			if(c.isGood){
-				boolean isIsolated = true;
-				for(ParticleInfo c2 :candidates){
-					//try to remove events that have possible mollers in them. 
-					//correct for this later.  
-					if(Math.abs(c2.t - c.t) < 2.5 && c2.E < .3 && c2 != c){
-						isIsolated = false;
-						break;
-					}
-				}
-				if(isIsolated){
-					h3a.fill(c.theta);
-				}
-			}
-		}
-		candidates.clear();
-		processEventEfficiency(particles);
-	}
-
-	private static void processEventEfficiency(List<ReconstructedParticle> parts) {
-		for(ReconstructedParticle p : parts){
-			if(p.getClusters().size() == 0)
-				continue;
-			if(!(p.getEnergy() > eMin && p.getEnergy() < eMax))
-				continue;
-			Cluster c = p.getClusters().get(0);
-			if(!EcalUtil.fid_ECal(c) || c.getCalorimeterHits().size() < 3)
-				continue;
-			//good cluster?  now continue
-			int ixiy[] = EcalUtil.getCrystalIndex(c); 
-
-			h6.fill(ixiy[0], ixiy[1]);
-			if(p.getTracks().size() == 0)
-				continue;
-			Track t = p.getTracks().get(0);
-			if(t.getChi2()> maxChi2)
-				continue;
-			h6a.fill(ixiy[0], ixiy[1]);
-
-		}
-	}
+			
+
+		}
+		
+	}
+
+	
 
 	static double eMin = .8;
 	static double eMax = 1.2;
 	static double beamEnergy = 1.057;
 
-	static double beamTilt = .03057;
+	static double beamTiltX = .03057;
+	static double beamTiltY;
 	static double maxChi2 = 50;
 	//maximum difference between the reconstructed energy and momentum
-	static double maxdE = .3;
+	static double maxdE = .5;
 
 	static double seedEnergyCut = .4;
 
 
-	static ArrayList<ParticleInfo> candidates = new ArrayList();
 	static boolean addParticle(ReconstructedParticle part){
-
-
-
+		if(part.getTracks().size() != 0){
+			if(part.getMomentum().magnitudeSquared() > .8
+					&& part.getTracks().get(0).getChi2() > maxChi2){
+				h4y.fill(part.getMomentum().y()/part.getMomentum().z());
+			}
+		}
 		if(part.getCharge() != -1)
 			return false;
 		if(part.getClusters().size() == 0)
@@ -422,6 +394,12 @@
 		
 		if(EcalUtil.fid_ECal(c)){
 			
+			if(c.getPosition()[1] > 0){
+				h5.fill(c.getEnergy());
+			}
+			else{ 
+				h5a.fill(c.getEnergy());
+			}
 			if(part.getTracks().size() == 0)
 				return false;
 			Track t = part.getTracks().get(0);
@@ -430,12 +408,7 @@
 			}
 			if(!TrackType.isGBL(t.getType()))
 				return false;
-			if(c.getPosition()[1] > 0){
-				h5.fill(c.getEnergy());
-			}
-			else{ 
-				h5a.fill(c.getEnergy());
-			}
+			
 			
 			
 			Hep3Vector p = part.getMomentum();
@@ -443,9 +416,12 @@
 
 
 			double px = p.x(), pz = p.z();
-			double pxtilt = px*Math.cos(beamTilt)-pz*Math.sin(beamTilt);
+			double pxtilt = px*Math.cos(beamTiltX)-pz*Math.sin(beamTiltX);
 			double py = p.y();
-			double pztilt = pz*Math.cos(beamTilt)+px*Math.sin(beamTilt);
+			double pztilt = pz*Math.cos(beamTiltX)+px*Math.sin(beamTiltX);
+			
+			double pytilt = py*Math.cos(beamTiltY)-pztilt*Math.sin(beamTiltY);
+			pztilt = pz*Math.cos(beamTiltY) + pytilt*Math.sin(beamTiltY);
 
 			if(Math.abs(pztilt - c.getEnergy()) > maxdE)
 				return false;
@@ -454,8 +430,8 @@
 			else
 				h9_b.fill(pztilt);
 
-			double theta = Math.atan(Math.hypot(pxtilt, py)/pztilt);
-			double phi =Math.atan2(py, pxtilt);
+			double theta = Math.atan(Math.hypot(pxtilt, pytilt)/pztilt);
+			double phi =Math.atan2(pytilt, pxtilt);
 			boolean inRange = cb.inRange(theta, phi);
 			if(inRange)
 				h1.fill(theta, c.getEnergy());
@@ -470,6 +446,7 @@
 				h2c.fill(theta, phi);
 
 				h4.fill(px/pz, py/pz);
+				//h4y.fill(py/pz);
 
 				if(inRange){
 
@@ -492,7 +469,6 @@
 					
 					
 					h4a.fill(px/pz, py/pz);
-					candidates.add(new ParticleInfo(theta, c.getEnergy(), c.getCalorimeterHits().get(0).getTime(), true));
 				}
 
 
@@ -502,16 +478,5 @@
 		}
 		return false;
 	}
-	static class ParticleInfo{
-		double theta;
-		double E;
-		double t;
-		boolean isGood;
-		ParticleInfo(double theta, double E, double t, boolean isGood){
-			this.theta = theta;
-			this.E = E;
-			this.t = t;
-			this.isGood = isGood;
-		}
-	}
+	
 }

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/RemoveDuplicateParticles.java	Sun Feb  7 20:22:03 2016
@@ -56,7 +56,7 @@
 			return false;
 		if(p.getTracks().size() == 1 && p.getTracks().size() == 0)
 			return true;
-		if(TrackType.isGBL(p.getTracks().get(0).getType()) && !TrackType.isGBL(p.getTracks().get(0).getType()))
+		if(TrackType.isGBL(p.getTracks().get(0).getType()) && !TrackType.isGBL(p2.getTracks().get(0).getType()))
 				return true;
 		
 		if(p.getTracks().get(0).getChi2() < p2.getTracks().get(0).getChi2()){

Modified: java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java	(original)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ShowCustomBinningXY.java	Sun Feb  7 20:22:03 2016
@@ -24,28 +24,29 @@
 
 				double nK = 10;
 				for(int sign = -1; sign <=1; sign +=2){
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta1, sign*(phi1+(phi2-phi1)*k/nK), theta1, sign*(phi1+(phi2-phi1)*(k+1)/nK),g);
-					}
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta1 + (theta2-theta1)*k/nK, sign*phi2, theta1 + (theta2-theta1)*(k+1)/nK, sign*phi2,g);
-					}
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta2, sign*(phi2+(phi1-phi2)*k/nK), theta2, sign*(phi2+(phi1-phi2)*(k+1)/nK),g);
-					}
-					for(int k = 0; k< nK; k++){
-						drawLineFromPolar(theta2 + (theta1-theta2)*k/nK, sign*phi1, theta2 + (theta1-theta2)*(k+1)/nK, sign*phi1,g);
+
+					Polygon p = new Polygon();
+					for(int k = 0; k< nK; k++){
+						drawLineFromPolar(theta1, sign*(phi1+(phi2-phi1)*k/nK), theta1, sign*(phi1+(phi2-phi1)*(k+1)/nK),g,p);
+					}
+					for(int k = 0; k< nK; k++){
+						drawLineFromPolar(theta1 + (theta2-theta1)*k/nK, sign*phi2, theta1 + (theta2-theta1)*(k+1)/nK, sign*phi2,g,p);
+					}
+					for(int k = 0; k< nK; k++){
+						drawLineFromPolar(theta2, sign*(phi2+(phi1-phi2)*k/nK), theta2, sign*(phi2+(phi1-phi2)*(k+1)/nK),g, p);
+					}
+					for(int k = 0; k< nK; k++){
+						drawLineFromPolar(theta2 + (theta1-theta2)*k/nK, sign*phi1, theta2 + (theta1-theta2)*(k+1)/nK, sign*phi1,g, p);
 					}
 					
-					closePolarFigure(g, i%2 == 0 ? altBin1 : altBin2, i%2 == 0 ? fillBin1 : fillBin2);
+					closePolarFigure(g, i%2 == 0 ? altBin1 : altBin2, i%2 == 0 ? fillBin1 : fillBin2, p);
 				}
 
 			}
 		}
 	}
-	Polygon p = null;
 	private void drawLineFromPolar(double theta1, double phi1, double theta2,
-			double phi2, Graphics g) {
+			double phi2, Graphics g, Polygon p) {
 		double[] xy1 = toXY(theta1, phi1);
 		double[] xy2 = toXY(theta2, phi2);
 
@@ -57,19 +58,24 @@
 				getY(xy2[1]));*/
 		p.addPoint(getX(xy2[0]), getY(xy2[1]));
 	}
-	private void closePolarFigure(Graphics g, Color outlineColor, Color fillColor){
+	private void closePolarFigure(Graphics g, Color outlineColor, Color fillColor, Polygon p){
 		g.setColor(fillColor);
 		g.fillPolygon(p);
 		g.setColor(outlineColor);
 		g.drawPolygon(p);
-		p = null;
-		
-	}
-	double tilt = .03057;
+		
+	}
+	double xtilt =  .0294;
+	double ytilt = -.00082;
 	double[] toXY(double theta, double phi){
-		double ux = Math.cos(phi)*Math.sin(theta)*Math.cos(tilt)+Math.cos(theta)*Math.sin(tilt);
+		double ux = Math.cos(phi)*Math.sin(theta)*Math.cos(xtilt)+Math.cos(theta)*Math.sin(xtilt);
 		double uy = Math.sin(phi)*Math.sin(theta);
-		double uz = Math.cos(theta)*Math.cos(tilt)-Math.cos(phi)*Math.sin(theta)*Math.sin(tilt);
+		double uz = Math.cos(theta)*Math.cos(xtilt)-Math.cos(phi)*Math.sin(theta)*Math.sin(xtilt);
+		
+		double temp = Math.cos(ytilt)*uy+Math.sin(ytilt)*uz;
+		uz = Math.cos(ytilt)*uz-Math.sin(ytilt)*uy;
+		uy = temp;
+		
 		double pxpz = ux/uz;
 		double pypz = uy/uz;
 		return new double[]{pxpz, pypz};
@@ -224,4 +230,19 @@
 			g.drawLine(getX(0), getY(i/100.), getX(0) + 5, getY(i/100.));
 		}
 	}
+	public void paint(Graphics g){
+		super.paint(g);
+		drawBeamspot(g);
+	}
+	
+	void drawBeamspot(Graphics g){
+		g.setColor(Color.red);
+		int x = getX(xtilt), y = getY(ytilt);
+		g.drawLine(x+10, y, x-10, y);
+		g.drawLine(x+10, y+1, x-10, y+1);
+		g.drawLine(x+10, y-1, x-10, y-1);
+		g.drawLine(x, y-10, x, y+10);
+		g.drawLine(x+1, y-10, x+1, y+10);
+		g.drawLine(x-1, y-10, x-1, y+10);
+	}
 }

Added: java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java	(added)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitAllProfiles.java	Sun Feb  7 20:22:03 2016
@@ -0,0 +1,56 @@
+package org.hps.users.spaul.moller;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IFitFactory;
+import hep.aida.IFitResult;
+import hep.aida.IFunction;
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IProfile1D;
+import hep.aida.ITree;
+
+import java.io.IOException;
+
+public class FitAllProfiles {
+	static IAnalysisFactory af = IAnalysisFactory.create();
+	static IFitFactory ff = af.createFitFactory();
+	
+	public static void main(String arg[]) throws IllegalArgumentException, IOException{
+		
+		ITree tree = af.createTreeFactory().create(arg[0]); 
+		IPlotter p = af.createPlotterFactory().create();
+		p.createRegions(3,2);
+		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz"));
+		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz"));
+		plotAndFit(p, 2, (IProfile1D)tree.find("pypz vs diff"));
+		plotAndFit(p, 3, (IProfile1D)tree.find("pxpz vs diff"));
+		
+		p.show();
+	}
+	public static void plotAndFit(IPlotter p, int r, IHistogram1D h){
+		p.region(r).plot(h);
+		IFitResult fit = ff.createFitter().fit(h, "g");
+		IFunction func = fit.fittedFunction();
+		System.out.println("\n" + h.title());
+		String names[] = func.parameterNames();
+		double params[] = func.parameters();
+		for(int i = 0; i< names.length; i++){
+			System.out.printf("%s: %f\n", names[i], params[i]);
+		}
+		p.region(r).plot(func);
+		
+	}
+	public static void plotAndFit(IPlotter p, int r, IProfile1D h){
+		p.region(r).plot(h);
+		IFitResult fit = ff.createFitter().fit(h, "p4");
+		IFunction func = fit.fittedFunction();
+		System.out.println("\n" + h.title());
+		String names[] = func.parameterNames();
+		double params[] = func.parameters();
+		for(int i = 0; i< names.length; i++){
+			System.out.printf("%s: %f\t", names[i], params[i]);
+		}
+		p.region(r).plot(func);
+		
+	}
+}

Added: java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java	(added)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/FitMollerPyPzGraphs.java	Sun Feb  7 20:22:03 2016
@@ -0,0 +1,74 @@
+package org.hps.users.spaul.moller;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.hps.users.spaul.StyleUtil;
+
+import hep.aida.*;
+
+public class FitMollerPyPzGraphs {
+	static IAnalysisFactory af = IAnalysisFactory.create();
+	static IFitFactory ff = af.createFitFactory();
+	
+	public static void main(String arg[]) throws IllegalArgumentException, IOException{
+		
+		ITree tree = af.createTreeFactory().create(arg[0]); 
+		/*IPlotter p = af.createPlotterFactory().create();
+		p.createRegions(4,2);
+		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz"), "uy all", "uy");
+		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz"), "ux all", "ux");
+		plotAndFit(p, 2, (IHistogram1D)tree.find("pypz bot"), "uy (bot)", "uy");
+		plotAndFit(p, 3, (IHistogram1D)tree.find("pxpz bot"), "ux (bot)", "ux");
+		plotAndFit(p, 4, (IHistogram1D)tree.find("pypz mid"), "uy (mid)", "uy");
+		plotAndFit(p, 5, (IHistogram1D)tree.find("pxpz mid"), "ux (mid)", "ux");
+		plotAndFit(p, 6, (IHistogram1D)tree.find("pypz top"), "uy (top)", "uy");
+		plotAndFit(p, 7, (IHistogram1D)tree.find("pxpz top"), "ux (top)", "ux");
+
+		StyleUtil.setSize(p, 1000, 500);
+		p.show();*/
+		
+
+		IPlotter p;
+		p = af.createPlotterFactory().create();
+		p.region(0).plot((IHistogram1D) tree.find("diff"));
+		StyleUtil.stylize(p.region(0), "pz top - pz bottom (GeV)", "#");
+		p.show();
+		
+		p = af.createPlotterFactory().create();
+		p.createRegions(2, 1);
+		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz bot"), "bot", "uy");
+		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz bot"), "bot", "ux");
+		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz mid"), "mid", "uy");
+		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz mid"), "mid", "ux");
+		plotAndFit(p, 0, (IHistogram1D)tree.find("pypz top"), "top", "uy");
+		plotAndFit(p, 1, (IHistogram1D)tree.find("pxpz top"), "top", "ux");
+		StyleUtil.setSize(p, 1000, 500);
+		p.show();
+		
+	}
+	public static void plotAndFit(IPlotter p, int r, IHistogram1D h, String title, String xAxis){
+		p.region(r).plot(h);
+		h.setTitle(title);
+		StyleUtil.noFillHistogramBars(p.region(r));
+		IFitResult fit = ff.createFitter().fit(h, "g");
+		StyleUtil.stylize(p.region(r), title, xAxis, "#");
+		IFunction func = fit.fittedFunction();
+		System.out.println("\n" + h.title());
+		String names[] = func.parameterNames();
+		double params[] = func.parameters();
+		for(int i = 0; i< names.length; i++){
+			System.out.printf("%s: %f\t", names[i], params[i]);
+		}
+		//System.out.println(Arrays.toString(fit.);
+		
+		p.region(r).plot(func);
+		StyleUtil.stylize(p.region(r), title, xAxis, "#");
+		p.region(r).style().statisticsBoxStyle().setVisible(true);
+		p.region(r).style().legendBoxStyle().setVisible(false);
+		//System.out.println(Arrays.toString(p.region(r).style().statisticsBoxStyle().availableParameters()));
+		//p.show();
+	}
+	
+	
+}

Added: java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java	(added)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltAnalysis.java	Sun Feb  7 20:22:03 2016
@@ -0,0 +1,314 @@
+package org.hps.users.spaul.moller;
+
+import java.util.List;
+
+import hep.aida.IHistogram1D;
+import hep.aida.IHistogram2D;
+import hep.aida.IPlotter;
+import hep.aida.IProfile1D;
+
+import org.hps.recon.tracking.TrackType;
+import org.hps.users.spaul.StyleUtil;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.Vertex;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+public class MollerBeamtiltAnalysis extends Driver{
+	@Override
+	public void process(EventHeader event){
+		List<Vertex> mollers = event.get(Vertex.class, "TargetConstrainedMollerVertices");
+		for(Vertex v : mollers){
+			if(!passesCuts(v))
+				continue;
+			ReconstructedParticle m = v.getAssociatedParticle();
+			ReconstructedParticle top;
+			ReconstructedParticle bottom;
+			if(m.getParticles().get(0).getMomentum().y()>0){
+				top = m.getParticles().get(0);
+				bottom = m.getParticles().get(1);
+			}else{
+				top = m.getParticles().get(1);
+				bottom = m.getParticles().get(0);
+			}
+
+			double pypz = m.getMomentum().y()/m.getMomentum().z();
+			double pxpz = m.getMomentum().x()/m.getMomentum().z();
+			//double pypz = (top.getMomentum().y()+bottom.getMomentum().y())/(top.getMomentum().z()+bottom.getMomentum().z());
+			//double pxpz = (top.getMomentum().x()+bottom.getMomentum().x())/(top.getMomentum().z()+bottom.getMomentum().z());
+
+			hpypz.fill(pypz);
+			hpxpz.fill(pxpz);
+
+
+			double diff = top.getMomentum().z()-bottom.getMomentum().z();
+			double sum = m.getMomentum().z();//top.getMomentum().z()+bottom.getMomentum().z();
+			double mass = m.getMass();
+
+			if(diff > -.05 && diff < .05){
+				hpypz_mid.fill(pypz);
+				hpxpz_mid.fill(pxpz);
+			}
+
+			if(diff > .2 && diff < .3){
+				hpypz_topHighE.fill(pypz);
+				hpxpz_topHighE.fill(pxpz);
+			}
+
+			if(diff > -.3 && diff < -.2){
+				hpypz_botHighE.fill(pypz);
+				hpxpz_botHighE.fill(pxpz);
+			}
+
+
+			this.diff.fill(diff);
+			this.sum.fill(sum);
+			this.mass.fill(mass);
+			pypz_vs_diff.fill(diff,pypz );
+			pxpz_vs_diff.fill(diff, pxpz );
+
+
+
+			pxpz_vs_sum.fill(sum, pxpz );
+			pypz_vs_sum.fill(sum, pypz );
+
+			pxpz_vs_mass.fill(mass, pxpz );
+			pypz_vs_mass.fill(mass, pypz );
+			timediff.fill(top.getClusters().get(0).getCalorimeterHits().get(0).getTime()
+					-bottom.getClusters().get(0).getCalorimeterHits().get(0).getTime());
+			/*if(moreEnergetic.getMomentum().y() > 0)
+			{
+				pypz_tophighE.fill(pypz);
+				pxpz_tophighE.fill(pxpz);
+			}
+			if(moreEnergetic.getMomentum().y() < 0)
+			{
+				pypz_bottomhighE.fill(pypz);
+				pxpz_bottomhighE.fill(pxpz);
+			}*/
+		}
+	}
+
+	double _maxVtxChi2 = 15;
+	double _maxTrkChi2 = 30;
+	double _maxMass = .037;
+	double _minMass = .030;
+	double _minPz = 1.0;
+	double _maxPz = 1.1;
+	boolean passesCuts(Vertex vertex){
+		ReconstructedParticle m = vertex.getAssociatedParticle();
+		if(!TrackType.isGBL(m.getType()))
+			return false;
+		if(m.getMomentum().z() > _maxPz || m.getMomentum().z() < _minPz)
+			return false;
+		if(m.getMass() > _maxMass || m.getMass() < _minMass)
+			return false;
+
+		if(m.getParticles().get(0).getCharge() != -1 
+				|| m.getParticles().get(1).getCharge() != -1 )
+			return false;
+
+		if(vertex.getChi2() > _maxVtxChi2)
+			return false;
+
+
+		if(m.getParticles().get(0).getClusters().size() == 0)
+			return false;
+		if(m.getParticles().get(1).getClusters().size() == 0)
+			return false;
+
+		if(m.getParticles().get(0).getTracks().get(0).getChi2() > _maxTrkChi2)
+			return false;
+		if(m.getParticles().get(1).getTracks().get(0).getChi2() > _maxTrkChi2)
+			return false;
+		return true;
+	}
+
+	IHistogram1D hpypz, hpxpz, diff, sum, mass,
+	hpypz_topHighE, hpxpz_topHighE,
+	hpypz_botHighE, hpxpz_botHighE,
+	hpypz_mid, hpxpz_mid;
+
+	boolean display = false;
+
+
+
+
+	public double getMaxVtxChi2() {
+		return _maxVtxChi2;
+	}
+
+
+	public void setMaxVtxChi2(double _maxVtxChi2) {
+		this._maxVtxChi2 = _maxVtxChi2;
+	}
+
+
+	public double getMaxTrkChi2() {
+		return _maxTrkChi2;
+	}
+
+
+	public void setMaxTrkChi2(double _maxTrkChi2) {
+		this._maxTrkChi2 = _maxTrkChi2;
+	}
+
+
+	public double getMaxMass() {
+		return _maxMass;
+	}
+
+
+	public void setMaxMass(double _maxMass) {
+		this._maxMass = _maxMass;
+	}
+
+
+	public double getMinMass() {
+		return _minMass;
+	}
+
+
+	public void setMinMass(double _minMass) {
+		this._minMass = _minMass;
+	}
+
+
+	public double getMinPz() {
+		return _minPz;
+	}
+
+
+	public void setMinPz(double _minPz) {
+		this._minPz = _minPz;
+	}
+
+
+	public double getMaxPz() {
+		return _maxPz;
+	}
+
+
+	public void setMaxPz(double _maxPz) {
+		this._maxPz = _maxPz;
+	}
+
+
+	public boolean getDisplay() {
+		return display;
+	}
+
+
+	public void setDisplay(boolean display) {
+		this.display = display;
+	}
+
+	IHistogram1D vtx_x, vtx_y, timediff;
+
+	IProfile1D pxpz_vs_diff, pypz_vs_diff, pxpz_vs_sum, pypz_vs_sum,
+	pxpz_vs_mass, pypz_vs_mass;
+
+
+	//IHistogram1D pypz_tophighE, pxpz_tophighE;
+	//IHistogram1D pypz_bottomhighE, pxpz_bottomhighE;
+	@Override
+	public void startOfData(){
+		AIDA aida = AIDA.defaultInstance();
+		hpypz = aida.histogram1D("pypz", 60, -.005,.005);
+		hpxpz = aida.histogram1D("pxpz", 60, .025,.035);
+
+
+		hpypz_mid = aida.histogram1D("pypz mid", 60, -.005,.005);
+		hpxpz_mid = aida.histogram1D("pxpz mid", 60, .025,.035);
+
+		hpypz_topHighE = aida.histogram1D("pypz top", 30, -.005,.005);
+		hpxpz_topHighE = aida.histogram1D("pxpz top", 30, .025,.035);
+
+		hpypz_botHighE = aida.histogram1D("pypz bot", 30, -.005,.005);
+		hpxpz_botHighE = aida.histogram1D("pxpz bot", 30, .025,.035);
+
+
+		pxpz_vs_diff = aida.profile1D("pxpz vs diff", 25, -.60, .60);
+		pypz_vs_diff = aida.profile1D("pypz vs diff", 25, -.60, .60);
+
+		diff = aida.histogram1D("diff", 50, -.60, .60);
+
+		sum = aida.histogram1D("sum", 50, 1.0, 1.1);
+
+		pxpz_vs_sum = aida.profile1D("pxpz vs sum", 25, 1.0, 1.1);
+		pypz_vs_sum = aida.profile1D("pypz vs sum", 25, 1.0, 1.1);
+
+		pxpz_vs_mass = aida.profile1D("pxpz vs mass", 25, .03, .037);
+		pypz_vs_mass = aida.profile1D("pypz vs mass", 25, .03, .037);
+
+		//vtx_x = aida.histogram1D("vtx x", 60, -1, 1);
+		//vtx_y = aida.histogram1D("vtx y", 60, -1, 1);
+		mass = aida.histogram1D("mass", 60, .030, .037);
+		timediff = aida.histogram1D("time diff", 60, -6, 6);
+
+
+		/*pypz_tophighE = aida.histogram1D("topHighE pypz", 60, -.005,.005);
+		pxpz_tophighE = aida.histogram1D("topHighE pxpz", 60,  .025,.035);
+		pypz_bottomhighE = aida.histogram1D("bottomHighE pypz", 60, -.005,.005);
+		pxpz_bottomhighE = aida.histogram1D("bottomHighE pxpz", 60, .025,.035);*/
+		if(display){
+			IPlotter p = aida.analysisFactory().createPlotterFactory().create();
+			StyleUtil.setSize(p, 1300, 900);
+			//p.createRegions(3, 2);
+			p.createRegions(4, 3);
+
+			p.region(0).plot(hpypz);
+			p.region(1).plot(hpxpz);
+			p.region(2).plot(timediff);
+			p.region(3).plot(pypz_vs_diff);
+			p.region(4).plot(pxpz_vs_diff);
+			p.region(5).plot(diff);
+			p.region(6).plot(pypz_vs_sum);
+			p.region(7).plot(pxpz_vs_sum);
+			p.region(8).plot(sum);
+
+			p.region(9).plot(pypz_vs_mass);
+			p.region(10).plot(pxpz_vs_mass);
+			p.region(11).plot(mass);
+			/*p.region(2).plot(pypz_tophighE);
+		p.region(3).plot(pxpz_tophighE);
+		p.region(4).plot(pypz_bottomhighE);
+		p.region(5).plot(pxpz_bottomhighE);*/
+			StyleUtil.stylize(p.region(0),"py/pz", "py/pz", "#");
+			StyleUtil.stylize(p.region(1),"px/pz", "px/pz", "#");
+			StyleUtil.stylize(p.region(2),"time diff (t-b)", "diff (ns)", "#");
+			StyleUtil.stylize(p.region(3),"py/pz vs diff", "diff (GeV)", "py/pz");
+			StyleUtil.stylize(p.region(4),"px/pz vs diff", "diff (GeV)", "px/pz");
+			StyleUtil.stylize(p.region(5),"diff", "diff (GeV)", "#");
+
+			StyleUtil.stylize(p.region(6),"py/pz vs sum", "sum (GeV)", "py/pz");
+			StyleUtil.stylize(p.region(7),"px/pz vs sum", "sum (GeV)", "px/pz");
+			StyleUtil.stylize(p.region(8),"sum", "sum (GeV)", "#");
+
+			StyleUtil.stylize(p.region(9),"py/pz vs mass", "mass (GeV)", "py/pz");
+			StyleUtil.stylize(p.region(10),"px/pz vs mass", "mass (GeV)", "px/pz");
+			StyleUtil.stylize(p.region(11),"mass", "mass (GeV)", "#");
+
+			p.show();
+
+			IPlotter p2 = aida.analysisFactory().createPlotterFactory().create();
+
+			p2.createRegions(2, 1);
+
+
+			p2.region(0).plot(hpypz_botHighE);
+			p2.region(1).plot(hpxpz_botHighE);
+			p2.region(0).plot(hpypz_mid);
+			p2.region(1).plot(hpxpz_mid);
+			p2.region(0).plot(hpypz_topHighE);
+			p2.region(1).plot(hpxpz_topHighE);
+
+			StyleUtil.stylize(p2.region(0),"py/pz", "py/pz", "#");
+			StyleUtil.stylize(p2.region(1),"px/pz", "py/pz", "#");
+			StyleUtil.noFillHistogramBars(p2.region(0));
+			StyleUtil.noFillHistogramBars(p2.region(1));
+			p2.show();
+		}
+	}
+}

Added: java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java	(added)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerBeamtiltFitter.java	Sun Feb  7 20:22:03 2016
@@ -0,0 +1,65 @@
+package org.hps.users.spaul.moller;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IFitFactory;
+import hep.aida.IFitResult;
+import hep.aida.IFunction;
+import hep.aida.IHistogram1D;
+import hep.aida.IPlotter;
+import hep.aida.IPlotterFactory;
+import hep.aida.IPlotterStyle;
+import hep.aida.ITree;
+
+import java.io.IOException;
+
+import org.hps.users.spaul.StyleUtil;
+
+public class MollerBeamtiltFitter {
+	static IAnalysisFactory af = IAnalysisFactory.create();
+	static IFitFactory ff = af.createFitFactory();
+	static IPlotterFactory pf = af.createPlotterFactory();
+	
+	public static void main(String arg[]) throws IllegalArgumentException, IOException{
+		
+		ITree tree = af.createTreeFactory().create(arg[0]); 
+		
+
+		IPlotter p;
+		
+		p = pf.create();
+		p.createRegions(2, 1);
+
+		plotAndFit(p, 0, (IHistogram1D)tree.find("pxpz"), "ux", "ux");
+		plotAndFit(p, 1, (IHistogram1D)tree.find("pypz"), "uy", "uy");
+		StyleUtil.setSize(p, 1000, 500);
+		p.show();
+		
+	}
+	public static void plotAndFit(IPlotter p, int r, IHistogram1D h, String title, String xAxis){
+		p.region(r).plot(h);
+		h.setTitle(title);
+		
+		double xmin = h.mean()-2*h.rms();
+		double xmax = h.mean()+2*h.rms();
+		String range = String.format("range=\"(%f,%f)\"", xmin, xmax);
+		//range = "";
+		IFitResult fit = ff.createFitter().fit(h, "g", range);
+		IFunction func = fit.fittedFunction();
+		System.out.println("\n" + h.title());
+		String names[] = func.parameterNames();
+		double params[] = func.parameters();
+		for(int i = 0; i< names.length; i++){
+			System.out.printf("%s: %f\t", names[i], params[i]);
+		}
+		//System.out.println(Arrays.toString(fit.);
+		IPlotterStyle style = p.region(r).style();
+		style.dataStyle().outlineStyle().setColor("blue");
+		p.region(r).plot(func, style);
+		StyleUtil.noFillHistogramBars(p.region(r));
+		StyleUtil.stylize(p.region(r), title, xAxis, "#");
+		p.region(r).style().statisticsBoxStyle().setVisible(true);
+		p.region(r).style().legendBoxStyle().setVisible(false);
+		//System.out.println(Arrays.toString(p.region(r).style().statisticsBoxStyle().availableParameters()));
+		//p.show();
+	}
+}

Added: java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java
 =============================================================================
--- java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java	(added)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/moller/MollerStdhepTest.java	Sun Feb  7 20:22:03 2016
@@ -0,0 +1,15 @@
+package org.hps.users.spaul.moller;
+
+import java.io.IOException;
+
+import hep.io.mcfio.MCFIOEvent;
+import hep.io.stdhep.StdhepReader;
+import hep.io.stdhep.StdhepRecord;
+
+public class MollerStdhepTest 
+{
+	public static void main(String arg[]) throws IOException
+	{
+		
+	}
+}

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use