2 added + 2 modified, total 4 files
lcsim/src/org/lcsim/contrib/seedtracker
diff -N SeedTrackerDiagnostics.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SeedTrackerDiagnostics.java 13 Apr 2008 01:22:45 -0000 1.1
@@ -0,0 +1,116 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.seedtracker;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ *
+ * @author cozzy
+ */
+public class SeedTrackerDiagnostics {
+
+ AIDA aida = AIDA.defaultInstance();
+
+ private double b_field;
+ private EventHeader ev;
+
+ private double mcth_min=0.;
+ private double mcth_max=0.9;
+ private double mcth_step = 0.1;
+
+
+ public SeedTrackerDiagnostics(EventHeader event, double b_field){
+ this.ev = event;
+ this.b_field = b_field;
+ }
+
+ public void performDiagnostics(List<SeedCandidate> seedlist, SeedStrategy strategy){
+
+ List<MCParticle> likelyMCList = makePurityPlots(seedlist);
+ makeEfficiencyPlots(seedlist,likelyMCList,strategy);
+ }
+
+ public void setMinCosThetaOpts(double min, double max, double step){
+ this.mcth_max = max;
+ this.mcth_min = min;
+ this.mcth_step = step;
+ }
+
+
+ //makes purity plots and also returns a list of likely MCParticles found
+ private List<MCParticle> makePurityPlots(List<SeedCandidate> seedlist) {
+
+ List<MCParticle> ret = new ArrayList<MCParticle>();
+ for (SeedCandidate s : seedlist) {
+
+ SeedValidator v = new SeedValidator(s);
+
+ ret.add(v.getLikelyMC());
+
+ if (v.getVerdict().isGoodValue()) {
+ aida.cloud1D("Good seeds chisq").fill(s.getHelix().chisqtot());
+ aida.cloud1D("Good seeds numhits").fill(s.getHits().size());
+ aida.cloud1D("Good seeds pt").fill(s.getHelix().pT(5.0));
+ } else {
+ aida.cloud1D("Bad seeds chisq").fill(s.getHelix().chisqtot());
+ aida.cloud1D("Bad seeds numhits").fill(s.getHits().size());
+ aida.cloud1D("Bad seeds pt").fill(s.getHelix().pT(5.0));
+ }
+
+ aida.cloud1D("purity").fill(v.getPurity());
+ aida.cloud2D("purity vs. numHits").fill(v.getPurity(), s.getHits().size());
+ aida.cloud2D("purity vs. pt").fill(v.getPurity(), s.getHelix().pT(5.0));
+ aida.cloud2D("purity vs. cth").fill(v.getPurity(), s.getHelix().cth());
+ aida.cloud2D("purity vs. chisq").fill(v.getPurity(), s.getHelix().chisqtot());
+ aida.cloud2D("purity cs. dca").fill(v.getPurity(), s.getHelix().dca());
+ }
+ return ret;
+ }
+
+ private void makeEfficiencyPlots(List<SeedCandidate> seedlist, List<MCParticle> likelyMCs, SeedStrategy strat){
+
+ FindableTrackParams findable = new FindableTrackParams(strat);
+ findable.setBField(b_field);
+
+ List<MCParticle> MCs = ev.getMCParticles();
+
+ //cycle through all the minCosTheta's we're interested in...
+ for (double d = mcth_min; d <= mcth_max+0.00001; d+=mcth_step ) {
+
+ findable.setMinCosTheta(d);
+
+ List<MCParticle> temp = new ArrayList<MCParticle>();
+ temp.addAll(MCs);
+ Iterator iter = temp.iterator();
+
+ //remove all none findable MCs
+ while(iter.hasNext()){
+
+ if(!findable.isFindable((MCParticle)iter.next()))
+ iter.remove();
+ }
+
+ int denom = temp.size();
+ aida.cloud1D("Num findable/ minCosTheta = "+String.valueOf(d)).fill(denom);
+
+ temp.removeAll(likelyMCs);
+
+ int num =temp.size();
+ if(denom>0){
+ double eff = (double) num / (double) denom;
+ aida.cloud2D("Efficiency vs. minCosTheta").fill(eff, d);
+ aida.cloud1D("Efficiency / minCosTheta = "+String.valueOf(d)).fill(eff);
+ }
+ }
+ }
+
+}
lcsim/src/org/lcsim/contrib/seedtracker
diff -N FindableTrackParams.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ FindableTrackParams.java 13 Apr 2008 01:22:45 -0000 1.1
@@ -0,0 +1,109 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.seedtracker;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import org.lcsim.event.MCParticle;
+import org.lcsim.util.swim.HelixSwimmer;
+
+/**
+ *
+ * @author cozzy
+ */
+public class FindableTrackParams {
+
+
+ private double minPt;
+ private double minCosTheta;
+ private double maxZ0;
+ private double maxDCA;
+
+ private double b_field = 5.0;
+ private Hep3Vector ip = new BasicHep3Vector(0,0,0);
+ private static final double DEFAULT_MIN_COS_THETA = 0.3;
+
+
+ public FindableTrackParams(){
+ minCosTheta = DEFAULT_MIN_COS_THETA;
+ }
+
+
+ public FindableTrackParams(SeedStrategy strategy){
+ this();
+ minPt = strategy.getMinPT();
+ maxZ0 = strategy.getMaxZ0();
+ maxDCA = strategy.getMaxDCA();
+ }
+
+
+
+ public boolean isFindable(MCParticle p){
+
+ double px = p.getMomentum().x();
+ double py = p.getMomentum().y();
+
+ double pt = Math.sqrt(px*px+py*py);
+
+ if (pt < minPt || pt/p.getMomentum().magnitude() < minCosTheta)
+ return false;
+
+ HelixSwimmer h = new HelixSwimmer(b_field);
+
+ h.setTrack(p.getMomentum(), p.getOrigin(),(int)p.getCharge());
+
+ double dca = h.getDistanceToPoint(ip);
+ double z0 = h.getPointAtLength(h.getTrackLengthToPoint(ip)).z() - ip.z();
+
+
+ if (Math.abs(z0) > maxZ0 || dca > maxDCA)
+ return false;
+
+ return true;
+ }
+
+
+ public double getMinCosTheta() {
+ return minCosTheta;
+ }
+
+ public void setMinCosTheta(double cosTheta) {
+ this.minCosTheta = cosTheta;
+ }
+
+ public double getMaxDCA() {
+ return maxDCA;
+ }
+
+ public void setMaxDCA(double maxDCA) {
+ this.maxDCA = maxDCA;
+ }
+
+ public double getMaxZ0() {
+ return maxZ0;
+ }
+
+ public void setMaxZ0(double maxZ0) {
+ this.maxZ0 = maxZ0;
+ }
+
+ public double getMinPt() {
+ return minPt;
+ }
+
+ public void setMinPt(double pt) {
+ this.minPt = pt;
+ }
+
+ public void setBField(double b) {
+ this.b_field=b;
+ }
+
+ public void setIP(Hep3Vector ip) {
+ this.ip = ip;
+ }
+
+}
lcsim/src/org/lcsim/contrib/seedtracker
diff -u -r1.9 -r1.10
--- SeedTracker.java 12 Feb 2008 17:10:10 -0000 1.9
+++ SeedTracker.java 13 Apr 2008 01:22:45 -0000 1.10
@@ -30,6 +30,8 @@
public class SeedTracker extends Driver {
private List<SeedStrategy> _strategylist;
+ private static final boolean PERFORM_DIAGNOSTICS = true;
+
/** Creates a new instance of SeedTracker */
public SeedTracker() {
_strategylist = new DefaultStrategy().getStrategyList();
@@ -71,6 +73,10 @@
// Instantiate the Seed Merger
MergeSeedLists mergeseedlists = new MergeSeedLists();
+ mergeseedlists.makeBadDecisionPlots(PERFORM_DIAGNOSTICS); // make plots if performing diagnostics...
+
+ // Instantiate diagnostics
+ SeedTrackerDiagnostics diagnostics = new SeedTrackerDiagnostics(event,bfield);
// Instantiate the Track Maker
MakeTracks maketracks = new MakeTracks();
@@ -93,6 +99,11 @@
// Merge the extended seeds into the list of found track seeds, eliminating duplicates
mergeseedlists.Merge(trackseeds, extended, strategy);
+
+ // Perform diagnostics
+ if(PERFORM_DIAGNOSTICS)
+ diagnostics.performDiagnostics(trackseeds, strategy);
+
}
// Make tracks from the final list of track seeds
lcsim/src/org/lcsim/contrib/seedtracker
diff -u -r1.4 -r1.5
--- MergeSeedLists.java 8 Apr 2008 08:44:00 -0000 1.4
+++ MergeSeedLists.java 13 Apr 2008 01:22:45 -0000 1.5
@@ -22,7 +22,7 @@
public class MergeSeedLists {
private AIDA aida = AIDA.defaultInstance();
- private static final boolean VALIDATE=true;
+ private boolean validate =false;
/** Creates a new instance of MergeSeedLists */
@@ -41,7 +41,7 @@
duplicate = true;
if (isBetter(newseed, seed, strategy)) {
- if(VALIDATE){
+ if(validate){
SeedValidator oldV = new SeedValidator(seed);
SeedValidator newV = new SeedValidator(newseed);
@@ -59,12 +59,14 @@
}
System.out.println(" After merging: "+seedlist.size());
- if(VALIDATE) {
- makeCandidatePlots(seedlist);
- }
return;
}
+ public void makeBadDecisionPlots(boolean makePlots){
+ validate = makePlots;
+ }
+
+
private boolean isDuplicate(SeedCandidate seed1, SeedCandidate seed2) {
int nduplicate = 0;
for (HelicalTrackHit hit1 : seed1.getHits()) {
@@ -108,28 +110,5 @@
}
}
-
- private void makeCandidatePlots(List<SeedCandidate> seedlist) {
- for (SeedCandidate s : seedlist) {
-
- SeedValidator v = new SeedValidator(s);
- if (v.getVerdict().isGoodValue()) {
- aida.cloud1D("Good seeds chisq").fill(s.getHelix().chisqtot());
- aida.cloud1D("Good seeds numhits").fill(s.getHits().size());
- aida.cloud1D("Good seeds pt").fill(s.getHelix().pT(5.0));
- } else {
- aida.cloud1D("Bad seeds chisq").fill(s.getHelix().chisqtot());
- aida.cloud1D("Bad seeds numhits").fill(s.getHits().size());
- aida.cloud1D("Bad seeds pt").fill(s.getHelix().pT(5.0));
- }
-
- aida.cloud1D("purity").fill(v.getPurity());
- aida.cloud2D("purity vs. numHits").fill(v.getPurity(), s.getHits().size());
- aida.cloud2D("purity vs. pt").fill(v.getPurity(), s.getHelix().pT(5.0));
- aida.cloud2D("purity vs. cth").fill(v.getPurity(), s.getHelix().cth());
- aida.cloud2D("purity vs. chisq").fill(v.getPurity(), s.getHelix().chisqtot());
- aida.cloud2D("purity cs. dca").fill(v.getPurity(), s.getHelix().dca());
- }
- }
}
\ No newline at end of file
CVSspam 0.2.8