Print

Print


Commit in slicPandora on MAIN
CMakeLists.txt+1-11.10 -> 1.11
include/PandoraFrontend.h+17added 1.1
       /LcioInputCollectionSettings.h+1-11.2 -> 1.3
src/PandoraFrontend.cpp+212added 1.1
tests/PandoraFrontendTest.cpp+13added 1.1
     /PandoraFrontend.cpp-2201.8 removed
+244-222
3 added + 1 removed + 2 modified, total 6 files
add PandoraFrontend class extracted from old main method; use the simple PandoraFrontend example as the default binary

slicPandora
CMakeLists.txt 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- CMakeLists.txt	7 Sep 2011 22:37:43 -0000	1.10
+++ CMakeLists.txt	19 Sep 2011 19:50:10 -0000	1.11
@@ -65,7 +65,7 @@
 INSTALL_SHARED_LIBRARY( ${PROJECT_NAME} DESTINATION lib )
 
 # ---- Executable ----
-ADD_EXECUTABLE( bin_${PROJECT_NAME} ./tests/PandoraFrontend )
+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 )

slicPandora/include
PandoraFrontend.h added at 1.1
diff -N PandoraFrontend.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PandoraFrontend.h	19 Sep 2011 19:50:10 -0000	1.1
@@ -0,0 +1,17 @@
+// $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_ */

slicPandora/include
LcioInputCollectionSettings.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- LcioInputCollectionSettings.h	19 Sep 2011 18:54:31 -0000	1.2
+++ LcioInputCollectionSettings.h	19 Sep 2011 19:50:10 -0000	1.3
@@ -23,7 +23,7 @@
     	typedef std::map<CaloType, std::vector<std::string> > CaloCollectionMap;
 
 	    LcioInputCollectionSettings();
-	    ~LcioInputCollectionSettings();
+	    virtual ~LcioInputCollectionSettings();
 
 	    /**
 	     * Read LCIO collection settings from an XML file.

slicPandora/src
PandoraFrontend.cpp added at 1.1
diff -N PandoraFrontend.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PandoraFrontend.cpp	19 Sep 2011 19:50:10 -0000	1.1
@@ -0,0 +1,212 @@
+// $Id: PandoraFrontend.cpp,v 1.1 2011/09/19 19:50:10 jeremy Exp $
+#include "PandoraFrontend.h"
+
+// slicPandora
+#include "JobManager.h"
+#include "JobConfig.h"
+#include "DefaultProcessors.h"
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+
+void PandoraFrontend::printUsage()
+{
+    cout << endl;
+    cout << "-----slicPandora Usage-----" << endl;
+    cout << "./bin/PandoraFrontend -g [geometry] -c [pandoraConfig] -i [inputEvents] -o [outputEvents] -l [lcioConfig] -r [nrun] -s [nskip]" << endl << endl;
+    cout << "    [-r] is optional.  Default is run over all input events." << endl;
+    cout << "    [-s] is optional.  Default is start at the first event." << endl;
+    cout << "    [-l] is optional.  Default is use subdetector's associated hit collections from geometry." << endl;
+    cout << "    [-o] is optional.  Default output file is called \"pandoraOutput.slcio\"." << endl;
+}
+
+int PandoraFrontend::run(int argc, char **argv)
+{
+    // getopt flags.
+    int g;
+    opterr = 0;
+
+    // Variables for holding getopt values.
+    int nrun = -1;
+    int nskip = 0;
+    char *geometryFile = NULL;
+    char *configFile = NULL;
+    char *outputFile = "pandoraOutput.slcio";
+    char *lcioConfigFile = NULL;
+    char *inputFile = NULL;
+
+    // Process command line options.
+    while ((g = getopt(argc, argv, "g:c:i:r:s:l:o:")) != -1)
+    {
+        switch (g)
+        {
+            // Geometry file.
+            case 'g':
+                geometryFile = optarg;
+                break;
+            // Pandora config file.
+            case 'c':
+                configFile = optarg;
+                break;
+            // Output file path.
+            case 'o':
+                outputFile = optarg;
+                break;
+            // Input LCIO file.
+            case 'i':
+                inputFile = optarg;
+                break;
+            // LCIO XML collection config file.
+            case 'l':
+                lcioConfigFile = optarg;
+                break;
+            // Number of events to run.
+            case 'r':
+                nrun = atoi(optarg);
+                break;
+            // Number of events to skip.
+            case 's':
+                nskip = atoi(optarg);
+                break;
+            // There are no valid non-switch arguments.
+            default:
+                printUsage();
+                return 1;
+        }
+    }
+
+    // Print arguments before we do anything with them.
+    cout << "slicPandora got these command line arguments..." << endl;
+    cout << endl;
+    if (geometryFile != NULL)
+    {
+        cout << "geometryFile (-g) = " << geometryFile << endl;
+    }
+    if (configFile != NULL)
+    {
+        cout << "configFile (-c) = " << configFile << endl;
+    }
+    if (outputFile != NULL)
+    {
+        cout << "outputFile (-o) = " << outputFile << endl;
+    }
+    if (inputFile != NULL)
+    {
+        cout << "inputFile (-i) = " << inputFile << endl;
+    }
+    if (lcioConfigFile != NULL)
+    {
+        cout << "lcioCollFile (-l) = " << lcioConfigFile << endl;
+    }
+    if (nrun > 0)
+    {
+        cout << "nrun (-r) = " << nrun << endl;
+    }
+    if (nskip > 0)
+    {
+        cout << "nskip (-s) = " << nskip << endl;
+    }
+    cout << endl;
+
+    // Error flag.
+    bool error = false;
+
+    // Create the job configuration from the command line arguments.
+    JobConfig* config = new JobConfig();
+
+    // Pandora config.
+    if (configFile != NULL)
+    {
+        config->setPandoraSettingsXmlFile(configFile);
+    }
+    else
+    {
+        cout << "Missing config file." << endl;
+        error = true;
+    }
+
+    // Geometry file.
+    if (geometryFile != NULL)
+    {
+        config->setGeometryFile(geometryFile);
+    }
+    else
+    {
+        cout << "Missing geometry file." << endl;
+        error = true;
+    }
+
+    // Input file.
+    if (inputFile != NULL)
+    {
+        config->addInputFile(inputFile);
+    }
+    else
+    {
+        cout << "Missing input file." << endl;
+        error = true;
+    }
+
+    // Output file.  Don't need to check for null because it has a default.
+    config->setOutputFile(outputFile);
+
+    // Skip events.
+    if (nskip != 0)
+    {
+        config->setSkipEvents(nskip);
+    }
+
+    // LCIO config file.
+    if (lcioConfigFile != NULL)
+    {
+        config->setLcioConfigFile(lcioConfigFile);
+    }
+
+    // Number of events to run.
+    config->setNumberOfEvents(nrun);
+
+    // Stop the job if command line arguments were not good.
+    if (error)
+    {
+        printUsage();
+        return 1;
+    }
+
+    // Make a new job manager.
+    JobManager* mgr = new JobManager();
+
+    // Set the JobManager's configuration.
+    mgr->setJobConfig(config);
+
+    // Add a processor to mark beginning of event processing.
+    mgr->addEventProcessor(new EventMarkerProcessor());
+
+    // Add a processor to convert LCIO MCParticles to Pandora MCParticle::Parameters.
+    mgr->addEventProcessor(new MCParticleProcessor());
+
+    // Add a processor to convert LCIO SimCalorimeterHits to LCIO CalorimeterHits.
+    mgr->addEventProcessor(new SimCalorimeterHitProcessor());
+
+    // Add a processor to convert LCIO CalorimeterHits to Pandora CaloHit::Parameters.
+    mgr->addEventProcessor(new CalorimeterHitProcessor());
+
+    // Add a processor to convert LCIO Tracks and their track states to Pandora Track Parameters.
+    mgr->addEventProcessor(new SimpleTrackProcessor());
+
+    // Add a processor to automatically run the registered Pandora algorithms.
+    mgr->addEventProcessor(new PandoraProcessor());
+
+    // Add a processor to create LCIO PFO objects, including clusters and ReconParticles.
+    mgr->addEventProcessor(new PfoProcessor());
+
+    // Add a processor to reset Pandora after the event.
+    mgr->addEventProcessor(new ResetPandoraProcessor());
+
+    // Run the job.
+    mgr->run();
+
+    // Return success.
+    return 0;
+}

slicPandora/tests
PandoraFrontendTest.cpp added at 1.1
diff -N PandoraFrontendTest.cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PandoraFrontendTest.cpp	19 Sep 2011 19:50:10 -0000	1.1
@@ -0,0 +1,13 @@
+// $Id: PandoraFrontendTest.cpp,v 1.1 2011/09/19 19:50:10 jeremy Exp $
+
+/**
+ * Test of PandoraFrontend, which is used as the default binary for slicPandora.
+ */
+#include "PandoraFrontend.h"
+
+// Run main.
+int main(int argc, char **argv)
+{
+    PandoraFrontend pandora;
+    return pandora.run(argc, argv);
+}

slicPandora/tests
PandoraFrontend.cpp removed after 1.8
diff -N PandoraFrontend.cpp
--- PandoraFrontend.cpp	19 Sep 2011 19:24:33 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,220 +0,0 @@
-//$Id: PandoraFrontend.cpp,v 1.8 2011/09/19 19:24:33 jeremy Exp $
-
-/**
- * This is a simple frontend to run slicPandora.
- */
-// FIXME: Turn the frontend into a class.
-
-// stl
-#include <iostream>
-#include <stdlib.h>
-
-// getopt
-#include <getopt.h>
-
-// slicPandora
-#include "JobManager.h"
-#include "DefaultProcessors.h"
-
-using std::cout;
-using std::endl;
-
-void printUsage()
-{
-    cout << "./bin/PandoraFrontend -g [geometry] -c [pandoraConfig] -i [inputEvents] -o [outputEvents] -l [lcioConfig] -r [nrun] -s [nskip]" << endl << endl;
-    cout << "    [-r] is optional.  Default is run over all input events." << endl;
-    cout << "    [-s] is optional.  Default is start at the first event." << endl;
-    cout << "    [-l] is optional.  Default is use subdetector's associated hit collections from geometry." << endl;
-    cout << "    [-o] is optional.  Default output file is called \"pandoraOutput.slcio\"." << endl;
-}
-
-int main(int argc, char **argv)
-{
-	// getopt flags.
-	int g;
-	opterr = 0;
-
-	// Variables for holding getopt values.
-	int nrun = -1;
-	int nskip = 0;
-	char *geometryFile = NULL;
-	char *configFile = NULL;
-	char *outputFile = "pandoraOutput.slcio";
-	char *lcioConfigFile = NULL;
-	char *inputFile = NULL;
-
-	// Process command line options.
-	while ((g = getopt(argc, argv, "g:c:i:r:s:l:o:")) != -1)
-	{
-		switch (g)
-		{
-			// Geometry file.
-			case 'g':
-				geometryFile = optarg;
-				break;
-		    // Pandora config file.
-			case 'c':
-				configFile = optarg;
-			    break;
-			// Output file path.
-            case 'o':
-            	outputFile = optarg;
-				break;
-		    // Input LCIO file.
-			case 'i':
-				inputFile = optarg;
-				break;
-			// LCIO XML collection config file.
-			case 'l':
-				lcioConfigFile = optarg;
-				break;
-		    // Number of events to run.
-			case 'r':
-				nrun = atoi(optarg);
-				break;
-			// Number of events to skip.
-			case 's':
-				nskip = atoi(optarg);
-				break;
-			// There are no valid non-switch arguments.
-			default:
-				printUsage();
-				return 1;
-		}
-	}
-
-	// Print arguments before we do anything with them.
-	cout << "slicPandora got these command line arguments..." << endl;
-	cout << endl;
-	if (geometryFile != NULL)
-	{
-	    cout << "geometryFile (-g) = " << geometryFile << endl;
-	}
-	if (configFile != NULL)
-	{
-	    cout << "configFile (-c) = " << configFile << endl;
-	}
-	if (outputFile != NULL)
-	{
-	    cout << "outputFile (-o) = " << outputFile << endl;
-	}
-	if (inputFile != NULL)
-	{
-	    cout << "inputFile (-i) = " << inputFile << endl;
-	}
-	if (lcioConfigFile != NULL)
-	{
-		cout << "lcioCollFile (-l) = " << lcioConfigFile << endl;
-	}
-	if (nrun > 0)
-	{
-		cout << "nrun (-r) = " << nrun << endl;
-	}
-	if (nskip > 0)
-	{
-		cout << "nskip (-s) = " << nskip << endl;
-	}
-	cout << endl;
-
-	// Error flag.
-	bool error = false;
-
-    // Create the job configuration from the command line arguments.
-    JobConfig* config = new JobConfig();
-
-    // Pandora config.
-    if (configFile != NULL)
-    {
-    	config->setPandoraSettingsXmlFile(configFile);
-    }
-    else
-    {
-    	cout << "Missing config file." << endl;
-    	error = true;
-    }
-
-    // Geometry file.
-    if (geometryFile != NULL)
-    {
-    	config->setGeometryFile(geometryFile);
-    }
-    else
-    {
-    	cout << "Missing geometry file." << endl;
-    	error = true;
-    }
-
-    // Input file.
-    if (inputFile != NULL)
-    {
-    	config->addInputFile(inputFile);
-    }
-    else
-    {
-    	cout << "Missing input file." << endl;
-    	error = true;
-    }
-
-    // Output file.  Don't need to check for null because it has a default.
-    config->setOutputFile(outputFile);
-
-    // Skip events.
-    if (nskip != 0)
-    {
-    	config->setSkipEvents(nskip);
-    }
-
-    // LCIO config file.
-    if (lcioConfigFile != NULL)
-    {
-    	config->setLcioConfigFile(lcioConfigFile);
-    }
-
-    // Number of events to run.
-    config->setNumberOfEvents(nrun);
-
-    // Stop the job if command line arguments were not good.
-    if (error)
-    {
-    	cout << "An error occurred while processing the command line options (see above).  slicPandora will exit now!" << endl;
-    	printUsage();
-    	return 1;
-    }
-
-    // Make a new job manager.
-    JobManager* mgr = new JobManager();
-
-    // Set the JobManager's configuration.
-    mgr->setJobConfig(config);
-
-    // Add a processor to mark beginning of event processing.
-    mgr->addEventProcessor(new EventMarkerProcessor());
-
-    // Add a processor to convert LCIO MCParticles to Pandora MCParticle::Parameters.
-    mgr->addEventProcessor(new MCParticleProcessor());
-
-    // Add a processor to convert LCIO SimCalorimeterHits to LCIO CalorimeterHits.
-    mgr->addEventProcessor(new SimCalorimeterHitProcessor());
-
-    // Add a processor to convert LCIO CalorimeterHits to Pandora CaloHit::Parameters.
-    mgr->addEventProcessor(new CalorimeterHitProcessor());
-
-    // Add a processor to convert LCIO Tracks and their track states to Pandora Track Parameters.
-    mgr->addEventProcessor(new SimpleTrackProcessor());
-
-    // Add a processor to automatically run the registered Pandora algorithms.
-    mgr->addEventProcessor(new PandoraProcessor());
-
-    // Add a processor to create LCIO PFO objects, including clusters and ReconParticles.
-    mgr->addEventProcessor(new PfoProcessor());
-
-    // Add a processor to reset Pandora after the event.
-    mgr->addEventProcessor(new ResetPandoraProcessor());
-
-    // Run the job.
-    std::cout << "running..." << std::endl;
-    mgr->run();
-
-    // Return success.
-    return 0;
-}
CVSspam 0.2.8