slic/include
diff -u -r1.38 -r1.39
--- G4Application.hh 20 Dec 2005 01:23:25 -0000 1.38
+++ G4Application.hh 10 Apr 2006 21:05:07 -0000 1.39
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.38 2005/12/20 01:23:25 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/G4Application.hh,v 1.39 2006/04/10 21:05:07 jeremy Exp $
#ifndef slic_G4Application_hh
#define slic_G4Application_hh 1
@@ -96,6 +96,16 @@
void setMode(ERunMode rmode);
+ const std::string& getBinaryName()
+ {
+ return m_binaryname;
+ }
+
+ const std::string& getBinaryBasename()
+ {
+ return m_binarybasename;
+ }
+
protected:
void setupFromCommandLine(int, char**);
@@ -109,6 +119,14 @@
private:
+ void setBinaryBasename()
+ {
+ std::string::size_type sidx = m_binaryname.find_last_of('/');
+ if (sidx != std::string::npos) {
+ m_binarybasename = std::string(m_binaryname, sidx + 1);
+ }
+ }
+
void setupUserActions();
void initializeUI();
@@ -117,8 +135,6 @@
void initializeVis();
#endif
-// void initializeRunManager();
-
protected:
// instance
@@ -152,6 +168,10 @@
/* Has the application been initialized yet? */
bool m_isInitialized;
+
+ // What was the name of the SLIC binary from CL? (used by LcioFileNamer)
+ std::string m_binaryname;
+ std::string m_binarybasename;
};
}
slic/src
diff -u -r1.64 -r1.65
--- G4Application.cc 23 Feb 2006 00:12:42 -0000 1.64
+++ G4Application.cc 10 Apr 2006 21:05:07 -0000 1.65
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.64 2006/02/23 00:12:42 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/G4Application.cc,v 1.65 2006/04/10 21:05:07 jeremy Exp $
#include "G4Application.hh"
// slic
@@ -136,6 +136,12 @@
void G4Application::setupFromCommandLine(int argc, char** argv)
{
/*
+ * Set the name and basename of slic's binary from the command line arguments.
+ */
+ m_binaryname = std::string(argv[0]);
+ setBinaryBasename();
+
+ /*
* Register the mappings of command line options to Geant4 commands
* with the CmdManager.
*/
slic/src
diff -u -r1.12 -r1.13
--- LcioFileNamer.cc 19 Oct 2005 22:51:16 -0000 1.12
+++ LcioFileNamer.cc 10 Apr 2006 21:05:07 -0000 1.13
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioFileNamer.cc,v 1.12 2005/10/19 22:51:16 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioFileNamer.cc,v 1.13 2006/04/10 21:05:07 jeremy Exp $
#include "LcioFileNamer.hh"
// lcdd
@@ -57,6 +57,9 @@
else if ( field == "run" || field == "runNumber" || field == "runNum" ) {
value = LcioFileNamer::makeRunNumberString();
}
+ else if ( field == "binary" ) {
+ value = G4Application::instance()->getBinaryBasename();
+ }
else {
cerr << "WARNING: Ignoring unknown field <" << field << ">" << endl;
value = "";