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  January 2016

HPS-SVN January 2016

Subject:

r4077 - /java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java

From:

[log in to unmask]

Reply-To:

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

Date:

Sun, 3 Jan 2016 18:49:54 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (194 lines)

Author: [log in to unmask]
Date: Sun Jan  3 10:49:49 2016
New Revision: 4077

Log: (empty)

Added:
    java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java

Added: 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	(added)
+++ java/trunk/users/src/main/java/org/hps/users/spaul/feecc/ExtractFormFactors.java	Sun Jan  3 10:49:49 2016
@@ -0,0 +1,179 @@
+package org.hps.users.spaul.feecc;
+
+import hep.aida.*;
+
+
+import java.io.File;
+import java.io.IOException;
+
+import org.hps.users.spaul.StyleUtil;
+
+//arg[0] should point to the sums directory,
+// with files that are named runnum.aida and one file total.aida
+//arg[1] is the binning scheme file.  
+//arg[2] is the luminosity (corrected for prescaling, blinding etc.) in barns^-1
+//arg[3] is the scale factor for the mott scattering (Z^2*alpha^2)/(4*E^2) in barns
+//arg[4] is recoil parameter (2E/M) in Mott scattering
+//arg[5] is the radius (in fm) for calculating predicted form factors
+
+public class ExtractFormFactors {
+	static double Na = 6.022e23;
+	static double hbarc = .1973269788;
+	static double alpha = 1/137.;
+	static double q = 1.602e-19;
+	static double amu = .931454;
+	public static void main(String arg[]) throws IllegalArgumentException, IOException{
+		IAnalysisFactory af = IAnalysisFactory.create();
+		ITreeFactory tf = af.createTreeFactory();
+
+		String[] inpaths = new String[]{"theta", "theta top", "theta bottom"};
+		String[] outpaths = new String[]{"form factors", "top only", "bottom only"};
+		
+		for(int config = 0; config < 3; config ++){
+			ITree treeNew = af.createTreeFactory().create();
+
+
+
+			IDataPointSetFactory dpsf = af.createDataPointSetFactory(treeNew);
+
+			IPlotter p = af.createPlotterFactory().create(outpaths[config]);
+
+
+			int Nsets = arg.length/10;
+			dpsMeasured = new IDataPointSet[Nsets];
+
+			for(int set = 0; set< Nsets; set++){
+				String title = arg[0+10*set];
+				String inputFile = arg[1+10*set];
+				CustomBinning cb = new CustomBinning(new File(arg[2+10*set]));
+
+
+				double Q = Double.parseDouble(arg[3+10*set]); //in nC
+				double E = Double.parseDouble(arg[4+10*set]); //in GeV
+				double aDensity = Double.parseDouble(arg[5+10*set]); //in g/cm^2
+				double M = Double.parseDouble(arg[6+10*set]); // in amu
+				double Z = Double.parseDouble(arg[7+10*set]); 
+				double r = Double.parseDouble(arg[8+10*set]);
+				double prescale = Math.pow(2,Double.parseDouble(arg[9+10*set]));
+
+				double luminosity = Q*1e-9/q*aDensity/(M/Na)*1e-24;  //nuclei per barn times # of beam electrons
+				
+				double scale = Math.pow((Z*alpha*hbarc)/(2*E), 2)/100; //this should be in barns
+				
+				if(config != 0) //one half of the detector only
+					scale /= 2;  
+				double recoil = 2*E/(M*amu);
+
+
+				//double luminosity = Double.parseDouble(arg[2]);
+				//double scale = Double.parseDouble(arg[3]);
+				//double recoil = Double.parseDouble(arg[4]);
+				//double r = Double.parseDouble(arg[5]);
+
+				ITree tree0 = tf.create(inputFile, "xml");
+				//IHistogram1D hist_iso = (IHistogram1D) tree0.find("theta isolated ");
+				IHistogram1D hist = (IHistogram1D) tree0.find(inpaths[config]);
+				System.out.println(inpaths[config] + " " + title + " " + hist.binHeight(0));
+
+				dpsMeasured[set] = dpsf.create(title, 2);
+				//IDataPointSet dps_iso = dpsf.create("F(Q)^2 (measured isolated)", 2);
+
+				if(set == 0)
+					dpsTheory = dpsf.create("theoretical", 2);
+
+				int nBins = hist.axis().bins();
+
+				for(int i = 0; i< nBins; i++){
+					double thmax = cb.thetaMax[i];
+					double thmin = cb.thetaMin[i];
+					double n = hist.binHeight(i);
+					//double n_iso = hist_iso.binHeight(i);
+
+					//scale = Math.pow(74/137.*.2/(2*1.057), 2);
+					double mottInt = MottIntegral.mottIntegral(recoil, scale, i, cb);
+					double F2 =n*prescale/luminosity/mottInt;
+					double dF2 = Math.sqrt(n)*prescale/luminosity/mottInt;
+
+					//double F2_iso =n_iso*prescale/luminosity/mottInt;
+					//double dF2_iso = Math.sqrt(n_iso)*prescale/luminosity/mottInt;
+
+
+					IDataPoint dp = dpsMeasured[set].addPoint();
+
+					double trigStuff = Math.pow(Math.sin((thmax+thmin)/4),2);
+					double Q2 = 4*E*E*trigStuff/(1+recoil*trigStuff);
+					double dQ2 = E*E*(thmax+thmin)*(thmax-thmin)*2;
+					dp.coordinate(0).setValue(Q2);
+					dp.coordinate(0).setErrorMinus(dQ2);
+					dp.coordinate(0).setErrorPlus(dQ2);
+					dp.coordinate(1).setValue(F2);
+					dp.coordinate(1).setErrorMinus(dF2);
+					dp.coordinate(1).setErrorPlus(dF2);
+
+					/*dp = dps_iso.addPoint();
+				dp.coordinate(0).setValue(Q2);
+				dp.coordinate(0).setErrorMinus(dQ2);
+				dp.coordinate(0).setErrorPlus(dQ2);
+				dp.coordinate(1).setValue(F2_iso);
+				dp.coordinate(1).setErrorMinus(dF2_iso);
+				dp.coordinate(1).setErrorPlus(dF2_iso);
+					 */
+					double F_calc = 0;
+					if(Z == 74){
+						//double R = 5.373; 
+						double R = 6.87;
+						F_calc = F_calc(Q2, R);
+					} else if(Z== 6){
+						double rp = 0.8786;
+						double a = 1.64;
+						F_calc = F_calc_alt(Q2, 6,a, Math.sqrt(a*a*(1-1/12.)+rp*rp) );
+					}
+
+					if(set == 0){
+						dp = dpsTheory.addPoint();
+						dp.coordinate(0).setValue(Q2);
+						//double F_calc = 1-r*r*Q2/(6*hbarc*hbarc);
+						dp.coordinate(1).setValue(F_calc*F_calc);
+						dp.coordinate(1).setErrorMinus(0);
+						dp.coordinate(1).setErrorPlus(0);
+
+					}
+					//System.out.println(i + "\t" + thmin+ "\t" + thmax + "\t"+ F_calc*F_calc + "\t" + F2 + "\t" + dF2);
+
+
+
+
+
+
+
+				}
+
+				p.region(0).plot(dpsMeasured[set]);
+
+				//p.region(0).plot(dps_iso);
+			}
+			p.region(0).plot(dpsTheory);
+			StyleUtil.stylize(p.region(0), "Form Factors", "Q^2 (GeV^2)", "|F(Q^2)|^2");
+			p.show();
+		}
+
+	}
+	static IDataPointSet dpsMeasured[];
+	static IDataPointSet dpsTheory;
+
+	static double F_calc(double Q2, double r){
+		double x = Math.sqrt(Q2*r*r/(hbarc*hbarc));
+		double F_calc = 3/(x*x*x)*(Math.sin(x)-x*Math.cos(x));
+		return F_calc;
+	}
+
+	static double F_calc_alt(double Q2, double Z, double a, double b){
+		return (1-(Z-2)/(6*Z)*a*a*Q2/(hbarc*hbarc))*Math.exp(-1/4.*b*b*Q2/(hbarc*hbarc));
+	}
+
+
+	void temp_test(){
+		
+	}
+
+}

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