Commit in slicPandora on MAIN
src/DetectorGeometry.cpp+215added 1.1
   /DummyProcessor.cpp+16added 1.1
   /EventProcessor.cpp+21added 1.1
   /JobConfig.cpp+126added 1.1
   /JobManager.cpp+129added 1.1
   /SimCalorimeterHitProcessor.cpp+78added 1.1
   /SlicPandoraConfig.cpp-401.1 removed
   /SlicPandoraDetectorGeometry.cpp-2041.1 removed
include/DummyProcessor.h+15added 1.1
       /EventProcessor.h+35added 1.1
       /JobManager.h+49added 1.1
       /SimCalorimeterHitProcessor.h+15added 1.1
       /DetectorGeometry.h+19-141.1 -> 1.2
       /JobConfig.h+33-61.1 -> 1.2
tests/JobManagerTest.cpp+20added 1.1
+771-264
11 added + 2 removed + 2 modified, total 15 files
end of work day checkin

slicPandora/src
DetectorGeometry.cpp added at 1.1
diff -N DetectorGeometry.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DetectorGeometry.cpp	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,215 @@
+#include "DetectorGeometry.h"
+
+#include <stdexcept>
+#include <cstdio>
+#include <cstring>
+
+#include "tinyxml.h"
+
+using namespace std;
+
+DetectorGeometry::DetectorGeometry(std::string filename)
+{
+    loadFromFile(filename);
+}
+
+void DetectorGeometry::loadFromFile(std::string filename)
+{
+    // Load doc and check if valid.
+    TiXmlDocument doc(filename.c_str());
+    if (!doc.LoadFile())
+    {
+        printf("line %i:::%s\n", doc.ErrorRow(), doc.ErrorDesc());
+        throw runtime_error("Parse error reading input XML file.");
+    }
+
+    // Get the root element.
+    TiXmlElement* root = doc.RootElement();
+
+    // Process the calorimeter elements.
+    TiXmlElement* calorimeters = root->FirstChildElement("calorimeters");
+    TiXmlElement* calElem = (TiXmlElement*) calorimeters->FirstChild("calorimeter");
+    for (calElem;
+         calElem;
+         calElem = calElem->NextSiblingElement() )
+    {
+        // Get the type of calorimeter.
+        const char* subdetType = calElem->Attribute("type");
+        
+        // Pick the right subdetector object to populate.
+        PandoraApi::GeometryParameters::SubDetectorParameters* subdet = 
+            getSubDetectorFromType(subdetType);
+
+        if (subdet == 0)
+        {
+            std::cerr << "FATAL ERROR: Could not find subdetector with type " << subdetType << ".  Exiting!"  << std::endl;
+            exit(1);
+        }            
+
+        // Numerical parameters which are attributes on calorimeter.
+        float innerR, innerZ, innerPhi;
+        innerR = innerZ = innerPhi = 0;
+        int innerSym = 0;
+        float outerR, outerZ, outerPhi; 
+        outerR = outerZ = outerPhi = 0;
+        int outerSym = 0;
+        int nlayers = 0;
+
+        // Read in parameters.
+        calElem->QueryFloatAttribute("innerR", &innerR );        
+        calElem->QueryFloatAttribute("innerZ", &innerZ );        
+        calElem->QueryFloatAttribute("innerPhi", &innerPhi );
+        calElem->QueryIntAttribute("innerSymmetryOrder", &innerSym );
+        calElem->QueryFloatAttribute("outerR", &outerR );        
+        calElem->QueryFloatAttribute("outerZ", &outerZ );        
+        calElem->QueryFloatAttribute("outerPhi", &outerPhi );
+        calElem->QueryIntAttribute("outerSymmetryOrder", &outerSym );
+
+        // Set subdetector parameters.
+        subdet->m_innerRCoordinate = innerR;
+        subdet->m_innerZCoordinate = innerZ;
+        subdet->m_innerPhiCoordinate = innerPhi;
+        subdet->m_innerSymmetryOrder = innerSym;
+        subdet->m_outerRCoordinate = outerR;
+        subdet->m_outerZCoordinate = outerZ;
+        subdet->m_outerPhiCoordinate = outerPhi;
+        subdet->m_outerSymmetryOrder = outerSym;
+
+        // Number of layers.
+        TiXmlElement* layers = (TiXmlElement*) calElem->FirstChild("layers");
+        layers->QueryIntAttribute("nlayers", &nlayers);
+        subdet->m_nLayers = nlayers;
+
+        // Process layer elements.
+        TiXmlElement* layerElem = layers->FirstChildElement();
+        for (layerElem;
+             layerElem;
+             layerElem = layerElem->NextSiblingElement() )
+        {
+            PandoraApi::GeometryParameters::LayerParameters layerParams;
+
+            float dToIp = 0;
+            float radLen = 0.;
+            float intLen = 0.;
+
+            layerElem->QueryFloatAttribute("intLen", &intLen);
+            layerElem->QueryFloatAttribute("radLen", &radLen);
+            layerElem->QueryFloatAttribute("distanceToIp", &dToIp);
+            
+            layerParams.m_closestDistanceToIp = dToIp;
+            layerParams.m_nRadiationLengths = radLen;
+            layerParams.m_nInteractionLengths = intLen;
+
+            // Add the layer to the subdetector's layer list.
+            subdet->m_layerParametersList.push_back(layerParams);
+        }
+
+        // Dump subdetector parameters to screen.
+        printOut(subdetType, subdet);
+
+        // Add cell size information to extras map.
+        ExtraSubDetectorParameters extras;
+        int cellSizeU = 0;
+        int cellSizeV = 0;
+        calElem->QueryIntAttribute("cellSizeU", &cellSizeU);
+        calElem->QueryIntAttribute("cellSizeV", &cellSizeV);
+        extras.m_cellSizeU = cellSizeU;
+        extras.m_cellSizeV = cellSizeV;
+        extras.m_collection = calElem->Attribute("collection");
+        std::string subdetTypeStr(subdetType);
+        subdetExtras[subdetTypeStr] = extras;
+    }   
+
+    // Tracking parameters.
+    TiXmlElement* tracking = root->FirstChildElement("tracking");
+    float tinnerR, touterR, tz;
+    tinnerR = touterR = tz;
+    tracking->QueryFloatAttribute("innerR", &tinnerR);
+    tracking->QueryFloatAttribute("outerR", &touterR);
+    tracking->QueryFloatAttribute("z", &tz);
+    geom.m_mainTrackerInnerRadius = tinnerR;
+    geom.m_mainTrackerOuterRadius = touterR;
+    geom.m_mainTrackerZExtent = tz;
+
+    // Print tracking.
+    printf("Tracking: \n");
+    printf("    mainTrackerInnerRadius: %f\n", geom.m_mainTrackerInnerRadius.Get());
+    printf("    mainTrackerOuterRadius: %f\n", geom.m_mainTrackerOuterRadius.Get());
+    printf("    mainTrackerZExtent: %f\n", geom.m_mainTrackerZExtent.Get());
+    printf("\n" );    
+
+    // Coil and B-field.
+    TiXmlElement* coil = root->FirstChildElement("coil");
+    float cinnerR, couterR, cz, bfield;
+    cinnerR = couterR = cz = bfield = 0.;
+    coil->QueryFloatAttribute("innerR", &cinnerR);
+    coil->QueryFloatAttribute("outerR", &couterR);
+    coil->QueryFloatAttribute("z", &cz);
+    coil->QueryFloatAttribute("bfield", &bfield);
+    geom.m_coilInnerRadius = cinnerR;
+    geom.m_coilOuterRadius = couterR;
+    geom.m_coilZExtent = cz;
+    geom.m_bField = bfield;  
+
+    // Print coil and field.
+    printf("Coil: \n");
+    printf("    coilInnerRadius: %f\n", geom.m_coilInnerRadius.Get());
+    printf("    coilOuterRadius: %f\n", geom.m_coilOuterRadius.Get());
+    printf("    coilZExtent: %f\n", geom.m_coilZExtent.Get());
+    printf("    bField: %f\n", geom.m_bField.Get());
+    printf("\n" );
+}
+
+PandoraApi::GeometryParameters::SubDetectorParameters* DetectorGeometry::getSubDetectorFromType(const char* subdetType)
+{    
+    if ( strcmp( subdetType, "EM_BARREL" ) == 0 )
+    {
+        return &(geom.m_eCalBarrelParameters);
+    }
+    else if ( strcmp( subdetType, "EM_ENDCAP" ) == 0 )
+    {
+        return &(geom.m_eCalEndCapParameters);
+    }
+    else if ( strcmp( subdetType, "HAD_BARREL" ) == 0 )
+    {
+        return &(geom.m_hCalBarrelParameters);
+    }
+    else if ( strcmp( subdetType, "HAD_ENDCAP" ) == 0 )
+    {
+        return &(geom.m_hCalEndCapParameters);
+    }
+    else
+    {
+        runtime_error("Unknown subdetector type.");
+    }
+    // Next line removes compilation warning.  Code should never get here!
+    return 0;
+}
+
+void DetectorGeometry::printOut(const char* subdetType, PandoraApi::GeometryParameters::SubDetectorParameters* subdet)
+{
+    // Parameters.
+    printf("Subdetector: %s\n",            subdetType);
+    printf("    innerRCoordinate: %f\n",   subdet->m_innerRCoordinate.Get());
+    printf("    innerZCoordinate: %f\n",   subdet->m_innerZCoordinate.Get());
+    printf("    innerPhiCoordinate: %f\n", subdet->m_innerPhiCoordinate.Get());
+    printf("    innerSymmetryOrder: %i\n", subdet->m_innerSymmetryOrder.Get());
+    printf("    outerRCoordinate: %f\n",   subdet->m_outerRCoordinate.Get());
+    printf("    outerZCoordinate: %f\n",   subdet->m_outerZCoordinate.Get());
+    printf("    outerPhiCoordinate: %f\n", subdet->m_outerPhiCoordinate.Get());
+    printf("    outerSymmetryOrder: %i\n", subdet->m_outerSymmetryOrder.Get());
+    printf("    nLayers: %i\n",            subdet->m_nLayers.Get());
+
+    // Layers.
+    int cntr = 1;
+    for (PandoraApi::GeometryParameters::LayerParametersList::const_iterator iter = subdet->m_layerParametersList.begin();
+         iter != subdet->m_layerParametersList.end();
+         iter++ )
+    {
+        PandoraApi::GeometryParameters::LayerParameters lp = (*iter);
+        printf("        layer %i - dToIp=%f, radLen=%f, intLen=%f\n", cntr, lp.m_closestDistanceToIp.Get(), lp.m_nRadiationLengths.Get(), lp.m_nInteractionLengths.Get());
+        ++cntr;             
+    }
+    
+    printf("\n");    
+}

slicPandora/src
DummyProcessor.cpp added at 1.1
diff -N DummyProcessor.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DummyProcessor.cpp	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,16 @@
+#include "DummyProcessor.h"
+
+// stl
+#include <iostream>
+
+DummyProcessor::DummyProcessor()
+    : EventProcessor("DummyProcessor")
+{}
+
+DummyProcessor::~DummyProcessor()
+{}
+
+void DummyProcessor::processEvent(EVENT::LCEvent*)
+{
+    std::cout << "DummyProcessor got event!" << std::endl;
+}

slicPandora/src
EventProcessor.cpp added at 1.1
diff -N EventProcessor.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EventProcessor.cpp	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,21 @@
+#include "EventProcessor.h"
+
+#include "JobManager.h"
+
+EventProcessor::EventProcessor(std::string name) 
+    : m_name(name)     
+{;}
+
+EventProcessor::~EventProcessor()
+{;}
+
+void EventProcessor::setJobManager(JobManager* manager)
+{
+    m_manager = manager;
+}
+
+JobManager* EventProcessor::getJobManager()
+{
+    return m_manager;
+}
+

slicPandora/src
JobConfig.cpp added at 1.1
diff -N JobConfig.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ JobConfig.cpp	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,126 @@
+#include "JobConfig.h"
+#include "DetectorGeometry.h"
+
+JobConfig::JobConfig()
+    : m_nevents(-1),
+      m_nskip(0)
+{}
+
+JobConfig::~JobConfig()
+{}
+
+const std::string& JobConfig::getPandoraSettingsXmlFile()
+{
+    return m_pandoraSettingsXmlFile;
+}
+
+void JobConfig::setPandoraSettingsXmlFile(std::string pandoraSettingsXmlFile)
+{
+    m_pandoraSettingsXmlFile = pandoraSettingsXmlFile;
+}
+
+void JobConfig::setPandoraSettingsXmlFile(const char* pandoraSettingsXmlFile)
+{
+    m_pandoraSettingsXmlFile = std::string(pandoraSettingsXmlFile);
+}
+
+const std::string& JobConfig::getGeometryFile()
+{
+    return m_geometryFile;
+}
+
+void JobConfig::setGeometryFile(const char* geometryFile)
+{
+    m_geometryFile = std::string(geometryFile);
+}
+
+void JobConfig::setGeometryFile(std::string geometryFile)
+{
+    m_geometryFile = geometryFile;
+}
+
+void JobConfig::addInputFile(const char* filename)
+{
+    m_inputLcioFiles.push_back(std::string(filename));
+}
+
+void JobConfig::addInputFile(std::string filename)
+{
+    m_inputLcioFiles.push_back(filename);
+}
+
+JobConfig::FileList JobConfig::getInputFiles()
+{
+    return m_inputLcioFiles;
+}
+
+void JobConfig::setNumberOfEvents(int nevents)
+{
+    m_nevents = nevents;
+}
+
+int JobConfig::getNumberOfEvents()
+{
+    return m_nevents;
+}
+
+void JobConfig::setSkipEvents(int nskip)
+{
+    m_nskip = nskip;
+}
+
+int JobConfig::getSkipEvents()
+{
+    return m_nskip;
+}
+
+void JobConfig::setOutputFile(const char* outputFile)
+{
+    m_outputFile = std::string(outputFile);
+}
+
+void JobConfig::setOutputFile(std::string outputFile)
+{
+    m_outputFile = outputFile;
+}
+
+const std::string& JobConfig::getOutputFile()
+{
+    return m_outputFile;
+}
+
+void JobConfig::addCalorimeterType(const char* calType)
+{
+    m_calTypes.push_back(std::string(calType));
+}
+
+void JobConfig::addCalorimeterType(std::string calType)
+{
+    m_calTypes.push_back(calType);
+}
+
+JobConfig::CalorimeterTypes JobConfig::getCalorimeterTypes()
+{
+    return m_calTypes;
+}
+
+JobConfig::CalorimeterTypes JobConfig::getDefaultCalorimeterTypes()
+{
+    static CalorimeterTypes defaultCalTypes;
+    defaultCalTypes.push_back(std::string("EM_BARREL"));
+    defaultCalTypes.push_back(std::string("EM_ENDCAP"));
+    defaultCalTypes.push_back(std::string("HAD_BARREL"));
+    defaultCalTypes.push_back(std::string("HAD_ENDCAP"));
+    return defaultCalTypes;
+}
+
+void JobConfig::useDefaultCalorimeterTypes()
+{
+    CalorimeterTypes defaultCalTypes = getDefaultCalorimeterTypes();
+    for (CalorimeterTypes::iterator iter = defaultCalTypes.begin();
+         iter != defaultCalTypes.end();
+         iter++)
+    {
+        m_calTypes.push_back((*iter));
+    }
+}

slicPandora/src
JobManager.cpp added at 1.1
diff -N JobManager.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ JobManager.cpp	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,129 @@
+#include "JobManager.h"
+
+// slicPandora
+#include "JobConfig.h"
+#include "DetectorGeometry.h"
+#include "EventProcessor.h"
+
+// pandora
+#include "PfoConstructionAlgorithm.h"
+
+// lcio
+#include "IOIMPL/LCFactory.h"
+#include "EVENT/LCIO.h"
+
+// stl
+#include <iostream>
+
+using namespace std;
+using IO::LCReader;
+using IO::LCWriter;
+using IOIMPL::LCFactory;
+
+JobManager::JobManager()
+    : m_config(0),
+      m_pandora(0),
+      m_detectorGeometry(0),
+      m_geometryLoaded(false)
+{}
+
+JobManager::JobManager(JobConfig* config)
+    : m_config(config),
+      m_pandora(0),
+      m_detectorGeometry(0),
+      m_geometryLoaded(false)
+{}
+
+JobManager::~JobManager()
+{}
+
+void JobManager::initialize()
+{
+    m_pandora = new pandora::Pandora();
+    
+    PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, createGeometry());
+    PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, registerUserAlgorithmFactories());
+    PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ReadSettings(*m_pandora, m_config->getPandoraSettingsXmlFile()));
+}
+
+void JobManager::setJobConfig(JobConfig* config)
+{
+    m_config = config;
+}
+
+JobConfig* JobManager::getJobConfig()
+{
+    return m_config;
+}
+
+void JobManager::addEventProcessor(EventProcessor* processor)
+{
+    processor->setJobManager(this);
+    m_processors.push_back(processor);
+}
+
+StatusCode JobManager::registerUserAlgorithmFactories()
+{
+    pandora::AlgorithmFactory* pfac = new PfoConstructionAlgorithm::Factory();
+    PandoraApi::RegisterAlgorithmFactory(*m_pandora, "PFO_Construction", pfac);
+    return STATUS_CODE_SUCCESS;
+}
+
+StatusCode JobManager::createGeometry()
+{
+    m_detectorGeometry = new DetectorGeometry(m_config->getGeometryFile());
+    m_geometryLoaded = true;
+
+    return STATUS_CODE_SUCCESS;
+}
+
+StatusCode JobManager::run()
+{
+    initialize();
+
+    LCReader* reader = LCFactory::getInstance()->createLCReader();
+    LCWriter* writer = LCFactory::getInstance()->createLCWriter();
+   
+    writer->setCompressionLevel(9);
+    writer->open(m_config->getOutputFile().c_str(), EVENT::LCIO::WRITE_NEW);
+
+    // Open file list.
+    JobConfig::FileList inputFiles = m_config->getInputFiles();
+    
+    reader->open(m_config->getInputFiles());
+
+    // Skip events.
+    if (m_config->getSkipEvents() > 0)
+        reader->skipNEvents(m_config->getSkipEvents());
+    
+    int nread = 0;
+
+    LCEvent* event = reader->readNextEvent();
+    ++nread;
+    int ntoread = m_config->getNumberOfEvents();
+
+    // Process events.
+    while (event != 0)
+    {
+        processEvent(event);
+        if (nread >= ntoread)
+        {
+            std::cout << "Read <" << ntoread << "> events.  Stopping run!" << std::endl;
+            break;
+        }
+        event = reader->readNextEvent();
+        ++nread;
+    }
+
+    return STATUS_CODE_SUCCESS;
+}
+
+void JobManager::processEvent(EVENT::LCEvent* event)
+{
+    for (EventProcessors::iterator it = m_processors.begin();
+         it != m_processors.end();
+         it++)
+    {
+        (*it)->processEvent(event);
+    }
+}

slicPandora/src
SimCalorimeterHitProcessor.cpp added at 1.1
diff -N SimCalorimeterHitProcessor.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimCalorimeterHitProcessor.cpp	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,78 @@
+#include "SimCalorimeterHitProcessor.h"
+
+#include "JobManager.h"
+#include "JobConfig.h"
+
+SimCalorimeterHitProcessor::SimCalorimeterHitProcessor()
+    : EventProcessor("SimCalorimeterHitProcessor")
+{;}
+
+SimCalorimeterHitProcessor::~SimCalorimeterHitProcessor()
+{;}
+
+void SimCalorimeterHitProcessor::processEvent(EVENT::LCEvent* event)
+{
+    JobConfig::CalorimeterTypes calTypes = getJobManager()->getJobConfig()->getCalorimeterTypes();
+    for (JobConfig::CalorimeterTypes::iterator iter = calTypes.begin();
+         iter != calTypes.end();
+         iter++)
+    {
+        
+    }
+}
+
+/*
+void SimCalorimeterHitProcessor::processEvent(EVENT::LCEvent* event)
+{
+    double SF1 = .0175;
+    double SF2 = .00936;
+    // get the input SimCalorimeterHits
+    LCCollection* simCalHits = event->getCollection("EcalBarrelHits");
+    cout << " event has " << simCalHits->getNumberOfElements() << " SimCalorimeterHits";
+    //create a container for the output CalorimeterHits
+    LCCollectionVec* calHits = new LCCollectionVec(LCIO::CALORIMETERHIT);
+    // set the flag to indicate that the position will be stored with the hit.
+    LCFlagImpl chFlag(0);
+    chFlag.setBit(LCIO::CHBIT_LONG);
+
+    calHits->setFlag(chFlag.getFlag());
+
+
+    // now convert...
+    LCCollectionVec* scRel = new LCCollectionVec(LCIO::LCRELATION);
+    scRel->parameters().setValue("RelationFromType", LCIO::CALORIMETERHIT);
+    scRel->parameters().setValue("RelationToType", LCIO::SIMCALORIMETERHIT);
+
+    int nSimHits = simCalHits->getNumberOfElements();
+    for (int j = 0; j < nSimHits; j++)
+    {
+
+        CalorimeterHitImpl* calHit = new CalorimeterHitImpl;
+        SimCalorimeterHit* simcalHit = dynamic_cast<SimCalorimeterHit*> (simCalHits->getElementAt(j));
+
+        //      std::cout << " adding new calorimeter hit and relation : " << j << " : "  << calHit << " - " << simcalHit << std::endl ;
+        int layer = (simcalHit->getCellID0() >> 13) & 0x7f;
+        double cfac = (layer < 21 ? SF1 : SF2);
+        calHit->setEnergy(simcalHit->getEnergy() / cfac);
+        calHit->setCellID0(simcalHit->getCellID0());
+        calHit->setCellID1(simcalHit->getCellID1());
+        calHit->setTime(simcalHit->getTimeCont(0));
+        calHit->setPosition(simcalHit->getPosition());
+
+        //       scRel->addRelation( calHit , simcalHit , 0.5 ) ;
+        //       scRel->addRelation( calHit , simcalHit , 0.5 ) ;
+        scRel->addElement(new LCRelationImpl(calHit, simcalHit, 0.5));
+        scRel->addElement(new LCRelationImpl(calHit, simcalHit, 0.5));
+        scRel->addElement(new LCRelationImpl(calHit, simcalHit, 0.5));
+        calHits->addElement(calHit);
+
+        //       // create a copy of sim hit and modify it
+        //       SimCalorimeterHitImpl* mSimHit = new SimCalorimeterHitImpl( *simcalHit ) ;
+        //       mSimHit->setEnergy(  mSimHit->getEnergy() * 1000. ) ;
+        //       modifiedSimCalHits->addElement( mSimHit ) ;
+
+    }
+    event->addCollection(calHits, "CalorimeterHits");
+
+}
+*/

slicPandora/src
SlicPandoraConfig.cpp removed after 1.1
diff -N SlicPandoraConfig.cpp
--- SlicPandoraConfig.cpp	22 Feb 2010 19:44:15 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,40 +0,0 @@
-#include "JobConfig.h"
-#include "DetectorGeometry.h"
-
-JobConfig::JobConfig()
-    : m_geometryLoaded(false)
-{}
-
-JobConfig::~JobConfig()
-{}
-
-const std::string& JobConfig::getPandoraSettingsXmlFile()
-{
-    return m_pandoraSettingsXmlFile;
-}
-
-const std::string& JobConfig::getGeometryFile()
-{
-    return m_geometryFile;
-}
-
-void JobConfig::setPandoraSettingsXmlFile(std::string pandoraSettingsXmlFile)
-{
-    m_pandoraSettingsXmlFile = pandoraSettingsXmlFile;
-}
-
-void JobConfig::setGeometryFile(std::string geometryFile)
-{
-    m_geometryFile = geometryFile;
-}
-
-void JobConfig::createGeometry()
-{
-    if (m_geometryLoaded)
-        return;
-
-    m_detectorGeometry = new DetectorGeometry();
-    m_detectorGeometry->loadFromFile(m_geometryFile);
-
-    m_geometryLoaded = true;
-}

slicPandora/src
SlicPandoraDetectorGeometry.cpp removed after 1.1
diff -N SlicPandoraDetectorGeometry.cpp
--- SlicPandoraDetectorGeometry.cpp	22 Feb 2010 19:44:15 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,204 +0,0 @@
-#include "DetectorGeometry.h"
-
-#include <stdexcept>
-#include <cstdio>
-#include <cstring>
-
-#include "tinyxml.h"
-
-using namespace std;
-
-void DetectorGeometry::loadFromFile(std::string filename)
-{
-    // Load doc and check if valid.
-    TiXmlDocument doc(filename.c_str());
-    if (!doc.LoadFile())
-    {
-        printf("line %i:::%s\n", doc.ErrorRow(), doc.ErrorDesc());
-        throw runtime_error("Parse error reading input XML file.");
-    }
-
-    // Get the root element.
-    TiXmlElement* root = doc.RootElement();
-
-    // Process the calorimeter elements.
-    TiXmlElement* calorimeters = root->FirstChildElement("calorimeters");
-    TiXmlElement* calElem = (TiXmlElement*) calorimeters->FirstChild("calorimeter");
-    for (calElem;
-         calElem;
-         calElem = calElem->NextSiblingElement() )
-    {
-        // Get the type of calorimeter.
-        const char* subdetType = calElem->Attribute("type");
-
-        // Pick the right subdetector object to populate.
-        PandoraApi::GeometryParameters::SubDetectorParameters* subdet = 
-            getSubDetectorFromType(subdetType);
-
-        // Numerical parameters which are attributes on calorimeter.
-        float innerR, innerZ, innerPhi;
-        innerR = innerZ = innerPhi = 0;
-        int innerSym = 0;
-        float outerR, outerZ, outerPhi; 
-        outerR = outerZ = outerPhi = 0;
-        int outerSym = 0;
-        int nlayers = 0;
-
-        // Read in parameters.
-        calElem->QueryFloatAttribute("innerR", &innerR );        
-        calElem->QueryFloatAttribute("innerZ", &innerZ );        
-        calElem->QueryFloatAttribute("innerPhi", &innerPhi );
-        calElem->QueryIntAttribute("innerSymmetryOrder", &innerSym );
-        calElem->QueryFloatAttribute("outerR", &outerR );        
-        calElem->QueryFloatAttribute("outerZ", &outerZ );        
-        calElem->QueryFloatAttribute("outerPhi", &outerPhi );
-        calElem->QueryIntAttribute("outerSymmetryOrder", &outerSym );
-
-        // Set subdetector parameters.
-        subdet->m_innerRCoordinate = innerR;
-        subdet->m_innerZCoordinate = innerZ;
-        subdet->m_innerPhiCoordinate = innerPhi;
-        subdet->m_innerSymmetryOrder = innerSym;
-        subdet->m_outerRCoordinate = outerR;
-        subdet->m_outerZCoordinate = outerZ;
-        subdet->m_outerPhiCoordinate = outerPhi;
-        subdet->m_outerSymmetryOrder = outerSym;
-
-        // Number of layers.
-        TiXmlElement* layers = (TiXmlElement*) calElem->FirstChild("layers");
-        layers->QueryIntAttribute("nlayers", &nlayers);
-        subdet->m_nLayers = nlayers;
-
-        // Process layer elements.
-        TiXmlElement* layerElem = layers->FirstChildElement();
-        for (layerElem;
-             layerElem;
-             layerElem = layerElem->NextSiblingElement() )
-        {
-            PandoraApi::GeometryParameters::LayerParameters layerParams;
-
-            float dToIp = 0;
-            float radLen = 0.;
-            float intLen = 0.;
-
-            layerElem->QueryFloatAttribute("intLen", &intLen);
-            layerElem->QueryFloatAttribute("radLen", &radLen);
-            layerElem->QueryFloatAttribute("distanceToIp", &dToIp);
-            
-            layerParams.m_closestDistanceToIp = dToIp;
-            layerParams.m_nRadiationLengths = radLen;
-            layerParams.m_nInteractionLengths = intLen;
-
-            // Add the layer to the subdetector's layer list.
-            subdet->m_layerParametersList.push_back(layerParams);
-        }
-
-        // Dump subdetector parameters to screen.
-        printOut(subdetType, subdet);
-
-        // Add cell size information to extras map.
-        ExtraSubDetectorParameters extras;
-        int cellSizeU = 0;
-        int cellSizeV = 0;
-        calElem->QueryIntAttribute("cellSizeU", &cellSizeU);
-        calElem->QueryIntAttribute("cellSizeV", &cellSizeV);
-        extras.m_cellSizeU = cellSizeU;
-        extras.m_cellSizeV = cellSizeV;
-        extras.m_collection = calElem->Attribute("collection");
-        std::string subdetTypeStr(subdetType);
-        subdetExtras[subdetTypeStr] = extras;
-    }   
-
-    // Tracking parameters.
-    TiXmlElement* tracking = root->FirstChildElement("tracking");
-    float tinnerR, touterR, tz;
-    tinnerR = touterR = tz;
-    tracking->QueryFloatAttribute("innerR", &tinnerR);
-    tracking->QueryFloatAttribute("outerR", &touterR);
-    tracking->QueryFloatAttribute("z", &tz);
-    geom.m_mainTrackerInnerRadius = tinnerR;
-    geom.m_mainTrackerOuterRadius = touterR;
-    geom.m_mainTrackerZExtent = tz;
-
-    // Print tracking.
-    printf("Tracking: \n");
-    printf("    mainTrackerInnerRadius: %f\n", geom.m_mainTrackerInnerRadius.Get());
-    printf("    mainTrackerOuterRadius: %f\n", geom.m_mainTrackerOuterRadius.Get());
-    printf("    mainTrackerZExtent: %f\n", geom.m_mainTrackerZExtent.Get());
-    printf("\n" );    
-
-    // Coil and B-field.
-    TiXmlElement* coil = root->FirstChildElement("coil");
-    float cinnerR, couterR, cz, bfield;
-    cinnerR = couterR = cz = bfield = 0.;
-    coil->QueryFloatAttribute("innerR", &cinnerR);
-    coil->QueryFloatAttribute("outerR", &couterR);
-    coil->QueryFloatAttribute("z", &cz);
-    coil->QueryFloatAttribute("bfield", &bfield);
-    geom.m_coilInnerRadius = cinnerR;
-    geom.m_coilOuterRadius = couterR;
-    geom.m_coilZExtent = cz;
-    geom.m_bField = bfield;  
-
-    // Print coil and field.
-    printf("Coil: \n");
-    printf("    coilInnerRadius: %f\n", geom.m_coilInnerRadius.Get());
-    printf("    coilOuterRadius: %f\n", geom.m_coilOuterRadius.Get());
-    printf("    coilZExtent: %f\n", geom.m_coilZExtent.Get());
-    printf("    bField: %f\n", geom.m_bField.Get());
-    printf("\n" );
-}
-
-PandoraApi::GeometryParameters::SubDetectorParameters* DetectorGeometry::getSubDetectorFromType(const char* subdetType)
-{    
-    if ( strcmp( subdetType, "ECAL_BARREL" ) == 0 )
-    {
-        return &(geom.m_eCalBarrelParameters);
-    }
-    else if ( strcmp( subdetType, "ECAL_ENDCAP" ) == 0 )
-    {
-        return &(geom.m_eCalEndCapParameters);
-    }
-    else if ( strcmp( subdetType, "HCAL_BARREL" ) == 0 )
-    {
-        return &(geom.m_hCalBarrelParameters);
-    }
-    else if ( strcmp( subdetType, "ECAL_ENDCAP" ) == 0 )
-    {
-        return &(geom.m_hCalEndCapParameters);
-    }
-    else
-    {
-        runtime_error("Unknown subdetector type.");
-    }
-    // To remove compilation warning.  Should never get here.  
-    return 0;
-}
-
-void DetectorGeometry::printOut(const char* subdetType, PandoraApi::GeometryParameters::SubDetectorParameters* subdet)
-{
-    // Parameters.
-    printf("Subdetector: %s\n",            subdetType);
-    printf("    innerRCoordinate: %f\n",   subdet->m_innerRCoordinate.Get());
-    printf("    innerZCoordinate: %f\n",   subdet->m_innerZCoordinate.Get());
-    printf("    innerPhiCoordinate: %f\n", subdet->m_innerPhiCoordinate.Get());
-    printf("    innerSymmetryOrder: %i\n", subdet->m_innerSymmetryOrder.Get());
-    printf("    outerRCoordinate: %f\n",   subdet->m_outerRCoordinate.Get());
-    printf("    outerZCoordinate: %f\n",   subdet->m_outerZCoordinate.Get());
-    printf("    outerPhiCoordinate: %f\n", subdet->m_outerPhiCoordinate.Get());
-    printf("    outerSymmetryOrder: %i\n", subdet->m_outerSymmetryOrder.Get());
-    printf("    nLayers: %i\n",            subdet->m_nLayers.Get());
-
-    // Layers.
-    int cntr = 1;
-    for (PandoraApi::GeometryParameters::LayerParametersList::const_iterator iter = subdet->m_layerParametersList.begin();
-         iter != subdet->m_layerParametersList.end();
-         iter++ )
-    {
-        PandoraApi::GeometryParameters::LayerParameters lp = (*iter);
-        printf("        layer %i - dToIp=%f, radLen=%f, intLen=%f\n", cntr, lp.m_closestDistanceToIp.Get(), lp.m_nRadiationLengths.Get(), lp.m_nInteractionLengths.Get());
-        ++cntr;             
-    }
-    
-    printf("\n");    
-}

slicPandora/include
DummyProcessor.h added at 1.1
diff -N DummyProcessor.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ DummyProcessor.h	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,15 @@
+#ifndef DummyProcessor_h
+#define DummyProcessor_h 1
+
+#include "EventProcessor.h"
+
+class DummyProcessor : public EventProcessor
+{
+public:
+    DummyProcessor();
+    virtual ~DummyProcessor();
+
+    void processEvent(EVENT::LCEvent*);
+};
+
+#endif

slicPandora/include
EventProcessor.h added at 1.1
diff -N EventProcessor.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ EventProcessor.h	23 Feb 2010 02:27:26 -0000	1.1
@@ -0,0 +1,35 @@
+#ifndef EventProcessor_h
+#define EventProcessor_h 1
+
+// stl
+#include <string>
+
+// lcio
+#include "EVENT/LCEvent.h"
+
+using EVENT::LCEvent;
+
+class JobManager;
+
+/**
+ * This is an API for event processing classes.  Sub-classes must implement
+ * the processEvent() method.  Job information can be retrieved by using the 
+ * pointer to the JobManager.
+ */
+class EventProcessor
+{
+public:
+    EventProcessor(std::string);
+    virtual ~EventProcessor();
+
+    void setJobManager(JobManager*);
+    JobManager* getJobManager();
+
+    virtual void processEvent(EVENT::LCEvent*) = 0;
+
+private:
+    JobManager* m_manager;
+    std::string m_name;
+};
+
+#endif

slicPandora/include
JobManager.h added at 1.1
diff -N JobManager.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ JobManager.h	23 Feb 2010 02:27:27 -0000	1.1
@@ -0,0 +1,49 @@
+#ifndef JobManager_h
+#define JobManager_h 1
+
+// lcio
+#include "EVENT/LCEvent.h"
+
+// pandora
+#include "Api/PandoraApi.h"
+
+class JobConfig;
+class DetectorGeometry;
+class EventProcessor;
+
+class JobManager
+{
+public:
+    typedef std::vector<EventProcessor*> EventProcessors;
+
+    JobManager();
+    JobManager(JobConfig*);
+    virtual ~JobManager();
+
+    void setJobConfig(JobConfig*);
+    JobConfig* getJobConfig();
+
+    void addEventProcessor(EventProcessor*);
+
+    StatusCode run();
+
+private:
+
+    void processEvent(EVENT::LCEvent*);
+
+    void initialize();
+
+    StatusCode registerUserAlgorithmFactories();
+
+    StatusCode createGeometry();
+
+private:
+    JobConfig* m_config;
+    pandora::Pandora* m_pandora;
+    DetectorGeometry* m_detectorGeometry;
+    EventProcessors m_processors;
+    bool m_geometryLoaded;
+    bool m_initialized;    
+};
+
+#endif

slicPandora/include
SimCalorimeterHitProcessor.h added at 1.1
diff -N SimCalorimeterHitProcessor.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ SimCalorimeterHitProcessor.h	23 Feb 2010 02:27:27 -0000	1.1
@@ -0,0 +1,15 @@
+#ifndef SimCalorimeterHitProcessor_h
+#define SimCalorimeterHitProcessor_h 1
+
+#include "EventProcessor.h"
+
+class SimCalorimeterHitProcessor : public EventProcessor
+{
+public:
+    SimCalorimeterHitProcessor();
+    virtual ~SimCalorimeterHitProcessor();
+
+    void processEvent(EVENT::LCEvent*);    
+};
+
+#endif

slicPandora/include
DetectorGeometry.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- DetectorGeometry.h	22 Feb 2010 19:44:14 -0000	1.1
+++ DetectorGeometry.h	23 Feb 2010 02:27:26 -0000	1.2
@@ -8,13 +8,24 @@
     
 public:
 
+    // Extra subdetector parameters, including cell sizes.
+    class ExtraSubDetectorParameters
+    {
+    public:
+        pandora::InputFloat m_cellSizeU;
+        pandora::InputFloat m_cellSizeV;
+        std::string m_collection;
+    };
+
+    typedef std::map<std::string, ExtraSubDetectorParameters> ExtraSubDetectorParametersMap;
+
+public:
+
     DetectorGeometry() {;}
+    DetectorGeometry(std::string);
 
     virtual ~DetectorGeometry() {;}
-
-    /**
-     * Load the SiD geometry from an input XML file.
-     */
+    
     void loadFromFile(std::string);
 
     PandoraApi::Geometry::Parameters* getGeometryParameters()
@@ -22,18 +33,12 @@
         return &geom;
     }
 
-    void printOut(const char* subdetType, PandoraApi::GeometryParameters::SubDetectorParameters* subdet);
-
-    // Extra subdetector parameters, including cell sizes.
-    class ExtraSubDetectorParameters
+    ExtraSubDetectorParametersMap* getExtraParameters()
     {
-    public:
-        pandora::InputFloat m_cellSizeU;
-        pandora::InputFloat m_cellSizeV;
-        std::string m_collection;
-    };
+        return &subdetExtras;
+    }
 
-    typedef std::map<std::string, ExtraSubDetectorParameters> ExtraSubDetectorParametersMap;
+    void printOut(const char* subdetType, PandoraApi::GeometryParameters::SubDetectorParameters* subdet);
 
 private:
     PandoraApi::GeometryParameters::SubDetectorParameters* getSubDetectorFromType( const char* );

slicPandora/include
JobConfig.h 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- JobConfig.h	22 Feb 2010 19:44:14 -0000	1.1
+++ JobConfig.h	23 Feb 2010 02:27:26 -0000	1.2
@@ -1,7 +1,9 @@
 #ifndef _SLIC_PANDORACONFIG_H
 #define _SLIC_PANDORACONFIG_H 1
 
+// stl
 #include <string>
+#include <vector>
 
 class DetectorGeometry;
 
@@ -10,24 +12,49 @@
 
 public:
 
+    typedef std::vector<std::string> FileList;
+    typedef std::vector<std::string> CalorimeterTypes;
+
     JobConfig();
     virtual ~JobConfig();
 
+    void setPandoraSettingsXmlFile(const char*);
     void setPandoraSettingsXmlFile(std::string);
     const std::string& getPandoraSettingsXmlFile();
 
+    void setGeometryFile(const char*);
     void setGeometryFile(std::string);    
     const std::string& getGeometryFile();
 
-    void createGeometry();
-    
-    DetectorGeometry* getDetectorGeometry();
-
+    void addInputFile(const char*);
+    void addInputFile(std::string);
+    FileList getInputFiles();
+
+    void setOutputFile(const char*);
+    void setOutputFile(std::string);
+    const std::string& getOutputFile();
+
+    void useDefaultCalorimeterTypes();
+    void addCalorimeterType(const char*);
+    void addCalorimeterType(std::string);
+    CalorimeterTypes getCalorimeterTypes();
+    CalorimeterTypes getDefaultCalorimeterTypes();
+
+    void setNumberOfEvents(int nevents);
+    int getNumberOfEvents();
+
+    void setSkipEvents(int nskip);
+    int getSkipEvents();
+   
 private:
     std::string m_pandoraSettingsXmlFile;
     std::string m_geometryFile;
-    bool m_geometryLoaded;
-    DetectorGeometry* m_detectorGeometry;
+    std::string m_outputFile;    
+    CalorimeterTypes m_calTypes;
+    FileList m_inputLcioFiles;
+    int m_nevents;
+    int m_nskip;
+    bool m_useDefaultCalTypes;
 };
 
 #endif

slicPandora/tests
JobManagerTest.cpp added at 1.1
diff -N JobManagerTest.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ JobManagerTest.cpp	23 Feb 2010 02:27:27 -0000	1.1
@@ -0,0 +1,20 @@
+#include "JobConfig.h"
+#include "JobManager.h"
+#include "DummyProcessor.h"
+
+int main(int argc, char** argv)
+{
+    JobConfig* config = new JobConfig();
+    config->setPandoraSettingsXmlFile("./tests/PandoraSettings.xml");
+    config->setGeometryFile("./examples/sidloi2_pandora.xml");
+    config->addInputFile("./input.slcio");
+    config->setOutputFile("pandoraRecon.slcio");
+    config->setNumberOfEvents(1);
+    config->setSkipEvents(0);    
+
+    JobManager* mgr = new JobManager();
+    mgr->setJobConfig(config);
+    mgr->addEventProcessor(new DummyProcessor());
+
+    mgr->run();
+}
CVSspam 0.2.8