Commit in hps-java/src/main/java/org/lcsim/hps/users/phansson on MAIN | |||
ParticleHelixProducer.java | +19 | -4 | 1.3 -> 1.4 |
Randomizing particle input, adding switch for single track production.
diff -u -r1.3 -r1.4 --- ParticleHelixProducer.java 10 Oct 2012 19:57:34 -0000 1.3 +++ ParticleHelixProducer.java 13 Oct 2012 02:58:02 -0000 1.4 @@ -45,6 +45,7 @@
public class ParticleHelixProducer extends Driver { private boolean debug = false;
+ private boolean saveSingleTrack = false;
private int _totalTracks = 0; TrackUtils trackUtils = new TrackUtils(); TrackerHitUtils trackerhitutils = new TrackerHitUtils();
@@ -71,6 +72,10 @@
this.debug = debug; }
+ public void setSaveSingleTrack(boolean single) { + this.saveSingleTrack = single; + } +
public void setTrackOutputCollectionName(String trackOutputCollectionName) { this.trackOutputCollectionName = trackOutputCollectionName; }
@@ -132,6 +137,7 @@
double bfield = Math.abs(_bfield.z()); //remove sign from B-field, assumed to be along z-direction if(debug) System.out.println(this.getClass().getSimpleName() + ": bfield " + bfield ); for(MCParticle part : fsParticles) {
+ if(Math.random()>0.5) continue;
if(ParticleTypeClassifier.isElectron(part.getPDGID()) || ParticleTypeClassifier.isPositron(part.getPDGID())) {
@@ -139,6 +145,16 @@
Hep3Vector org = part.getOrigin(); double q = -1*part.getCharge(); //since I flipped the B-field I need to flip the charge
+ + if(p.magnitude()<0.3 ) { + if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small momentum p=" + p.toString()); + continue; + } + if(Math.abs( Math.atan(p.y()/p.z()) ) < 0.01) { + if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small thetay =" + Math.abs( Math.atan(p.y()/p.z()) )); + continue; + } +
//propagate to start of field region if needed double dz = 0-org.z(); if(dz>0) {
@@ -159,10 +175,6 @@
org = VecOp.mult(detToTrk, org); if(debug) System.out.println(this.getClass().getSimpleName() + ": MC particle p=" + p.toString() +" org=" + org.toString() +" q = " + q + " (rotated)");
- if(p.magnitude()<0.3) { - if(debug) System.out.println(this.getClass().getSimpleName() + ": this MC particle had too small momentum p=" + p.toString()); - continue; - }
if(debug) { double pt = Math.sqrt(p.x()*p.x() + p.y()*p.y()); double Rman = q*pt/(Constants.fieldConversion*bfield);
@@ -195,6 +207,9 @@
h_slope.fill(htf.slope()); h_z0.fill(htf.z0());
+ + if(saveSingleTrack && tracks.size()==1) break; +
} } }
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