Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/pfa/cheat on MAIN
Example2JetAnalysis.java+121added 1.1
CreateFinalStateMCParticleList.java+2-21.1 -> 1.2
PerfectClusteringDriver.java+20-131.2 -> 1.3
SimpleAnalysis.java+7-41.3 -> 1.4
+150-19
1 added + 3 modified, total 4 files


lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/pfa/cheat
Example2JetAnalysis.java added at 1.1
diff -N Example2JetAnalysis.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Example2JetAnalysis.java	7 Oct 2009 06:51:34 -0000	1.1
@@ -0,0 +1,121 @@
+package org.lcsim.contrib.jeremym.pfa.cheat;
+
+import hep.physics.jet.FixNumberOfJetsFinder;
+import hep.physics.jet.JetFinder;
+import hep.physics.vec.Hep3Vector;
+
+import java.util.List;
+
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.ReconstructedParticle;
+import org.lcsim.event.util.JetDriver;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+/**
+ * Test analysis using reconstructed particles
+ */
+public class Example2JetAnalysis extends Driver
+{
+	private AIDA aida = AIDA.defaultInstance();
+	String reconname = "ReconParticles";
+	String jetlistname = "JetReconstructedParticles";
+	int ievt;
+
+	public Example2JetAnalysis()
+	{}
+
+	public void setInputCollectionName(String reconname)
+	{
+		this.reconname = reconname;
+	}
+
+	public void setOutputCollectionName(String jetlistname)
+	{
+		this.jetlistname = jetlistname;
+	}
+
+	public void startOfData()
+	{		
+		JetDriver j = new JetDriver();
+		j.setInputCollectionName(reconname);
+	    j.setOutputCollectionName(jetlistname);
+		JetFinder twojet = new FixNumberOfJetsFinder(2);
+		j.setFinder(twojet);
+		add(j);   
+		ievt = 0;
+	}   
+
+	protected void process(EventHeader event)
+	{
+		AIDA.defaultInstance().tree().cd("/");
+		try 
+		{
+			super.process(event);
+		}
+		catch (Exception x)
+		{
+			System.out.println(x.getLocalizedMessage());
+			System.out.println("WARNING: Error running Jet Finder.  Skipping event.");			
+			return;
+		}
+		List<ReconstructedParticle>jets = event.get(ReconstructedParticle.class,jetlistname);
+		aida.cloud1D("Jets per Event").fill(jets.size());
+		double esum = 0.;
+		double pxsum = 0.;
+		double pysum = 0.;
+		double pzsum = 0.;
+		double chargesum = 0.;
+		double[] je = new double[jets.size()];
+		Hep3Vector[] jp = new Hep3Vector[jets.size()];
+		int ind = 0;
+		for(ReconstructedParticle jet:jets)
+		{
+			esum += jet.getEnergy();
+			je[ind] = jet.getEnergy();
+			Hep3Vector v = jet.getMomentum();
+			jp[ind] = v;
+			pxsum += v.x();
+			pysum += v.y();
+			pzsum += v.z();
+			chargesum += jet.getCharge();
+			ind++;
+		}
+		double psum = Math.sqrt(pxsum*pxsum+pysum*pysum+pzsum*pzsum);
+		double evtmass = Math.sqrt(esum*esum - psum*psum);
+		aida.cloud1D("Jet Event Energy").fill(esum);
+		aida.cloud1D("Jet Event Momentum").fill(psum);
+		aida.cloud1D("Jet Event Charge").fill(chargesum);
+		aida.cloud1D("Jet Event Mass").fill(evtmass);
+		for(int i=0;i<jets.size();i++)
+		{
+			double ct = jp[i].z()/Math.sqrt(jp[i].x()*jp[i].x() + jp[i].y()*jp[i].y() + jp[i].z()*jp[i].z());
+			double jm = Math.sqrt(jp[i].x()*jp[i].x() + jp[i].y()*jp[i].y() + jp[i].z()*jp[i].z());
+			aida.cloud1D("Jet Energy").fill(je[i]);
+			aida.cloud1D("Jet Momentum").fill(jm);
+			aida.cloud1D("Jet Mass").fill(Math.sqrt(je[i]*je[i] - jm*jm));
+			aida.cloud1D("Jet cosTheta").fill(jp[i].z()/jm);
+			if(Math.abs(ct) < .8)
+			{
+				aida.cloud1D("Jet Cut Energy").fill(je[i]);
+				aida.cloud1D("Jet Cut Momentum").fill(jm);
+				aida.cloud1D("Jet Cut Mass").fill(Math.sqrt(je[i]*je[i] - jm*jm));
+			}
+			for(int j=i+1;j<jets.size();j++)
+			{
+				double ct1 = jp[j].z()/Math.sqrt(jp[j].x()*jp[j].x() + jp[j].y()*jp[j].y() + jp[j].z()*jp[j].z());
+				double masssq = (je[i]+je[j])*(je[i]+je[j]) - (jp[i].x()+jp[j].x())*(jp[i].x()+jp[j].x()) - (jp[i].y()+jp[j].y())*(jp[i].y()+jp[j].y())
+				- (jp[i].z()+jp[j].z())*(jp[i].z()+jp[j].z());
+				double sign = 1.;
+				if(masssq < 0.)sign = -1.;
+				aida.cloud1D("Jet - Jet mass").fill(sign*Math.sqrt(sign*masssq));
+				aida.cloud2D("Jet cosTh1 vs cosTh2").fill(ct1,ct);
+				if( (Math.abs(ct) < .8)&&(Math.abs(ct1) < .8) )
+				{
+					aida.cloud1D("Jet Cut - Jet mass").fill(sign*Math.sqrt(sign*masssq));
+				}
+			}
+		}
+		ievt ++;
+	}
+}

lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/pfa/cheat
CreateFinalStateMCParticleList.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CreateFinalStateMCParticleList.java	3 Oct 2009 00:21:08 -0000	1.1
+++ CreateFinalStateMCParticleList.java	7 Oct 2009 06:51:34 -0000	1.2
@@ -19,7 +19,7 @@
  * interactions beyond a radius or z position can be ignored by using the setRadiusCut and setZCut
  * methods. The collection name of the final state particles can also be set.
  * @author Ron Cassell
- * @version $Id: CreateFinalStateMCParticleList.java,v 1.1 2009/10/03 00:21:08 jeremy Exp $
+ * @version $Id: CreateFinalStateMCParticleList.java,v 1.2 2009/10/07 06:51:34 jeremy Exp $
  */
 public class CreateFinalStateMCParticleList extends Driver
 {
@@ -417,4 +417,4 @@
         }
         return rp;
     }
-}
\ No newline at end of file
+}

lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/pfa/cheat
PerfectClusteringDriver.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- PerfectClusteringDriver.java	3 Oct 2009 00:06:36 -0000	1.2
+++ PerfectClusteringDriver.java	7 Oct 2009 06:51:34 -0000	1.3
@@ -18,16 +18,32 @@
  */
 public class PerfectClusteringDriver extends Driver
 {
-	String finalStateParticleCollection = "FinalState" + EventHeader.MC_PARTICLES;
+        // default from FinalState Driver
+	String finalStateParticleCollection = "GenFinalState" + EventHeader.MC_PARTICLES;
 	String calorimeterHitCollection = "CalorimeterHits";
 	String clusterCollection = "PerfectClusters";
-	boolean removeHits = true;
+	boolean removeHits = false;
 	boolean removeParticles = false;
 	List<Integer> pdgids = new ArrayList<Integer>();
 	int minHits = 3;
-	
+  
 	public PerfectClusteringDriver()
 	{}
+
+	public void setClusterOutputCollection(String clusterCollection)
+	{
+		this.clusterCollection = clusterCollection;
+	}
+	
+	public void setCalorimeterHitInputCollection(String hitCollection)
+	{
+		this.calorimeterHitCollection = hitCollection;
+	}
+
+        public void setFinalStateParticleCollection(String finalStateParticleCollection)
+        {
+                this.finalStateParticleCollection = finalStateParticleCollection;
+        }
 	
 	public void setRemoveHits(boolean removeHits)
 	{
@@ -78,15 +94,6 @@
 		}
 	}
 	
-	public void setClusterOutputCollection(String clusterCollection)
-	{
-		this.clusterCollection = clusterCollection;
-	}
-	
-	public void setCalorimeterHitInputCollection(String hitCollection)
-	{
-		this.calorimeterHitCollection = hitCollection;
-	}
 	
 	public void process(EventHeader event)
 	{
@@ -195,4 +202,4 @@
 		if (newClusterCollection)
 			event.put(this.clusterCollection, outputCollection);
 	}
-}
\ No newline at end of file
+}

lcsim-contrib/src/main/java/org/lcsim/contrib/jeremym/pfa/cheat
SimpleAnalysis.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- SimpleAnalysis.java	3 Oct 2009 00:06:36 -0000	1.3
+++ SimpleAnalysis.java	7 Oct 2009 06:51:34 -0000	1.4
@@ -17,7 +17,7 @@
 public class SimpleAnalysis extends Driver
 {
 	String particleCollection = "CheatReconParticles";
-	String filename = "SimpleAnalysis.aida";
+	//String filename = "SimpleAnalysis.aida";
 	AIDA aida = AIDA.defaultInstance();
 	int nevents = 0;
 	double avgE = 0.;
@@ -37,14 +37,15 @@
 	{
 		this.particleCollection = particleCollection;
 	}
-	
+/*	
 	public void setFileName(String filename)
 	{
 		this.filename = filename;
 	}
-	
+*/	
 	public void process(EventHeader event)
 	{
+		AIDA.defaultInstance().tree().cd("/");
 		double allMcpESum = 0;
 		for (MCParticle mcp : event.get(MCParticle.class, EventHeader.MC_PARTICLES))
 		{
@@ -271,7 +272,8 @@
 		aida.cloud1D("Average Reconstructed MCParticle Energy for " + nevents + " Events").fill(this.mcpETotal / nevents);
 		aida.cloud1D("Average FS MCParticle Energy for " + nevents + " Events").fill(this.allMcpETotal / nevents);
 		aida.cloud1D("Energy Error from Reconstructed MCParticle Energy for " + nevents + " Events").fill(avgE - (mcpETotal / nevents));
-		try 
+		/*
+                try 
 		{
 			aida.saveAs(filename);
 		}
@@ -279,5 +281,6 @@
 		{
 			throw new RuntimeException(x);
 		}
+*/
 	}
 }
CVSspam 0.2.8