Commit in slic on MAIN
include/LcioManager.hh+9-31.54 -> 1.55
       /LcioMcpManager.hh+12-11.51 -> 1.52
       /LcioMcpMessenger.hh+2-11.8 -> 1.9
       /PhysicsListManager.hh+5-51.14 -> 1.15
src/LcioManager.cc+24-111.73 -> 1.74
   /LcioMcpManager.cc+14-91.65 -> 1.66
   /LcioMcpMessenger.cc+10-11.9 -> 1.10
+76-31
7 modified files
JM: https://jira.slac.stanford.edu/browse/SLIC-143

slic/include
LcioManager.hh 1.54 -> 1.55
diff -u -r1.54 -r1.55
--- LcioManager.hh	5 Sep 2006 23:21:44 -0000	1.54
+++ LcioManager.hh	8 Jan 2007 22:22:05 -0000	1.55
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioManager.hh,v 1.54 2006/09/05 23:21:44 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioManager.hh,v 1.55 2007/01/08 22:22:05 jeremy Exp $
 
 #ifndef SLIC_LCIOMANAGER_HH
 #define SLIC_LCIOMANAGER_HH 1
@@ -104,6 +104,12 @@
     // create Mcp coll
     void createFinalMcpCollection();
 
+    void addCollection( EVENT::LCEvent*, EVENT::LCCollection*, const std::string& );
+
+    void addCollection( EVENT::LCCollection*, const std::string& );
+    
+    void addInitialMCParticleCollection();
+
     // formerly writeEvent()
     void endEvent(const G4Event* anEvent);
 
@@ -134,7 +140,7 @@
 
       m_fileExistsAction = fea;
     }
-
+    
     EFileExistsAction getFileExistsAction()
     {
       return m_fileExistsAction;
@@ -236,7 +242,7 @@
     bool m_enableDumpEvent;
     bool m_writerIsOpen;
     bool m_usingAutoname;
-    bool m_abortCurrentRun;
+    bool m_abortCurrentRun;    
   };
 }
 

slic/include
LcioMcpManager.hh 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- LcioMcpManager.hh	15 Nov 2006 22:25:54 -0000	1.51
+++ LcioMcpManager.hh	8 Jan 2007 22:22:05 -0000	1.52
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpManager.hh,v 1.51 2006/11/15 22:25:54 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpManager.hh,v 1.52 2007/01/08 22:22:05 jeremy Exp $
 
 #ifndef SLIC_LCIOMCPMANAGER_HH
 #define SLIC_LCIOMCPMANAGER_HH 1
@@ -109,6 +109,16 @@
 
     double getNoChargeFlag() const;
 
+    inline void setWriteInitialMCParticleCollection(bool b)
+    {
+      m_writeInitialMCParticleCollection=b;
+    }
+    
+    inline bool writeInitialMCParticleCollection()
+    {
+      return m_writeInitialMCParticleCollection;
+    }
+
   private:
 
     // clear the maps
@@ -143,6 +153,7 @@
 
     bool m_enablePrintFinal;
     bool m_enablePrintInitial;
+    bool m_writeInitialMCParticleCollection;
 
   public:
     static const double m_NAN;

slic/include
LcioMcpMessenger.hh 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- LcioMcpMessenger.hh	5 Sep 2006 23:21:46 -0000	1.8
+++ LcioMcpMessenger.hh	8 Jan 2007 22:22:05 -0000	1.9
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpMessenger.hh,v 1.8 2006/09/05 23:21:46 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpMessenger.hh,v 1.9 2007/01/08 22:22:05 jeremy Exp $
 
 #ifndef SLIC_LCIOMCPMESSENGER_HH
 #define SLIC_LCIOMCPMESSENGER_HH 1
@@ -36,6 +36,7 @@
     G4UIcommand* m_verboseCmd;
     G4UIcmdWithABool* m_printFinalCollection;
     G4UIcmdWithABool* m_printInitialCollection;
+    G4UIcmdWithABool* m_writeInitialCollection;
   };
 }
 

slic/include
PhysicsListManager.hh 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- PhysicsListManager.hh	16 Dec 2006 00:06:20 -0000	1.14
+++ PhysicsListManager.hh	8 Jan 2007 22:22:05 -0000	1.15
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/PhysicsListManager.hh,v 1.14 2006/12/16 00:06:20 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/PhysicsListManager.hh,v 1.15 2007/01/08 22:22:05 jeremy Exp $
 
 #ifndef SLIC_PHYSICSLISTMANAGER_HH
 #define SLIC_PHYSICSLISTMANAGER_HH 1
@@ -45,22 +45,22 @@
 
     void setCurrentListName(const std::string& n);
 
-    const std::string& getCurrentListName()
+    inline const std::string& getCurrentListName()
     {
       return m_currentListName;
     }
 
-    bool isInitialized()
+    inline bool isInitialized()
     {
       return m_isInitialized;
     }
 
-    void enableLimits(bool l)
+    inline void enableLimits(bool l)
     {
       m_enableLimits = l;
     }
 
-    bool enableLimits()
+    inline bool enableLimits()
     {
       return m_enableLimits;
     }

slic/src
LcioManager.cc 1.73 -> 1.74
diff -u -r1.73 -r1.74
--- LcioManager.cc	12 Oct 2006 22:30:01 -0000	1.73
+++ LcioManager.cc	8 Jan 2007 22:22:05 -0000	1.74
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.73 2006/10/12 22:30:01 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.74 2007/01/08 22:22:05 jeremy Exp $
 #include "LcioManager.hh"
 
 // slic
@@ -108,14 +108,6 @@
     }
   }
 
-  // LcioManager* LcioManager::instance()
-//   {
-//     if ( m_instance == 0 ) {
-//       m_instance = new LcioManager();
-//     }
-//     return m_instance;
-//   }
-
   void LcioManager::openLcioFile()
   {
     // Get full output path with extension to check its existence.
@@ -143,7 +135,7 @@
 	  std::cout << "Deleted old LCIO file <" << fullFilename << ">" << std::endl;
 	}
       }
-      // Append mod is on.
+      // Append mode is on.
       else if ( m_fileExistsAction == eAppend ) {
 	std::cout << "Appending to existing LCIO file <" << fullFilename << ">" << std::endl;
 	writeMode = LCIO::WRITE_APPEND;
@@ -420,6 +412,11 @@
       // create mcp collection from input event
       createFinalMcpCollection();
 
+      // If selected, add the initial MCParticle collection to the event.
+      if ( LcioMcpManager::instance()->writeInitialMCParticleCollection() ) {
+	addInitialMCParticleCollection();
+      }
+
       // create HC in current LCEvent from current G4Event using builder
       createHitsCollections();
 
@@ -465,6 +462,22 @@
   void LcioManager::createFinalMcpCollection()
   {
     // add Mcp coll to current event
-    getCurrentLCEvent()->addCollection( m_mcpManager->getFinalMcpCollection(), "MCParticle" );
+    getCurrentLCEvent()->addCollection( m_mcpManager->getFinalMcpCollection(), LCIO::MCPARTICLE );
+  }
+
+  void LcioManager::addCollection( EVENT::LCEvent* event, EVENT::LCCollection* collection, const std::string& collectionName)
+  {
+    event->addCollection( collection, collectionName );
+  }
+
+  void LcioManager::addCollection( EVENT::LCCollection* collection, const std::string& collectionName )
+  {
+    getCurrentLCEvent()->addCollection( collection, collectionName );
+  }
+  
+  void LcioManager::addInitialMCParticleCollection()
+  {
+    const std::string& name = std::string("Initial") + std::string(LCIO::MCPARTICLE);
+    addCollection( LcioMcpManager::instance()->getInitialMcpCollection(), name );
   }
 }

slic/src
LcioMcpManager.cc 1.65 -> 1.66
diff -u -r1.65 -r1.66
--- LcioMcpManager.cc	15 Dec 2006 06:15:46 -0000	1.65
+++ LcioMcpManager.cc	8 Jan 2007 22:22:05 -0000	1.66
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpManager.cc,v 1.65 2006/12/15 06:15:46 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpManager.cc,v 1.66 2007/01/08 22:22:05 jeremy Exp $
 #include "LcioMcpManager.hh"
 
 // slic
@@ -47,7 +47,8 @@
     : Module("LcioMcpManager"),
       m_minimumTrackingDistance(DEFAULT_MIN_TRACKING_DISTANCE),
       m_enablePrintFinal(false),
-      m_enablePrintInitial(false)
+      m_enablePrintInitial(false),
+      m_writeInitialMCParticleCollection(false)
   {
     // create new Mcp messenger instance
     m_messenger = new LcioMcpMessenger();
@@ -159,17 +160,21 @@
       delete mcpVec;
     }
   }
-
-  /* Does not need to delete Mcp final collection, as it is deleted by the LCEvent's dtor. */
+  
   void LcioMcpManager::reset()
   {
-    deleteInitialMcpCollection();
-
-    /* Clear the map of MCParticle collections. */
+    // Initial MCParticle collection needs deletion if it wasn't added to the event.
+    if ( !writeInitialMCParticleCollection() ) {   
+      deleteInitialMcpCollection();
+    }
+    
+    // Clear the map of MCParticle collections.
     m_mcpColls.clear();
-
-    /* Clear the maps of MCParticle runtime data for this event. */
+    
+    // Clear the maps of MCParticle runtime data from this event.
     m_maps->clear();
+
+    // NOTE: The final MCParticle collection is deleted by the LCEvent destructor.
   }
 
   // verbosity

slic/src
LcioMcpMessenger.cc 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- LcioMcpMessenger.cc	9 Dec 2005 01:58:34 -0000	1.9
+++ LcioMcpMessenger.cc	8 Jan 2007 22:22:05 -0000	1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpMessenger.cc,v 1.9 2005/12/09 01:58:34 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpMessenger.cc,v 1.10 2007/01/08 22:22:05 jeremy Exp $
 #include "LcioMcpMessenger.hh"
 
 // slic
@@ -54,6 +54,10 @@
       // set Lcio Mcp generator's verbosity
       LcioManager::instance()->getGenerator()->setVerbose( v );
     }
+    // Enable writing of initial MCParticle collection to event.
+    else if ( cmd == m_writeInitialCollection ) {
+      mgr->setWriteInitialMCParticleCollection( m_writeInitialCollection->GetNewBoolValue(newVals.c_str() ) );
+    }
     else {
       G4Exception( "LcioMessenger::setNewValue() - unknown command" );
     }
@@ -94,5 +98,10 @@
     m_printFinalCollection->SetGuidance( "Enable printing of the final MCParticle collection during event processing." );
     m_printFinalCollection->SetParameterName("enable", true);
     m_printFinalCollection->SetDefaultValue(true);
+
+    m_writeInitialCollection = new G4UIcmdWithABool( "/mcp/writeInitialCollection", this );
+    m_writeInitialCollection->SetGuidance( "Write the initial MCParticle collection from StdHep conversion to the LCEvent." );
+    m_writeInitialCollection->SetParameterName( "enable", true );
+    m_writeInitialCollection->SetDefaultValue(false);
   }
 }
CVSspam 0.2.8