5 modified files
lcsim/src/org/lcsim/contrib/SODTracker
diff -u -r1.1 -r1.2
--- SODHit.java 10 Mar 2006 21:21:34 -0000 1.1
+++ SODHit.java 12 Jul 2006 18:15:55 -0000 1.2
@@ -1,228 +1,228 @@
-package org.lcsim.contrib.SODTracker;
-
-import org.lcsim.event.TrackerHit;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.MCParticle;
-import org.lcsim.util.step.TrkParams;
-import java.util.*;
-
-public class SODHit
-{
- public SODHit()
- {
- _used_on_hel=-1;
- _resid=-10000.0;
- _is_foreground_hit=false;
- }
-// public SODHit(TrackerHit h)
- public void make_hit(TrackerHit h)
- {
- _used_on_hel=0;
- _is_foreground_hit=true;
-//jas2 double[] hitpos = h.getPoint();
- double[] hitpos = h.getPosition();
- _hitx = hitpos[0];
- _hity = hitpos[1];
- _hitrad = Math.sqrt(_hitx*_hitx+_hity*_hity);
- _hitlay=0;
-// if _hitlay=0 it's not a SODHIT and other data may be invalid,
-// SO CHECK ON IT!!!
- if ((_hitrad>20.00)&&(_hitrad<20.10))_hitlay=1;
- if ((_hitrad>46.25)&&(_hitrad<46.35))_hitlay=2;
- if ((_hitrad>72.50)&&(_hitrad<72.60))_hitlay=3;
- if ((_hitrad>98.75)&&(_hitrad<98.85))_hitlay=4;
- if ((_hitrad>125.0)&&(_hitrad<125.1))_hitlay=5;
-// not really true right now (let sit hits be SODHit's also and
-// protect "elsewhere")
- if ((_hitrad>1.15)&&(_hitrad<1.25))_hitlay=1;
- if ((_hitrad>2.35)&&(_hitrad<2.45))_hitlay=2;
- if ((_hitrad>3.55)&&(_hitrad<3.65))_hitlay=3;
- if ((_hitrad>4.75)&&(_hitrad<4.85))_hitlay=4;
- if ((_hitrad>5.95)&&(_hitrad<6.05))_hitlay=5;
- _hitphi = Math.atan2(_hity,_hitx);
-// System.out.print("drawmetrk ");System.out.print(_hitx);
-// System.out.print(" ");System.out.println(_hity);
-// TrackerHit _savehit = h;
- }
- public void make_hit(int lay, double xin, double yin, double rgauss, SimTrackerHit trackerHit, MCParticle mcp)
- {
- _used_on_hel=0;
- _is_foreground_hit=true;
- _hitx = xin*mmtocm;
- _hity = yin*mmtocm;
- _hitrad = Math.sqrt(_hitx*_hitx+_hity*_hity);
- _hitlay=lay+1;
- _hitphi = Math.atan2(_hity,_hitx);
- double myres = sodres; if (_hitrad<10.0){myres = vtxres;}
- _hitx-=rgauss*myres*Math.sin(_hitphi);
- _hity+=rgauss*myres*Math.cos(_hitphi);
- _hitphi = Math.atan2(_hity,_hitx);
- _trackerHit = trackerHit;
- _mcParticle = mcp;
- }
- public void make_hit(int lay, double xin, double yin, double rgauss, SimTrackerHit trackerHit)
- {
- _used_on_hel=0;
- _is_foreground_hit=true;
- _hitx = xin*mmtocm;
- _hity = yin*mmtocm;
- _hitrad = Math.sqrt(_hitx*_hitx+_hity*_hity);
- _hitlay=lay+1;
- _hitphi = Math.atan2(_hity,_hitx);
- double myres = sodres; if (_hitrad<10.0){myres = vtxres;}
- _hitx-=rgauss*myres*Math.sin(_hitphi);
- _hity+=rgauss*myres*Math.cos(_hitphi);
- _hitphi = Math.atan2(_hity,_hitx);
- _trackerHit = trackerHit;
- }
- public void make_hit(double xrad, double xphi)
- {
- _used_on_hel=0;
- _is_foreground_hit=false;
- _hitx = xrad*Math.cos(xphi);
- _hity = xrad*Math.sin(xphi);
- _hitrad = xrad;
- _hitlay=0;
-// if _hitlay=0 it's not a SODHIT and other data may be invalid,
-// SO CHECK ON IT!!!
- if ((_hitrad>20.00)&&(_hitrad<20.10))_hitlay=1;
- if ((_hitrad>46.25)&&(_hitrad<46.35))_hitlay=2;
- if ((_hitrad>72.50)&&(_hitrad<72.60))_hitlay=3;
- if ((_hitrad>98.75)&&(_hitrad<98.85))_hitlay=4;
- if ((_hitrad>125.0)&&(_hitrad<125.1))_hitlay=5;
- _hitphi = xphi;
-// System.out.print("drawmebg ");System.out.print(_hitx);
-// System.out.print(" ");System.out.println(_hity);
-// TrackerHit _savehit = h;
- }
- public int GetUsedOnHel(){return _used_on_hel;}
- public void SetUsedOnHel(int i){_used_on_hel=i;}
- public int layer(){return _hitlay;}
- public double x(){return _hitx;}
- public double y(){return _hity;}
- public double r(){return _hitrad;}
- public double phi(){return _hitphi;}
-// the following only make sense after calc_resid (test on true)
- public double get_resid(){return _resid;}
- public boolean calc_circ_derivatives(SODHel t, double [] derivs)
- {
-// calc_resid(t); derivs[0]= get_resid()/e();
- t.calc_circ_derivatives(_hitrad,_hitphi,derivs);
- double estrip=e();
-// c++ for(int i=0; i<derivs.length(); i++) {derivs[i]/=estrip;}
- for(int i=0; i<4; i++) {derivs[i]/=estrip;}
-// derivs[0]= derivs[0]/e();
- return true;
- }
- public boolean calc_numb_derivatives(SODHel t, double [] derivs)
- {
- calc_resid(t); double resid_base=get_resid(); double error=e();
- derivs[0]=resid_base/error; double delta=0.0001;
- SODHel new_hel=new SODHel();
- new_hel.make_hel(t.D0()+delta,t.Phi0(),t.Omega(),t.Z0(),t.Tanl());
- calc_resid(new_hel);derivs[1]=(get_resid()-resid_base)/(delta*error);
- new_hel.make_hel(t.D0(),t.Phi0()+delta,t.Omega(),t.Z0(),t.Tanl());
- calc_resid(new_hel);derivs[2]=(get_resid()-resid_base)/(delta*error);
- delta=0.01*t.Omega();
- new_hel.make_hel(t.D0(),t.Phi0(),t.Omega()+delta,t.Z0(),t.Tanl());
- calc_resid(new_hel);derivs[3]=(get_resid()-resid_base)/(delta*error);
- return true;
- }
- public boolean calc_resid(SODHel t)
- {
- double phi1 = t.phi1_at_radius(_hitrad);
- double dphi=_hitphi-phi1;
- if(dphi<-pi)dphi+=twopi;if(dphi>pi)dphi-=twopi;
- _resid=dphi*_hitrad;
- int prtflg=0;
- if (prtflg!=0){
- System.out.print("hittup ");System.out.print(_hitlay);
- System.out.print(" ");System.out.print(_hitrad);
- System.out.print(" ");System.out.print(_resid);
- System.out.print(" ");System.out.print(t.D0());
- System.out.print(" ");System.out.print(t.Phi0());
- System.out.print(" ");System.out.println(t.Omega());
- }//end printing
- return true;
- }
- public boolean calc_resid(TrkParams t)
- {
- double phi1 = phi1_at_radius(t,_hitrad);
- double dphi=_hitphi-phi1;
- if(dphi<-pi)dphi+=twopi;if(dphi>pi)dphi-=twopi;
- _resid=dphi*_hitrad;
- int prtflg=0;
- if (prtflg!=0){
- System.out.print("hittup ");System.out.print(_hitlay);
- System.out.print(" ");System.out.print(_hitrad);
- System.out.print(" ");System.out.print(_resid);
- System.out.print(" ");System.out.print(t.getParam(0));
- System.out.print(" ");System.out.print(t.getParam(1));
- System.out.print(" ");System.out.println(t.getParam(2));
- }//end printing
- return true;
- }
- public double phi1_at_radius(TrkParams t, double rl)
- {
- double d0=t.getParam(0);
- double phi0=t.getParam(1);
- double omega=t.getParam(2);
- double orcsq=(1.0+d0*omega)*(1.0+d0*omega);
- double orlsq=(rl*omega)*(rl*omega);
- double cphil=(1.0+orcsq-orlsq)/(2.0*(1.0+d0*omega));
- double phil1=Math.acos(cphil);
- double l1=phil1/omega; if (l1<0.0)l1=-1.0*l1;
- double sp0=Math.sin(phi0); double cp0=Math.cos(phi0);
- double xc=-sp0*(d0+1.0/omega);
- double yc=cp0*(d0+1.0/omega);
- double phit=phi0+phil1; if (omega<0.0)phit=phi0-phil1;
- double xh=xc+Math.sin(phit)/omega;
- double yh=yc-Math.cos(phit)/omega;
- double rh=Math.sqrt(xh*xh+yh*yh);
- double phih=Math.atan2(yh,xh);
- return phih;
- }
- public double e(double pt){
- double res = -0.00040625*pt+0.0208125;
- if ((pt<2.0)&&(_hitlay==1))res=-0.01*pt+0.04;
- if ((pt<2.0)&&(_hitlay==5))res=-0.18*pt+0.38;
- if ((res<0.0130)&&(_hitlay==1))res=0.0130;
- if ((res<0.0141)&&(_hitlay==5))res=0.0141;
- return res;
- }
- public double e(){
-//fundamental res double res = 0.0007;
-// double res = 0.0140;
-//used for slac workshop double res = 0.0060;
-//
-//c for now change resolution by hand in SODHit e()
-//c to compensate for MS
-//
-// double res = 0.0020; //new012904 for 50 GeV 10 hits
-// double res = 0.0100; //new020204 for 1 GeV 10 hits
-// double res = 0.0040; //new081905 for 2 GeV 10 hits
-// double res = 0.0024; //new081905 for 5 GeV 10 hits
-// double res = 0.0021; //new081905 for 10 GeV 10 hits
-// double res = 0.0010; //new011006 for 20, 50, 100 GeV 10 hits
- double res = sodres; if (_hitrad<10.0){res = vtxres;}
- return res;
- }
- public boolean IsForegroundHit(){return _is_foreground_hit;}
- public MCParticle getMCParticle(){return _mcParticle;}
- public SimTrackerHit getHit(){return _trackerHit;}
- private int _hitlay;
- private double _hitx;
- private double _hity;
- private double _hitrad;
- private double _hitphi;
- private double _resid;
- private boolean _is_foreground_hit;
- public int _used_on_hel;
- private static double pi=3.14159265359;
- private static double twopi=6.283185307;
- private static double mmtocm=0.1;
- private static double vtxres=0.0005;
- private static double sodres=0.0007;
- private SimTrackerHit _trackerHit;
- private MCParticle _mcParticle;
-}
+package org.lcsim.contrib.SODTracker;
+
+import org.lcsim.event.TrackerHit;
+import org.lcsim.event.SimTrackerHit;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.step.TrkParams;
+import java.util.*;
+
+public class SODHit
+{
+ public SODHit()
+ {
+ _used_on_hel=-1;
+ _resid=-10000.0;
+ _is_foreground_hit=false;
+ }
+// public SODHit(TrackerHit h)
+ public void make_hit(TrackerHit h)
+ {
+ _used_on_hel=0;
+ _is_foreground_hit=true;
+//jas2 double[] hitpos = h.getPoint();
+ double[] hitpos = h.getPosition();
+ _hitx = hitpos[0];
+ _hity = hitpos[1];
+ _hitrad = Math.sqrt(_hitx*_hitx+_hity*_hity);
+ _hitlay=0;
+// if _hitlay=0 it's not a SODHIT and other data may be invalid,
+// SO CHECK ON IT!!!
+ if ((_hitrad>20.00)&&(_hitrad<20.10))_hitlay=1;
+ if ((_hitrad>46.25)&&(_hitrad<46.35))_hitlay=2;
+ if ((_hitrad>72.50)&&(_hitrad<72.60))_hitlay=3;
+ if ((_hitrad>98.75)&&(_hitrad<98.85))_hitlay=4;
+ if ((_hitrad>125.0)&&(_hitrad<125.1))_hitlay=5;
+// not really true right now (let sit hits be SODHit's also and
+// protect "elsewhere")
+ if ((_hitrad>1.15)&&(_hitrad<1.25))_hitlay=1;
+ if ((_hitrad>2.35)&&(_hitrad<2.45))_hitlay=2;
+ if ((_hitrad>3.55)&&(_hitrad<3.65))_hitlay=3;
+ if ((_hitrad>4.75)&&(_hitrad<4.85))_hitlay=4;
+ if ((_hitrad>5.95)&&(_hitrad<6.05))_hitlay=5;
+ _hitphi = Math.atan2(_hity,_hitx);
+// System.out.print("drawmetrk ");System.out.print(_hitx);
+// System.out.print(" ");System.out.println(_hity);
+// TrackerHit _savehit = h;
+ }
+ public void make_hit(int lay, double xin, double yin, double rgauss, SimTrackerHit trackerHit, MCParticle mcp)
+ {
+ _used_on_hel=0;
+ _is_foreground_hit=true;
+ _hitx = xin*mmtocm;
+ _hity = yin*mmtocm;
+ _hitrad = Math.sqrt(_hitx*_hitx+_hity*_hity);
+ _hitlay=lay+1;
+ _hitphi = Math.atan2(_hity,_hitx);
+ double myres = sodres; if (_hitrad<10.0){myres = vtxres;}
+ _hitx-=rgauss*myres*Math.sin(_hitphi);
+ _hity+=rgauss*myres*Math.cos(_hitphi);
+ _hitphi = Math.atan2(_hity,_hitx);
+ _trackerHit = trackerHit;
+ _mcParticle = mcp;
+ }
+ public void make_hit(int lay, double xin, double yin, double rgauss, SimTrackerHit trackerHit)
+ {
+ _used_on_hel=0;
+ _is_foreground_hit=true;
+ _hitx = xin*mmtocm;
+ _hity = yin*mmtocm;
+ _hitrad = Math.sqrt(_hitx*_hitx+_hity*_hity);
+ _hitlay=lay+1;
+ _hitphi = Math.atan2(_hity,_hitx);
+ double myres = sodres; if (_hitrad<10.0){myres = vtxres;}
+ _hitx-=rgauss*myres*Math.sin(_hitphi);
+ _hity+=rgauss*myres*Math.cos(_hitphi);
+ _hitphi = Math.atan2(_hity,_hitx);
+ _trackerHit = trackerHit;
+ }
+ public void make_hit(double xrad, double xphi)
+ {
+ _used_on_hel=0;
+ _is_foreground_hit=false;
+ _hitx = xrad*Math.cos(xphi);
+ _hity = xrad*Math.sin(xphi);
+ _hitrad = xrad;
+ _hitlay=0;
+// if _hitlay=0 it's not a SODHIT and other data may be invalid,
+// SO CHECK ON IT!!!
+ if ((_hitrad>20.00)&&(_hitrad<20.10))_hitlay=1;
+ if ((_hitrad>46.25)&&(_hitrad<46.35))_hitlay=2;
+ if ((_hitrad>72.50)&&(_hitrad<72.60))_hitlay=3;
+ if ((_hitrad>98.75)&&(_hitrad<98.85))_hitlay=4;
+ if ((_hitrad>125.0)&&(_hitrad<125.1))_hitlay=5;
+ _hitphi = xphi;
+// System.out.print("drawmebg ");System.out.print(_hitx);
+// System.out.print(" ");System.out.println(_hity);
+// TrackerHit _savehit = h;
+ }
+ public int GetUsedOnHel(){return _used_on_hel;}
+ public void SetUsedOnHel(int i){_used_on_hel=i;}
+ public int layer(){return _hitlay;}
+ public double x(){return _hitx;}
+ public double y(){return _hity;}
+ public double r(){return _hitrad;}
+ public double phi(){return _hitphi;}
+// the following only make sense after calc_resid (test on true)
+ public double get_resid(){return _resid;}
+ public boolean calc_circ_derivatives(SODHel t, double [] derivs)
+ {
+// calc_resid(t); derivs[0]= get_resid()/e();
+ t.calc_circ_derivatives(_hitrad,_hitphi,derivs);
+ double estrip=e();
+// c++ for(int i=0; i<derivs.length(); i++) {derivs[i]/=estrip;}
+ for(int i=0; i<4; i++) {derivs[i]/=estrip;}
+// derivs[0]= derivs[0]/e();
+ return true;
+ }
+ public boolean calc_numb_derivatives(SODHel t, double [] derivs)
+ {
+ calc_resid(t); double resid_base=get_resid(); double error=e();
+ derivs[0]=resid_base/error; double delta=0.0001;
+ SODHel new_hel=new SODHel();
+ new_hel.make_hel(t.D0()+delta,t.Phi0(),t.Omega(),t.Z0(),t.Tanl());
+ calc_resid(new_hel);derivs[1]=(get_resid()-resid_base)/(delta*error);
+ new_hel.make_hel(t.D0(),t.Phi0()+delta,t.Omega(),t.Z0(),t.Tanl());
+ calc_resid(new_hel);derivs[2]=(get_resid()-resid_base)/(delta*error);
+ delta=0.01*t.Omega();
+ new_hel.make_hel(t.D0(),t.Phi0(),t.Omega()+delta,t.Z0(),t.Tanl());
+ calc_resid(new_hel);derivs[3]=(get_resid()-resid_base)/(delta*error);
+ return true;
+ }
+ public boolean calc_resid(SODHel t)
+ {
+ double phi1 = t.phi1_at_radius(_hitrad);
+ double dphi=_hitphi-phi1;
+ if(dphi<-pi)dphi+=twopi;if(dphi>pi)dphi-=twopi;
+ _resid=dphi*_hitrad;
+ int prtflg=0;
+ if (prtflg!=0){
+ System.out.print("hittup ");System.out.print(_hitlay);
+ System.out.print(" ");System.out.print(_hitrad);
+ System.out.print(" ");System.out.print(_resid);
+ System.out.print(" ");System.out.print(t.D0());
+ System.out.print(" ");System.out.print(t.Phi0());
+ System.out.print(" ");System.out.println(t.Omega());
+ }//end printing
+ return true;
+ }
+ public boolean calc_resid(TrkParams t)
+ {
+ double phi1 = phi1_at_radius(t,_hitrad);
+ double dphi=_hitphi-phi1;
+ if(dphi<-pi)dphi+=twopi;if(dphi>pi)dphi-=twopi;
+ _resid=dphi*_hitrad;
+ int prtflg=0;
+ if (prtflg!=0){
+ System.out.print("hittup ");System.out.print(_hitlay);
+ System.out.print(" ");System.out.print(_hitrad);
+ System.out.print(" ");System.out.print(_resid);
+ System.out.print(" ");System.out.print(t.getParam(0));
+ System.out.print(" ");System.out.print(t.getParam(1));
+ System.out.print(" ");System.out.println(t.getParam(2));
+ }//end printing
+ return true;
+ }
+ public double phi1_at_radius(TrkParams t, double rl)
+ {
+ double d0=t.getParam(0);
+ double phi0=t.getParam(1);
+ double omega=t.getParam(2);
+ double orcsq=(1.0+d0*omega)*(1.0+d0*omega);
+ double orlsq=(rl*omega)*(rl*omega);
+ double cphil=(1.0+orcsq-orlsq)/(2.0*(1.0+d0*omega));
+ double phil1=Math.acos(cphil);
+ double l1=phil1/omega; if (l1<0.0)l1=-1.0*l1;
+ double sp0=Math.sin(phi0); double cp0=Math.cos(phi0);
+ double xc=-sp0*(d0+1.0/omega);
+ double yc=cp0*(d0+1.0/omega);
+ double phit=phi0+phil1; if (omega<0.0)phit=phi0-phil1;
+ double xh=xc+Math.sin(phit)/omega;
+ double yh=yc-Math.cos(phit)/omega;
+ double rh=Math.sqrt(xh*xh+yh*yh);
+ double phih=Math.atan2(yh,xh);
+ return phih;
+ }
+ public double e(double pt){
+ double res = -0.00040625*pt+0.0208125;
+ if ((pt<2.0)&&(_hitlay==1))res=-0.01*pt+0.04;
+ if ((pt<2.0)&&(_hitlay==5))res=-0.18*pt+0.38;
+ if ((res<0.0130)&&(_hitlay==1))res=0.0130;
+ if ((res<0.0141)&&(_hitlay==5))res=0.0141;
+ return res;
+ }
+ public double e(){
+//fundamental res double res = 0.0007;
+// double res = 0.0140;
+//used for slac workshop double res = 0.0060;
+//
+//c for now change resolution by hand in SODHit e()
+//c to compensate for MS
+//
+// double res = 0.0020; //new012904 for 50 GeV 10 hits
+// double res = 0.0100; //new020204 for 1 GeV 10 hits
+// double res = 0.0040; //new081905 for 2 GeV 10 hits
+// double res = 0.0024; //new081905 for 5 GeV 10 hits
+// double res = 0.0021; //new081905 for 10 GeV 10 hits
+// double res = 0.0010; //new011006 for 20, 50, 100 GeV 10 hits
+ double res = sodres; if (_hitrad<10.0){res = vtxres;}
+ return res;
+ }
+ public boolean IsForegroundHit(){return _is_foreground_hit;}
+ public MCParticle getMCParticle(){return _mcParticle;}
+ public SimTrackerHit getHit(){return _trackerHit;}
+ private int _hitlay;
+ private double _hitx;
+ private double _hity;
+ private double _hitrad;
+ private double _hitphi;
+ private double _resid;
+ private boolean _is_foreground_hit;
+ public int _used_on_hel;
+ private static double pi=3.14159265359;
+ private static double twopi=6.283185307;
+ private static double mmtocm=0.1;
+ private static double vtxres=0.0005;
+ private static double sodres=0.0007;
+ private SimTrackerHit _trackerHit;
+ private MCParticle _mcParticle;
+}
lcsim/src/org/lcsim/contrib/SODTracker
diff -u -r1.1 -r1.2
--- SODL1Path.java 10 Mar 2006 21:21:34 -0000 1.1
+++ SODL1Path.java 12 Jul 2006 18:15:55 -0000 1.2
@@ -1,125 +1,125 @@
-package org.lcsim.contrib.SODTracker;
-
-import java.util.*;
-
-public class SODL1Path
-{
- public SODL1Path(int npath, SODFittedCir in_fit,
- java.util.LinkedList l1shlist,
- java.util.LinkedList l2shlist,
- java.util.LinkedList l3shlist,
- java.util.LinkedList l4shlist,
- java.util.LinkedList l5shlist)
- {
- test_fit = new SODFittedCir();
- complete_trk=0;
- int prtflg=0;
- double rmin=10.0;
- test_fit.clone_fitted_cir(in_fit);
-// see if hits in layers 1 5 are with tolerance
- double l1_min_resid=rmin,l2_min_resid=rmin;
- double l3_min_resid=rmin,l4_min_resid=rmin;
- double l5_min_resid=rmin;
- SODHit sh1_min=(SODHit)l1shlist.getFirst();
- SODHit sh2_min=(SODHit)l2shlist.getFirst();
- SODHit sh3_min=(SODHit)l3shlist.getFirst();
- SODHit sh4_min=(SODHit)l4shlist.getFirst();
- SODHit sh5_min=(SODHit)l5shlist.getFirst();
-//layer 1
- int l1_correct_rank=0;
- for (ListIterator ii = l1shlist.listIterator();ii.hasNext();){
- SODHit sh1=(SODHit)ii.next();
- if ((sh1.GetUsedOnHel()==0)&&(sh1.calc_resid(test_fit))){
- double resid= sh1.get_resid() ;
- if ( Math.abs(resid)<Math.abs(l1_min_resid) ){
- l1_min_resid=resid;
- sh1_min=sh1;
- l1_correct_rank++;
- if (sh1.IsForegroundHit())l1_correct_rank=0;
- }
- }
- }
- if ( Math.abs(l1_min_resid)<rmin ){
- test_fit.add_hit_to_fit(sh1_min);
- sh1_min.SetUsedOnHel(npath); //try this
- if(sh1_min.IsForegroundHit())complete_trk+=1;
- }
-//layer 2
- for (ListIterator ii = l2shlist.listIterator();ii.hasNext();){
- SODHit sh2=(SODHit)ii.next();
- if ((sh2.GetUsedOnHel()==0)&&(sh2.calc_resid(test_fit))){
- double resid= sh2.get_resid() ;
- if ( Math.abs(resid)<Math.abs(l2_min_resid) ){l2_min_resid=resid; sh2_min=sh2;}
- }
- }
- if ( Math.abs(l2_min_resid)<rmin ){
- test_fit.add_hit_to_fit(sh2_min);
- if(sh2_min.IsForegroundHit())complete_trk+=2;
- }
-//layer 3
- for (ListIterator ii = l3shlist.listIterator();ii.hasNext();){
- SODHit sh3=(SODHit)ii.next();
- if ((sh3.GetUsedOnHel()==0)&&(sh3.calc_resid(test_fit))){
- double resid= sh3.get_resid() ;
- if ( Math.abs(resid)<Math.abs(l3_min_resid) ){l3_min_resid=resid; sh3_min=sh3;}
- }
- }
- if ( Math.abs(l3_min_resid)<rmin ){
- test_fit.add_hit_to_fit(sh3_min);
- if(sh3_min.IsForegroundHit())complete_trk+=4;
- }
-//layer 4
- for (ListIterator ii = l4shlist.listIterator();ii.hasNext();){
- SODHit sh4=(SODHit)ii.next();
- if ((sh4.GetUsedOnHel()==0)&&(sh4.calc_resid(test_fit))){
- double resid= sh4.get_resid() ;
- if ( Math.abs(resid)<Math.abs(l4_min_resid) ){l4_min_resid=resid; sh4_min=sh4;}
- }
- }
- if ( Math.abs(l4_min_resid)<rmin ){
- test_fit.add_hit_to_fit(sh4_min);
- if(sh4_min.IsForegroundHit())complete_trk+=8;
- }
-//layer 5
- for (ListIterator ii = l5shlist.listIterator();ii.hasNext();){
- SODHit sh5=(SODHit)ii.next();
- if ((sh5.GetUsedOnHel()==0)&&(sh5.calc_resid(test_fit))){
- double resid= sh5.get_resid() ;
- if ( Math.abs(resid)<Math.abs(l5_min_resid) ){l5_min_resid=resid; sh5_min=sh5;}
- }
- }
- if ( Math.abs(l5_min_resid)<rmin ){
- test_fit.add_hit_to_fit(sh5_min);
-//was a bug if(sh3_min.IsForegroundHit())complete_trk+=16;
- if(sh5_min.IsForegroundHit())complete_trk+=16;
- }
-// if trk OK, add it to trk list
-// if (1==npath)System.out.print("SODL1Path11111");
-// if (2==npath)System.out.print("SODL1Path21111");
-// if (3==npath)System.out.print("SODL1Path31111");
-// System.out.print(" ");System.out.print(l1_min_resid);//usually
-// if (1==npath){System.out.print(" ");System.out.print(l1_correct_rank);}
-// System.out.print(" ");System.out.print(l2_min_resid);//usually
-// System.out.print(" ");System.out.print(l3_min_resid);//usually
-// System.out.print(" ");System.out.print(l4_min_resid);//usually
-// System.out.print(" ");System.out.print(l5_min_resid);//usually
-// System.out.print(" ");System.out.print(test_fit.Chisq());
-// System.out.print(" ");System.out.print(test_fit.Nhits());
-// System.out.print(" ");System.out.print(complete_trk);
-// System.out.println(" ");
- }//end ctor from 5 hit lists
- public double Rcs(){
- double rcs=1000000.0; double xhits=(double)test_fit.Nhits();
- if (xhits>3.0){rcs=test_fit.Chisq()/(xhits-3.0);}
- return rcs;
- }
- public double Chisq(){return test_fit.Chisq();}
- public int Nhits(){return test_fit.Nhits();}
- public double Pt(){return test_fit.Pt();}
- public int Complete_trk(){return complete_trk;}
- public SODFittedCir out_fit(){return test_fit;}
- private SODFittedCir test_fit;
- private int complete_trk;
- private static double pi=3.14159265359;
- private static double twopi=6.283185307;
-}
+package org.lcsim.contrib.SODTracker;
+
+import java.util.*;
+
+public class SODL1Path
+{
+ public SODL1Path(int npath, SODFittedCir in_fit,
+ java.util.LinkedList l1shlist,
+ java.util.LinkedList l2shlist,
+ java.util.LinkedList l3shlist,
+ java.util.LinkedList l4shlist,
+ java.util.LinkedList l5shlist)
+ {
+ test_fit = new SODFittedCir();
+ complete_trk=0;
+ int prtflg=0;
+ double rmin=10.0;
+ test_fit.clone_fitted_cir(in_fit);
+// see if hits in layers 1 5 are with tolerance
+ double l1_min_resid=rmin,l2_min_resid=rmin;
+ double l3_min_resid=rmin,l4_min_resid=rmin;
+ double l5_min_resid=rmin;
+ SODHit sh1_min=(SODHit)l1shlist.getFirst();
+ SODHit sh2_min=(SODHit)l2shlist.getFirst();
+ SODHit sh3_min=(SODHit)l3shlist.getFirst();
+ SODHit sh4_min=(SODHit)l4shlist.getFirst();
+ SODHit sh5_min=(SODHit)l5shlist.getFirst();
+//layer 1
+ int l1_correct_rank=0;
+ for (ListIterator ii = l1shlist.listIterator();ii.hasNext();){
+ SODHit sh1=(SODHit)ii.next();
+ if ((sh1.GetUsedOnHel()==0)&&(sh1.calc_resid(test_fit))){
+ double resid= sh1.get_resid() ;
+ if ( Math.abs(resid)<Math.abs(l1_min_resid) ){
+ l1_min_resid=resid;
+ sh1_min=sh1;
+ l1_correct_rank++;
+ if (sh1.IsForegroundHit())l1_correct_rank=0;
+ }
+ }
+ }
+ if ( Math.abs(l1_min_resid)<rmin ){
+ test_fit.add_hit_to_fit(sh1_min);
+ sh1_min.SetUsedOnHel(npath); //try this
+ if(sh1_min.IsForegroundHit())complete_trk+=1;
+ }
+//layer 2
+ for (ListIterator ii = l2shlist.listIterator();ii.hasNext();){
+ SODHit sh2=(SODHit)ii.next();
+ if ((sh2.GetUsedOnHel()==0)&&(sh2.calc_resid(test_fit))){
+ double resid= sh2.get_resid() ;
+ if ( Math.abs(resid)<Math.abs(l2_min_resid) ){l2_min_resid=resid; sh2_min=sh2;}
+ }
+ }
+ if ( Math.abs(l2_min_resid)<rmin ){
+ test_fit.add_hit_to_fit(sh2_min);
+ if(sh2_min.IsForegroundHit())complete_trk+=2;
+ }
+//layer 3
+ for (ListIterator ii = l3shlist.listIterator();ii.hasNext();){
+ SODHit sh3=(SODHit)ii.next();
+ if ((sh3.GetUsedOnHel()==0)&&(sh3.calc_resid(test_fit))){
+ double resid= sh3.get_resid() ;
+ if ( Math.abs(resid)<Math.abs(l3_min_resid) ){l3_min_resid=resid; sh3_min=sh3;}
+ }
+ }
+ if ( Math.abs(l3_min_resid)<rmin ){
+ test_fit.add_hit_to_fit(sh3_min);
+ if(sh3_min.IsForegroundHit())complete_trk+=4;
+ }
+//layer 4
+ for (ListIterator ii = l4shlist.listIterator();ii.hasNext();){
+ SODHit sh4=(SODHit)ii.next();
+ if ((sh4.GetUsedOnHel()==0)&&(sh4.calc_resid(test_fit))){
+ double resid= sh4.get_resid() ;
+ if ( Math.abs(resid)<Math.abs(l4_min_resid) ){l4_min_resid=resid; sh4_min=sh4;}
+ }
+ }
+ if ( Math.abs(l4_min_resid)<rmin ){
+ test_fit.add_hit_to_fit(sh4_min);
+ if(sh4_min.IsForegroundHit())complete_trk+=8;
+ }
+//layer 5
+ for (ListIterator ii = l5shlist.listIterator();ii.hasNext();){
+ SODHit sh5=(SODHit)ii.next();
+ if ((sh5.GetUsedOnHel()==0)&&(sh5.calc_resid(test_fit))){
+ double resid= sh5.get_resid() ;
+ if ( Math.abs(resid)<Math.abs(l5_min_resid) ){l5_min_resid=resid; sh5_min=sh5;}
+ }
+ }
+ if ( Math.abs(l5_min_resid)<rmin ){
+ test_fit.add_hit_to_fit(sh5_min);
+//was a bug if(sh3_min.IsForegroundHit())complete_trk+=16;
+ if(sh5_min.IsForegroundHit())complete_trk+=16;
+ }
+// if trk OK, add it to trk list
+// if (1==npath)System.out.print("SODL1Path11111");
+// if (2==npath)System.out.print("SODL1Path21111");
+// if (3==npath)System.out.print("SODL1Path31111");
+// System.out.print(" ");System.out.print(l1_min_resid);//usually
+// if (1==npath){System.out.print(" ");System.out.print(l1_correct_rank);}
+// System.out.print(" ");System.out.print(l2_min_resid);//usually
+// System.out.print(" ");System.out.print(l3_min_resid);//usually
+// System.out.print(" ");System.out.print(l4_min_resid);//usually
+// System.out.print(" ");System.out.print(l5_min_resid);//usually
+// System.out.print(" ");System.out.print(test_fit.Chisq());
+// System.out.print(" ");System.out.print(test_fit.Nhits());
+// System.out.print(" ");System.out.print(complete_trk);
+// System.out.println(" ");
+ }//end ctor from 5 hit lists
+ public double Rcs(){
+ double rcs=1000000.0; double xhits=(double)test_fit.Nhits();
+ if (xhits>3.0){rcs=test_fit.Chisq()/(xhits-3.0);}
+ return rcs;
+ }
+ public double Chisq(){return test_fit.Chisq();}
+ public int Nhits(){return test_fit.Nhits();}
+ public double Pt(){return test_fit.Pt();}
+ public int Complete_trk(){return complete_trk;}
+ public SODFittedCir out_fit(){return test_fit;}
+ private SODFittedCir test_fit;
+ private int complete_trk;
+ private static double pi=3.14159265359;
+ private static double twopi=6.283185307;
+}
lcsim/src/org/lcsim/contrib/SODTracker
diff -u -r1.1 -r1.2
--- SODNoiseMaker.java 10 Mar 2006 21:21:34 -0000 1.1
+++ SODNoiseMaker.java 12 Jul 2006 18:15:55 -0000 1.2
@@ -1,34 +1,35 @@
-package org.lcsim.contrib.SODTracker;
-
-import java.util.*;
-import java.io.*;
-public class SODNoiseMaker{
- public SODNoiseMaker(java.util.LinkedList l1list, java.util.LinkedList l2list,
- java.util.LinkedList l3list, java.util.LinkedList l4list, java.util.LinkedList l5list) {
- double rl1=20.05,rl2=46.30,rl3=72.55,rl4=98.80,rl5=125.05;
- //split sod
- int nl1=106,nl2=91,nl3=92,nl4=98,nl5=109;
- //tiled sod int nl1=36,nl2=5,nl3=1,nl4=0,nl5=1;
- boolean success;
- for(int i=0; i<nl1; i++) {
- double myphi = Math.random()*Math.PI*2.0;
- SODHit sh1=new SODHit(); sh1.make_hit(rl1,myphi); success=l1list.add(sh1);
- }
- for(int i=0; i<nl2; i++) {
- double myphi = Math.random()*Math.PI*2.0;
- SODHit sh2=new SODHit(); sh2.make_hit(rl2,myphi); success=l2list.add(sh2);
- }
- for(int i=0; i<nl3; i++) {
- double myphi = Math.random()*Math.PI*2.0;
- SODHit sh3=new SODHit(); sh3.make_hit(rl3,myphi); success=l3list.add(sh3);
- }
- for(int i=0; i<nl4; i++) {
- double myphi = Math.random()*Math.PI*2.0;
- SODHit sh4=new SODHit(); sh4.make_hit(rl4,myphi); success=l4list.add(sh4);
- }
- for(int i=0; i<nl5; i++) {
- double myphi = Math.random()*Math.PI*2.0;
- SODHit sh5=new SODHit(); sh5.make_hit(rl5,myphi); success=l5list.add(sh5);
- }
- }
-}
+package org.lcsim.contrib.SODTracker;
+
+import java.util.*;
+import java.io.*;
+public class SODNoiseMaker{
+ public SODNoiseMaker(java.util.LinkedList l1list, java.util.LinkedList l2list,
+ java.util.LinkedList l3list, java.util.LinkedList l4list, java.util.LinkedList l5list) {
+ double rl1=20.05,rl2=46.30,rl3=72.55,rl4=98.80,rl5=125.05;
+ //split sod
+// int nl1=106,nl2=91,nl3=92,nl4=98,nl5=109;
+ int nl1=900,nl2=900,nl3=900,nl4=900,nl5=900;
+ //tiled sod int nl1=36,nl2=5,nl3=1,nl4=0,nl5=1;
+ boolean success;
+ for(int i=0; i<nl1; i++) {
+ double myphi = Math.random()*Math.PI*2.0;
+ SODHit sh1=new SODHit(); sh1.make_hit(rl1,myphi); success=l1list.add(sh1);
+ }
+ for(int i=0; i<nl2; i++) {
+ double myphi = Math.random()*Math.PI*2.0;
+ SODHit sh2=new SODHit(); sh2.make_hit(rl2,myphi); success=l2list.add(sh2);
+ }
+ for(int i=0; i<nl3; i++) {
+ double myphi = Math.random()*Math.PI*2.0;
+ SODHit sh3=new SODHit(); sh3.make_hit(rl3,myphi); success=l3list.add(sh3);
+ }
+ for(int i=0; i<nl4; i++) {
+ double myphi = Math.random()*Math.PI*2.0;
+ SODHit sh4=new SODHit(); sh4.make_hit(rl4,myphi); success=l4list.add(sh4);
+ }
+ for(int i=0; i<nl5; i++) {
+ double myphi = Math.random()*Math.PI*2.0;
+ SODHit sh5=new SODHit(); sh5.make_hit(rl5,myphi); success=l5list.add(sh5);
+ }
+ }
+}
lcsim/src/org/lcsim/contrib/SODTracker
diff -u -r1.1 -r1.2
--- SODReadGeom.java 10 Mar 2006 21:21:35 -0000 1.1
+++ SODReadGeom.java 12 Jul 2006 18:15:55 -0000 1.2
@@ -1,106 +1,106 @@
-package org.lcsim.contrib.SODTracker;
-
-import java.util.*;
-import java.io.*;
-public class SODReadGeom
-{
- public SODReadGeom(BufferedReader bread)
- {
- System.out.println("read in geometry with SODReadGeom ");
- boolean success;
- String input;
- _radvtxlay = new double[10];
- _radsodlay = new double[10];
- _radsidlay = new double[20];
- _resvtxlay = new double[10];
- _ressodlay = new double[10];
- _ressidlay = new double[20];
- try{input = bread.readLine();
- int[] values = new int[13];
- int j=0;
- StringTokenizer st = new StringTokenizer(input);
- while(st.hasMoreElements()){
- if (j<13){values[j] = Float.valueOf(st.nextToken()).intValue();}
- j++;
- }
- if (1==j){
- _nvtxlay=values[0];
- System.out.print(values[0]);
- System.out.println(" vtx layers in SODReadGeom ");
- }else{System.out.println("BIG FUCKUP IN SODReadGeom");}
-
- int nl1=values[0];
- if (nl1>0){
- input = bread.readLine(); st = new StringTokenizer(input); j=0;
- while(st.hasMoreElements()){
- double myphi=Double.valueOf(st.nextToken()).doubleValue();
- _radvtxlay[j]=myphi;
- j++;
- }
- if (nl1==j){// System.out.println(" ");
- }else{System.out.println("BIG FUCKUP IN SODReadGeom vtx rad");}
- }
-
- int nl2=values[0]; if (nl2>0){
- input = bread.readLine(); st = new StringTokenizer(input); j=0;
- while(st.hasMoreElements()){
- double myphi=Double.valueOf(st.nextToken()).doubleValue();
- _resvtxlay[j]=myphi;
- j++;
- }
- if (nl2==j){// System.out.println(" ");
- }else{System.out.println("BIG FUCKUP IN SODReadGeom vtx res");}
- }
-
- input = bread.readLine(); st = new StringTokenizer(input); j=0;
- while(st.hasMoreElements()){
- if (j<13){values[j] = Float.valueOf(st.nextToken()).intValue();}
- j++;
- }
- if (1==j){
- _nsodlay=values[0];
- System.out.print(values[0]);
- System.out.println(" sod layers in SODReadGeom ");
- }else{System.out.println("BIG FUCKUP IN SODReadGeom");}
-
- nl1=values[0]; if (nl1>0){
- input = bread.readLine(); st = new StringTokenizer(input); j=0;
- while(st.hasMoreElements()){
- double myphi=Double.valueOf(st.nextToken()).doubleValue();
- _radsodlay[j]=myphi;
- int k=_nvtxlay+j;
- _radsidlay[k]=myphi;
- j++;
- }
- if (nl1==j){// System.out.println(" ");
- }else{System.out.println("BIG FUCKUP IN SODReadGeom vtx rad");}
- }
-
- nl2=values[0]; if (nl2>0){
- input = bread.readLine(); st = new StringTokenizer(input); j=0;
- while(st.hasMoreElements()){
- double myphi=Double.valueOf(st.nextToken()).doubleValue();
- _ressodlay[j]=myphi;
- int k=_nvtxlay+j;
- _ressidlay[k]=myphi;
- j++;
- }
- if (nl2==j){// System.out.println(" ");
- }else{System.out.println("BIG FUCKUP IN SODReadGeom sod res");}
- }
-
- }catch(Exception e){System.out.println("blow me!! readLine failed");e.printStackTrace();}
- }
- public double rad_at_vtx_layer(int i){return _radvtxlay[i-1];}
- public double rad_at_sod_layer(int i){return _radsodlay[i-1];}
- public double res_at_vtx_layer(int i){return _resvtxlay[i-1];}
- public double res_at_sod_layer(int i){return _ressodlay[i-1];}
- private int _nvtxlay;
- private int _nsodlay;
- private double[] _radvtxlay;
- private double[] _radsodlay;
- private double[] _radsidlay;
- private double[] _resvtxlay;
- private double[] _ressodlay;
- private double[] _ressidlay;
-}
+package org.lcsim.contrib.SODTracker;
+
+import java.util.*;
+import java.io.*;
+public class SODReadGeom
+{
+ public SODReadGeom(BufferedReader bread)
+ {
+ System.out.println("read in geometry with SODReadGeom ");
+ boolean success;
+ String input;
+ _radvtxlay = new double[10];
+ _radsodlay = new double[10];
+ _radsidlay = new double[20];
+ _resvtxlay = new double[10];
+ _ressodlay = new double[10];
+ _ressidlay = new double[20];
+ try{input = bread.readLine();
+ int[] values = new int[13];
+ int j=0;
+ StringTokenizer st = new StringTokenizer(input);
+ while(st.hasMoreElements()){
+ if (j<13){values[j] = Float.valueOf(st.nextToken()).intValue();}
+ j++;
+ }
+ if (1==j){
+ _nvtxlay=values[0];
+ System.out.print(values[0]);
+ System.out.println(" vtx layers in SODReadGeom ");
+ }else{System.out.println("BIG FUCKUP IN SODReadGeom");}
+
+ int nl1=values[0];
+ if (nl1>0){
+ input = bread.readLine(); st = new StringTokenizer(input); j=0;
+ while(st.hasMoreElements()){
+ double myphi=Double.valueOf(st.nextToken()).doubleValue();
+ _radvtxlay[j]=myphi;
+ j++;
+ }
+ if (nl1==j){// System.out.println(" ");
+ }else{System.out.println("BIG FUCKUP IN SODReadGeom vtx rad");}
+ }
+
+ int nl2=values[0]; if (nl2>0){
+ input = bread.readLine(); st = new StringTokenizer(input); j=0;
+ while(st.hasMoreElements()){
+ double myphi=Double.valueOf(st.nextToken()).doubleValue();
+ _resvtxlay[j]=myphi;
+ j++;
+ }
+ if (nl2==j){// System.out.println(" ");
+ }else{System.out.println("BIG FUCKUP IN SODReadGeom vtx res");}
+ }
+
+ input = bread.readLine(); st = new StringTokenizer(input); j=0;
+ while(st.hasMoreElements()){
+ if (j<13){values[j] = Float.valueOf(st.nextToken()).intValue();}
+ j++;
+ }
+ if (1==j){
+ _nsodlay=values[0];
+ System.out.print(values[0]);
+ System.out.println(" sod layers in SODReadGeom ");
+ }else{System.out.println("BIG FUCKUP IN SODReadGeom");}
+
+ nl1=values[0]; if (nl1>0){
+ input = bread.readLine(); st = new StringTokenizer(input); j=0;
+ while(st.hasMoreElements()){
+ double myphi=Double.valueOf(st.nextToken()).doubleValue();
+ _radsodlay[j]=myphi;
+ int k=_nvtxlay+j;
+ _radsidlay[k]=myphi;
+ j++;
+ }
+ if (nl1==j){// System.out.println(" ");
+ }else{System.out.println("BIG FUCKUP IN SODReadGeom vtx rad");}
+ }
+
+ nl2=values[0]; if (nl2>0){
+ input = bread.readLine(); st = new StringTokenizer(input); j=0;
+ while(st.hasMoreElements()){
+ double myphi=Double.valueOf(st.nextToken()).doubleValue();
+ _ressodlay[j]=myphi;
+ int k=_nvtxlay+j;
+ _ressidlay[k]=myphi;
+ j++;
+ }
+ if (nl2==j){// System.out.println(" ");
+ }else{System.out.println("BIG FUCKUP IN SODReadGeom sod res");}
+ }
+
+ }catch(Exception e){System.out.println("blow me!! readLine failed");e.printStackTrace();}
+ }
+ public double rad_at_vtx_layer(int i){return _radvtxlay[i-1];}
+ public double rad_at_sod_layer(int i){return _radsodlay[i-1];}
+ public double res_at_vtx_layer(int i){return _resvtxlay[i-1];}
+ public double res_at_sod_layer(int i){return _ressodlay[i-1];}
+ private int _nvtxlay;
+ private int _nsodlay;
+ private double[] _radvtxlay;
+ private double[] _radsodlay;
+ private double[] _radsidlay;
+ private double[] _resvtxlay;
+ private double[] _ressodlay;
+ private double[] _ressidlay;
+}
lcsim/src/org/lcsim/contrib/SODTracker
diff -u -r1.1 -r1.2
--- SODTrackFinder.java 10 Mar 2006 21:21:35 -0000 1.1
+++ SODTrackFinder.java 12 Jul 2006 18:15:55 -0000 1.2
@@ -66,6 +66,7 @@
} else { // if(useMCTruth) {
+// System.out.println("find seed track from combinatorics")
int prtflg=0;
_trklist = new java.util.LinkedList(); int ncombo=0;
if ((l1shlist.size()>0)&&(l2shlist.size()>0)&&(l3shlist.size()>0)&&
CVSspam 0.2.8