Commit in hps-java/src/main/java/org/lcsim/hps on MAIN | |||
recon/tracking/HPSRawTrackerHitFitterDriver.java | +13 | 1.19 -> 1.20 | |
/SvtTrackExtrapolator.java | +1 | -1 | 1.8 -> 1.9 |
recon/tracking/gbl/GBLOutput.java | +39 | -16 | 1.12 -> 1.13 |
/TruthResiduals.java | +15 | -7 | 1.5 -> 1.6 |
users/phansson/TwoTrackAnlysis.java | +1 | -1 | 1.20 -> 1.21 |
+69 | -25 |
Cleaning up truth handling and adding get functions for truth test.
diff -u -r1.19 -r1.20 --- HPSRawTrackerHitFitterDriver.java 3 May 2013 23:18:56 -0000 1.19 +++ HPSRawTrackerHitFitterDriver.java 11 Oct 2013 22:18:52 -0000 1.20 @@ -2,9 +2,12 @@
import java.util.ArrayList; import java.util.List;
+
import org.lcsim.detector.tracker.silicon.SiSensor; import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.SimTrackerHit;
import org.lcsim.hps.readout.ecal.ReadoutTimestamp; import org.lcsim.hps.recon.tracking.HPSSVTCalibrationConstants.ChannelConstants; import org.lcsim.util.Driver;
@@ -81,6 +84,16 @@
// Make a fitted hit from this cluster for (RawTrackerHit hit : rawHits) {
+ if(this.debug) { + if(hit.getSimTrackerHits() == null) System.out.printf("%s: raw hit has NO simhit \n",this.getClass()); + else { + for(SimTrackerHit shit: hit.getSimTrackerHits()) { + MCParticle mpc = shit.getMCParticle(); + if( mpc != null) System.out.printf("%s: raw hit has simhit at %s and mcp with pdgid %d \n",this.getClass().getSimpleName(), shit.getPositionVec().toString(),mpc.getPDGID()); + else System.out.printf("%s: raw hit has simhit but no mcp \n",this.getClass().getSimpleName(), shit.getPositionVec().toString()); + } + } + }
int strip = hit.getIdentifierFieldValue("strip"); ChannelConstants constants = HPSSVTCalibrationConstants.getChannelConstants((SiSensor) hit.getDetectorElement(), strip); HPSShapeFitParameters fit = _shaper.fitShape(hit, constants);
diff -u -r1.8 -r1.9 --- SvtTrackExtrapolator.java 11 Oct 2013 02:23:59 -0000 1.8 +++ SvtTrackExtrapolator.java 11 Oct 2013 22:18:52 -0000 1.9 @@ -10,7 +10,7 @@
public class SvtTrackExtrapolator { boolean isTrackSet = false;
- TrackUtils trackUtils = new TrackUtils();
+ private TrackUtils trackUtils = new TrackUtils();
public static final double ECAL_FACE = 1524; // mm public static final double DIPOLE_EDGE = 457.2 + 457.2; // 452.2 + 462.2; //914; // mm
diff -u -r1.12 -r1.13 --- GBLOutput.java 17 Sep 2013 00:52:52 -0000 1.12 +++ GBLOutput.java 11 Oct 2013 22:18:52 -0000 1.13 @@ -8,26 +8,38 @@
import hep.physics.matrix.Matrix; import hep.physics.matrix.MatrixOp; import hep.physics.matrix.SymmetricMatrix;
-import hep.physics.vec.*;
+import hep.physics.vec.BasicHep3Matrix; +import hep.physics.vec.BasicHep3Vector; +import hep.physics.vec.Hep3Matrix; +import hep.physics.vec.Hep3Vector; +import hep.physics.vec.VecOp;
-import java.io.FileWriter; -import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap; import java.util.List; import java.util.Map; import org.lcsim.constants.Constants;
-import org.lcsim.event.*; -import org.lcsim.fit.helicaltrack.*;
+import org.lcsim.event.MCParticle; +import org.lcsim.event.RawTrackerHit; +import org.lcsim.event.SimTrackerHit; +import org.lcsim.event.Track; +import org.lcsim.event.TrackerHit; +import org.lcsim.fit.helicaltrack.HelicalTrackCross; +import org.lcsim.fit.helicaltrack.HelicalTrackFit; +import org.lcsim.fit.helicaltrack.HelicalTrackHit; +import org.lcsim.fit.helicaltrack.HelicalTrackStrip; +import org.lcsim.fit.helicaltrack.HelixUtils;
import org.lcsim.geometry.Detector; import org.lcsim.hps.event.HPSTransformations;
-import org.lcsim.hps.recon.tracking.*;
+import org.lcsim.hps.recon.tracking.MaterialSupervisor;
import org.lcsim.hps.recon.tracking.MaterialSupervisor.DetectorPlane; import org.lcsim.hps.recon.tracking.MaterialSupervisor.ScatteringDetectorVolume;
+import org.lcsim.hps.recon.tracking.MultipleScattering;
import org.lcsim.hps.recon.tracking.MultipleScattering.ScatterPoint; import org.lcsim.hps.recon.tracking.MultipleScattering.ScatterPoints;
+import org.lcsim.hps.recon.tracking.TrackUtils; +import org.lcsim.hps.recon.tracking.TrackerHitUtils;
import org.lcsim.recon.tracking.seedtracker.ScatterAngle; import org.lcsim.recon.tracking.seedtracker.SeedCandidate; import org.lcsim.recon.tracking.seedtracker.SeedTrack;
@@ -111,14 +123,19 @@
MCParticle mcp = getMatchedTruthParticle(trk); if(mcp==null) {
- System.out.printf("%s: no truth particle found!\n",this.getClass().getSimpleName());
+ System.out.printf("%s: no truth particle found in event!\n",this.getClass().getSimpleName());
+ this.printMCParticles(mcParticles);
System.exit(1);
+ return; + } else { + System.out.printf("%s: truth particle (pdgif %d ) found in event!\n",this.getClass().getSimpleName(),mcp.getPDGID());
} if(AprimeEvent ) {
- checkAprimeTruth(mcp,mcParticles);
+ if( mcp != null) { + checkAprimeTruth(mcp,mcParticles); + }
}
-
// Get track parameters from MC particle HelicalTrackFit htfTruth = TrackUtils.getHTF(mcp,-1.0*this._B.z());
@@ -390,11 +407,12 @@
MCParticle getMatchedTruthParticle(Track track) {
- boolean debug = false;
+ boolean debug = true;
Map<MCParticle,Integer> particlesOnTrack = new HashMap<MCParticle,Integer>();
- if(debug) System.out.printf("getmatched\n");
+ if(debug) System.out.printf("getmatched mc particle from %d tracker hits on the track \n",track.getTrackerHits().size()); +
for(TrackerHit hit : track.getTrackerHits()) { List<MCParticle> mcps = ((HelicalTrackHit)hit).getMCParticles();
@@ -402,6 +420,7 @@
System.out.printf("%s: warning, this hit (layer %d pos=%s) has no mc particles.\n",this.getClass().getSimpleName(),((HelicalTrackHit)hit).Layer(),((HelicalTrackHit)hit).getCorrectedPosition().toString()); } else {
+ if( debug ) System.out.printf("%s: this hit (layer %d pos=%s) has %d mc particles.\n",this.getClass().getSimpleName(),((HelicalTrackHit)hit).Layer(),((HelicalTrackHit)hit).getCorrectedPosition().toString(),mcps.size());
for(MCParticle mcp : mcps) { if( !particlesOnTrack.containsKey(mcp) ) { particlesOnTrack.put(mcp, 0);
@@ -427,11 +446,15 @@
//maxEntry = entry; } if(debug) {
- System.out.printf("Matched particle with pdgId=%d and mom %s to track with charge %d and momentum [%f %f %f]\n", - maxEntry.getKey().getPDGID(),maxEntry.getKey().getMomentum().toString(), - track.getCharge(),track.getTrackStates().get(0).getMomentum()[0],track.getTrackStates().get(0).getMomentum()[1],track.getTrackStates().get(0).getMomentum()[2]);
+ if (maxEntry != null ) { + System.out.printf("Matched particle with pdgId=%d and mom %s to track with charge %d and momentum [%f %f %f]\n", + maxEntry.getKey().getPDGID(),maxEntry.getKey().getMomentum().toString(), + track.getCharge(),track.getTrackStates().get(0).getMomentum()[0],track.getTrackStates().get(0).getMomentum()[1],track.getTrackStates().get(0).getMomentum()[2]); + } else { + System.out.printf("No truth particle found on this track\n"); + }
}
- return maxEntry.getKey();
+ return maxEntry == null ? null : maxEntry.getKey();
}
diff -u -r1.5 -r1.6 --- TruthResiduals.java 11 Oct 2013 00:07:24 -0000 1.5 +++ TruthResiduals.java 11 Oct 2013 22:18:52 -0000 1.6 @@ -5,6 +5,7 @@
package org.lcsim.hps.recon.tracking.gbl; import hep.aida.IAnalysisFactory;
+import hep.aida.IHistogram;
import hep.aida.IHistogram1D; import hep.aida.IHistogram2D; import hep.aida.IHistogramFactory;
@@ -32,7 +33,7 @@
public class TruthResiduals { private int _debug;
- private boolean _hideFrame = false;
+ private boolean _hideFrame = true;
private Hep3Vector _B; private HPSTransformations _hpstrans = new HPSTransformations(); private AIDA aida = AIDA.defaultInstance();
@@ -45,6 +46,7 @@
private IHistogram2D h_mcp_org; private IHistogram2D trkpos_y_vs_x; private boolean firstWeirdTrack = true;
+ private SvtTrackExtrapolator extrapol = new SvtTrackExtrapolator();
@@ -52,7 +54,7 @@
* file name * Bz in Tesla */
- TruthResiduals(Hep3Vector bfield) {
+ public TruthResiduals(Hep3Vector bfield) {
_B = _hpstrans.transformVectorToTracking(bfield); System.out.printf("%s: B field %s\n",this.getClass().getSimpleName(),_B.toString()); }
@@ -64,7 +66,7 @@
}
- void processSim(List<MCParticle> mcParticles, List<SimTrackerHit> simTrackerHits) {
+ public void processSim(List<MCParticle> mcParticles, List<SimTrackerHit> simTrackerHits) {
if(res_truthsimhit == null) makePlots();
@@ -137,9 +139,8 @@
HelicalTrackFit htfTruth = TrackUtils.getHTF(mcp, -1*this._B.z());
- - SvtTrackExtrapolator extrapol = null; - //= new SvtTrackExtrapolator(htfTruth.parameters());
+ extrapol.setTrack(htfTruth.parameters()); +
Hep3Vector trkposExtraPolator = extrapol.extrapolateTrack(simHitPosTracking.x()); //System.out.printf("trkposextrapol (det) %s\n",trkposExtraPolator.toString());
@@ -203,7 +204,14 @@
}
-
+ public IHistogram getResidual(int layer,String coord) { + if( !this.res_truthsimhit.containsKey(layer) ) + throw new RuntimeException("Error the layer number is not valid"); + if( coord!="x" || coord!="y") + throw new RuntimeException("Error the coord is not valid"); + IHistogram1D h = this.res_truthsimhit.get(layer).get(coord=="x"?0:1); + return h; + }
diff -u -r1.20 -r1.21 --- TwoTrackAnlysis.java 12 Jul 2013 23:13:15 -0000 1.20 +++ TwoTrackAnlysis.java 11 Oct 2013 22:18:52 -0000 1.21 @@ -963,7 +963,7 @@
private void createWriter() {
- try {
+ try {
fileWriter = new FileWriter(outputNameTextTuple); } catch (IOException ex) { Logger.getLogger(TwoTrackAnlysis.class.getName()).log(Level.SEVERE, null, ex);
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1