6 added + 7 modified, total 13 files
slicPandora/include
diff -N CalorimeterHitProcessor.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CalorimeterHitProcessor.h 5 Mar 2010 01:35:48 -0000 1.1
@@ -0,0 +1,49 @@
+#ifndef CALORIMETERHITPROCESSOR_H
+#define CALORIMETERHITPROCESSOR_H 1
+
+// pandora
+#include "Api/PandoraApi.h"
+
+// slicPandora
+#include "EventProcessor.h"
+#include "DetectorGeometry.h"
+
+// lcio
+#include "EVENT/CalorimeterHit.h"
+
+using EVENT::CalorimeterHit;
+
+class CalorimeterHitProcessor : public EventProcessor
+{
+public:
+ CalorimeterHitProcessor()
+ : EventProcessor("CalorimeterHitProcessor")
+ {;}
+
+ virtual ~CalorimeterHitProcessor()
+ {;}
+
+public:
+
+ void processEvent(EVENT::LCEvent*);
+
+private:
+
+ /**
+ * Make a 64-bit identifier for a hit.
+ */
+ inline long long makeId64(CalorimeterHit* hit)
+ {
+ return ((long long)hit->getCellID1())<<32 | hit->getCellID0();
+ }
+
+ /**
+ * Convert an LCIO CalorimeterHit into a PandoraPFANew CaloHit Parameters.
+ */
+ PandoraApi::CaloHit::Parameters makeCaloHitParameters(
+ PandoraApi::GeometryParameters::SubDetectorParameters* subdet,
+ DetectorGeometry::ExtraSubDetectorParameters* xsubdet,
+ CalorimeterHit*);
+};
+
+#endif
slicPandora/include
diff -N PandoraProcessor.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PandoraProcessor.h 5 Mar 2010 01:35:48 -0000 1.1
@@ -0,0 +1,29 @@
+#ifndef PANDORAPROCESSOR_H
+#define PANDORAPROCESSOR_H 1
+
+// slicPandora
+#include "EventProcessor.h"
+
+// lcio
+#include "EVENT/LCEvent.h"
+
+class PandoraProcessor : public EventProcessor
+{
+public:
+ PandoraProcessor()
+ : EventProcessor("PandoraProcessor")
+ {}
+
+ virtual ~PandoraProcessor()
+ {}
+
+public:
+
+ void processEvent(EVENT::LCEvent*);
+};
+
+#endif
+
+
+
+
slicPandora/include
diff -N PfoProcessor.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PfoProcessor.h 5 Mar 2010 01:35:48 -0000 1.1
@@ -0,0 +1,19 @@
+#ifndef PFOPROCESSOR_H
+#define PFOPROCESSOR_H 1
+
+#include "EventProcessor.h"
+
+// lcio
+#include "EVENT/LCEvent.h"
+
+class PfoProcessor : public EventProcessor
+{
+public:
+ PfoProcessor();
+ virtual ~PfoProcessor();
+
+public:
+ void processEvent(EVENT::LCEvent*);
+};
+
+#endif
slicPandora/include
diff -u -r1.4 -r1.5
--- DetectorGeometry.h 3 Mar 2010 22:47:51 -0000 1.4
+++ DetectorGeometry.h 5 Mar 2010 01:35:48 -0000 1.5
@@ -15,6 +15,7 @@
{
public:
pandora::InputFloat m_samplingFraction;
+ pandora::InputFloat m_cellThickness;
};
typedef std::vector<ExtraLayerParameters> ExtraLayerParametersList;
@@ -23,11 +24,16 @@
class ExtraSubDetectorParameters
{
public:
+ pandora::InputFloat m_cellThickness;
pandora::InputFloat m_cellSizeU;
pandora::InputFloat m_cellSizeV;
std::string m_collection;
IDDecoder* m_decoder;
ExtraLayerParametersList m_extraLayerParams;
+ // TODO: Add module normal vectors.
+ // TODO: Add hitType, e.g. pandora::ECAL.
+ // TODO: Add detectorRegion, e.g. pandora::BARREL.
+ // TODO: Add isDigital.
};
typedef std::map<std::string, ExtraSubDetectorParameters> ExtraSubDetectorParametersMap;
slicPandora/include
diff -u -r1.1 -r1.2
--- EventProcessor.h 23 Feb 2010 02:27:26 -0000 1.1
+++ EventProcessor.h 5 Mar 2010 01:35:48 -0000 1.2
@@ -7,10 +7,11 @@
// lcio
#include "EVENT/LCEvent.h"
-using EVENT::LCEvent;
-
+// Needed to avoid circular reference with EventProcessor.
class JobManager;
+using EVENT::LCEvent;
+
/**
* This is an API for event processing classes. Sub-classes must implement
* the processEvent() method. Job information can be retrieved by using the
@@ -25,6 +26,12 @@
void setJobManager(JobManager*);
JobManager* getJobManager();
+ /**
+ * 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.
+ */
virtual void processEvent(EVENT::LCEvent*) = 0;
private:
slicPandora/include
diff -u -r1.2 -r1.3
--- JobManager.h 24 Feb 2010 01:13:49 -0000 1.2
+++ JobManager.h 5 Mar 2010 01:35:48 -0000 1.3
@@ -14,25 +14,67 @@
class JobManager
{
public:
+ /**
+ * A list of EventProcessors.
+ */
typedef std::vector<EventProcessor*> EventProcessors;
+ /**
+ * Create the JobManager without a configuration.
+ */
JobManager();
+
+ /**
+ * Create the JobManager with a configuration.
+ */
JobManager(JobConfig*);
+
+ /**
+ * Standard dtor.
+ */
virtual ~JobManager();
+ /**
+ * Set the job configuration for this run.
+ */
void setJobConfig(JobConfig*);
+
+ /**
+ * Get the job configuration for this run.
+ */
JobConfig* getJobConfig();
+ /**
+ * Add an EventProcessor to the end of the processor list.
+ */
void addEventProcessor(EventProcessor*);
+ /**
+ * Get the DetectorGeometry created from the input xml file.
+ */
DetectorGeometry* getDetectorGeometry();
+ /**
+ * Get the Pandora PFA instance as a const ref. This is the argument
+ * signature for PandoraPFANew methods.
+ */
+ const pandora::Pandora& getPandora();
+
+ /**
+ * Run the job with the current settings.
+ */
StatusCode run();
private:
+ /**
+ * Run the processEvent() methods of the EventProcessors in order.
+ */
void processEvent(EVENT::LCEvent*);
+ /**
+ * Initialize the job so it is ready to run.
+ */
void initialize();
StatusCode registerUserAlgorithmFactories();
slicPandora/src
diff -N CalorimeterHitProcessor.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CalorimeterHitProcessor.cpp 5 Mar 2010 01:35:48 -0000 1.1
@@ -0,0 +1,63 @@
+// $Id: CalorimeterHitProcessor.cpp,v 1.1 2010/03/05 01:35:48 jeremy Exp $
+
+#include "CalorimeterHitProcessor.h"
+
+// slicPandora
+#include "IDDecoder.h"
+
+using EVENT::CalorimeterHit;
+
+void CalorimeterHitProcessor::processEvent(EVENT::LCEvent*)
+{
+
+}
+
+PandoraApi::CaloHit::Parameters CalorimeterHitProcessor::makeCaloHitParameters(
+ PandoraApi::GeometryParameters::SubDetectorParameters* subdet,
+ DetectorGeometry::ExtraSubDetectorParameters* xsubdet,
+ CalorimeterHit* hit)
+{
+ // Get the IDDecoder.
+ IDDecoder* decoder = xsubdet->m_decoder;
+
+ // Make a 64-bit id for the hit.
+ long long cellId = makeId64(hit);
+
+ // Get the layer number.
+ int layer = decoder->getFieldValue("layer", cellId);
+
+ // Get the layer parameters for this layer.
+ PandoraApi::GeometryParameters::LayerParametersList* layerList = &(subdet->m_layerParametersList);
+ PandoraApi::GeometryParameters::LayerParameters layerParams = (*layerList)[layer];
+ DetectorGeometry::ExtraLayerParameters xlayerParams = xsubdet->m_extraLayerParams[layer];
+
+ // Get the module number.
+ int module = decoder->getFieldValue("module", cellId);
+
+ // Create a new, empty CaloHit Parameters.
+ PandoraApi::CaloHit::Parameters params;
+
+ // Fill in the CaloHit Parameters data fields.
+ params.m_layer = layer;
+ params.m_electromagneticEnergy = hit->getEnergy();
+ params.m_hadronicEnergy = hit->getEnergy();
+ params.m_mipEquivalentEnergy = 1.0; // FIXME: dummy value
+ params.m_isDigital = false; // FIXME: hard-coded value
+ params.m_time = hit->getTime();
+ params.m_inputEnergy = hit->getEnergy();
+ params.m_pParentAddress = hit;
+ params.m_cellSizeU = xsubdet->m_cellSizeU;
+ params.m_cellSizeV = xsubdet->m_cellSizeV;
+ params.m_cellThickness = xlayerParams.m_cellThickness;
+ params.m_nRadiationLengths = layerParams.m_nRadiationLengths;
+ params.m_nInteractionLengths = layerParams.m_nInteractionLengths;
+
+/*
+ params.m_positionVector = pandora::CartesianVector(pos[0], pos[1], pos[2]);
+ params.m_normalVector = *(_normalVectors.at(module));
+ params.m_hitType = pandora::ECAL;
+ params.m_detectorRegion = pandora::BARREL;
+*/
+
+ return params;
+}
slicPandora/src
diff -N PandoraProcessor.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PandoraProcessor.cpp 5 Mar 2010 01:35:48 -0000 1.1
@@ -0,0 +1,18 @@
+#include "PandoraProcessor.h"
+
+// slicPandora
+#include "JobManager.h"
+
+// pandora
+#include "StatusCodes.h"
+#include "Api/PandoraApi.h"
+
+void PandoraProcessor::processEvent(EVENT::LCEvent*)
+{
+ StatusCode stat = PandoraApi::ProcessEvent(getJobManager()->getPandora());
+ if (stat != STATUS_CODE_SUCCESS)
+ {
+ std::cerr << "PandoraApi::ProcessEvent did not succeed!" << std::endl;
+ exit(1);
+ }
+}
slicPandora/src
diff -N PfoProcessor.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ PfoProcessor.cpp 5 Mar 2010 01:35:48 -0000 1.1
@@ -0,0 +1,39 @@
+// $Id: PfoProcessor.cpp,v 1.1 2010/03/05 01:35:48 jeremy Exp $
+#include "PfoProcessor.h"
+
+// lcio
+#include "EVENT/LCIO.h"
+#include "IMPL/LCFlagImpl.h"
+#include "IMPL/LCCollectionVec.h"
+#include "IMPL/ClusterImpl.h"
+
+// slicPandora
+#include "PfoConstructionAlgorithm.h"
+#include "JobManager.h"
+
+using IMPL::LCCollectionVec;
+using IMPL::LCFlagImpl;
+using IMPL::ClusterImpl;
+
+PfoProcessor::PfoProcessor()
+ : EventProcessor("PfoProcessor")
+{}
+
+PfoProcessor::~PfoProcessor()
+{}
+
+void PfoProcessor::processEvent(EVENT::LCEvent*)
+{
+ // Setup cluster collection.
+ LCCollectionVec* clusterVec = new LCCollectionVec(EVENT::LCIO::CLUSTER);
+ LCFlagImpl clusterFlag(0);
+ clusterFlag.setBit(EVENT::LCIO::CLBIT_HITS);
+ clusterVec->setFlag(clusterFlag.getFlag());
+
+ pandora::ParticleFlowObjectList particleFlowObjectList;
+ PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraApi::GetParticleFlowObjects(getJobManager()->getPandora(),
+ particleFlowObjectList));
+ LCCollectionVec* pReconstructedParticleCollection = new LCCollectionVec(EVENT::LCIO::RECONSTRUCTEDPARTICLE);
+
+
+}
slicPandora/src
diff -u -r1.4 -r1.5
--- DetectorGeometry.cpp 3 Mar 2010 22:47:51 -0000 1.4
+++ DetectorGeometry.cpp 5 Mar 2010 01:35:48 -0000 1.5
@@ -102,31 +102,40 @@
float radLen = 0.;
float intLen = 0.;
float samplingFrac = 0.;
+ float cellThickness = 0.;
+ // Get the layer parameters from the xml attributes.
layerElem->QueryFloatAttribute("intLen", &intLen);
layerElem->QueryFloatAttribute("radLen", &radLen);
layerElem->QueryFloatAttribute("distanceToIp", &dToIp);
layerElem->QueryFloatAttribute("samplingFraction", &samplingFrac);
+ layerElem->QueryFloatAttribute("cellThickness", &cellThickness);
+ // Set layer parameters.
layerParams.m_closestDistanceToIp = dToIp;
layerParams.m_nRadiationLengths = radLen;
layerParams.m_nInteractionLengths = intLen;
- // Layer extras (sampling fraction).
+ // Set extra layer parameters.
layerExtra.m_samplingFraction = samplingFrac;
+ layerExtra.m_cellThickness = cellThickness;
+
+ // Register extra layer parameters.
extras.m_extraLayerParams.push_back(layerExtra);
// Add the layer to the subdetector's layer list.
subdet->m_layerParametersList.push_back(layerParams);
}
- // Add cell size information to extras map.
- int cellSizeU = 0;
- int cellSizeV = 0;
- calElem->QueryIntAttribute("cellSizeU", &cellSizeU);
- calElem->QueryIntAttribute("cellSizeV", &cellSizeV);
+ // Set cell size information on extras.
+ float cellSizeU = 0;
+ float cellSizeV = 0;
+ calElem->QueryFloatAttribute("cellSizeU", &cellSizeU);
+ calElem->QueryFloatAttribute("cellSizeV", &cellSizeV);
extras.m_cellSizeU = cellSizeU;
extras.m_cellSizeV = cellSizeV;
+
+ // Set the collection name on extras.
extras.m_collection = calElem->Attribute("collection");
// Setup the IDDecoder.
slicPandora/src
diff -u -r1.2 -r1.3
--- JobManager.cpp 24 Feb 2010 01:13:49 -0000 1.2
+++ JobManager.cpp 5 Mar 2010 01:35:48 -0000 1.3
@@ -132,3 +132,8 @@
(*it)->processEvent(event);
}
}
+
+const pandora::Pandora& JobManager::getPandora()
+{
+ return const_cast<const pandora::Pandora&> (*m_pandora);
+}
slicPandora/src
diff -u -r1.3 -r1.4
--- SimCalorimeterHitProcessor.cpp 3 Mar 2010 22:47:51 -0000 1.3
+++ SimCalorimeterHitProcessor.cpp 5 Mar 2010 01:35:48 -0000 1.4
@@ -63,6 +63,8 @@
const std::string& collectionName = xsubdet.m_collection;
IDDecoder* decoder = xsubdet.m_decoder;
+ //std::cout << "looking up collection: " << collectionName << std::endl;
+
LCCollection* simCalHits = event->getCollection(collectionName);
LCCollection* calHits = new LCCollectionVec(EVENT::LCIO::CALORIMETERHIT);
LCFlagImpl chFlag(0);
slicPandora/tests
diff -u -r1.2 -r1.3
--- JobManagerTest.cpp 24 Feb 2010 01:13:49 -0000 1.2
+++ JobManagerTest.cpp 5 Mar 2010 01:35:48 -0000 1.3
@@ -1,25 +1,41 @@
-// $Id: JobManagerTest.cpp,v 1.2 2010/02/24 01:13:49 jeremy Exp $
+// $Id: JobManagerTest.cpp,v 1.3 2010/03/05 01:35:48 jeremy Exp $
+// slicPandora
#include "JobConfig.h"
#include "JobManager.h"
#include "DummyProcessor.h"
+#include "PfoProcessor.h"
+#include "PandoraProcessor.h"
#include "SimCalorimeterHitProcessor.h"
+/**
+ * This runs a complete Pandora job on example input.
+ */
int main(int argc, char** argv)
{
+ // Create the example job configuration.
JobConfig* config = new JobConfig();
config->setPandoraSettingsXmlFile("./tests/PandoraSettings.xml");
config->setGeometryFile("./examples/sidloi2_pandora.xml");
- config->useDefaultCalorimeterTypes();
+ //config->useDefaultCalorimeterTypes();
+ config->addCalorimeterType("EM_BARREL"); // Just test on single collection for now.
config->addInputFile("./input.slcio");
config->setOutputFile("pandoraRecon.slcio");
config->setNumberOfEvents(1);
config->setSkipEvents(0);
JobManager* mgr = new JobManager();
+
+ // Set the job configuration.
mgr->setJobConfig(config);
+
+ // Add the event processors in the correct order.
mgr->addEventProcessor(new DummyProcessor());
mgr->addEventProcessor(new SimCalorimeterHitProcessor());
+ // TODO: add converter to CaloHitParams here
+ mgr->addEventProcessor(new PandoraProcessor());
+ mgr->addEventProcessor(new PfoProcessor());
+ // Run the job.
mgr->run();
}
CVSspam 0.2.8