Commit in slicPandora on MAIN
Makefile+24-291.9 -> 1.10
src/CalorimeterHitMaker.cpp+1-21.2 -> 1.3
   /CalorimeterHitProcessor.cpp+2-21.2 -> 1.3
   /PfoProcessor.cpp+83-101.2 -> 1.3
include/EventMarkerProcessor.h+25added 1.1
       /ResetPandoraProcessor.h+28added 1.1
       /CalorimeterHitMaker.h+11.1 -> 1.2
       /DetectorGeometry.h+21.6 -> 1.7
       /EventProcessor.h+10-31.2 -> 1.3
       /IDDecoder.h+11.2 -> 1.3
       /JobConfig.h+11.2 -> 1.3
       /JobManager.h+11.4 -> 1.5
       /PfoConstructionAlgorithm.h+41.1 -> 1.2
       /PfoProcessor.h+11.1 -> 1.2
+184-46
2 added + 12 modified, total 14 files
checkpoint

slicPandora
Makefile 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- Makefile	9 Mar 2010 19:59:19 -0000	1.9
+++ Makefile	9 Mar 2010 20:13:41 -0000	1.10
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.9 2010/03/09 19:59:19 jeremy Exp $
+# $Id: Makefile,v 1.10 2010/03/09 20:13:41 jeremy Exp $
 
 ifndef PANDORAPFA
 $(error Set PANDORAPFA env var to location of Pandora PFA New.)
@@ -29,9 +29,9 @@
 
 # libs
 LIBS=-L$(PANDORAPFA)/lib -lPandoraPFANew -L$(LCIO)/lib -llcio -lsio
+RUNLIBS=$(LIBS) -L$(PWD)/lib -l$(BINNAME)
 
 # tests
-TESTLIBS=$(LIBS) -L$(PWD)/lib -l$(BINNAME)
 TESTBINS=$(subst tests,bin,$(basename $(TESTSRCS)))
 TESTOBJ=$(addsuffix .o, $(basename $(TESTSRCS)))
 TESTSCRIPT=$(PWD)/scripts/run_test.sh
@@ -47,6 +47,14 @@
 # Default target.
 .DEFAULT: all
 
+# Create the lib directory.
+libdir:
+	@mkdir -p $(PWD)/lib;
+
+# Create the bin directory.
+bindir:
+	@mkdir -p $(PWD)/bin;
+
 # Create .o files from .cpp files.
 %.o: %.cpp
 	@echo "Compiling $< ..."; $(CXX) -c $(CXXFLAGS) -o $@ $<
@@ -67,41 +75,28 @@
 libs: lib shlib
 
 # Compile all the tests.
-tests: libs FORCE $(TESTS)
+tests: $(TESTS)
 
-# Test program targets.
-$(TESTS): FORCE
+# Single test program targets.
+$(TESTS): 
 	@echo "Compiling $@ ..."; \
-	$(CXX) $(CXXFLAGS) $(TESTLIBS) -o ./bin/$@ $(PWD)[log in to unmask]
-
-FORCE:
-
-# Run a single test.  
-# These are named like ${BINNAME}_run to avoid conflicts with other targets.
-$(TESTRUN) :	
-	@res=$(shell $(TESTSCRIPT) $(subst _run,,$@));
-
-# Run all the tests.
-runtests: tests FORCE
-	@rm -f $(PWD)/test.log; \
-	for testrun in $(TESTRUN); do \
-		echo "Running test case: $$testrun"; \
-		$(MAKE) -s $$testrun; \
-	done;
-
-FORCE:
+	$(CXX) $(CXXFLAGS) $(RUNLIBS) -o ./bin/$@ $(PWD)[log in to unmask]
 
 # Clean up the object files and directories.
 clean:
 	@rm -rf $(OBJS) $(PWD)/lib $(PWD)/bin
 
-# Create the lib directory.
-libdir:
-	@mkdir -p $(PWD)/lib;
+# Run a single test.  These are named like ${BINNAME}_run to avoid conflicts with other targets.
+#$(TESTRUN) :	
+#	@res=$(shell $(TESTSCRIPT) $(subst _run,,$@));
 
-# Create the bin directory.
-bindir:
-	@mkdir -p $(PWD)/bin;
+# Run all the tests.
+#runtests: tests 
+#	@rm -f $(PWD)/test.log; \
+#	for testrun in $(TESTRUN); do \
+#		echo "Running test case: $$testrun"; \
+#		$(MAKE) -s $$testrun; \
+#	done;
 
 # No standalone binary is created for SlicPandora, just the library.
 # The test cases create binaries.  Leave target here for reference.  

slicPandora/src
CalorimeterHitMaker.cpp 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- CalorimeterHitMaker.cpp	9 Jan 2010 00:38:29 -0000	1.2
+++ CalorimeterHitMaker.cpp	9 Mar 2010 20:13:42 -0000	1.3
@@ -36,8 +36,7 @@
 }
 
 CalorimeterHitMaker::~CalorimeterHitMaker()
-{
-}
+{}
 
 void CalorimeterHitMaker::processEvent(lcio::LCEvent* event)
 {

slicPandora/src
CalorimeterHitProcessor.cpp 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- CalorimeterHitProcessor.cpp	8 Mar 2010 23:00:53 -0000	1.2
+++ CalorimeterHitProcessor.cpp	9 Mar 2010 20:13:42 -0000	1.3
@@ -1,4 +1,4 @@
-// $Id: CalorimeterHitProcessor.cpp,v 1.2 2010/03/08 23:00:53 jeremy Exp $
+// $Id: CalorimeterHitProcessor.cpp,v 1.3 2010/03/09 20:13:42 jeremy Exp $
 
 #include "CalorimeterHitProcessor.h"
 
@@ -18,7 +18,7 @@
 using EVENT::CalorimeterHit;
 using EVENT::LCCollection;
 
-#define CALO_PARAMS_DEBUG 1
+// #define CALO_PARAMS_DEBUG 1
 
 void CalorimeterHitProcessor::processEvent(EVENT::LCEvent* event)
 {

slicPandora/src
PfoProcessor.cpp 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- PfoProcessor.cpp	8 Mar 2010 23:00:53 -0000	1.2
+++ PfoProcessor.cpp	9 Mar 2010 20:13:42 -0000	1.3
@@ -1,11 +1,17 @@
-// $Id: PfoProcessor.cpp,v 1.2 2010/03/08 23:00:53 jeremy Exp $
+// $Id: PfoProcessor.cpp,v 1.3 2010/03/09 20:13:42 jeremy Exp $
 #include "PfoProcessor.h"
 
 // lcio
-#include "EVENT/LCIO.h"
-#include "IMPL/LCFlagImpl.h"
+
+#include "EVENT/LCCollection.h"
+#include "EVENT/SimCalorimeterHit.h"
+#include "EVENT/CalorimeterHit.h"
 #include "IMPL/LCCollectionVec.h"
+#include "IMPL/ReconstructedParticleImpl.h"
 #include "IMPL/ClusterImpl.h"
+#include "IMPL/LCFlagImpl.h" 
+#include "EVENT/LCIO.h"
+#include "EVENT/Track.h"
 
 // slicPandora
 #include "PfoConstructionAlgorithm.h"
@@ -14,6 +20,11 @@
 using IMPL::LCCollectionVec;
 using IMPL::LCFlagImpl;
 using IMPL::ClusterImpl;
+using IMPL::ReconstructedParticleImpl;
+using EVENT::CalorimeterHit;
+using EVENT::Track;
+using std::cout;
+using std::endl;
 
 PfoProcessor::PfoProcessor()
     : EventProcessor("PfoProcessor")
@@ -22,22 +33,84 @@
 PfoProcessor::~PfoProcessor()
 {}
 
-void PfoProcessor::processEvent(EVENT::LCEvent*)
+void PfoProcessor::processEvent(EVENT::LCEvent* event)
 {
     std::cout << "PfoProcessor::processEvent" << std::endl;
-
-    // Setup cluster collection.
-    /*
+        // first a container for the clusters...
     LCCollectionVec* clusterVec = new LCCollectionVec(EVENT::LCIO::CLUSTER);
+    // if we want to point back to the hits we need to set the flag
     LCFlagImpl clusterFlag(0);
     clusterFlag.setBit(EVENT::LCIO::CLBIT_HITS);
     clusterVec->setFlag(clusterFlag.getFlag());
 
+    // get the particle flow objects
     pandora::ParticleFlowObjectList particleFlowObjectList;
     PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraApi::GetParticleFlowObjects(getJobManager()->getPandora(),
-                                                                                                                            particleFlowObjectList));
+            particleFlowObjectList));
+
+    std::cout << "Pandora found " << particleFlowObjectList.size() << " PFOs" << std::endl;
+
     LCCollectionVec* pReconstructedParticleCollection = new LCCollectionVec(EVENT::LCIO::RECONSTRUCTEDPARTICLE);
-    */
 
-    
+    // get particle flow objects and create "reconstructed particles"
+    for (pandora::ParticleFlowObjectList::iterator itPFO = particleFlowObjectList.begin(), itPFOEnd = particleFlowObjectList.end();
+            itPFO != itPFOEnd; ++itPFO)
+    {
+        ReconstructedParticleImpl *pReconstructedParticle = new ReconstructedParticleImpl();
+
+        pandora::ClusterAddressList clusterAddressList = (*itPFO)->GetClusterAddressList();
+        cout << "Found " << clusterAddressList.size() << " clusters." << endl;
+        pandora::TrackAddressList trackAddressList = (*itPFO)->GetTrackAddressList();
+
+        // make LCIO clusters
+        for (pandora::ClusterAddressList::iterator itCluster = clusterAddressList.begin(), itClusterEnd = clusterAddressList.end();
+                itCluster != itClusterEnd; ++itCluster)
+        {
+            ClusterImpl *pCluster = new ClusterImpl();
+            
+            double clusterEnergy = 0.;
+            float* clusterPosition;
+            double maxE = 0;
+            for (pandora::CaloHitAddressList::iterator itHit = (*itCluster).begin(), itHitEnd = (*itCluster).end(); itHit != itHitEnd; ++itHit)
+            {
+              
+                clusterEnergy += ((CalorimeterHit*) (*itHit))->getEnergy();
+                if(((CalorimeterHit*) (*itHit))->getEnergy()>maxE)
+                {
+                    maxE = ((CalorimeterHit*) (*itHit))->getEnergy();
+                    //avert your gaze...
+                    clusterPosition = const_cast<float*>(((CalorimeterHit*) (*itHit))->getPosition());
+                }
+                pCluster->addHit((CalorimeterHit*) (*itHit), 1.0); // transform from Uid (=void*) to a CalorimeterHit*
+            }
+            pCluster->setEnergy(clusterEnergy);
+            pCluster->setPosition(clusterPosition);
+            cout << "Cluster contains " << pCluster->getCalorimeterHits().size() << " hits" << endl;
+            // add this cluster to the collection
+            clusterVec->addElement(pCluster);
+            pReconstructedParticle->addCluster(pCluster);
+        }
+
+        // add tracks
+        for (pandora::TrackAddressList::iterator itTrack = trackAddressList.begin(), itTrackEnd = trackAddressList.end(); itTrack != itTrackEnd;
+                ++itTrack)
+        {
+            pReconstructedParticle->addTrack((Track*) (*itTrack));
+        }
+
+        float momentum[3] = {(*itPFO)->GetMomentum().GetX(), (*itPFO)->GetMomentum().GetY(), (*itPFO)->GetMomentum().GetZ()};
+        pReconstructedParticle->setMomentum(momentum);
+        pReconstructedParticle->setEnergy((*itPFO)->GetEnergy());
+        pReconstructedParticle->setMass((*itPFO)->GetMass());
+        pReconstructedParticle->setCharge((*itPFO)->GetChargeSign());
+        pReconstructedParticle->setType((*itPFO)->GetParticleId());
+
+        pReconstructedParticleCollection->addElement(pReconstructedParticle);
+    }
+    // add the list of clusters to the event
+    event->addCollection(clusterVec, "ReconClusters");
+    //cout << "end of loop over pandora outpout" << endl;
+    event->addCollection(pReconstructedParticleCollection, "PandoraPFOCollection");
+    //cout << "added pfo objects to event" << endl;
+       
 }

slicPandora/include
EventMarkerProcessor.h added at 1.1
diff -N EventMarkerProcessor.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EventMarkerProcessor.h	9 Mar 2010 20:13:42 -0000	1.1
@@ -0,0 +1,25 @@
+// $Id: EventMarkerProcessor.h,v 1.1 2010/03/09 20:13:42 jeremy Exp $
+
+#ifndef EVENTMARKERPROCESSOR_H
+#define EVENTMARKERPROCESSOR_H 1
+
+#include "EventProcessor.h"
+
+class EventMarkerProcessor : public EventProcessor
+{
+public:
+    EventMarkerProcessor() : EventProcessor("EventMarkerProcessor") {;}
+    virtual ~EventMarkerProcessor() {;}
+
+public:
+    
+    void processEvent(EVENT::LCEvent* event)
+    {
+        std::cout << std::endl;
+        std::cout << ">>>>>> EVENT #" << event->getEventNumber() << std::endl;
+        std::cout << std::endl;
+    }
+
+};
+
+#endif

slicPandora/include
ResetPandoraProcessor.h added at 1.1
diff -N ResetPandoraProcessor.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ResetPandoraProcessor.h	9 Mar 2010 20:13:42 -0000	1.1
@@ -0,0 +1,28 @@
+// $Id: ResetPandoraProcessor.h,v 1.1 2010/03/09 20:13:42 jeremy Exp $
+
+#ifndef RESETPANDORAPROCESSOR_H
+#define RESETPANDORAPROCESSOR_H 1
+
+// slicPandora
+#include "EventProcessor.h"
+
+// pandora
+#include "Api/PandoraApiImpl.h"
+
+class ResetPandoraProcessor : public EventProcessor
+{
+public:
+    ResetPandoraProcessor() 
+        : EventProcessor("ResetPandoraProcessor")
+    {;}
+    virtual ~ResetPandoraProcessor() {;}
+
+public:
+    void processEvent(EVENT::LCEvent*)
+    {
+        getJobManager()->getPandora().GetPandoraApiImpl()->ResetForNextEvent();
+    }   
+};
+
+
+#endif

slicPandora/include
CalorimeterHitMaker.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CalorimeterHitMaker.h	8 Jan 2010 22:55:34 -0000	1.1
+++ CalorimeterHitMaker.h	9 Mar 2010 20:13:42 -0000	1.2
@@ -1,3 +1,4 @@
+// $Id: CalorimeterHitMaker.h,v 1.2 2010/03/09 20:13:42 jeremy Exp $
 /* 
  * File:   CalorimeterHitMaker.h
  * Author: ngraf

slicPandora/include
DetectorGeometry.h 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- DetectorGeometry.h	8 Mar 2010 23:00:54 -0000	1.6
+++ DetectorGeometry.h	9 Mar 2010 20:13:42 -0000	1.7
@@ -1,3 +1,5 @@
+// $Id: DetectorGeometry.h,v 1.7 2010/03/09 20:13:42 jeremy Exp $
+
 #ifndef DetectorGeometry_h
 #define DetectorGeometry_h 1
 

slicPandora/include
EventProcessor.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- EventProcessor.h	5 Mar 2010 01:35:48 -0000	1.2
+++ EventProcessor.h	9 Mar 2010 20:13:42 -0000	1.3
@@ -1,3 +1,5 @@
+// $Id: EventProcessor.h,v 1.3 2010/03/09 20:13:42 jeremy Exp $
+
 #ifndef EventProcessor_h
 #define EventProcessor_h 1
 
@@ -25,12 +27,17 @@
 
     void setJobManager(JobManager*);
     JobManager* getJobManager();
+    
+    inline const std::string& getName()
+    {
+        return m_name;
+    }
 
     /**
      * Process a single LCIO event.  This is a pure virtual method that must be 
-     * implemented by sub-classes.  Pandora-style processors may ignore the LCEvent
-     * entirely and retrieve objects or collections from the JobManager's
-     * Pandora object.
+     * implemented by sub-classes.  Processors that are calling Pandora algorithms
+     * may ignore the LCEvent entirely and retrieve objects directly from Pandora 
+     * via the JobManager's reference to it.
      */
     virtual void processEvent(EVENT::LCEvent*) = 0;
 

slicPandora/include
IDDecoder.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- IDDecoder.h	3 Mar 2010 22:47:52 -0000	1.2
+++ IDDecoder.h	9 Mar 2010 20:13:42 -0000	1.3
@@ -1,3 +1,4 @@
+// $Id: IDDecoder.h,v 1.3 2010/03/09 20:13:42 jeremy Exp $
 #ifndef IDDecoder_h
 #define IDDecoder_h 1
 

slicPandora/include
JobConfig.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- JobConfig.h	23 Feb 2010 02:27:26 -0000	1.2
+++ JobConfig.h	9 Mar 2010 20:13:42 -0000	1.3
@@ -1,3 +1,4 @@
+// $Id: JobConfig.h,v 1.3 2010/03/09 20:13:42 jeremy Exp $
 #ifndef _SLIC_PANDORACONFIG_H
 #define _SLIC_PANDORACONFIG_H 1
 

slicPandora/include
JobManager.h 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- JobManager.h	8 Mar 2010 23:00:54 -0000	1.4
+++ JobManager.h	9 Mar 2010 20:13:42 -0000	1.5
@@ -1,3 +1,4 @@
+// $Id: JobManager.h,v 1.5 2010/03/09 20:13:42 jeremy Exp $
 #ifndef JobManager_h
 #define JobManager_h 1
 

slicPandora/include
PfoConstructionAlgorithm.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- PfoConstructionAlgorithm.h	8 Jan 2010 22:55:34 -0000	1.1
+++ PfoConstructionAlgorithm.h	9 Mar 2010 20:13:42 -0000	1.2
@@ -1,9 +1,13 @@
+// $Id: PfoConstructionAlgorithm.h,v 1.2 2010/03/09 20:13:42 jeremy Exp $
 /**
  *  @file   PandoraPFANew/include/Algorithms/PfoConstructionAlgorithm.h
  * 
  *  @brief  Header file for the pfo construction algorithm class.
  * 
  *  $Log: PfoConstructionAlgorithm.h,v $
+ *  Revision 1.2  2010/03/09 20:13:42  jeremy
+ *  checkpoint
+ *
  *  Revision 1.1  2010/01/08 22:55:34  ngraf
  *  First working release.
  *

slicPandora/include
PfoProcessor.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- PfoProcessor.h	5 Mar 2010 01:35:48 -0000	1.1
+++ PfoProcessor.h	9 Mar 2010 20:13:42 -0000	1.2
@@ -1,3 +1,4 @@
+// $Id: PfoProcessor.h,v 1.2 2010/03/09 20:13:42 jeremy Exp $
 #ifndef PFOPROCESSOR_H
 #define PFOPROCESSOR_H 1
 
CVSspam 0.2.8