lcsim/src/org/lcsim/contrib/uiowa/template
diff -N PerfectPatternRecognitionPFA.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PerfectPatternRecognitionPFA.java 17 Nov 2006 21:23:40 -0000 1.1
@@ -0,0 +1,164 @@
+package org.lcsim.recon.pfa.structural;
+
+// Overkill!
+import java.util.*;
+import hep.physics.vec.*;
+import hep.physics.particle.*;
+
+import org.lcsim.util.*;
+import org.lcsim.util.decision.*;
+import org.lcsim.util.hitmap.*;
+import org.lcsim.event.*;
+import org.lcsim.event.util.*;
+import org.lcsim.digisim.*;
+import org.lcsim.recon.cluster.mst.*;
+import org.lcsim.recon.cluster.mipfinder.*;
+import org.lcsim.recon.cluster.clumpfinder.*;
+import org.lcsim.recon.cluster.structural.*;
+import org.lcsim.recon.cluster.structural.likelihood.*;
+import org.lcsim.recon.cluster.util.*;
+import org.lcsim.recon.cluster.analysis.*;
+import org.lcsim.mc.fast.tracking.*;
+import org.lcsim.recon.pfa.identifier.*;
+import org.lcsim.recon.pfa.output.*;
+import org.lcsim.recon.pfa.cheat.*;
+import org.lcsim.recon.cluster.cheat.*;
+
+import org.lcsim.util.aida.AIDA;
+
+public class PerfectPatternRecognitionPFA extends Driver
+{
+ public PerfectPatternRecognitionPFA()
+ {
+ // Run digisim
+ add(new CalHitMapDriver());
+ add(new org.lcsim.digisim.DigiSimDriver());
+ add( new SimCalorimeterHitsDriver() );
+
+ // Set up truth info
+ CreateFinalStateMCParticleList mcListMakerGen = new CreateFinalStateMCParticleList("Gen");
+ add(mcListMakerGen);
+ String mcListNameGen = "GenFinalStateParticles";
+ String mcListName = mcListNameGen;
+ add (new org.lcsim.mc.fast.tracking.MCFastTracking());
+
+ // Ad-hoc calibration
+ org.lcsim.contrib.uiowa.compile.AdHocEnergyCalibration adHocCalib = new org.lcsim.contrib.uiowa.compile.AdHocEnergyCalibration();
+ add(adHocCalib);
+ // Ron's calibrations
+ PhotonClusterEnergyCalculator ronPhotonCalib = new PhotonClusterEnergyCalculator();
+ GenericClusterEnergyCalculator ronGenericCalib = new GenericClusterEnergyCalculator();
+ DetailedNeutralHadronClusterEnergyCalculator ronNeutralHadronCalib = new DetailedNeutralHadronClusterEnergyCalculator();
+
+ // Hit maps
+ HitListToHitMapDriver hitmapEcal = new HitListToHitMapDriver();
+ hitmapEcal.addInputList("EcalBarrDigiHits");
+ hitmapEcal.addInputList("EcalEndcapDigiHits");
+ hitmapEcal.setOutput("input hit map ecal");
+ HitListToHitMapDriver hitmapHcal = new HitListToHitMapDriver();
+ hitmapHcal.addInputList("HcalBarrDigiHits");
+ hitmapHcal.addInputList("HcalEndcapDigiHits");
+ hitmapHcal.setOutput("input hit map hcal");
+ add(hitmapEcal);
+ add(hitmapHcal);
+ HitMapAddDriver adder = new HitMapAddDriver();
+ adder.addInputHitMap("input hit map ecal");
+ adder.addInputHitMap("input hit map hcal");
+ adder.setOutputHitMap("input hit map all");
+ add(adder);
+
+ // Cheat: Find photons
+ DecisionMakerSingle<Particle> photonDecision = new ParticlePDGDecision(22);
+ DecisionMakerSingle<Particle> notPhotonDecision = new NotDecisionMakerSingle<Particle> (photonDecision);
+ add(new ListFilterDriver( photonDecision, mcListName, "MCParticles photons only"));
+ add(new ListFilterDriver(notPhotonDecision, mcListName, "MCParticles not photons"));
+ PerfectClusterer myCheatPhotonFinder = new PerfectClusterer();
+ myCheatPhotonFinder.setInputHitMap("input hit map all");
+ myCheatPhotonFinder.setOutputHitMap("hit map without photons");
+ myCheatPhotonFinder.setOutputClusterList("photon clusters");
+ myCheatPhotonFinder.setMCParticleList("MCParticles photons only");
+ myCheatPhotonFinder.allowHitSharing(false);
+ add(myCheatPhotonFinder);
+
+ // Cheat: Find e/pi/mu/K/p
+ OrDecisionMakerSingle<Particle> chargedDecision = new OrDecisionMakerSingle<Particle>();
+ chargedDecision.addDecisionMaker(new ParticlePDGDecision(11)); // e-/e+
+ chargedDecision.addDecisionMaker(new ParticlePDGDecision(211)); // pi+/pi-
+ chargedDecision.addDecisionMaker(new ParticlePDGDecision(13)); // mu-/mu+
+ chargedDecision.addDecisionMaker(new ParticlePDGDecision(321)); // K+/K-
+ chargedDecision.addDecisionMaker(new ParticlePDGDecision(2212)); // p/pbar
+ DecisionMakerSingle<Particle> notChargedDecision = new NotDecisionMakerSingle<Particle> (chargedDecision);
+ add(new ListFilterDriver( chargedDecision, "MCParticles not photons", "MCParticles charged only"));
+ add(new ListFilterDriver(notChargedDecision, "MCParticles not photons", "MCParticles not photons not charged"));
+ PerfectClusterer myCheatChargedFinder = new PerfectClusterer();
+ myCheatChargedFinder.setInputHitMap("hit map without photons");
+ myCheatChargedFinder.setOutputHitMap("hit map without photons or charged");
+ myCheatChargedFinder.setOutputClusterList("charged clusters");
+ myCheatChargedFinder.setMCParticleList("MCParticles charged only");
+ myCheatChargedFinder.allowHitSharing(false);
+ add(myCheatChargedFinder);
+
+ // Cheat: Anything else
+ PerfectClusterer myCheatNeutralFinder = new PerfectClusterer();
+ myCheatNeutralFinder.setInputHitMap("hit map without photons or charged");
+ myCheatNeutralFinder.setOutputHitMap("hit map without photons or charged or neutral");
+ myCheatNeutralFinder.setOutputClusterList("neutral clusters");
+ myCheatNeutralFinder.setMCParticleList("MCParticles not photons not charged");
+ myCheatNeutralFinder.allowHitSharing(false);
+ add(myCheatNeutralFinder);
+
+ add(new DebugInfoHitMap("hit map without photons or charged or neutral"));
+
+ // Make particles: photons
+ SimpleNeutralParticleMaker myPhotonIdentifier1 = new SimpleNeutralParticleMaker(22);
+ SimpleNeutralParticleMaker myPhotonIdentifier2 = new SimpleNeutralParticleMaker(22);
+ myPhotonIdentifier1.setCalibration(adHocCalib);
+ myPhotonIdentifier2.setCalibration(ronPhotonCalib);
+ myPhotonIdentifier1.setInputClusterList("photon clusters");
+ myPhotonIdentifier2.setInputClusterList("photon clusters");
+ myPhotonIdentifier1.setOutputParticleList("photon particles");
+ myPhotonIdentifier2.setOutputParticleList("photon particles (ron calib)");
+ add(myPhotonIdentifier1);
+ add(myPhotonIdentifier2);
+ // Make particles: charged
+ PerfectIdentifier myChargedIdentifier = new PerfectIdentifier();
+ myChargedIdentifier.setInputClusterList("charged clusters");
+ myChargedIdentifier.setOutputParticleList("charged particles");
+ myChargedIdentifier.setMCParticleList(mcListName);
+ myChargedIdentifier.setInputTrackList(EventHeader.TRACKS);
+ add(myChargedIdentifier);
+ // Make particles: neutral
+ SimpleNeutralParticleMaker myNeutralIdentifier1 = new SimpleNeutralParticleMaker(22); // everything is a photon
+ SimpleNeutralParticleMaker myNeutralIdentifier2 = new SimpleNeutralParticleMaker(22); // everything is a photon
+ myNeutralIdentifier1.setCalibration(adHocCalib);
+ myNeutralIdentifier2.setCalibration(ronNeutralHadronCalib);
+ myNeutralIdentifier1.setInputClusterList("neutral clusters");
+ myNeutralIdentifier2.setInputClusterList("neutral clusters");
+ myNeutralIdentifier1.setOutputParticleList("neutral particles");
+ myNeutralIdentifier2.setOutputParticleList("neutral particles (ron calib)");
+ add(myNeutralIdentifier1);
+ add(myNeutralIdentifier2);
+
+ // Merge
+ ListAddDriver<ReconstructedParticle> mergeParticles1 = new ListAddDriver<ReconstructedParticle>();
+ ListAddDriver<ReconstructedParticle> mergeParticles2 = new ListAddDriver<ReconstructedParticle>();
+ mergeParticles1.addInputList("photon particles");
+ mergeParticles2.addInputList("photon particles (ron calib)");
+ mergeParticles1.addInputList("charged particles");
+ mergeParticles2.addInputList("charged particles");
+ mergeParticles1.addInputList("neutral particles");
+ mergeParticles2.addInputList("neutral particles (ron calib)");
+ mergeParticles1.setOutputList("all particles");
+ mergeParticles2.setOutputList("all particles (ron calib)");
+ add(mergeParticles1);
+ add(mergeParticles2);
+
+ // Plot-making stuff
+ ConfusionPlotter confMerge = new ConfusionPlotter("all particles", mcListName, "perfect-confusion.aida");
+ //confMerge.setDebug(true);
+ add(confMerge);
+ add(new CorrectedEnergySumPlotter("input hit map all", "all particles", mcListName, "perfect-reco-corrected.aida"));
+ add(new CorrectedEnergySumPlotter("input hit map all", "all particles (ron calib)", mcListName, "perfect-reco-corrected-ron.aida"));
+
+ }
+}