Commit in hps-java/src/main on MAIN | |||
java/org/lcsim/hps/recon/tracking/EventQuality.java | +4 | -3 | 1.2 -> 1.3 |
java/org/lcsim/hps/recon/tracking/gbl/GBLOutput.java | +51 | -41 | 1.15 -> 1.16 |
/GBLOutputDriver.java | +24 | -14 | 1.7 -> 1.8 |
resources/org/lcsim/hps/steering/users/phansson/TwoTrackAnalysis.lcsim | +5 | -6 | 1.10 -> 1.11 |
+84 | -64 |
fixing comp with data
diff -u -r1.2 -r1.3 --- EventQuality.java 22 May 2013 18:45:33 -0000 1.2 +++ EventQuality.java 7 Nov 2013 03:20:13 -0000 1.3 @@ -10,9 +10,10 @@
import java.util.Map; /**
- * Singleton class to hold default - * Should make template for different cut values - * @author phansson
+ * Singleton class to hold default cut values + * + * @author Per Hansson Adrian <[log in to unmask]> + * @version $id: $
*/ public class EventQuality {
diff -u -r1.15 -r1.16 --- GBLOutput.java 15 Oct 2013 00:33:53 -0000 1.15 +++ GBLOutput.java 7 Nov 2013 03:20:13 -0000 1.16 @@ -45,9 +45,12 @@
import org.lcsim.recon.tracking.seedtracker.SeedTrack; /**
- * - * @author phansson - */
+* This class is used to convert lcio input to a relative unstructured output format used as imput to GBL +* +* @author Per Hansson Adrian <[log in to unmask]> +* @version $id: $ +* +*/
public class GBLOutput { private int _debug;
@@ -105,7 +108,7 @@
- void printGBL(Track trk, List<MCParticle> mcParticles, List<SimTrackerHit> simTrackerHits) {
+ void printGBL(Track trk, List<MCParticle> mcParticles, List<SimTrackerHit> simTrackerHits, boolean isMC) {
SeedTrack st = (SeedTrack)trk; SeedCandidate seed = st.getSeedCandidate();
@@ -119,25 +122,26 @@
List<HelicalTrackHit> hits = seed.getHits(); // Find the truth particle of the track
- MCParticle mcp = getMatchedTruthParticle(trk); - - if(mcp==null) { - System.out.printf("%s: no truth particle found in event!\n",this.getClass().getSimpleName()); - this.printMCParticles(mcParticles); - System.exit(1); - return; - } else { - if(_debug>0) System.out.printf("%s: truth particle (pdgif %d ) found in event!\n",this.getClass().getSimpleName(),mcp.getPDGID()); - }
+ MCParticle mcp = null; + + if(isMC) { + mcp = getMatchedTruthParticle(trk); + + if(mcp==null) { + System.out.printf("%s: no truth particle found in event!\n",this.getClass().getSimpleName()); + this.printMCParticles(mcParticles); + System.exit(1); + } else { + if(_debug>0) System.out.printf("%s: truth particle (pdgif %d ) found in event!\n",this.getClass().getSimpleName(),mcp.getPDGID()); + }
- if(AprimeEvent ) { - if( mcp != null) {
+ if(AprimeEvent ) {
checkAprimeTruth(mcp,mcParticles); } } // Get track parameters from MC particle
- HelicalTrackFit htfTruth = TrackUtils.getHTF(mcp,-1.0*this._B.z());
+ HelicalTrackFit htfTruth = isMC ? TrackUtils.getHTF(mcp,-1.0*this._B.z()) : null;
// Use the truth helix as the initial track for GBL? //htf = htfTruth;
@@ -221,7 +225,7 @@
//Find intercept point with sensor in tracking frame Hep3Vector trkpos = TrackUtils.getHelixPlaneIntercept(htf, strip, Math.abs(_B.z()));
- Hep3Vector trkposTruth = TrackUtils.getHelixPlaneIntercept(htfTruth, strip, Math.abs(_B.z()));
+ Hep3Vector trkposTruth = isMC ? TrackUtils.getHelixPlaneIntercept(htfTruth, strip, Math.abs(_B.z())) : new BasicHep3Vector(-999999.9,-999999.9,-999999.9);
file.printStripTrackPos(trkpos); if(_debug>0) {
@@ -243,22 +247,24 @@
// Find the sim tracker hit for this layer SimTrackerHit simHit = simHitsLayerMap.get(strip.layer());
- - if(simHit==null) { - System.out.printf("%s: no sim hit for strip hit at layer %d\n",this.getClass().getSimpleName(),strip.layer()); - System.out.printf("%s: it as %d mc particles associated with it:\n",this.getClass().getSimpleName(),hit.getMCParticles().size()); - for (MCParticle particle : hit.getMCParticles()) System.out.printf("%s: %d p %s \n",this.getClass().getSimpleName(),particle.getPDGID(),particle.getMomentum().toString()); - System.out.printf("%s: these are sim hits in the event:\n",this.getClass().getSimpleName()); - for (SimTrackerHit simhit : simTrackerHits) System.out.printf("%s sim hit at %s with MC particle pdgid %d with p %s \n",this.getClass().getSimpleName(),simhit.getPositionVec().toString(),simhit.getMCParticle().getPDGID(),simhit.getMCParticle().getMomentum().toString()); - System.out.printf("%s: these are all the MC particles in the event:\n",this.getClass().getSimpleName()); - System.exit(1); - } - - if(_debug>0) { - double s_truthSimHit = HelixUtils.PathToXPlane(htfTruth, simHit.getPositionVec().z(), 0, 0).get(0); - Hep3Vector trkposTruthSimHit = HelixUtils.PointOnHelix(htfTruth, s_truthSimHit); - Hep3Vector resTruthSimHit = VecOp.sub(HPSTransformations.transformVectorToTracking(simHit.getPositionVec()),trkposTruthSimHit); - System.out.printf("TruthSimHit residual %s for layer %d\n",resTruthSimHit.toString(),strip.layer());
+ + if( isMC ) { + if(simHit==null) { + System.out.printf("%s: no sim hit for strip hit at layer %d\n",this.getClass().getSimpleName(),strip.layer()); + System.out.printf("%s: it as %d mc particles associated with it:\n",this.getClass().getSimpleName(),hit.getMCParticles().size()); + for (MCParticle particle : hit.getMCParticles()) System.out.printf("%s: %d p %s \n",this.getClass().getSimpleName(),particle.getPDGID(),particle.getMomentum().toString()); + System.out.printf("%s: these are sim hits in the event:\n",this.getClass().getSimpleName()); + for (SimTrackerHit simhit : simTrackerHits) System.out.printf("%s sim hit at %s with MC particle pdgid %d with p %s \n",this.getClass().getSimpleName(),simhit.getPositionVec().toString(),simhit.getMCParticle().getPDGID(),simhit.getMCParticle().getMomentum().toString()); + System.out.printf("%s: these are all the MC particles in the event:\n",this.getClass().getSimpleName()); + System.exit(1); + } + + if(_debug>0) { + double s_truthSimHit = HelixUtils.PathToXPlane(htfTruth, simHit.getPositionVec().z(), 0, 0).get(0); + Hep3Vector trkposTruthSimHit = HelixUtils.PointOnHelix(htfTruth, s_truthSimHit); + Hep3Vector resTruthSimHit = VecOp.sub(HPSTransformations.transformVectorToTracking(simHit.getPositionVec()),trkposTruthSimHit); + System.out.printf("TruthSimHit residual %s for layer %d\n",resTruthSimHit.toString(),strip.layer()); + }
} //path length to intercept
@@ -459,13 +465,15 @@
private BasicMatrix getPerParVector(HelicalTrackFit htf) { BasicMatrix perPar = new BasicMatrix(1,5);
- double kappa = -1.0*Math.signum(htf.R())*Constants.fieldConversion*this._B.z()/htf.pT(Math.abs(_B.z())); - double theta = Math.PI/2.0 - Math.atan(htf.slope()); - perPar.setElement(0,0,kappa); - perPar.setElement(0,1,theta); - perPar.setElement(0,2,htf.phi0()); - perPar.setElement(0,3,htf.dca()); - perPar.setElement(0,4,htf.z0());
+ if( htf != null) { + double kappa = -1.0*Math.signum(htf.R())*Constants.fieldConversion*this._B.z()/htf.pT(Math.abs(_B.z())); + double theta = Math.PI/2.0 - Math.atan(htf.slope()); + perPar.setElement(0,0,kappa); + perPar.setElement(0,1,theta); + perPar.setElement(0,2,htf.phi0()); + perPar.setElement(0,3,htf.dca()); + perPar.setElement(0,4,htf.z0()); + }
return perPar; }
@@ -778,6 +786,8 @@
private BasicMatrix _params = new BasicMatrix(1,5); private ClParams(HelicalTrackFit htf) {
+ if (htf == null) return; +
Hep3Matrix perToClPrj = GBLOutput.this.getPerToClPrj(htf); double d0 = -1 * htf.dca(); //sign convention for curvilinear frame
diff -u -r1.7 -r1.8 --- GBLOutputDriver.java 17 Sep 2013 00:52:52 -0000 1.7 +++ GBLOutputDriver.java 7 Nov 2013 03:20:13 -0000 1.8 @@ -20,9 +20,12 @@
import org.lcsim.util.aida.AIDA; /**
- * - * @author phansson - */
+* This driver is used to convert lcio input to a relative unstructured output format used as imput to GBL +* +* @author Per Hansson Adrian <[log in to unmask]> +* @version $id: $ +* +*/
public class GBLOutputDriver extends Driver { private AIDA aida = AIDA.defaultInstance();
@@ -39,6 +42,7 @@
private String MCParticleCollectionName = "MCParticle"; private int iTrack = 0; private int iEvent = 0;
+ private boolean isMC = true;
public void setDebug(int v) { this._debug = v;
@@ -52,6 +56,9 @@
public void setHideFrame(boolean hide) { hideFrame = hide; }
+ public void setIsMC(boolean isMC) { + this.isMC = isMC; + }
public GBLOutputDriver() {
@@ -87,17 +94,20 @@
} }
+ + List<MCParticle> mcParticles = new ArrayList<MCParticle>(); + if(event.hasCollection(MCParticle.class,this.MCParticleCollectionName)) { + mcParticles = event.get(MCParticle.class,this.MCParticleCollectionName); + } + + List<SimTrackerHit> simTrackerHits = new ArrayList<SimTrackerHit>(); + if (event.hasCollection(SimTrackerHit.class, "TrackerHits")) { + simTrackerHits = event.getSimTrackerHits("TrackerHits"); + }
- List<MCParticle> mcParticles = null; - if(event.hasCollection(MCParticle.class,this.MCParticleCollectionName)) { - mcParticles = event.get(MCParticle.class,this.MCParticleCollectionName); - } - - List<SimTrackerHit> simTrackerHits = event.getSimTrackerHits("TrackerHits"); - - - truthRes.processSim(mcParticles, simTrackerHits); -
+ if(isMC) { + truthRes.processSim(mcParticles, simTrackerHits); + }
List<Track> selected_tracks = new ArrayList<Track>();
@@ -117,7 +127,7 @@
for (Track trk : selected_tracks) { if(_debug>0) System.out.printf("%s: Print GBL output for this track\n", this.getClass().getSimpleName()); gbl.printTrackID(iTrack);
- gbl.printGBL(trk,mcParticles,simTrackerHits);
+ gbl.printGBL(trk,mcParticles,simTrackerHits,this.isMC);
totalTracksProcessed++; ++iTrack; }
diff -u -r1.10 -r1.11 --- TwoTrackAnalysis.lcsim 28 Oct 2013 17:50:09 -0000 1.10 +++ TwoTrackAnalysis.lcsim 7 Nov 2013 03:20:13 -0000 1.11 @@ -1,12 +1,10 @@
<lcsim xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="http://www.lcsim.org/schemas/lcsim/1.0/lcsim.xsd"> <inputFiles>
- <!-- - <fileRegExp baseDir="./../data/mc/v3/snapshot-1.6/">egs.*_0.016x0.*recon_[0-9].*slcio</fileRegExp> - -->
+ <!--<fileRegExp baseDir="./../data/mc/HPS-TestRun-v5/1.8-SNAPSHOT-recoil-101013/">egs_5.5gev_0.016x0_500mb_recoil_readout_[0-9].slcio</fileRegExp>-->
</inputFiles> <control>
- <numberOfEvents>-1</numberOfEvents>
+ <numberOfEvents>1000</numberOfEvents>
<printInputFiles>true</printInputFiles> <printDriversDetailed>true</printDriversDetailed> </control>
@@ -25,8 +23,8 @@
<!-- <driver name="TruthMomentumAnalysis"/> --> <!-- <driver name="HelicalTrackHitResidualsDriver"/> --> <!-- <driver name="LCIOWriter"/> -->
- <driver name="TwoTrackAnalysis"/> -<!-- <driver name="GBLDriver"/> -->
+<!-- <driver name="TwoTrackAnalysis"/> --> + <driver name="GBLDriver"/>
<!-- <driver name="PrintGeometryDriver"/>-->
@@ -38,6 +36,7 @@
type="org.lcsim.hps.recon.tracking.gbl.GBLOutputDriver"> <debug>0</debug> <hideFrame>false</hideFrame>
+ <isMC>${isMC}</isMC>
<outputPlotFileName></outputPlotFileName> <gblFileName>gblinput.txt</gblFileName> </driver>
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