Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
ReclusterDriver.java+62-331.35 -> 1.36
MJC: (contrib) Add debug for MCAL to match HCAL and ECAL

lcsim/src/org/lcsim/contrib/uiowa
ReclusterDriver.java 1.35 -> 1.36
diff -u -r1.35 -r1.36
--- ReclusterDriver.java	15 Aug 2008 22:15:15 -0000	1.35
+++ ReclusterDriver.java	30 Aug 2008 20:04:30 -0000	1.36
@@ -38,7 +38,7 @@
   *
   * This version is PRELIMINARY.
   *
-  * @version $Id: ReclusterDriver.java,v 1.35 2008/08/15 22:15:15 mcharles Exp $
+  * @version $Id: ReclusterDriver.java,v 1.36 2008/08/30 20:04:30 mcharles Exp $
   * @author Mat Charles
   */
 
@@ -1459,8 +1459,8 @@
 	    System.out.println("Here is a summary of all the energy deposits for each track:");
 	    for (Track tr : tracksSortedByMomentum) {
 		double trackMomentum = (new BasicHep3Vector(tr.getMomentum())).magnitude();
-		HitMap hitsEcal = ((HitMap)(m_event.get("inputHitMapEcal")));
-		HitMap hitsHcal = ((HitMap)(m_event.get("inputHitMapHcal")));
+		HitMap hitsEcal = ((HitMap)(m_event.get("EcalDigiHitMap")));
+		HitMap hitsHcal = ((HitMap)(m_event.get("HcalDigiHitMap")));
 		List<CalorimeterHit> allTruthHitsInEcal = findHitsFromTruth_T(tr, hitsEcal.values());
 		List<CalorimeterHit> allTruthHitsInHcal = findHitsFromTruth_T(tr, hitsHcal.values());
 		int countCoreHitsEcal = 0;
@@ -3069,12 +3069,20 @@
 	// DEBUG: Check the status of all hits in the event.
 	HitMap hitMapEcal = ((HitMap)(m_event.get("EcalDigiHitMap")));
 	HitMap hitMapHcal = ((HitMap)(m_event.get("HcalDigiHitMap")));
+	HitMap hitMapMcal = ((HitMap)(m_event.get("HcalDigiHitMap")));
+	HitMap hitMapMcalBarrel = ((HitMap)(m_event.get("MuonBarrDigiHitMap")));
+	HitMap hitMapMcalEndcap = ((HitMap)(m_event.get("MuonEndcapDigiHitMap")));
 	Set<CalorimeterHit> hitsEcal = new HashSet<CalorimeterHit>(hitMapEcal.values());
 	Set<CalorimeterHit> hitsHcal = new HashSet<CalorimeterHit>(hitMapHcal.values());
+	Set<CalorimeterHit> hitsMcal = new HashSet<CalorimeterHit>();
+	hitsMcal.addAll(hitMapMcalBarrel.values());
+	hitsMcal.addAll(hitMapMcalEndcap.values());
 	Set<CalorimeterHit> hitsEcalSharedWithTargets = new HashSet<CalorimeterHit>();
 	Set<CalorimeterHit> hitsHcalSharedWithTargets = new HashSet<CalorimeterHit>();
+	Set<CalorimeterHit> hitsMcalSharedWithTargets = new HashSet<CalorimeterHit>();
 	Set<CalorimeterHit> hitsEcalSharedWithoutTargets = new HashSet<CalorimeterHit>();
 	Set<CalorimeterHit> hitsHcalSharedWithoutTargets = new HashSet<CalorimeterHit>();
+	Set<CalorimeterHit> hitsMcalSharedWithoutTargets = new HashSet<CalorimeterHit>();
 	
 	for (SharedClusterGroup shares : allSharedClusters) {
 	    List<SharedCluster> sharedClusters = shares.listAllSharedClusters();
@@ -3083,20 +3091,19 @@
 		for (CalorimeterHit hit : sharedCluster.getCluster().getCalorimeterHits()) {
 		    boolean hitInEcal = hitsEcal.contains(hit);
 		    boolean hitInHcal = hitsHcal.contains(hit);
+		    boolean hitInMcal = hitsMcal.contains(hit);
 		    if (hitInEcal && hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		    if (!hitInEcal && !hitInHcal) { throw new AssertionError("Book-keeping error"); }
+		    if (hitInEcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (hitInHcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (!hitInEcal && !hitInHcal && !hitInMcal) { throw new AssertionError("Book-keeping error"); }
 		    if (targets.size()==0) {
-			if (hitInEcal) { 
-			    hitsEcalSharedWithoutTargets.add(hit);
-			} else {
-			    hitsHcalSharedWithoutTargets.add(hit);
-			}
+			if (hitInEcal) { hitsEcalSharedWithoutTargets.add(hit); }
+			if (hitInHcal) { hitsHcalSharedWithoutTargets.add(hit); }
+			if (hitInMcal) { hitsMcalSharedWithoutTargets.add(hit); }
 		    } else {
-			if (hitInEcal) { 
-			    hitsEcalSharedWithTargets.add(hit);
-			} else {
-			    hitsHcalSharedWithTargets.add(hit);
-			}
+			if (hitInEcal) { hitsEcalSharedWithTargets.add(hit); }
+			if (hitInHcal) { hitsHcalSharedWithTargets.add(hit); }
+			if (hitInMcal) { hitsMcalSharedWithTargets.add(hit); }
 		    }
 		}
 	    }
@@ -3104,60 +3111,67 @@
 	    
 	Set<CalorimeterHit> hitsEcalInChargedCore = new HashSet<CalorimeterHit>();
 	Set<CalorimeterHit> hitsHcalInChargedCore = new HashSet<CalorimeterHit>();
+	Set<CalorimeterHit> hitsMcalInChargedCore = new HashSet<CalorimeterHit>();
 	for (Track tr : tracksSortedByMomentum) {
 	    Set<Cluster> showerComponents = newMapTrackToShowerComponents.get(tr);
 	    for (Cluster clus : showerComponents) {
 		for (CalorimeterHit hit : clus.getCalorimeterHits()) {
 		    boolean hitInEcal = hitsEcal.contains(hit);
 		    boolean hitInHcal = hitsHcal.contains(hit);
+		    boolean hitInMcal = hitsMcal.contains(hit);
 		    if (hitInEcal && hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		    if (!hitInEcal && !hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		    if (hitInEcal) {
-			hitsEcalInChargedCore.add(hit);
-		    } else {
-			hitsHcalInChargedCore.add(hit);
-		    }
+		    if (hitInEcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (hitInHcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (!hitInEcal && !hitInHcal && !hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (hitInEcal) { hitsEcalInChargedCore.add(hit); }
+		    if (hitInHcal) { hitsHcalInChargedCore.add(hit); }
+		    if (hitInMcal) { hitsMcalInChargedCore.add(hit); }
 		}
 	    }
 	}
 	    
 	Set<CalorimeterHit> hitsEcalInPhotonCore = new HashSet<CalorimeterHit>();
 	Set<CalorimeterHit> hitsHcalInPhotonCore = new HashSet<CalorimeterHit>();
+	Set<CalorimeterHit> hitsMcalInPhotonCore = new HashSet<CalorimeterHit>();
 	for (Cluster clus : photons) {
 	    Track tr = newMapShowerComponentToTrack.get(clus);
 	    if (tr == null) {
 		for (CalorimeterHit hit : clus.getCalorimeterHits()) {
 		    boolean hitInEcal = hitsEcal.contains(hit);
 		    boolean hitInHcal = hitsHcal.contains(hit);
+		    boolean hitInMcal = hitsMcal.contains(hit);
 		    if (hitInEcal && hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		    if (!hitInEcal && !hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		    if (hitInEcal) {
-			hitsEcalInPhotonCore.add(hit);
-		    } else {
-			hitsHcalInPhotonCore.add(hit);
-		    }
+		    if (hitInEcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (hitInHcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (!hitInEcal && !hitInHcal && !hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		    if (hitInEcal) { hitsEcalInPhotonCore.add(hit); }
+		    if (hitInHcal) { hitsHcalInPhotonCore.add(hit); }
+		    if (hitInMcal) { hitsMcalInPhotonCore.add(hit); }
 		}
 	    }
 	}
 	
 	Set<CalorimeterHit> hitsEcalInNeutralCore = new HashSet<CalorimeterHit>();
 	Set<CalorimeterHit> hitsHcalInNeutralCore = new HashSet<CalorimeterHit>();
+	Set<CalorimeterHit> hitsMcalInNeutralCore = new HashSet<CalorimeterHit>();
 	for (Cluster clus : neutralClusterCores) {
 	    for (CalorimeterHit hit : clus.getCalorimeterHits()) {
 		boolean hitInEcal = hitsEcal.contains(hit);
 		boolean hitInHcal = hitsHcal.contains(hit);
+		boolean hitInMcal = hitsMcal.contains(hit);
 		if (hitInEcal && hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		if (!hitInEcal && !hitInHcal) { throw new AssertionError("Book-keeping error"); }
-		if (hitInEcal) {
-		    hitsEcalInNeutralCore.add(hit);
-		} else {
-		    hitsHcalInNeutralCore.add(hit);
-		}
+		if (hitInEcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		if (hitInHcal && hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		if (!hitInEcal && !hitInHcal && !hitInMcal) { throw new AssertionError("Book-keeping error"); }
+		if (hitInEcal) { hitsEcalInNeutralCore.add(hit); }
+		if (hitInHcal) { hitsHcalInNeutralCore.add(hit); }
+		if (hitInMcal) { hitsMcalInNeutralCore.add(hit); }
 	    }
 	}
 	
 	int countIdentifiedHitsEcal = hitsEcalSharedWithTargets.size() + hitsEcalSharedWithoutTargets.size() + hitsEcalInChargedCore.size() + hitsEcalInPhotonCore.size() + hitsEcalInNeutralCore.size();
 	int countIdentifiedHitsHcal = hitsHcalSharedWithTargets.size() + hitsHcalSharedWithoutTargets.size() + hitsHcalInChargedCore.size() + hitsHcalInPhotonCore.size() + hitsHcalInNeutralCore.size();
+	int countIdentifiedHitsMcal = hitsMcalSharedWithTargets.size() + hitsMcalSharedWithoutTargets.size() + hitsMcalInChargedCore.size() + hitsMcalInPhotonCore.size() + hitsMcalInNeutralCore.size();
 	
 	System.out.println("Of the "+hitsEcal.size()+" ECAL hits, I identified "+countIdentifiedHitsEcal+":");
 	System.out.println("  "+hitsEcalSharedWithTargets.size()+" are shared and have a target");
@@ -3171,11 +3185,19 @@
 	System.out.println("  "+hitsHcalInChargedCore.size()+" are in the core of a charged shower");
 	System.out.println("  "+hitsHcalInPhotonCore.size()+" are in the core of a photon shower");
 	System.out.println("  "+hitsHcalInNeutralCore.size()+" are in the core of a neutral hadron shower");
+	System.out.println("Of the "+hitsMcal.size()+" MCAL hits, I identified "+countIdentifiedHitsMcal+":");
+	System.out.println("  "+hitsMcalSharedWithTargets.size()+" are shared and have a target");
+	System.out.println("  "+hitsMcalSharedWithoutTargets.size()+" are shared and have no target");
+	System.out.println("  "+hitsMcalInChargedCore.size()+" are in the core of a charged shower");
+	System.out.println("  "+hitsMcalInPhotonCore.size()+" are in the core of a photon shower");
+	System.out.println("  "+hitsMcalInNeutralCore.size()+" are in the core of a neutral hadron shower");
+	
 	
 	for (Track tr : tracksSortedByMomentum) {
 	    List<CalorimeterHit> trackTruthHitsInEcal = findHitsFromTruth_T(tr, hitsEcal);
 	    List<CalorimeterHit> trackTruthHitsInHcal = findHitsFromTruth_T(tr, hitsHcal);
-	    System.out.println("For track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" with "+trackTruthHitsInEcal.size()+" ECAL + "+trackTruthHitsInHcal.size()+" HCAL hits:");
+	    List<CalorimeterHit> trackTruthHitsInMcal = findHitsFromTruth_T(tr, hitsMcal);
+	    System.out.println("For track with p="+(new BasicHep3Vector(tr.getMomentum())).magnitude()+" with "+trackTruthHitsInEcal.size()+" ECAL + "+trackTruthHitsInHcal.size()+" HCAL + "+trackTruthHitsInMcal.size()+" MCAL hits:");
 	    int count;
 	    String printme = new String("  ECAL hits: ");
 	    count = 0; for (CalorimeterHit hit : trackTruthHitsInEcal) { if (hitsEcalSharedWithTargets.contains(hit)) { count++; } } ; printme += " sharedWithTarget="+count;
@@ -3191,6 +3213,13 @@
 	    count = 0; for (CalorimeterHit hit : trackTruthHitsInHcal) { if (hitsHcalInPhotonCore.contains(hit)) { count++; } } ; printme += " photonCore="+count;
 	    count = 0; for (CalorimeterHit hit : trackTruthHitsInHcal) { if (hitsHcalInNeutralCore.contains(hit)) { count++; } } ; printme += " neutralCore="+count;
 	    System.out.println(printme);
+	    printme = new String("  MCAL hits: ");
+	    count = 0; for (CalorimeterHit hit : trackTruthHitsInMcal) { if (hitsMcalSharedWithTargets.contains(hit)) { count++; } } ; printme += " sharedWithTarget="+count;
+	    count = 0; for (CalorimeterHit hit : trackTruthHitsInMcal) { if (hitsMcalSharedWithoutTargets.contains(hit)) { count++; } } ; printme += " sharedWithoutTarget="+count;
+	    count = 0; for (CalorimeterHit hit : trackTruthHitsInMcal) { if (hitsMcalInChargedCore.contains(hit)) { count++; } } ; printme += " chargedCore="+count;
+	    count = 0; for (CalorimeterHit hit : trackTruthHitsInMcal) { if (hitsMcalInPhotonCore.contains(hit)) { count++; } } ; printme += " photonCore="+count;
+	    count = 0; for (CalorimeterHit hit : trackTruthHitsInMcal) { if (hitsMcalInNeutralCore.contains(hit)) { count++; } } ; printme += " neutralCore="+count;
+	    System.out.println(printme);
 	}
     }
 
CVSspam 0.2.8