Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.ejml.interfaces.linsol.LinearSolverDense;
import org.hps.util.Pair;

import org.lcsim.event.TrackerHit;

/**
* Track followed and fitted by the Kalman filter
*/
Expand Down Expand Up @@ -138,6 +140,7 @@ public class KalTrack {
Cp = null;
// Fill the maps
time = 0.;
double terr = 0.0;
tMin = 9.9e9;
tMax = -9.9e9;
this.chi2 = 0.;
Expand All @@ -150,15 +153,17 @@ public class KalTrack {
continue;
}
nHits++;
time += site.m.hits.get(site.hitID).time;
double hTV = site.m.hits.get(site.hitID).timeErr;
time += site.m.hits.get(site.hitID).time/hTV;
terr += 1.0/hTV;
tMin = Math.min(tMin, site.m.hits.get(site.hitID).time);
tMax = Math.max(tMax, site.m.hits.get(site.hitID).time);
this.chi2 += site.chi2inc;
if (debug) {
System.out.format(" Layer %d, chi^2 increment=%10.5f, a=%s\n", site.m.Layer, site.chi2inc, site.aS.helix.a.toString());
}
}
time = time / (double) nHits;
time = time / terr;
reducedChi2 = chi2 / (double) nHits;
lyrMap = null;
millipedeMap = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@
import org.lcsim.geometry.IDDecoder;
import org.lcsim.recon.tracking.digitization.sisim.SiTrackerHitStrip1D;
import org.lcsim.recon.tracking.digitization.sisim.TrackerHitType;
import org.hps.recon.tracking.FittedRawTrackerHit;
import org.hps.recon.tracking.ShaperFitAlgorithm;
import org.hps.recon.tracking.ShaperPileupFitAlgorithm;
import org.hps.recon.tracking.PulseShape;
import org.hps.recon.tracking.ShapeFitParameters;

import org.hps.conditions.database.DatabaseConditionsManager;
import org.hps.conditions.svt.SvtSyncStatus.SvtSyncStatusCollection;
import org.hps.conditions.svt.SvtTimingConstants;
import org.hps.readout.ecal.ReadoutTimestamp;
import org.hps.readout.svt.HPSSVTConstants;
import org.hps.recon.ecal.cluster.TriggerTime;
import org.lcsim.detector.tracker.silicon.HpsSiSensor;
import org.lcsim.event.EventHeader;
import org.lcsim.event.RawTrackerHit;
import org.lcsim.geometry.Detector;
import org.lcsim.lcio.LCIOConstants;
import org.lcsim.recon.cat.util.Const;
import org.lcsim.util.Driver;

/**
* This class provides an interface between hps-java and the Kalman Filter fitting and pattern recognition code.
Expand Down Expand Up @@ -1058,7 +1077,24 @@ private boolean fillAllMeasurements(EventHeader event) {
globalX.print("globalX");
globalY.print("globalY");
}
Measurement m = new Measurement(umeas, xStrip, du, time, localHit.getdEdx()*1000000.);
List<RawTrackerHit> rawhits = hit.getRawHits();
ShaperFitAlgorithm fitter = new ShaperPileupFitAlgorithm(.5,1);
PulseShape shape = new PulseShape.FourPole();
fitter.setRunNum(event.getRunNumber());
double Variance=0.0;
for(RawTrackerHit rth: rawhits){
double Min = 10000;
for(ShapeFitParameters fit : fitter.fitShape(rth, shape)){
if(fit.getT0Err()<Min){
Min=fit.getT0Err();
}
}
if(module.Layer>1){
Variance+=1/(Min*Min);
}
}
Variance=1.0/Variance;
Measurement m = new Measurement(umeas, xStrip, du, time, localHit.getdEdx()*1000000.,Variance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really, this should be done in clustering but SiTrackerHit doesn't have a place for the error on the time. We do extend SiTrackerHit in hps-java at org.hps.recon.tracking.SiTrackerHitStrip1D and we could put the error in there but it wouldn't be saved to the LCIO. For now this is ok...I think we have some other changes to LCIO/lcsim we need to make so we should put this on the list.

module.addMeasurement(m);
hitMap.put(m, hit);
hitsFilled++;
Expand Down Expand Up @@ -1159,7 +1195,7 @@ private double fillMeasurements(List<TrackerHit> hits1D, int addMode) {
globalX.print("globalX");
globalY.print("globalY");
}
Measurement m = new Measurement(umeas, xStrip, du, 0., hit.getdEdx()*1000000.);
Measurement m = new Measurement(umeas, xStrip, du, 0., hit.getdEdx()*1000000.,1.0);

KalHit hitPair = new KalHit(mod,m);
trackHitsKalman.add(hitPair);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Measurement { //
double x; // X of the center of the strip in the detector frame
double sigma; // Measurement uncertainty
double time; // Time of the hit in ns
double timeErr; // Standard deviation of time measurement.
double energy; // Energy deposited in the silicon
double vTrue; // MC truth measurement value
Vec rGlobal; // Global MC truth
Expand All @@ -28,6 +29,19 @@ class Measurement { //
tksMC = null;
}

Measurement(double value, double xStrip, double resolution, double t, double E, double terr) {
v = value;
x = xStrip;
sigma = resolution;
time = t;
timeErr = terr;
energy = E;
tracks = new ArrayList<KalTrack>();
vTrue = 0.;
rGlobal = null;
tksMC = null;
}

Measurement(double value, double xStrip, double resolution, double t, double E, Vec rGlobal, double vTrue) {
v = value;
x = xStrip;
Expand Down