lcsim/src/org/lcsim/recon/cheater
diff -N CheatPhotonFinder.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CheatPhotonFinder.java 7 Nov 2010 21:46:14 -0000 1.1
@@ -0,0 +1,82 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.lcsim.recon.cheater;
+import java.util.*;
+import org.lcsim.util.Driver;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.util.hitmap.HitMap;
+import org.lcsim.util.lcio.LCIOConstants;
+import org.lcsim.recon.cluster.util.*;
+
+/**
+ *
+ * @author cassell
+ */
+public class CheatPhotonFinder extends Driver
+{
+ String inName;
+ String outHName;
+ String outCName;
+ String CheatReconRname = "ReconPerfectReconParticles";
+ String PPRPflowRname = "PPRReconParticles";
+ String CheatReconFSname = "ReconFSParticles";
+ String ExtraTracks = "ExtraTracks";
+ public CheatPhotonFinder(String in, String outH, String outC)
+ {
+ inName = in;
+ outHName = outH;
+ outCName = outC;
+//
+// Do the cheating reconstruction (includes Digisim)
+//
+ CheatReconDriverRealTracking crd = new CheatReconDriverRealTracking();
+ crd.setCheatReconstructedParticleOutputName(CheatReconRname);
+ crd.setCheatFSParticleOutputName(CheatReconFSname);
+ add(crd);
+//
+// Make the perfect pattern recognition pflow reconstructed particles from the
+// Cheat Recon particles
+//
+ PPRDriverRealTracking pprd = new PPRDriverRealTracking(CheatReconRname,PPRPflowRname,ExtraTracks);
+ ClusterEnergyCalculator pcec = new QPhotonClusterEnergyCalculator();
+ pprd.setPhotonClusterEnergyCalculator(pcec);
+ ClusterEnergyCalculator nhcec = new QNeutralHadronClusterEnergyCalculator();
+ pprd.setNeutralHadronClusterEnergyCalculator(nhcec);
+ add(pprd);
+ }
+ protected void process(EventHeader event)
+ {
+ super.process(event);
+ HitMap inmap = (HitMap) event.get(inName);
+ List<Cluster> photons = new ArrayList<Cluster>();
+ List<ReconstructedParticle> rl = event.get(ReconstructedParticle.class,PPRPflowRname);
+ for(ReconstructedParticle p:rl)
+ {
+ if((p.getParticleIDUsed().getPDG() == 22)||
+ (Math.abs(p.getParticleIDUsed().getPDG()) == 11) )
+ {
+ if(p.getClusters().size() == 1)photons.add(p.getClusters().get(0));
+ }
+ }
+ int flag = 1<<LCIOConstants.CLBIT_HITS;
+ event.put(outCName, photons, Cluster.class, flag );
+ HitMap outputHitMap = new HitMap(inmap);
+// Remove photon hits
+ for (Cluster clus : photons)
+ {
+ for (CalorimeterHit hit : clus.getCalorimeterHits())
+ {
+ Long cellID = new Long(hit.getCellID());
+ outputHitMap.remove(cellID);
+ }
+ }
+ event.put(outHName, outputHitMap);
+ }
+
+}