Author: [log in to unmask]
Date: Wed Jul 1 03:18:15 2015
New Revision: 3647
Log:
Split tolerances for angle and parallel properties between sensor pairs. Also make them settable.
Modified:
projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackCross.java
projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackHit.java
projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/StereoHitMaker.java
Modified: projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackCross.java
=============================================================================
--- projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackCross.java (original)
+++ projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackCross.java Wed Jul 1 03:18:15 2015
@@ -43,29 +43,47 @@
* @param strip2 Second of the two strips that form this cross
*/
public HelicalTrackCross(HelicalTrackStrip strip1, HelicalTrackStrip strip2) {
- super(HitUtils.PositionFromOrigin(strip1, strip2), HitUtils.CovarianceFromOrigin(strip1, strip2),
+ super();
+ init(strip1,strip2);
+
+ }
+
+
+ /**
+ * Creates a new instance of HelicalTrackCross
+ */
+ public HelicalTrackCross() {
+ super();
+ }
+
+ public void init(HelicalTrackStrip strip1, HelicalTrackStrip strip2) {
+ init(HitUtils.PositionFromOrigin(strip1, strip2), HitUtils.CovarianceFromOrigin(strip1, strip2),
strip1.dEdx()+strip2.dEdx(), 0.5*(strip1.time() + strip2.time()), _type, null,
strip1.detector(), strip1.layer(), strip1.BarrelEndcapFlag());
- // Save the strips and initialize the current helix to null
_strip1 = strip1;
_strip2 = strip2;
_helix = null;
+ init();
+ }
+
+
+ private void init() {
// Put the raw hits from the strips into the hit list
- if (strip1.rawhits() != null) {
- for (RawTrackerHit rawhit : (List<RawTrackerHit>) strip1.rawhits()) {
+ if (_strip1.rawhits() != null) {
+ for (RawTrackerHit rawhit : (List<RawTrackerHit>) _strip1.rawhits()) {
super.addRawHit(rawhit);
}
}
- if (strip2.rawhits() != null) {
- for (RawTrackerHit rawhit : (List<RawTrackerHit>) strip2.rawhits()) {
+ if (_strip2.rawhits() != null) {
+ for (RawTrackerHit rawhit : (List<RawTrackerHit>) _strip2.rawhits()) {
super.addRawHit(rawhit);
}
}
// Check if the sensors are parallel to each other
- if (VecOp.cross(_strip1.w(),_strip2.w()).magnitude() > _eps) {
- throw new RuntimeException("Trying to construct a stereo hit from non-parallel sensor planes!");
+ if (VecOp.cross(_strip1.w(),_strip2.w()).magnitude() > _epsParallel) {
+ throw new RuntimeException("Trying to construct a stereo hit from non-parallel sensor planes eps=" + Double.toString(_epsParallel) + " value=" + Double.toString(VecOp.cross(_strip1.w(),_strip2.w()).magnitude()));
}
// Check that the normals point in the same direction
@@ -74,12 +92,12 @@
}
// Calculate v1hat . u2hat, which is equivalent to sin(alpha) where alpha is the stereo angle
- double salpha = HitUtils.v1Dotu2(strip1, strip2);
- if (Math.abs(salpha) < _eps) {
+ double salpha = HitUtils.v1Dotu2(_strip1, _strip2);
+ if (Math.abs(salpha) < _epsStereoAngle) {
throw new RuntimeException("Trying to construct a stereo hit using parallel strips!");
}
-
}
+
/**
* Return a list of HelicalTrackStrips that contains the two strips that
Modified: projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackHit.java
=============================================================================
--- projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackHit.java (original)
+++ projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/HelicalTrackHit.java Wed Jul 1 03:18:15 2015
@@ -52,10 +52,31 @@
private double _drphi;
private double _dr;
private double _chisq;
- protected static final double _eps = 1e-2;
+ protected double _eps = 1e-2;
+ protected double _epsParallel;// = 1e-2;
+ protected double _epsStereoAngle = 1e-2;
protected long id; // FIXME: Dummy value that needs to be set from RawTrackerHit data.
+ /**
+ * Create a new instance of {@ HelicalTrackHit}
+ */
+ public HelicalTrackHit() {
+ }
+
+ /**
+ * Create a new instance of {@ HelicalTrackHit}
+ */
public HelicalTrackHit(Hep3Vector pos, SymmetricMatrix cov, double dEdx, double time, int type,
+ List rawhits, String detname, int layer, BarrelEndcapFlag beflag) {
+
+ init(pos, cov, dEdx, time, type, rawhits, detname, layer, beflag);
+
+ }
+
+ /**
+ * Initialize the {@link HelicalTrackHit}.
+ */
+ public void init(Hep3Vector pos, SymmetricMatrix cov, double dEdx, double time, int type,
List rawhits, String detname, int layer, BarrelEndcapFlag beflag) {
_pos = pos.v();
_poscor = pos;
@@ -79,6 +100,18 @@
setPolarVariables();
}
+ public void setEpsParallel(double _epsParallel) {
+ this._epsParallel = _epsParallel;
+ }
+
+ public double getEpsParallel(){
+ return _epsParallel;
+ }
+
+ public void setEpsStereoAngle(double _epsStereoAngle) {
+ this._epsStereoAngle = _epsStereoAngle;
+ }
+
/**
* Return the corrected x coordinate of the HelicalTrackHit
* @return x coordinate
Modified: projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/StereoHitMaker.java
=============================================================================
--- projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/StereoHitMaker.java (original)
+++ projects/lcsim/trunk/tracking/src/main/java/org/lcsim/fit/helicaltrack/StereoHitMaker.java Wed Jul 1 03:18:15 2015
@@ -25,7 +25,8 @@
static final boolean debug=false;
private double _tolerance;
private double _maxsep;
- private double _eps = 1.0e-2;
+ private double _epsParallel = 1.0e-2;
+ private double _epsStereoAngle = 1.0e-2;
/**
* Creates a new instance of StereoHitMaker with default parameters:
@@ -159,7 +160,19 @@
if (!CheckCross(strip1, strip2)) return null;
// Strip pair passes all requirements, make a new cross
- HelicalTrackCross cross = new HelicalTrackCross(strip1, strip2);
+ //HelicalTrackCross cross = new HelicalTrackCross(strip1, strip2);
+ HelicalTrackCross cross = new HelicalTrackCross();
+ if(debug)
+ System.out.println("in MakeHit...epsParallel=" + Double.toString(_epsParallel));
+
+ cross.setEpsParallel(_epsParallel);
+ cross.setEpsStereoAngle(_epsStereoAngle);
+
+ if(debug)
+ System.out.println("in MakeHit2...epsParallel=" + Double.toString(cross.getEpsParallel()));
+
+
+ cross.init(strip1, strip2);
// Add any matching MC hits to the cross
for (MCParticle mcp : strip1.MCParticles()) {
@@ -196,7 +209,7 @@
// Check that the sensors planes are parallel to each other
if(debug)
System.out.println("Strip1 w : "+strip1.w().toString()+"; Strip2 w :"+strip2.w().toString());
- if (Math.abs(VecOp.cross(strip1.w(), strip2.w()).magnitude()) > _eps) {
+ if (Math.abs(VecOp.cross(strip1.w(), strip2.w()).magnitude()) > _epsParallel) {
if(debug){
System.out.println("Failed! Planes aren't parallel"+VecOp.cross(strip1.w(), strip2.w()).magnitude());
}
@@ -206,7 +219,7 @@
System.out.println("in CheckCross...planes are parallel");
// Check that the strips aren't colinear
double salpha = VecOp.dot(strip1.v(), strip2.u());
- if (Math.abs(salpha) < _eps) return false;
+ if (Math.abs(salpha) < _epsStereoAngle) return false;
if(debug)
System.out.println("in CheckCross...strips aren't colinear");
// Locate the center of the hit strips and the difference in these positions
@@ -236,4 +249,13 @@
// Passed all tests - OK to make stereo hit from this strip pair
return true;
}
+
+ public void setEpsParallel(double _epsParallel) {
+ this._epsParallel = _epsParallel;
+ }
+
+ public void setEpsStereoAngle(double _epsStereoAngle) {
+ this._epsStereoAngle = _epsStereoAngle;
+ }
+
}
########################################################################
Use REPLY-ALL to reply to list
To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1
|