6 added + 5 removed + 1 modified, total 12 files
slicPandora
diff -u -r1.5 -r1.6
--- Makefile 9 Feb 2010 00:05:09 -0000 1.5
+++ Makefile 22 Feb 2010 19:44:14 -0000 1.6
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.5 2010/02/09 00:05:09 jeremy Exp $
+# $Id: Makefile,v 1.6 2010/02/22 19:44:14 jeremy Exp $
ifndef PANDORAPFA
$(error Set PANDORAPFA env var to location of Pandora PFA New.)
@@ -40,15 +40,18 @@
# flags
CXXFLAGS=-Wall -g $(INCLUDES)
-# Create bin, static lib, and shared lib.
-all: libdir bindir bin lib shlib tests
+# Create library and tests.
+all: libs tests
# Default target.
.DEFAULT: all
+# No standalone binary is created for SlicPandora, just the library.
+# The test cases create binaries. Leave target here for reference.
+# --JM
# Create a standalone binary.
-bin: bindir
- @$(CXX) $(SRCS) $(CXXFLAGS) $(LIBS) -o $(PWD)/bin/$(BINNAME)
+#bin: bindir
+# @$(CXX) $(SRCS) $(CXXFLAGS) $(LIBS) -o $(PWD)/bin/$(BINNAME)
# Create .o files from .cpp files.
%.o: %.cpp
@@ -66,6 +69,9 @@
shlib: libdir obj
@$(CXX) -shared -W1,-soname,lib$(BINNAME).so -o $(PWD)/lib/lib$(BINNAME).so $(OBJS) $(LIBS)
+# Both lib targets in one.
+libs: lib shlib
+
# Compile a test case.
$(TESTBINS) : $(TESTSRCS)
@$(CXX) $< $(CXXFLAGS) $(TESTLIBS) -o $@
slicPandora/include
diff -N DetectorGeometry.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ DetectorGeometry.h 22 Feb 2010 19:44:14 -0000 1.1
@@ -0,0 +1,47 @@
+#ifndef DetectorGeometry_h
+#define DetectorGeometry_h 1
+
+#include "Api/PandoraApi.h"
+
+class DetectorGeometry
+{
+
+public:
+
+ DetectorGeometry() {;}
+
+ virtual ~DetectorGeometry() {;}
+
+ /**
+ * Load the SiD geometry from an input XML file.
+ */
+ void loadFromFile(std::string);
+
+ PandoraApi::Geometry::Parameters* getGeometryParameters()
+ {
+ return &geom;
+ }
+
+ void printOut(const char* subdetType, PandoraApi::GeometryParameters::SubDetectorParameters* subdet);
+
+ // 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;
+
+private:
+ PandoraApi::GeometryParameters::SubDetectorParameters* getSubDetectorFromType( const char* );
+
+private:
+ PandoraApi::Geometry::Parameters geom;
+ ExtraSubDetectorParametersMap subdetExtras;
+};
+
+
+#endif
slicPandora/include
diff -N JobConfig.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ JobConfig.h 22 Feb 2010 19:44:14 -0000 1.1
@@ -0,0 +1,33 @@
+#ifndef _SLIC_PANDORACONFIG_H
+#define _SLIC_PANDORACONFIG_H 1
+
+#include <string>
+
+class DetectorGeometry;
+
+class JobConfig
+{
+
+public:
+
+ JobConfig();
+ virtual ~JobConfig();
+
+ void setPandoraSettingsXmlFile(std::string);
+ const std::string& getPandoraSettingsXmlFile();
+
+ void setGeometryFile(std::string);
+ const std::string& getGeometryFile();
+
+ void createGeometry();
+
+ DetectorGeometry* getDetectorGeometry();
+
+private:
+ std::string m_pandoraSettingsXmlFile;
+ std::string m_geometryFile;
+ bool m_geometryLoaded;
+ DetectorGeometry* m_detectorGeometry;
+};
+
+#endif
slicPandora/include
diff -N SiDPandoraPFAGeometry.h
--- SiDPandoraPFAGeometry.h 9 Feb 2010 00:05:32 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,46 +0,0 @@
-#ifndef SiDPandoraPFAGeometry_h
-#define SiDPandoraPFAGeometry_h 1
-
-#include "Api/PandoraApi.h"
-
-class SiDPandoraPFAGeometry
-{
-
-public:
-
- SiDPandoraPFAGeometry() {;}
-
- virtual ~SiDPandoraPFAGeometry() {;}
-
- /**
- * Load the SiD geometry from an input XML file.
- */
- void loadFromFile(const char* filename);
-
- PandoraApi::Geometry::Parameters* getGeometryParameters()
- {
- return &geom;
- }
-
- void printOut(const char* subdetType, PandoraApi::GeometryParameters::SubDetectorParameters* subdet);
-
- // Extra subdetector parameters, including cell sizes.
- class ExtraSubDetectorParameters
- {
- public:
- pandora::InputFloat m_cellSizeU;
- pandora::InputFloat m_cellSizeV;
- };
-
- typedef std::map<std::string, ExtraSubDetectorParameters> ExtraSubDetectorParametersMap;
-
-private:
- PandoraApi::GeometryParameters::SubDetectorParameters* getSubDetectorFromType( const char* );
-
-private:
- PandoraApi::Geometry::Parameters geom;
- ExtraSubDetectorParametersMap subdetExtras;
-};
-
-
-#endif
slicPandora/src
diff -N SlicPandoraConfig.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SlicPandoraConfig.cpp 22 Feb 2010 19:44:15 -0000 1.1
@@ -0,0 +1,40 @@
+#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
diff -N SlicPandoraDetectorGeometry.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SlicPandoraDetectorGeometry.cpp 22 Feb 2010 19:44:15 -0000 1.1
@@ -0,0 +1,204 @@
+#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/src
diff -N SiDPandoraPFAGeometry.cc
--- SiDPandoraPFAGeometry.cc 9 Jan 2010 00:38:29 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,188 +0,0 @@
-#include "SiDPandoraPFAGeometry.h"
-
-#include <stdexcept>
-#include <cstdio>
-#include <cstring>
-
-#include "tinyxml.h"
-
-using namespace std;
-
-void SiDPandoraPFAGeometry::loadFromFile(const char* filename)
-{
- // Load doc and check if valid.
- TiXmlDocument doc( filename );
- 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);
- }
-
- // 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;
-
- 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;
-
- 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* SiDPandoraPFAGeometry::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.");
- }
-}
-
-void SiDPandoraPFAGeometry::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
diff -N SiDPandoraPFAGeometry.cpp
--- SiDPandoraPFAGeometry.cpp 9 Feb 2010 00:05:33 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,201 +0,0 @@
-#include "SiDPandoraPFAGeometry.h"
-
-#include <stdexcept>
-#include <cstdio>
-#include <cstring>
-
-#include "tinyxml.h"
-
-using namespace std;
-
-void SiDPandoraPFAGeometry::loadFromFile(const char* filename)
-{
- // Load doc and check if valid.
- TiXmlDocument doc( filename );
- 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;
- 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* SiDPandoraPFAGeometry::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.");
- }
-}
-
-void SiDPandoraPFAGeometry::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
diff -N main.cpp
--- main.cpp 13 Jan 2010 01:50:24 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-#include "SiDPandoraPFAGeometry.h"
-
-using namespace std;
-
-int main( int argc, const char* argv[] )
-{
- if ( argc < 2 )
- {
- std::cout << "USAGE: ./slicPandora geometry.xml" << std::endl;
- return 1;
- }
-
- const char* geomFile = argv[1];
- //const char* steeringFile = argv[2];
-
- //SiDPandoraPFAGeometry geom;
- //geom.loadFromFile("./examples/dummyGeometry.xml");
-
- SiDPandoraPFAGeometry geom;
- geom.loadFromFile( geomFile );
-
- PandoraApi::Geometry::Parameters* params = geom.getGeometryParameters();
-
- // test
- std::cout << "trackerInnerRadius = " << params->m_mainTrackerInnerRadius.Get() << std::endl;
- std::cout << "trackerOuterRadius = " << params->m_mainTrackerOuterRadius.Get() << std::endl;
-}
slicPandora/tests
diff -N JobTest.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ JobTest.cpp 22 Feb 2010 19:44:15 -0000 1.1
@@ -0,0 +1,158 @@
+/*
+ * File: main.cpp
+ * Author: ngraf
+ *
+ * Created on December 1, 2009, 2:18 AM
+ */
+
+#include <stdlib.h>
+#include <iostream>
+
+#include "lcio.h"
+
+#include "IO/LCReader.h"
+#include "IO/LCWriter.h"
+#include "IMPL/LCTOOLS.h"
+#include "EVENT/LCRunHeader.h"
+
+
+#include "SlicPandoraPFANewProcessor.h"
+#include "CalorimeterHitMaker.h"
+
+static std::vector<std::string> FILEN;
+
+using namespace std;
+using namespace lcio;
+
+/*
+ *
+ */
+int main(int argc, char** argv)
+{
+ cout << "Hello from sidPandora" << endl;
+
+
+ // read file names from command line (only argument)
+ if (argc < 2)
+ {
+ cout << " usage: slicpandoramain <input-file1> <pandora settings xml file>" << endl;
+ exit(1);
+ }
+ // for (int i = 1; i < argc; i++)
+ // {
+ FILEN.push_back(argv[1]);
+ string xmlFileName = argv[2];
+ cout << "Processing file " << argv[1] << endl;
+ cout << "using " << xmlFileName << endl;
+ // }
+ int nFiles = 1;
+
+ LCReader* lcReader = LCFactory::getInstance()->createLCReader();
+
+ LCWriter* lcWriter = LCFactory::getInstance()->createLCWriter();
+ try
+ {
+ lcWriter->setCompressionLevel(9);
+ lcWriter->open("reco.slcio", LCIO::WRITE_NEW);
+ } catch (IOException& e)
+ {
+ cout << "[RunEventProcessor()] Can't open file for writing - "
+ << e.what() << endl;
+ exit(1);
+ }
+
+
+ // first we read the run information
+
+ cout << "creating processors" << endl;
+ CalorimeterHitMaker chitmaker;
+ SlicPandoraPFANewProcessor processor(xmlFileName);
+
+ // PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ReadSettings(_pandora, "C:/work/ilc/software/C++/PandoraPFA/PandoraSettings.xml"));
+ // for reading from one file only use sth. like:
+ // const char* FILEN = "recjob.slcio" ;
+ // cout << " will open and read from files: " << endl;
+ // for (int i = 0; i < nFiles; i++)
+ // {
+ // cout << " " << FILEN[i] << endl;
+ // }
+
+ int maxNumberOfEvents = 1;
+ int events = 0;
+
+ //
+ // lcReader->open(FILEN);
+ // LCRunHeader *runHdr;
+ //
+ // // use a try catch block here: if sth. went wrong with reading the run data we
+ // // still can try and read the event data - see below
+ // try
+ // {
+ // // loop over all run headers
+ // while ((runHdr = lcReader->readNextRunHeader()) != 0)
+ // {
+ // LCTOOLS::dumpRunHeader(runHdr);
+ // // cout << " Run : " << runHdr->getRunNumber()
+ // // << " - " << runHdr->getDetectorName()
+ // // << ": " << runHdr->getDescription() << endl ;
+ //
+ //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateTracks(pLCEvent));
+ //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateCaloHits(pLCEvent));
+ //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ProcessEvent(m_pandora));
+ //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->ProcessParticleFlowObjects(pLCEvent));
+ //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::Reset(m_pandora));
+ // if(++events >= maxNumberOfEvents) break;
+ // }
+ //
+ // } catch (IOException& e)
+ // {
+ // cout << " io error when reading run data : " << e.what() << endl;
+ // }
+ // cout << endl;
+ //
+ // lcReader->close();
+
+
+ // now loop over the file again and dump event data
+
+ lcReader->open(FILEN);
+
+ // cout << " reopened " << FILEN << " for reading " << endl ;
+ cout << " will open and read from files: " << endl;
+ for (int i = 0; i < nFiles; i++)
+ {
+ cout << " " << FILEN[i] << endl;
+ }
+
+ LCEvent* evt;
+ int nEvents = 0;
+
+ //----------- the event loop -----------
+ while ((evt = lcReader->readNextEvent()) != 0)
+ {
+ LCTOOLS::dumpEvent(evt);
+ // create CalorimeterHits...
+ chitmaker.processEvent(evt);
+ // run pandoraPFA...
+ processor.processEvent(evt);
+ cout << " done with processing this event" << endl;
+ // print out the contents of the reconstruction
+ LCTOOLS::dumpEvent(evt);
+ lcWriter->writeEvent(evt);
+ if (++nEvents >= maxNumberOfEvents) break;
+
+ }
+ // -------- end of event loop -----------
+
+ cout << endl << " " << nEvents << " events read from files: " << endl;
+ for (int i = 0; i < nFiles; i++)
+ {
+ cout << " " << FILEN[i] << endl;
+ }
+
+ lcReader->close();
+ lcWriter->close();
+
+ delete lcReader;
+ return (EXIT_SUCCESS);
+}
slicPandora/tests
diff -N SimpleGeometryLoader.cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SimpleGeometryLoader.cpp 22 Feb 2010 19:44:15 -0000 1.1
@@ -0,0 +1,23 @@
+#include "DetectorGeometry.h"
+
+using namespace std;
+
+int main( int argc, const char* argv[] )
+{
+ if ( argc < 2 )
+ {
+ std::cout << "USAGE: ./slicPandora geometry.xml" << std::endl;
+ return 1;
+ }
+
+ const char* geomFile = argv[1];
+
+ DetectorGeometry geom;
+ geom.loadFromFile( geomFile );
+
+ PandoraApi::Geometry::Parameters* params = geom.getGeometryParameters();
+
+ // test
+ std::cout << "trackerInnerRadius = " << params->m_mainTrackerInnerRadius.Get() << std::endl;
+ std::cout << "trackerOuterRadius = " << params->m_mainTrackerOuterRadius.Get() << std::endl;
+}
slicPandora/tests
diff -N main.cpp
--- main.cpp 8 Jan 2010 22:55:34 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,158 +0,0 @@
-/*
- * File: main.cpp
- * Author: ngraf
- *
- * Created on December 1, 2009, 2:18 AM
- */
-
-#include <stdlib.h>
-#include <iostream>
-
-#include "lcio.h"
-
-#include "IO/LCReader.h"
-#include "IO/LCWriter.h"
-#include "IMPL/LCTOOLS.h"
-#include "EVENT/LCRunHeader.h"
-
-
-#include "SlicPandoraPFANewProcessor.h"
-#include "CalorimeterHitMaker.h"
-
-static std::vector<std::string> FILEN;
-
-using namespace std;
-using namespace lcio;
-
-/*
- *
- */
-int main(int argc, char** argv)
-{
- cout << "Hello from sidPandora" << endl;
-
-
- // read file names from command line (only argument)
- if (argc < 2)
- {
- cout << " usage: slicpandoramain <input-file1> <pandora settings xml file>" << endl;
- exit(1);
- }
- // for (int i = 1; i < argc; i++)
- // {
- FILEN.push_back(argv[1]);
- string xmlFileName = argv[2];
- cout << "Processing file " << argv[1] << endl;
- cout << "using " << xmlFileName << endl;
- // }
- int nFiles = 1;
-
- LCReader* lcReader = LCFactory::getInstance()->createLCReader();
-
- LCWriter* lcWriter = LCFactory::getInstance()->createLCWriter();
- try
- {
- lcWriter->setCompressionLevel(9);
- lcWriter->open("reco.slcio", LCIO::WRITE_NEW);
- } catch (IOException& e)
- {
- cout << "[RunEventProcessor()] Can't open file for writing - "
- << e.what() << endl;
- exit(1);
- }
-
-
- // first we read the run information
-
- cout << "creating processors" << endl;
- CalorimeterHitMaker chitmaker;
- SlicPandoraPFANewProcessor processor(xmlFileName);
-
- // PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ReadSettings(_pandora, "C:/work/ilc/software/C++/PandoraPFA/PandoraSettings.xml"));
- // for reading from one file only use sth. like:
- // const char* FILEN = "recjob.slcio" ;
- // cout << " will open and read from files: " << endl;
- // for (int i = 0; i < nFiles; i++)
- // {
- // cout << " " << FILEN[i] << endl;
- // }
-
- int maxNumberOfEvents = 1;
- int events = 0;
-
- //
- // lcReader->open(FILEN);
- // LCRunHeader *runHdr;
- //
- // // use a try catch block here: if sth. went wrong with reading the run data we
- // // still can try and read the event data - see below
- // try
- // {
- // // loop over all run headers
- // while ((runHdr = lcReader->readNextRunHeader()) != 0)
- // {
- // LCTOOLS::dumpRunHeader(runHdr);
- // // cout << " Run : " << runHdr->getRunNumber()
- // // << " - " << runHdr->getDetectorName()
- // // << ": " << runHdr->getDescription() << endl ;
- //
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateTracks(pLCEvent));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->CreateCaloHits(pLCEvent));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::ProcessEvent(m_pandora));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, this->ProcessParticleFlowObjects(pLCEvent));
- //// PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraApi::Reset(m_pandora));
- // if(++events >= maxNumberOfEvents) break;
- // }
- //
- // } catch (IOException& e)
- // {
- // cout << " io error when reading run data : " << e.what() << endl;
- // }
- // cout << endl;
- //
- // lcReader->close();
-
-
- // now loop over the file again and dump event data
-
- lcReader->open(FILEN);
-
- // cout << " reopened " << FILEN << " for reading " << endl ;
- cout << " will open and read from files: " << endl;
- for (int i = 0; i < nFiles; i++)
- {
- cout << " " << FILEN[i] << endl;
- }
-
- LCEvent* evt;
- int nEvents = 0;
-
- //----------- the event loop -----------
- while ((evt = lcReader->readNextEvent()) != 0)
- {
- LCTOOLS::dumpEvent(evt);
- // create CalorimeterHits...
- chitmaker.processEvent(evt);
- // run pandoraPFA...
- processor.processEvent(evt);
- cout << " done with processing this event" << endl;
- // print out the contents of the reconstruction
- LCTOOLS::dumpEvent(evt);
- lcWriter->writeEvent(evt);
- if (++nEvents >= maxNumberOfEvents) break;
-
- }
- // -------- end of event loop -----------
-
- cout << endl << " " << nEvents << " events read from files: " << endl;
- for (int i = 0; i < nFiles; i++)
- {
- cout << " " << FILEN[i] << endl;
- }
-
- lcReader->close();
- lcWriter->close();
-
- delete lcReader;
- return (EXIT_SUCCESS);
-}
CVSspam 0.2.8