Skip to content
Snippets Groups Projects
Commit 569e9d0b authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Initial commit

parents
Branches
No related tags found
No related merge requests found
Showing
with 1415 additions and 0 deletions
########################################################
# CMake file for building slicPandora, which is
# based on Marlin's CMakeLists.txt by Jan Engels, DESY.
#
# @author Jeremy McCormick, SLAC
########################################################
# --- Check for Recent CMake ----
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# ---- Project Info ----
PROJECT( slicPandora )
SET( ${PROJECT_NAME}_VERSION_MAJOR 02 )
SET( ${PROJECT_NAME}_VERSION_MINOR 00 )
SET( ${PROJECT_NAME}_VERSION_PATCH 00 )
# ---- Turn off RPATH ----
SET( CMAKE_SKIP_RPATH 1 )
# ---- Find and Setup External Packages ----
FIND_PACKAGE( ILCUTIL COMPONENTS ILCSOFT_CMAKE_MODULES REQUIRED )
INCLUDE( ilcsoft_default_settings )
FIND_PACKAGE( LCIO REQUIRED )
FIND_PACKAGE( PandoraSDK 02.00.00 REQUIRED )
FIND_PACKAGE( LCContent 02.00.00 REQUIRED )
#FIND_PACKAGE( ROOT )
#FIND_PACKAGE( PandoraMonitoring 02.00.00 )
FOREACH( pkg LCIO PandoraSDK )
IF ( ${pkg}_FOUND )
INCLUDE_DIRECTORIES( ${${pkg}_INCLUDE_DIRS} )
LINK_LIBRARIES( ${${pkg}_LIBRARIES} )
ADD_DEFINITIONS( ${${PKG}_DEFINITIONS} )
ENDIF()
ENDFOREACH()
# ---- Monitoring define for Pandora ----
#IF( PandoraMonitoring_FOUND )
# ADD_DEFINITIONS( -DMONITORING )
#ELSE()
# MESSAGE( STATUS "PandoraMonitoring package was not found -- please set PandoraMonitoring_DIR to activate PandoraMonitoring." )
#ENDIF()
# ---- Variables for includes and libs ----
SET( slicPandora_DEPENDS_INCLUDE_DIRS ${LCIO_INCLUDE_DIRS} ${PandoraSDK_INCLUDE_DIRS} ${LCContent_INCLUDE_DIRS} )
SET( slicPandora_DEPENDS_LIBRARY_DIRS ${LCIO_LIBRARY_DIRS} ${PandoraSDK_INCLUDE_DIRS} ${LCContent_INCLUDE_DIRS} )
SET( slicPandora_DEPENDS_LIBRARIES ${LCIO_LIBRARIES} ${PandoraSDK_LIBRARIES} ${LCContent_LIBRARIES} )
# ---- Set includes and libs ----
INCLUDE_DIRECTORIES( ${slicPandora_DEPENDS_INCLUDE_DIRS} )
LINK_LIBRARIES( ${slicPandora_DEPENDS_LIBRARIES} )
# ---- Project Include Dir ----
INCLUDE_DIRECTORIES( ./include )
INSTALL_DIRECTORY( ./include DESTINATION . FILES_MATCHING PATTERN "*.h" )
# ---- Compiler Flags ----
ADD_DEFINITIONS( "-Wall -ansi -pedantic" )
ADD_DEFINITIONS( "-Wno-long-long" )
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
message( STATUS "The compiler ${CMAKE_CXX_COMPILER} has C++11 support." )
ADD_DEFINITIONS( "-std=c++11" )
else()
message( STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Some Pandora functionality will be limited." )
endif()
# ---- Project Source Directory ----
AUX_SOURCE_DIRECTORY( ./src library_sources )
# ---- Shared Lib ----
ADD_SHARED_LIBRARY( ${PROJECT_NAME} ${library_sources} )
INSTALL_SHARED_LIBRARY( ${PROJECT_NAME} DESTINATION lib )
# ---- Executable ----
ADD_EXECUTABLE( bin_${PROJECT_NAME} ./tests/PandoraFrontendTest )
SET_TARGET_PROPERTIES( bin_${PROJECT_NAME} PROPERTIES OUTPUT_NAME PandoraFrontend )
TARGET_LINK_LIBRARIES( bin_${PROJECT_NAME} slicPandora )
INSTALL( TARGETS bin_${PROJECT_NAME} DESTINATION bin )
###############################################
# cmake configuration file for @PROJECT_NAME@
# @author Jan Engels, DESY
###############################################
SET( @PROJECT_NAME@_FOUND FALSE )
MARK_AS_ADVANCED( @PROJECT_NAME@_FOUND )
# do not store find results in cache
SET( @PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@_INCLUDE_DIR-NOTFOUND )
FIND_PATH( @PROJECT_NAME@_INCLUDE_DIR
NAMES PandoraPFANewProcessor.h
PATHS @CMAKE_INSTALL_PREFIX@
PATH_SUFFIXES include
NO_DEFAULT_PATH
)
IF( NOT @PROJECT_NAME@_INCLUDE_DIR )
MESSAGE( STATUS "Check for @PROJECT_NAME@: ${@PROJECT_NAME@_HOME}"
" -- failed to find @PROJECT_NAME@ include directory!!" )
ELSE( NOT @PROJECT_NAME@_INCLUDE_DIR )
MARK_AS_ADVANCED( @PROJECT_NAME@_INCLUDE_DIR )
ENDIF( NOT @PROJECT_NAME@_INCLUDE_DIR )
# do not store find results in cache
SET( @PROJECT_NAME@_LIB @PROJECT_NAME@_LIB-NOTFOUND )
FIND_LIBRARY( @PROJECT_NAME@_LIB
NAMES @PROJECT_NAME@
PATHS @CMAKE_INSTALL_PREFIX@
PATH_SUFFIXES lib
NO_DEFAULT_PATH
)
IF( NOT @PROJECT_NAME@_LIB )
MESSAGE( STATUS "Check for @PROJECT_NAME@: ${@PROJECT_NAME@_HOME}"
" -- failed to find @PROJECT_NAME@ library!!" )
ELSE( NOT @PROJECT_NAME@_LIB )
MARK_AS_ADVANCED( @PROJECT_NAME@_LIB )
ENDIF( NOT @PROJECT_NAME@_LIB )
# set variables and display results
IF( @PROJECT_NAME@_INCLUDE_DIR AND @PROJECT_NAME@_LIB )
SET( @PROJECT_NAME@_FOUND TRUE )
SET( @PROJECT_NAME@_INCLUDE_DIRS ${@PROJECT_NAME@_INCLUDE_DIR} )
SET( @PROJECT_NAME@_LIBRARY_DIRS "@CMAKE_INSTALL_PREFIX@/lib" )
SET( @PROJECT_NAME@_LIBRARIES ${@PROJECT_NAME@_LIB} )
MARK_AS_ADVANCED( @PROJECT_NAME@_INCLUDE_DIRS @PROJECT_NAME@_LIBRARY_DIRS @PROJECT_NAME@_LIBRARIES )
MESSAGE( STATUS "Check for @PROJECT_NAME@: ${@PROJECT_NAME@_HOME} -- works" )
ELSE( @PROJECT_NAME@_INCLUDE_DIR AND @PROJECT_NAME@_LIB )
IF( @PROJECT_NAME@_FIND_REQUIRED )
MESSAGE( FATAL_ERROR "Check for @PROJECT_NAME@: ${@PROJECT_NAME@_HOME} -- failed!!" )
ELSE( @PROJECT_NAME@_FIND_REQUIRED )
MESSAGE( STATUS "Check for @PROJECT_NAME@: ${@PROJECT_NAME@_HOME}"
" -- failed!! will skip this package..." )
ENDIF( @PROJECT_NAME@_FIND_REQUIRED )
ENDIF( @PROJECT_NAME@_INCLUDE_DIR AND @PROJECT_NAME@_LIB )
##########################################
# create an uninstall target for cmake
# http://www.cmake.org/Wiki/CMake_FAQ
##########################################
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF("${rm_retval}" STREQUAL 0)
ELSE("${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF("${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)
<LcioInputCollections>
<!-- Track -->
<TrackCollection name="Tracks" />
<!-- TrackState -->
<TrackStateCollection name="StateAtStart" trackState="StateAtStart" />
<TrackStateCollection name="StateAtECal" trackState="StateAtECal" />
<TrackStateCollection name="StateAtEnd" trackState="StateAtEnd" />
<!-- CalorimeterHit -->
<CaloCollection name="EcalBarrelHits" caloType="EM_BARREL" />
<CaloCollection name="EcalEndcapHits" caloType="EM_ENDCAP" />
<CaloCollection name="HcalBarrelHits" caloType="HAD_BARREL" />
<CaloCollection name="HcalEndcapHits" caloType="HAD_ENDCAP" />
<CaloCollection name="MuonBarrelHits" caloType="MUON_BARREL" />
<CaloCollection name="MuonEndcapHits" caloType="MUON_ENDCAP" />
</LcioInputCollections>
This diff is collapsed.
#!/bin/sh
date
echo
./bin/PandoraFrontend ./examples/sidloi2_pandora.xml ./examples/PandoraSettingsNew.xml ./input.slcio ./pandoraRecon.slcio 10
echo
date
#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;
namespace pandora { class SubDetector; }
/**
* This is an event processor that converts collections of CalorimeterHits
* to Pandora CaloHit::Parameters and registers them with the current
* Pandora instance. The collections to process are retrieved from the JobManager's
* list of calorimeter collection types (e.g. EM_BARREL).
*/
class CalorimeterHitProcessor : public EventProcessor
{
public:
/**
* Standard ctor.
*/
CalorimeterHitProcessor()
: EventProcessor("CalorimeterHitProcessor")
{;}
/**
* Standard dtor.
*/
virtual ~CalorimeterHitProcessor()
{;}
public:
/**
* This method converts LCIO CalorimeterHits into Pandora CalHit::Parameters.
* @param The LCIO event containing the CalorimeterHit collections to convert.
*/
void processEvent(EVENT::LCEvent* event);
private:
/**
* Make a 64-bit ID from the two 32-bit cell IDs of a CalorimeterHit.
* @param The CalorimterHit with the ID to be converted.
*/
inline long long makeId64(CalorimeterHit* hit) const
{
return ((long long)hit->getCellID1())<<32 | hit->getCellID0();
}
/**
* Convert an LCIO CalorimeterHit into a PandoraPFANew CaloHit Parameters.
* @param subdet The SubDetector parameters for the hit.
* @param xsubdet The extra SubDetector parameters.
* @oaran calhit The CaloHit to be converted.
* @return A Pandora CaloHit.
*/
PandoraApi::CaloHit::Parameters makeCaloHitParameters(
const pandora::SubDetector* subdet,
DetectorGeometry::ExtraSubDetectorParameters* xsubdet,
CalorimeterHit* calhit);
/**
* Print the given CalHit::Parameters to cout.
* @param The CaloHit parameters to print out.
*/
void printCaloHitParameters(const PandoraApi::CaloHit::Parameters& calparams);
};
#endif
#ifndef ClusterShapes_h
#define ClusterShapes_h
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdlib>
#include <math.h>
/**
* Ported from MarlinUtil. Only took findGravity() and getCentreOfGravity() functions.
* There is no GSL dependency.
* --JM
*
* @authors V. Morgunov (ITEP/DESY), A. Raspereza (DESY), O. Wendt (DESY)
* @version $Id: ClusterShapes.h,v 1.2 2010/06/08 22:12:41 jeremy Exp $
*
*/
class ClusterShapes
{
public:
/**
* Constructor
* @param nhits : number of hits in the cluster
* @param a : amplitudes of elements ('cells') of the cluster. Stored in
* an array, with one entry for each element ('cell'). Each entry
* is depending on coordinates x,y,z (Cartesian), which are stored
* in the arrays x,y,z.
* @param x,y,z : array of coordinates corresponding to the array of amplitudes a.
*
*
*/
ClusterShapes(int nhits, float* a, float* x, float* y, float* z);
/**
* Destructor
*/
~ClusterShapes();
/**
* returns an array, which represents a vector from the origin of the
* coordiante system, i.\ e.\ IP, to the centre of gravity of the cluster. The centre
* of gravity is calculated with the energy of the entries of the cluster.
*/
float* getCentreOfGravity();
/** US spelling of getCentreOfGravity */
inline float* getCenterOfGravity() { return getCentreOfGravity() ; }
private:
void findGravity();
private:
int _nHits;
float* _aHit;
float* _xHit;
float* _yHit;
float* _zHit;
float* _exHit;
float* _eyHit;
float* _ezHit;
int* _types;
float* _xl;
float* _xt;
float* _t;
float* _s;
int _ifNotGravity;
float _totAmpl;
float _radius;
float _xgr;
float _ygr;
float _zgr;
float _analogGravity[3];
int _ifNotWidth;
float _analogWidth;
int _ifNotInertia;
float _ValAnalogInertia[3];
float _VecAnalogInertia[9];
int _ifNotEigensystem;
int _ifNotElipsoid;
float _r1 ; // Cluster spatial axis length -- the largest
float _r2 ; // Cluster spatial axis length -- less
float _r3 ; // Cluster spatial axis length -- less
float _vol ; // Cluster ellipsoid volume
float _r_ave ; // Cluster average radius (qubic root)
float _density ; // Cluster density
float _eccentricity ; // Cluster Eccentricity
float _r1_forw ;
float _r1_back ;
};
#endif
#ifndef DEFAULTPROCESSORS_H
#define DEFAULTPROCESSORS_H 1
/**
* List of default slicPandora Processor headers.
*/
// slicPandora
#include "CalorimeterHitProcessor.h"
#include "EventMarkerProcessor.h"
#include "PandoraProcessor.h"
#include "PfoProcessor.h"
#include "ResetPandoraProcessor.h"
#include "SimCalorimeterHitProcessor.h"
#include "SimpleTrackProcessor.h"
#include "MCParticleProcessor.h"
#endif
// $Id: DetectorGeometry.h,v 1.16 2011/09/19 20:34:53 jeremy Exp $
#ifndef DetectorGeometry_h
#define DetectorGeometry_h 1
// pandora
#include "Api/PandoraApi.h"
// stl
#include <vector>
class IDDecoder;
class JobManager;
/**
* Encapsulates the detector geometry including Pandora's geometry parameters,
* as well as various extras necessary to load Pandora geometry files generated
* by GeomConverter.
*/
class DetectorGeometry
{
public:
// Extra layer parameters.
class ExtraLayerParameters
{
public:
pandora::InputFloat m_samplingFraction;
pandora::InputFloat m_emSamplingFraction;
pandora::InputFloat m_hadSamplingFraction;
pandora::InputFloat m_cellThickness;
float m_intLength;
float m_radLength;
};
typedef std::vector<ExtraLayerParameters> ExtraLayerParametersList;
// Extra subdetector parameters, including cell sizes.
class ExtraSubDetectorParameters
{
public:
pandora::InputFloat m_cellThickness;
pandora::InputFloat m_cellSizeU;
pandora::InputFloat m_cellSizeV;
pandora::InputFloat m_mipEnergy;
pandora::InputFloat m_mipSigma;
pandora::InputFloat m_mipCut;
pandora::InputFloat m_timeCut;
std::string m_collection;
IDDecoder* m_decoder;
ExtraLayerParametersList m_extraLayerParams;
pandora::InputHitType m_inputHitType;
pandora::InputHitRegion m_inputHitRegion;
std::vector<pandora::CartesianVector*> m_normalVectors;
pandora::InputBool m_isDigital;
};
typedef std::map<std::string, ExtraSubDetectorParameters> ExtraSubDetectorParametersMap;
public:
DetectorGeometry(JobManager *pJobManager, std::string);
virtual ~DetectorGeometry() {;}
/**
* Load geometry from an XML input file produced by GeomConverter in the "pandora" format.
*/
void loadFromFile(std::string);
/**
* Get the map of ExtraSubDetectorParameters.
*/
ExtraSubDetectorParametersMap* getExtraParameters()
{
return &subdetExtras;
}
ExtraSubDetectorParameters* getExtraSubDetectorParametersFromType(const std::string& calType)
{
return &(subdetExtras[calType]);
}
/**
* Print SubDetectorParameters to cout.
*/
void printOut(const char* subdetType, PandoraApi::Geometry::SubDetector::Parameters* subdet);
/**
* Get the pandora SubDetectorType for a given calorimeter type string.
*/
pandora::SubDetectorType getPandoraSubDetectorType(const char*) const;
/**
* Get the pandora SubDetectorType for a given calorimeter type string.
*/
pandora::SubDetectorType getPandoraSubDetectorType(const std::string&) const;
/**
* Simple utility method to return the InputHitRegion from the calorimeter type.
*/
inline pandora::InputHitRegion getHitRegion(const std::string& calType) const;
/**
* Simple utility method to return the InputHitType from the calorimeter type.
*/
inline pandora::InputHitType getHitType(const std::string& calType) const;
/**
* Get the pointer to the geometry's associated JobManager.
*/
JobManager* getJobManager() const
{
return m_manager;
}
/**
* Get the inner b field strength, units Tesla
* @return the inner b field strength, units Tesla
*/
float getInnerBField() const
{
return m_innerBField;
}
/**
* Get the detector name.
* @return The detector name.
*/
const std::string& getDetectorName() const
{
return detectorName;
}
private:
JobManager* m_manager;
ExtraSubDetectorParametersMap subdetExtras;
float m_innerBField;
std::string detectorName;
};
#endif
#ifndef DummyProcessor_h
#define DummyProcessor_h 1
#include "EventProcessor.h"
class DummyProcessor : public EventProcessor
{
public:
DummyProcessor();
virtual ~DummyProcessor();
void processEvent(EVENT::LCEvent*);
};
#endif
// $Id: EventMarkerProcessor.h,v 1.2 2010/06/08 22:12:41 jeremy Exp $
#ifndef EVENTMARKERPROCESSOR_H
#define EVENTMARKERPROCESSOR_H 1
#include "EventProcessor.h"
/**
* Prints the event number for each event processed.
*/
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
// $Id: EventProcessor.h,v 1.4 2010/03/11 22:18:44 jeremy Exp $
#ifndef EventProcessor_h
#define EventProcessor_h 1
// stl
#include <string>
// lcio
#include "EVENT/LCEvent.h"
// Avoid circular reference with EventProcessor class.
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
* pointer to the JobManager.
*/
class EventProcessor
{
public:
/**
* ctor which requires a name argument.
*/
EventProcessor(std::string name)
: m_name(name)
{;}
/**
* Standard dtor.
*/
virtual ~EventProcessor()
{;}
/**
* Set the pointer to the processor's JobManager.
*/
inline void setJobManager(JobManager* manager)
{
m_manager = manager;
}
/**
* Get the pointer to the processor's JobManager.
*/
inline JobManager* getJobManager() const
{
return m_manager;
}
/**
* Get the name of the processor.
*/
inline const std::string& getName() const
{
return m_name;
}
/**
* Process a single LCIO event. This is a pure virtual method that must be
* implemented by sub-classes. Processors that call Pandora algorithms may
* ignore the LCEvent and retrieve objects directly from the Pandora instance.
*/
virtual void processEvent(EVENT::LCEvent*) = 0;
private:
JobManager* m_manager;
std::string m_name;
};
#endif
// $Id: IDDecoder.h,v 1.4 2010/03/11 22:18:44 jeremy Exp $
#ifndef IDDECODER_H
#define IDDECODER_H 1
// stl
#include <string>
#include <vector>
#include <map>
/**
* This class extracts field values from 64-bit identifiers based on an identifier
* description. It provides similar functionality to the GeomConverter Java class
* org.lcsim.geometry.util.IDDecoder (but NOT the org.lcsim.geometry.IDDecoder interface
* with the same class name).
*/
class IDDecoder
{
public:
/**
* An IDField represents a portion of a 64-bit id which contains a data field.
* This is defined by a starting bit, a length, and a flag that specifies
* whether the field may contain signed values that need to be decoded differently
* from unsigned fields. Fields also have a name, e.g. "layer"..
*/
class IDField
{
public:
/**
* Fully specified ctor. The parameters of IDFields do not change after creation.
*/
IDField(const std::string& name, int start, int length, bool isSigned)
: m_name(name), m_start(start), m_length(length), m_signed(isSigned)
{;}
/**
* Standard dtor.
*/
virtual ~IDField()
{;}
/**
* Get the name of the field.
*/
inline const std::string& getName() const
{
return m_name;
}
/**
* Get the start bit of the field, numbered from 0 to 63.
*/
inline const int getStart() const
{
return m_start;
}
/**
* Get the length of the field.
*/
inline const int getLength() const
{
return m_length;
}
/**
* Get the sign flag specifying whether this field may contain signed field values.
*/
inline const bool isSigned() const
{
return m_signed;
}
private:
std::string m_name;
int m_start;
int m_length;
bool m_signed;
};
public:
// List of fields.
typedef std::vector<IDField*> IDFields;
// Map of field indices to fields.
typedef std::map<int,IDField*> IndexedFieldMap;
// Map of field names to fields.
typedef std::map<std::string,IDField*> NamedFieldMap;
// Map field names to indices.
typedef std::map<std::string,int> Name2IndexMap;
/**
* ctor that requires a list of fields.
*/
IDDecoder(IDFields fields)
: m_fields(fields)
{
// Setup the field maps.
int i=0;
for (IDFields::iterator iter = fields.begin();
iter != fields.end();
iter++)
{
m_indexMap[i] = (*iter);
m_nameMap[(*iter)->getName()] = (*iter);
m_name2IndexMap[(*iter)->getName()] = i;
i++;
}
}
/**
* Standard dtor.
*/
virtual ~IDDecoder()
{;}
/**
* Extract a field at the given index from the id.
*/
int getFieldValue(int index, long id);
/**
* Extract a field with the given name from the id.
*/
int getFieldValue(const std::string& name, long id);
/**
* Get a field by index.
*/
inline const IDField* getField(int index)
{
return m_indexMap[index];
}
/**
* Get a field by name.
*/
inline const IDField* getField(const std::string& name)
{
return m_nameMap[name];
}
/**
* Get the index of a field by name.
*/
inline const int getFieldIndex(const std::string& name)
{
return m_name2IndexMap[name];
}
/**
* Get the number of fields.
*/
inline const int getFieldCount() const
{
return m_fields.size();
}
private:
IDFields m_fields;
IndexedFieldMap m_indexMap;
NamedFieldMap m_nameMap;
Name2IndexMap m_name2IndexMap;
};
#endif
// $Id: JobConfig.h,v 1.7 2012/01/31 15:08:34 jeremy Exp $
#ifndef JOBCONFIG_H
#define JOBCONFIG_H 1
// stl
#include <string>
#include <vector>
// slicPandora
#include "LcioInputCollectionSettings.h"
/**
* JobConfig contains the parameters for running Pandora jobs using the JobManager.
*/
class JobConfig
{
public:
// List of input files.
typedef std::vector<std::string> FileList;
// List of calorimeter types.
typedef std::vector<std::string> CalorimeterTypes;
JobConfig()
: nrun(-1),
nskip(0),
m_useDefaultCaloTypes(true),
m_deleteExistingCollections(false)
{;}
virtual ~JobConfig()
{;}
/**
* Set the Pandora settings XML file path.
*/
void setPandoraSettingsXmlFle(const char* pandoraSettingsXmlFile)
{
this->pandoraSettingsXmlFile = std::string(pandoraSettingsXmlFile);
}
/**
* Set the Pandora settings XML file path.
*/
void setPandoraSettingsXmlFile(std::string pandoraSettingsXmlFile)
{
this->pandoraSettingsXmlFile = pandoraSettingsXmlFile;
}
/**
* Get the Pandora settings XML file path.
*/
const std::string& getPandoraSettingsXmlFile() const
{
return pandoraSettingsXmlFile;
}
/**
* Set the path to the input Pandora geometry file generated by GeomConverter.
*/
void setGeometryFile(const char* geometryFile)
{
this->geometryFile = std::string(geometryFile);
}
/**
* Set the path to the input Pandora geometry file generated by GeomConverter.
*/
void setGeometryFile(std::string geometryFile)
{
this-> geometryFile = geometryFile;
}
/**
* Get the path to the geometry file.
*/
const std::string& getGeometryFile() const
{
return geometryFile;
}
/**
* Add an input LCIO file.
*/
void addInputFile(const char* filename)
{
inputLcioFiles.push_back(std::string(filename));
}
/**
* Add an input LCIO file.
*/
void addInputFile(std::string filename)
{
inputLcioFiles.push_back(filename);
}
/**
* Get the list of input files.
*/
const FileList& getInputFiles() const
{
return inputLcioFiles;
}
/**
* Set the LCIO output file path.
*/
void setOutputFile(const char* outputFile)
{
this->outputFile = std::string(outputFile);
}
/**
* Set the LCIO output file path.
*/
void setOutputFile(std::string outputFile)
{
this->outputFile = outputFile;
}
/**
* Get the LCIO output file path.
*/
const std::string& getOutputFile() const
{
return outputFile;
}
/**
* Set the maximum number of events to process.
*/
void setNumberOfEvents(int nrun)
{
this->nrun = nrun;
}
/**
* Get the maximum number of events to process.
*/
const int getNumberOfEvents() const
{
return nrun;
}
/**
* Set the number of events to skip.
*/
void setSkipEvents(int nskip)
{
this->nskip = nskip;
}
/**
* Get the number of events to skip.
*/
const int getSkipEvents() const
{
return nskip;
}
/**
* Get a list of calorimeter types.
*/
const CalorimeterTypes& getCalorimeterTypes() const
{
return calTypes;
}
/**
* Add a CalorimeterType.
*/
void addCalorimeterType(const char* calType)
{
calTypes.push_back(std::string(calType));
}
/**
* Add a CalorimeterType.
*/
void addCalorimeterType(std::string calType)
{
calTypes.push_back(calType);
}
/**
* Setup to use the default CalorimeterTypes list.
*/
void setupDefaultCalorimeterTypes();
/**
* Set the XML file used for LCIO collection config.
*/
void setLcioConfigFile(const char* lcioConfigFile)
{
this->lcioConfigFile = lcioConfigFile;
m_useDefaultCaloTypes = false;
}
/**
* Get the XML file used for LCIO collection config.
*/
const std::string& getLcioConfigFile() const
{
return lcioConfigFile;
}
const bool useDefaultCaloTypes() const
{
return m_useDefaultCaloTypes;
}
const void setDeleteExistingCollections(bool d)
{
m_deleteExistingCollections = d;
}
const bool deleteExistingCollections() const
{
return m_deleteExistingCollections;
}
private:
std::string pandoraSettingsXmlFile;
std::string geometryFile;
std::string outputFile;
std::string lcioConfigFile;
CalorimeterTypes calTypes;
FileList inputLcioFiles;
int nrun;
int nskip;
bool m_useDefaultCaloTypes;
bool m_deleteExistingCollections;
};
#endif
// $Id: JobManager.h,v 1.10 2011/09/16 23:31:17 jeremy Exp $
#ifndef JobManager_h
#define JobManager_h 1
// lcio
#include "EVENT/LCEvent.h"
// pandora
#include "Api/PandoraApi.h"
// slicPandora
#include "JobConfig.h"
#include "LcioInputCollectionSettings.h"
class DetectorGeometry;
class EventProcessor;
/**
* The JobManager is a manager class for running slicPandora jobs.
* The job configuration is defined in a separate class, JobConfig.
*/
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();
/**
* Run the job with the current settings.
*/
void run();
/**
* Add an EventProcessor to the end of the processor list.
*/
void addEventProcessor(EventProcessor*);
/**
* Get the DetectorGeometry that was created from the input XML file.
*/
DetectorGeometry* getDetectorGeometry();
/**
* Get the Pandora PFA instance.
*/
const pandora::Pandora& getPandora();
/**
* Get the LCIO input collection settings for the job.
*/
inline const LcioInputCollectionSettings& getLcioCollectionSettings() const
{
return collectionSettings;
}
pandora::StatusCode setupDefaultLcioInputCollectionSettings(LcioInputCollectionSettings& lcioConfig);
private:
/**
* Run the processEvent() methods of the EventProcessors in order.
*/
void processEvent(EVENT::LCEvent*);
/**
* Initialize the job so that it is ready to run.
*/
void initialize();
/**
* Create Pandora's algorithm generators.
*/
pandora::StatusCode registerUserAlgorithmFactories();
/**
* Create the geometry from the XML geometry file.
*/
pandora::StatusCode createGeometry();
private:
JobConfig* m_config;
pandora::Pandora* m_pandora;
DetectorGeometry* m_detectorGeometry;
EventProcessors m_processors;
bool m_geometryLoaded;
bool m_initialized;
LcioInputCollectionSettings collectionSettings;
};
#endif
#ifndef LCIOInputCollectionSettings_h
#define LCIOInputCollectionSettings_h 1
#include <string>
#include <map>
#include "Xml/tinyxml.h"
#include "Api/PandoraApi.h"
#include "Pandora/StatusCodes.h"
class LcioInputCollectionSettings
{
public:
/**
* This represents the various kinds of calorimeters within Pandora.
*/
enum CaloType { UNKNOWN, EM_BARREL, EM_ENDCAP, HAD_BARREL, HAD_ENDCAP, MUON_BARREL, MUON_ENDCAP };
/**
* Map of CaloType to list of collections.
*/
typedef std::map<CaloType, std::vector<std::string> > CaloCollectionMap;
LcioInputCollectionSettings();
virtual ~LcioInputCollectionSettings();
/**
* Read LCIO collection settings from an XML file.
*/
pandora::StatusCode readSettings(const std::string& xmlFileName);
/**
* Add a link from CaloType to a collection.
*/
void addCaloCollection(CaloType type, const std::string& collection)
{
caloCollectionMap[type].push_back(std::string(collection));
}
/**
* Get the name of the Track collection.
*/
const std::string& getTrackCollectionName() const
{
return trackCollectionName;
}
/**
* Get the name of the TrackState collection.
*/
inline std::string getTrackStateCollectionName(const std::string& trackState)
{
return trackStateMap[trackState];
}
/**
* Was setup from XML?
*/
inline bool initialized() const
{
return m_initialized;
}
/**
* Get the CaloType from a string.
*/
static const CaloType getTypeFromString(const std::string& caloTypeName);
/**
* Get the type string from a CaloType.
*/
static const std::string& getStringFromType(CaloType caloType);
/**
* Get the map of CalorimeterHit collection names.
*/
const CaloCollectionMap& getCaloCollectionMap() const
{
return caloCollectionMap;
}
/**
* Get the list of default CalorimeterHit subdetector types.
*/
const std::vector<std::string>& getDefaultCalorimeterTypes() const
{
return defaultCaloTypes;
}
private:
bool m_initialized;
std::vector<std::string> defaultCaloTypes;
CaloCollectionMap caloCollectionMap;
std::string trackCollectionName;
std::map<std::string, std::string> trackStateMap;
static std::string emBarrel;
static std::string emEndcap;
static std::string hadBarrel;
static std::string hadEndcap;
static std::string muonBarrel;
static std::string muonEndcap;
static std::string unknown;
};
#endif
#ifndef MCPARTICLEPROCESSOR_H
#define MCPARTICLEPROCESSOR_H 1
// pandora
#include "Api/PandoraApi.h"
// slicPandora
#include "EventProcessor.h"
#include "DetectorGeometry.h"
// lcio
#include "EVENT/MCParticle.h"
using EVENT::MCParticle;
/**
* This is an event processor that converts collections of MCParticles
* to Pandora MCParticle::Parameters and registers them with the current
* Pandora instance.
*/
class MCParticleProcessor : public EventProcessor
{
public:
/**
* Standard ctor.
*/
MCParticleProcessor()
: EventProcessor("MCParticleProcessor")
{;}
/**
* Standard dtor.
*/
virtual ~MCParticleProcessor()
{;}
public:
/**
* This method converts LCIO MCParticles into Pandora CalHit::Parameters.
*/
void processEvent(EVENT::LCEvent*);
private:
/* /\** */
/* * Make a 64-bit ID from the two 32-bit cell IDs of a MCParticle. */
/* *\/ */
/* inline long long makeId64(MCParticle* hit) const */
/* { */
/* return ((long long)hit->getCellID1())<<32 | hit->getCellID0(); */
/* } */
/**
* Convert an LCIO MCParticle into a PandoraPFANew MCParticle Parameters.
*/
PandoraApi::MCParticle::Parameters makeMCParticleParameters(MCParticle*, int);
/**
* Print the given MCParticle::Parameters to cout.
*/
void printMCParticleParameters(const PandoraApi::MCParticle::Parameters&);
private:
static std::string mcParticleCollectionName;
};
#endif
// $Id: PandoraFrontend.h,v 1.1 2011/09/19 19:50:10 jeremy Exp $
#ifndef PANDORAFRONTEND_H_
#define PANDORAFRONTEND_H_
class PandoraFrontend
{
public:
PandoraFrontend() {;}
virtual ~PandoraFrontend() {;}
// To be run from program's main and used for return value.
int run(int argc, char **argv);
static void printUsage();
};
#endif /* PANDORAFRONTEND_H_ */
#ifndef PANDORAPROCESSOR_H
#define PANDORAPROCESSOR_H 1
// slicPandora
#include "EventProcessor.h"
// lcio
#include "EVENT/LCEvent.h"
/**
* Calls ProcessEvent to activate Pandora on an event.
*/
class PandoraProcessor : public EventProcessor
{
public:
PandoraProcessor()
: EventProcessor("PandoraProcessor")
{}
virtual ~PandoraProcessor()
{}
public:
void processEvent(EVENT::LCEvent*);
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment