Print

Print


Commit in lcsim/src/org/lcsim/contrib/uiowa on MAIN
NonTrivialPFA.java+68-161.24 -> 1.25
MJC: Add muon finding step to PFA, cheating for now

lcsim/src/org/lcsim/contrib/uiowa
NonTrivialPFA.java 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- NonTrivialPFA.java	12 Oct 2007 23:30:01 -0000	1.24
+++ NonTrivialPFA.java	13 Oct 2007 20:08:39 -0000	1.25
@@ -21,6 +21,7 @@
 import org.lcsim.recon.cluster.analysis.*;
 import org.lcsim.event.util.CreateFinalStateMCParticleList;
 import org.lcsim.mc.fast.tracking.MCFastTracking;
+import org.lcsim.recon.pfa.cheat.PerfectIdentifier;
 import org.lcsim.recon.pfa.identifier.SimpleNeutralParticleMaker;
 import org.lcsim.recon.pfa.identifier.SimpleChargedParticleMaker;
 import org.lcsim.recon.pfa.identifier.MIPChargedParticleMaker;
@@ -232,10 +233,26 @@
 	// Find simple clusters
 	// --------------------
 
+	String eventMuonClusters = "muonClusters";
+	String eventMuonParticles = "muonParticles";
+	String eventHitMapEcalWithoutMuons = "hitMapEcalWithoutMuons";
+	String eventHitMapHcalWithoutMuons = "hitMapHcalWithoutMuons";
+	String eventTracksMinusMuons = "TracksMinusMuons";
+	{
+	    // Muons
+	    String prefix = "muonfinder__";
+	    addCheatingMuonFinder(prefix, eventHitMapEcal, eventHitMapHcal, trackList, eventMuonClusters, eventHitMapEcalWithoutMuons, eventHitMapHcalWithoutMuons, mcListName, eventTracksMinusMuons, eventMuonParticles);
+	    trackList = eventTracksMinusMuons; // CHANGES TRACK LIST (UGLY)
+	    // Book-keeping
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMuons, eventMuonClusters, eventHitMapHcalWithoutMuons } );
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMuons, eventMuonParticles, eventHitMapHcalWithoutMuons } );
+	}
+
 	String eventPhotonClusters = "photonClustersWithoutFragments";
 	String eventPhotonClustersWithFragments = "photonClusters";
 	String eventLargePhotonParticleList = "largePhotonParticles";
 	String eventHitMapEcalWithoutPhotons = "hitMapEcalWithoutPhotons";
+	String eventInputHitMapEcalForPhotons = eventHitMapEcalWithoutMuons;
 	{
 	    // Photons
 	    String prefix = "photonfinder__";
@@ -243,14 +260,14 @@
 	    boolean cheatOnPhotons = false;
 	    boolean useRonPhotonFinder = true;
 	   if (cheatOnPhotons) {
-		addCheatingPhotonFinder(prefix, eventHitMapEcal, inputTrackList, eventPhotonClusters, eventHitMapEcalWithoutPhotons, mcListName);
+		addCheatingPhotonFinder(prefix, eventInputHitMapEcalForPhotons, inputTrackList, eventPhotonClusters, eventHitMapEcalWithoutPhotons, mcListName);
 	    } else if (useRonPhotonFinder) {
-		addRonPhotonFinder(prefix, eventHitMapEcal, eventPhotonClusters, eventHitMapEcalWithoutPhotons); // TEST
+		addRonPhotonFinder(prefix, eventInputHitMapEcalForPhotons, eventPhotonClusters, eventHitMapEcalWithoutPhotons);
 	    } else {
-		addPhotonFinder(prefix, eventHitMapEcal, inputTrackList, eventPhotonClusters, eventHitMapEcalWithoutPhotons);
+		addPhotonFinder(prefix, eventInputHitMapEcalForPhotons, inputTrackList, eventPhotonClusters, eventHitMapEcalWithoutPhotons);
 	    }
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutPhotons, eventPhotonClusters, eventHitMapHcal } );
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutPhotons, eventPhotonClusters, eventHitMapHcalWithoutMuons, eventMuonParticles } );
 	}
 
 
@@ -263,7 +280,7 @@
 	    // MIPs
 	    String prefix = "mipfinder__";
 	    addMIPFinder(prefix, eventHitMapEcalWithoutPhotons, eventMipsEcal, eventHitMapEcalWithoutMipsOrPhotons); 
-	    addMIPFinder(prefix, eventHitMapHcal, eventMipsHcal, eventHitMapHcalWithoutMips);
+	    addMIPFinder(prefix, eventHitMapHcalWithoutMuons, eventMipsHcal, eventHitMapHcalWithoutMips);
 	    // Merge ECAL & HCAL lists
 	    ListAddDriver<Cluster> mergeMIPs = new ListAddDriver<Cluster>(Cluster.class);
 	    mergeMIPs.addInputList(eventMipsEcal);
@@ -271,8 +288,8 @@
 	    mergeMIPs.setOutputList(eventMips);
 	    add(mergeMIPs);
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotons, eventHitMapHcalWithoutMips, eventPhotonClusters, eventMipsEcal, eventMipsHcal } );
-	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotons, eventHitMapHcalWithoutMips, eventPhotonClusters, eventMips } );
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotons, eventHitMapHcalWithoutMips, eventPhotonClusters, eventMipsEcal, eventMipsHcal, eventMuonParticles } );
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotons, eventHitMapHcalWithoutMips, eventPhotonClusters, eventMips, eventMuonParticles } );
 	}
 
 	String eventHitMapEcalWithoutMipsOrPhotonsOrClumps = "hitMapEcalWithoutMipsOrPhotonsOrClumps";
@@ -292,8 +309,8 @@
 	    mergeClumps.setOutputList(eventClumps);
 	    add(mergeClumps);
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotonsOrClumps, eventHitMapHcalWithoutMipsOrClumps, eventPhotonClusters, eventMips, eventClumpsEcal, eventClumpsHcal } );
-	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotonsOrClumps, eventHitMapHcalWithoutMipsOrClumps, eventPhotonClusters, eventMips, eventClumps } );
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotonsOrClumps, eventHitMapHcalWithoutMipsOrClumps, eventPhotonClusters, eventMips, eventClumpsEcal, eventClumpsHcal, eventMuonParticles } );
+	    accountant.addListOfNamedLists( new String[] { eventHitMapEcalWithoutMipsOrPhotonsOrClumps, eventHitMapHcalWithoutMipsOrClumps, eventPhotonClusters, eventMips, eventClumps, eventMuonParticles } );
 	}
 
 	String eventLargeClusters = "MSTClustersLinkedWithTenOrMoreHits";
@@ -303,7 +320,7 @@
 	    String prefix = "hadronclusterfinder__";
 	    addHadronicClusterFinder(prefix, eventHitMapEcalWithoutMipsOrPhotonsOrClumps, eventHitMapHcalWithoutMipsOrClumps, eventMipsEcal, eventMipsHcal, eventClumpsEcal, eventClumpsHcal, eventLargeClusters, eventSmallClusters);
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventLargeClusters, eventSmallClusters, eventPhotonClusters } );
+	    accountant.addListOfNamedLists( new String[] { eventLargeClusters, eventSmallClusters, eventPhotonClusters, eventMuonParticles } );
 	}
 
 	// Likelihood-based hadronic shower reconstruction
@@ -359,7 +376,7 @@
 		}
 	    }
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventSmallClusters, eventUnusedHits, eventSkeletonClusters, eventPhotonClusters } );
+	    accountant.addListOfNamedLists( new String[] { eventSmallClusters, eventUnusedHits, eventSkeletonClusters, eventPhotonClusters, eventMuonParticles } );
 
 	    // Check track matches are sensible; don't match multiple
 	    // tracks to the same skeleton.
@@ -385,7 +402,7 @@
 	    prefix = "halo__";
  	    addHaloAssigner(prefix, eventSplitSkeletonClusters, eventUnusedHits, eventHaloClusters, eventUnusedHitsMinusHalo);
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventSmallClusters, eventUnusedHitsMinusHalo, eventHaloClusters, eventPhotonClusters } );
+	    accountant.addListOfNamedLists( new String[] { eventSmallClusters, eventUnusedHitsMinusHalo, eventHaloClusters, eventPhotonClusters, eventMuonParticles } );
 
 	    // Match to tracks
 	    String tempParticleList = "transientChargedHadronParticles";
@@ -403,8 +420,8 @@
 	    addSmallPhotonClusterFinder(prefix, fragID, eventHaloClusters, eventSmallClusters, eventHaloMinusPhotonClusters, eventSmallClustersNotPhotons, eventSmallPhotonClusters);
             addSmallPhotonParticleFinder(prefix+"ron__",eventSmallPhotonClusters,eventSmallPhotonParticles,ronPhotonCalib);
 	    // Book-keeping
-	    accountant.addListOfNamedLists( new String[] { eventSmallClustersNotPhotons, eventUnusedHitsMinusHalo, eventHaloMinusPhotonClusters, eventSmallPhotonClusters, eventPhotonClusters } );
-	    accountant.addListOfNamedLists( new String[] { eventSmallClustersNotPhotons, eventUnusedHitsMinusHalo, eventHaloMinusPhotonClusters, eventSmallPhotonParticles, eventPhotonClusters } );
+	    accountant.addListOfNamedLists( new String[] { eventSmallClustersNotPhotons, eventUnusedHitsMinusHalo, eventHaloMinusPhotonClusters, eventSmallPhotonClusters, eventPhotonClusters, eventMuonParticles } );
+	    accountant.addListOfNamedLists( new String[] { eventSmallClustersNotPhotons, eventUnusedHitsMinusHalo, eventHaloMinusPhotonClusters, eventSmallPhotonParticles, eventPhotonClusters, eventMuonParticles } );
 
 	    // Support classes to merge/handle fragments
 	    SimpleFragmentMerger fragMerge = new SimpleFragmentMerger();
@@ -425,7 +442,7 @@
 	    prefix = "photonmaker__";
 	    addPhotonParticleMaker(prefix, eventPhotonClustersWithFragments, eventLargePhotonParticleList, ronPhotonCalib);
 	    
-	    String[] mergeThese = { eventHadronParticles, eventLargePhotonParticleList, eventSmallPhotonParticles } ;
+	    String[] mergeThese = { eventHadronParticles, eventLargePhotonParticleList, eventSmallPhotonParticles, eventMuonParticles } ;
 	    addMerger(mergeThese, eventOutputParticles);
 
 	    // Flush the output list to make sure it's LCIO-compatible
@@ -439,7 +456,7 @@
 
 	    // Book-keeping
 	    // Need to be smarter about this bit:
-	    accountant.addListOfNamedLists( new String[] { eventSmallPhotonParticles, eventLargePhotonParticleList, "merge_ron_ron__neutralHadronParticles", "merge_ron_ron__chargedHadronParticlesAfterFragmentHandling" } );
+	    accountant.addListOfNamedLists( new String[] { eventSmallPhotonParticles, eventLargePhotonParticleList, "merge_ron_ron__neutralHadronParticles", "merge_ron_ron__chargedHadronParticlesAfterFragmentHandling", eventMuonParticles } );
 
 	    accountant.addListOfNamedLists( new String[] { eventOutputParticlesFlushed } );
 	}
@@ -500,6 +517,41 @@
         add(myCheatPhotonFinder);
     }
 
+    protected void addCheatingMuonFinder(String prefix, String inputHitMapEcal, String inputHitMapHcal, String inputTrackList, String outputMuonClusterList, String outputHitMapEcal, String outputHitMapHcal, String mcListName, String outputTrackList, String outputParticleList)
+    {
+	System.out.println("WARNING: Cheating on mon finder");
+
+        add(new ListFilterDriver(new ParticlePDGDecision(13), mcListName, prefix+"MCParticlesMuonsOnly"));
+
+	List<String> inputHitMaps = new Vector<String>();
+	inputHitMaps.add(inputHitMapEcal);
+	inputHitMaps.add(inputHitMapHcal);
+	add(new HitMapAddDriver(inputHitMaps, prefix+"TempHitMap"));
+
+        org.lcsim.recon.cluster.cheat.PerfectClusterer myCheatMuonFinder = new org.lcsim.recon.cluster.cheat.PerfectClusterer();
+        myCheatMuonFinder.setInputHitMap(prefix+"TempHitMap");
+        myCheatMuonFinder.setOutputHitMap(prefix+"TempOutputHitMap");
+        myCheatMuonFinder.setOutputClusterList(prefix+"TempMuonClusterList");
+        myCheatMuonFinder.setMCParticleList(prefix+"MCParticlesMuonsOnly");
+        myCheatMuonFinder.allowHitSharing(false);
+        add(myCheatMuonFinder);
+
+	PerfectIdentifier id = new PerfectIdentifier();
+	id.setInputClusterList(prefix+"TempMuonClusterList");
+	id.setOutputParticleList(outputParticleList);
+	id.setMCParticleList(prefix+"MCParticlesMuonsOnly");
+	id.setInputTrackList(inputTrackList);
+	id.setOutputTrackList(outputTrackList);
+	id.requireTrack(true);
+	add(id);
+
+	// OK. Now go back and remove the hits from muons that were used
+	add(new ParticleListToClusterListDriver(outputParticleList, outputMuonClusterList));
+	add(new ClusterListToHitMapDriver(outputMuonClusterList, prefix+"TempMuonHitMap"));
+	add(new HitMapSubtractDriver(inputHitMapEcal, prefix+"TempMuonHitMap", outputHitMapEcal));
+	add(new HitMapSubtractDriver(inputHitMapHcal, prefix+"TempMuonHitMap", outputHitMapHcal));
+    }
+
     protected void addRonPhotonFinder(String prefix, String inputHitMap, String outputPhotonClusterList, String outputHitMap)
     {
 	org.lcsim.contrib.uiowa.RonPhotonFinder.RonPhotonFinderSid01 driver = new org.lcsim.contrib.uiowa.RonPhotonFinder.RonPhotonFinderSid01(inputHitMap, outputHitMap, outputPhotonClusterList);
CVSspam 0.2.8