Skip to content
Snippets Groups Projects
JobConfig.h 4.75 KiB
Newer Older
  • Learn to ignore specific revisions
  • Whitney Armstrong's avatar
    Whitney Armstrong committed
    // $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