Print

Print


Commit in slicPandora on MAIN
include/JobConfig.h+14-21.6 -> 1.7
src/JobManager.cpp+2-21.14 -> 1.15
   /PandoraFrontend.cpp+16-31.1 -> 1.2
   /PfoProcessor.cpp+12-171.18 -> 1.19
   /SimCalorimeterHitProcessor.cpp+131.30 -> 1.31
+57-24
5 modified files
add option for replacing existing collections to rerun pandora output files (requested by Jan Strube)

slicPandora/include
JobConfig.h 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- JobConfig.h	16 Sep 2011 23:31:17 -0000	1.6
+++ JobConfig.h	31 Jan 2012 15:08:34 -0000	1.7
@@ -1,4 +1,4 @@
-// $Id: JobConfig.h,v 1.6 2011/09/16 23:31:17 jeremy Exp $
+// $Id: JobConfig.h,v 1.7 2012/01/31 15:08:34 jeremy Exp $
 #ifndef JOBCONFIG_H
 #define JOBCONFIG_H 1
 
@@ -26,7 +26,8 @@
     JobConfig()
         : nrun(-1),
           nskip(0),
-          m_useDefaultCaloTypes(true)
+          m_useDefaultCaloTypes(true),
+          m_deleteExistingCollections(false)
     {;}
 
     virtual ~JobConfig()
@@ -211,6 +212,16 @@
     	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;
@@ -221,6 +232,7 @@
     int nrun;
     int nskip;
     bool m_useDefaultCaloTypes;
+    bool m_deleteExistingCollections;
 };
 
 #endif

slicPandora/src
JobManager.cpp 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- JobManager.cpp	16 Sep 2011 23:31:18 -0000	1.14
+++ JobManager.cpp	31 Jan 2012 15:08:34 -0000	1.15
@@ -165,7 +165,7 @@
     int nread = 0;
 
     // Read first event.
-    LCEvent* event = reader->readNextEvent();
+    LCEvent* event = reader->readNextEvent(EVENT::LCIO::UPDATE);
 
     // Check for first event and bail if did not get one.
     if (0 == event)
@@ -187,7 +187,7 @@
         writer->writeEvent(event);
 
         // Read the next event.
-        event = reader->readNextEvent();
+        event = reader->readNextEvent(EVENT::LCIO::UPDATE);
  
         // End of input file.
         if (0 == event)

slicPandora/src
PandoraFrontend.cpp 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- PandoraFrontend.cpp	19 Sep 2011 19:50:10 -0000	1.1
+++ PandoraFrontend.cpp	31 Jan 2012 15:08:34 -0000	1.2
@@ -1,4 +1,4 @@
-// $Id: PandoraFrontend.cpp,v 1.1 2011/09/19 19:50:10 jeremy Exp $
+// $Id: PandoraFrontend.cpp,v 1.2 2012/01/31 15:08:34 jeremy Exp $
 #include "PandoraFrontend.h"
 
 // slicPandora
@@ -15,11 +15,12 @@
 {
     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 << "./bin/PandoraFrontend -g [geometry] -c [pandoraConfig] -i [inputEvents] -o [outputEvents] -l [lcioConfig] -r [nrun] -s [nskip] -f" << 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;
+    cout << "    [-f] is optional.  This flag will cause existing input collections that slicPandora creates to be replaced." << endl;
 }
 
 int PandoraFrontend::run(int argc, char **argv)
@@ -36,9 +37,10 @@
     char *outputFile = "pandoraOutput.slcio";
     char *lcioConfigFile = NULL;
     char *inputFile = NULL;
+    bool deleteExistingCollections = false;
 
     // Process command line options.
-    while ((g = getopt(argc, argv, "g:c:i:r:s:l:o:")) != -1)
+    while ((g = getopt(argc, argv, "g:c:i:r:s:l:o:f")) != -1)
     {
         switch (g)
         {
@@ -70,6 +72,10 @@
             case 's':
                 nskip = atoi(optarg);
                 break;
+            // Force input collections to be recreated.
+            case 'f':
+            	deleteExistingCollections = true;
+            	break;
             // There are no valid non-switch arguments.
             default:
                 printUsage();
@@ -108,6 +114,10 @@
     {
         cout << "nskip (-s) = " << nskip << endl;
     }
+    if (deleteExistingCollections)
+    {
+    	cout << "deleteExistingCollections (-f) = " << deleteExistingCollections << endl;
+    }
     cout << endl;
 
     // Error flag.
@@ -167,6 +177,9 @@
     // Number of events to run.
     config->setNumberOfEvents(nrun);
 
+    // Set delete existing collections.
+    config->setDeleteExistingCollections(deleteExistingCollections);
+
     // Stop the job if command line arguments were not good.
     if (error)
     {

slicPandora/src
PfoProcessor.cpp 1.18 -> 1.19
diff -u -r1.18 -r1.19
--- PfoProcessor.cpp	7 Sep 2011 22:40:07 -0000	1.18
+++ PfoProcessor.cpp	31 Jan 2012 15:08:34 -0000	1.19
@@ -1,4 +1,4 @@
-// $Id: PfoProcessor.cpp,v 1.18 2011/09/07 22:40:07 jeremy Exp $
+// $Id: PfoProcessor.cpp,v 1.19 2012/01/31 15:08:34 jeremy Exp $
 #include "PfoProcessor.h"
 
 // lcio
@@ -42,6 +42,9 @@
 
 void PfoProcessor::processEvent(EVENT::LCEvent* event)
 {    
+	// Set flag whether to delete existing collections.
+	bool deleteExistingCollections = getJobManager()->getJobConfig()->deleteExistingCollections();
+
     // Make a container for the clusters.
     LCCollectionVec* clusterVec = new LCCollectionVec(EVENT::LCIO::CLUSTER);
 
@@ -51,22 +54,6 @@
     clusterVec->setFlag(clusterFlag.getFlag());
 
     // Get Pandora's list of PFOs.
-    //pandora::ParticleFlowObjectList particleFlowObjectList;
-/*
-    pandora::PfoList particleFlowObjectList;
-    PANDORA_THROW_RESULT_IF_AND_IF(
-        pandora::STATUS_CODE_SUCCESS, 
-	pandora::STATUS_CODE_NOT_INITIALIZED, 
-        !=, 
-	PandoraApi::GetCurrentPfoList(),
-//GetParticleFlowObjects(getJobManager()->getPandora(),
-        particleFlowObjectList);
-#ifdef PFOPROCESSOR_DEBUG
-    std::cout << "Pandora found " << particleFlowObjectList.size() << " PFOs in event <" << event->getEventNumber() << ">." << std::endl;
-#endif
-*/
-    // Get current Pfo list.
-    //pandora::PfoList pfoList;
     const pandora::PfoList *pfoList = NULL;
     PandoraApi::GetCurrentPfoList(getJobManager()->getPandora(), pfoList);
 
@@ -222,8 +209,16 @@
     }
     
     // Add the list of clusters to the event.
+    if (deleteExistingCollections)
+    {
+    	event->removeCollection("ReconClusters");
+    }
     event->addCollection(clusterVec, "ReconClusters");
 
     // Add the list of ReconstructedParticles to the event.
+    if (deleteExistingCollections)
+    {
+    	event->removeCollection("PandoraPFOCollection");
+    }
     event->addCollection(pReconstructedParticleCollection, "PandoraPFOCollection");       
 }

slicPandora/src
SimCalorimeterHitProcessor.cpp 1.30 -> 1.31
diff -u -r1.30 -r1.31
--- SimCalorimeterHitProcessor.cpp	18 Jan 2012 21:36:34 -0000	1.30
+++ SimCalorimeterHitProcessor.cpp	31 Jan 2012 15:08:34 -0000	1.31
@@ -67,12 +67,21 @@
     flag |= 1 << EVENT::LCIO::RCHBIT_TIME;    // time
     LCFlagImpl chFlag(flag);
 
+    // Delete existing collections.
+    bool deleteExistingCollections = mgr->getJobConfig()->deleteExistingCollections();
+
     // Loop over CaloTypes.
     for (LcioInputCollectionSettings::CaloCollectionMap::const_iterator it = caloCollMap.begin(); it != caloCollMap.end(); it++)
     {
         // Get the CaloType string.
         const std::string& caloType = LcioInputCollectionSettings::getStringFromType(it->first);
 
+        // Delete an existing CalHit collection.
+        if (deleteExistingCollections)
+        {
+        	event->removeCollection(caloType);
+        }
+
         // Skip over unknown types of cal collections.
         if (caloType.compare("UNKNOWN") == 0)
         {
@@ -246,5 +255,9 @@
     }
 
     // Add the CalorimeterHit to SimCalorimeterHit relations.
+    if (deleteExistingCollections)
+    {
+    	event->removeCollection("CalorimeterHitRelations");
+    }
     event->addCollection(scRel, "CalorimeterHitRelations");
 }
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1