hps-java/src/main/java/org/lcsim/hps/users/phansson
diff -u -r1.8 -r1.9
--- TwoTrackAnlysis.java 11 Mar 2013 02:08:41 -0000 1.8
+++ TwoTrackAnlysis.java 11 Mar 2013 04:06:51 -0000 1.9
@@ -151,7 +151,6 @@
-
totalEvents++;
if(this._debug) {
@@ -178,21 +177,19 @@
return;
}
-
- for(int i=0;i<tracklist.size();++i) {
- Track trk = tracklist.get(i);
+ if(_debug) {
+ for(int i=0;i<tracklist.size();++i) {
+ Track trk = tracklist.get(i);
- if(this._debug) {
- System.out.printf("%s: trk momentum (%.3f,%.3f,%.3f) chi2=%.3f\n",this.getClass().getSimpleName(),trk.getTrackStates().get(0).getMomentum()[0],trk.getTrackStates().get(0).getMomentum()[1],trk.getTrackStates().get(0).getMomentum()[2],trk.getChi2());
- }
+ System.out.printf("%s: trk momentum (%.3f,%.3f,%.3f) chi2=%.3f\n",this.getClass().getSimpleName(),trk.getTrackStates().get(0).getMomentum()[0],trk.getTrackStates().get(0).getMomentum()[1],trk.getTrackStates().get(0).getMomentum()[2],trk.getChi2());
+
+ }
}
- if(this._debug)
- System.out.printf("%s: event nr %d has only %d tracks\n",this.getClass().getSimpleName(),event.getEventNumber(),tracklist.size());
-
-
-
if(tracklist.size()!=2) {
+ //if(_debug) {
+ System.out.printf("%s: event %d has only %d tracks \n",this.getClass().getSimpleName(),event.getEventNumber(),tracklist.size());
+ //}
return;
}
@@ -221,20 +218,28 @@
HelicalTrackFit helix = st1.getSeedCandidate().getHelix();
HashMap<Integer,HelicalTrackHit> hits = this.getHitMap(trk.getTrackerHits(),helix);
if(i==0) {
- Map<String,Double> res = TrackUtils.calculateTrackHitResidual(hits.get(1), helix, true);
- _trk1_res1_z_all.fill(res.get("resz"));
- _trk1_res1_y_all.fill(res.get("resy"));
- res = TrackUtils.calculateTrackHitResidual(hits.get(3), helix, true);
- _trk1_res2_z_all.fill(res.get("resz"));
- _trk1_res2_y_all.fill(res.get("resy"));
+ if(hits.get(1) != null) {
+ Map<String,Double> res = TrackUtils.calculateTrackHitResidual(hits.get(1), helix, true);
+ _trk1_res1_z_all.fill(res.get("resz"));
+ _trk1_res1_y_all.fill(res.get("resy"));
+ }
+ if(hits.get(3) != null) {
+ Map<String,Double> res = TrackUtils.calculateTrackHitResidual(hits.get(3), helix, true);
+ _trk1_res2_z_all.fill(res.get("resz"));
+ _trk1_res2_y_all.fill(res.get("resy"));
+ }
}
if(i==1) {
- Map<String,Double> res = TrackUtils.calculateTrackHitResidual(hits.get(1), helix, true);
- _trk2_res1_z_all.fill(res.get("resz"));
- _trk2_res1_y_all.fill(res.get("resy"));
- res = TrackUtils.calculateTrackHitResidual(hits.get(3), helix, true);
- _trk2_res2_z_all.fill(res.get("resz"));
- _trk2_res2_y_all.fill(res.get("resy"));
+ if(hits.get(1) != null) {
+ Map<String,Double> res = TrackUtils.calculateTrackHitResidual(hits.get(1), helix, true);
+ _trk2_res1_z_all.fill(res.get("resz"));
+ _trk2_res1_y_all.fill(res.get("resy"));
+ }
+ if(hits.get(3) != null) {
+ Map<String,Double> res = TrackUtils.calculateTrackHitResidual(hits.get(3), helix, true);
+ _trk2_res2_z_all.fill(res.get("resz"));
+ _trk2_res2_y_all.fill(res.get("resy"));
+ }
}
}
}
@@ -396,6 +401,7 @@
String br_line = "";
br_line+="evtnr/I:";
br_line+="e_px/F:e_py/F:e_pz/F:p_px/F:p_py/F:p_pz/F:";
+ br_line+="trk1_d0/F:trk1_phi0/F:trk1_R/F:trk1_z0/F:trk1_slope/F:";
br_line+="trk1_q/I:trk1_chi2/F:trk1_px/F:trk1_py/F:trk1_pz/F:trk1_nhits/I:";
for(int iLayer=1;iLayer<=5;++iLayer) br_line+="trk1_hit"+iLayer+"_x/F:"+"trk1_hit"+iLayer+"_y/F:"+"trk1_hit"+iLayer+"_z/F:";
for(int iLayer=1;iLayer<=5;++iLayer) {
@@ -408,6 +414,7 @@
for(int iLayer=1;iLayer<=10;++iLayer) br_line+="trk1_strip"+iLayer+"_u/F:";
for(int iLayer=1;iLayer<=10;++iLayer) br_line+="top_strip"+iLayer+"_n/F:";
for(int iLayer=1;iLayer<=10;++iLayer) br_line+="bot_strip"+iLayer+"_n/F:";
+ br_line+="trk2_d0/F:trk2_phi0/F:trk2_R/F:trk2_z0/F:trk2_slope/F:";
br_line+="trk2_q/I:trk2_chi2/F:trk2_px/F:trk2_py/F:trk2_pz/F:trk2_nhits/I:";
for(int iLayer=1;iLayer<=5;++iLayer) br_line+="trk2_hit"+iLayer+"_x/F:"+"trk2_hit"+iLayer+"_y/F:"+"trk2_hit"+iLayer+"_z/F:";
for(int iLayer=1;iLayer<=5;++iLayer) {
@@ -441,6 +448,7 @@
//Track properties
SeedTrack st1 = (SeedTrack) trk1;
HelicalTrackFit helix1 = st1.getSeedCandidate().getHelix();
+ printWriter.format("%5.5f %5.5f %5.5f %5.5f %5.5f ",helix1.dca(),helix1.phi0(),helix1.R(),helix1.z0(),helix1.slope());
List<TrackerHit> hitsOnTrack1 = trk1.getTrackerHits();
printWriter.format("%5d %5.5f %5.5f %5.5f %5.5f %5d ",trk1.getCharge(),trk1.getChi2(), trk1.getTrackStates().get(0).getMomentum()[0],trk1.getTrackStates().get(0).getMomentum()[1],trk1.getTrackStates().get(0).getMomentum()[2],hitsOnTrack1.size());
HashMap<Integer,HelicalTrackHit> hits1 = this.getHitMap(hitsOnTrack1,helix1);
@@ -512,6 +520,7 @@
}
SeedTrack st2 = (SeedTrack) trk2;
HelicalTrackFit helix2 = st2.getSeedCandidate().getHelix();
+ printWriter.format("%5.5f %5.5f %5.5f %5.5f %5.5f ",helix2.dca(),helix2.phi0(),helix2.R(),helix2.z0(),helix2.slope());
List<TrackerHit> hitsOnTrack2 = trk2.getTrackerHits();
printWriter.format("%5d %5.5f %5.5f %5.5f %5.5f %5d ",trk2.getCharge(),trk2.getChi2(), trk2.getTrackStates().get(0).getMomentum()[0],trk2.getTrackStates().get(0).getMomentum()[1],trk2.getTrackStates().get(0).getMomentum()[2],hitsOnTrack2.size());
HashMap<Integer,List<HelicalTrackStrip>> striphits2 = this.getStripHitsMap(hitsOnTrack2);