Author: [log in to unmask]
Date: Mon Nov 10 18:19:04 2014
New Revision: 1489
Log:
Add classes for fitting non-bend projections of tracks.
Added:
java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/
java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/AxialTrackReconDriver.java
- copied, changed from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackReconDriver.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/HelicalTrack2DHit.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/HPSFitter.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrack2DFitter.java
- copied, changed from r1342, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrack2DFitter.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackAxialFitter.java
- copied, changed from r1342, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrack2DFitter.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackConfirmerExtender.java
- copied, changed from r1342, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackConfirmerExtender.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackFinder.java
- copied, changed from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackFinder.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackFitter.java
- copied, changed from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackFitter.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackReconDriver.java
- copied, changed from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackReconDriver.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTracker.java
- copied, changed from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTracker.java
java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Axial.xml
- copied, changed from r1417, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml
java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-L1-3.xml
- copied, changed from r1331, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml
java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-L4-6.xml
- copied, changed from r1331, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml
java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-StraightTracks.xml
- copied, changed from r1331, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml
Modified:
java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelicalTrackHitDriver.java
java/trunk/tracking/src/main/java/org/hps/recon/tracking/MultipleScattering.java
Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelicalTrackHitDriver.java
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelicalTrackHitDriver.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/HelicalTrackHitDriver.java Mon Nov 10 18:19:04 2014
@@ -1,20 +1,19 @@
package org.hps.recon.tracking;
+import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import hep.physics.vec.VecOp;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-
-//===> import org.hps.conditions.deprecated.StereoPair;
-//===> import org.hps.conditions.deprecated.StereoPair.detectorVolume;
-//===> import org.hps.conditions.deprecated.SvtUtils;
-
+import org.hps.recon.tracking.axial.HelicalTrack2DHit;
import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.ITransform3D;
+import org.lcsim.detector.converter.compact.subdetector.HpsTracker2;
import org.lcsim.detector.converter.compact.subdetector.SvtStereoLayer;
+import org.lcsim.detector.tracker.silicon.HpsSiSensor;
import org.lcsim.detector.tracker.silicon.SiSensor;
import org.lcsim.detector.tracker.silicon.SiTrackerModule;
import org.lcsim.event.EventHeader;
@@ -30,7 +29,6 @@
import org.lcsim.fit.helicaltrack.HelicalTrackStrip;
import org.lcsim.geometry.Detector;
import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
-import org.lcsim.detector.converter.compact.subdetector.HpsTracker2;
import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHit;
import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType;
@@ -42,7 +40,7 @@
* @author Mathew Graham <[log in to unmask]>
* @author Per Hansson <[log in to unmask]>
* @author Omar Moreno <[log in to unmask]>
- *
+ *
*/
// TODO: Add class documentation.
// FIXME: The option to run using the Common geometry should be removed
@@ -53,9 +51,12 @@
// dt cut time in ns
private String _subdetectorName = "Tracker";
private final Map<String, String> _stereomap = new HashMap<String, String>();
- private List<SvtStereoLayer> stereoLayers = null;
+ private List<SvtStereoLayer> stereoLayers = null;
private final List<String> _colnames = new ArrayList<String>();
private boolean _doTransformToTracking = true;
+ private boolean _saveAxialHits = false;
+ private String _axialname = "AxialTrackHits";
+ private String _axialmcrelname = "AxialTrackHitsMCRelations";
public enum LayerGeometryType {
@@ -110,6 +111,10 @@
*/
public void setTransformToTracking(boolean trans) {
this._doTransformToTracking = trans;
+ }
+
+ public void setSaveAxialHits(boolean save) {
+ _saveAxialHits = save;
}
/**
@@ -150,42 +155,35 @@
// Instantiate the list of HelicalTrackCrosses and HelicalTrackHits
List<HelicalTrackCross> stereoCrosses = new ArrayList<HelicalTrackCross>();
List<HelicalTrackHit> helhits = new ArrayList<HelicalTrackHit>();
-
// Create an LCRelation from a HelicalTrackHit to
List<LCRelation> hitrelations = new ArrayList<LCRelation>();
-
// Create an LCRelation from a HelicalTrackHit to an MC particle used to
// create it
List<LCRelation> mcrelations = new ArrayList<LCRelation>();
-
RelationalTable hittomc = new BaseRelationalTable(RelationalTable.Mode.ONE_TO_MANY, RelationalTable.Weighting.UNWEIGHTED);
if (event.hasCollection(LCRelation.class, "SVTTrueHitRelations")) {
List<LCRelation> trueHitRelations = event.get(LCRelation.class, "SVTTrueHitRelations");
- for (LCRelation relation : trueHitRelations) {
- if (relation != null && relation.getFrom() != null && relation.getTo() != null) {
+ for (LCRelation relation : trueHitRelations)
+ if (relation != null && relation.getFrom() != null && relation.getTo() != null)
hittomc.add(relation.getFrom(), relation.getTo());
- }
- }
- }
-
+ }
+
+ List<HelicalTrack2DHit> axialhits = new ArrayList<>();
+ List<LCRelation> axialmcrelations = new ArrayList<LCRelation>();
+ // Loop over the input collection names we want to make hits out of
+ // ...for HPS, probably this is just a single one...
for (String _colname : this._colnames) {
if (!event.hasCollection(SiTrackerHit.class, _colname)) {
- if (_debug) {
+ if (_debug)
System.out.println("Event: " + event.getRunNumber() + " does not contain the collection " + _colname);
- }
continue;
}
-
// Get the list of SiTrackerHits for this collection
List<SiTrackerHit> hitlist = event.get(SiTrackerHit.class, _colname);
-
- if (_debug) {
+ if (_debug)
System.out.printf("%s: found %d SiTrackerHits\n", this.getClass().getSimpleName(), hitlist.size());
- }
-
Map<HelicalTrackStrip, SiTrackerHitStrip1D> stripmap = new HashMap<HelicalTrackStrip, SiTrackerHitStrip1D>();
-
- for (SiTrackerHit hit : hitlist) {
+ for (SiTrackerHit hit : hitlist)
if (hit instanceof SiTrackerHitStrip1D) {
// Cast the hit as a 1D strip hit and find the
@@ -195,19 +193,26 @@
if ((_clusterTimeCut > 0 && Math.abs(h.getTime()) < _clusterTimeCut) || _clusterTimeCut < 0) {
// Create a HelicalTrackStrip for this hit
HelicalTrackStrip strip = makeDigiStrip(h);
- for (RawTrackerHit rth : h.getRawHits()) {
- for (Object simHit : hittomc.allFrom(rth)) {
+ for (RawTrackerHit rth : h.getRawHits())
+ for (Object simHit : hittomc.allFrom(rth))
strip.addMCParticle(((SimTrackerHit) simHit).getMCParticle());
- }
- }
// Map a reference back to the hit needed to create
// the stereo hit LC relations
stripmap.put(strip, h);
-
- if (_debug) {
+ if (_debug)
System.out.printf("%s: added strip org %s layer %d\n", this.getClass().getSimpleName(), strip.origin().toString(), strip.layer());
- }
+
+ if (_saveAxialHits)//
+ if (((HpsSiSensor) h.getSensor()).isAxial()) {
+ HelicalTrack2DHit haxial = makeDigiAxialHit(h);
+ axialhits.add(haxial);
+ List<RawTrackerHit> rl = haxial.getRawHits();
+ for (RawTrackerHit rth : rl)
+ for (Object simHit : hittomc.allFrom(rth))
+ haxial.addMCParticle(((SimTrackerHit) simHit).getMCParticle());
+ axialmcrelations.add(new MyLCRelation(haxial, haxial.getMCParticles()));
+ }
}
} else {
// If not a 1D strip hit, make a pixel hit
@@ -216,7 +221,6 @@
helhits.add(hit3d);
hitrelations.add(new MyLCRelation(hit3d, hit));
}
- }
List<HelicalTrackCross> helicalTrackCrosses = new ArrayList<HelicalTrackCross>();
@@ -232,9 +236,8 @@
// This hit should be a on a stereo pair!
// With our detector setup, when is this not true?
- if (!_stereomap.containsKey(id) && !_stereomap.containsValue(id)) {
+ if (!_stereomap.containsKey(id) && !_stereomap.containsValue(id))
throw new RuntimeException(this.getClass().getSimpleName() + ": this " + id + " was not among the stereo modules!");
- }
// Get the list of strips for this layer - create a new
// list if one doesn't already exist
@@ -249,9 +252,8 @@
lyrhits.add(strip);
}
- if (_debug) {
+ if (_debug)
System.out.printf("%s: Create stereo hits from %d strips \n", this.getClass().getSimpleName(), striplistmap.size());
- }
// Loop over the stereo layer pairs
// TODO: Change this so that it makes use of StereoPairs
@@ -259,9 +261,8 @@
// Get the second layer
String id2 = _stereomap.get(id1);
- if (_debug) {
+ if (_debug)
System.out.printf("%s: Form stereo hits from sensor id %s with %d hits and %s with %d hits\n", this.getClass().getSimpleName(), id1, striplistmap.get(id1) == null ? 0 : striplistmap.get(id1).size(), id2, striplistmap.get(id2) == null ? 0 : striplistmap.get(id2).size());
- }
// Form the stereo hits and add them to our hit list
helicalTrackCrosses.addAll(_crosser.MakeHits(striplistmap.get(id1), striplistmap.get(id2)));
@@ -292,45 +293,37 @@
List<HelicalTrackCross> newCrosses;
//===> if (stereoPair.getDetectorVolume() == detectorVolume.Top) {
- if (stereoLayer.getAxialSensor().isTopLayer()) {
- newCrosses = _crosser.MakeHits(striplistmap.get(stereoLayer.getAxialSensor()), striplistmap.get(stereoLayer.getStereoSensor()));
- //===> } else if (stereoPair.getDetectorVolume() == detectorVolume.Bottom) {
- } else if (stereoLayer.getAxialSensor().isBottomLayer()) {
+ if (stereoLayer.getAxialSensor().isTopLayer())
+ newCrosses = _crosser.MakeHits(striplistmap.get(stereoLayer.getAxialSensor()), striplistmap.get(stereoLayer.getStereoSensor())); //===> } else if (stereoPair.getDetectorVolume() == detectorVolume.Bottom) {
+ else if (stereoLayer.getAxialSensor().isBottomLayer())
newCrosses = _crosser.MakeHits(striplistmap.get(stereoLayer.getStereoSensor()), striplistmap.get(stereoLayer.getAxialSensor()));
- } else {
+ else
throw new RuntimeException("stereo pair is neither top nor bottom");
- }
helicalTrackCrosses.addAll(newCrosses);
} // Loop over stereo pairs
}
for (HelicalTrackCross cross : helicalTrackCrosses) {
- if (cross.getMCParticles() != null) {
- for (MCParticle mcp : cross.getMCParticles()) {
+ if (cross.getMCParticles() != null)
+ for (MCParticle mcp : cross.getMCParticles())
mcrelations.add(new MyLCRelation((HelicalTrackHit) cross, mcp));
- }
- }
- for (HelicalTrackStrip strip : cross.getStrips()) {
+ for (HelicalTrackStrip strip : cross.getStrips())
hitrelations.add(new MyLCRelation(cross, stripmap.get(strip)));
- }
- if (_debug) {
+ if (_debug)
System.out.printf("%s: cross at %.2f,%.2f,%.2f \n", this.getClass().getSimpleName(), cross.getPosition()[0], cross.getPosition()[1], cross.getPosition()[2]);
- }
}
stereoCrosses.addAll(helicalTrackCrosses);
- if (_debug) {
+ if (_debug)
System.out.printf("%s: added %d stereo hits from %s collection \n", this.getClass().getSimpleName(), helicalTrackCrosses.size(), _colname);
- }
} // End of loop over collection names
if (_debug) {
System.out.printf("%s: totally added %d stereo hits:\n", this.getClass().getSimpleName(), stereoCrosses.size());
- for (HelicalTrackCross cross : stereoCrosses) {
+ for (HelicalTrackCross cross : stereoCrosses)
System.out.printf("%s: %.2f,%.2f,%.2f \n", this.getClass().getSimpleName(), cross.getPosition()[0], cross.getPosition()[1], cross.getPosition()[2]);
- }
}
// Add things to the event
@@ -339,10 +332,16 @@
event.put(_outname, helhits, HelicalTrackHit.class, 0);
event.put(_hitrelname, hitrelations, LCRelation.class, 0);
event.put(_mcrelname, mcrelations, LCRelation.class, 0);
+ if (_saveAxialHits) {
+ event.put(_axialname, axialhits, HelicalTrackHit.class, 0);
+ event.put(_axialmcrelname, axialmcrelations, LCRelation.class, 0);
+ System.out.println(this.getClass().getSimpleName() + " : number of " + _axialmcrelname + " found = " + axialmcrelations.size());
+ }
if (_doTransformToTracking) {
addRotatedHitsToEvent(event, stereoCrosses);
- }
-
+ if (_saveAxialHits)
+ addRotated2DHitsToEvent(event, axialhits);
+ }
} // Process()
public void addCollection(String colname) {
@@ -365,43 +364,57 @@
@Override
protected void detectorChanged(Detector detector) {
- // Get the collection of stereo layers from the detector
- stereoLayers = ((HpsTracker2) detector.getSubdetector(this._subdetectorName).getDetectorElement()).getStereoPairs();
-
+ // Get the collection of stereo layers from the detector
+ stereoLayers = ((HpsTracker2) detector.getSubdetector(this._subdetectorName).getDetectorElement()).getStereoPairs();
+
/*
* Setup default pairing
*/
- if (_debug) {
+ if (_debug)
System.out.printf("%s: Setup stereo hit pair modules \n", this.getClass().getSimpleName());
- }
List<SiTrackerModule> modules = detector.getSubdetector(this._subdetectorName).getDetectorElement().findDescendants(SiTrackerModule.class);
- if (modules.isEmpty()) {
+ if (modules.isEmpty())
throw new RuntimeException(this.getClass().getName() + ": No SiTrackerModules found in detector.");
- }
if (LayerGeometryType.Common == this._layerGeometryType) {
int nLayersTotal = detector.getSubdetector(_subdetectorName).getLayering().getLayers().getNumberOfLayers();
- if (_debug) {
+ if (_debug)
System.out.printf("%s: %d layers \n", this.getClass().getSimpleName(), nLayersTotal);
- }
- if (nLayersTotal % 2 != 0) {
+ if (nLayersTotal % 2 != 0)
throw new RuntimeException(this.getClass().getName() + ": Don't know how to do stereo pairing for odd number of modules.");
- }
for (int i = 1; i <= (nLayersTotal) - 1; i += 2) {
- if (_debug) {
+ if (_debug)
System.out.printf("%s: Adding stereo pair: %d,%d\n", this.getClass().getSimpleName(), i, i + 1);
- }
setStereoPair(_subdetectorName, i, i + 1);
}
}
- if (_debug) {
+ if (_debug)
System.out.printf("%s: %d stereo modules added", this.getClass().getSimpleName(), this._stereomap.size());
- }
-
+
+ }
+
+ /*
+ * Make HelicalTrack2DHits from SiTrackerHitStrip1D...note that these HelicalTrack2DHits
+ * are defined in org.hps.recon.tracking.axial (not the lcsim class)
+ */
+ private HelicalTrack2DHit makeDigiAxialHit(SiTrackerHitStrip1D h) {
+
+ double z1 = h.getHitSegment().getEndPoint().x();
+ double z2 = h.getHitSegment().getStartPoint().x();//x is the non-bend direction in the JLAB frame
+ double zmin = Math.min(z1, z2);
+ double zmax = Math.max(z1, z2);
+ IDetectorElement de = h.getSensor();
+
+ HelicalTrack2DHit hit = new HelicalTrack2DHit(h.getPositionAsVector(),
+ h.getCovarianceAsMatrix(), h.getdEdx(), h.getTime(),
+ h.getRawHits(), _ID.getName(de), _ID.getLayer(de),
+ _ID.getBarrelEndcapFlag(de), zmin, zmax, h.getUnmeasuredCoordinate());
+
+ return hit;
}
private HelicalTrackStrip makeDigiStrip(SiTrackerHitStrip1D h) {
@@ -430,18 +443,15 @@
HelicalTrackStrip strip = new HelicalTrackStrip(org, u, v, umeas, du, vmin, vmax, dEdx, time, rawhits, det, lyr, be);
try {
- if (h.getMCParticles() != null) {
- for (MCParticle p : h.getMCParticles()) {
+ if (h.getMCParticles() != null)
+ for (MCParticle p : h.getMCParticles())
strip.addMCParticle(p);
- }
- }
} catch (RuntimeException e) {
// Okay when MC info not present.
}
- if (_debug) {
+ if (_debug)
System.out.println(this.getClass().getSimpleName() + ": produced HelicalTrackStrip with origin " + strip.origin().toString());
- }
return strip;
}
@@ -472,24 +482,61 @@
Hep3Vector newu = CoordinateTransformations.transformVectorToTracking(u);
Hep3Vector newv = CoordinateTransformations.transformVectorToTracking(v);
HelicalTrackStrip newstrip = new HelicalTrackStrip(neworigin, newu, newv, umeas, du, vmin, vmax, dedx, time, rthList, detname, layer, bec);
- for (MCParticle p : strip.MCParticles()) {
+ for (MCParticle p : strip.MCParticles())
newstrip.addMCParticle(p);
- }
rotatedstriphits.add(newstrip);
}
HelicalTrackCross newhit = new HelicalTrackCross(rotatedstriphits.get(0), rotatedstriphits.get(1));
- for (MCParticle mcp : cross.getMCParticles()) {
+ for (MCParticle mcp : cross.getMCParticles())
newhit.addMCParticle(mcp);
- }
rotatedhits.add(newhit);
hthrelations.add(new MyLCRelation(cross, newhit));
- for (MCParticle mcp : newhit.getMCParticles()) {
+ for (MCParticle mcp : newhit.getMCParticles())
mcrelations.add(new MyLCRelation(newhit, mcp));
- }
}
event.put("Rotated" + _outname, rotatedhits, HelicalTrackHit.class, 0);
event.put("Rotated" + _hitrelname, hthrelations, LCRelation.class, 0);
event.put("Rotated" + _mcrelname, mcrelations, LCRelation.class, 0);
}
+
+ /*
+ * Rotate the 2D tracker hits
+ */
+ private void addRotated2DHitsToEvent(EventHeader event, List<HelicalTrack2DHit> striphits) {
+ List<HelicalTrack2DHit> rotatedhits = new ArrayList<HelicalTrack2DHit>();
+ List<LCRelation> mcrelations = new ArrayList<LCRelation>();
+ for (HelicalTrack2DHit twodhit : striphits) {
+ Hep3Vector pos = new BasicHep3Vector(twodhit.getPosition());
+ SymmetricMatrix cov = twodhit.getCorrectedCovMatrix();
+ double dedx = twodhit.getdEdx();
+ double time = twodhit.getTime();
+ List<RawTrackerHit> rthList = twodhit.getRawHits();
+ String detname = twodhit.Detector();
+ int layer = twodhit.Layer();
+ BarrelEndcapFlag bec = twodhit.BarrelEndcapFlag();
+ double vmin = twodhit.axmin();
+ double vmax = twodhit.axmax();
+ Hep3Vector axDir = twodhit.axialDirection();
+ Hep3Vector newpos = CoordinateTransformations.transformVectorToTracking(pos);
+ Hep3Vector newaxdir = CoordinateTransformations.transformVectorToTracking(axDir);
+ SymmetricMatrix newcov = CoordinateTransformations.transformCovarianceToTracking(cov);
+ HelicalTrack2DHit newhit = new HelicalTrack2DHit(newpos, newcov, dedx, time, rthList, detname, layer, bec, vmin, vmax, newaxdir);
+ for (MCParticle mcp : twodhit.getMCParticles())
+ newhit.addMCParticle(mcp);
+ rotatedhits.add(newhit);
+ for (MCParticle mcp : newhit.getMCParticles())
+ mcrelations.add(new MyLCRelation(newhit, mcp));
+ }
+ if (_debug) {
+ System.out.println(this.getClass().getSimpleName() + ": " + _axialname + " size = " + rotatedhits.size());
+ System.out.println(this.getClass().getSimpleName() + ": " + _axialmcrelname + " size = " + mcrelations.size());
+ }
+ event.put("Rotated" + _axialname, rotatedhits, HelicalTrackHit.class, 0);
+ event.put("Rotated" + _axialmcrelname, mcrelations, LCRelation.class, 0);
+ }
+
+ public void saveAxial2DHits(boolean saveThem) {
+ _saveAxialHits = saveThem;
+ }
}
Modified: java/trunk/tracking/src/main/java/org/hps/recon/tracking/MultipleScattering.java
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/MultipleScattering.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/MultipleScattering.java Mon Nov 10 18:19:04 2014
@@ -25,6 +25,8 @@
*/
public class MultipleScattering extends org.lcsim.recon.tracking.seedtracker.MultipleScattering {
+ private boolean _fixTrackMomentum=false;
+ private double _momentum=-99;//dummy
public MultipleScattering(MaterialManager materialmanager) {
super(materialmanager);
}
@@ -32,7 +34,7 @@
/**
* Override lcsim version and select material manager depending on object
* type. This allows to
- * use a local extension of the material manager in teh lcsim track fitting
+ * use a local extension of the material manager in the lcsim track fitting
* code.
*
* @param helix
@@ -77,9 +79,9 @@
System.out.printf("%s: momentum is p=%f,R=%f,B=%f \n", this.getClass().getSimpleName(), helix.p(Math.abs(_bfield)), helix.R(), _bfield);
}
// MG TURN THIS OFF SO IT DOESN'T ABORT STRAIGHT TRACKS
-// // Check that B Field is set
-// if (_bfield == 0.)
-// throw new RuntimeException("B Field must be set before calling FindScatters method");
+ // Check that B Field is set
+ if (_bfield == 0.&&!_fixTrackMomentum)
+ throw new RuntimeException("B Field or fixed momentum must be set before calling FindScatters method");
// Create a new list to contain the mutliple scatters
// List<ScatterAngle> scatters = new ArrayList<ScatterAngle>();
@@ -122,9 +124,10 @@
if (_debug)
System.out.printf("%s: material traversed: %f R.L. (%fmm) \n", this.getClass().getSimpleName(), radlen, vol.getMaterialTraversed(dir));
-// double p = helix.p(this._bfield);
- double p = 1.0; // set default momentum to 1.0
- if (_bfield != 0)
+ double p;
+ if (_fixTrackMomentum)
+ p=_momentum;
+ else
p = helix.p(this._bfield);
double msangle = this.msangle(p, radlen);
@@ -360,6 +363,11 @@
// Should be safe to cast here
return (MaterialManager) _materialmanager;
}
+
+ public void fixTrackMomentum(double mom){
+ _fixTrackMomentum=true;
+ _momentum=mom;
+ }
/**
* Nested class to encapsulate the scatter angles and which detector element
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/AxialTrackReconDriver.java (from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackReconDriver.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackReconDriver.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/AxialTrackReconDriver.java Mon Nov 10 18:19:04 2014
@@ -1,8 +1,10 @@
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.axial;
import hep.physics.vec.BasicHep3Vector;
import java.util.List;
import org.hps.recon.tracking.CoordinateTransformations;
+import org.hps.recon.tracking.straighttracks.StraightTrackAxialFitter;
+import org.hps.recon.tracking.straighttracks.StraightTracker;
import org.lcsim.event.EventHeader;
import org.lcsim.event.Track;
import org.lcsim.event.base.BaseTrack;
@@ -14,12 +16,13 @@
import org.lcsim.util.Driver;
/**
- * This class runs the Track Reconstruction 0 B-Field events.
- * The tracker digitization must be run in front of it. It is intended to work
+ * This class runs the Track Reconstruction using just the axial layers;
+ * No circle fit is performed.
+ * The tracker digitization must be run in front of it.
*
* @author Matt Graham <[log in to unmask]>
*/
-public final class StraightTrackReconDriver extends Driver {
+public final class AxialTrackReconDriver extends Driver {
// Debug flag.
private boolean debug = false;
@@ -34,20 +37,18 @@
// Tracking strategies resource path.
private String strategyResource = "HPS-Full-StraightTracks.xml";
// Output track collection.
- private String trackCollectionName = "StraightTracks";
+ private String trackCollectionName = "VerticalTracks";
// HelicalTrackHit input collection.
- private String stInputCollectionName = "RotatedHelicalTrackHits";
+ private String stInputCollectionName = "RotatedAxialTrackHits";
// Include MS (done by removing XPlanes from the material manager results)
private boolean includeMS = true;
// number of repetitive fits on confirmed/extended tracks
private int _iterativeConfirmed = 3;
// use HPS implementation of material manager
private boolean _useHPSMaterialManager = true;
- // enable the use of sectoring using sector binning in SeedTracker
- private boolean _applySectorBinning = true;
private double rmsTimeCut = -1;
- public StraightTrackReconDriver() {
+ public AxialTrackReconDriver() {
}
public void setDebug(boolean debug) {
@@ -88,17 +89,6 @@
public void setIterativeFits(int val) {
this._iterativeConfirmed = val;
}
-
- /**
- * Set to enable the sectoring to use the sector bins in checking for
- * consistent hits.
- *
- * @param applySectorBinning apply sector binning switch
- */
- public void setApplySectorBinning(boolean applySectorBinning) {
- this._applySectorBinning = applySectorBinning;
- }
-
/**
* Set time cut.
* @param rmsTimeCut
@@ -148,6 +138,7 @@
stFinal.setInputCollectionName(stInputCollectionName);
stFinal.setTrkCollectionName(trackCollectionName);
stFinal.setBField(bfield);
+ stFinal.setTrackFittingAlgorithm(new StraightTrackAxialFitter());
if (debug) {
stFinal.setDiagnostics(new SeedTrackerDiagnostics());
}
Added: java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/HelicalTrack2DHit.java
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/HelicalTrack2DHit.java (added)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/axial/HelicalTrack2DHit.java Mon Nov 10 18:19:04 2014
@@ -0,0 +1,71 @@
+package org.hps.recon.tracking.axial;
+
+import hep.physics.matrix.SymmetricMatrix;
+import hep.physics.vec.Hep3Vector;
+import java.util.List;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.geometry.subdetector.BarrelEndcapFlag;
+
+/**
+ * Encapsulate 2D hit info needed by HelicalTrackFitter.
+ * This class is explicitly for HPS where the length of the
+ * sensors are (mostly) along the detector
+ * y-dimension ( == HelicalTrackFit x-dimension);
+ * @author Matt Graham <[log in to unmask]>
+ * Copied/Modified from org.lcsim.recon.tracking.helicaltrack.HelicalTrack2DHit.java
+ */
+public class HelicalTrack2DHit extends HelicalTrackHit {
+ private double _axmin;//min value along the bend-direction..
+ private double _axmax;//max value along the bend-direction..
+ private static int _type = 2;
+ private Hep3Vector _axialDirection;//the direction along the strip length
+
+ /**
+ * Create a HelicalTrack2DHit from the associated TrackerHit and HelicalTrackStrip.
+ * @param pos location of the strip center
+ * @param cov covariance matrix for the hit
+ * @param dEdx deposited energy
+ * @param time hit time
+ * @param rawhits list of raw hits
+ * @param axmin minimum z for the strip
+ * @param axmax maximum z for the strip
+ * @param detname detector name
+ * @param layer layer number
+ * @param beflag
+ */
+ public HelicalTrack2DHit(Hep3Vector pos, SymmetricMatrix cov, double dEdx, double time,
+ List rawhits, String detname, int layer, BarrelEndcapFlag beflag, double zmin, double zmax, Hep3Vector axDir) {
+ super(pos, cov, dEdx, time, _type, rawhits, detname, layer, beflag);
+ _axmin = zmin;
+ _axmax = zmax;
+ _axialDirection=axDir;
+ }
+
+ /**
+ * Return the minimum z coordinate.
+ * @return minimum z coordinate
+ */
+ public double axmin() {
+ return _axmin;
+ }
+
+ /**
+ * Return the maximum z coordinate.
+ * @return maximum z coordinate
+ */
+ public double axmax() {
+ return _axmax;
+ }
+
+ /**
+ * Return the length of the strip along the z direction.
+ * @return strip length
+ */
+ public double axlen() {
+ return _axmax - _axmin;
+ }
+
+ public Hep3Vector axialDirection(){
+ return _axialDirection;
+ }
+}
Added: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/HPSFitter.java
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/HPSFitter.java (added)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/HPSFitter.java Mon Nov 10 18:19:04 2014
@@ -0,0 +1,43 @@
+package org.hps.recon.tracking.straighttracks;
+
+import java.util.List;
+import java.util.Map;
+import org.lcsim.fit.helicaltrack.HelicalTrackFit;
+import org.lcsim.fit.helicaltrack.HelicalTrackHit;
+import org.lcsim.fit.helicaltrack.MultipleScatter;
+
+/**
+ *
+ * @author mgraham
+ */
+public interface HPSFitter {
+
+// public void HPSFitter();
+
+ public enum FitStatus {
+
+ /**
+ * Successful Fit.
+ */
+ Success,
+ /**
+ * Inconsistent seed hits
+ */
+ InconsistentSeed,
+ /**
+ * s-z line fit failed.
+ */
+ SZLineFitFailed,
+ /**
+ * ZSegmentFit failed.
+ */
+ XYLineFitFailed
+ };
+
+ public FitStatus fit(List<HelicalTrackHit> hits);
+
+ public FitStatus fit(List<HelicalTrackHit> hits, Map<HelicalTrackHit, MultipleScatter> msmap, HelicalTrackFit oldfit);
+
+ public HelicalTrackFit getFit();
+
+}
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrack2DFitter.java (from r1342, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrack2DFitter.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrack2DFitter.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrack2DFitter.java Mon Nov 10 18:19:04 2014
@@ -1,4 +1,4 @@
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import hep.physics.matrix.SymmetricMatrix;
import java.util.HashMap;
@@ -15,7 +15,7 @@
*
* @author mgraham
*/
-public class StraightTrack2DFitter {
+public class StraightTrack2DFitter implements HPSFitter {
SlopeInterceptLineFitter _lfitter = new SlopeInterceptLineFitter();
HelicalTrackFit _fit;
@@ -23,35 +23,36 @@
/**
* Status of the HelicalTrackFit.
*/
- public enum FitStatus {
-
- /**
- * Successful Fit.
- */
- Success,
- /**
- * Inconsistent seed hits
- */
- InconsistentSeed,
- /**
- * s-z line fit failed.
- */
- SZLineFitFailed,
- /**
- * ZSegmentFit failed.
- */
- XYLineFitFailed
- };
-
+ // public enum FitStatus {
+//
+// /**
+// * Successful Fit.
+// */
+// Success,
+// /**
+// * Inconsistent seed hits
+// */
+// InconsistentSeed,
+// /**
+// * s-z line fit failed.
+// */
+// SZLineFitFailed,
+// /**
+// * ZSegmentFit failed.
+// */
+// XYLineFitFailed
+// };
public void StraightTrack2DFitter() {
}
+ @Override
public FitStatus fit(List<HelicalTrackHit> hits) {
Map<HelicalTrackHit, MultipleScatter> msmap = new HashMap<HelicalTrackHit, MultipleScatter>();
return fit(hits, msmap, null);
}
+ @Override
public FitStatus fit(List<HelicalTrackHit> hits, Map<HelicalTrackHit, MultipleScatter> msmap, HelicalTrackFit oldfit) {
// Check that we have at least 3 hits
boolean success = false;
@@ -90,7 +91,7 @@
success = _lfitter.fit(x, y, dy, nhit);
if (!success)
return FitStatus.XYLineFitFailed;
- SlopeInterceptLineFit xyFit = _lfitter.getFit();
+ SlopeInterceptLineFit xyFit = _lfitter.getFit();
par[0] = xyFit.intercept();
par[1] = xyFit.slope();
cov.setElement(0, 0, Math.pow(xyFit.interceptUncertainty(), 2));
@@ -117,13 +118,14 @@
cov.setElement(4, 4, Math.pow(szFit.slopeUncertainty(), 2));
cov.setElement(3, 4, Math.pow(szFit.covariance(), 2));
chisq[1] = szFit.chisquared();
- ndof[1] = szFit.ndf();
+ ndof[1] = szFit.ndf();
par[2] = 1e-50;
// Create the HelicalTrackFit for this helix
_fit = new HelicalTrackFit(par, cov, chisq, ndof, smap, msmap);
return FitStatus.Success;
}
+ @Override
public HelicalTrackFit getFit() {
return _fit;
}
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackAxialFitter.java (from r1342, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrack2DFitter.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrack2DFitter.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackAxialFitter.java Mon Nov 10 18:19:04 2014
@@ -1,4 +1,4 @@
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import hep.physics.matrix.SymmetricMatrix;
import java.util.HashMap;
@@ -12,49 +12,47 @@
import org.lcsim.fit.line.SlopeInterceptLineFitter;
/**
- *
- * @author mgraham
+ * Do a simple 1d linear fit using the
+ *
+ * @author mgraham <[log in to unmask]>
*/
-public class StraightTrack2DFitter {
+public class StraightTrackAxialFitter implements HPSFitter{
SlopeInterceptLineFitter _lfitter = new SlopeInterceptLineFitter();
HelicalTrackFit _fit;
- /**
- * Status of the HelicalTrackFit.
- */
- public enum FitStatus {
-
- /**
- * Successful Fit.
- */
- Success,
- /**
- * Inconsistent seed hits
- */
- InconsistentSeed,
- /**
- * s-z line fit failed.
- */
- SZLineFitFailed,
- /**
- * ZSegmentFit failed.
- */
- XYLineFitFailed
- };
-
+// /**
+// * Status of the HelicalTrackFit.
+// */
+// public enum FitStatus {
+//
+// /**
+// * Successful Fit.
+// */
+// Success,
+// /**
+// * Inconsistent seed hits
+// */
+// InconsistentSeed,
+// /**
+// * s-z line fit failed.
+// */
+// SZLineFitFailed,
+// };
+
public void StraightTrack2DFitter() {
}
-
+ @Override
public FitStatus fit(List<HelicalTrackHit> hits) {
Map<HelicalTrackHit, MultipleScatter> msmap = new HashMap<HelicalTrackHit, MultipleScatter>();
return fit(hits, msmap, null);
}
-
+
+ @Override
public FitStatus fit(List<HelicalTrackHit> hits, Map<HelicalTrackHit, MultipleScatter> msmap, HelicalTrackFit oldfit) {
// Check that we have at least 3 hits
- boolean success = false;
+ boolean success;
int nhit = hits.size();
if (nhit < 3)
return FitStatus.InconsistentSeed;
@@ -67,43 +65,16 @@
// Setup for the line fit
double[] s = new double[nhit];
- double[] z = new double[nhit];
- double[] y = new double[nhit];
- double[] x = new double[nhit];
+ double[] z = new double[nhit];
double[] dz = new double[nhit];
- double[] dy = new double[nhit];
Map<HelicalTrackHit, Double> smap = new HashMap<>();
-
- // Store the coordinates and errors for the XY line fit
- for (int i = 0; i < nhit; i++) {
- HelicalTrackHit hit = hits.get(i);
- y[i] = hit.y();
- dy[i] = HitUtils.zres(hit, msmap, oldfit);
- double drphi_ms = 0;
- if (msmap.containsKey(hit))
- drphi_ms = msmap.get(hit).drphi();
- double dyHitSq = hit.getCorrectedCovMatrix().e(1, 1);
- dy[i] = Math.sqrt(dyHitSq + drphi_ms * drphi_ms);
- x[i] = hit.x();
- }
- // Call the line fitter and check for success
- success = _lfitter.fit(x, y, dy, nhit);
- if (!success)
- return FitStatus.XYLineFitFailed;
- SlopeInterceptLineFit xyFit = _lfitter.getFit();
- par[0] = xyFit.intercept();
- par[1] = xyFit.slope();
- cov.setElement(0, 0, Math.pow(xyFit.interceptUncertainty(), 2));
- cov.setElement(1, 1, Math.pow(xyFit.slopeUncertainty(), 2));
- cov.setElement(0, 1, Math.pow(xyFit.covariance(), 2));
- chisq[0] = xyFit.chisquared();
- ndof[0] = xyFit.ndf();
+
// Store the coordinates and errors for the SZ line fit
for (int i = 0; i < nhit; i++) {
HelicalTrackHit hit = hits.get(i);
z[i] = hit.z();
dz[i] = HitUtils.zres(hit, msmap, oldfit); //MG this works even in msmap is null
- s[i] = Math.sqrt(hit.x() * hit.x() + hit.y() * hit.y());
+ s[i] = hit.x(); //take as the track length, the distance in x
smap.put(hit, s[i]);
}
// Call the line fitter and check for success
@@ -118,12 +89,17 @@
cov.setElement(3, 4, Math.pow(szFit.covariance(), 2));
chisq[1] = szFit.chisquared();
ndof[1] = szFit.ndf();
+ //set the other parameters to 0;
+ chisq[0] = 0;
+ ndof[0] = 0;
+ par[0]=0;
+ par[1]=0;
par[2] = 1e-50;
// Create the HelicalTrackFit for this helix
_fit = new HelicalTrackFit(par, cov, chisq, ndof, smap, msmap);
return FitStatus.Success;
}
-
+ @Override
public HelicalTrackFit getFit() {
return _fit;
}
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackConfirmerExtender.java (from r1342, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackConfirmerExtender.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackConfirmerExtender.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackConfirmerExtender.java Mon Nov 10 18:19:04 2014
@@ -1,7 +1,7 @@
/*
* StraightTrackConfirmerExtender.java
*/
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import java.util.ArrayList;
import java.util.Collections;
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackFinder.java (from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackFinder.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackFinder.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackFinder.java Mon Nov 10 18:19:04 2014
@@ -4,7 +4,7 @@
* Created on January 22, 2008, 9:39 AM
*
*/
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import java.util.ArrayList;
import java.util.HashSet;
@@ -29,7 +29,7 @@
public class StraightTrackFinder {
private HitManager _hitmanager;
- private StraightTrackFitter _helixfitter;
+ private StraightTrackFitter _fitter;
private StraightTrackConfirmerExtender _confirmer;
private List<SeedCandidate> _trackseeds;
private ISeedTrackerDiagnostics _diag = null;
@@ -46,10 +46,10 @@
// Save the pointers to the hit manager and helix fitter classes
_hitmanager = hitmanager;
- _helixfitter = helixfitter;
+ _fitter = helixfitter;
// Instantiate the Confirmer/Extender and Seed Candidate merging classes
- _confirmer = new StraightTrackConfirmerExtender(_hitmanager, _helixfitter);
+ _confirmer = new StraightTrackConfirmerExtender(_hitmanager, _fitter);
// Create a list of track seeds that have been found
_trackseeds = new ArrayList<SeedCandidate>();
@@ -142,7 +142,7 @@
System.out.println(this.getClass().getSimpleName() + ": fit the candidate");
// See if we can fit a helix to this seed candidate
- boolean success = _helixfitter.FitCandidate(seed, strategy);
+ boolean success = _fitter.FitCandidate(seed, strategy);
if (!success)
continue;
@@ -151,7 +151,7 @@
System.out.println(this.getClass().getSimpleName() + ": fit success");
// Save the helix fit
- seed.setHelix(_helixfitter.getHelix());
+ seed.setHelix(_fitter.getHelix());
// Check the seed - hook for plugging in external constraint
if (_trackCheck != null)
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackFitter.java (from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackFitter.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackFitter.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackFitter.java Mon Nov 10 18:19:04 2014
@@ -4,13 +4,13 @@
* Created on January 22, 2008, 9:25 AM
*
*/
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import java.util.List;
import java.util.Map;
import org.hps.recon.tracking.MaterialManager;
import org.hps.recon.tracking.MultipleScattering;
-import org.hps.recon.tracking.nobfield.StraightTrack2DFitter.FitStatus;
+import org.hps.recon.tracking.straighttracks.HPSFitter.FitStatus;
import org.lcsim.fit.helicaltrack.HelicalTrackCross;
import org.lcsim.fit.helicaltrack.HelicalTrackFit;
import org.lcsim.fit.helicaltrack.HelicalTrackHit;
@@ -30,7 +30,8 @@
*/
public class StraightTrackFitter {
- private StraightTrack2DFitter _fitter = new StraightTrack2DFitter();
+// private StraightTrack2DFitter _fitter = new StraightTrack2DFitter();
+ private HPSFitter _fitter = new StraightTrack2DFitter();
protected MultipleScattering _scattering;
private HelicalTrackFit _helix;//still use HelicalTrackFit...
private MaterialManager _materialmanager;
@@ -48,6 +49,7 @@
public StraightTrackFitter(MaterialManager materialmanager) {
_materialmanager = materialmanager;
_scattering = new MultipleScattering(_materialmanager);
+ _scattering.fixTrackMomentum(1.0);//fix the track momentum to 1 GeV
}
// public boolean FitCandidate(SeedCandidate seed, SeedStrategy strategy) {
@@ -58,9 +60,9 @@
// Initialize fit results to null objects
_helix = null;
- // Check that we have set the magnetic field
- if (_bfield != 0.)
- throw new RuntimeException("B Field should be zero for the straight track fitter");
+// // Check that we have set the magnetic field
+// if (_bfield != 0.)
+// throw new RuntimeException("B Field should be zero for the straight track fitter");
// Retrieve list of hits to be fit
List<HelicalTrackHit> hitlist = seed.getHits();
@@ -237,6 +239,12 @@
public void setDebug(boolean debug) {
this._debug = debug;
- _scattering.setDebug(true);
- }
+ _scattering.setDebug(debug);
+ }
+
+ public void setFitter(HPSFitter fitter ){
+ System.out.println("Setting fitter to "+fitter.getClass().getSimpleName());
+ _fitter=fitter;
+ }
+
}
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackReconDriver.java (from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackReconDriver.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTrackReconDriver.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTrackReconDriver.java Mon Nov 10 18:19:04 2014
@@ -1,4 +1,4 @@
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import hep.physics.vec.BasicHep3Vector;
import java.util.List;
Copied: java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTracker.java (from r1345, java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTracker.java)
=============================================================================
--- java/trunk/tracking/src/main/java/org/hps/recon/tracking/nobfield/StraightTracker.java (original)
+++ java/trunk/tracking/src/main/java/org/hps/recon/tracking/straighttracks/StraightTracker.java Mon Nov 10 18:19:04 2014
@@ -4,7 +4,7 @@
* Created on August 16, 2005, 8:54 AM
*
*/
-package org.hps.recon.tracking.nobfield;
+package org.hps.recon.tracking.straighttracks;
import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
@@ -29,7 +29,7 @@
/**
* Tracking algorithm based on forming straight track seeds from all 3-hit combinations,
- * confirming this tentantive track by requiring additional hits, and extending
+ * confirming this tenantive track by requiring additional hits, and extending
* the track to additional layers. The operation of the algorithm is controlled
* by a list of SeedStrategy that define the tracker layers to be used and the
* cuts on the tracking algorithm.
@@ -44,7 +44,7 @@
protected ISeedTrackerDiagnostics _diag = null;
protected MaterialManager _materialmanager = new MaterialManager();
protected HitManager _hitmanager;
- protected StraightTrackFitter _helixfitter;
+ protected StraightTrackFitter _fitter;
protected StraightTrackFinder _finder;
protected MakeTracks _maketracks;
protected Hep3Vector _IP = new BasicHep3Vector(0., 0., 0.);
@@ -77,18 +77,18 @@
_strategylist = strategylist;
// Instantiate the hit manager
_hitmanager = new HitManager();
- // Instantiate the material manager for HPS, the helix fitter and seed track finder as tey depends on the material manager
+ // Instantiate the material manager for HPS, the fitter and seed track finder as tey depends on the material manager
if (useHPSMaterialManager) {
MaterialSupervisor materialSupervisor = new MaterialSupervisor(includeMS);
_materialmanager = materialSupervisor;
- _helixfitter = new StraightTrackFitter(materialSupervisor);
+ _fitter = new StraightTrackFitter(materialSupervisor);
} else {
MaterialManager materialmanager = new MaterialManager(includeMS);
_materialmanager = materialmanager; //mess around with types here...
- _helixfitter = new StraightTrackFitter(materialmanager);
+ _fitter = new StraightTrackFitter(materialmanager);
}
// Instantiate the Seed Finder
- _finder = new StraightTrackFinder(_hitmanager, _helixfitter);
+ _finder = new StraightTrackFinder(_hitmanager, _fitter);
// Instantiate the Track Maker
_maketracks = new MakeTracks();
}
@@ -101,7 +101,7 @@
public void setDebug(boolean debug) {
_debug = true;
_materialmanager.setDebug(debug);
- _helixfitter.setDebug(debug);
+ _fitter.setDebug(debug);
_finder.setDebug(debug);
}
@@ -143,7 +143,7 @@
// Perform track finding under this strategy
_finder.FindTracks(strategy, _bfield);
if (_debug)
- System.out.println("In " + this.getClass().getSimpleName() + ": Number of Tracks Found=" + _finder.getTrackSeeds().size());
+ System.out.println("In " + this.getClass().getSimpleName() + ": Number of Tracks Found=" + _finder.getTrackSeeds().size()+" for Strategy = "+strategy.getName());
// Make the timing plots if requested
long time = System.currentTimeMillis();
dtime = ((double) (time - last_time)) / 1000.;
@@ -156,7 +156,7 @@
List<SeedCandidate> trackseeds = _finder.getTrackSeeds();
if (_iterativeConfirmedFits > 0) {
- // Iteratively re-fit tracks to take into account helix and hit position correlations
+ // Iteratively re-fit tracks to take into account and hit position correlations
if (_debug)
System.out.printf("%s: Iteratively improve %d seeds\n", this.getClass().getSimpleName(), trackseeds.size());
List<SeedCandidate> seedsToRemove = new ArrayList<SeedCandidate>();
@@ -164,7 +164,7 @@
SeedStrategy strategy = seed.getSeedStrategy();
boolean success = false;
for (int iterFit = 0; iterFit < _iterativeConfirmedFits; ++iterFit)
- success = _helixfitter.FitCandidate(seed, strategy);
+ success = _fitter.FitCandidate(seed, strategy);
if (!success)
seedsToRemove.add(seed);
// else if (_debug)
@@ -201,17 +201,16 @@
@Override
protected void detectorChanged(Detector detector) {
-
- // Only build the model when the detector is changed
+ // Only build the model when the detector is changed
_materialmanager.buildModel(detector);
- // Find the bfield and pass it to the helix fitter and diagnostic package
+ // Find the bfield and pass it to the fitter and diagnostic package
if (!_forceBField)
_bfield = detector.getFieldMap().getField(_IP).z();
if (_diag != null)
_diag.setBField(_bfield);
- _helixfitter.setBField(_bfield);
+ _fitter.setBField(_bfield);
// Get the tracking radius
_rtrk = _materialmanager.getRMax();
@@ -252,7 +251,7 @@
// Set the diagnostic package
_diag = d;
- _helixfitter.setDiagnostics(_diag);
+ _fitter.setDiagnostics(_diag);
_finder.setDiagnostic(_diag);
// Pass the hit manager, material manager, and bfield to the diagnostic package
@@ -294,7 +293,7 @@
}
public void setReferencePoint(double xref, double yref) {
- _helixfitter.setReferencePoint(xref, yref);
+ _fitter.setReferencePoint(xref, yref);
}
public void setSectorParams(boolean sector) {
@@ -325,5 +324,9 @@
_materialmanager.setDefaultXPlaneUsage(useDefault);
}
+
+ public void setTrackFittingAlgorithm(HPSFitter fitter){
+ _fitter.setFitter(fitter);
+ }
}
Copied: java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Axial.xml (from r1417, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml)
=============================================================================
--- java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml (original)
+++ java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Axial.xml Mon Nov 10 18:19:04 2014
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrategyList xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://lcsim.org/recon/tracking/seedtracker/strategybuilder/strategies.xsd">
<TargetDetector>HPS-Full</TargetDetector>
- <Strategy name="HelicalTrackHit Strategy">
+ <Strategy name="Top Tracks Strategy">
<!--Cutoffs-->
@@ -26,5 +26,32 @@
<Layer type="Extend" layer_number="11" detector_name="Tracker" be_flag="BARREL" />
</Layers>
</Strategy>
+
+ <Strategy name="Bottom Tracks Strategy">
+
+ <!--Cutoffs-->
+
+ <MinPT>0.100</MinPT>
+ <MinHits>5</MinHits>
+ <MinConfirm>1</MinConfirm>
+
+ <MaxDCA>4.0</MaxDCA>
+ <MaxZ0>4.0</MaxZ0>
+
+ <MaxChisq>25.0</MaxChisq>
+ <BadHitChisq>10.0</BadHitChisq>
+
+ <!--Layers-->
+
+ <Layers>
+ <Layer type="Seed" layer_number="6" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Seed" layer_number="4" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Seed" layer_number="2" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Confirm" layer_number="8" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Extend" layer_number="10" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Extend" layer_number="12" detector_name="Tracker" be_flag="BARREL" />
+ </Layers>
+ </Strategy>
+
</StrategyList>
Copied: java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-L1-3.xml (from r1331, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml)
=============================================================================
--- java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml (original)
+++ java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-L1-3.xml Mon Nov 10 18:19:04 2014
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrategyList xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://lcsim.org/recon/tracking/seedtracker/strategybuilder/strategies.xsd">
<TargetDetector>HPS-Full</TargetDetector>
- <Strategy name="HelicalTrackHit Strategy">
+ <Strategy name="Layers 1-3 Tracking">
<!--Cutoffs-->
<MinPT>0.100</MinPT>
- <MinHits>5</MinHits>
- <MinConfirm>1</MinConfirm>
+ <MinHits>3</MinHits>
+ <MinConfirm>0</MinConfirm>
<MaxDCA>4.0</MaxDCA>
<MaxZ0>4.0</MaxZ0>
@@ -20,10 +20,7 @@
<Layers>
<Layer type="Seed" layer_number="5" detector_name="Tracker" be_flag="BARREL" />
<Layer type="Seed" layer_number="3" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Seed" layer_number="1" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Confirm" layer_number="7" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Extend" layer_number="9" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Extend" layer_number="11" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Seed" layer_number="1" detector_name="Tracker" be_flag="BARREL" />
</Layers>
</Strategy>
</StrategyList>
Copied: java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-L4-6.xml (from r1331, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml)
=============================================================================
--- java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml (original)
+++ java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-L4-6.xml Mon Nov 10 18:19:04 2014
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<StrategyList xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://lcsim.org/recon/tracking/seedtracker/strategybuilder/strategies.xsd">
<TargetDetector>HPS-Full</TargetDetector>
- <Strategy name="HelicalTrackHit Strategy">
+ <Strategy name="Layers 4-6 Tracking">
<!--Cutoffs-->
<MinPT>0.100</MinPT>
- <MinHits>5</MinHits>
- <MinConfirm>1</MinConfirm>
+ <MinHits>3</MinHits>
+ <MinConfirm>0</MinConfirm>
- <MaxDCA>4.0</MaxDCA>
- <MaxZ0>4.0</MaxZ0>
+ <MaxDCA>10.0</MaxDCA>
+ <MaxZ0>10.0</MaxZ0>
<MaxChisq>25.0</MaxChisq>
<BadHitChisq>10.0</BadHitChisq>
@@ -18,12 +18,9 @@
<!--Layers-->
<Layers>
- <Layer type="Seed" layer_number="5" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Seed" layer_number="3" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Seed" layer_number="1" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Confirm" layer_number="7" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Extend" layer_number="9" detector_name="Tracker" be_flag="BARREL" />
- <Layer type="Extend" layer_number="11" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Seed" layer_number="11" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Seed" layer_number="9" detector_name="Tracker" be_flag="BARREL" />
+ <Layer type="Seed" layer_number="7" detector_name="Tracker" be_flag="BARREL" />
</Layers>
</Strategy>
</StrategyList>
Copied: java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-StraightTracks.xml (from r1331, java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml)
=============================================================================
--- java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full.xml (original)
+++ java/trunk/tracking/src/main/resources/org/hps/recon/tracking/strategies/HPS-Full-StraightTracks.xml Mon Nov 10 18:19:04 2014
@@ -6,14 +6,14 @@
<!--Cutoffs-->
<MinPT>0.100</MinPT>
- <MinHits>5</MinHits>
- <MinConfirm>1</MinConfirm>
+ <MinHits>4</MinHits>
+ <MinConfirm>0</MinConfirm>
<MaxDCA>4.0</MaxDCA>
<MaxZ0>4.0</MaxZ0>
- <MaxChisq>25.0</MaxChisq>
- <BadHitChisq>10.0</BadHitChisq>
+ <MaxChisq>2500.0</MaxChisq>
+ <BadHitChisq>1000.0</BadHitChisq>
<!--Layers-->
|