diff --git a/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTFactory.java b/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTFactory.java index 066b41051a..9ac753780c 100644 --- a/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTFactory.java +++ b/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTFactory.java @@ -169,6 +169,8 @@ public FMTLayer createLayer(ConstantProvider cp, int sectorId, int superlayerId, layer.getBoundary().addFace(new Triangle3D(pUR, pUL, pLR)); layer.getPlane().set(0, 0, 0, 0, 0, -1); + layer.setRmin(beamHole); + layer.setRmax(rMax); Transformation3D transform = new Transformation3D(); transform.rotateY(Math.toRadians(180)); diff --git a/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTLayer.java b/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTLayer.java index 4eea8c565b..ca082dc735 100644 --- a/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTLayer.java +++ b/common-tools/clas-geometry/src/main/java/org/jlab/geom/detector/fmt/FMTLayer.java @@ -21,6 +21,9 @@ */ public class FMTLayer extends AbstractLayer { + private double rmin; + private double rmax; + protected FMTLayer(int sectorId, int superlayerId, int layerId) { super(DetectorId.FMT, sectorId, superlayerId, layerId, false); } @@ -34,4 +37,37 @@ public String getType() { return "FMT Layer"; } + /** + * Returns the minimum radius + * @return + */ + public double getRmin() { + return rmin; + } + + /** + * Set the minimum radius + * @param rmin + */ + public void setRmin(double rmin) { + this.rmin = rmin; + } + + /** + * Returns the maximum radius + * @return + */ + public double getRmax() { + return rmax; + } + + /** + * Set the maximum radius + * @param rmax + */ + public void setRmax(double rmax) { + this.rmax = rmax; + } + + } diff --git a/etc/bankdefs/hipo4/fmt.json b/etc/bankdefs/hipo4/fmt.json index a1584b3678..449818eec6 100644 --- a/etc/bankdefs/hipo4/fmt.json +++ b/etc/bankdefs/hipo4/fmt.json @@ -14,7 +14,8 @@ {"name":"residual", "type":"F", "info":"fitted hit residual"}, {"name":"adcIndex", "type":"S", "info":"associated adc index"}, {"name":"clusterIndex", "type":"S", "info":"associated cluster index"}, - {"name":"trackIndex", "type":"S", "info":"associated track index"} + {"name":"trackIndex", "type":"S", "info":"associated track index"}, + {"name":"status", "type":"B", "info":"hits status (0==good)"} ] }, { @@ -68,14 +69,14 @@ "info": "reconstructed tracks using FMT information", "entries": [ {"name":"index", "type":"S", "info":"index of the track in the DC bank"}, - {"name":"status", "type":"B", "info":"status of the track (0: not refit using FMT, 1: refit using FMT)"}, + {"name":"status", "type":"B", "info":"status of the track (0: refitted using FMT, 1: original DC track)"}, {"name":"sector", "type":"B", "info":"sector of the track in DC"}, {"name":"Vtx0_x", "type":"F", "info":"Vertex x-position of the swam track to the DOCA to the beamline (in cm)"}, {"name":"Vtx0_y", "type":"F", "info":"Vertex y-position of the swam track to the DOCA to the beamline (in cm)"}, {"name":"Vtx0_z", "type":"F", "info":"Vertex z-position of the swam track to the DOCA to the beamline (in cm)"}, - {"name":"p0_x", "type":"F", "info":"3-momentum x-coordinate of the swam track to the DOCA to the beamline (in cm)"}, - {"name":"p0_y", "type":"F", "info":"3-momentum y-coordinate of the swam track to the DOCA to the beamline (in cm)"}, - {"name":"p0_z", "type":"F", "info":"3-momentum z-coordinate of the swam track to the DOCA to the beamline (in cm)"}, + {"name":"p0_x", "type":"F", "info":"3-momentum x-coordinate of the swam track to the DOCA to the beamline (in GeV)"}, + {"name":"p0_y", "type":"F", "info":"3-momentum y-coordinate of the swam track to the DOCA to the beamline (in GeV)"}, + {"name":"p0_z", "type":"F", "info":"3-momentum z-coordinate of the swam track to the DOCA to the beamline (in GeV)"}, {"name":"q", "type":"B", "info":"charge of the track"}, {"name":"chi2", "type":"F", "info":"chi^2 of the fit"}, {"name":"NDF", "type":"B", "info":"number of degrees of freedom of the fit"} diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java index 19db97f36a..e6330ee504 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java @@ -18,6 +18,7 @@ public class EBUtil { * * FIXME: move float parameters to CCDB */ + @Deprecated public static boolean centralNeutralVeto(DetectorParticle p) { ScintillatorResponse cnd=(ScintillatorResponse)p.getHit(DetectorType.CND); diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java index f880091535..b004327b62 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java @@ -479,9 +479,7 @@ public int bestPidFromTiming(DetectorParticle p) { bestPid = p.getBeta() hitlist) { + public static DataBank fillFMTHitsBank(DataEvent event, List hitlist) { DataBank bank = event.createBank("FMT::Hits", hitlist.size()); for (int i = 0; i < hitlist.size(); i++) { @@ -31,12 +31,14 @@ public static DataBank fillFMTHitsBank(DataEvent event, List hitlist) bank.setShort("adcIndex", i, (short) hitlist.get(i).getIndex()); bank.setShort("clusterIndex", i, (short) hitlist.get(i).getClusterIndex()); bank.setShort("trackIndex", i, (short) hitlist.get(i).getTrackIndex()); + bank.setByte( "status", i, (byte) hitlist.get(i).getStatus()); } return bank; } /** + * @param event * @param cluslist the reconstructed list of fitted clusters in the event * @return clusters bank */ @@ -65,6 +67,7 @@ public static DataBank fillFMTClustersBank(DataEvent event, List clusli /** * + * @param event * @param crosses the reconstructed list of crosses in the event * @return crosses bank */ @@ -127,10 +130,6 @@ private static DataBank fillFMTTrajectoryBank(DataEvent event,List candli bank.setFloat("dy", row, (float) track.getDCTraj(layer).getLocalPosition().y()); bank.setFloat("dz", row, (float) track.getDCTraj(layer).getLocalPosition().z()); } -// else { -// System.out.println(layer + " " + track.toString()); -// event.getBank("TimeBasedTrkg::Trajectory").show(); -// } if(track.getFMTTraj(layer)!=null) { bank.setFloat("x", row, (float) track.getFMTTraj(layer).getPosition().x()); bank.setFloat("y", row, (float) track.getFMTTraj(layer).getPosition().y()); @@ -149,7 +148,7 @@ private static DataBank fillFMTTrajectoryBank(DataEvent event,List candli return bank; } - public static void appendFMTBanks(DataEvent event, List fhits, List clusters, + public static void appendFMTBanks(DataEvent event, List fhits, List clusters, List tracks) { if (event == null) return; diff --git a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/cluster/Cluster.java b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/cluster/Cluster.java index d46a4869ed..246cb51bdb 100755 --- a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/cluster/Cluster.java +++ b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/cluster/Cluster.java @@ -4,7 +4,6 @@ import java.util.List; import org.jlab.geom.prim.Line3D; import org.jlab.geom.prim.Point3D; -import org.jlab.rec.fmt.hit.FittedHit; import org.jlab.rec.fmt.hit.Hit; /** @@ -15,7 +14,7 @@ * @author benkel * @author devita */ -public class Cluster extends ArrayList implements Comparable { +public class Cluster extends ArrayList implements Comparable { private static final long serialVersionUID = 9153980362683755204L; @@ -43,10 +42,8 @@ public class Cluster extends ArrayList implements Comparable /** * - * @param sector the sector * @param layer the layer - * @param cid the cluster ID, an incremental integer corresponding to the - * cluster formed in the series of clusters + * @param index */ public Cluster(int layer, int index) { this._Layer = layer; @@ -64,7 +61,7 @@ public int getLayer() { /** * - * @param _Superlayer the layer of the cluster (1...6) + * @param _Layer */ public void setLayer(int _Layer) { this._Layer = _Layer; @@ -117,7 +114,7 @@ public double getCentroidResidual() { public void setCentroidResidual(double trackLocalY) { this._CentroidResidual = this._Centroid-trackLocalY; - for(FittedHit hit : this) hit.setResidual(trackLocalY); + for(Hit hit : this) hit.setResidual(trackLocalY); } public double getTotalEnergy() { @@ -214,14 +211,14 @@ public int getTrackIndex() { public void setTrackIndex(int _AssociatedTrackIndex) { this._AssociatedTrackIndex = _AssociatedTrackIndex; - for(FittedHit hit: this) hit.setTrackIndex(_AssociatedTrackIndex); + for(Hit hit: this) hit.setTrackIndex(_AssociatedTrackIndex); } - private boolean containsHit(FittedHit hit) { + private boolean containsHit(Hit hit) { boolean addFlag = false; if(hit.getLayer()==this.getLayer()) { - for(int j = 0; j< this.size(); j++) { - if(this.get(j).isClose(hit)) { + for (Hit aThi : this) { + if (aThi.isClose(hit)) { addFlag = true; break; } @@ -232,10 +229,10 @@ private boolean containsHit(FittedHit hit) { public static ArrayList findClusters(List hits) { - ArrayList clusters = new ArrayList(); + ArrayList clusters = new ArrayList<>(); - for(int ihit=0; ihit findClusters(List hits) { /** * Sets energy-weighted parameters; these are the strip centroid - * (energy-weighted) value, the energy-weighted phi for Z detectors and the - * energy-weighted z for C detectorsting + * (energy-weighted) value * @param eweight set to true for energy weighting */ public void calc_CentroidParams(boolean eweight) { @@ -295,14 +291,11 @@ public void calc_CentroidParams(boolean eweight) { if (nbhits != 0) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; - int seed = -1; - double Emax = -1; - double Time = -1; - double Error = 0; + Hit seed = null; // looping over the number of hits in the cluster for (int i = 0; i < nbhits; i++) { - FittedHit thehit = this.get(i); + Hit thehit = this.get(i); // get the energy value of the strip double strpEn = thehit.getEnergy(); @@ -382,27 +375,25 @@ public void calc_CentroidParams(boolean eweight) { double delta = Double.POSITIVE_INFINITY; for (int i = 0; i < nbhits; i++) { - FittedHit thehit = this.get(i); + Hit thehit = this.get(i); if(Math.abs(thehit.getStrip()-stripNumCent) implements Comparable { /** * - * @param sector the sector (1) * @param region the region (1...3) - * @param rid the cross ID (if there are only 3 crosses in the event, the ID - * corresponds to the region index + * @param index */ public Cross(int region, int index) { this._Region = region; @@ -74,7 +72,7 @@ public int getIndex() { /** * Sets the cross ID * - * @param _Id the id of the cross + * @param index */ public void setIndex(int index) { this._Index = index; @@ -250,7 +248,7 @@ public void setAssociatedElementsIDs() { cluster.setCrossIndex(this._Index); cluster.setTrackIndex(this._TrackIndex); - for (FittedHit hit : cluster) { + for (Hit hit : cluster) { hit.setClusterIndex(cluster.getIndex()); hit.setCrossIndex(this._Index); hit.setTrackIndex(this._TrackIndex); diff --git a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/FittedHit.java b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/FittedHit.java deleted file mode 100755 index 468f654c20..0000000000 --- a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/FittedHit.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jlab.rec.fmt.hit; - -/** - * A hit that was used in a fitted track. - * - * @author ziegler - * @author benkel - * @author devita -*/ - -public class FittedHit extends Hit implements Comparable { - - /** - * @param index - * @param layer (1...6) - * @param strip (1...1024) - * @param time - * @param energy - */ - - public FittedHit(int index, int layer, int strip, double energy, double time) { - super(index, layer, strip, energy, time); - } - - public FittedHit(Hit hit) { - super(hit.getIndex(), hit.getLayer(), hit.getStrip(), hit.getEnergy(), hit.getTime()); - } - - private double _residual; // distance to track intersect - private int _TrkgStatus = -1 ; // TrkgStatusFlag factor (-1: no fit; 0: global helical fit; 1: KF fit) - - private int _AssociatedCrossIndex = -1; - private int _AssociatedTrackIndex = -1; - - public double getdocaToTrk() { - return _residual; - } - - public void setdocaToTrk(double _docaToTrk) { - this._residual = _docaToTrk; - } - - /** - * - * @return an integer representative of the stage of the pattern recognition and subsequent KF - * fit for that hit. -1: no fit; 0: global helical fit; 1: KF fit - */ - public int getTrkgStatus() { - return _TrkgStatus; - } - - /** - * @param trkgStatus is an integer representative of the stage of the pattern recognition and subsequent KF fit - * for that hit. -1: no fit; 0: global helical fit; 1: KF fit - * - */ - public void setTrkgStatus(int trkgStatus) { - _TrkgStatus = trkgStatus; - } - - /** - * - * @param arg0 the other hit - * @return an int used to sort a collection of hits by layer number - */ - public int compareTo(FittedHit arg0) { - if (this.getLayer() > arg0.getLayer()) return 1; - else return 0; - } - - public double getResidual() { - return this._residual; - } - - public void setResidual(double trackLocalY) { - this._residual = this.getStripLocalSegment().origin().y()-trackLocalY; - } - - public int getCrossIndex() { - return _AssociatedCrossIndex; - } - - public void setCrossIndex(int _AssociatedCrossIndex) { - this._AssociatedCrossIndex = _AssociatedCrossIndex; - } - - public int getTrackIndex() { - return _AssociatedTrackIndex; - } - - public void setTrackIndex(int _AssociatedTrackIndex) { - this._AssociatedTrackIndex = _AssociatedTrackIndex; - } -} diff --git a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/Hit.java b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/Hit.java index bd58f4d0c7..a6549493f1 100755 --- a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/Hit.java +++ b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/hit/Hit.java @@ -22,18 +22,22 @@ // Class implements Comparable interface to allow for sorting a collection of hits by wire numbers public class Hit implements Comparable { - private int _Layer; // layer [1,...6] - private int _Strip; // strip [1...1024] + private int _Layer; // layer [1,...6] + private int _Strip; // strip [1...1024] + + private int _Status; // 0 good, 1 bad energy, 2, bad time, 3 dead + private double _Energy; + private double _Time; + private double _Error; + private Line3D _LocalSegment = null; // The geometry segment representing the strip position in the local frame + private Line3D _GlobalSegment = null; // The geometry segment representing the strip position in the global frame + private int _Index; // Hit index + private int _ClusterIndex = -1; // Cluster index + private int _CrossIndex = -1; // Cross index + private int _TrackIndex = -1; // Track index + private double _residual; // distance to track intersect - private double _Energy; // Reconstructed time, for now it is the gemc time - private double _Time; // Hit time - private double _Error; // Hit time - private Line3D _LocalSegment; // The geometry segment representing the strip position in the local frame - private Line3D _GlobalSegment; // The geometry segment representing the strip position in the global frame - private int _Index; // Hit Id - private int _ClusterIndex = -1; - /** * @param index * @param layer @@ -48,12 +52,6 @@ public Hit(int index, int layer, int strip, double energy, double time) { this._Energy = energy; this._Time = time; this._Error = Constants.getPitch()/Math.sqrt(12); - -// double x0 = Constants.FVT_stripsX[layer - 1][strip - 1][0]; -// double x1 = Constants.FVT_stripsX[layer - 1][strip - 1][1]; -// double y0 = Constants.FVT_stripsY[layer - 1][strip - 1][0]; -// double y1 = Constants.FVT_stripsY[layer - 1][strip - 1][1]; -// double z = Geometry.getLayerZ(layer - 1); this._GlobalSegment = Constants.getStrip(layer, strip); this._LocalSegment = Constants.getLocalStrip(layer, strip); } @@ -174,6 +172,37 @@ public double getDoca(double x, double y, double z) { return _GlobalSegment.distance(trkPoint).length(); } + public int getStatus() { + return _Status; + } + + public void setStatus(int _Status) { + this._Status = _Status; + } + + public double getResidual() { + return this._residual; + } + + public void setResidual(double trackLocalY) { + this._residual = this.getStripLocalSegment().origin().y()-trackLocalY; + } + + public int getCrossIndex() { + return _CrossIndex; + } + + public void setCrossIndex(int crossIndex) { + this._CrossIndex = crossIndex; + } + + public int getTrackIndex() { + return _TrackIndex; + } + + public void setTrackIndex(int _AssociatedTrackIndex) { + this._TrackIndex = _AssociatedTrackIndex; + } /** * * @param arg the other hit @@ -228,13 +257,16 @@ public void setClusterIndex(int _AssociatedClusterIndex) { this._ClusterIndex = _AssociatedClusterIndex; } - public static List fetchHits(DataEvent event, IndexedTable statuses) { + public static List fetchHits(DataEvent event, IndexedTable timecuts, IndexedTable statuses) { + + List hits = new ArrayList<>(); - List hits = new ArrayList(); + double tmin = timecuts.getDoubleValue("hit_min", 0, 0, 0); + double tmax = timecuts.getDoubleValue("hit_max", 0, 0, 0); if (event.hasBank("FMT::adc")) { DataBank bankDGTZ = event.getBank("FMT::adc"); - int rows = bankDGTZ.rows();; + int rows = bankDGTZ.rows(); for (int i = 0; i < rows; i++) { int sector = bankDGTZ.getByte("sector", i); int layer = bankDGTZ.getByte("layer", i); @@ -246,14 +278,18 @@ public static List fetchHits(DataEvent event, IndexedTable statuses) { Hit hit = new Hit(i, layer, strip, (double) ADC, time); - int status = statuses.getIntValue("status", sector, layer, strip); - if(status==0) hits.add(hit); + hit.setStatus(statuses.getIntValue("status", sector, layer, strip)); + + if(time!=0 && (timetmax)) hit.setStatus(2); // exclude time==0 hits for MC + + hits.add(hit); } } Collections.sort(hits); return hits; } + /** * * @return print statement with hit information diff --git a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/Track.java b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/Track.java index 2b1d921bc0..4b6bb58d2a 100644 --- a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/Track.java +++ b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/Track.java @@ -5,8 +5,9 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.jlab.detector.base.DetectorType; +import org.jlab.clas.swimtools.Swim; import org.jlab.geom.prim.Line3D; +import org.jlab.geom.prim.Vector3D; import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.fmt.Constants; @@ -43,9 +44,9 @@ public class Track { private double _pz; private int _NDF; - private Trajectory[] _DCtrajs = new Trajectory[Constants.NLAYERS]; - private List[] _clusters = new ArrayList[Constants.NLAYERS]; - private Trajectory[] _FMTtrajs = new Trajectory[Constants.NLAYERS]; + private final Trajectory[] _DCtrajs = new Trajectory[Constants.NLAYERS]; + private final List[] _clusters = new ArrayList[Constants.NLAYERS]; + private final Trajectory[] _FMTtrajs = new Trajectory[Constants.NLAYERS]; public Track() { } @@ -68,6 +69,7 @@ public Track(int _index, int _sector, int _q, double _x, double _y, double _z, /** + * @param layer * @return the _traj */ public Trajectory getDCTraj(int layer) { @@ -76,7 +78,7 @@ public Trajectory getDCTraj(int layer) { } /** - * @param _traj the _traj to set + * @param trj */ public void setDCTraj(Trajectory trj) { this._DCtrajs[trj.getLayer()-1] = trj; @@ -114,7 +116,7 @@ public int getClusterLayer(int layer) { else return 0; } - public void addCluster(Cluster cluster) { + public final void addCluster(Cluster cluster) { if(this._clusters[cluster.getLayer()-1]==null) this._clusters[cluster.getLayer()-1] = new ArrayList<>(); this._clusters[cluster.getLayer()-1].add(cluster); @@ -255,6 +257,13 @@ public void setZ(double _z) { this._z = _z; } + /** + * @return the the tracke momentum + */ + public double getP() { + return Math.sqrt(_px*_px+_py*_py+_pz*_pz); + } + /** * @return the _px */ @@ -360,7 +369,7 @@ public void filterClusters(int mode) { } } - public static List getDCTracks(DataEvent event) { + public static List getDCTracks(DataEvent event, Swim swimmer) { Map trackmap = new LinkedHashMap(); @@ -368,7 +377,7 @@ public static List getDCTracks(DataEvent event) { DataBank trajBank = null; if(event.hasBank("TimeBasedTrkg::TBTracks")) trackBank = event.getBank("TimeBasedTrkg::TBTracks"); if(event.hasBank("TimeBasedTrkg::Trajectory")) trajBank = event.getBank("TimeBasedTrkg::Trajectory"); - if (trackBank!=null && trajBank!=null) { + if (trackBank!=null) { for (int i = 0; i < trackBank.rows(); i++) { Track trk = new Track(); @@ -383,23 +392,42 @@ public static List getDCTracks(DataEvent event) { trk.setPx(trackBank.getFloat("p0_x", i)); trk.setPy(trackBank.getFloat("p0_y", i)); trk.setPz(trackBank.getFloat("p0_z", i)); + trk.setStatus(1); trackmap.put(id,trk); - } - for (int i = 0; i < trajBank.rows(); i++) { - if (trajBank.getByte("detector", i) == DetectorType.FMT.getDetectorId()) { - int id = trajBank.getShort("id", i); - int layer = trajBank.getByte("layer", i); - Trajectory trj = new Trajectory(layer, - trajBank.getFloat("x", i), - trajBank.getFloat("y", i), - trajBank.getFloat("z", i), - trajBank.getFloat("tx", i), - trajBank.getFloat("ty", i), - trajBank.getFloat("tz", i), - trajBank.getFloat("path", i)); - trackmap.get(id).setDCTraj(trj); + + for(int j=0; j tracks = new ArrayList<>(); for(Entry entry: trackmap.entrySet()) { @@ -408,6 +436,21 @@ public static List getDCTracks(DataEvent event) { return tracks; } + private static double[] getTrajectory(double x, double y, double z, double px, double py, double pz, + int q, int layer, Swim swim) { + Vector3D p = Constants.getLayer(layer).getPlane().point().toVector3D(); + Vector3D n = Constants.getLayer(layer).getPlane().normal(); + Vector3D v = new Vector3D(x, y, z); + double d = p.dot(n); + if(v.dot(n) clusters) { - measurements = new ArrayList(); + measurements = new ArrayList<>(); for (int i = 0; i < clusters.size(); i++) { int l = clusters.get(i).getLayer()-1; @@ -42,8 +42,7 @@ public void setMeasVecs(List clusters) { double error = clusters.get(i).getCentroidError(); double z = clusters.get(i).getGlobalSegment().origin().z(); int seed = clusters.get(i).getSeedStrip(); - MeasVec meas = new MeasVec(); - meas = this.setMeasVec(l, cent, error, z, seed); + MeasVec meas = this.setMeasVec(l, cent, error, z, seed); measurements.add(meas); } } diff --git a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/RungeKutta.java b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/RungeKutta.java index 09a7496e6b..809acc4fde 100644 --- a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/RungeKutta.java +++ b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/RungeKutta.java @@ -21,14 +21,14 @@ public class RungeKutta { private final ArrayList jk4; public RungeKutta() { - this.k1 = new ArrayList(4); - this.k2 = new ArrayList(4); - this.k3 = new ArrayList(4); - this.k4 = new ArrayList(4); - this.jk1 = new ArrayList(12); - this.jk2 = new ArrayList(12); - this.jk3 = new ArrayList(12); - this.jk4 = new ArrayList(12); + this.k1 = new ArrayList<>(4); + this.k2 = new ArrayList<>(4); + this.k3 = new ArrayList<>(4); + this.k4 = new ArrayList<>(4); + this.jk1 = new ArrayList<>(12); + this.jk2 = new ArrayList<>(12); + this.jk3 = new ArrayList<>(12); + this.jk4 = new ArrayList<>(12); } public void SwimToZ(int sector, StateVecs.StateVec fVec, Swim dcSwim, double z0, float[] bf){ diff --git a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/StateVecs.java b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/StateVecs.java index eaa9daceb5..620faf7214 100644 --- a/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/StateVecs.java +++ b/reconstruction/fmt/src/main/java/org/jlab/rec/fmt/track/fit/StateVecs.java @@ -11,7 +11,7 @@ * @author ziegler */ public class StateVecs { - private double Bmax = 2.366498; // averaged + private final double Bmax = 2.366498; // averaged final double speedLight = 0.002997924580; public double[] Z; @@ -21,17 +21,18 @@ public class StateVecs { public StateVec StateVec; public CovMat CovMat; public Matrix F = new Matrix(); - private Matrix fMS = new Matrix(); - private Matrix copyMatrix = new Matrix(); + private final Matrix fMS = new Matrix(); + private final Matrix copyMatrix = new Matrix(); private final double[] A = new double[2]; private final double[] dA = new double[4]; private final float[] bf = new float[3]; private final float[] lbf = new float[3]; - private Swim dcSwim; - private RungeKutta rk; + private final Swim dcSwim; + private final RungeKutta rk; /** * State vector representing the track in the sector coordinate system at the measurement layer + * @param swimmer */ public StateVecs(Swim swimmer) { dcSwim = swimmer; @@ -40,10 +41,12 @@ public StateVecs(Swim swimmer) { /** * + * @param sector * @param i initial state vector index - * @param f final state vector index + * @param Zf * @param iVec state vector at the initial index * @param covMat state covariance matrix at the initial index + * @return */ public Matrix transport(int sector, int i, double Zf, StateVec iVec, CovMat covMat) { // s = signed step-size double stepSize = 1.0; @@ -122,6 +125,7 @@ public Matrix transport(int sector, int i, double Zf, StateVec iVec, CovMat covM /** * + * @param sector * @param i initial state vector index * @param f final state vector index * @param iVec state vector at the initial index @@ -313,9 +317,17 @@ public void setMass(int hypo, double mass) { /** * - * @param trkcand the track candidate + * @param sector + * @param xVtx + * @param yVtx + * @param zVtx * @param z0 the value in z to which the track is swam back to + * @param pyVtx + * @param pzVtx + * @param q * @param kf the final state measurement index + * @param pxVtx + * @param c */ public void init(int sector, double xVtx, double yVtx, double zVtx, double pxVtx, double pyVtx, double pzVtx, diff --git a/reconstruction/fmt/src/main/java/org/jlab/service/fmt/FMTEngine.java b/reconstruction/fmt/src/main/java/org/jlab/service/fmt/FMTEngine.java index 8e9d567da6..162b04f416 100644 --- a/reconstruction/fmt/src/main/java/org/jlab/service/fmt/FMTEngine.java +++ b/reconstruction/fmt/src/main/java/org/jlab/service/fmt/FMTEngine.java @@ -1,6 +1,5 @@ package org.jlab.service.fmt; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -14,7 +13,6 @@ import org.jlab.rec.fmt.banks.RecoBankWriter; import org.jlab.rec.fmt.cluster.Cluster; -import org.jlab.rec.fmt.hit.FittedHit; import org.jlab.rec.fmt.hit.Hit; import org.jlab.rec.fmt.track.Track; import org.jlab.rec.fmt.track.Trajectory; @@ -29,7 +27,6 @@ public class FMTEngine extends ReconstructionEngine { boolean debug = false; - boolean alreadyDroppedBanks = false; public FMTEngine() { super("FMT", "ziegler", "5.0"); @@ -52,6 +49,7 @@ public boolean init() { String[] tables = new String[]{ "/geometry/beam/position", + "/calibration/mvt/fmt_time", "/calibration/mvt/fmt_status" }; requireConstants(Arrays.asList(tables)); @@ -99,27 +97,20 @@ public boolean processDataEvent(DataEvent event) { // get status table IndexedTable status = this.getConstantsManager().getConstants(run, "/calibration/mvt/fmt_status"); + // get time table + IndexedTable timecuts = this.getConstantsManager().getConstants(run, "/calibration/mvt/fmt_time"); + // === HITS ================================================================================ - List hits = Hit.fetchHits(event, status); - if (hits.size() == 0) return true; + List hits = Hit.fetchHits(event, timecuts, status); + if (hits.isEmpty()) return true; // === CLUSTERS ============================================================================ List clusters = Cluster.findClusters(hits); if(debug) for (int i = 0; i < clusters.size(); i++) System.out.println(clusters.get(i).toString()); - - // === FITTED HITS ========================================================================= - List fittedhits = new ArrayList(); - for (int i = 0; i < clusters.size(); i++) fittedhits.addAll(clusters.get(i)); - // set cluster seed indices - for(int i=0; i tracks = Track.getDCTracks(event); - if(tracks.size()==0) return true; + List tracks = Track.getDCTracks(event, swimmer); + if(tracks.isEmpty()) return true; // === SEEDS ============================================================================= for(int i=0; i trackClusters = track.getClusters(); - if (trackClusters.isEmpty()) continue; + + if (trackClusters.size()<2) continue; kf = new KFitter(track, swimmer, 0); kf.runFitter(track.getSector()); @@ -216,7 +208,7 @@ public boolean processDataEvent(DataEvent event) { // if successful, save track parameters if(Vt == null || Vt[6]