Commit in lcsim/src/org/lcsim/contrib/Cassell/recon/Cheat on MAIN
CheatReconOutputExample.java+36-21.1 -> 1.2
Update example to show how to get track parameters and errors

lcsim/src/org/lcsim/contrib/Cassell/recon/Cheat
CheatReconOutputExample.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CheatReconOutputExample.java	8 Nov 2007 23:34:46 -0000	1.1
+++ CheatReconOutputExample.java	30 Nov 2007 15:01:23 -0000	1.2
@@ -3,6 +3,7 @@
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.ReconstructedParticle;
 import org.lcsim.event.MCParticle;
+import org.lcsim.event.Track;
 import org.lcsim.util.Driver;
 import org.lcsim.util.loop.LCIODriver;
 import org.lcsim.contrib.Cassell.recon.Cheat.CheatReconDriver;
@@ -17,7 +18,7 @@
  * @see org.lcsim.util.loop.LCIODriver
  * 
  * @author Tony Johnson
- * @version $Id: CheatReconOutputExample.java,v 1.1 2007/11/08 23:34:46 cassell Exp $
+ * @version $Id: CheatReconOutputExample.java,v 1.2 2007/11/30 15:01:23 cassell Exp $
  */
 public class CheatReconOutputExample extends Driver
 {
@@ -63,7 +64,8 @@
 //
         List<ReconstructedParticle> ppr = event.get(ReconstructedParticle.class,PPRPflowRname);
 //
-// Plot the energy sum and invariant mass for each event
+// Plot the energy sum and invariant mass for each event. First the final state
+// particles.
 //
         double evtE = 0.;
         double evtPx = 0.;
@@ -82,6 +84,9 @@
         aida.cloud1D("Event non-neutrino final state energy").fill(evtE);
         double evtM = Math.sqrt(evtE*evtE - evtPx*evtPx - evtPy*evtPy - evtPz*evtPz);
         aida.cloud1D("Event non-neutrino final state mass").fill(evtM);
+//
+// Next look at the reconstructed particles
+//
         evtE = 0.;
         evtPx = 0.;
         evtPy = 0.;
@@ -93,6 +98,35 @@
            evtPx += P.x();
            evtPy += P.y();
            evtPz += P.z();
+//
+// Plot the track parameters for charged reconstructed particles
+//
+           if(p.getCharge() != 0)
+           {
+               List<Track> tl = p.getTracks();
+               if(tl.size() < 1)
+               {
+                   System.out.println("No tracks for charged recon particle!!!");
+                   System.out.println("PDG = "+p.getParticleIDUsed().getPDG()+
+                       " E = "+p.getEnergy());
+               }
+               else if(tl.size() > 1)
+               {
+                   System.out.println(tl.size()+" tracks for charged recon particle!!!");
+                   System.out.println("PDG = "+p.getParticleIDUsed().getPDG()+
+                       " E = "+p.getEnergy());
+               }
+               else
+               {
+                   Track t = tl.get(0);
+                   double[] tp = t.getTrackParameters();
+                   for(int i=0;i<tp.length;i++)
+                   {
+                       aida.cloud1D("Track parameter "+i).fill(tp[i]);
+                       aida.cloud1D("Error on track parameter "+i).fill(t.getErrorMatrix().diagonal(i));
+                   }
+               }
+           }
         }
         aida.cloud1D("Event reconstructed energy").fill(evtE);
         evtM = Math.sqrt(evtE*evtE - evtPx*evtPx - evtPy*evtPy - evtPz*evtPz);
CVSspam 0.2.8