Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
HistReassignment.java+113added 1.1
make histogram separated

lcsim/src/org/lcsim/contrib/uiowa
HistReassignment.java added at 1.1
diff -N HistReassignment.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ HistReassignment.java	15 Aug 2008 18:09:11 -0000	1.1
@@ -0,0 +1,113 @@
+package org.lcsim.contrib.uiowa;
+
+import java.util.*;
+import org.lcsim.util.*;
+import org.lcsim.event.util.*;
+import org.lcsim.event.*;
+import hep.physics.vec.*;
+import org.lcsim.event.base.*;
+import org.lcsim.util.aida.AIDA;
+import org.lcsim.recon.pfa.identifier.*;
+
+public class HistReassignment extends ReclusterDriver{
+    private AIDA aida = AIDA.defaultInstance();
+    private LocalHelixExtrapolator m_extrap;
+    private Hep3Vector m_v1;
+    private Hep3Vector m_v2;
+    private Double m_limit;
+    private Double m_dist;
+    private Double m_longi;
+    private Double m_trans;
+    private Double m_degree;
+    private Double m_radian;
+    private Double m_cos;
+    private Double m_p;
+    private Double m_score;
+    private List<MCParticle> m_truthList; 
+    private MCParticle m_domi;
+
+    public HistReassignment(){
+    }
+
+    public void Hist1D (Track tr, Cluster clus, double score, List<MCParticle> mcList){
+        List<MCParticle> truthList = getMCParticle(tr);
+        double tmpScore = score;
+        boolean truthMatchFound = false;
+        Map<MCParticle, List<SimCalorimeterHit>> truthMap = truthInListFromHitList(clus.getCalorimeterHits(), mcList);
+        for (MCParticle part : truthMap.keySet()) {
+            List<SimCalorimeterHit> hits = truthMap.get(part);
+            if(truthList.contains(part)) truthMatchFound = true;
+        }
+        aida.cloud1D("score_reassigned",100000).fill(tmpScore);
+        aida.cloud1D("score_weighted_reassigned",100000).fill(tmpScore, energy(clus));
+        if (truthMatchFound) {
+            aida.cloud1D("score_matched_fromPart",10000).fill(tmpScore);
+            aida.cloud1D("score_weighted_matched_fromPart",100000).fill(tmpScore, energy(clus));
+        } else {
+            aida.cloud1D("score_notmatched_fromPart",10000).fill(tmpScore);
+            aida.cloud1D("score_weighted_notmatched_fromPart",100000).fill(tmpScore, energy(clus));
+        }
+        MCParticle domPart = quoteDominantParticle(clus);
+        if(truthList.contains(domPart)){
+            aida.histogram1D("MC matched or not", 4, -2,2).fill(1.0);
+            aida.histogram1D("MC matched_weight or not", 4, -2,2).fill(1.0, energy(clus));
+            aida.cloud1D("score_match",10000).fill(tmpScore);
+            aida.cloud1D("score_weighted_match",100000).fill(tmpScore, energy(clus));
+        } else {
+            aida.histogram1D("MC matched or not", 4, -2,2).fill(-1.0);
+            aida.histogram1D("MC matched_weight or not", 4,-2,2).fill(-1.0, energy(clus));
+            aida.cloud1D("score_notmatch",10000).fill(tmpScore);
+            aida.cloud1D("score_weighted_notmatch",100000).fill(tmpScore, energy(clus));
+            if(domPart.getCharge() != 0){ //charged
+                aida.cloud1D("score_notmatch_charged",10000).fill(tmpScore);
+                aida.cloud1D("score_weighted_notmatch_charged",100000).fill(tmpScore, energy(clus));
+            }else if(domPart.getPDGID() == 22){ //photon
+                aida.cloud1D("score_notmatch_photon",10000).fill(tmpScore);
+                aida.cloud1D("score_weighted_notmatch_photn",100000).fill(tmpScore, energy(clus));
+            }else { //neutral
+                aida.cloud1D("score_notmatch_neutral",10000).fill(tmpScore);
+                aida.cloud1D("score_weighted_notmatch_neutral",100000).fill(tmpScore, energy(clus));
+            }
+        }
+    }
+
+
+    public void Hist2D(Hep3Vector v1, Hep3Vector v2, Track tr, Cluster clus){
+        m_p = (new BasicHep3Vector(tr.getMomentum())).magnitude();
+        m_truthList = getMCParticle(tr);
+        m_domi = quoteDominantParticle(clus);        
+
+        Hep3Vector v1_unit = VecOp.unit(v1); // vector from showering point to cluster
+        Hep3Vector v2_unit = VecOp.unit(v2); // tangent vector
+        m_cos = VecOp.dot(v1_unit, v2_unit);
+        m_dist = v1.magnitude();
+        m_longi = v1.magnitude()*m_cos;
+        m_radian = Math.acos(VecOp.dot(v2_unit, v1_unit));
+        m_trans = v1.magnitude()*Math.sin(m_radian); 
+        m_degree = m_radian*180/Math.PI;
+                                                                                                                  
+        if(m_truthList.contains(m_domi)){
+            aida.cloud2D("match_radian_longi",100000).fill(m_radian,m_longi);
+            aida.cloud2D("match_degree_longi",100000).fill(m_degree,m_longi);
+            aida.cloud2D("match_cos_longi",100000).fill(m_cos,m_longi);
+            aida.cloud2D("match_trans_longi",100000).fill(m_trans, m_longi);
+            aida.cloud2D("match_degree_trans",100000).fill(m_degree,m_trans);
+            aida.cloud2D("match_p_ratio",100000).fill(m_p, m_longi/m_trans);
+            aida.cloud2D("match_p_longi",100000).fill(m_p, m_longi);
+            aida.cloud2D("match_p_trans",100000).fill(m_p, m_trans);
+            aida.cloud2D("match_p_cos",100000).fill(m_p, m_cos);
+        } else {
+            aida.cloud2D("notmatch_radian_longi",100000).fill(m_radian,m_longi);
+            aida.cloud2D("notmatch_degree_longi",100000).fill(m_degree,m_longi);
+            aida.cloud2D("notmatch_cos_longi",100000).fill(m_cos,m_longi);
+            aida.cloud2D("notmatch_trans_longi",100000).fill(m_trans, m_longi);
+            aida.cloud2D("notmatch_degree_trans",100000).fill(m_degree,m_trans);
+            aida.cloud2D("notmatch_p_ratio",100000).fill(m_p, m_longi/m_trans);
+            aida.cloud2D("notmatch_p_longi",100000).fill(m_p, m_longi);
+            aida.cloud2D("notmatch_p_trans",100000).fill(m_p, m_trans);
+            aida.cloud2D("notmatch_p_cos",100000).fill(m_p, m_cos);
+        }
+
+    }
+
+} 
CVSspam 0.2.8