1 added + 83 modified, total 84 files
slic
diff -u -r1.22 -r1.23
--- slic.cc 27 Nov 2012 19:32:17 -0000 1.22
+++ slic.cc 6 Nov 2013 00:23:35 -0000 1.23
@@ -1,20 +1,35 @@
-// $Header: /cvs/lcd/slic/slic.cc,v 1.22 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/slic.cc,v 1.23 2013/11/06 00:23:35 jeremy Exp $
/**
- @mainpage
-
- The SLIC simulator is a Geant4 package that uses LCDD as its geometry input.
-
- Any questions can be directed to <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
- or posted in the <a href="http://forum.linearcollider.org/index.php?t=threadt&frm_id=7&rid=0&S=012b8714798313e7abf7c4d092eb9d0a">Full Simulations Area</a>
- of the <a href="http://forum.linearcollider.org/">LinearCollider.org Forum</a>.
-*/
-
-// slic
+ * @mainpage
+ *
+ * The SLIC simulator is a Geant4 package that uses LCDD as its geometry input.
+ *
+ * To see the available command line options, execute the following from the shell:
+ * @verbatim
+ * slic --help
+ * @endverbatim
+ *
+ * To print the version of the application, execute the following:
+ * @verbatim
+ * slic --version
+ * @endverbatim
+ *
+ * The primary source of documentation for SLIC is its
+ * <a href="https://confluence.slac.stanford.edu/display/ilc/SLIC">Confluence Wiki page</a>.
+ *
+ * Any questions can be directed to <a href="mailto:[log in to unmask]">Jeremy McCormick</a>
+ * or posted in the <a href="http://forum.linearcollider.org/index.php?t=threadt&frm_id=7&rid=0&S=012b8714798313e7abf7c4d092eb9d0a">Full Simulations Area</a>
+ * of the <a href="http://forum.linearcollider.org/">LinearCollider.org Forum</a>.
+ */
+// SLIC
#include "SlicMain.hh"
using namespace slic;
+/**
+ * The main function for the application, which delegates to a class.
+ */
int main(int argc, char** argv) {
return (new SlicMain())->main(argc, argv);
}
slic/config/doxygen
diff -u -r1.5 -r1.6
--- slic_doxygen.cfg.in 24 Oct 2011 21:55:52 -0000 1.5
+++ slic_doxygen.cfg.in 6 Nov 2013 00:23:35 -0000 1.6
@@ -25,20 +25,20 @@
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = "@PACKAGE_NAME@"
+PROJECT_NAME = "@PROJECT_NAME@"
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = @PACKAGE_VERSION@
+PROJECT_NUMBER = @SLIC_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
-OUTPUT_DIRECTORY = doc
+OUTPUT_DIRECTORY = @PROJECT_SOURCE_DIR@/doc
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@@ -574,7 +574,7 @@
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = . src/ include/
+INPUT = ./slic.cc @PROJECT_SOURCE_DIR@/src/ @PROJECT_SOURCE_DIR@/include/
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
slic/include
diff -u -r1.2 -r1.3
--- CommandLineOption.hh 27 Nov 2012 19:32:17 -0000 1.2
+++ CommandLineOption.hh 6 Nov 2013 00:23:35 -0000 1.3
@@ -1,9 +1,9 @@
-// $Header: /cvs/lcd/slic/include/CommandLineOption.hh,v 1.2 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/CommandLineOption.hh,v 1.3 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_COMMANDLINEOPTION_HH
#define SLIC_COMMANDLINEOPTION_HH
-// stl
+// STL
#include <map>
#include <vector>
#include <string>
@@ -12,91 +12,99 @@
/**
* @author Jeremy McCormick <[log in to unmask]>
- *
* @class CommandLineOption
- *
* @brief Command-line option with a single letter, full name and description
* plus an associated Geant4 command (which is optional).
- *
*/
class CommandLineOption {
public:
- /**
- * The fully qualified constructor for CommandLineOption.
- * (There are no setters for this class.)
- */
- CommandLineOption(const std::string& shortname, const std::string& longname,
- const std::string& description, unsigned int min_args = 0, unsigned int max_args = 0,
- const std::string& g4cmdstr = "") :
- m_shortname(shortname), m_longname(longname), m_description(description), m_g4cmdstr(g4cmdstr), m_minArgs(
- min_args), m_maxArgs(max_args) {
- ;
- }
-
- virtual ~CommandLineOption() {
- ;
- }
+ /**
+ * The fully qualified constructor for CommandLineOption.
+ * @param[in] shortname The single letter command switch.
+ * @param[in] longname The longer name of the command.
+ * @param[in] minArgs The minimum number of arguments.
+ * @param[in] maxArgs The maximum number of arguments.
+ * @param[in] macroCommand The corresponding Geant4 macro string.
+ */
+ CommandLineOption(const std::string& shortname, const std::string& longname, const std::string& description, unsigned int minArgs = 0,
+ unsigned int maxArgs = 0, const std::string& macroCommand = "") :
+ m_shortname(shortname), m_longname(longname), m_description(description), m_g4cmdstr(macroCommand), m_minArgs(minArgs), m_maxArgs(maxArgs) {
+ ;
+ }
+
+ /**
+ * Class destructor.
+ */
+ virtual ~CommandLineOption() {
+ ;
+ }
public:
- /**
- * Get the short name associated with this option.
- * This must be a single letter, such as 'm'.
- */
- const std::string& getShortName() const {
- return m_shortname;
- }
-
- /**
- * Get the long name associated with this option.
- * This must be one or more words separated by dashes,
- * such as "lcio-path".
- */
- const std::string& getLongName() const {
- return m_longname;
- }
-
- /**
- * Get a brief description of this option.
- */
- const std::string& getDescription() const {
- return m_description;
- }
-
- /**
- * Get the Geant4 command associated with this option.
- * This may be a null string if there is no associated
- * Geant4 command, though currently all of SLIC's options
- * have a corresponding Geant4 macro command.
- */
- const std::string& getG4CommandString() const {
- return m_g4cmdstr;
- }
-
- /**
- * Get the minimum number of arguments to this option.
- */
- unsigned int getMinArgs() const {
- return m_minArgs;
- }
-
- /**
- * Get the maximum number of arguments to this option.
- */
- unsigned int getMaxArgs() const {
- return m_maxArgs;
- }
+ /**
+ * Get the short name associated with this option.
+ * This must be a single letter, such as 'm'.
+ * @return The single letter command switch.
+ */
+ const std::string& getShortName() const {
+ return m_shortname;
+ }
+
+ /**
+ * Get the long name associated with this option.
+ * This must be one or more words separated by dashes,
+ * such as "lcio-path".
+ * @return The long name of the command.
+ */
+ const std::string& getLongName() const {
+ return m_longname;
+ }
+
+ /**
+ * Get a brief description of this option.
+ * @return A description of the option.
+ */
+ const std::string& getDescription() const {
+ return m_description;
+ }
+
+ /**
+ * Get the Geant4 command associated with this option.
+ * This may be a null string if there is no associated
+ * Geant4 command, though currently all of SLIC's options
+ * have a corresponding macro.
+ * @return The Geant4 command string for the option.
+ */
+ const std::string& getG4CommandString() const {
+ return m_g4cmdstr;
+ }
+
+ /**
+ * Get the minimum number of arguments to this option.
+ * @return The minimum number of arguments.
+ */
+ unsigned int getMinArgs() const {
+ return m_minArgs;
+ }
+
+ /**
+ * Get the maximum number of arguments to this option.
+ * @return The maximum number of arguments.
+ */
+ unsigned int getMaxArgs() const {
+ return m_maxArgs;
+ }
private:
- std::string m_shortname;
- std::string m_longname;
- std::string m_description;
- std::string m_g4cmdstr;
- int m_minArgs;
- int m_maxArgs;
+ std::string m_shortname;
+ std::string m_longname;
+ std::string m_description;
+ std::string m_g4cmdstr;
+ int m_minArgs;
+ int m_maxArgs;
};
}
slic/include
diff -u -r1.9 -r1.10
--- CommandLineProcessor.hh 27 Nov 2012 19:32:17 -0000 1.9
+++ CommandLineProcessor.hh 6 Nov 2013 00:23:35 -0000 1.10
@@ -2,12 +2,12 @@
#ifndef SLIC_COMMANDLINEPROCESSOR_HH
#define SLIC_COMMANDLINEPROCESSOR_HH
-// stl
+// STL
#include <string>
#include <map>
#include <vector>
-// slic
+// SLIC
#include "CommandLineOption.hh"
#include "CommandQueue.hh"
#include "Geant4VersionInfo.hh"
@@ -16,11 +16,10 @@
#include "Singleton.hh"
namespace slic {
+
/**
* @author Jeremy McCormick
- *
- * @brief Command line processor for SLIC using getopt.
- *
+ * @brief Command line processor for SLIC that uses getopt.
* @note All options are mapped in a straightforward fashion
* to Geant4 macro commands that may be defined
* within LCDD, SLIC, or Geant4 itself. The result
@@ -32,140 +31,157 @@
public:
- /**
- * OptionsPair is a short option name and its associated arguments.
- */
- typedef std::pair<std::string, std::string> OptionsPair;
-
- /**
- * CommandLineArguments is the list of options and arguments from the command line.
- */
- typedef std::vector<CommandLineProcessor::OptionsPair> CommandLineArguments;
-
- /**
- * OptionsList is a list of CommandLineOption classes describing valid command line switches.
- */
- typedef std::vector<CommandLineOption*> OptionsList;
+ /**
+ * OptionsPair is a short option name and its associated arguments.
+ */
+ typedef std::pair<std::string, std::string> OptionsPair;
+
+ /**
+ * CommandLineArguments is the list of options and arguments from the command line.
+ */
+ typedef std::vector<CommandLineProcessor::OptionsPair> CommandLineArguments;
+
+ /**
+ * OptionsList is a list of CommandLineOption classes describing valid command line switches.
+ */
+ typedef std::vector<CommandLineOption*> OptionsList;
public:
- virtual ~CommandLineProcessor();
- CommandLineProcessor();
+
+ /**
+ * Class constructor.
+ */
+ CommandLineProcessor();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~CommandLineProcessor();
public:
- /**
- * This is the primary function to process the raw arguments.
- * Options that will cause an abort, e.g. '-h', '-v', and '-n',
- * are handled explicitly so that the correct flag is set.
- * Other arguments are handled generically and put into the
- * CommandLineArguments vector, which associates a short
- * option name with its arguments (if any). Options that can
- * occur more than once, such as the '-m' command, get one entry
- * per occurrence in the CommandLineArguments. getopt will
- * check that the option is valid and that enough arguments
- * were received, before the command is put into CommandLineArguments.
- * After calling process(), the getCommandQueue() function can
- * be used to retrieve the list of Geant4 macro commands that
- * resulted from processing the raw command line arguments.
- */
- void process(int argc, char** argv);
-
- /**
- * Print out the options table.
- */
- void printOptions();
-
- /**
- * Print the version information.
- */
- void printVersion() {
- log() << LOG::okay << PackageInfo::getFullApplicationString() << LOG::done;
- log() << LOG::okay << "Geant4 " << Geant4VersionInfo::getFullVersion() << LOG::done;
- }
-
- /**
- * Get the queue of Geant4 macro commands created from
- * the command line arguments.
- */
- CommandQueue* getCommandQueue() {
- return &m_g4q;
- }
-
- /**
- * Print the usage statement.
- */
- void printUsage();
+ /**
+ * This is the primary function to process the raw arguments.
+ * Options that will cause an abort, e.g. '-h', '-v', and '-n',
+ * are handled explicitly so that the correct flag is set.
+ * Other arguments are handled generically and put into the
+ * CommandLineArguments vector, which associates a short
+ * option name with its arguments (if any). Options that can
+ * occur more than once, such as the '-m' command, get one entry
+ * per occurrence in the CommandLineArguments. getopt will
+ * check that the option is valid and that enough arguments
+ * were received, before the command is put into CommandLineArguments.
+ * After calling process(), the getCommandQueue() function can
+ * be used to retrieve the list of Geant4 macro commands that
+ * resulted from processing the raw command line arguments.
+ * @param[in] argc The argument count.
+ * @param[in] argv The argument values.
+ */
+ void process(int argc, char** argv);
+
+ /**
+ * Print out the options table.
+ */
+ void printOptions();
+
+ /**
+ * Print the version information.
+ */
+ void printVersion() {
+ log() << LOG::okay << PackageInfo::getFullApplicationString() << LOG::done;
+ log() << LOG::okay << "Geant4 " << Geant4VersionInfo::getFullVersion() << LOG::done;
+ }
+
+ /**
+ * Get the queue of Geant4 macro commands created from
+ * the command line arguments.
+ * @return The queue of Geant4 macro commands to execute.
+ */
+ CommandQueue* getCommandQueue() {
+ return &m_g4q;
+ }
+
+ /**
+ * Print the usage statement.
+ */
+ void printUsage();
private:
- /**
- * Process all the command line arguments in correct
- * order to create the queue of Geant4 commands.
- */
- void processOptions();
-
- /**
- * Abort the application before Geant4 starts,
- * e.g. if usage or version are selected.
- * This is not called if the command line arguments
- * are invalid, as getopt will handle this and
- * call exit() itself.
- */
- inline void abort();
-
- /**
- * Process a command line switch by adding
- * the corresponding Geant4 macro command to
- * the CommandQueue.
- */
- inline void processOption(const std::string&);
-
- /**
- * Add a command line option describing a
- * command line switch, its full name,
- * description, geant4 command, etc.
- */
- inline void addOption(CommandLineOption*);
-
- /**
- * Find an option specification by its single letter designation (with no '-').
- */
- inline CommandLineOption* getCommandLineOption(const std::string& opt);
-
- /**
- * Automatically create the getopt options string from OptionsList
- * and set the m_getoptOptions variable to this value.
- */
- inline void createOptionsString();
-
- /**
- * Register the list of valid command line options.
- */
- inline void registerOptions();
-
- /**
- * Returns true if the option was found in the command line arguments.
- */
- inline bool hasOption(const std::string& opt);
+ /**
+ * Process all the command line arguments in correct
+ * order to create the queue of Geant4 commands.
+ */
+ void processOptions();
+
+ /**
+ * Abort the application before Geant4 starts,
+ * e.g. if usage or version are selected.
+ * This is not called if the command line arguments
+ * are invalid, as getopt will handle this and
+ * call exit() itself.
+ */
+ void abort();
+
+ /**
+ * Process a command line switch by adding
+ * the corresponding Geant4 macro command to
+ * the CommandQueue.
+ * @param[in] option The option to process.
+ */
+ void processOption(const std::string& option);
+
+ /**
+ * Add a command line option describing a
+ * command line switch, its full name,
+ * description, geant4 command, etc.
+ * @param[in] option The command line option to add.
+ */
+ void addOption(CommandLineOption* option);
+
+ /**
+ * Find an option specification by its single letter designation (with no '-').
+ * @param[in] option The option to find.
+ * @return The command line option object or null if does not exist.
+ */
+ CommandLineOption* getCommandLineOption(const std::string& option);
+
+ /**
+ * Automatically create the getopt options string from OptionsList
+ * and set the m_getoptOptions variable to this value.
+ */
+ void createOptionsString();
+
+ /**
+ * Register the list of valid command line options.
+ */
+ void registerOptions();
+
+ /**
+ * Returns true if the option was found in the command line arguments.
+ * @param[in] option The command line option.
+ * @return True if option exist; false if not.
+ */
+ bool hasOption(const std::string& option);
private:
- // A vector of options with their arguments.
- CommandLineArguments m_commandline;
+ // A vector of options with their arguments.
+ CommandLineArguments m_commandline;
- // A list of Geant4 macro commands filled by processing the command line arguments.
- CommandQueue m_g4q;
+ // A list of Geant4 macro commands filled by processing the command line arguments.
+ CommandQueue m_g4q;
- // The list of valid options and their associated meta-data.
- OptionsList m_cmds;
+ // The list of valid options and their associated meta-data.
+ OptionsList m_cmds;
- // Flags to be set by the process function.
- int m_help_flag;
- int m_interactive_flag;
- int m_version_flag;
+ // Flags to be set by the process function.
+ int m_help_flag;
+ int m_interactive_flag;
+ int m_version_flag;
- // The getopt options string, which is created automatically.
- std::string m_getoptOptions;
+ // The getopt options string, which is created automatically.
+ std::string m_getoptOptions;
};
}
slic/include
diff -u -r1.3 -r1.4
--- CommandQueue.hh 27 Nov 2012 19:32:17 -0000 1.3
+++ CommandQueue.hh 6 Nov 2013 00:23:35 -0000 1.4
@@ -1,89 +1,102 @@
-// $Header: /cvs/lcd/slic/include/CommandQueue.hh,v 1.3 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/CommandQueue.hh,v 1.4 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_COMMANDQUEUE_HH
#define SLIC_COMMANDQUEUE_HH
-// slic
+// SLIC
#include "Module.hh"
-// std
+// STL
#include <vector>
#include <string>
namespace slic {
+
/**
* @class CommandQueue
* @brief A queue of G4 commands to be executed in order.
- * @note Created by CommandLineProcessor from the command line arguments.
+ * @note Created by CommandLineProcessor from the command line arguments.
*/
class CommandQueue: public Module {
public:
- typedef std::vector<std::string> CmdVecType;
- typedef std::string CmdType;
- typedef size_t SizeType;
+ typedef std::vector<std::string> CommandVectorType;
+ typedef std::string CommandType;
+ typedef size_t SizeType;
public:
- CommandQueue() :
- Module("CommandQueue") {
- }
-
- virtual ~CommandQueue() {
- }
-
- /**
- * Add a command to the queue.
- */
- void add(const CmdType& g4cmd) {
- m_commands.push_back(g4cmd);
- }
-
- /**
- * Add a command using char* type.
- */
- void add(const char* g4cmd) {
- std::string cmdStr = g4cmd;
- add(std::string(cmdStr));
- }
-
- /**
- * Get the begin iterator of the queue.
- */
- CmdVecType::iterator cmdsBegin() {
- return m_commands.begin();
- }
-
- /**
- * Get the end iterator of the queue.
- */
- CmdVecType::iterator cmdsEnd() {
- return m_commands.end();
- }
-
- /**
- * Print the queue to the log.
- */
- void printOut();
-
- /**
- * Execute the commands in the queue sequentially.
- */
- void execute();
-
- /**
- * Clear all the commands in the queue.
- */
- void clear() {
- m_commands.clear();
- }
-
- /**
- * Find the first command that matches a string.
- */
- CmdVecType::iterator find(const std::string& str);
+ /**
+ * Class constructor.
+ */
+ CommandQueue() :
+ Module("CommandQueue") {
+ }
+
+ /**
+ * Class destructor.
+ */
+ virtual ~CommandQueue() {
+ }
+
+ /**
+ * Add a command to the queue.
+ * @param[in] command The Geant4 command to add to the queue.
+ */
+ void add(const CommandType& command) {
+ m_commands.push_back(command);
+ }
+
+ /**
+ * Add a command to the queue.
+ * @param[in] command The Geant4 command to add to the queue.
+ */
+ void add(const char* command) {
+ std::string cmdStr = command;
+ add(std::string(cmdStr));
+ }
+
+ /**
+ * Get the begin iterator of the queue.
+ * @return An iterator pointing to the beginning of the command queue.
+ */
+ CommandVectorType::iterator cmdsBegin() {
+ return m_commands.begin();
+ }
+
+ /**
+ * Get the end iterator of the queue.
+ * @return An iterator pointing to the end of the command queue.
+ */
+ CommandVectorType::iterator cmdsEnd() {
+ return m_commands.end();
+ }
+
+ /**
+ * Print the queue to the log.
+ */
+ void printOut();
+
+ /**
+ * Execute the commands in the queue sequentially.
+ */
+ void execute();
+
+ /**
+ * Clear all the commands in the queue.
+ */
+ void clear() {
+ m_commands.clear();
+ }
+
+ /**
+ * Find the first command that matches a string.
+ * @param[in] command The macro command to find.
+ * @return An iterator pointing to the command or end iterator if not found.
+ */
+ CommandVectorType::iterator find(const std::string& command);
private:
- CmdVecType m_commands;
+ CommandVectorType m_commands;
};
}
slic/include
diff -u -r1.13 -r1.14
--- EventAction.hh 1 Jul 2013 21:01:30 -0000 1.13
+++ EventAction.hh 6 Nov 2013 00:23:35 -0000 1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/EventAction.hh,v 1.13 2013/07/01 21:01:30 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventAction.hh,v 1.14 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTACTION_HH
#define SLIC_EVENTACTION_HH 1
@@ -19,37 +19,74 @@
namespace slic {
/**
+ * @class EventAction
* @brief Implementation of G4UserEventAction.
* @note Calls actions of TrajectoryManager and LcioManager.
*/
class EventAction: public G4UserEventAction, public Module {
+
public:
- EventAction();
- ~EventAction();
+
+ /**
+ * Class constructor.
+ */
+ EventAction();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~EventAction();
public:
- // virtuals from G4
- virtual void BeginOfEventAction(const G4Event *anEvent);
- virtual void EndOfEventAction(const G4Event *anEvent);
-
- static EventAction* getEventAction();
-
- // event timing
- void enableEventTimer(bool et = true);
- void startEventTimer();
- void stopEventTimer();
+ /**
+ * Callback for the beginning of a Geant4 event.
+ * @param[in] anEvent The Geant4 event.
+ */
+ void BeginOfEventAction(const G4Event *anEvent);
+
+ /**
+ * Callback for the end of a Geant4 event.
+ * @param[in] anEvent The Geant4 event.
+ */
+ virtual void EndOfEventAction(const G4Event *anEvent);
+
+ /**
+ * Get the singleton instance of this class.
+ * @return The EventAction object.
+ */
+ static EventAction* getEventAction();
+
+ /**
+ * Enable or disable the event processing timer.
+ * @param[in] et The event timer setting; true to turn on.
+ */
+ void enableEventTimer(bool et = true);
+
+ /**
+ * Start the event timer.
+ */
+ void startEventTimer();
+
+ /**
+ * Stop the event timer.
+ */
+ void stopEventTimer();
private:
- void printEndEventMessage(const G4Event *anEvent);
+ /**
+ * Print the end of event message.
+ * @param[in] anEvent The Geant4 event.
+ */
+ void printEndEventMessage(const G4Event *anEvent);
private:
- bool m_enableEventTimer;
- mutable G4Timer m_eventTimer;
+ bool m_enableEventTimer;
+ mutable G4Timer m_eventTimer;
- G4UImessenger* m_messenger;
+ G4UImessenger* m_messenger;
};
}
slic/include
diff -u -r1.6 -r1.7
--- EventDebugger.hh 27 Nov 2012 19:32:17 -0000 1.6
+++ EventDebugger.hh 6 Nov 2013 00:23:35 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/EventDebugger.hh,v 1.6 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventDebugger.hh,v 1.7 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTDEBUGGER_HH
#define SLIC_EVENTDEBUGGER_HH 1
@@ -27,51 +27,102 @@
class EventDebugger: public Module, public Singleton<EventDebugger> {
public:
- typedef std::vector<G4int> DebugEventList;
+ typedef std::vector<G4int> DebugEventList;
public:
- virtual ~EventDebugger();
- //static EventDebugger* instance();
- //protected:
- EventDebugger();
+ /**
+ * Class constructor.
+ */
+ EventDebugger();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~EventDebugger();
public:
- void enableDebug(bool e = true);
-
- void addDebugEvent(G4int eventNum);
- void clearDebugEvents();
- bool haveDebugEvent(G4int) const;
-
- void setDebugMacro(std::string);
- void setCleanupMacro(std::string);
-
- void beginRun(const G4Run*);
- void beginEvent(const G4Event*);
- void endEvent(const G4Event*);
+ /**
+ * Turn event debugging on or off.
+ * @param[in] e The event debugging setting.
+ */
+ void enableDebug(bool e = true);
+
+ /**
+ * Add an event number that should be debugged.
+ * @param[in] eventNumber The event number to debug.
+ */
+ void addDebugEvent(G4int eventNumber);
+
+ /**
+ * Clear the event number list.
+ */
+ void clearDebugEvents();
+
+ /**
+ * Check if a given event should be debugged.
+ * @param[in] eventNumber True if event should be debugged; false if not.
+ */
+ bool haveDebugEvent(G4int eventNumber) const;
+
+ /**
+ * Set a Geant4 macro to be executed on debug events.
+ * @param[in] macro The Geant4 macro string to be executed on debug events.
+ */
+ void setDebugMacro(std::string macro);
+
+ /**
+ * Set the macro for cleaning up after debugging an event.
+ * @param[in] macro The Geant4 macro string to be executed on debug events.
+ */
+ void setCleanupMacro(std::string macro);
+
+ /**
+ * Begin of run hook.
+ * @param[in] run The Geant4 run.
+ */
+ void beginRun(const G4Run* run);
+
+ /**
+ * Begin of event hook.
+ * @param[in] event The Geant4 event.
+ */
+ void beginEvent(const G4Event* event);
+
+ /**
+ * End of event hook.
+ * @param[in] event The Geant4 event.
+ */
+ void endEvent(const G4Event* event);
private:
- void sortDebugEvents();
-
- void execDebugMacro();
- void execCleanupMacro();
+ /**
+ * Sort the event number list in ascending order.
+ */
+ void sortDebugEvents();
+
+ /**
+ * Execute the debug macro.
+ */
+ void execDebugMacro();
+
+ /**
+ * Execute the cleanup macro.
+ */
+ void execCleanupMacro();
private:
- //static EventDebugger* m_instance;
-
- EventDebuggerMessenger* m_messenger;
-
- std::string m_debugMacro;
- std::string m_cleanupMacro;
-
- DebugEventList m_events;
- bool m_debugging;
- bool m_haveDebugMacro;
- bool m_haveCleanupMacro;
- bool m_forceDebugMode;
+ EventDebuggerMessenger* m_messenger;
+ std::string m_debugMacro;
+ std::string m_cleanupMacro;
+ DebugEventList m_events;
+ bool m_debugging;
+ bool m_haveDebugMacro;
+ bool m_haveCleanupMacro;
+ bool m_forceDebugMode;
};
}
slic/include
diff -u -r1.5 -r1.6
--- EventDebuggerMessenger.hh 27 Nov 2012 19:32:17 -0000 1.5
+++ EventDebuggerMessenger.hh 6 Nov 2013 00:23:35 -0000 1.6
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/EventDebuggerMessenger.hh,v 1.5 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventDebuggerMessenger.hh,v 1.6 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTDEBUGGERMESSENGER_HH
#define SLIC_EVENTDEBUGGERMESSENGER_HH 1
@@ -12,28 +12,48 @@
class G4UIcmdWithABool;
namespace slic {
+
/**
* @class EventDebuggerMessenger
- * @brief G4UImessenger for the EventDebugger
+ * @brief G4UImessenger for the EventDebugger.
*/
class EventDebuggerMessenger: public G4UImessenger {
+
public:
- EventDebuggerMessenger();
- virtual ~EventDebuggerMessenger();
+
+ /**
+ * Class constructor.
+ */
+ EventDebuggerMessenger();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~EventDebuggerMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ /**
+ * Process the macro command.
+ * @param[in] cmd The macro command.
+ * @param[in] newVals The command arguments.
+ */
+ void SetNewValue(G4UIcommand* cmd, G4String newVals);
private:
- void defineCommands();
+
+ /**
+ * Define the Geant4 macro commands.
+ */
+ void defineCommands();
private:
- G4UIdirectory* m_debugDir;
- G4UIcmdWithAString* m_debugMacroCmd;
- G4UIcmdWithAString* m_cleanupMacroCmd;
- G4UIcommand* m_clearDebugEventsCmd;
- G4UIcmdWithABool* m_enableDebugCmd;
- G4UIcommand* m_addDebugEventsCmd;
+ G4UIdirectory* m_debugDir;
+ G4UIcmdWithAString* m_debugMacroCmd;
+ G4UIcmdWithAString* m_cleanupMacroCmd;
+ G4UIcommand* m_clearDebugEventsCmd;
+ G4UIcmdWithABool* m_enableDebugCmd;
+ G4UIcommand* m_addDebugEventsCmd;
};
}
slic/include
diff -u -r1.7 -r1.8
--- EventMessenger.hh 27 Nov 2012 19:32:17 -0000 1.7
+++ EventMessenger.hh 6 Nov 2013 00:23:35 -0000 1.8
@@ -1,31 +1,50 @@
-// $Header: /cvs/lcd/slic/include/EventMessenger.hh,v 1.7 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventMessenger.hh,v 1.8 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTMESSENGER_HH
#define SLIC_EVENTMESSENGER_HH 1
-// geant4
+// Geant4
#include "G4UImessenger.hh"
class G4UIcmdWithABool;
namespace slic {
+
/**
* @class EventMessenger
* @brief Messenger for event-related commands.
*/
class EventMessenger: public G4UImessenger {
public:
- EventMessenger();
- virtual ~EventMessenger();
+
+ /**
+ * Class constructor.
+ */
+ EventMessenger();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~EventMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ /**
+ * Process the macro command.
+ * @param[in] command The macro command.
+ * @param[in] newValues The argument values.
+ */
+ void SetNewValue(G4UIcommand* command, G4String newValues);
private:
- void defineCommands();
+
+ /**
+ * Define the commands that this messenger with handle.
+ */
+ void defineCommands();
private:
- G4UIcmdWithABool* m_eventTimerCmd;
+ G4UIcmdWithABool* m_eventTimerCmd;
};
}
slic/include
diff -u -r1.10 -r1.11
--- EventSource.hh 27 Nov 2012 19:32:17 -0000 1.10
+++ EventSource.hh 6 Nov 2013 00:23:35 -0000 1.11
@@ -1,46 +1,91 @@
-// $Header: /cvs/lcd/slic/include/EventSource.hh,v 1.10 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventSource.hh,v 1.11 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTSOURCE_HH
#define SLIC_EVENTSOURCE_HH 1
-// slic
+// SLIC
#include "Module.hh"
-// geant4
+// Geant4
#include "G4VPrimaryGenerator.hh"
class G4Event;
class G4Run;
namespace slic {
+
/**
* @class EventSource
- * @brief The base class for a physics event source such as a StdHep file source.
+ * @brief The virtual base class for a physics event source such as a StdHep file.
*/
class EventSource: public Module {
-public:
+protected:
- virtual ~EventSource();
+ /**
+ * Class constructor.
+ */
+ EventSource(const std::string& name);
-protected:
- EventSource(const std::string& name);
+public:
+
+ /**
+ * Class destructor.
+ */
+ virtual ~EventSource();
public:
- virtual void generate(G4Event* evt) = 0;
- virtual void dumpCurrentEvent() = 0;
- virtual void reset();
- virtual unsigned int skipEvents(unsigned int);
- virtual void beginEvent(const G4Event*);
- virtual void endEvent(const G4Event*);
- virtual void beginRun(const G4Run*);
- virtual void endRun(const G4Run*);
+ /**
+ * Generate an event.
+ * @param[in] event The Geant4 event to be modified.
+ */
+ virtual void generate(G4Event* event) = 0;
+
+ /**
+ * Dump information about the current event.
+ */
+ virtual void dumpCurrentEvent() = 0;
+
+ /**
+ * Reset the event source.
+ */
+ virtual void reset();
+
+ /**
+ * Skip a number of events in the source.
+ * @param[in] n The number of events to skip.
+ */
+ virtual unsigned int skipEvents(unsigned int n);
+
+ /**
+ * Hook for beginning of an event.
+ * @param[in] event The Geant4 event.
+ */
+ virtual void beginEvent(const G4Event* event);
+
+ /**
+ * Hook for end of an event.
+ * @param[in] event The Geant4 event.
+ */
+ virtual void endEvent(const G4Event* event);
+
+ /**
+ * Hook for the beginning of a run.
+ * @param[in] run The Geant4 run.
+ */
+ virtual void beginRun(const G4Run* run);
+
+ /**
+ * Hook for the end of a run.
+ * @param[in] run The Geant4 run.
+ */
+ virtual void endRun(const G4Run* run);
private:
- std::string m_name;
- int nEventsGenerated;
+ std::string m_name;
+ int nEventsGenerated;
};
}
slic/include
diff -u -r1.14 -r1.15
--- EventSourceManager.hh 27 Nov 2012 19:32:17 -0000 1.14
+++ EventSourceManager.hh 6 Nov 2013 00:23:35 -0000 1.15
@@ -1,9 +1,9 @@
-// $Header: /cvs/lcd/slic/include/EventSourceManager.hh,v 1.14 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventSourceManager.hh,v 1.15 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTSOURCEMANAGER_HH
#define SLIC_EVENTSOURCEMANAGER_HH 1
-// slic
+// SLIC
#include "Module.hh"
#include "EventSource.hh"
#include "EventSourceWithInputFile.hh"
@@ -12,7 +12,7 @@
#include "GeneratorMessenger.hh"
#include "Singleton.hh"
-// geant4
+// Geant4
#include "G4VPrimaryGenerator.hh"
#include "G4GeneralParticleSource.hh"
#include "G4ParticleGun.hh"
@@ -24,106 +24,311 @@
* @brief This singleton is responsible for managing physics event sources.
*/
class EventSourceManager: public Module, public Singleton<EventSourceManager> {
-public:
- enum ESourceType {
- eUnknown = 0, eStdHep = 1, eLCIO, eGPS, eParticleGun
- };
-public:
- virtual ~EventSourceManager();
- EventSourceManager();
public:
- void setSourceType(ESourceType est);
- void setSourceType(const std::string& s);
- ESourceType getCurrentSourceType();
- ESourceType getSourceTypeFromFileExtension(const std::string& s);
- const std::string& getCurrentSourceName();
- const std::string& getSourceNameFromType(ESourceType egt) const;
- ESourceType getSourceTypeFromName(const std::string& s) const;
- const std::string& getFilename();
- void setFilename(const std::string& f);
- void setupEventSource();
- void resetCurrentEventSource();
- void setSkipEvents(unsigned int s);
- unsigned int getSkipEvents();
- void dumpCurrentEvent();
- void printNumEventsGenerated();
- int getNumEventsGenerated();
- void incrNumEventsGenerated();
- void generate(G4Event* evt);
- void setEventSource(EventSource* es);
- void deleteCurrentEventSource();
- EventSource* createEventSource(ESourceType st);
- EventSource* getCurrentSource();
- void setupEventSource(ESourceType st);
- void setupEventSource(const std::string& s);
- void beginEvent(const G4Event*);
- void endEvent(const G4Event*);
- void beginRun(const G4Run*);
- void endRun(const G4Run*);
- bool isEOF();
- bool isNewSource();
- bool isNewSource(ESourceType est);
- bool isNewFilename();
- bool isFileSource();
- EventSourceWithInputFile* getFileSource();
- G4GeneralParticleSource* getGPS();
- G4ParticleGun* getParticleGun();
- double getLorentzTransformationAngle() {
- return m_lorentzTransformationAngle;
- }
- void setLorentzTransformationAngle(const G4double lorentzTransformationAngle);
- void setZSmearing(const G4double zSmearingParam) {
- m_zSmearingParam = zSmearingParam;
- G4cout << "Set m_zSmearingParam = " << m_zSmearingParam << G4endl;
- }
- G4double getZSmearing() {
- return m_zSmearingParam;
- }
-public:
- virtual void GeneratePrimaryVertex(G4Event* evt);
-
-private:
-
- // generator messenger
- GeneratorMessenger* m_messenger;
-
- // current event source
- EventSource* m_currentEventSource;
- // ParticleGun source. Always enabled.
- EventSource* m_particleGunSource;
+ /**
+ * Enum for different source types.
+ */
+ enum ESourceType {
+ eUnknown = 0, eStdHep = 1, eLCIO, eGPS, eParticleGun
+ };
- // filename
- std::string m_filename;
- bool m_fileIsSet;
- bool m_newFilename;
-
- // num events generated on current generator
- int m_ngen;
-
- // num events to skip
- unsigned int m_nskip;
-
- // need to setup a new source new run?
- bool m_newSource;
+public:
- // gen strings
- static std::string m_stdhepStr;
- static std::string m_lcioStr;
- static std::string m_gpsStr;
- static std::string m_gunStr;
- static std::string m_unknownStr;
+ virtual ~EventSourceManager();
- // source type
- ESourceType m_sourceType;
+ EventSourceManager();
- // Lorentz transformation angle which will be applied to event.
- G4double m_lorentzTransformationAngle;
+public:
- // Parameter which will be used to smear vertex Z position.
- G4double m_zSmearingParam;
-};
-}
+ /**
+ * Set the source type to use.
+ * @param[in] est The event source type.
+ */
+ void setSourceType(ESourceType est);
+
+ /**
+ * Set the source type to use.
+ * @param[in] est The event source type string.
+ */
+ void setSourceType(const std::string& s);
+
+ /**
+ * Get the current source type.
+ * @return The current source type.
+ */
+ ESourceType getCurrentSourceType();
+
+ /**
+ * Determine the source type from a file extension.
+ * @param[in] s The file extension.
+ * @return The event source type.
+ */
+ ESourceType getSourceTypeFromFileExtension(const std::string& ext);
+
+ /**
+ * Get the name of the current source.
+ * @return The name of the current source.
+ */
+ const std::string& getCurrentSourceName();
+
+ /**
+ * Get the source name string from a type.
+ * @return egt The source name from the type.
+ */
+ const std::string& getSourceNameFromType(ESourceType egt) const;
+
+ /**
+ * Get the source type from a name.
+ * @param[in] name The name of the source.
+ * @return The source type.
+ */
+ ESourceType getSourceTypeFromName(const std::string& name) const;
+
+ /**
+ * Get the current file name.
+ * @return The file name.
+ */
+ const std::string& getFilename();
+
+ /**
+ * Set the current file name.
+ * @param[in] fileName The file name.
+ */
+ void setFilename(const std::string& fileName);
+
+ /**
+ * Setup the current event source.
+ */
+ void setupEventSource();
+
+ /**
+ * Reset the current event source.
+ */
+ void resetCurrentEventSource();
+
+ /**
+ * Set the number of events to skip.
+ * @param[in] n The number of events to skip.
+ */
+ void setSkipEvents(unsigned int n);
+
+ /**
+ * Get the number of events to skip.
+ * @return The number of events to skip.
+ */
+ unsigned int getSkipEvents();
+
+ /**
+ * Dump the current event.
+ */
+ void dumpCurrentEvent();
+
+ /**
+ * Print the number of events generated.
+ */
+ void printNumEventsGenerated();
+
+ /**
+ * Get the number of events generated.
+ * @return The number of events generated.
+ */
+ int getNumEventsGenerated();
+
+ /**
+ * Increment the number of events generated.
+ */
+ void incrNumEventsGenerated();
+
+ /**
+ * Generate a Geant4 event.
+ * @param[in] The target Geant4 event.
+ */
+ void generate(G4Event* event);
+
+ /**
+ * Set the current event source.
+ * @param[in] eventSource The event source.
+ */
+ void setEventSource(EventSource* eventSource);
+
+ /**
+ * Delete the current event source.
+ */
+ void deleteCurrentEventSource();
+
+ /**
+ * Create an event source from a type.
+ * @return The event source from the type.
+ */
+ EventSource* createEventSource(ESourceType st);
+
+ /**
+ * Get the current event source.
+ * @return The current event source.
+ */
+ EventSource* getCurrentSource();
+
+ /**
+ * Setup an event source from a type.
+ * @param[in] sourceType The event source type.
+ */
+ void setupEventSource(ESourceType sourceType);
+
+ /**
+ * Setup an event source from a type string.
+ * @param[in] sourceType The event source type string.
+ */
+ void setupEventSource(const std::string& sourceType);
+
+ /**
+ * Begin event hook.
+ * @param[in] event The Geant4 event.
+ */
+ void beginEvent(const G4Event* event);
+
+ /**
+ * End event hook.
+ * @param[in] event The Geant4 event.
+ */
+ void endEvent(const G4Event* event);
+
+ /**
+ * Begin run hook.
+ * @param[in] run The Geant4 run.
+ */
+ void beginRun(const G4Run* run);
+
+ /**
+ * End run hook.
+ * @param[in] run The Geant4 run.
+ */
+ void endRun(const G4Run* run);
+
+ /**
+ * Check if end of file has been reached for file-based sources.
+ * @return True if end of file has been reached; false if not.
+ */
+ bool isEOF();
+
+ /**
+ * Check if this is a new source which needs to be setup.
+ * @return True if source is new for the run; false if not.
+ */
+ bool isNewSource();
+
+ /**
+ * Check if this is a new source by type.
+ * @return True if source type is new for the run; false if not.
+ */
+ bool isNewSource(ESourceType est);
+
+ /**
+ * Check if the filename is different from the previous.
+ * @return True if file name is new; false if not.
+ */
+ bool isNewFilename();
+
+ /**
+ * Check if source is file-based.
+ * @return True if source is file-based; false if not.
+ */
+ bool isFileSource();
+
+ /**
+ * Get the source with input file.
+ * @return The source with an input file.
+ */
+ EventSourceWithInputFile* getFileSource();
+
+ /**
+ * Get the GPS particle source.
+ * @return The GPS particle source.
+ */
+ G4GeneralParticleSource* getGPS();
+
+ /**
+ * Get the particle gun source.
+ * @return The particle gun source.
+ */
+ G4ParticleGun* getParticleGun();
+
+ /**
+ * Get the Lorentz transformation angle.
+ * @return The Lorentz transformation angle.
+ */
+ double getLorentzTransformationAngle() {
+ return m_lorentzTransformationAngle;
+ }
+
+ /**
+ * Set the Lorentz transformation angle.
+ * @param[in] angle The Lorentz transformation angle.
+ */
+ void setLorentzTransformationAngle(const G4double angle);
+
+ /**
+ * Set the Z smearing parameter.
+ * @param[in] zSmear The Z smearing parameter.
+ */
+ void setZSmearing(const G4double zSmear) {
+ m_zSmearingParam = zSmear;
+ G4cout << "Set m_zSmearingParam = " << m_zSmearingParam << G4endl;}
+
+ /**
+ * Get the Z smearing parameter.
+ * @return The Z smearing parameter.
+ */
+ G4double getZSmearing() {
+ return m_zSmearingParam;
+ }
+
+ public:
+
+ virtual void GeneratePrimaryVertex(G4Event* evt);
+
+ private:
+
+ // generator messenger
+ GeneratorMessenger* m_messenger;
+
+ // current event source
+ EventSource* m_currentEventSource;
+
+ // ParticleGun source. Always enabled.
+ EventSource* m_particleGunSource;
+
+ // filename
+ std::string m_filename;
+ bool m_fileIsSet;
+ bool m_newFilename;
+
+ // num events generated on current generator
+ int m_ngen;
+
+ // num events to skip
+ unsigned int m_nskip;
+
+ // need to setup a new source new run?
+ bool m_newSource;
+
+ // gen strings
+ static std::string m_stdhepStr;
+ static std::string m_lcioStr;
+ static std::string m_gpsStr;
+ static std::string m_gunStr;
+ static std::string m_unknownStr;
+
+ // source type
+ ESourceType m_sourceType;
+
+ // Lorentz transformation angle which will be applied to event.
+ G4double m_lorentzTransformationAngle;
+
+ // Parameter which will be used to smear vertex Z position.
+ G4double m_zSmearingParam;
+ };
+ }
#endif
slic/include
diff -u -r1.10 -r1.11
--- EventSourceWithInputFile.hh 27 Nov 2012 19:32:17 -0000 1.10
+++ EventSourceWithInputFile.hh 6 Nov 2013 00:23:35 -0000 1.11
@@ -1,72 +1,112 @@
-// $Header: /cvs/lcd/slic/include/EventSourceWithInputFile.hh,v 1.10 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/EventSourceWithInputFile.hh,v 1.11 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_EVENTSOURCEWITHINPUTFILE_HH
#define SLIC_EVENTSOURCEWITHINPUTFILE_HH 1
-// slic
+// SLIC
#include "EventSource.hh"
#include "FileUtil.hh"
#include "Module.hh"
namespace slic {
+
/**
* @class EventSourceWithInputFile
- * @brief A physics event source with an associated input file, such as StdHep or LCIO.
+ * @brief An EventSource with an associated input file, such as StdHep or LCIO event files.
*/
class EventSourceWithInputFile: public EventSource {
protected:
- EventSourceWithInputFile(const std::string& name, const std::string& filename = "") :
- EventSource(name), m_filename(filename), m_eof(false), m_fileIsOpen(false), m_fileIsNew(false), m_fileIsSet(
- false) {
- }
-
-public:
- virtual ~EventSourceWithInputFile() {
- }
+ /**
+ * Class constructor.
+ * @param[in] name The name of the source.
+ * @param[in] filename The file name of the source.
+ */
+ EventSourceWithInputFile(const std::string& name, const std::string& filename = "") :
+ EventSource(name), m_filename(filename), m_eof(false), m_fileIsOpen(false), m_fileIsNew(false), m_fileIsSet(false) {
+ }
public:
- void setFilename(const std::string& s);
-
- const std::string& getFilename();
-
- // reset current source
- virtual void reset();
-
- // skip n events
- virtual unsigned int skipEvents(unsigned int nevents);
+ /**
+ * Class destructor.
+ */
+ virtual ~EventSourceWithInputFile() {
+ }
- // current status = EOF?
- virtual bool isEOF();
-
- virtual void beginEvent(const G4Event*);
-
- virtual void beginRun(const G4Run*);
-
- // Next 4 to be implemented by subclasses...
-
- // open the current file
- virtual void open() = 0;
-
- // close the current file
- virtual void close() = 0;
+public:
- // read the next event
- virtual void readNextEvent() = 0;
- virtual void dumpCurrentEvent() = 0;
+ /**
+ * Set the file name of the source.
+ * @param[in] filename The file name.
+ */
+ void setFilename(const std::string& filename);
+
+ /**
+ * Get the file name of the source.
+ * @return The file name.
+ */
+ const std::string& getFilename();
+
+ /**
+ * Reset the source back to the beginning of the file.
+ */
+ void reset();
+
+ /**
+ * Skip a number of events in the source's file.
+ * @param[in] nevents The number of events to skip.
+ */
+ unsigned int skipEvents(unsigned int nevents);
+
+ /**
+ * Check if the end of file has been reached.
+ */
+ bool isEOF();
+
+ /**
+ * Begin of event hook.
+ * @param[in] event The Geant4 event.
+ */
+ void beginEvent(const G4Event* event);
+
+ /**
+ * Begin run hook.
+ * @param[in] run The Geant4 run.
+ */
+ void beginRun(const G4Run* run);
+
+ /**
+ * Open the file associated with the source.
+ */
+ virtual void open() = 0;
+
+ /**
+ * Close the file associated with the source.
+ */
+ virtual void close() = 0;
+
+ /**
+ * Read the next event.
+ */
+ virtual void readNextEvent() = 0;
+
+ /**
+ * Dump the current event to std::cout.
+ */
+ virtual void dumpCurrentEvent() = 0;
protected:
- // name of input file
- std::string m_filename;
+ // name of input file
+ std::string m_filename;
- // state vars
- bool m_eof;
- bool m_fileIsOpen;
- bool m_fileIsNew;
- bool m_fileIsSet;
+ // state vars
+ bool m_eof;
+ bool m_fileIsOpen;
+ bool m_fileIsNew;
+ bool m_fileIsSet;
};
}
slic/include
diff -u -r1.3 -r1.4
--- FieldManager.hh 27 Nov 2012 19:32:17 -0000 1.3
+++ FieldManager.hh 6 Nov 2013 00:23:35 -0000 1.4
@@ -1,23 +1,36 @@
-// $Id: FieldManager.hh,v 1.3 2012/11/27 19:32:17 jeremy Exp $
+// $Id: FieldManager.hh,v 1.4 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_FIELDMANAGER_HH
#define SLIC_FIELDMANAGER_HH 1
+// SLIC
#include "Module.hh"
#include "FieldMessenger.hh"
#include "Singleton.hh"
namespace slic {
+
+/**
+ * @class FieldManager
+ * @brief A manager of B-fields that currently just holds the pointer to its associated FieldMessenger.
+ */
class FieldManager: public Module, public Singleton<FieldManager> {
public:
- FieldManager();
- virtual ~FieldManager();
+ /**
+ * Class constructor.
+ */
+ FieldManager();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~FieldManager();
private:
- FieldMessenger* m_messenger;
+ FieldMessenger* m_messenger;
};
}
slic/include
diff -u -r1.6 -r1.7
--- FieldMessenger.hh 27 Nov 2012 19:32:17 -0000 1.6
+++ FieldMessenger.hh 6 Nov 2013 00:23:35 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/FieldMessenger.hh,v 1.6 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/FieldMessenger.hh,v 1.7 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_FIELDMESSENGER_HH
#define SLIC_FIELDMESSENGER_HH 1
@@ -15,28 +15,59 @@
/**
* @class FieldMessenger
- * @brief G4UImessenger to G4FieldManager (and related).
+ *
+ * @brief G4UImessenger to G4FieldManager and related classes.
+ *
+ * @note
+ * This messenger handles the following commands:
+ * - /field/selectStepper
+ * - /field/setDeltaOneStep
+ * - /field/setDeltaIntersection
+ *
+ * @note
+ * For more information on these settings, see the
+ * <a href="http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s03.html">Electromagnetic Field section</a>
+ * of the Geant4 Application Developer's Guide.
+ *
*/
+
class FieldMessenger: public G4UImessenger {
+
public:
- FieldMessenger(FieldManager* mgr);
- virtual ~FieldMessenger();
+
+ /**
+ * Class constructor.
+ */
+ FieldMessenger(FieldManager* mgr);
+
+ /**
+ * Class destructor.
+ */
+ virtual ~FieldMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
-private:
- void defineCommands();
+ /**
+ * Process macro commands.
+ * @param[in] command The macro command.
+ * @param[in] newValues The command arguments.
+ */
+ virtual void SetNewValue(G4UIcommand* command, G4String newValues);
private:
- FieldManager* m_mgr;
+ /**
+ * Define the messenger's commands.
+ */
+ void defineCommands();
- G4UIdirectory* m_fieldDir;
+private:
- G4UIcommand* m_selectStepperCmd;
- G4UIcmdWithADoubleAndUnit* m_setDeltaOneStepCmd;
- G4UIcmdWithADoubleAndUnit* m_setDeltaIntersectionCmd;
+ FieldManager* m_mgr;
+ G4UIdirectory* m_fieldDir;
+ G4UIcommand* m_selectStepperCmd;
+ G4UIcmdWithADoubleAndUnit* m_setDeltaOneStepCmd;
+ G4UIcmdWithADoubleAndUnit* m_setDeltaIntersectionCmd;
};
}
slic/include
diff -u -r1.11 -r1.12
--- FileUtil.hh 27 Nov 2012 19:32:17 -0000 1.11
+++ FileUtil.hh 6 Nov 2013 00:23:35 -0000 1.12
@@ -1,28 +1,69 @@
-// $Header: /cvs/lcd/slic/include/FileUtil.hh,v 1.11 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/FileUtil.hh,v 1.12 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_FILEUTIL_HH
#define SLIC_FILEUTIL_HH 1
-// std
+// STL
#include <string>
namespace slic {
/**
- @class FileUtil
- @brief Utilities for file manipulation using std.
+ * @class FileUtil
+ * @brief Utilities for file manipulation.
*/
class FileUtil {
-public:
- static int removeFile(const char* filename);
- static int removeFile(const std::string& filename);
- static bool fileExists(const char* filename);
- static bool fileExists(const std::string& filename);
+public:
- static std::string basename(std::string fn);
- static std::string extension(std::string fn);
- static std::string removeExtension(std::string ext);
+ /**
+ * Remove a file.
+ * @param[in] filename Full path to a file.
+ * @return Command status with non-zero indicating an error.
+ */
+ static int removeFile(const char* filename);
+
+ /**
+ * Remove a file.
+ * @param[in] filename Full path to a file.
+ * @return Command status with non-zero indicating an error.
+ */
+ static int removeFile(const std::string& filename);
+
+ /**
+ * Check if a file exists.
+ * @param[in] fileName Full path to a file.
+ * @return True if file exists; false if it does not.
+ */
+ static bool fileExists(const char* filename);
+
+ /**
+ * Check if a file exists.
+ * @param[in] fileName Full path string to a file.
+ * @return True if file exists; false if it does not.
+ */
+ static bool fileExists(const std::string& filename);
+
+ /**
+ * Get the base name of a file path, which has the directory stripped from it.
+ * @param[in] filename Full path to a file.
+ * @return The base name of the file.
+ */
+ static std::string basename(std::string filename);
+
+ /**
+ * Get the extension of a file.
+ * @param[in] filename Full path to a file.
+ * @return The extension of the file.
+ */
+ static std::string extension(std::string filename);
+
+ /**
+ * Strip the extension from a file name.
+ * @param[in] filename Full path to a file.
+ * @return The file name with extension stripped off.
+ */
+ static std::string removeExtension(std::string filename);
};
}
slic/include
diff -u -r1.6 -r1.7
--- G4MagIntegratorStepperFactory.hh 27 Nov 2012 19:32:17 -0000 1.6
+++ G4MagIntegratorStepperFactory.hh 6 Nov 2013 00:23:35 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/G4MagIntegratorStepperFactory.hh,v 1.6 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/G4MagIntegratorStepperFactory.hh,v 1.7 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_G4MAGINTEGRATORSTEPPERFACTORY_HH
#define SLIC_G4MAGINTEGRATORSTEPPERFACTORY_HH 1
@@ -16,27 +16,45 @@
class G4MagneticField;
namespace slic {
+
/**
* @class G4MagIntegratorStepperFactory
* @brief Instantiates and sets the G4MagIntegratorStepper based on name.
*/
class G4MagIntegratorStepperFactory: public Singleton<G4MagIntegratorStepperFactory>, public Module {
-public:
- virtual ~G4MagIntegratorStepperFactory();
+public:
- G4MagIntegratorStepperFactory();
+ /**
+ * Class constructor.
+ */
+ G4MagIntegratorStepperFactory();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~G4MagIntegratorStepperFactory();
public:
- void setupG4MagIntegratorStepper(std::string name);
+
+ /**
+ * Setup an integrator stepper by name.
+ * @param[in] name The name of the stepper.
+ */
+ void setupG4MagIntegratorStepper(std::string name);
private:
- G4MagIntegratorStepper* createG4MagIntegratorStepper(std::string name);
+
+ /**
+ * Create an integrator stepper.
+ * @return The integrator stepper.
+ */
+ G4MagIntegratorStepper* createG4MagIntegratorStepper(std::string name);
private:
- G4Mag_EqRhs* m_fieldEquations;
- G4FieldManager* m_fieldMgr;
- G4MagneticField* m_field;
+ G4Mag_EqRhs* m_fieldEquations;
+ G4FieldManager* m_fieldMgr;
+ G4MagneticField* m_field;
};
}
slic/include
diff -u -r1.9 -r1.10
--- GPSEventSource.hh 27 Nov 2012 19:32:17 -0000 1.9
+++ GPSEventSource.hh 6 Nov 2013 00:23:35 -0000 1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/GPSEventSource.hh,v 1.9 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/GPSEventSource.hh,v 1.10 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_GPSEVENTSOURCE_HH
#define SLIC_GPSEVENTSOURCE_HH 1
@@ -10,28 +10,54 @@
#include "G4GeneralParticleSource.hh"
namespace slic {
+
/**
* @class GPSEventSource
* @brief Wrapper for Geant4's general particle source.
*/
class GPSEventSource: public EventSource {
+
public:
- GPSEventSource();
- virtual ~GPSEventSource();
+
+ /**
+ * Class constructor.
+ */
+ GPSEventSource();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~GPSEventSource();
public:
- virtual void generate(G4Event* evt);
- virtual void dumpCurrentEvent();
+ /**
+ * Generate a Geant4 event.
+ * @param[in] event The Geant4 event.
+ */
+ void generate(G4Event* event);
+
+ /**
+ * Dump the current event to std::cout.
+ */
+ void dumpCurrentEvent();
+
+ /**
+ * Get the Geant4 general particle source class.
+ * @return The general particle source.
+ */
+ G4GeneralParticleSource* getGPS();
- /** Set default GPS event in ctor. */
- void setupGeneratorDefaults();
+private:
- G4GeneralParticleSource* getGPS();
+ /**
+ * Setup the default GPS event settings.
+ */
+ void setupGeneratorDefaults();
private:
- G4GeneralParticleSource* m_generator;
+ G4GeneralParticleSource* m_generator;
};
}
slic/include
diff -u -r1.2 -r1.3
--- Geant4VersionInfo.hh.in 11 Apr 2013 18:42:04 -0000 1.2
+++ Geant4VersionInfo.hh.in 6 Nov 2013 00:23:35 -0000 1.3
@@ -4,19 +4,26 @@
#include <string>
/**
- * Statically accessible Geant4 version information,
- * including major, minor, and patch numbers and the
- * full version string.
+ * @class Geant4VersionInfo
+ * @brief Statically accessible Geant4 version information.
*/
class Geant4VersionInfo
{
private:
+
+ /**
+ * Class constructor.
+ */
Geant4VersionInfo() {;}
public:
- static std::string getFullVersion()
- {
+ /**
+ * Get the Geant4 version string in format "##.##.##"
+ * or "[release].[version].[patch]".
+ * @return The Geant4 version string.
+ */
+ static std::string getFullVersion() {
return "@Geant4_VERSION@";
}
};
slic/include
diff -u -r1.11 -r1.12
--- GeneratorMessenger.hh 27 Nov 2012 19:32:17 -0000 1.11
+++ GeneratorMessenger.hh 6 Nov 2013 00:23:35 -0000 1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/GeneratorMessenger.hh,v 1.11 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/GeneratorMessenger.hh,v 1.12 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_GENERATORMESSENGER_HH
#define SLIC_GENERATORMESSENGER_HH 1
@@ -13,6 +13,7 @@
class G4UIcmdWithADoubleAndUnit;
namespace slic {
+
/**
* @class GeneratorMessenger
* @brief Geant4 commands related to event generation.
@@ -21,29 +22,44 @@
public:
- GeneratorMessenger();
- virtual ~GeneratorMessenger();
+ /**
+ * Class constructor.
+ */
+ GeneratorMessenger();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~GeneratorMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+ /**
+ * Process a macro command.
+ * @param[in] command The macro command.
+ * @param[in] newValues The command arguments.
+ */
+ virtual void SetNewValue(G4UIcommand* command, G4String newValues);
private:
- void defineCommands();
+ /**
+ * Define the commands of the messenger.
+ */
+ void defineCommands();
private:
- G4UIdirectory* m_generatorDir;
- G4UIcommand* m_randomSeedCmd;
- G4UIcommand* m_selectCmd;
- G4UIcommand* m_resetCmd;
- G4UIcmdWithAnInteger* m_skipEventsCmd;
- G4UIcommand* m_filenameCmd;
- G4UIcommand* m_dumpCurrentEventCmd;
- G4UIcommand* m_printNumEventsGeneratedCmd;
- G4UIcmdWithADoubleAndUnit* m_setLorentzTransformationAngleCmd;
- G4UIcmdWithADouble* m_setZSmearingParameterCmd;
+ G4UIdirectory* m_generatorDir;
+ G4UIcommand* m_randomSeedCmd;
+ G4UIcommand* m_selectCmd;
+ G4UIcommand* m_resetCmd;
+ G4UIcmdWithAnInteger* m_skipEventsCmd;
+ G4UIcommand* m_filenameCmd;
+ G4UIcommand* m_dumpCurrentEventCmd;
+ G4UIcommand* m_printNumEventsGeneratedCmd;
+ G4UIcmdWithADoubleAndUnit* m_setLorentzTransformationAngleCmd;
+ G4UIcmdWithADouble* m_setZSmearingParameterCmd;
};
}
slic/include
diff -u -r1.2 -r1.3
--- HepPDTManager.hh 27 Nov 2012 19:32:17 -0000 1.2
+++ HepPDTManager.hh 6 Nov 2013 00:23:35 -0000 1.3
@@ -1,110 +1,69 @@
#ifndef SLIC_HEPPDTMANAGER_HH
#define SLIC_HEPPDTMANAGER_HH 1
-// heppdt
+// HepPDT
#include "HepPDT/TableBuilder.hh"
#include "HepPDT/ParticleDataTable.hh"
-// slic
+// SLIC
#include "Module.hh"
#include "Singleton.hh"
+// STL
#include <stdio.h>
#include <cstdlib>
using HepPDT::TableBuilder;
namespace slic {
+
+/**
+ * @class HepPDTManager
+ * @brief A class for managing the HepPDT particle table.
+ */
class HepPDTManager: public Module, public Singleton<HepPDTManager> {
public:
- HepPDTManager() :
- Module("HepPDTManager"), m_datacol(0), m_fileSet(false) {
- //loadParticleData();
- log().setOutputLevel(LOG::debug);
- }
-
- ~HepPDTManager() {
- delete m_datacol;
- }
+ /**
+ * Class constructor.
+ */
+ HepPDTManager();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~HepPDTManager();
public:
- HepPDT::ParticleDataTable* getParticleDataTable() {
- if (m_datacol == 0) {
- loadParticleData();
- }
- return m_datacol;
- }
-
- void setParticleDataFile(std::string pdfile) {
- m_pdfile = pdfile;
- m_fileSet = true;
- }
+ /**
+ * Get the particle data table, which is created on demand.
+ * @return The particle data table.
+ */
+ HepPDT::ParticleDataTable* getParticleDataTable();
+
+ /**
+ * Set the path to the particle data table.
+ * @param[in] pdfile The path to the particle data table.
+ */
+ void setParticleDataFile(std::string pdfile);
private:
- void loadParticleData() {
- // See if we can get the data file from the environment if it wasn't setup via CL or G4 macro.
- if (!m_fileSet) {
- char *heppdt = getenv("HEPPDT_BASE");
- if (heppdt) {
- m_pdfile = std::string(heppdt) + std::string("/data/particle.tbl");
- } else {
- log() << LOG::error << "Could not find particle.tbl!" << LOG::done;
- return;
- }
- }
-
- std::ifstream pdfile(m_pdfile.c_str());
- if (!pdfile) {
-#ifdef SLIC_LOG
- log() << LOG::error << "error reading file " << m_pdfile << LOG::done;
-#endif
- return;
- }
-
- m_datacol = new HepPDT::ParticleDataTable("Particle Data Table");
- HepPDT::TableBuilder *tb = new HepPDT::TableBuilder((*m_datacol));
- if (!addParticleTable(pdfile, (*tb))) {
-#ifdef SLIC_LOG
- log() << LOG::error << "error reading lines from " << m_pdfile << LOG::done;
-#endif
- }
-
- delete tb;
- tb = 0;
- pdfile.close();
-
- // DEBUG
- //printParticleData();
- }
-
- void printParticleData() {
- log() << LOG::always << "-- HepPDT Particle Data Table --" << LOG::endl;
- log() << "ParticleDataTable has " << m_datacol->size() << " particles" << LOG::endl;
-
- for (HepPDT::ParticleDataTable::const_iterator it = m_datacol->begin(); it != m_datacol->end();
- it++) {
- HepPDT::ParticleID id = it->first;
- HepPDT::ParticleData pdata = it->second;
-
- log() << LOG::always << id.pid() << " " << id.PDTname();
-
- if (id.isSUSY()) {
- log() << " <-- SUSY particle";
- }
-
- log() << LOG::endl;
- }
-
- log() << LOG::done;
- }
+ /**
+ * Load all data into the particle data table object.
+ */
+ void loadParticleData();
+
+ /**
+ * Print out the particle table data.
+ */
+ void printParticleData();
private:
- HepPDT::ParticleDataTable* m_datacol;
- std::string m_pdfile;
- bool m_fileSet;
+ HepPDT::ParticleDataTable* m_datacol;
+ std::string m_pdfile;
+ bool m_fileSet;
};
}
slic/include
diff -u -r1.10 -r1.11
--- HitsCollectionUtil.hh 1 Jul 2013 21:01:30 -0000 1.10
+++ HitsCollectionUtil.hh 6 Nov 2013 00:23:35 -0000 1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/HitsCollectionUtil.hh,v 1.10 2013/07/01 21:01:30 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/HitsCollectionUtil.hh,v 1.11 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_HITSCOLLECTIONUTIL_HH
#define SLIC_HITSCOLLECTIONUTIL_HH 1
@@ -10,19 +10,39 @@
class SensitiveDetector;
namespace slic {
+
/**
* @class HitsCollectionUtil
- * @brief Static utility methods for Hits Collections.
+ * @brief Static utility methods for hits collections.
*/
class HitsCollectionUtil {
+
private:
- HitsCollectionUtil();
+
+ /**
+ * Class constructor.
+ */
+ HitsCollectionUtil();
public:
- static std::vector<SensitiveDetector*> getSensitiveDetectors();
- static std::vector<int> getHCIDs();
- static std::vector<std::string> getHCNames();
+ /**
+ * Get the current list of sensitive detectors.
+ * @return The list of sensitive detectors.
+ */
+ static std::vector<SensitiveDetector*> getSensitiveDetectors();
+
+ /**
+ * Get the current list of hits collection IDs.
+ * @return The list of hits collection IDS.
+ */
+ static std::vector<int> getHCIDs();
+
+ /**
+ * Get the current list of hits collection names.
+ * @return The list of hits collection names.
+ */
+ static std::vector<std::string> getHCNames();
};
}
slic/include
diff -u -r1.3 -r1.4
--- LCExtendedDecay.hh 27 Nov 2012 19:32:17 -0000 1.3
+++ LCExtendedDecay.hh 6 Nov 2013 00:23:35 -0000 1.4
@@ -4,16 +4,29 @@
#include "G4UnknownDecay.hh"
namespace slic {
+
+/**
+ * @class LCExtendedDecay
+ * @brief This class triggers decays for the extended particle set from HepPDT.
+ */
class LCExtendedDecay: public G4UnknownDecay {
public:
- LCExtendedDecay() :
- G4UnknownDecay("LCExtendedDecay") {
- ;
- }
- G4bool IsApplicable(const G4ParticleDefinition &pdef) {
- return (pdef.GetParticleType() == "extended");
- }
+ /**
+ * Class constructor.
+ */
+ LCExtendedDecay() :
+ G4UnknownDecay("LCExtendedDecay") {
+ ;
+ }
+
+ /**
+ * Determine if the extended decay process is applicable to the given particle.
+ * @param[in] pdef The particle definition.
+ */
+ G4bool IsApplicable(const G4ParticleDefinition &pdef) {
+ return (pdef.GetParticleType() == "extended");
+ }
};
}
slic/include
diff -u -r1.5 -r1.6
--- LCExtendedParticles.hh 27 Nov 2012 19:32:17 -0000 1.5
+++ LCExtendedParticles.hh 6 Nov 2013 00:23:35 -0000 1.6
@@ -11,22 +11,40 @@
#include "G4hMultipleScattering.hh"
namespace slic {
+
+/**
+ * @class LCExtendedParticles
+ * @brief This class models the extended particle set from HepPDT.
+ */
class LCExtendedParticles: public G4VPhysicsConstructor {
public:
- LCExtendedParticles(const G4String& name = "LCExtendedParticles");
-
- virtual ~LCExtendedParticles();
-
- void ConstructParticle();
-
- void ConstructProcess();
+ /**
+ * Class constructor.
+ * @param[in] name The name of the physics to be constructed.
+ */
+ LCExtendedParticles(const G4String& name = "LCExtendedParticles");
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LCExtendedParticles();
+
+ /**
+ * Construct the particles.
+ */
+ void ConstructParticle();
+
+ /**
+ * Construct the processes.
+ */
+ void ConstructProcess();
private:
- G4Decay m_decay;
- G4hIonisation m_ionise;
- G4hMultipleScattering m_scatter;
+ G4Decay m_decay;
+ G4hIonisation m_ionise;
+ G4hMultipleScattering m_scatter;
};
}
slic/include
diff -u -r1.3 -r1.4
--- LCOpticalPhysics.hh 27 Nov 2012 19:32:17 -0000 1.3
+++ LCOpticalPhysics.hh 6 Nov 2013 00:23:35 -0000 1.4
@@ -8,9 +8,10 @@
////////////////////////////////////////////////////////////////
//
-#ifndef LCOpticalPhysics_h
-#define LCOpticalPhysics_h 1
+#ifndef LCOpticalPhysics_hh
+#define LCOpticalPhysics_hh 1
+// Geant4
#include "G4VPhysicsConstructor.hh"
#include "G4Cerenkov.hh"
#include "G4Scintillation.hh"
@@ -19,22 +20,41 @@
#include "G4OpBoundaryProcess.hh"
#include "G4ProcessManager.hh"
+/**
+ * @class LCOpticalPhysics
+ * @brief Optical physics constructor.
+ */
class LCOpticalPhysics: public G4VPhysicsConstructor {
+
public:
+ /**
+ * The class constructor.
+ * @param[in] name The name of the G4VPhysicsConstructor.
+ */
LCOpticalPhysics(const G4String& name = "optical");
+ /**
+ * Class destructor.
+ */
virtual ~LCOpticalPhysics();
- // This method will be invoked in the Construct() method.
- // each particle type will be instantiated
- virtual void ConstructParticle();
-
- // This method will be invoked in the Construct() method.
- // each physics process will be instantiated and
- // registered to the process manager of each particle type
- virtual void ConstructProcess();
- //these methods Construct physics processes and register them
+ /**
+ * This method will be invoked in the Construct() method where
+ * each particle type will be instantiated.
+ */
+ void ConstructParticle();
+
+ /**
+ * This method will be invoked in the Construct() method.
+ * Each physics process will be instantiated and registered
+ * to the process manager of each particle type
+ */
+ void ConstructProcess();
+
+ /**
+ * This method constructs physics processes and registers them.
+ */
void ConstructOp();
protected:
slic/include
diff -u -r1.2 -r1.3
--- LCSUSYDecay.hh 27 Nov 2012 19:32:17 -0000 1.2
+++ LCSUSYDecay.hh 6 Nov 2013 00:23:35 -0000 1.3
@@ -4,13 +4,26 @@
#include "G4UnknownDecay.hh"
namespace slic {
+
+/**
+ * @class LCSUSYDecay
+ * @brief This class triggers decays for SUSY particles.
+ */
class LCSUSYDecay: public G4UnknownDecay {
public:
+
+ /**
+ * Class constructor.
+ */
LCSUSYDecay() :
G4UnknownDecay("LCSUSYDecay") {
;
}
+ /**
+ * Make this class applicable to SUSY particles.
+ * @return True if process is applicable; false if not.
+ */
G4bool IsApplicable(const G4ParticleDefinition &pdef) {
return (pdef.GetParticleType() == "susy");
}
slic/include
diff -u -r1.4 -r1.5
--- LCSUSYPhysics.hh 27 Nov 2012 19:32:17 -0000 1.4
+++ LCSUSYPhysics.hh 6 Nov 2013 00:23:35 -0000 1.5
@@ -12,15 +12,34 @@
#include "G4hMultipleScattering.hh"
namespace slic {
+
+/**
+ * @class LCSUSYPhysics
+ * @brief Physics processors and particles for SUSY.
+ */
class LCSUSYPhysics: public G4VPhysicsConstructor {
+
public:
+ /**
+ * Class constructor.
+ * @param[in] name The name of the G4VPhysicsConstructor.
+ */
LCSUSYPhysics(const G4String& name = "LCSUSYPhysics");
+ /**
+ * Class destructor.
+ */
virtual ~LCSUSYPhysics();
+ /**
+ * This is called from Construct() to create and register the SUSY particles.
+ */
void ConstructParticle();
+ /**
+ * This is called from Construct() to create and register the physics processes.
+ */
void ConstructProcess();
private:
slic/include
diff -u -r1.9 -r1.10
--- LcioEventSource.hh 27 Nov 2012 19:32:17 -0000 1.9
+++ LcioEventSource.hh 6 Nov 2013 00:23:35 -0000 1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioEventSource.hh,v 1.9 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioEventSource.hh,v 1.10 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOEVENTSOURCE_HH
#define SLIC_LCIOEVENTSOURCE_HH 1
@@ -19,41 +19,73 @@
namespace slic {
/**
* @class LcioEventSource
- * @brief Event generation from the MCParticle collection of an LCIO file.
+ * @brief Implements event generation from the MCParticle collection of an LCIO file.
*/
class LcioEventSource: public EventSourceWithInputFile {
-public:
- LcioEventSource(const std::string& fname = "");
-
- virtual ~LcioEventSource();
public:
- // open the current file
- virtual void open();
-
- // close the current file
- virtual void close();
-
- // read the next event
- virtual void readNextEvent();
-
- virtual void dumpCurrentEvent();
+ /**
+ * Class constructor.
+ * @param[in] fname The file name.
+ */
+ LcioEventSource(const std::string& filename = "");
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LcioEventSource();
- void generate(G4Event* anEvent);
-
- virtual void beginRun(const G4Run* aRun);
-
- virtual void beginEvent(const G4Event* anEvent);
-
- //virtual void endEvent(const G4Event*);
+public:
- EVENT::LCCollection* getCurrentMcpLCCollection();
+ /**
+ * Open the current file.
+ */
+ void open();
+
+ /**
+ * Close the current file.
+ */
+ void close();
+
+ /**
+ * Read the next event.
+ */
+ void readNextEvent();
+
+ /**
+ * Dump the current event.
+ */
+ void dumpCurrentEvent();
+
+ /**
+ * Generate a Geant4 event.
+ * @param[in] anEvent The target event.
+ */
+ void generate(G4Event* anEvent);
+
+ /**
+ * Begin run hook.
+ * @param[in] aRun The run.
+ */
+ void beginRun(const G4Run* aRun);
+
+ /**
+ * Begin event hook.
+ * @param[in] anEvent The event.
+ */
+ void beginEvent(const G4Event* anEvent);
+
+ /**
+ * Get the current MCParticle collection.
+ * @return The current MCParticle collection.
+ */
+ EVENT::LCCollection* getCurrentMcpLCCollection();
private:
- LcioMcpFilter* m_filter;
- IO::LCReader* m_reader;
- EVENT::LCEvent* m_event;
+ LcioMcpFilter* m_filter;
+ IO::LCReader* m_reader;
+ EVENT::LCEvent* m_event;
};
}
slic/include
diff -u -r1.10 -r1.11
--- LcioFileNamer.hh 27 Nov 2012 19:32:17 -0000 1.10
+++ LcioFileNamer.hh 6 Nov 2013 00:23:35 -0000 1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioFileNamer.hh,v 1.10 2012/11/27 19:32:17 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioFileNamer.hh,v 1.11 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOFILENAMER_HH
#define SLIC_LCIOFILENAMER_HH 1
@@ -20,35 +20,85 @@
* @brief Automatically name LCIO output files according to input settings.
*/
class LcioFileNamer: public Module {
-public:
- LcioFileNamer();
- virtual ~LcioFileNamer() {
- }
public:
- std::string makeFileName(std::vector<std::string>);
-
-private:
- std::string getFieldValue(std::string);
+ /**
+ * Class constructor.
+ */
+ LcioFileNamer();
- std::string makeDefaultFileName();
+ virtual ~LcioFileNamer();
- static std::string makeEventName();
+public:
- static std::string makeFileBasedName();
- static std::string makeGPSName();
- static std::string makeGunName();
+ /**
+ * Create a file name based on a list of fields to include.
+ * @param[in] fields The list of fields.
+ * @return The file name.
+ */
+ std::string makeFileName(std::vector<std::string> fields);
- static std::string makeRunNumberString();
- static std::string makeEventNumberString();
+private:
- static std::string getGeant4VersionString();
+ /**
+ * Get the value of a field.
+ * @param[in] field The field name.
+ */
+ std::string getFieldValue(std::string field);
+
+ /**
+ * Create the file name using the default set of fields.
+ * @return The file name.
+ */
+ std::string makeDefaultFileName();
+
+ /**
+ * Create the file name based on the current event generator.
+ * @return The file name.
+ */
+ static std::string makeEventName();
+
+ /**
+ * Create the file name based on a generator with an input file.
+ * @return The file name.
+ */
+ static std::string makeFileBasedName();
+
+ /**
+ * Create the file name based on settings of the Geant4 GPS.
+ * @return The file name.
+ */
+ static std::string makeGPSName();
+
+ /**
+ * Create the file name based on settings of the Geant4 particle gun.
+ * @return The file name.
+ */
+ static std::string makeGunName();
+
+ /**
+ * Create a string from the current run number information in the RunManager.
+ * @return The run number string.
+ */
+ static std::string makeRunNumberString();
+
+ /**
+ * Create a string from the number of events that were run using 'beamon'.
+ * @return The number of events that were run.
+ */
+ static std::string makeEventNumberString();
+
+ /**
+ * Create a string with the Geant4 version information.
+ * @return The Geant4 version string.
+ */
+ static std::string getGeant4VersionString();
private:
- static std::string m_sep;
- std::vector<std::string> m_defaultFields;
+ static std::string m_sep;
+ std::vector<std::string> m_defaultFields;
};
}
slic/include
diff -u -r1.12 -r1.13
--- LcioHitsCollectionBuilder.hh 17 Sep 2013 00:39:21 -0000 1.12
+++ LcioHitsCollectionBuilder.hh 6 Nov 2013 00:23:35 -0000 1.13
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioHitsCollectionBuilder.hh,v 1.12 2013/09/17 00:39:21 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioHitsCollectionBuilder.hh,v 1.13 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOHITSCOLLECTIONBUILDER_HH
#define SLIC_LCIOHITSCOLLECTIONBUILDER_HH
@@ -22,8 +22,7 @@
// geant4
#include "G4Event.hh"
-namespace slic
-{
+namespace slic {
class LcioMcpManager;
@@ -36,88 +35,167 @@
public:
- LcioHitsCollectionBuilder();
-
- virtual ~LcioHitsCollectionBuilder();
-
- // interface function to create an Lcio event from a G4 event
- EVENT::LCEvent* createHCsFromG4Event(const G4Event* g4evt, EVENT::LCEvent* lcevt);
-
- // flags for hits
- void setLongFlag(bool s = true);
-
- void setPDGFlag(bool s = true);
-
- void setStoreMomentum(bool s = true) {
- m_storeMomentum = s;
- }
-
- bool getStoreMomentum() {
- return m_storeMomentum;
- }
+ /**
+ * Class constructor.
+ */
+ LcioHitsCollectionBuilder();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LcioHitsCollectionBuilder();
+
+ /**
+ * Setup instance variables and then create the LCIO output hits collections
+ * from the Geant4 sensitive detector data for the event.
+ * @param[in] event The Geant4 event.
+ * @param[in] lcioEvent The LCIO target event.
+ * @return The LCIO event with the hits collections.
+ */
+ EVENT::LCEvent* createHitCollectionsFromEvent(const G4Event* event, EVENT::LCEvent* lcioEvent);
+
+ /**
+ * Set to true in order to include positions in output hits.
+ * @param[in] longFlag The setting of the long flag.
+ */
+ void setLongFlag(bool longFlag = true);
+
+ /**
+ * Set to true in order to include all step contributions in output hits
+ * rather than aggregating them together by PDG ID.
+ * @param[in] pdgFlag The setting of the PDG flag.
+ */
+ void setPDGFlag(bool pdgFlag = true);
+
+ /**
+ * Set to true in order to store momentum in output step contributions.
+ * @param[in] storeMomentum The store momentum setting.
+ */
+ void setStoreMomentum(bool storeMomentum = true) {
+ m_storeMomentum = storeMomentum;
+ }
+
+ /**
+ * Get whether to store momentum in output step contributions.
+ * @return True if momentum should be stored; false if not.
+ */
+ bool getStoreMomentum() {
+ return m_storeMomentum;
+ }
private:
- // create the hit collections in Lcio Event from the current G4Event
- void createHitCollections();
-
- // create the LCCollectionVec
- IMPL::LCCollectionVec* createCollectionVec(G4VHitsCollection* g4HC, SensitiveDetector::EType SDtype);
-
- // create a tracker coll
- IMPL::LCCollectionVec* createTrackerCollectionVec(G4VHitsCollection* g4HC);
-
- // create a calorimeter coll
- IMPL::LCCollectionVec* createCalorimeterCollectionVec(G4VHitsCollection* g4HC);
-
- // save cal hits
- void saveHits(CalorimeterHitsCollection* calHits, IMPL::LCCollectionVec* lcioColl);
-
- // save trk hits
- void saveHits(TrackerHitsCollection* trkHits, IMPL::LCCollectionVec* lcioColl);
-
- // create cal hit from G4 cal hit
- IMPL::SimCalorimeterHitImpl* createHit(CalorimeterHit* calHit);
-
- // create trk hit from G4 trk hit
- IMPL::SimTrackerHitImpl* createHit(TrackerHit* trkHit);
-
- // copy MCParticle hit contributions from G4 cal hit to the LCIO cal hit
- void addMcpContribs(CalorimeterHit*, IMPL::SimCalorimeterHitImpl*);
-
- // setup default flag settings; called in ctor
- void setCalFlagDefaults();
-
- // combine Mcp hit contribs using track ID
- void combineMcpHitContribs(const HitContributionList& long_contrib, HitContributionList& combined_contrib);
-
- // find single contrib by track ID in the combined list
- HitContribution* findMcpHitContribByTrackID(int trk_id, HitContributionList& contribs);
-
- // set endcap bit in trk or cal flag depending on SD type
- void setEndcapFlag(SensitiveDetector* g4sd);
- /**
- * True if the LCEvent contains a collection with given name; False if not.
- */
- static bool containsCollection(EVENT::LCEvent*, const std::string&);
+ /*
+ * Create the output LCIO hit collections from the current Geant4 event,
+ * using the instance variables of this class.
+ */
+ void createHitCollections();
+
+ /**
+ * Create the LCCollectionVec for a given hits collection.
+ * @param[in] hitCollection The hit collection.
+ * @param[in] sensitiveDetectorType The type of the sensitive detector (e.g. tracker or calorimeter).
+ */
+ IMPL::LCCollectionVec* createCollectionVec(G4VHitsCollection* hitCollection, SensitiveDetector::EType sensitiveDetectorType);
+
+ /**
+ * Create an output collection of LCIO tracker hits.
+ * @param[in] The input TrackerHit collection.
+ */
+ IMPL::LCCollectionVec* createTrackerCollectionVec(G4VHitsCollection* hitCollection);
+
+ /**
+ * Create an output collection of LCIO caloriemter hits.
+ * @param[in] The input CalorimeterHit collection.
+ */
+ IMPL::LCCollectionVec* createCalorimeterCollectionVec(G4VHitsCollection* hitCollection);
+
+ /**
+ * Save the CalorimeterHits into the output LCIO collection.
+ * @param[in]
+ *
+ */
+ void saveHits(CalorimeterHitsCollection* calorimeterHits, IMPL::LCCollectionVec* collection);
+
+ /**
+ * Save TrackerHits to a collection.
+ * @param[in] trackerHits The TrackerHits to add.
+ * @param[out] collection The target collection.
+ */
+ void saveHits(TrackerHitsCollection* trackerHits, IMPL::LCCollectionVec* collection);
+
+ /**
+ * Create a SimCalorimeterHit from a CalorimeterHit.
+ * @param[in] calorimeterHit The source CalorimeterHit.
+ * @return The output SimCalorimeterHit.
+ */
+ IMPL::SimCalorimeterHitImpl* createHit(CalorimeterHit* calorimeterHit);
+
+ /**
+ * Create a SimTrackerHit from a TrackerHit.
+ * @param[in] trackerHit The input TrackerHit.
+ * @return The output SimTrackerHit.
+ */
+ IMPL::SimTrackerHitImpl* createHit(TrackerHit* trackerHit);
+
+ /**
+ * Copy MCParticle hit contributions from a CalorimeterHit to a SimCalorimeterHit.
+ * @param[in] calorimeterHit The CalorimeterHit with the contributions.
+ * @param[out] simCalorimeterHit The SimCalorimeterHit to update.
+ */
+ void addParticleContributions(CalorimeterHit* calorimeterHit, IMPL::SimCalorimeterHitImpl* simCalorimeterHit);
+
+ /**
+ * Set default CalorimeterHit flag settings. This is called from this classe's constructor.
+ */
+ void setFlagDefaults();
+
+ /**
+ * Combine hit contributions using track IDs.
+ * @param[in] allContributions The full hit contribution list.
+ * @param[out] combinedContributions The hit contributions grouped by track ID.
+ */
+ void combineMcpHitContribs(const HitContributionList& allContributions, HitContributionList& combinedContributions);
+
+ /**
+ * Find a single hit contribution by track ID within the combined list.
+ * @param[in] trackID The track ID.
+ * @param[in] contributions The hit contribution list to search.
+ * @return The matching HitContribution or null if there are none.
+ */
+ HitContribution* findHitContribution(int trackID, HitContributionList& contributions);
+
+ /**
+ * Set the endcap flag depending on the type of the sensitive detector.
+ * @param[in] sensitiveDetector The SensitiveDetector.
+ */
+ void setEndcapFlag(SensitiveDetector* sensitiveDetector);
+
+ /**
+ * Check if an event contains a named collection.
+ * @param[in] event The LCEvent to search.
+ * @param[in] name The name of the collection.
+ * @return True if the LCEvent contains a collection with given name; false if not.
+ */
+ static bool containsCollection(EVENT::LCEvent* event, const std::string& name);
private:
- // current Lcio event
- EVENT::LCEvent* m_currentLCEvent;
+ // current Lcio event
+ EVENT::LCEvent* m_currentLCEvent;
- // current G4 event
- const G4Event* m_currentG4Event;
+ // current G4 event
+ const G4Event* m_currentG4Event;
- // default flags
- IMPL::LCFlagImpl m_trkCollFlag;
- IMPL::LCFlagImpl m_calCollFlag;
+ // default flags
+ IMPL::LCFlagImpl m_trkCollFlag;
+ IMPL::LCFlagImpl m_calCollFlag;
- // store momentum
- bool m_storeMomentum;
+ // store momentum
+ bool m_storeMomentum;
- // ptr to Lcio Mcp manager for lkp of Mcp data
- LcioMcpManager* m_mcpManager;
+ // ptr to Lcio Mcp manager for lkp of Mcp data
+ LcioMcpManager* m_mcpManager;
};
}
slic/include
diff -u -r1.61 -r1.62
--- LcioManager.hh 1 Jul 2013 21:01:30 -0000 1.61
+++ LcioManager.hh 6 Nov 2013 00:23:35 -0000 1.62
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioManager.hh,v 1.61 2013/07/01 21:01:30 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioManager.hh,v 1.62 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMANAGER_HH
#define SLIC_LCIOMANAGER_HH 1
@@ -44,187 +44,332 @@
/**
* @class LcioManager
- * @brief Singleton manager class of Lcio file operations.
- * @note This class is the top-level instantiator of other
- * Lcio singleton managers and helper classes.
+ * @brief Singleton manager class of LCIO configuration and output file operations.
+ * @note This class is the top-level instantiator of most other LCIO-related managers
+ * and helper classes.
*/
class LcioManager: public Module, public Singleton<LcioManager> {
public:
- enum EFileExistsAction {
- eInvalid = -1, eFail = 0, eDelete = 1, eAppend = 2
- };
-
- typedef unsigned int RunNumberType;
+ /**
+ * Enum for setting what action to take when an output LCIO file already exists.
+ */
+ enum EFileExistsAction {
+ eInvalid = -1, eFail = 0, eDelete = 1, eAppend = 2
+ };
+
+ /**
+ * Typedef for run number.
+ */
+ typedef unsigned int RunNumberType;
public:
- virtual ~LcioManager();
-
- //static LcioManager* instance();
- LcioManager();
+ /**
+ * Class constructor.
+ */
+ LcioManager();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LcioManager();
public:
- // open file from mvar vals
- void openLcioFile();
-
- // path and filename
- void setPath(const std::string& path);
- void setFilename(const std::string& filename);
- void setAutonameFields(const std::vector<std::string>& fields);
-
- const std::string& getPath() const;
- const std::string& getFilename() const;
-
- // get path + filename; arg == true to include ".slcio" extension
- std::string getFullOutputPath(bool withExtension = false);
-
- // convert to file exists setting from a string
- static EFileExistsAction getFileExistsActionFromString(const std::string& fea);
-
- void setRunNumber(RunNumberType rnt);
-
- // run actions
- void beginRun(const G4Run*);
- void endRun(const G4Run*);
-
- // create the LCEvent
- IMPL::LCEventImpl* createLCEvent(const G4Event* anEvent);
- IMPL::LCEventImpl* createLCEvent();
-
- // 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);
-
- // set the current LCEvent
- void setCurrentLCEvent(IMPL::LCEventImpl* anLCEvent) {
- m_currentLCEvent = anLCEvent;
- }
- IMPL::LCEventImpl* getCurrentLCEvent() {
- return m_currentLCEvent;
- }
-
- void setStoreMomentum(bool s = true) {
- m_HCBuilder->setStoreMomentum(s);
- }
-
- void setFileExistsAction(EFileExistsAction fea) {
- if (fea == eInvalid) {
+ /**
+ * Open the output LCIO file.
+ */
+ void openLcioFile();
+
+ /**
+ * Set the output path.
+ */
+ void setPath(const std::string& path);
+
+ /**
+ * Set the output file name, which will be appended to the path.
+ */
+ void setFilename(const std::string& filename);
+
+ /**
+ * Set the list of fields to use for output file autonaming.
+ */
+ void setAutonameFields(const std::vector<std::string>& fields);
+
+ /**
+ * Get the output path for the LCIO files.
+ * @return The output path for the LCIO files.
+ */
+ const std::string& getPath() const;
+
+ /**
+ * Get the output file name.
+ * @return The output file path.
+ */
+ const std::string& getFilename() const;
+
+ /**
+ * Get the path plus the filename and optionally include the extension.
+ * @param[in] withExtension Whether or not to include the file extension.
+ * @return The full output file path.
+ */
+ std::string getFullOutputPath(bool withExtension = false);
+
+ /**
+ * Get the FileExists enum value from a string.
+ * @param[in] fileExists The file exists string.
+ * @return The file exists action from the string.
+ */
+ static EFileExistsAction getFileExistsActionFromString(const std::string& fileExists);
+
+ /**
+ * Set the current run number.
+ * @param[in] runNumber The run number.
+ */
+ void setRunNumber(RunNumberType runNumber);
+
+ /**
+ * Begin of run hook.
+ * @param[in] run The run.
+ */
+ void beginRun(const G4Run* run);
+
+ /**
+ * End of run hook.
+ * @param[in] run The run.
+ */
+ void endRun(const G4Run* run);
+
+ /**
+ * Create the LCEvent from the G4Event.
+ * @param[in] anEvent The input G4Event.
+ * @return The output LCEvent.
+ */
+ IMPL::LCEventImpl* createLCEvent(const G4Event* anEvent);
+
+ /**
+ * Create the LCEvent from the current G4Event.
+ * @return The LCEvent.
+ */
+ IMPL::LCEventImpl* createLCEvent();
+
+ /**
+ * Create the final output particle collction.
+ */
+ void createFinalMcpCollection();
+
+ /**
+ * Add a collection to the LCEvent.
+ * @param[in] lcsevent The LCEvent.
+ * @param[in] collection The collection.
+ * @param[in] name The name of the collection.
+ */
+ void addCollection(EVENT::LCEvent* lcevent, EVENT::LCCollection* collection, const std::string& name);
+
+ /**
+ * Add a collection the current LCEvent.
+ * @param[in] The collection.
+ */
+ void addCollection(EVENT::LCCollection* collection, const std::string& name);
+
+ /**
+ * Add the initial particle collection.
+ */
+ void addInitialMCParticleCollection();
+
+ /**
+ * End of event hook to write out an LCIO file.
+ * @param[in] The physics event.
+ */
+ void endEvent(const G4Event* anEvent);
+
+ /**
+ * Set the current output LCIO event.
+ * @param[in] anLCEvent The LCIO event.
+ */
+ void setCurrentLCEvent(IMPL::LCEventImpl* anLCEvent) {
+ m_currentLCEvent = anLCEvent;
+ }
+
+ /**
+ * Get the current LCEvent.
+ * @return The current LCEvent.
+ */
+ IMPL::LCEventImpl* getCurrentLCEvent() {
+ return m_currentLCEvent;
+ }
+
+ /**
+ * Set whether to store momentum in output hits.
+ * @param[in] s Setting for storing momentum in output hits.
+ */
+ void setStoreMomentum(bool s = true) {
+ m_HCBuilder->setStoreMomentum(s);
+ }
+
+ /**
+ * Set the file exists action.
+ * @param[in] fea The file exists action.
+ */
+ void setFileExistsAction(EFileExistsAction fea) {
+ if (fea == eInvalid) {
#ifdef SLIC_LOG
- log() << LOG::error << "Invalid setting for FileExistsAction." << LOG::done;
+ log() << LOG::error << "Invalid setting for FileExistsAction." << LOG::done;
#endif
- return;
- }
+ return;
+ }
- m_fileExistsAction = fea;
- }
+ m_fileExistsAction = fea;
+ }
- EFileExistsAction getFileExistsAction() {
- return m_fileExistsAction;
- }
-
- inline LcioPrimaryGenerator* getGenerator() {
- return m_eventGenerator;
- }
-
- inline LcioMcpManager* getMcpManager() {
- return m_mcpManager;
- }
-
- inline LcioHitsCollectionBuilder* getHCBuilder() {
- return m_HCBuilder;
- }
-
- inline LcioFileNamer* getFileNamer() {
- return m_namer;
- }
-
- void enableDumpEvent(bool p = true) {
- m_enableDumpEvent = p;
- }
+ /**
+ * Get the file exists action.
+ * @return The file exists action.
+ */
+ EFileExistsAction getFileExistsAction() {
+ return m_fileExistsAction;
+ }
+
+ /**
+ * Get the LCIO generator.
+ * @return The LCIO generator.
+ */
+ inline LcioPrimaryGenerator* getGenerator() {
+ return m_eventGenerator;
+ }
+
+ /**
+ * Get the MCParticle manager.
+ * @return The MCParticle manager.
+ */
+ inline LcioMcpManager* getMcpManager() {
+ return m_mcpManager;
+ }
+
+ /**
+ * Get the LcioHitsCollectionBuilder for creating output hit collections.
+ * @return The LcioHitsCollectionBuilder.
+ */
+ inline LcioHitsCollectionBuilder* getHCBuilder() {
+ return m_HCBuilder;
+ }
+
+ /**
+ * Get the LcioFileNamer for automatically naming output files.
+ * @return The LcioFileNamer for naming output files.
+ */
+ inline LcioFileNamer* getFileNamer() {
+ return m_namer;
+ }
+
+ /**
+ * Enable dump event output for debugging.
+ * @param[in] The dump event setting.
+ */
+ void enableDumpEvent(bool p = true) {
+ m_enableDumpEvent = p;
+ }
private:
- void makeAutoname();
-
- // add HCs using builder and current ptrs
- void createHitsCollections();
-
- // LCWriter
- void createWriter();
- void deleteWriter();
-
- // run header
- void createRunHeader(const G4Run*);
- void deleteRunHeader();
-
- // set detector tag in LCIO output header
- void setDetectorName();
-
- // set timestamp
- void setEventTimeStamp();
-
- // add actives detectors from LCDD parser into the LCIO header
- void addActiveSubdetectors();
-
- // reset cached instance vars
- void reset();
+ /**
+ * Make the LCIO output file name using the LcioFileNamer.
+ */
+ void makeAutoname();
+
+ /**
+ * Create the hits collections using the current set of objects.
+ */
+ void createHitsCollections();
+
+ /**
+ * Create the output LCWriter.
+ */
+ void createWriter();
+
+ /**
+ * Delete the current LCWriter.
+ */
+ void deleteWriter();
+
+ /**
+ * Create the run header from the Geant4 run.
+ * @param[in] run The Geant4 run.
+ */
+ void createRunHeader(const G4Run* run);
+
+ /**
+ * Delete the current run header.
+ */
+ void deleteRunHeader();
+
+ /**
+ * Set the detector name in the current run header.
+ */
+ void setDetectorName();
+
+ /**
+ * Set the time stamp in the current event header.
+ */
+ void setEventTimeStamp();
+
+ /**
+ * Add the list of active subdetectors into the event header.
+ */
+ void addActiveSubdetectors();
+
+ /**
+ * Reset the instance variables of this class.
+ */
+ void reset();
private:
- // final Mcp collection with all info from McpInitial, Trajectories, Primaries
- IMPL::LCCollectionVec* m_McpFinalColl;
+ // final Mcp collection with all info from McpInitial, Trajectories, Primaries
+ IMPL::LCCollectionVec* m_McpFinalColl;
- // writer
- IO::LCWriter* m_writer;
+ // writer
+ IO::LCWriter* m_writer;
- // run header
- IMPL::LCRunHeaderImpl* m_runHdr;
+ // run header
+ IMPL::LCRunHeaderImpl* m_runHdr;
- // file info
- std::string m_filename;
- std::string m_path;
+ // file info
+ std::string m_filename;
+ std::string m_path;
- // Mcp manager
- LcioMcpManager* m_mcpManager;
+ // Mcp manager
+ LcioMcpManager* m_mcpManager;
- // event generator from MCP Coll
- LcioPrimaryGenerator* m_eventGenerator;
+ // event generator from MCP Coll
+ LcioPrimaryGenerator* m_eventGenerator;
- // creation of HCs
- LcioHitsCollectionBuilder* m_HCBuilder;
+ // creation of HCs
+ LcioHitsCollectionBuilder* m_HCBuilder;
- // current LCEvent
- IMPL::LCEventImpl* m_currentLCEvent;
+ // current LCEvent
+ IMPL::LCEventImpl* m_currentLCEvent;
- // messenger
- LcioMessenger* m_messenger;
+ // messenger
+ LcioMessenger* m_messenger;
- // action when file exists
- EFileExistsAction m_fileExistsAction;
+ // action when file exists
+ EFileExistsAction m_fileExistsAction;
- // starting run number
- RunNumberType m_runNumber;
+ // starting run number
+ RunNumberType m_runNumber;
- LcioFileNamer* m_namer;
+ LcioFileNamer* m_namer;
- static std::string m_defaultFileName;
- std::vector<std::string> m_currentAutonameFields;
+ static std::string m_defaultFileName;
+ std::vector<std::string> m_currentAutonameFields;
- bool m_enableDumpEvent;
- bool m_writerIsOpen;
- bool m_usingAutoname;
- //bool m_abortCurrentRun;
+ bool m_enableDumpEvent;
+ bool m_writerIsOpen;
+ bool m_usingAutoname;
+ //bool m_abortCurrentRun;
};
}
slic/include
diff -u -r1.10 -r1.11
--- LcioMcpFactory.hh 27 Nov 2012 19:32:18 -0000 1.10
+++ LcioMcpFactory.hh 6 Nov 2013 00:23:35 -0000 1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpFactory.hh,v 1.10 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpFactory.hh,v 1.11 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPFACTORY_HH
#define SLIC_LCIOMCPFACTORY_HH 1
@@ -27,70 +27,148 @@
class LcioMcpFactory: public Module {
public:
- LcioMcpFactory(LcioMcpManager*);
- virtual ~LcioMcpFactory();
-public:
+ /**
+ * Class constructor.
+ * @param[in] manager The LcioMcpManager used for particle utilities.
+ */
+ LcioMcpFactory(LcioMcpManager* manager);
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LcioMcpFactory();
- // create new, blank Mcp coll
- EVENT::LCCollection* createEmptyMcpCollection(const std::string& collName, bool errorOnExist = true);
+public:
- // chooses to create from initial or traj cont
- void createFinalMcpCollection(const G4Event* event);
+ /**
+ * Create a new, empty MCParticle collection.
+ * @param[in] collectionName The name of the collection.
+ * @param[in] errorOnExists Whether to throw an error if the collection already exists (otherwise will overwrite).
+ * @return The new, empty LCCollection.
+ */
+ EVENT::LCCollection* createEmptyMcpCollection(const std::string& collectionName, bool errorOnExist = true);
+
+ /**
+ * Create the final MCParticle output collection from the event.
+ * @param[in] event The current Geant4 event.
+ */
+ void createFinalMcpCollection(const G4Event* event);
private:
- // use StdHep-generated mcpVec to create final mcpVec for an event
- void createFinalMcpCollectionFromInitial(EVENT::LCCollection* mcpVecInitial);
-
- // These two functions create the Mcp coll from trajectories only in case of G4 GPS or gun
- void createFinalMcpCollectionFromTrajectoryContainer(G4TrajectoryContainer* trjCont);
-
- /* Create Mcp daughters of a trajectory with the given track ID. */
- void addMcpDaughtersFromTrajectoryContainer(IMPL::MCParticleImpl* parMcp, int parTrkID);
-
- // create an Mcp from a trajectory only
- IMPL::MCParticleImpl* createMcpFromTrajectory(Trajectory*);
-
- // create Mcps recursively given an initial Mcp
- IMPL::MCParticleImpl* createMcpFromInitialRecurse(EVENT::MCParticle* mcp);
-
- // create an Mcp from another, associated initial Mcp only
- IMPL::MCParticleImpl* createMcpFromInitialOnly(EVENT::MCParticle* mcpInit);
-
- // create an Mcp from a G4PrimaryParticle
- IMPL::MCParticleImpl* createMcpFromPrimary(G4PrimaryParticle*, EVENT::MCParticle*);
-
- // create an Mcp from primary and input Mcp
- IMPL::MCParticleImpl* createMcpFromInitialAndPrimary(G4PrimaryParticle* primary,
- EVENT::MCParticle* mcpInit);
-
- // create an Mcp from a trajectory and an input Mcp
- IMPL::MCParticleImpl* createMcpFromInitialAndTrajectory(Trajectory*, EVENT::MCParticle* mcpInit);
-
- // create an Mcp from a G4PrimaryParticle, shallow copy only
- IMPL::MCParticleImpl* createMcpFromPrimaryShallowCopy(G4PrimaryParticle*);
-
- // create new Mcp and shallow copy from input Mcp
- IMPL::MCParticleImpl* createMcpShallowCopy(EVENT::MCParticle* mcp);
-
- // create and add MCP daughters based on G4PrimaryParticle and associated MCP from StdHep
- void createDaughtersFromPrimary(G4PrimaryParticle* primary, EVENT::MCParticle* mcpInit,
- IMPL::MCParticleImpl* mcpPar);
-
- // add daughters to a MCP based on associated intial MCP from StdHep
- void addMcpDaughtersFromInitial(IMPL::MCParticleImpl* mcpNew, EVENT::MCParticle* mcpInit);
-
- void fillMcpEndPointEnergy(IMPL::LCCollectionVec* mcpColl);
-
-#if LCIO_VERSION_GE(1, 60)
- void copySpinAndColorFlow(EVENT::MCParticle* mcp1, EVENT::MCParticle* mcp2);
-#endif
+ /**
+ * Create the final MCParticle vector for an event using the MCParticle vector
+ * from the StdHep input.
+ * @param[in] mcpVecInitial The initial LCIO MCParticle collection.
+ */
+ void createFinalCollectionFromInitial(EVENT::LCCollection* mcpVecInitial);
+
+ /**
+ * Create the output MCParticle collection using trajectory data only.
+ * @param[in] trajectories The trajectory container.
+ */
+ void createFinalCollectionFromTrajectories(G4TrajectoryContainer* trajectories);
+
+ /**
+ * Create the MCParticle daughters of a trajectory that has the given track ID.
+ * @param[in] parentParticle The parent MCParticle.
+ * @param[in] parentID The parent's track ID.
+ */
+ void createDaughters(IMPL::MCParticleImpl* parentParticle, int parentID);
+
+ /**
+ * Create an MCParticle from a trajectory only.
+ * @param[in] The trajectory.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* fromTrajectory(Trajectory* trajectory);
+
+ /**
+ * Create MCParticles recursively given an initial starting particle.
+ * @param[in] The start point for creating daughter particles recursively.
+ * @return The initial top particle with daughters added.
+ */
+ IMPL::MCParticleImpl* fromInitialRecurse(EVENT::MCParticle* particle);
+
+ /**
+ * Create an MCParticle from an initial MCParticle, only.
+ * @param[in] mcpInit The initial MCParticle.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* fromInitialOnly(EVENT::MCParticle* mcpInit);
+
+ /**
+ * Create an MCParticle from a G4PrimaryParticle.
+ * @param[in] The input G4PrimaryParticle.
+ * @param[in] The corresponding initial MCParticle.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* fromPrimary(G4PrimaryParticle* primary, EVENT::MCParticle* particle);
+
+ /**
+ * Create an MCParticle from a G4PrimaryParticle and associated, initial MCParticle.
+ * @param[in] primary The input G4PrimaryParticle.
+ * @param[in] initial The associated initial MCParticle.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* fromInitialAndPrimary(G4PrimaryParticle* primary, EVENT::MCParticle* initial);
+
+ /**
+ * Create an MCParticle from a trajectory and an input MCParticle.
+ * @param[in] trajectory The G4Trajectory.
+ * @param[in] initial The initial, associated MCParticle.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* fromInitialAndTrajectory(Trajectory* trajectory, EVENT::MCParticle* initial);
+
+ /**
+ * Create an MCParticle from a G4PrimaryParticle via shallow copy, e.g. daughters are not created automatically.
+ * @param[in] The G4PrimaryParticle.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* fromPrimaryShallowCopy(G4PrimaryParticle* primary);
+
+ /**
+ * Shallow copy an MCParticle.
+ * @param[in] particle The MCParticle to copy.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* shallowCopy(EVENT::MCParticle* particle);
+
+ /**
+ * Create the daughter MCParticles from the G4PrimaryParticle and initial MCParticle
+ * and add them to the parent.
+ * @param[in] primary The starting G4PrimaryParticle.
+ * @param[in] initial The associated, initial MCParticle.
+ */
+ void daughtersFromPrimary(G4PrimaryParticle* primary, EVENT::MCParticle* initial, IMPL::MCParticleImpl* mcpPar);
+
+ /**
+ * Add daughters to an MCParticle based on the associated initial MCParticle.
+ * @param[in] newParticle The new MCParticle to be updated.
+ * @param[in] initialParticle The initial MCParticle containing daughter information.
+ */
+ void addDaughtersFromInitial(IMPL::MCParticleImpl* newParticle, EVENT::MCParticle* initialParticle);
+
+ /**
+ * Create an LCGenericObject collection with MCParticle endpoint energies.
+ * The order will match that of the MCParticle collection.
+ * @param[in] particleCollection The MCParticle collection.
+ */
+ void fillEndPointEnergy(IMPL::LCCollectionVec* particleCollection);
+
+ /**
+ * Copy spin and color flow information from one particle to another.
+ * @param[in] sourceParticle The input MCParticle.
+ * @param[out] targetParticle The output MCParticle with updated spin and color flow information.
+ */
+ void copySpinAndColorFlow(EVENT::MCParticle* sourceParticle, EVENT::MCParticle* targetParticle);
private:
- LcioMcpManager* m_manager;
- IMPL::LCCollectionVec* m_finalColl;
- G4TrajectoryContainer* m_currentTrajectoryContainer;
+ LcioMcpManager* m_manager;
+ IMPL::LCCollectionVec* m_finalColl;
+ G4TrajectoryContainer* m_currentTrajectoryContainer;
};
}
slic/include
diff -u -r1.8 -r1.9
--- LcioMcpFilter.hh 27 Nov 2012 19:32:18 -0000 1.8
+++ LcioMcpFilter.hh 6 Nov 2013 00:23:35 -0000 1.9
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpFilter.hh,v 1.8 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpFilter.hh,v 1.9 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPFILTER_HH
#define SLIC_LCIOMCPFILTER_HH 1
@@ -21,19 +21,48 @@
public:
- LcioMcpFilter();
- virtual ~LcioMcpFilter();
+ /**
+ * Class constructor.
+ */
+ LcioMcpFilter();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LcioMcpFilter();
public:
- EVENT::LCCollection* filterSimParticles(EVENT::LCCollection* mcpColl);
- IMPL::MCParticleImpl* makeMcp(EVENT::MCParticle* mcp, EVENT::LCCollection* mcpColl);
- void addSimDaughters(EVENT::MCParticle* mcp, EVENT::MCParticle* parMcp, EVENT::LCCollection* mcpColl);
-
- bool wasAdded(EVENT::MCParticle* mcp);
+ /**
+ * Create a new MCParticle collection with only generator particles included.
+ * @param[in] inputCollection The input MCParticle collection.
+ * @return The filtered, output collection.
+ */
+ EVENT::LCCollection* filterSimParticles(EVENT::LCCollection* inputCollection);
+
+ /**
+ * Create a new MCParticle and add it to the target collection, unless it was already added.
+ * @param[in] particle The input MCParticle to be copied.
+ * @param[out] targetCollection The collection to be updated.
+ * @return The new MCParticle.
+ */
+ IMPL::MCParticleImpl* makeParticle(EVENT::MCParticle* particle, EVENT::LCCollection* targetCollection);
+
+ /**
+ * Add simulation daughters from a parent particle to the target.
+ * @param[out] targetParticle The target particle to update.
+ * @param[in] parentParticle The source particle with the daughters.
+ */
+ void addSimDaughters(EVENT::MCParticle* targetParticle, EVENT::MCParticle* parentParticle, EVENT::LCCollection* mcpColl);
+
+ /**
+ * Check if a particle was already added to the list.
+ * @return True if particle is already in list; false if not.
+ */
+ bool wasAdded(EVENT::MCParticle* particle);
private:
- std::vector<EVENT::MCParticle*> m_mcpList;
+ std::vector<EVENT::MCParticle*> m_mcpList;
};
}
slic/include
diff -u -r1.56 -r1.57
--- LcioMcpManager.hh 27 Nov 2012 19:32:18 -0000 1.56
+++ LcioMcpManager.hh 6 Nov 2013 00:23:35 -0000 1.57
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpManager.hh,v 1.56 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpManager.hh,v 1.57 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPMANAGER_HH
#define SLIC_LCIOMCPMANAGER_HH 1
@@ -42,117 +42,188 @@
class LcioMcpManager: public Module, public Singleton<LcioMcpManager> {
public:
- // Mcp collections
- typedef std::map<std::string, EVENT::LCCollection*> McpCollectionMap;
+ // Mcp collections
+ typedef std::map<std::string, EVENT::LCCollection*> McpCollectionMap;
public:
- virtual ~LcioMcpManager();
- LcioMcpManager();
+ virtual ~LcioMcpManager();
+ LcioMcpManager();
public:
- // action at end of event
- void endEvent(const G4Event* anEvent);
-
- /*
- * Create an empty MCParticle collection indexed by collName.
- * SIDE EFFECT: Automatically registers collection into the map.
- */
- EVENT::LCCollection* createMcpCollection(const std::string& collName);
-
- /**
- * Get the MCP collection generated from StdHep.
- * Creates empty collection if doesn't exist.
- */
- EVENT::LCCollection* getInitialMcpCollection();
-
- /**
- * Get the MCP collection generated at EndOfEvent.
- * Creates empty collection if doesn't exist.
- */
- EVENT::LCCollection* getFinalMcpCollection();
-
- void setMinimumTrackingDistance(double minDist);
- double getMinimumTrackingDistance();
-
- // reset the manager at the end of event
- void reset();
-
- // set initial mcp coll externally
- void setInitialMcpCollection(EVENT::LCCollection* mcpColl);
-
- /* Register an LCCollection object containing MCParticles, by name. */
- void registerMcpCollection(const std::string& collName, EVENT::LCCollection*);
-
- /* Find the first MCParticle coll in the LCevent. */
- EVENT::LCCollection* findMcpCollection(EVENT::LCEvent* event);
-
- /* Find a registered MCParticle coll. */
- EVENT::LCCollection* findMcpCollection(const std::string& collName);
-
- /* Print utility functions, using the LcioMcpPrinter. */
- void printMcpCollection(const std::string& collName);
- void printMcpCollection(const std::string& collName, EVENT::LCCollection* coll);
-
- /* Get the MCParticle data maps. */
- LcioMcpMaps* getMaps();
-
- void enablePrintFinal(bool p = true);
- void enablePrintInitial(bool p = true);
-
- void beginEvent(const G4Event* anEvent);
-
- double getNoChargeFlag() const;
-
- inline void setWriteInitialMCParticleCollection(bool b) {
- m_writeInitialMCParticleCollection = b;
- }
-
- inline bool writeInitialMCParticleCollection() {
- return m_writeInitialMCParticleCollection;
- }
-
- int getMCParticleIndex(EVENT::LCCollection*, EVENT::MCParticle*);
-
- // delete the initial collection
- void deleteInitialMcpCollection();
+ /**
+ * End of event hook.
+ * @param[in] anEvent The event.
+ */
+ void endEvent(const G4Event* anEvent);
+
+ /**
+ * Get the MCParticle collection generated that was generated from an input StdHep event.
+ * This will create an empty collection if it does not exist.
+ * @return The MCParticle collection from the input StdHep event.
+ */
+ EVENT::LCCollection* getInitialMcpCollection();
+
+ /**
+ * Get the MCP collection generated at EndOfEvent.
+ * Creates empty collection if doesn't exist.
+ */
+ EVENT::LCCollection* getFinalMcpCollection();
+
+ /**
+ * Set the minimum tracking distance for creating G4PrimaryParticles and G4PrimaryVertex objects
+ * during event generation.
+ * @param[in] minimumTrackingDistance The minimum tracking distance.
+ */
+ void setMinimumTrackingDistance(double minimumTrackingDistance);
+
+ /**
+ * Get the minimum tracking distance.
+ * @return The minimum tracking distance.
+ */
+ double getMinimumTrackingDistance();
+
+ /**
+ * Reset the manager's state. To be called after done processing a single event.
+ */
+ void reset();
+
+ /**
+ * Set the initial MCParticle collection created from event generation.
+ * @param[in] initialCollection The initial MCParticle collection.
+ */
+ void setInitialMcpCollection(EVENT::LCCollection* initialCollection);
+
+ /**
+ * Register by name an LCCollection containing MCParticles.
+ * @param[in] name The name of the collection.
+ * @param[in] collection The collection to register.
+ */
+ void registerMcpCollection(const std::string& name, EVENT::LCCollection* collection);
+
+ /**
+ * Find the first MCParticle collection in the LCevent.
+ * @param[in] event The LCEvent to search.
+ * @return The found collection or null if not found.
+ */
+ EVENT::LCCollection* findParticleCollection(EVENT::LCEvent* event);
+
+ /*
+ * Find a registered MCParticle collection by name.
+ * @param[in] name The name of the collection to find.
+ * @return The found collection or null if not found.
+ */
+ EVENT::LCCollection* findParticleCollection(const std::string& name);
+
+ /**
+ * Using the LcioMcpPrinter, print out the named collection from the current event.
+ * @param[in] name The name of the collection to print out.
+ */
+ void printMcpCollection(const std::string& name);
+
+ /**
+ * Using the LcioMcpPrinter, print out the named collection from the current event.
+ * @param[in] name The name of the collection to print out.
+ */
+ void printMcpCollection(const std::string& collName, EVENT::LCCollection* coll);
+
+ /**
+ * Get the MCParticle data maps.
+ * @return The MCParticle maps.
+ */
+ LcioMcpMaps* getMaps();
+
+ /**
+ * Enable printing of the final MCParticle collection.
+ * @param[in] p The enable setting.
+ */
+ void enablePrintFinal(bool p = true);
+
+ /**
+ * Enable printing of the initial MCParticle collection.
+ * @param[in] p The enable setting.
+ */
+ void enablePrintInitial(bool p = true);
+
+ /**
+ * Begin of event hook.
+ * @param[in] anEvent The event.
+ */
+ void beginEvent(const G4Event* anEvent);
+
+ /**
+ * Set whether to write out the initial MCParticle collection to the event
+ * as a supplementary collection.
+ * @param[in] b Set to true in order to write this collection; false to not write.
+ */
+ inline void setWriteInitialMCParticleCollection(bool b) {
+ m_writeInitialMCParticleCollection = b;
+ }
+
+ /**
+ * Get whether to write out the intial MCParticle collection to the event.
+ * @return True if initial MCParticle collection will be written; false if not.
+ */
+ inline bool writeInitialMCParticleCollection() {
+ return m_writeInitialMCParticleCollection;
+ }
+
+ /**
+ * Get the index of a particle in a collection or -1 if not present.
+ * @param[in] collection The LCCollection to search.
+ * @param[in] particle The MCParticle to find.
+ * @return The index of the MCParticle or -1 if not found.
+ */
+ int getParticleIndex(EVENT::LCCollection* collection, EVENT::MCParticle* particle);
private:
- // clear the maps
- void clearMaps();
+ /**
+ * Delete the current, initial MCParticle collection.
+ */
+ void deleteInitialMcpCollection();
+
+ /*
+ * Create an empty MCParticle collection indexed by name and register it in the map.
+ * @param[in] name The name of the collection.
+ * @return The new MCParticle collection.
+ */
+ EVENT::LCCollection* createParticleCollection(const std::string& name);
+
+ // clear the maps
+ void clearMaps();
private:
- // current LCEvent
- IMPL::LCEventImpl* m_currentLCEvent;
+ // current LCEvent
+ IMPL::LCEventImpl* m_currentLCEvent;
- // printer for MCP debugging
- LcioMcpPrinter* m_printer;
+ // printer for MCP debugging
+ LcioMcpPrinter* m_printer;
- // user settings
- double m_vertexIsNotEndpointOfParentTolerance;
- double m_minimumTrackingDistance;
+ // user settings
+ double m_vertexIsNotEndpointOfParentTolerance;
+ double m_minimumTrackingDistance;
- // G4 messenger for Mcp handling
- LcioMcpMessenger* m_messenger;
+ // G4 messenger for Mcp handling
+ LcioMcpMessenger* m_messenger;
- // map of Mcp colls being tracked by the manager
- McpCollectionMap m_mcpColls;
+ // map of Mcp colls being tracked by the manager
+ McpCollectionMap m_mcpColls;
- /* Factory for creating MCParticles from Geant4 runtime data. */
- LcioMcpFactory* m_factory;
+ /* Factory for creating MCParticles from Geant4 runtime data. */
+ LcioMcpFactory* m_factory;
- /* Collection of maps with MCParticle information. */
- LcioMcpMaps* m_maps;
+ /* Collection of maps with MCParticle information. */
+ LcioMcpMaps* m_maps;
- bool m_enablePrintFinal;
- bool m_enablePrintInitial;
- bool m_writeInitialMCParticleCollection;
+ bool m_enablePrintFinal;
+ bool m_enablePrintInitial;
+ bool m_writeInitialMCParticleCollection;
public:
- static const double m_NAN;
- static const double DEFAULT_MIN_TRACKING_DISTANCE;
+ static const double m_NAN;
+ static const double DEFAULT_MIN_TRACKING_DISTANCE;
};
}
slic/include
diff -u -r1.7 -r1.8
--- LcioMcpMaps.hh 27 Nov 2012 19:32:18 -0000 1.7
+++ LcioMcpMaps.hh 6 Nov 2013 00:23:35 -0000 1.8
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpMaps.hh,v 1.7 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpMaps.hh,v 1.8 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPMAPS_HH
#define SLIC_LCIOMCPMAPS_HH 1
@@ -32,56 +32,123 @@
class LcioMcpMaps: public Module {
public:
- LcioMcpMaps(LcioMcpManager*);
+
+ /**
+ * Class constructor.
+ * @param[in] particleManager The MCParticle Manager.
+ */
+ LcioMcpMaps(LcioMcpManager* particleManager);
+
+ /**
+ * Class destructor.
+ */
virtual ~LcioMcpMaps();
public:
- // track to Mcp
+ /**
+ * Map of track IDs to MCParticle.
+ */
typedef std::map<G4int, IMPL::MCParticleImpl*> TrackToMcpMap;
- // Mcp to primary particle
+ /**
+ * Map of MCParticle to G4PrimaryParticle.
+ */
typedef std::map<EVENT::MCParticle*, G4PrimaryParticle*> McpToPrimaryMap;
- // initial Mcp from StdHep to final Mcp
+ /**
+ * Map of initial MCParticle from StdHep to final MCParticle.
+ */
typedef std::map<EVENT::MCParticle*, IMPL::MCParticleImpl*> InitMcpToMcpMap;
public:
- // connect an initial Mcp to a primary
- void addMcpToPrimaryLink(EVENT::MCParticle* mcp, G4PrimaryParticle* primary);
-
- // connect track to MCParticle via track ID
- void addTrackIDToMcpLink(G4int trkID, IMPL::MCParticleImpl* mcp);
-
- // connect initial Mcp to final Mcp
- void addInitialMcpToFinalMcpLink(EVENT::MCParticle* mcpInit, IMPL::MCParticleImpl* mcpFinal);
-
- // find an MCParticle from the trackID
- IMPL::MCParticleImpl* findMcpFromTrackID(G4int trkID) const;
-
- /* Find the trackID for the final MCParticle. */
- G4int findTrackIDFromFinalMcp(EVENT::MCParticle*) const;
-
- // find matching primary particle given an MCP ptr
- G4PrimaryParticle* findPrimaryFromMcp(EVENT::MCParticle* mcp) const;
-
- // loop over input collection to find matching Mcp primary for this trajectory
- EVENT::MCParticle* findPrimaryInitialMcpFromTrajectory(Trajectory* trj) const;
-
- // find a dau Mcp given a G4PrimaryParticle dau
- EVENT::MCParticle* findDaughterMcpFromPrimary(EVENT::MCParticle* mcpInit,
- G4PrimaryParticle* primary) const;
-
- // given an input particle from stdhep, find the proper output particle
- IMPL::MCParticleImpl* findFinalParticleFromInitial(EVENT::MCParticle* mcpInit) const;
-
- // print maps
+ /**
+ * Map an initial MCParticle to a G4PrimaryParticle.
+ * @param[in] particle The MCParticle.
+ * @param[in] primary The G4PrimaryParticle.
+ */
+ void addParticleToPrimary(EVENT::MCParticle* particle, G4PrimaryParticle* primary);
+
+ /**
+ * Map a track ID to an MCParticle.
+ * @param[in] trackID The track ID.
+ * @param[in] particle The MCParticle.
+ */
+ void addTrackToMCParticle(G4int trackID, IMPL::MCParticleImpl* particle);
+
+ /**
+ * Map an initial MCParticle to a final output MCParticle.
+ * @param[in] initial The initial MCParticle.
+ * @param[in] final The final MCParticle.
+ */
+ void addInitialParticleToFinal(EVENT::MCParticle* initial, IMPL::MCParticleImpl* final);
+
+ /**
+ * Find an MCParticle from the associated trackID.
+ * @param[in] trackID The track ID.
+ * @return The MCParticle or null if not found.
+ */
+ IMPL::MCParticleImpl* findParticle(G4int trackID) const;
+
+ /**
+ * Find a trackID from a final MCParticle.
+ * @param[in] particle The final MCParticle.
+ * @return The track ID or -1 if not found.
+ */
+ G4int findTrack(EVENT::MCParticle* particle) const;
+
+ /**
+ * Find a G4PrimaryParticle from an MCParticle.
+ * @param[in] particle The MCParticle.
+ * @return The G4PrimaryParticle or null if not found.
+ */
+ G4PrimaryParticle* findPrimary(EVENT::MCParticle* particle) const;
+
+ /**
+ * Find an MCParticle from a Trajectory.
+ * @param[in] trajectory The Trajectory.
+ * @return The MCParticle or null if not found.
+ */
+ EVENT::MCParticle* findInitialParticle(Trajectory* trajectory) const;
+
+ /**
+ * Find a daughter MCParticle given a G4PrimaryParticle daughter.
+ * @param[in] initial The parent particle.
+ * @param[in] primary The G4PrimaryParticle daughter.
+ * @return The primary daughter or null if does not exist.
+ */
+ EVENT::MCParticle* findDaughterParticle(EVENT::MCParticle* initial, G4PrimaryParticle* primary) const;
+
+ /**
+ * Find a final, output MCParticle given an initial, input MCParticle.
+ * @param[in] initialParticle The intitial MCParticle.
+ */
+ IMPL::MCParticleImpl* findFinalParticle(EVENT::MCParticle* initialParticle) const;
+
+ /**
+ * Print out all the maps.
+ */
void printMaps();
- void printTrackToMcpMap();
- void printMcpToPrimaryMap();
- void printInitMcpToMcpMap();
+ /**
+ * Print the track to particle map.
+ */
+ void printTracksToParticles();
+
+ /**
+ * Print the particle to primary map.
+ */
+ void printParticlesToPrimaries();
+
+ /**
+ * Print the intial to final MCParticle map.
+ */
+ void printInitialParticleToFinal();
+
+ /**
+ * Clear the maps.
+ */
void clear();
private:
slic/include
diff -u -r1.11 -r1.12
--- LcioMcpMessenger.hh 27 Nov 2012 19:32:18 -0000 1.11
+++ LcioMcpMessenger.hh 6 Nov 2013 00:23:35 -0000 1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpMessenger.hh,v 1.11 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpMessenger.hh,v 1.12 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPMESSENGER_HH
#define SLIC_LCIOMCPMESSENGER_HH 1
@@ -13,18 +13,37 @@
namespace slic {
/**
- @class LcioMcpMessenger
- @brief G4UImessenger to LcioMcpManager.
+ * @class LcioMcpMessenger
+ * @brief G4UImessenger for LcioMcpManager.
*/
class LcioMcpMessenger: public G4UImessenger {
+
public:
+
+ /**
+ * Class constructor.
+ */
LcioMcpMessenger();
+
+ /**
+ * Class destructor.
+ */
virtual ~LcioMcpMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ /**
+ * Execute a macro command.
+ * @param[in] command The command to execute.
+ * @param[in] newValues The arguments.
+ */
+ virtual void SetNewValue(G4UIcommand* command, G4String newValues);
private:
+
+ /**
+ * Define the commands handled by this messenger.
+ */
void defineCommands();
private:
slic/include
diff -u -r1.20 -r1.21
--- LcioMcpPrinter.hh 26 Jun 2013 01:57:02 -0000 1.20
+++ LcioMcpPrinter.hh 6 Nov 2013 00:23:35 -0000 1.21
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpPrinter.hh,v 1.20 2013/06/26 01:57:02 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpPrinter.hh,v 1.21 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPPRINTER_HH
#define SLIC_LCIOMCPPRINTER_HH 1
@@ -21,47 +21,121 @@
class LcioMcpPrinter: public Module {
public:
- typedef std::vector<int> IdxVec;
+ /**
+ * List of indices.
+ */
+ typedef std::vector<int> IndexVector;
public:
+ /**
+ * Class constructor.
+ */
LcioMcpPrinter();
+
+ /**
+ * Class destructor.
+ */
virtual ~LcioMcpPrinter();
public:
- void printMcpCollection(const std::string& collName, EVENT::LCCollection* coll);
-
-protected:
-
- /* Print from member vars */
- void printMcpCollection();
-
- /* Print a single MCParticle line */
- void printMcp(EVENT::MCParticle* mcp);
-
- // str conv
- static std::string makeDoubleArray3String(const double*);
- static std::string makeFloatArray3String(const float*);
- static std::string makeSimStatusCodesString(EVENT::MCParticle* mcp);
- static std::string makeIdxVecString(const IdxVec&);
+ /**
+ * Print out an MCParticle collection.
+ * @param[in] name The name of the collection.
+ * @param[in] collection The LCCollection containing MCParticle objects.
+ */
+ void printParticleCollection(const std::string& name, EVENT::LCCollection* collection);
- IdxVec findDaughterIndices(EVENT::MCParticle* mcp);
- IdxVec findParentIndices(EVENT::MCParticle* mcp);
-
- // index of a particle (-1 for not found)
- int findMcpIndex(EVENT::MCParticle* mcp);
+private:
- // formatting chunks
+ /**
+ * Print current MCParticle collection.
+ */
+ void printParticleCollection();
+
+ /*
+ * Print information for a single MCParticle.
+ */
+ void printParticle(EVENT::MCParticle* particle);
+
+ /**
+ * Make a string from a double array of length 3.
+ * @param[in] array The double array.
+ * @return The string.
+ */
+ static std::string makeDoubleArray3String(const double* array);
+
+ /**
+ * Make a string from a float array of length 3.
+ * @param[in] array The float array.
+ * @return The string.
+ */
+ static std::string makeFloatArray3String(const float* array);
+
+ /**
+ * Make a string from the status codes of an MCParticle.
+ * @param[in] particle The MCParticle.
+ * @return The list of status codes converted to a string.
+ */
+ static std::string makeSimStatusCodesString(EVENT::MCParticle* particle);
+
+ /**
+ * Make a string from a vector of indices.
+ * @param[in] indices The IndexVector.
+ * @return The list of indices converted to a string.
+ */
+ static std::string makeIndexVectorString(const IndexVector& indices);
+
+ /**
+ * Get the indices of an MCParticle's daughters.
+ * @param[in] particle The MCParticle.
+ * @return The vector of indices.
+ */
+ IndexVector findDaughterIndices(EVENT::MCParticle* particle);
+
+ /**
+ * Get the indices of an MCParticle's parents.
+ * @param[in] particle The MCParticle.
+ * @return The vector of indices.
+ */
+ IndexVector findParentIndices(EVENT::MCParticle* particle);
+
+ /**
+ * Find the index of a particle.
+ * @param[in] particle The MCParticle.
+ * @return The index of the MCParticle or -1 if not found.
+ */
+ int findParticleIndex(EVENT::MCParticle* particle);
+
+ /**
+ * Insert a field separator.
+ */
inline void sep();
+
+ /**
+ * Insert a new line.
+ */
inline void line();
+
+ /**
+ * Print the header.
+ */
inline void head();
+
+ /**
+ * Print the footer.
+ */
inline void foot();
- // column labels
+ /**
+ * Print the column labels.
+ */
void colLabels();
- // flag labels
+ /**
+ * Print the status flag labels.
+ */
void flagLabels();
public:
slic/include
diff -u -r1.6 -r1.7
--- LcioMcpStatusSetter.hh 27 Nov 2012 19:32:18 -0000 1.6
+++ LcioMcpStatusSetter.hh 6 Nov 2013 00:23:35 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpStatusSetter.hh,v 1.6 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpStatusSetter.hh,v 1.7 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPSTATUSSETTER_HH
#define SLIC_LCIOMCPSTATUSSETTER_HH 1
@@ -17,21 +17,61 @@
* objects.
*/
class LcioMcpStatusSetter {
+
private:
+
+ /**
+ * Class constructor, which is private because this class is all static utility methods.
+ */
LcioMcpStatusSetter() {
}
public:
- // set Mcp status codes from trajectory
- static IMPL::MCParticleImpl* setMcpStatusCodesFromTrajectory(Trajectory*, IMPL::MCParticleImpl*);
- static void setGeneratorStatus(EVENT::MCParticle* mcpInit, IMPL::MCParticleImpl* mcp);
+
+ /**
+ * Set the status codes on an MCParticle from a Trajectory.
+ * @param[in] trajectory The particle Trajectory.
+ * @param[in] particle The MCParticle on which to set status codes.
+ * @return The same MCParticle with status codes set.
+ */
+ static IMPL::MCParticleImpl* setStatusCodesFromTrajectory(Trajectory* trajectory, IMPL::MCParticleImpl* particle);
+
+ /**
+ * Set the generator status on a final MCParticle from the associated initial.
+ * @param[in] initialParticle The initial MCParticle.
+ * @param[in,out] finalParticle The output MCParticle with generator status set.
+ */
+ static void setGeneratorStatus(EVENT::MCParticle* initialParticle, IMPL::MCParticleImpl* finalParticle);
private:
- // check and set MCP flags
- static void setVertexIsNotEndpointOfParentFlag(Trajectory*, IMPL::MCParticleImpl*);
- static void setFinalStatusFlags(Trajectory*, IMPL::MCParticleImpl*);
- static void setCreatedInSimulationFlag(Trajectory*, IMPL::MCParticleImpl*);
- static void setBackscatterFlag(Trajectory*, IMPL::MCParticleImpl*);
+
+ /**
+ * Set the final flag values on an
+ * @param[in] trajectory The Trajectory.
+ * @param[in,out] particle The MCParticle on which statuses will be set.
+ */
+ static void setFinalStatusFlags(Trajectory* trajectory, IMPL::MCParticleImpl* particle);
+
+ /**
+ * Set the vertex is not endpoint of parent flag on an MCParticle from Trajectory data.
+ * @param[in] trajectory The Trajectory.
+ * @param[in,out] particle The MCParticle.
+ */
+ static void setVertexIsNotEndpointOfParentFlag(Trajectory* trajectory, IMPL::MCParticleImpl* particle);
+
+ /**
+ * Set the created in simulation flag on an MCParticle from Trajectory data.
+ * @param[in] trajectory The Trajectory.
+ * @param[in,out] particle The MCParticle.
+ */
+ static void setCreatedInSimulationFlag(Trajectory* trajectory, IMPL::MCParticleImpl* particle);
+
+ /**
+ * Set the backscatter flag on an MCParticle from Trajectory data.
+ * @param[in] trajectory The Trajectory.
+ * @param[in] particle The MCParticle.
+ */
+ static void setBackscatterFlag(Trajectory* trajectory, IMPL::MCParticleImpl* particle);
};
}
slic/include
diff -u -r1.6 -r1.7
--- LcioMcpUtil.hh 27 Nov 2012 19:32:18 -0000 1.6
+++ LcioMcpUtil.hh 6 Nov 2013 00:23:35 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioMcpUtil.hh,v 1.6 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMcpUtil.hh,v 1.7 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMCPUTIL_HH
#define SLIC_LCIOMCPUTIL_HH
@@ -10,6 +10,7 @@
#include "globals.hh"
namespace slic {
+
/**
* @class LcioMcpUtil
* @brief Static MCParticle utility functions.
@@ -17,16 +18,35 @@
class LcioMcpUtil {
private:
+
+ /**
+ * Class constructor, which is private because this class is all static utility functions.
+ */
LcioMcpUtil() {
}
public:
- // distance computation based on Mcp 3vect positions
- static G4double computeMcpDistance(IMPL::MCParticleImpl*, IMPL::MCParticleImpl*);
+ /**
+ * Compute the distance between the starting vertices of two MCParticle objects.
+ * @param[in] particle1 The first MCParticle.
+ * @param[in] particle2 The second MCParticle.
+ * @return The distance in millimeters between the two particle's starting vertices.
+ */
+ static G4double computeParticleDistance(IMPL::MCParticleImpl* particle1, IMPL::MCParticleImpl* particle2);
+
+ /**
+ * Compute the distance between two points represented as double arrays.
+ * @param[in] v1 The first vertex.
+ * @param[in] v2 The second vertex.
+ * @return The distance in millimeters between the two vertices.
+ */
static G4double computeDistance(const double *v1, const double *v2);
- // Mcp with no parents
+ /**
+ * Check if an MCParticle is a primary, e.g. it has no parent particle.
+ * @return True if MCParticle is primary; false if not.
+ */
static bool isPrimary(IMPL::MCParticleImpl* mcp);
};
}
slic/include
diff -u -r1.22 -r1.23
--- LcioMessenger.hh 27 Nov 2012 19:32:18 -0000 1.22
+++ LcioMessenger.hh 6 Nov 2013 00:23:35 -0000 1.23
@@ -1,9 +1,9 @@
-// $Header: /cvs/lcd/slic/include/LcioMessenger.hh,v 1.22 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioMessenger.hh,v 1.23 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOMESSENGER_HH
#define SLIC_LCIOMESSENGER_HH 1
-// G4
+// Geant4
#include "G4UImessenger.hh"
class G4UIcommand;
@@ -12,23 +12,40 @@
class G4UIdirectory;
namespace slic {
+
class LcioManager;
/**
* @class LcioMessenger
- * @brief G4UIcommand class for Lcio commands.
+ * @brief G4UIcommand class for LCIO commands.
*/
class LcioMessenger: public G4UImessenger {
public:
+
+ /**
+ * Class constructor.
+ */
LcioMessenger(LcioManager* mgr);
+
+ /**
+ * Class destructor.
+ */
virtual ~LcioMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+ /**
+ * Execute a macro command.
+ * @param[in] command The macro command.
+ * @param[in] newValues The command arguments.
+ */
+ virtual void SetNewValue(G4UIcommand* command, G4String newValues);
private:
+ /**
+ * Define the commands handled by this messenger.
+ */
void defineCommands();
private:
slic/include
diff -u -r1.17 -r1.18
--- LcioPrimaryGenerator.hh 27 Nov 2012 19:32:18 -0000 1.17
+++ LcioPrimaryGenerator.hh 6 Nov 2013 00:23:35 -0000 1.18
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/LcioPrimaryGenerator.hh,v 1.17 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/LcioPrimaryGenerator.hh,v 1.18 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_LCIOPRIMARYGENERATOR_HH
#define SLIC_LCIOPRIMARYGENERATOR_HH
@@ -22,26 +22,54 @@
/**
@class LcioPrimaryGenerator
- @brief Generates G4PrimaryParticles from an Lcio MCParticle tree.
+ @brief Generates G4PrimaryParticles from an LCIO MCParticle tree.
*/
class LcioPrimaryGenerator: public Module {
public:
- typedef std::map<EVENT::MCParticle*, G4PrimaryParticle*> McpToPrimaryMap;
+ typedef std::map<EVENT::MCParticle*, G4PrimaryParticle*> ParticleToPrimaryMap;
public:
- LcioPrimaryGenerator(LcioManager*);
- virtual ~LcioPrimaryGenerator();
+
+ /**
+ * Class constructor.
+ * @param[in] manager The LcioManager.
+ */
+ LcioPrimaryGenerator(LcioManager* manager);
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LcioPrimaryGenerator();
public:
- void generatePrimaryVertexFromMcpCollection(EVENT::LCCollection* mcpVec, G4Event* anEvent);
- G4PrimaryParticle* createPrimaryParticleFromMcp(IMPL::MCParticleImpl* mcp);
- G4PrimaryVertex* createPrimaryVertexFromMcp(IMPL::MCParticleImpl* mcp);
+ /**
+ * Create the G4Event structure from a collection of MCParticles.
+ * @param[in] particles The list of MCParticles.
+ * @param[in,out] anEvent The G4Event.
+ */
+ void generatePrimaryVertexFromMcpCollection(EVENT::LCCollection* particles, G4Event* anEvent);
+
+private:
+
+ /**
+ * Create the G4PrimaryParticle based on an input MCParticle.
+ * @param[in] particle The input MCParticle.
+ * @return The G4PrimaryParticle created from the MCParticle.
+ */
+ G4PrimaryParticle* createPrimaryParticle(IMPL::MCParticleImpl* particle);
+
+ /**
+ * Create a G4PrimaryVertex based on an itpu MCParticle.
+ * @param[in] particle The MCParticle.
+ * @return The G4PrimaryVertex created from the MCParticle.
+ */
+ G4PrimaryVertex* createPrimaryVertex(IMPL::MCParticleImpl* particle);
private:
- LcioManager* m_mgr;
- LcioMcpManager* m_mcpManager;
+ LcioManager* m_mgr;
+ LcioMcpManager* m_mcpManager;
};
}
slic/include
diff -u -r1.15 -r1.16
--- LogManager.hh 27 Nov 2012 19:32:18 -0000 1.15
+++ LogManager.hh 6 Nov 2013 00:23:35 -0000 1.16
@@ -1,25 +1,31 @@
#ifndef SLIC_LOGMANAGER_HH
#define SLIC_LOGMANAGER_HH 1
-// slic
+// SLIC
#include "LogStream.hh"
#include "LogMessenger.hh"
#include "Singleton.hh"
-// geant4
+// Geant4
#include "G4UIdirectory.hh"
-// stl
+// STL
#include <algorithm>
#include <vector>
#include <map>
namespace slic {
+
/**
- * Manages LogStreams and their associated LogMessenger objects.
+ * @class LogManager
+ *
+ * @brief Manages LogStreams and their associated LogMessenger objects.
+ *
+ * @note
* This class "owns" both LogStream and LogMessenger objects, so
* neither of these classes should be deleted outside of this class.
*
+ * @note
* LogManager and LogStream are both friends of each other.
*/
class LogManager: public Singleton<LogManager> {
@@ -46,11 +52,17 @@
public:
+ /**
+ * Class constructor.
+ */
LogManager() {
m_logDir = new G4UIdirectory("/log/");
m_logDir->SetGuidance("Commands for changing log output settings. [SLIC]");
}
+ /**
+ * Class destructor.
+ */
virtual ~LogManager() {
delete m_logDir;
}
@@ -59,8 +71,13 @@
/**
* Create a LogStream.
- */
- LogStream* createLog(std::string name = "NONE", LOG::ELevel level = LOG::okay, ostream* os = &std::cout) {
+ * @param[in] name The name of the LogStream.
+ * @param[in] level The log level.
+ * @param[in] os The output stream.
+ */
+ LogStream* createLog(std::string name = "NONE",
+ LOG::ELevel level = LOG::okay,
+ ostream* os = &std::cout) {
LogStream *l = new LogStream(name, level, os);
m_logs.push_back(l);
m_logNameMap[name] = l;
@@ -69,10 +86,13 @@
/**
* Create a LogStream and associated LogMessenger.
- */
-
- LogStream* createLogWithMessenger(std::string name = "NONE", LOG::ELevel level = LOG::okay, ostream* os =
- &std::cout) {
+ * @param[in] name The name of the LogStream.
+ * @param[in] level The log level.
+ * @param[in] os The output stream.
+ */
+ LogStream* createLogWithMessenger(std::string name = "NONE",
+ LOG::ELevel level = LOG::okay,
+ ostream* os = &std::cout) {
LogStream *l = createLog(name, level, os);
createLogMessenger(l);
return l;
@@ -80,6 +100,7 @@
/**
* Remove a LogStream and also its LogMessenger, if it exists.
+ * @param[in] log The LogStream to remove.
*/
void removeLog(LogStream *log) {
if (log == 0)
@@ -106,6 +127,8 @@
/**
* Create a LogMessenger attached to the given LogStream.
+ * @param[in] l The LogStream.
+ * @return The new LogMessenger assigned to the LogStream.
*/
LogMessenger* createLogMessenger(LogStream *l) {
// Check for and return an existing LogMessenger.
@@ -123,6 +146,7 @@
/**
* Remove a LogMessenger.
+ * @param lm The LogMessenger to remove.
*/
void removeLogMessenger(LogMessenger *lm) {
if (lm == 0)
@@ -136,6 +160,7 @@
/**
* Find a LogStream pointer by name.
+ * @param[in] name The name of the LogStream.
*/
LogStream* findLog(const std::string &name) {
return m_logNameMap[name];
@@ -143,6 +168,8 @@
/**
* Get position of LogStream by its pointer.
+ * @param[in] log The LogStream.
+ * @return An iterator pointing to the LogStream.
*/
LogListIterator findLog(LogStream *log) {
if (log == 0)
@@ -152,6 +179,8 @@
/**
* Find position of LogMessenger by its pointer.
+ * @param[in] lm The LogMessenger.
+ * @return An iterator pointing to the LogMessenger.
*/
LogMessengerListIterator findLogMessenger(LogMessenger *lm) {
if (lm == 0)
@@ -161,6 +190,8 @@
/**
* Find a LogMessenger by its associated LogStream.
+ * @param[in] s The LogStream.
+ * @return The LogMessenger or null if not found.
*/
LogMessenger* findLogMessenger(LogStream *s) {
return m_logMessengerMap[s];
slic/include
diff -u -r1.11 -r1.12
--- LogMessenger.hh 27 Nov 2012 19:32:18 -0000 1.11
+++ LogMessenger.hh 6 Nov 2013 00:23:35 -0000 1.12
@@ -1,4 +1,4 @@
-// $Id: LogMessenger.hh,v 1.11 2012/11/27 19:32:18 jeremy Exp $
+// $Id: LogMessenger.hh,v 1.12 2013/11/06 00:23:35 jeremy Exp $
#ifndef LOG_MESSENGER_HH
#define LOG_MESSENGER_HH 1
@@ -12,15 +12,38 @@
namespace slic {
class LogStream;
+/**
+ * @class LogMessenger
+ * @brief G4UImessenger assigned to a LogStream.
+ */
class LogMessenger: public G4UImessenger {
public:
+
+ /**
+ * Class constructor.
+ * @param[in] logstream The LogStream.
+ */
LogMessenger(LogStream* logstream);
+
+ /**
+ * Class destructor.
+ */
virtual ~LogMessenger();
public:
- void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ /**
+ * Execute macro command.
+ * @param[in] command The macro command.
+ * @param[in] newValues The argument values.
+ */
+ void SetNewValue(G4UIcommand* command, G4String newValues);
private:
+
+ /*
+ * Define commands handled by this messenger.
+ */
void defineCommands();
private:
slic/include
diff -u -r1.7 -r1.8
--- LogStream.hh 28 Nov 2012 23:08:03 -0000 1.7
+++ LogStream.hh 6 Nov 2013 00:23:35 -0000 1.8
@@ -1,10 +1,10 @@
#ifndef SLIC_LOGSTREAM_HH
#define SLIC_LOGSTREAM_HH 1
-// slic
+// SLIC
#include "TimeUtil.hh"
-// stl
+// STL
#include <iostream>
#include <fstream>
#include <iomanip>
@@ -19,29 +19,24 @@
namespace LOG {
+/**
+ * These are ios manipulators for this class.
+ */
enum EManip {
- done = 101,
- head = 102,
- time = 103,
- level = 104,
- name = 105,
- sep = 106,
- endl = 107
+ done = 101, head = 102, time = 103, level = 104, name = 105, sep = 106, endl = 107
};
+/**
+ * Log levels.
+ */
enum ELevel {
- none = 0,
- always = 1,
- fatal = 2,
- error = 3,
- warning = 4,
- okay = 5,
- verbose = 6,
- debug = 7,
- nlevels = 8
+ none = 0, always = 1, fatal = 2, error = 3, warning = 4, okay = 5, verbose = 6, debug = 7, nlevels = 8
};
}
+/**
+ * String representations of log levels.
+ */
static std::string levelNames[LOG::nlevels] = { "NONE", "ALWAYS", "FATAL", "ERROR", "WARNING", "OKAY", "VERBOSE", "DEBUG" };
namespace slic {
@@ -60,341 +55,570 @@
* is based on Gaudi's
* <a href="http://isscvs.cern.ch/cgi-bin/cvsweb.cgi/GaudiKernel/GaudiKernel/MsgStream.h?rev=1.41;content-type=text%2Fplain;cvsroot=Gaudi">MsgStream</a>
* class.
+ *
+ * For more information on the STL IO library see
+ * <a href="http://www.cplusplus.com/reference/iolibrary/">this reference page</a>.
*/
class LogStream {
protected:
- LogStream(std::string name, LOG::ELevel level, ostream* os = &std::cout) :
- m_name(name), m_outputLevel(level), m_currentMessageLevel(LOG::okay), m_os(os), m_active(true), m_fos(
- 0) {
- ;
- }
-
- LogStream() :
- m_name("NONE"), m_outputLevel(LOG::always), m_currentMessageLevel(LOG::okay), m_os(&std::cout), m_active(
- true), m_fos(0) {
- ;
- }
-
- virtual ~LogStream() {
- }
-
- // Give LogManager full access to protected constructors.
- friend class LogManager;
+ /**
+ * Class constructor.
+ * @param[in] name The name of the LogStream.
+ * @param[in] level The level of the logger.
+ * @param[in] os The output stream for printing message.
+ */
+ LogStream(std::string name, LOG::ELevel level, ostream* os = &std::cout) :
+ m_name(name), m_outputLevel(level), m_currentMessageLevel(LOG::okay), m_os(os), m_active(true), m_fos(0) {
+ ;
+ }
+
+ /**
+ * Class constructor providing default arguments.
+ */
+ LogStream() :
+ m_name("NONE"), m_outputLevel(LOG::always), m_currentMessageLevel(LOG::okay), m_os(&std::cout), m_active(true), m_fos(0) {
+ ;
+ }
+
+ /**
+ * Class destructor.
+ */
+ virtual ~LogStream() {
+ }
+
+ /**
+ * Give the LogManager full access to protected constructors.
+ */
+ friend class LogManager;
public:
- const std::string& getName() const {
- return m_name;
- }
-
- bool isActive() const {
- return m_active;
- }
-
- LOG::ELevel getOutputLevel() const {
- return m_outputLevel;
- }
-
- ostream& getOutputStream() const {
- return *m_os;
- }
-
- void setOutputLevel(const LOG::ELevel& outputLevel) {
- m_outputLevel = outputLevel;
- }
-
- LOG::ELevel getCurrentLevel() const {
- return m_currentMessageLevel;
- }
-
- void setCurrentLevel(LOG::ELevel level) {
- m_currentMessageLevel = level;
- }
-
- /**
- * Set the log level via streamer. Subsequent messages will be placed onto the LogStream if
- * the argument is less than or equal to the current output level. Otherwise they will be
- * discarded.
- */
- LogStream& operator <<(const LOG::ELevel& x) {
-
- //std::cout << "setting level: " << x << std::endl;
- //std::cout << "current level: " << getCurrentLevel() << std::endl;
-
- setCurrentLevel(x);
-
- //std::cout << "name: " << m_name << std::endl;
- //std::cout << "current level: " << getCurrentLevel() << std::endl;
- //std::cout << "output level: " << getOutputLevel() << std::endl;
- //std::cout << std::endl;
-
- if (getCurrentLevel() <= getOutputLevel()) {
- // Set active state.
- setActive(true);
- } else {
- // Set inactive state.
- setActive(false);
- }
- return *this;
- }
-
- LogStream& operator <<(const LOG::EManip& x) {
- if (isActive()) {
- // End of message.
- if (x == LOG::done) {
- getOutputStream() << std::endl;
- // Print full header info.
- } else if (x == LOG::head) {
- getOutputStream() << TimeUtil::getAscTime() << " :: " << levelNames[m_currentMessageLevel]
- << " :: " << getName() << " :: ";
- // Print current time.
- } else if (x == LOG::time) {
- getOutputStream() << TimeUtil::getAscTime();
- // Print current message level.
- } else if (x == LOG::level) {
- getOutputStream() << levelNames[m_currentMessageLevel];
- // Print logger name.
- } else if (x == LOG::name) {
- getOutputStream() << getName();
- } else if (x == LOG::sep) {
- getOutputStream() << " :: ";
- // Print end of line terminator.
- } else if (x == LOG::endl) {
- getOutputStream() << std::endl;
- }
- }
- return *this;
- }
-
- // Redirect to a file.
- void setOutputFile(const std::string& file) {
- ofstream* m_fos = new ofstream();
- m_fos->open(file.c_str(), ios::app | ios::out);
- m_os = m_fos;
- }
-
- LogStream& debug() {
- return *this << LOG::debug;
- }
-
- LogStream& verbose() {
- return *this << LOG::verbose;
- }
-
- LogStream& okay() {
- return *this << LOG::okay;
- }
-
- LogStream& warning() {
- return *this << LOG::warning;
- }
-
- LogStream& error() {
- return *this << LOG::error;
- }
-
- LogStream& fatal() {
- return *this << LOG::fatal;
- }
-
- LogStream& always() {
- return *this << LOG::always;
- }
-
- void log(const std::string& mesg, const LOG::ELevel& level) {
- (*this) << level << mesg << LOG::done;
- }
-
- void log(const std::string& mesg) {
- log(mesg, getOutputLevel());
- }
-
- void debug(const std::string& mesg) {
- log(mesg, LOG::debug);
- }
-
- void verbose(const std::string& mesg) {
- log(mesg, LOG::verbose);
- }
-
- void okay(const std::string& mesg) {
- log(mesg, LOG::okay);
- }
-
- void warning(const std::string& mesg) {
- log(mesg, LOG::warning);
- }
-
- void error(const std::string& mesg) {
- log(mesg, LOG::error);
- }
-
- void fatal(const std::string& mesg) {
- log(mesg, LOG::fatal);
- }
-
- void always(const std::string& mesg) {
- log(mesg, LOG::always);
- }
-
- LogStream& operator <<(const std::_Setiosflags &manip) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- LogStream& operator <<(const std::_Resetiosflags &manip) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- LogStream& operator <<(const std::_Setbase &manip) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- LogStream& operator <<(const std::_Setprecision &manip) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- LogStream& operator <<(const std::_Setw &manip) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- // Accept ios class modifiers.
- LogStream& operator <<(ios& (*manip)(std::ios&)) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- // Accept ios base class modifiers
- LogStream& operator <<(std::ios_base& (*manip)(std::ios_base&)) {
- if (isActive()) {
- getOutputStream() << manip;
- }
- return *this;
- }
-
- // Templated stream operator.
- template<typename T>
- LogStream& operator<<(const T& arg) {
- if (isActive()) {
- getOutputStream() << arg;
- }
- return *this;
- }
-
- // Specialization stream operator for vector<T>.
- template<typename T>
- LogStream& operator <<(const std::vector<T>& v) {
- if (isActive()) {
- for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i) {
- getOutputStream() << *i << " ";
- }
- }
- return *this;
- }
-
- //
- // Following are a bunch of methods for std::ios emulation.
- //
-
- int width() const {
- return isActive() ? getOutputStream().width() : 0;
- }
-
- int width(int v) {
- return isActive() ? getOutputStream().width(v) : 0;
- }
-
- long flags() const {
- return isActive() ? getOutputStream().flags() : 0;
- }
-
- long flags(std::ios_base::fmtflags v) {
- return isActive() ? getOutputStream().flags(v) : 0;
- }
-
- long setf(std::ios_base::fmtflags v) {
- return isActive() ? getOutputStream().setf(v) : 0;
- }
-
- char fill() const {
- return isActive() ? getOutputStream().fill() : -1;
- }
-
- char fill(char v) {
- return isActive() ? getOutputStream().fill(v) : -1;
- }
-
- int precision() const {
- return isActive() ? getOutputStream().precision() : 0;
- }
-
- int precision(int v) {
- return isActive() ? getOutputStream().precision(v) : 0;
- }
-
- int rdstate() const {
- return isActive() ? getOutputStream().rdstate() : std::ios_base::failbit;
- }
-
- int good() const {
- return isActive() ? getOutputStream().good() : 0;
- }
-
- int eof() const {
- return isActive() ? getOutputStream().eof() : 0;
- }
-
- int bad() const {
- return isActive() ? getOutputStream().bad() : 0;
- }
-
- long setf(std::ios_base::fmtflags _f, std::ios_base::fmtflags _m) {
- return isActive() ? getOutputStream().setf(_f, _m) : 0;
- }
-
- void unsetf(std::ios_base::fmtflags _l) {
- if (isActive()) {
- getOutputStream().unsetf(_l);
- }
- }
-
- void clear(std::ios_base::iostate _i = std::ios_base::failbit) {
- if (isActive()) {
- getOutputStream().clear(_i);
- }
- }
+ /**
+ * Get the name of the LogStream.
+ * @return The name of the LogStream.
+ */
+ const std::string& getName() const {
+ return m_name;
+ }
+
+ /**
+ * Get whether this LogStream is active or not.
+ * @return True if logstream is active; false if not.
+ */
+ bool isActive() const {
+ return m_active;
+ }
+
+ /**
+ * Get the output level which determines which messages will be shown.
+ * @return The output level.
+ */
+ LOG::ELevel getOutputLevel() const {
+ return m_outputLevel;
+ }
+
+ /**
+ * Set the output level.
+ * @param[in] outputLevel The output level.
+ */
+ void setOutputLevel(const LOG::ELevel& outputLevel) {
+ m_outputLevel = outputLevel;
+ }
+
+ /**
+ * Get the output stream.
+ * @return The output stream.
+ */
+ ostream& getOutputStream() const {
+ return *m_os;
+ }
+
+ /**
+ * Get the current log level for messages.
+ * @return The current log level.
+ */
+ LOG::ELevel getCurrentLevel() const {
+ return m_currentMessageLevel;
+ }
+
+ /**
+ * Set the current log level for messages.
+ * @param[in] level The log level.
+ */
+ void setCurrentLevel(LOG::ELevel level) {
+ m_currentMessageLevel = level;
+ }
+
+ /**
+ * Set the log level via streamer. Subsequent messages will be placed onto the LogStream if
+ * the level is less than or equal to the current output level. Otherwise they will be
+ * discarded.
+ * @param[in] level The log level.
+ * @return The current LogStream.
+ */
+ LogStream& operator <<(const LOG::ELevel& level) {
+
+ //std::cout << "setting level: " << level << std::endl;
+ //std::cout << "current level: " << getCurrentLevel() << std::endl;
+
+ setCurrentLevel(level);
+
+ //std::cout << "name: " << m_name << std::endl;
+ //std::cout << "current level: " << getCurrentLevel() << std::endl;
+ //std::cout << "output level: " << getOutputLevel() << std::endl;
+ //std::cout << std::endl;
+
+ if (getCurrentLevel() <= getOutputLevel()) {
+ // Set active state.
+ setActive(true);
+ } else {
+ // Set inactive state.
+ setActive(false);
+ }
+ return *this;
+ }
+
+ /**
+ * Handle ios manipulators for the LogStream.
+ * @param[in] x The ios manipulator.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(const LOG::EManip& x) {
+ if (isActive()) {
+ // End of message.
+ if (x == LOG::done) {
+ getOutputStream() << std::endl;
+ // Print full header info.
+ } else if (x == LOG::head) {
+ getOutputStream() << TimeUtil::getAscTime() << " :: " << levelNames[m_currentMessageLevel] << " :: " << getName() << " :: ";
+ // Print current time.
+ } else if (x == LOG::time) {
+ getOutputStream() << TimeUtil::getAscTime();
+ // Print current message level.
+ } else if (x == LOG::level) {
+ getOutputStream() << levelNames[m_currentMessageLevel];
+ // Print logger name.
+ } else if (x == LOG::name) {
+ getOutputStream() << getName();
+ } else if (x == LOG::sep) {
+ getOutputStream() << " :: ";
+ // Print end of line terminator.
+ } else if (x == LOG::endl) {
+ getOutputStream() << std::endl;
+ }
+ }
+ return *this;
+ }
+
+ /**
+ * Redirect the messages to a file.
+ * @param[in] file The file name.
+ */
+ void setOutputFile(const std::string& file) {
+ ofstream* m_fos = new ofstream();
+ m_fos->open(file.c_str(), ios::app | ios::out);
+ m_os = m_fos;
+ }
+
+ /**
+ * Set the current level to debug.
+ * @return The LogStream.
+ */
+ LogStream& debug() {
+ return *this << LOG::debug;
+ }
+
+ /**
+ * Set the current level to verbose.
+ * @return The LogStream.
+ */
+ LogStream& verbose() {
+ return *this << LOG::verbose;
+ }
+
+ /**
+ * Set the current level to okay.
+ * @return The LogStream.
+ */
+ LogStream& okay() {
+ return *this << LOG::okay;
+ }
+
+ /**
+ * Set the current level to warning.
+ * @return The LogStream.
+ */
+ LogStream& warning() {
+ return *this << LOG::warning;
+ }
+
+ /**
+ * Set the current level to error.
+ * @return The LogStream.
+ */
+ LogStream& error() {
+ return *this << LOG::error;
+ }
+
+ /**
+ * Set the current level to fatal.
+ * @return The LogStream.
+ */
+ LogStream& fatal() {
+ return *this << LOG::fatal;
+ }
+
+ /**
+ * Set the current level to always.
+ * @return The LogStream.
+ */
+ LogStream& always() {
+ return *this << LOG::always;
+ }
+
+ /**
+ * Log a message at a certain level.
+ * @param[in] mesg The message contents.
+ * @param[in] level The log level.
+ */
+ void log(const std::string& message, const LOG::ELevel& level) {
+ (*this) << level << message << LOG::done;
+ }
+
+ /**
+ * Log a message at the current level (NOT output level).
+ * @param[in] mesg The message.
+ */
+ void log(const std::string& mesg) {
+ log(mesg, getOutputLevel());
+ }
+
+ /**
+ * Log a message at debug level.
+ * @param[in] mesg The message.
+ */
+ void debug(const std::string& mesg) {
+ log(mesg, LOG::debug);
+ }
+
+ /**
+ * Log a message at verbose level.
+ * @param[in] mesg The message.
+ */
+ void verbose(const std::string& mesg) {
+ log(mesg, LOG::verbose);
+ }
+
+ /**
+ * Log a message at okay level.
+ * @param[in] mesg The message.
+ */
+ void okay(const std::string& mesg) {
+ log(mesg, LOG::okay);
+ }
+
+ /**
+ * Log a message at warning level.
+ * @param[in] mesg The message.
+ */
+ void warning(const std::string& mesg) {
+ log(mesg, LOG::warning);
+ }
+
+ /**
+ * Log a message at error level.
+ * @param[in] mesg The message.
+ */
+ void error(const std::string& mesg) {
+ log(mesg, LOG::error);
+ }
+
+ /**
+ * Log a message at fatal level.
+ * @param[in] mesg The message.
+ */
+ void fatal(const std::string& mesg) {
+ log(mesg, LOG::fatal);
+ }
+
+ /**
+ * Log a message at always level.
+ * @param[in] mesg The message.
+ */
+ void always(const std::string& mesg) {
+ log(mesg, LOG::always);
+ }
+
+ /**
+ * Handle STL Setiosflags manipulator.
+ * @param[in] The ios manipulator.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(const std::_Setiosflags &manip) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Handle STL Resetiosflags manipulator.
+ * @param[in] The ios manipulator.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(const std::_Resetiosflags &manip) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Handle STL Setbase manipulator.
+ * @param[in] The ios manipulator.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(const std::_Setbase &manip) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Handle STL Setprecision manipulator.
+ * @param[in] The ios manipulator.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(const std::_Setprecision &manip) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Handle STL Setw manipulator.
+ * @param[in] The ios manipulator.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(const std::_Setw &manip) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Handle ios class modifiers.
+ * @param[in] manip The ios class modifier.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(ios& (*manip)(std::ios&)) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Handle ios base class modifiers.
+ * @param[in] manip The ios base class modifier.
+ * @return The LogStream.
+ */
+ LogStream& operator <<(std::ios_base& (*manip)(std::ios_base&)) {
+ if (isActive()) {
+ getOutputStream() << manip;
+ }
+ return *this;
+ }
+
+ /**
+ * Templated stream operator.
+ * @param[in] arg The templated argument.
+ * @return The LogStream.
+ */
+ template<typename T>
+ LogStream& operator<<(const T& arg) {
+ if (isActive()) {
+ getOutputStream() << arg;
+ }
+ return *this;
+ }
+
+ /**
+ * Specialization stream operator for vectors.
+ * @param[in] v The input vector.
+ * @return The LogStream.
+ */
+ template<typename T>
+ LogStream& operator <<(const std::vector<T>& v) {
+ if (isActive()) {
+ for (typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); ++i) {
+ getOutputStream() << *i << " ";
+ }
+ }
+ return *this;
+ }
+
+ /**
+ * Get the current width setting.
+ * @param[in] The width setting.
+ */
+ int width() const {
+ return isActive() ? getOutputStream().width() : 0;
+ }
+
+ /**
+ * Set the current width.
+ * @param[in] The width setting.
+ * @return The new width setting.
+ */
+ int width(int v) {
+ return isActive() ? getOutputStream().width(v) : 0;
+ }
+
+ /**
+ * Get the current set of flags.
+ * @return The current set of ios formatting flags.
+ */
+ long flags() const {
+ return isActive() ? getOutputStream().flags() : 0;
+ }
+
+ /**
+ * Set the formatting flags.
+ * @param[in] v The formatting flags.
+ * @return The current set of formatting flags.
+ */
+ long flags(std::ios_base::fmtflags v) {
+ return isActive() ? getOutputStream().flags(v) : 0;
+ }
+
+ /**
+ * Set the formatting flags.
+ * @param[in] v The formatting flags.
+ * @return The current set of formatting flags.
+ */
+ long setf(std::ios_base::fmtflags v) {
+ return isActive() ? getOutputStream().setf(v) : 0;
+ }
+
+ /**
+ * Get the fill char.
+ * @return The fill char.
+ */
+ char fill() const {
+ return isActive() ? getOutputStream().fill() : -1;
+ }
+
+ /**
+ * Set the fill char.
+ * @param
+ * @return The new fill char.
+ */
+ char fill(char v) {
+ return isActive() ? getOutputStream().fill(v) : -1;
+ }
+
+ /**
+ * Get the precision.
+ * @return The precision.
+ */
+ int precision() const {
+ return isActive() ? getOutputStream().precision() : 0;
+ }
+
+ /**
+ * Set the precision.
+ * @param[in] v The precision.
+ * @return The new precision.
+ */
+ int precision(int v) {
+ return isActive() ? getOutputStream().precision(v) : 0;
+ }
+
+ /**
+ * Get the read state.
+ * @return The read state.
+ */
+ int rdstate() const {
+ return isActive() ? getOutputStream().rdstate() : std::ios_base::failbit;
+ }
+
+ /**
+ * Return 0 if no error bits are set.
+ * @return The good state.
+ */
+ int good() const {
+ return isActive() ? getOutputStream().good() : 0;
+ }
+
+ /**
+ * Return zero if EOF has not been reached; otherwise return non-zero.
+ * @return The EOF state.
+ */
+ int eof() const {
+ return isActive() ? getOutputStream().eof() : 0;
+ }
+
+ /**
+ * Return non-zero if error bits are set; otherwise return zero.
+ * @return The bad state.
+ */
+ int bad() const {
+ return isActive() ? getOutputStream().bad() : 0;
+ }
+
+ /**
+ * Set the format flags.
+ * @param[in] _f The format flags.
+ * @param[in] _m The mask containing the flags to be modified.
+ * @return The new format flags.
+ */
+ long setf(std::ios_base::fmtflags _f, std::ios_base::fmtflags _m) {
+ return isActive() ? getOutputStream().setf(_f, _m) : 0;
+ }
+
+ /**
+ * Clears the format flags selected by the mask.
+ * @param[in] _l The mask specifying which format flags to clear.
+ */
+ void unsetf(std::ios_base::fmtflags _l) {
+ if (isActive()) {
+ getOutputStream().unsetf(_l);
+ }
+ }
+
+ /**
+ * Set a new value for the internal error state flags.
+ * @param[in] _i The new error state flag value.
+ */
+ void clear(std::ios_base::iostate _i = std::ios_base::failbit) {
+ if (isActive()) {
+ getOutputStream().clear(_i);
+ }
+ }
private:
- void setActive(bool active) {
- m_active = active;
- }
+ /**
+ * Set whether this LogStream is active.
+ * @param[in] active The setting for enabling this LogStream to print messages.
+ */
+ void setActive(bool active) {
+ m_active = active;
+ }
private:
- std::string m_name;
- LOG::ELevel m_outputLevel;
- LOG::ELevel m_currentMessageLevel;
- ostream* m_os;
- bool m_active;
- std::ofstream* m_fos;
+ std::string m_name;
+ LOG::ELevel m_outputLevel;
+ LOG::ELevel m_currentMessageLevel;
+ ostream* m_os;
+ bool m_active;
+ std::ofstream* m_fos;
};
}
slic/include
diff -u -r1.12 -r1.13
--- Module.hh 27 Nov 2012 19:32:18 -0000 1.12
+++ Module.hh 6 Nov 2013 00:23:35 -0000 1.13
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/Module.hh,v 1.12 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/Module.hh,v 1.13 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_MODULE_HH
#define SLIC_MODULE_HH 1
@@ -18,6 +18,7 @@
class G4Track;
namespace slic {
+
/**
* @class Module
* @brief Base class for slic code modules that provides common functionality,
@@ -25,97 +26,157 @@
*/
class Module {
public:
- enum ModuleStatus {
- eOkay = 0, eNotInitialized = 1, eBadState = 2, eFatalError = 3
- };
+ enum ModuleStatus {
+ eOkay = 0, eNotInitialized = 1, eBadState = 2, eFatalError = 3
+ };
protected:
- /**
- * Only concrete Module subclasses can access the constructor.
- */
- Module(const std::string& name, bool deleteOnExit = true, bool autoRegister = true);
+ /**
+ * Class constructor. Only subclasses can access this.
+ * @param[in] name The name of the Module.
+ * @param[in] deleteOnExit Whether to call delete on this Module.
+ * @param[in] autoRegister Whether to automatically register this Module with the ModuleRegistry.
+ */
+ Module(const std::string& name, bool deleteOnExit = true, bool autoRegister = true);
public:
- virtual ~Module();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~Module();
public:
- const std::string& getName() const {
- return m_name;
- }
-
- ModuleStatus getStatus() const {
- return m_status;
- }
-
- virtual void initialize() {
- ;
- }
-
- virtual void reset() {
- ;
- }
-
- virtual void cleanup() {
- ;
- }
-
- bool deleteOnExit() {
- return m_deleteOnExit;
- }
-
- LogStream& log() {
- return *m_log;
- }
-
- virtual void beginEvent(const G4Event*) {
- ;
- }
-
- virtual void endEvent(const G4Event*) {
- ;
- }
-
- virtual void beginRun(const G4Run*) {
- ;
- }
-
- virtual void endRun(const G4Run*) {
- ;
- }
-
- virtual void preTracking(const G4Track*) {
- ;
- }
-
- virtual void postTracking(const G4Track*) {
- ;
- }
-
- virtual void stepping(const G4Step*) {
- ;
- }
-
- G4ClassificationOfNewTrack stackingClassifyNewTrack(const G4Track*) {
- G4Exception("", "", FatalException, "This method should be overridden.");
- // Arbitrary return value. Will never reach here.
- return fWaiting;
- }
-
- void stackingNewStage() {
- ;
- }
-
- void stackingPrepareNewEvent() {
- ;
- }
+ /**
+ * Get the name of the module.
+ * @return The name of the module.
+ */
+ const std::string& getName() const {
+ return m_name;
+ }
+
+ /**
+ * Get the status of the module as a ModuleStatus enum.
+ * @return The module's status.
+ */
+ ModuleStatus getStatus() const {
+ return m_status;
+ }
+
+ /**
+ * Perform initialization.
+ */
+ virtual void initialize() {
+ ;
+ }
+
+ /**
+ * Reset the state of the module.
+ */
+ virtual void reset() {
+ ;
+ }
+
+ /**
+ * Cleaup the module before deletion.
+ */
+ virtual void cleanup() {
+ ;
+ }
+
+ /**
+ * Get whether to delete the module.
+ * @return Return true if the module should be deleted; false if not.
+ */
+ bool deleteOnExit() {
+ return m_deleteOnExit;
+ }
+
+ /**
+ * Get the LogStream for this Module.
+ * @return The Module's LogStream.
+ */
+ LogStream& log() {
+ return *m_log;
+ }
+
+ /**
+ * Begin of event hook.
+ * @param[in] event The G4Event.
+ */
+ virtual void beginEvent(const G4Event* event) {
+ ;
+ }
+
+ /**
+ * End of event hook.
+ * @param[in] event The G4Event.
+ */
+ virtual void endEvent(const G4Event* event) {
+ ;
+ }
+
+ /**
+ * Begin of run hook.
+ * @param[in] run The G4Run.
+ */
+ virtual void beginRun(const G4Run* run) {
+ ;
+ }
+
+ /**
+ * End run hook.
+ * @param[in] run The G4Run.
+ */
+ virtual void endRun(const G4Run* run) {
+ ;
+ }
+
+ /**
+ * Pre-tracking hook called for new G4Track objects.
+ * @param[in] track The G4Track.
+ */
+ virtual void preTracking(const G4Track* track) {
+ ;
+ }
+
+ /**
+ * Post-tracking hook called before G4Track deletion.
+ * @param[in] track The G4Track.
+ */
+ virtual void postTracking(const G4Track* track) {
+ ;
+ }
+
+ /**
+ * Stepping hook called before a G4Step is executed.
+ * @param[in] step The G4Step.
+ */
+ virtual void stepping(const G4Step* step) {
+ ;
+ }
+
+ //G4ClassificationOfNewTrack stackingClassifyNewTrack(const G4Track*) {
+ // G4Exception("", "", FatalException, "This method should be overridden.");
+ // Arbitrary return value. Will never reach here.
+ // return fWaiting;
+ //}
+
+ //void stackingNewStage() {
+ // ;
+ //}
+
+ //void stackingPrepareNewEvent() {
+ // ;
+ //}
public:
- ModuleStatus m_status;
- std::string m_name;
- LogStream* m_log;
- bool m_deleteOnExit;
+ ModuleStatus m_status;
+ std::string m_name;
+ LogStream* m_log;
+ bool m_deleteOnExit;
};
}
slic/include
diff -u -r1.7 -r1.8
--- ModuleRegistry.hh 27 Nov 2012 19:32:18 -0000 1.7
+++ ModuleRegistry.hh 6 Nov 2013 00:23:35 -0000 1.8
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/ModuleRegistry.hh,v 1.7 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/ModuleRegistry.hh,v 1.8 2013/11/06 00:23:35 jeremy Exp $
// std
#include <map>
@@ -9,34 +9,70 @@
#include "Singleton.hh"
namespace slic {
+
/**
* @class ModuleRegistry
- * @brief A central store for classes inheriting from Module.
+ * @brief A central store for accessing Module objects.
*/
class ModuleRegistry: public Singleton<ModuleRegistry>, public Module {
-public:
- typedef std::map<std::string, Module*> ModuleMap;
public:
- virtual ~ModuleRegistry();
- ModuleRegistry();
-public:
+ /**
+ * A map of names to Modules.
+ */
+ typedef std::map<std::string, Module*> ModuleMap;
- void registerModule(Module*);
- Module* findModule(const std::string&);
+public:
- void deregisterModule(Module* module);
- void deregisterModule(const std::string& name);
+ /**
+ * Class constructor.
+ */
+ ModuleRegistry();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~ModuleRegistry();
- /**
- * Print the list of registered modules to the log.
- */
- void print();
+public:
- void deleteModules();
+ /**
+ * Register a module by its name.
+ * @param[in] module The Module to register.
+ */
+ void registerModule(Module* module);
+
+ /**
+ * Find a module by its name.
+ * @param[in] name The name of the Module to find.
+ * @return The Module with matching name or null if not found.
+ */
+ Module* findModule(const std::string& name);
+
+ /**
+ * Remove a Module from the registry.
+ * @param[in] module The Module to deregister.
+ */
+ void deregisterModule(Module* module);
+
+ /**
+ * Remove a Module from the registry by name.
+ * @param[in] name The name of the Module to deregister.
+ */
+ void deregisterModule(const std::string& name);
+
+ /**
+ * Print the list of registered modules to the log.
+ */
+ void print();
+
+ /**
+ * Delete all modules.
+ */
+ void deleteModules();
private:
- ModuleMap m_modules;
+ ModuleMap m_modules;
};
}
slic/include
diff -u -r1.7 -r1.8
--- PackageInfo.hh.in 9 Jul 2013 18:47:14 -0000 1.7
+++ PackageInfo.hh.in 6 Nov 2013 00:23:35 -0000 1.8
@@ -1,84 +1,53 @@
-// $Header: /cvs/lcd/slic/include/PackageInfo.hh.in,v 1.7 2013/07/09 18:47:14 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/PackageInfo.hh.in,v 1.8 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_PACKAGE_INFO_HH
#define SLIC_PACKAGE_INFO_HH 1
namespace slic {
+/**
+ * @class PackageInfo
+ * @brief Provides basic information about this application.
+ *
+ */
class PackageInfo {
public:
- static std::string& getVersionString()
- {
+ /**
+ * Get the version string of the application.
+ * @return The version string.
+ */
+ static std::string& getVersionString() {
static std::string ver_str = "@SLIC_VERSION@";
return ver_str;
}
- static std::string& getNameString()
- {
+ /**
+ * Get the full name of the application.
+ * @return The full name of the application.
+ */
+ static std::string& getNameString() {
static std::string name_str = "Simulation for the Linear Collider";
return name_str;
}
-
- static std::string& getAbbrevString()
- {
+
+ /**
+ * Get the abbreviated name of the application.
+ * @return The abbreviated name of the application.
+ */
+ static std::string& getAbbrevString() {
static std::string abbrev_str = "slic";
return abbrev_str;
}
-
- static std::string getFullApplicationString()
- {
- static std::string fullVerStr = getNameString() + " " + getVersionString();
- return fullVerStr;
- }
-
-/*
- static std::string& getAuthorString()
- {
- static std::string auth_str = "@PACKAGE_AUTHORS@";
- return auth_str;
- }
-
- static std::string& getAbbrevString()
- {
- static std::string abbrev_str = "@PROJECT@";
- return abbrev_str;
- }
-
- static std::string& getInstitutionString()
- {
- static std::string inst_str = "@PACKAGE_INSTITUTION@";
- return inst_str;
- }
-
- static std::string& getChangeDateString()
- {
- static std::string inst_str = "@PACKAGE_DATE@";
- return inst_str;
- }
-
- static std::string& getWWW()
- {
- static std::string www_str = "@PACKAGE_WWW@";
- return www_str;
- }
-
- static std::string& getEmail()
- {
- static std::string email_str = "@PACKAGE_BUGREPORT@";
- return email_str;
- }
+ /**
+ * Get a string fully describing the application.
+ * @return The description of the application.
+ */
static std::string getFullApplicationString() {
- static std::string fullVerStr = getNameString() + "; "
- + getAbbrevString() + "; "
- + getVersionString() + "; "
- + getAuthorString() + "; "
- + getInstitutionString() + "; "
- + getChangeDateString();
- return fullVerStr;
+ static std::string fullVerStr = getNameString() + " " + getVersionString();
+ return fullVerStr;
}
- */
};
}
slic/include
diff -u -r1.8 -r1.9
--- ParticleGunEventSource.hh 27 Nov 2012 19:32:18 -0000 1.8
+++ ParticleGunEventSource.hh 6 Nov 2013 00:23:35 -0000 1.9
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/ParticleGunEventSource.hh,v 1.8 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/ParticleGunEventSource.hh,v 1.9 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_PARTICLEGUNEVENTSOURCE_HH
#define SLIC_PARTICLEGUNEVENTSOURCE_HH 1
@@ -10,23 +10,46 @@
#include "G4ParticleGun.hh"
namespace slic {
+
/**
* @class ParticleGunEventSource
* @brief Wrapper for the Geant4 particle gun.
*/
class ParticleGunEventSource: public EventSource {
+
public:
- ParticleGunEventSource();
- virtual ~ParticleGunEventSource();
+
+ /**
+ * Class constructor.
+ */
+ ParticleGunEventSource();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~ParticleGunEventSource();
public:
- virtual void generate(G4Event* evt);
- void dumpCurrentEvent();
- G4ParticleGun* getParticleGun();
+ /**
+ * Generate an event.
+ * @param[in] event The target G4Event to fill.
+ */
+ virtual void generate(G4Event* event);
+
+ /**
+ * Dump information on the current event to the log.
+ */
+ void dumpCurrentEvent();
+
+ /**
+ * Get the associated G4ParticleGun.
+ * @return The G4ParticleGun associated with this source.
+ */
+ G4ParticleGun* getParticleGun();
private:
- G4ParticleGun* m_generator;
+ G4ParticleGun* m_generator;
};
}
slic/include
diff -u -r1.2 -r1.3
--- PhysicsListBuilder.hh 27 Nov 2012 19:32:18 -0000 1.2
+++ PhysicsListBuilder.hh 6 Nov 2013 00:23:35 -0000 1.3
@@ -6,58 +6,69 @@
namespace slic {
/**
- * Abstract class for building a single physics list such as LHEP or LCPhys.
+ * @class VPhysicsListBuilder
+ * @brief Abstract class for building a single physics list such as LHEP.
*/
class VPhysicsListBuilder {
public:
- VPhysicsListBuilder(const G4String& name, const G4String& description) :
- m_name(name), m_description(description) {
- }
-
- virtual ~VPhysicsListBuilder() {
- ;
- }
+
+ /**
+ * Class constructor.
+ * @param[in] name The name of the VPhysicsListBuilder.
+ * @param[in] description The description of the builder.
+ */
+ VPhysicsListBuilder(const G4String& name, const G4String& description) :
+ m_name(name), m_description(description) {
+ }
+
+ /**
+ *
+ */
+ virtual ~VPhysicsListBuilder() {
+ ;
+ }
public:
- const G4String& getName() {
- return m_name;
- }
-
- const G4String& getDescription() {
- return m_description;
- }
+ const G4String& getName() {
+ return m_name;
+ }
+
+ const G4String& getDescription() {
+ return m_description;
+ }
- virtual G4VUserPhysicsList* create() const = 0;
+ virtual G4VUserPhysicsList* create() const = 0;
private:
- G4String m_name;
- G4String m_description;
+ G4String m_name;
+ G4String m_description;
};
/**
- * Templated VPhysicsListBuilder for returning a concrete
- * physics list object, such as LHEP or LCPhys.
+ * @class TPhysicsListBuilder
+ * @brief Templated VPhysicsListBuilder for returning a concrete
+ * physics list object, such as LHEP.
*/
template<class T>
class TPhysicsListBuilder: public VPhysicsListBuilder {
public:
- TPhysicsListBuilder(const G4String& name, const G4String& description) :
- VPhysicsListBuilder(name, description) {
- }
-
- virtual ~TPhysicsListBuilder() {
- ;
- }
+ TPhysicsListBuilder(const G4String& name, const G4String& description) :
+ VPhysicsListBuilder(name, description) {
+ }
+
+ virtual ~TPhysicsListBuilder() {
+ ;
+ }
public:
- virtual G4VUserPhysicsList* create() const {
- return new T();
- }
+ virtual G4VUserPhysicsList* create() const {
+ return new T();
+ }
};
} // namespace slic
slic/include
diff -u -r1.23 -r1.24
--- PhysicsListManager.hh 11 Apr 2013 18:42:21 -0000 1.23
+++ PhysicsListManager.hh 6 Nov 2013 00:23:35 -0000 1.24
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/PhysicsListManager.hh,v 1.23 2013/04/11 18:42:21 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/PhysicsListManager.hh,v 1.24 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_PHYSICSLISTMANAGER_HH
#define SLIC_PHYSICSLISTMANAGER_HH 1
@@ -29,73 +29,124 @@
* @note Current, primary function is selection of a list and .
* setting the default, which is LCPhys.
*/
-
class PhysicsListManager: public Module, public Singleton<PhysicsListManager> {
public:
- PhysicsListManager();
-
- virtual ~PhysicsListManager();
+ /**
+ * The class constructor.
+ */
+ PhysicsListManager();
+
+ /**
+ * The class destructor.
+ */
+ virtual ~PhysicsListManager();
public:
- void initializePhysicsList();
-
- void setCurrentListName(const std::string& n);
-
- inline const std::string& getCurrentListName() {
- return m_currentListName;
- }
-
- inline bool isInitialized() {
- return m_isInitialized;
- }
-
- inline void enableLimits(bool l) {
- m_enableLimits = l;
- }
-
- inline bool enableLimits() {
- return m_enableLimits;
- }
-
- inline bool enableOptical() {
- return m_enableOptical;
- }
-
- inline void enableOptical(bool b) {
- m_enableOptical = b;
- }
-
- // Needs to be public for the RunManager to call it.
- void setupUserLimitsProcesses();
-
- void printAvailablePhysicsLists();
+ /**
+ * Initialize the currently selected physics list.
+ */
+ void initializePhysicsList();
+
+ /**
+ * Set the name of the current physics list.
+ * Only available in pre-init state.
+ * @param[in] name The name of the physics list.
+ */
+ void setCurrentListName(const std::string& name);
+
+ /**
+ * Get the name of the current physics list.
+ * @return The name of the current physics list.
+ */
+ inline const std::string& getCurrentListName() {
+ return m_currentListName;
+ }
+
+ /**
+ * Return true if the physics list has been initialized.
+ * @return True if list has been initialized; false if not.
+ */
+ inline bool isInitialized() {
+ return m_isInitialized;
+ }
+
+ /**
+ * Enable physics limits.
+ * @param[in] enableLimits True to enable limits; false to disable.
+ */
+ inline void enableLimits(bool enableLimits) {
+ m_enableLimits = enableLimits;
+ }
+
+ /**
+ * Return true if physics limits are enabled.
+ * @return True if physics limits are enabled; false if not.
+ */
+ inline bool enableLimits() {
+ return m_enableLimits;
+ }
+
+ /**
+ * Return true if optical physics are enabled.
+ * @return True if optical physics are enabled; false if not.
+ */
+ inline bool enableOptical() {
+ return m_enableOptical;
+ }
+
+ /**
+ * Enable optical physics.
+ * @param[in] enableOptical Set to true to enable optical physics; false to disable.
+ */
+ inline void enableOptical(bool enableOptical) {
+ m_enableOptical = enableOptical;
+ }
+
+ /**
+ * Set up the user limits process.
+ */
+ void setupUserLimitsProcesses();
+
+ /**
+ * Print a list of available physics lists.
+ */
+ void printAvailablePhysicsLists();
private:
- void setupOpticalProcesses();
-
- void setupSUSY();
-
- void setupExtended();
+ /**
+ * Setup optical physics.
+ */
+ void setupOpticalProcesses();
+
+ /**
+ * Setup SUSY physics.
+ */
+ void setupSUSY();
+
+ /**
+ * Setup extended particle set from HepPDT.
+ */
+ void setupExtended();
private:
- G4VUserPhysicsList* m_currentList;
- bool m_isInitialized;
- bool m_isFromDefault;
- bool m_enableLimits;
- bool m_setupLimits;
- bool m_enableOptical;
+ G4VUserPhysicsList* m_currentList;
+ bool m_isInitialized;
+ bool m_isFromDefault;
+ bool m_enableLimits;
+ bool m_setupLimits;
+ bool m_enableOptical;
- PhysicsMessenger* m_messenger;
+ PhysicsMessenger* m_messenger;
- std::string m_currentListName;
- static const std::string m_defaultListName;
+ std::string m_currentListName;
+ static const std::string m_defaultListName;
- G4PhysListFactory *m_factory;
+ G4PhysListFactory *m_factory;
};
}
slic/include
diff -u -r1.13 -r1.14
--- PhysicsMessenger.hh 27 Nov 2012 19:32:18 -0000 1.13
+++ PhysicsMessenger.hh 6 Nov 2013 00:23:35 -0000 1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/PhysicsMessenger.hh,v 1.13 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/PhysicsMessenger.hh,v 1.14 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_PHYSICSMESSENGER_HH
#define SLIC_PHYSICSMESSENGER_HH 1
@@ -13,31 +13,49 @@
namespace slic {
/**
- @class PhysicsMessenger
- @brief G4UImessenger for selection of physics list at runtime.
- Also handles data for the HepPDT interface.
+ * @class PhysicsMessenger
+ * @brief G4UImessenger for selection of physics list at runtime.
+ * @note Also handles data for the HepPDT interface.
*/
class PhysicsMessenger: public G4UImessenger {
+
public:
- PhysicsMessenger();
- virtual ~PhysicsMessenger();
+
+ /**
+ * Class constructor.
+ */
+ PhysicsMessenger();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~PhysicsMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+ /**
+ * Execute macro command.
+ * @param[in] cmd The command to execute.
+ * @param[in] newVals The command arguments.
+ */
+ virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
private:
- void defineCommands();
+
+ /**
+ * Define commands handled by this messenger.
+ */
+ void defineCommands();
private:
- G4UIdirectory* m_physicsListDir;
+ G4UIdirectory* m_physicsListDir;
- G4UIcommand* m_selectCmd;
- G4UIcmdWithoutParameter* m_printListsCmd;
- G4UIcmdWithoutParameter* m_printCurrentCmd;
- G4UIcmdWithABool* m_enableOpticalCmd;
- G4UIcommand* m_pdgCmd;
+ G4UIcommand* m_selectCmd;
+ G4UIcmdWithoutParameter* m_printListsCmd;
+ G4UIcmdWithoutParameter* m_printCurrentCmd;
+ G4UIcmdWithABool* m_enableOpticalCmd;
+ G4UIcommand* m_pdgCmd;
};
}
slic/include
diff -u -r1.24 -r1.25
--- PrimaryGeneratorAction.hh 27 Nov 2012 19:32:18 -0000 1.24
+++ PrimaryGeneratorAction.hh 6 Nov 2013 00:23:35 -0000 1.25
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/PrimaryGeneratorAction.hh,v 1.24 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/PrimaryGeneratorAction.hh,v 1.25 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_PRIMARYGENERATORACTION_HH
#define SLIC_PRIMARYGENERATORACTION_HH 1
@@ -15,36 +15,52 @@
namespace slic {
/**
- @class PrimaryGeneratorAction
- @brief Implementation of G4VUserPrimaryGeneratorAction.
- @note Delegates all control to EventSourceManager.
+ * @class PrimaryGeneratorAction
+ * @brief Implementation of G4VUserPrimaryGeneratorAction.
+ * @note Delegates all control to EventSourceManager.
*/
class PrimaryGeneratorAction: public G4VUserPrimaryGeneratorAction, public Module {
public:
- PrimaryGeneratorAction();
- virtual ~PrimaryGeneratorAction();
+
+ /**
+ * Class constructor.
+ */
+ PrimaryGeneratorAction();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~PrimaryGeneratorAction();
public:
- virtual void GeneratePrimaries(G4Event *anEvent);
- /**
- * Apply Lorentz transformation to event. The lorentz transformation
- * is retrieved from the singleton EventSourceManager.
- * @param[in] anEvent The current Geant4 event.
- */
- void applyLorentzTransformation(G4Event *anEvent);
-
- /**
- * Apply Z smearing to event. The Z spread parameter is retrieved
- * from the singleton EventSourceManager.
- * @param[in] anEvent The current Geant4 event.
- */
- void zsmear(G4Event* anEvent);
+ /**
+ * Generate G4PrimaryParticle objects into the G4Event.
+ * @param[in] anEvent The target G4Event.
+ */
+ virtual void GeneratePrimaries(G4Event *anEvent);
+
+ /**
+ * Apply Lorentz transformation to event. The lorentz transformation
+ * is retrieved from the singleton EventSourceManager.
+ * @param[in] anEvent The current Geant4 event.
+ */
+ void applyLorentzTransformation(G4Event *anEvent);
+
+ /**
+ * Apply Z smearing to event. The Z spread parameter is retrieved
+ * from the singleton EventSourceManager.
+ * @param[in] anEvent The current Geant4 event.
+ */
+ void zsmear(G4Event* anEvent);
private:
- void printBeginEventMessage(G4Event* anEvent);
+ /**
+ * Begin the beginning of event message.
+ */
+ void printBeginEventMessage(G4Event* anEvent);
};
}
slic/include
diff -u -r1.13 -r1.14
--- RunAction.hh 27 Nov 2012 19:32:18 -0000 1.13
+++ RunAction.hh 6 Nov 2013 00:23:35 -0000 1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/RunAction.hh,v 1.13 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/RunAction.hh,v 1.14 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_RUNACTION_HH
#define SLIC_RUNACTION_HH 1
@@ -16,26 +16,61 @@
* @class RunAction
* @brief Implementation of G4UserRunAction.
*/
-
class RunAction: public G4UserRunAction, public Module {
+
public:
- RunAction();
- ~RunAction();
+
+ /**
+ * Class constructor.
+ */
+ RunAction();
+
+ /**
+ * Class destructor.
+ */
+ ~RunAction();
public:
- virtual void BeginOfRunAction(const G4Run *aRun);
- virtual void EndOfRunAction(const G4Run *aRun);
+
+ /**
+ * Implementation of begin of run action.
+ * @param[in] aRun The G4Run that is starting.
+ */
+ void BeginOfRunAction(const G4Run *aRun);
+
+ /**
+ * Implementation of end of run action.
+ * @param[in] aRun The G4Run that is ending.
+ */
+ void EndOfRunAction(const G4Run *aRun);
private:
- void startRunTimer();
- void stopRunTimer();
- void printBeginOfRunMessage(const G4Run *aRun);
- void printEndOfRunMessage(const G4Run *aRun);
+ /**
+ * Start the run timer.
+ */
+ void startRunTimer();
+
+ /**
+ * Stop the run timer.
+ */
+ void stopRunTimer();
+
+ /**
+ * Print the beginning of run message.
+ * @param[in] aRun The G4Run that is starting.
+ */
+ void printBeginOfRunMessage(const G4Run *aRun);
+
+ /**
+ * Print the end of run message.
+ * @param[in] aRun The G4Run that is ending.
+ */
+ void printEndOfRunMessage(const G4Run *aRun);
private:
- G4Timer m_runTimer;
+ G4Timer m_runTimer;
};
}
slic/include
diff -u -r1.17 -r1.18
--- RunManager.hh 29 Nov 2012 00:32:45 -0000 1.17
+++ RunManager.hh 6 Nov 2013 00:23:35 -0000 1.18
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/RunManager.hh,v 1.17 2012/11/29 00:32:45 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/RunManager.hh,v 1.18 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_RUNMANAGER_HH
#define SLIC_RUNMANAGER_HH 1
@@ -14,57 +14,109 @@
/**
* @class RunManager
* @brief Extension of G4RunManager.
- * @note Current, primary function is to initialize the default
- * physics list setup using PhysicsListManager.
+ * @note Initializes the default physics list setup using PhysicsListManager.
*/
class RunManager: public G4RunManager, public Module {
+
public:
- RunManager();
- virtual ~RunManager();
+
+ /**
+ * Class constructor.
+ */
+ RunManager();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~RunManager();
public:
- static RunManager* instance() {
- return dynamic_cast<RunManager*>(G4RunManager::GetRunManager());
- }
-
- void abortRun() {
- //std::cout << "RunManager.abortRun - run will be aborted!!!" << std::endl;
- log() << LOG::fatal << "Aborting run." << LOG::done;
- m_abortRun = true;
- // Set return code to generic error but don't override if error is already set.
- if (SlicApplication::instance()->getReturnCode() == SlicApplication::OKAY) {
- SlicApplication::instance()->setReturnCode(SlicApplication::UNKNOWN_ERROR);
- }
- G4RunManager::GetRunManager()->AbortRun(false);
- }
-
- void abortRun(int errorCode) {
- log() << LOG::fatal << LOG::name << LOG::sep << "Aborting run with return code: " << errorCode << LOG::done;
- m_abortRun = true;
- SlicApplication::instance()->setReturnCode(errorCode);
- G4RunManager::GetRunManager()->AbortRun(false);
- }
-
- void Initialize();
- int getNumberOfEventsToRun();
- bool isRunAborted();
+ /**
+ * Get the instance of RunManager.
+ * @return The singleton RunManager.
+ */
+ static RunManager* instance() {
+ return dynamic_cast<RunManager*>(G4RunManager::GetRunManager());
+ }
+
+ /**
+ * Abort the current run.
+ */
+ void abortRun() {
+ //std::cout << "RunManager.abortRun - run will be aborted!!!" << std::endl;
+ log() << LOG::fatal << "Aborting run." << LOG::done;
+ m_abortRun = true;
+ // Set return code to generic error but don't override if error is already set.
+ if (SlicApplication::instance()->getReturnCode() == SlicApplication::OKAY) {
+ SlicApplication::instance()->setReturnCode(SlicApplication::UNKNOWN_ERROR);
+ }
+ G4RunManager::GetRunManager()->AbortRun(false);
+ }
+
+ /**
+ * Abort the current run with an error code.
+ * @param[in] errorCode The error code.
+ */
+ void abortRun(int errorCode) {
+ log() << LOG::fatal << LOG::name << LOG::sep << "Aborting run with return code: " << errorCode << LOG::done;
+ m_abortRun = true;
+ SlicApplication::instance()->setReturnCode(errorCode);
+ G4RunManager::GetRunManager()->AbortRun(false);
+ }
+
+ /**
+ * Initialize this class.
+ */
+ void Initialize();
+
+ /**
+ * Get the number of events to run.
+ * @return The number of events to run.
+ */
+ int getNumberOfEventsToRun();
+
+ /**
+ * Return true if run has been aborted.
+ * @return True if run has been aborted; false if not.
+ */
+ bool isRunAborted();
protected:
- void BeamOn(G4int n_event, const char* macroFile = 0, G4int n_select = -1);
- //void DoEventLoop(G4int, const char*, G4int);
- void InitializePhysics();
- void InitializeGeometry();
+ /**
+ * This method overrides the Geant4 implementation. The super class's method
+ * is called but wrapped in code for application control flow.
+ * @param[in] nevent The number of events to execute.
+ * @param[in] macroFile A macro file to be executed after each event (not used by SLIC).
+ * @param[in] nselect The number of events to wait before macro execution.
+ */
+ void BeamOn(G4int nevent, const char* macroFile = 0, G4int nselect = -1);
+
+ /**
+ * Initialize the current physics configuration.
+ */
+ void InitializePhysics();
+
+ /**
+ * Initialize the current geometry configuration.
+ */
+ void InitializeGeometry();
+
+ //void DoEventLoop(G4int, const char*, G4int);
private:
- void initializeUserActions();
+
+ /**
+ * Initialize the user actions defined by this application.
+ */
+ void initializeUserActions();
private:
- bool m_userActionsInitialized;
- int m_numberOfEventsToRun;
- bool m_abortRun;
+ bool m_userActionsInitialized;
+ int m_numberOfEventsToRun;
+ bool m_abortRun;
};
}
slic/include
diff -u -r1.4 -r1.5
--- Singleton.hh 27 Nov 2012 19:32:18 -0000 1.4
+++ Singleton.hh 6 Nov 2013 00:23:35 -0000 1.5
@@ -1,19 +1,40 @@
-// $Id: Singleton.hh,v 1.4 2012/11/27 19:32:18 jeremy Exp $
+// $Id: Singleton.hh,v 1.5 2013/11/06 00:23:35 jeremy Exp $
-#ifndef LCDD_SINGLETON_HH
-#define LCDD_SINGLETON_HH 1
+#ifndef SLIC_SINGLETON_HH
+#define SLIC_SINGLETON_HH 1
+/**
+ * @class Singleton<T>
+ * @note A templated class for creating Singletons.
+ */
template<class T>
+
class Singleton {
+
public:
- static T* instance();
- void release();
- Singleton();
- ~Singleton();
+ /**
+ * Get the singleton instance.
+ */
+ static T* instance();
+
+ /**
+ * Delete the current singleton instance.
+ */
+ void release();
+
+ /**
+ * Class constructor.
+ */
+ Singleton();
+
+ /**
+ * Class destructor.
+ */
+ ~Singleton();
private:
- static T* m_singleton;
+ static T* m_singleton;
};
template<class T> T* Singleton<T>::m_singleton = 0;
@@ -28,18 +49,18 @@
template<class T>
T* Singleton<T>::instance() {
- if (m_singleton == 0) {
- m_singleton = new T;
- }
- return m_singleton;
+ if (m_singleton == 0) {
+ m_singleton = new T;
+ }
+ return m_singleton;
}
template<class T>
void Singleton<T>::release() {
- if (m_singleton == 0)
- return;
- delete m_singleton;
- m_singleton = 0;
+ if (m_singleton == 0)
+ return;
+ delete m_singleton;
+ m_singleton = 0;
}
#endif
slic/include
diff -u -r1.43 -r1.44
--- SlicApplication.hh 26 Jun 2013 01:57:02 -0000 1.43
+++ SlicApplication.hh 6 Nov 2013 00:23:35 -0000 1.44
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/SlicApplication.hh,v 1.43 2013/06/26 01:57:02 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/SlicApplication.hh,v 1.44 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_SLICAPPLICATION_HH
#define SLIC_SLICAPPLICATION_HH 1
@@ -21,17 +21,8 @@
class SlicApplicationMessenger;
class RunManager;
-static const char* ErrorCodeStrings[] = {
- "okay",
- "unknown error",
- "caught unknown exception",
- "caught STD exception",
- "output file already exists",
- "failed to delete old output file",
- "event underflow",
- "invalid geometry setup",
- "event generator was never setup"
-};
+static const char* ErrorCodeStrings[] = { "okay", "unknown error", "caught unknown exception", "caught STD exception", "output file already exists",
+ "failed to delete old output file", "event underflow", "invalid geometry setup", "event generator was never setup" };
/**
* @class SlicApplication
@@ -43,199 +34,214 @@
public:
- /**
- * Indicates the run mode: batch or interactive.
- */
- enum ERunMode {
- eBatch = 1, eInteractive = 2
- };
-
- /**
- * Error codes.
- */
- enum ErrorCode {
- OKAY = 0,
- UNKNOWN_ERROR,
- UNKNOWN_EXCEPTION,
- STD_EXCEPTION,
- OUTPUT_FILE_EXISTS,
- FAILED_DELETE_LCIO_FILE,
- EVENT_UNDERFLOW,
- INVALID_GEOMETRY_SETUP,
- GENERATOR_NOT_SETUP,
- ERROR_CODE_SIZE
- };
+ /**
+ * Indicates the run mode: batch or interactive.
+ */
+ enum ERunMode {
+ eBatch = 1, eInteractive = 2
+ };
+
+ /**
+ * Error codes.
+ */
+ enum ErrorCode {
+ OKAY = 0,
+ UNKNOWN_ERROR,
+ UNKNOWN_EXCEPTION,
+ STD_EXCEPTION,
+ OUTPUT_FILE_EXISTS,
+ FAILED_DELETE_LCIO_FILE,
+ EVENT_UNDERFLOW,
+ INVALID_GEOMETRY_SETUP,
+ GENERATOR_NOT_SETUP,
+ ERROR_CODE_SIZE
+ };
private:
-
public:
- /**
- * The constructor.
- */
- SlicApplication();
-
- /**
- * The destructor.
- */
- virtual ~SlicApplication();
+ /**
+ * The constructor.
+ */
+ SlicApplication();
+
+ /**
+ * The destructor.
+ */
+ virtual ~SlicApplication();
public:
- /**
- * Return SLIC's RunManager instance.
- */
- RunManager* getRunManager();
-
- /**
- * Initialize the application.
- */
- void initialize();
-
- /**
- * Run the application.
- */
- void run();
-
- /**
- * Print the usage by calling the CommandLineProcessor.
- */
- void printUsage();
-
- /**
- * Print the version string.
- */
- void printVersion();
-
- /**
- * Print SLIC's splash screen.
- */
- void printSplashScreen();
-
- /**
- * Print the start time.
- */
- void printStartTime();
-
- /**
- * Print the end time.
- */
- void printEndTime();
-
- /**
- * Get the return code.
- */
- int getReturnCode() const;
-
- /**
- * Get the run mode, interactive or batch.
- */
- ERunMode getMode() const;
-
- /**
- * Set abort state.
- */
- void setAborting(bool a = true);
-
- /**
- * Check abort state.
- */
- bool isAborting() const;
-
- /**
- * Set the run mode.
- */
- void setMode(ERunMode rmode);
-
- /**
- * Get the name of the binary as it was invoked.
- */
- const std::string& getBinaryName() const;
-
- /**
- * Get the base name of the binary (file name only).
- */
- const std::string& getBinaryBasename() const;
-
- /**
- * Setup SLIC from command line arguments using the CommandLineProcessor.
- */
- void initialize(int, char**);
-
- /**
- * Set the return code.
- */
- void setReturnCode(int rc);
-
- /**
- * Get the Geant4 version string.
- */
- std::string getGeant4VersionString();
-
- const char* getErrorCodeString(unsigned int errorCode) {
- if (errorCode > (ERROR_CODE_SIZE - 1)) {
- log() << LOG::error << "invalid error code requested: " << errorCode << LOG::done;
- throw new std::exception();
- }
- return ErrorCodeStrings[errorCode];
- }
+ /**
+ * Return SLIC's RunManager instance.
+ * @return The RunManager instance.
+ */
+ RunManager* getRunManager();
+
+ /**
+ * Initialize the application.
+ */
+ void initialize();
+
+ /**
+ * Run the application.
+ */
+ void run();
+
+ /**
+ * Print the usage by calling the CommandLineProcessor.
+ */
+ void printUsage();
+
+ /**
+ * Print the version string.
+ */
+ void printVersion();
+
+ /**
+ * Print SLIC's splash screen.
+ */
+ void printSplashScreen();
+
+ /**
+ * Print the start time.
+ */
+ void printStartTime();
+
+ /**
+ * Print the end time.
+ */
+ void printEndTime();
+
+ /**
+ * Get the return code.
+ * @return The return code.
+ */
+ int getReturnCode() const;
+
+ /**
+ * Get the run mode, interactive or batch.
+ * @return The run mode.
+ */
+ ERunMode getMode() const;
+
+ /**
+ * Set abort state.
+ * @param[in] a The application abort state.
+ */
+ void setAborting(bool a = true);
+
+ /**
+ * Get the abort state.
+ */
+ bool isAborting() const;
+
+ /**
+ * Set the run mode.
+ * @param[in] rmode The run mode, either batch or interactive.
+ */
+ void setMode(ERunMode rmode);
+
+ /**
+ * Get the name of the binary, as it was invoked from the command line.
+ * @return The name of the binary.
+ */
+ const std::string& getBinaryName() const;
+
+ /**
+ * Get the base name of the binary (file name only).
+ * @return The base name of the binary.
+ */
+ const std::string& getBinaryBasename() const;
+
+ /**
+ * Setup SLIC from command line arguments using the CommandLineProcessor.
+ * @param[in] argc The argument count.
+ * @param[in] argv The argument values.
+ */
+ void initialize(int argc, char** argv);
+
+ /**
+ * Set the return code.
+ * @param[in] rc The return code.
+ */
+ void setReturnCode(int rc);
+
+ /**
+ * Get the Geant4 version string.
+ * @return The Geant4 version string.
+ */
+ std::string getGeant4VersionString();
+
+ /**
+ * Get a string representation of an error code.
+ * @param[in] errorCode The errorCode.
+ * @return The string representation of the error code.
+ */
+ const char* getErrorCodeString(unsigned int errorCode) {
+ if (errorCode > (ERROR_CODE_SIZE - 1)) {
+ log() << LOG::error << "invalid error code requested: " << errorCode << LOG::done;
+ throw new std::exception();
+ }
+ return ErrorCodeStrings[errorCode];
+ }
private:
- /**
- * Set the binary base name from the full name.
- */
- void setBinaryBasename();
-
- /**
- * Register the Geant4 user action classes with the G4RunManager.
- */
- void initializeUserActions();
-
- /**
- * Register the LCDDDetectorConstruction.
- */
- void initializeLCDD();
-
- /**
- * Initialize the Geant4 visualization subsystem.
- */
+ /**
+ * Set the binary base name from the full name.
+ */
+ void setBinaryBasename();
+
+ /**
+ * Register the Geant4 user action classes with the G4RunManager.
+ */
+ void initializeUserActions();
+
+ /**
+ * Register the LCDDDetectorConstruction.
+ */
+ void initializeLCDD();
+
+ /**
+ * Initialize the Geant4 visualization subsystem.
+ */
#ifdef G4VIS_USE
- void initializeVis();
+ void initializeVis();
#endif
protected:
- // G4 UI manager.
- G4UIExecutive* m_ui;
+ // G4 UI manager.
+ G4UIExecutive* m_ui;
- // app messenger
- SlicApplicationMessenger* m_appMessenger;
+ // app messenger
+ SlicApplicationMessenger* m_appMessenger;
- // field messenger
- FieldMessenger* m_fieldMessenger;
+ // field messenger
+ FieldMessenger* m_fieldMessenger;
- RunManager* m_runManager;
+ RunManager* m_runManager;
- // application run mode: batch or interactive
- ERunMode m_mode;
+ // application run mode: batch or interactive
+ ERunMode m_mode;
- // return code
- int m_returnCode;
+ // return code
+ int m_returnCode;
- // hack to make aborting G4 work (doesn't seem to function properly)
- bool m_setRunAbort;
+ // hack to make aborting G4 work (doesn't seem to function properly)
+ bool m_setRunAbort;
- // Has the initialize() function been called?
- bool m_isInitialized;
+ // Has the initialize() function been called?
+ bool m_isInitialized;
- // What was the name of the SLIC binary from CL? (used by LcioFileNamer)
- std::string m_binaryname;
- std::string m_binarybasename;
+ // What was the name of the SLIC binary from CL? (used by LcioFileNamer)
+ std::string m_binaryname;
+ std::string m_binarybasename;
- // Version string of Geant4.
- std::string* m_geant4VersionString;
+ // Version string of Geant4.
+ std::string* m_geant4VersionString;
};
}
slic/include
diff -u -r1.2 -r1.3
--- SlicApplicationMessenger.hh 27 Nov 2012 19:32:18 -0000 1.2
+++ SlicApplicationMessenger.hh 6 Nov 2013 00:23:35 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/SlicApplicationMessenger.hh,v 1.2 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/SlicApplicationMessenger.hh,v 1.3 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_SLICAPPLICATIONMESSENGER_HH
#define SLIC_SLICAPPLICATIONMESSENGER_HH 1
@@ -13,29 +13,48 @@
class SlicApplication;
/**
- @class SlicApplicationMessenger
- @brief G4UImessenger to the generic G4 application.
+ * @class SlicApplicationMessenger
+ * @brief G4UImessenger for the SLIC application.
*/
class SlicApplicationMessenger: public G4UImessenger {
public:
- SlicApplicationMessenger(SlicApplication*);
- virtual ~SlicApplicationMessenger();
+
+ /**
+ * Class constructor.
+ * @param[in] app The associated SlicApplication.
+ */
+ SlicApplicationMessenger(SlicApplication* app);
+
+ /**
+ * Class destructor.
+ */
+ virtual ~SlicApplicationMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ /**
+ * Execute macro command.
+ * @param[in] cmd The macro command.
+ * @param[in] newVals The argument values.
+ */
+ virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
private:
- void defineCommands();
+
+ /**
+ * Define commands handled by this macro.
+ */
+ void defineCommands();
private:
- SlicApplication* m_app;
+ SlicApplication* m_app;
- G4UIdirectory* m_slicDir;
+ G4UIdirectory* m_slicDir;
- G4UIcommand* m_interactive;
- G4UIcommand* m_slicUsage;
- G4UIcommand* m_slicVersion;
+ G4UIcommand* m_interactive;
+ G4UIcommand* m_slicUsage;
+ G4UIcommand* m_slicVersion;
};
}
slic/include
diff -u -r1.2 -r1.3
--- SlicMain.hh 27 Nov 2012 19:32:18 -0000 1.2
+++ SlicMain.hh 6 Nov 2013 00:23:35 -0000 1.3
@@ -1,17 +1,38 @@
-// $Id: SlicMain.hh,v 1.2 2012/11/27 19:32:18 jeremy Exp $
+// $Id: SlicMain.hh,v 1.3 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_SLICMAIN_HH
#define SLIC_SLICMAIN_HH 1
#include "Module.hh"
namespace slic {
+
+/**
+ * @class SlicMain
+ * @brief A wrapper for the main method of SLIC.
+ */
class SlicMain: public Module {
+
public:
- SlicMain();
- virtual ~SlicMain();
+
+ /**
+ * Class constructor.
+ */
+ SlicMain();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~SlicMain();
public:
- int main(int argc, char** argv);
+
+ /**
+ * Execute the main method by instantiating the SlicApplication
+ * and passing control to it.
+ * @param[in] argc The argument count.
+ * @param[in] argc The argument values.
+ */
+ int main(int argc, char** argv);
};
}
slic/include
diff -u -r1.10 -r1.11
--- StdHepEventSource.hh 27 Nov 2012 19:32:18 -0000 1.10
+++ StdHepEventSource.hh 6 Nov 2013 00:23:35 -0000 1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/StdHepEventSource.hh,v 1.10 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/StdHepEventSource.hh,v 1.11 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_STDHEPEVENTSOURCE_HH
#define SLIC_STDHEPEVENTSOURCE_HH 1
@@ -15,33 +15,64 @@
* @note Uses Willy Langeveld's lStdHep and lXDR classes for input processing.
*/
class StdHepEventSource: public EventSourceWithInputFile {
-public:
- StdHepEventSource(const std::string& fname);
public:
- virtual void generate(G4Event* anEvent);
-
- // open the current file
- virtual void open();
-
- // close the current file
- virtual void close();
-
- // read the next event
- virtual void readNextEvent();
+ /**
+ * Class constructor.
+ * @param[in] fname The file name.
+ */
+ StdHepEventSource(const std::string& fname);
- virtual void dumpCurrentEvent();
-
- virtual void beginRun(const G4Run* aRun);
-
- virtual void beginEvent(const G4Event* anEvent);
+public:
- lStdHep* getStdHepReader();
+ /**
+ * Generate events.
+ * @param[in] anEvent The target G4Event.
+ */
+ void generate(G4Event* anEvent);
+
+ /**
+ * Open the current file for reading.
+ */
+ void open();
+
+ /**
+ * Close the current file.
+ */
+ void close();
+
+ /**
+ * Read in the next event.
+ */
+ void readNextEvent();
+
+ /**
+ * Print out the current event.
+ */
+ void dumpCurrentEvent();
+
+ /**
+ * Begin of run action.
+ * @param[in] aRun The G4Run that is starting.
+ */
+ void beginRun(const G4Run* aRun);
+
+ /**
+ * Begin of event action.
+ * @param[in] anEvent The G4Event that is tarting.
+ */
+ void beginEvent(const G4Event* anEvent);
+
+ /**
+ * Get the lStdHep reader associated with this source.
+ * @return The StdHep reader.
+ */
+ lStdHep* getStdHepReader();
private:
- StdHepLoader* m_loader;
- StdHepToLcioConvertor* m_convertor;
+ StdHepLoader* m_loader;
+ StdHepToLcioConvertor* m_convertor;
};
}
slic/include
diff -u -r1.17 -r1.18
--- StdHepLoader.hh 27 Nov 2012 19:32:18 -0000 1.17
+++ StdHepLoader.hh 6 Nov 2013 00:23:35 -0000 1.18
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/StdHepLoader.hh,v 1.17 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/StdHepLoader.hh,v 1.18 2013/11/06 00:23:35 jeremy Exp $
#ifndef slic_StdhepLoader_hh
#define slic_StdhepLoader_hh 1
@@ -21,7 +21,7 @@
namespace slic {
enum EErrorCode {
- eEOF = 106
+ eEOF = 106
};
/**
@@ -31,38 +31,67 @@
class StdHepLoader: public Module {
public:
- virtual ~StdHepLoader();
- StdHepLoader();
+
+ /**
+ * Class constructor.
+ */
+ StdHepLoader();
+
+ /**
+ * Class destructor.
+ */
+ virtual ~StdHepLoader();
public:
- const std::string& getFilename() const {
- return m_filename;
- }
-
- lStdHep* getStdHepReader() {
- return m_reader;
- }
-
- bool isEndOfInput() {
- return m_isEndOfInput;
- }
+ /**
+ * Get the file name.
+ * @return The file name.
+ */
+ const std::string& getFilename() const {
+ return m_filename;
+ }
+
+ /**
+ * Get the backing lStdHep reader.
+ * @return The lStdHep reader object.
+ */
+ lStdHep* getStdHepReader() {
+ return m_reader;
+ }
+
+ /**
+ * Return true if end of input events.
+ * @return True if end of input events; false if not.
+ */
+ bool isEndOfInput() {
+ return m_isEndOfInput;
+ }
public:
- void openStdHepFile(const std::string&);
- void openStdHepFile(const char*);
+ /**
+ * Open a StdHep file for reading.
+ * @param[in] filename The full path to the file.
+ */
+ void openStdHepFile(const std::string& filename);
+
+ /**
+ * Open a StdHep file for reading.
+ * @param[in] filename The full path to the file.
+ */
+ void openStdHepFile(const char* filename);
- void closeStdHepFile();
+ void closeStdHepFile();
- void readNextEvent();
- void dumpCurrentEvent();
+ void readNextEvent();
+ void dumpCurrentEvent();
private:
- std::string m_filename;
- lStdHep* m_reader;
- bool m_isEndOfInput;
+ std::string m_filename;
+ lStdHep* m_reader;
+ bool m_isEndOfInput;
};
}
slic/include
diff -u -r1.22 -r1.23
--- StdHepToLcioConvertor.hh 27 Nov 2012 19:32:18 -0000 1.22
+++ StdHepToLcioConvertor.hh 6 Nov 2013 00:23:35 -0000 1.23
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/StdHepToLcioConvertor.hh,v 1.22 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/StdHepToLcioConvertor.hh,v 1.23 2013/11/06 00:23:35 jeremy Exp $
#ifndef SLIC_STDHEPTOLCIOCONVERTOR_HH
#define SLIC_STDHEPTOLCIOCONVERTOR_HH 1
@@ -45,14 +45,28 @@
class StdHepToLcioConvertor: public Module {
public:
- StdHepToLcioConvertor(lStdHep* rdr);
+
+ /**
+ * Class constructor.
+ * @param[in] reader The lStdHep to use.
+ */
+ StdHepToLcioConvertor(lStdHep* reader);
+
+ /**
+ * Class constructor.
+ */
StdHepToLcioConvertor();
+
+ /**
+ * Class destructor.
+ */
virtual ~StdHepToLcioConvertor();
public:
/**
* Set the lStdHep reader to be used by the convertor.
+ * @param[in] rdr The lStdHep reader to use.
*/
void setStdHepReader(lStdHep* rdr) {
assert(rdr);
@@ -61,68 +75,110 @@
/**
* Create the next MCP collection using current event
- * NOTE: This function depends upon an external read operation for the next event.
+ * @note This function depends upon an external read operation to setup the current event.
*/
- void fillCurrentMcpCollectionFromStdHep();
+ void fillParticleCollection();
/**
* Reset the current MCParticle collection.
+ * @param[in] collection The new MCParticle collection.
*/
- void setCurrentMcpCollection(EVENT::LCCollection* mcpColl);
+ void setParticleCollection(EVENT::LCCollection* collection);
/**
* Get the current MCParticle collection.
+ * @return The current MCParticle collection.
*/
- EVENT::LCCollection* getCurrentMcpCollection();
+ EVENT::LCCollection* getParticleCollection();
/**
- * Create a single MCParticle from a StdHep track.
- * NOTE: Does not setup mother or daughter links.
+ * Create a single MCParticle from a StdHep record.
+ * @param[in] ihep The index of the StdHep record.
+ * @note Does not setup mother or daughter links.
+ *
*/
- IMPL::MCParticleImpl* createMcpFromStdHep(int ihep);
+ IMPL::MCParticleImpl* createParticle(int ihep);
/**
- * Setup the parent pointers of this track.
+ * Setup the parent pointers of this MCParticle.
+ * @param[in] ihep The index of the StdHep record.
+ * @param[out] particle The MCParticle which will have its parent pointers setup.
*/
- void setupParents(int ihep, IMPL::MCParticleImpl*);
+ void setupParents(int ihep, IMPL::MCParticleImpl* particle);
/**
- * Setup the input MCParticle as a parent of this track.
+ * Assign parent MCParticle to the daugher from the index.
+ * @param[in] parentIndex The MCParticle index of the parent.
+ * @param[out] daughter The daughter particle.
*/
- void addMcpParent(int parIdx, IMPL::MCParticleImpl* parMcp);
+ void addParent(int parentIndex, IMPL::MCParticleImpl* daughter);
/**
- * Setup the daughter pointers of this track.
+ * Assign the StdHep record at the index as a daughter track of the MCParticle.
+ * @param[in] ihep The StdHep record index.
+ * @param[out] particle The parent particle.
*/
- void setupDaughters(int ihep, IMPL::MCParticleImpl*);
+ void setupDaughters(int ihep, IMPL::MCParticleImpl* particle);
/**
* Setup the input MCParticle as a parent of this track.
+ * @param[in] daughterIndex The index of the daughter.
+ * @param[in] parent The parent MCParticle.
*/
- void addMcpDaughter(int dauIdx, IMPL::MCParticleImpl* parMcp);
+ void addDaughter(int daughterIndex, IMPL::MCParticleImpl* parent);
/**
* Check if an MCParticle has another particle as its parent.
+ * @param[in] daughter The proposed daughter MCParticle.
+ * @param[in] parent The parent MCParticle.
+ * @return True if daughter particle has this parent; false if not.
*/
- bool hasParent(IMPL::MCParticleImpl* dauMcp, IMPL::MCParticleImpl* parMcp);
+ bool hasParent(IMPL::MCParticleImpl* daughter, IMPL::MCParticleImpl* parent);
/**
- * Given two ihep indices, return a vector of all the included indices (discrete, range, etc.).
+ * Given two ihep indices, return a vector of all the included indices.
+ * @param[in] startIndex The starting index.
+ * @param[in] endIndex The ending index.
+ * @param[out] vec The vector of indices.
*/
- std::vector<int> makeIndexVec(int idx1, int idx2, std::vector<int>& vec);
+ std::vector<int> makeIndexVec(int startIndex, int endIndex, std::vector<int>& vec);
/**
* Perform various sanity checks on the track's mother and daughter index values.
+ * @param[in] The StdHep record's index.
*/
void checkParentage(int ihep);
- /* Print utilities. */
+ /**
+ * Print the index.
+ * @param[in] ihep The index.
+ */
void printIndex(int ihep);
+
+ /**
+ * Print the mothers of this track.
+ * @param[in] ihep The index.
+ */
void printMothers(int ihep);
+
+ /**
+ * Print the daughters of this track.
+ * @param[in] ihep The index.
+ */
void printDaughters(int ihep);
+
+ /**
+ * Print the track.
+ * @param[in] The index.
+ */
void printTrack(int ihep);
- bool isValidDaughterIndex(int ihep) {
+ /**
+ * Return true if index is basically valid, in that it is greater than zero
+ * and not greater than the total number of tracks in the event.
+ * @return True if daughter index is valid; false if not.
+ */
+ bool isValidIndex(int ihep) {
return (ihep > -1 && ihep < m_reader->nTracks());
}
slic/include
diff -u -r1.16 -r1.17
--- SteppingAction.hh 1 Jul 2013 21:01:30 -0000 1.16
+++ SteppingAction.hh 6 Nov 2013 00:23:36 -0000 1.17
@@ -1,12 +1,12 @@
-// $Header: /cvs/lcd/slic/include/SteppingAction.hh,v 1.16 2013/07/01 21:01:30 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/SteppingAction.hh,v 1.17 2013/11/06 00:23:36 jeremy Exp $
#ifndef SLIC_STEPPINGACTION_HH
#define SLIC_STEPPINGACTION_HH 1
-// slic
+// SLIC
#include "Module.hh"
-// geant4
+// Geant4
#include "G4UserSteppingAction.hh"
#include "G4Track.hh"
#include "G4Step.hh"
@@ -17,19 +17,36 @@
namespace slic {
/**
- @class SteppingAction
- @brief Implementation of G4UserSteppingAction.
+ * @class SteppingAction
+ * @brief Implementation of G4UserSteppingAction.
*/
class SteppingAction: public G4UserSteppingAction, Module {
+
public:
+
+ /**
+ * Class constructor.
+ */
SteppingAction();
+
+ /**
+ * Class destructor.
+ */
virtual ~SteppingAction();
- virtual void UserSteppingAction(const G4Step*);
+
+ /**
+ * Implementation of user stepping action.
+ * @param[in] step The G4Step.
+ */
+ void UserSteppingAction(const G4Step* step);
+
private:
+
/**
- * Check if a G4Track should be killed.
+ * Kill a G4Track if it is inside a track-killing region.
+ * @param[in] step The G4Step.
*/
- void checkKillTrack(const G4Step*);
+ void checkKillTrack(const G4Step* step);
};
}
slic/include
diff -u -r1.11 -r1.12
--- TimeUtil.hh 27 Nov 2012 19:32:18 -0000 1.11
+++ TimeUtil.hh 6 Nov 2013 00:23:36 -0000 1.12
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/TimeUtil.hh,v 1.11 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/TimeUtil.hh,v 1.12 2013/11/06 00:23:36 jeremy Exp $
#ifndef SLIC_TIMEUTIL_HH
#define SLIC_TIMEUTIL_HH 1
@@ -7,8 +7,8 @@
#include <string>
/**
- @class TimeUtil
- @brief Time utilities.
+ * @class TimeUtil
+ * @brief Miscellaneous time-related utilities.
*/
class TimeUtil {
@@ -17,25 +17,45 @@
typedef long long long64;
public:
+
+ /**
+ * Class destructor.
+ */
virtual ~TimeUtil();
private:
+
+ /**
+ * Class constructor, which is private because functions are all static.
+ */
TimeUtil();
public:
- /* @return date formatted as "YYYY-MM-DD" */
+ /**
+ * Get the current date as a formmating string.
+ * @return The date formatted as "YYYY-MM-DD"
+ */
static std::string getDate();
- /* @return full time string as ASCII formatted string */
+ /**
+ * Get the current ASCII time.
+ * @return The full time as an ASCII formatted string.
+ */
static std::string getAscTime();
- /* @return time since the epoch with second resolution, converted to NS */
+ /**
+ * Get the time since the epoch, in nanoseconds, with a one second resolution.
+ * @return time since the epoch in nanoseconds.
+ */
static TimeUtil::long64 getTimeNS();
private:
- /* @return timeinfo processed with localtime() */
+ /**
+ * The current timeinfo.
+ * @return The timeinfo processed with the localtime() function.
+ */
static tm* get_tm_local();
};
slic/include
diff -u -r1.9 -r1.10
--- TrackingAction.hh 27 Nov 2012 19:32:18 -0000 1.9
+++ TrackingAction.hh 6 Nov 2013 00:23:36 -0000 1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/TrackingAction.hh,v 1.9 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/TrackingAction.hh,v 1.10 2013/11/06 00:23:36 jeremy Exp $
#ifndef SLIC_TRACKINGACTION_HH
#define SLIC_TRACKINGACTION_HH 1
@@ -11,16 +11,35 @@
class TrajectoryManager;
/**
- @class TrackingAction
- @brief Implementation of G4UserTrackingAction.
+ * @class TrackingAction
+ * @brief Implementation of G4UserTrackingAction.
*/
class TrackingAction: public G4UserTrackingAction {
+
public:
+
+ /**
+ * Class constructor.
+ */
TrackingAction();
+
+ /**
+ * Class destructor.
+ */
~TrackingAction();
public:
+
+ /**
+ * Pre tracking action.
+ * @param[in] aTrack The G4Track.
+ */
void PreUserTrackingAction(const G4Track* aTrack);
+
+ /**
+ * Post tracking action.
+ * @param[in] aTrack The G4Track.
+ */
void PostUserTrackingAction(const G4Track* aTrack);
private:
slic/include
diff -u -r1.18 -r1.19
--- Trajectory.hh 27 Nov 2012 19:32:18 -0000 1.18
+++ Trajectory.hh 6 Nov 2013 00:23:36 -0000 1.19
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/Trajectory.hh,v 1.18 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/Trajectory.hh,v 1.19 2013/11/06 00:23:36 jeremy Exp $
#ifndef SLIC_TRAJECTORY_HH
#define SLIC_TRAJECTORY_HH 1
@@ -15,148 +15,282 @@
typedef std::vector<G4VTrajectoryPoint*> TrajectoryPointContainer;
/**
- @class Trajectory
- @brief Implementation of G4VTrajectory.
+ * @class Trajectory
+ * @brief Implementation of G4VTrajectory.
*/
class Trajectory: public G4VTrajectory {
public:
+ /**
+ * Final status flags.
+ */
enum EFinalStatus {
eUnset = 0, eDecayedInTracker = 1, eLeftDetector = 2, eStopped = 3, eDecayedInCalorimeter = 4
};
public:
- // no arg ctor
+ /**
+ * Class constructor.
+ */
Trajectory();
- // create from track
+ /**
+ * Class constructor.
+ * @param[in] aTrack An associated G4Track.
+ */
Trajectory(const G4Track *aTrack);
- // copy ctor from trajectory
- Trajectory(Trajectory &);
-
+ /**
+ * Copy constructor.
+ * @param[in] trajectory The Trajectory to copy.
+ */
+ Trajectory(Trajectory& trajectory);
+
+ /**
+ * Class destructor.
+ */
virtual ~Trajectory();
public:
+ /**
+ * Draw a Trajectory.
+ * @param[in] i_mode The draw mode.
+ */
virtual void DrawTrajectory(G4int i_mode) const {
G4VTrajectory::DrawTrajectory(i_mode);
}
- // static string of final status
+ /**
+ * Convert final status enum to string (static version).
+ * @param[in] fs The EFinalStatus.
+ * @return The status converted to a string.
+ */
static const std::string& getFinalStatusString(EFinalStatus fs);
- // non-static version
- const std::string& getFinalStatusString() const {
+ /**
+ * Convert the current final status enum to string.
+ * @return The current final status converted to a string.
+ */
+ inline const std::string& getFinalStatusString() const {
return Trajectory::getFinalStatusString(m_finalStatus);
}
- // new op
- inline void* operator new(size_t);
-
- // del op
- inline void operator delete(void*);
-
+ /**
+ * Specialized implementation of the new operator.
+ * @param[in] size The size to allocate.
+ */
+ inline void* operator new(size_t size);
+
+ /**
+ * Specialized implementation of the delete operator.
+ * @param[in] pointer Pointer to the object to delete.
+ */
+ inline void operator delete(void* pointer);
+
+ /**
+ * Equals operator.
+ * @param[in] right The comparison object.
+ */
inline int operator ==(const Trajectory& right) const {
return (this == &right);
}
+ /**
+ * Get the track ID of this Trajectory.
+ * @return The track ID.
+ */
inline G4int GetTrackID() const {
return m_trackID;
}
+ /**
+ * Get parent track ID.
+ * @return The parent track ID.
+ */
inline G4int GetParentID() const {
return m_parentID;
}
+ /**
+ * Get the name of the particle associated with the Trajectory.
+ * @return The name of the particle.
+ */
inline G4String GetParticleName() const {
return m_particleName;
}
+ /**
+ * Get the charge.
+ * @return The charge.
+ */
inline G4double GetCharge() const {
return m_PDGCharge;
}
+ /**
+ * Get the PDG encoding of this Trajectory.
+ * @return The PDG encoding.
+ */
inline G4int GetPDGEncoding() const {
return m_PDGEncoding;
}
+ /**
+ * Get the initial momentum.
+ * @return The initial momentum.
+ */
inline G4ThreeVector GetInitialMomentum() const {
return m_initialMomentum;
}
+ /**
+ * Get the particle definition.
+ * @return The particle definition.
+ */
inline const G4ParticleDefinition* GetParticleDefinition() {
return m_particleDefinition;
}
+ /**
+ * Get the creation time of the particle, measured from the start of the event.
+ * @return The creation time.
+ */
inline G4double GetGlobalTime() {
return m_globalTime;
}
- // has endpoint daughters
+ /**
+ * Return true if particle has daughters produced at its endpoint.
+ * @return True if particle has endpoint daughters; false if not.
+ */
inline G4bool getHasEndpointDaughters() const {
return m_hasEndpointDaughters;
}
+ /**
+ * Set that this Trajectory has endpoint daughters.
+ * @param[in] d Set to true if has endpoint daughters; false if not.
+ */
inline void setHasEndpointDaughters(G4bool d) {
m_hasEndpointDaughters = d;
}
- // backscatter
+ /**
+ * Return true if this Trajectory is backscattered from a non-tracking region
+ * back into the tracking region.
+ * @return True if Trajectory is backscattered; false if not.
+ */
inline G4bool getBackscatter() const {
return m_backscatter;
}
+ /**
+ * Set backscatter.
+ * @param[in] b Set to true if backscatter; false if not.
+ */
inline void setBackscatter(G4bool b) {
m_backscatter = b;
}
- // vertexIsNotEndpointOfParent
+ /**
+ * Get vertex is not endpoint of parent flag.
+ * @return The vertix is not endpoint of parent flag.
+ */
inline G4bool getVertexIsNotEndpointOfParent() const {
return m_vertexIsNotEndpointOfParent;
}
- inline void setVertexIsNotEndpointOfParent(G4bool = true) {
+ /**
+ * Set the vertex is not endpoint of parent flag.
+ * @param[in] v The vertex is not endpoint of parent flag value.
+ */
+ inline void setVertexIsNotEndpointOfParent(G4bool v = true) {
m_vertexIsNotEndpointOfParent = true;
}
- // final status
+ /**
+ * Set the final status.
+ * @param[in] fstatus The final status.
+ */
inline void setFinalStatus(EFinalStatus fstatus) {
m_finalStatus = fstatus;
}
+ /**
+ * Get the final status.
+ * @return The final status.
+ */
inline EFinalStatus getFinalStatus() const {
return m_finalStatus;
}
- // createdInSimulation
+ /**
+ * Set the created in simulation flag.
+ * @param[in] c The created in simulation flag.
+ */
inline void setCreatedInSimulation(G4bool c) {
m_createdInSimulation = c;
}
+ /**
+ * Get the created in simulation flag.
+ * @return The created in simulation flag.
+ */
inline G4bool getCreatedInSimulation() const {
return m_createdInSimulation;
}
- // set additional info from track
+ /**
+ * Setup this Trajectory from a G4Track.
+ * @param[in] aTrack The G4Track.
+ */
void setupManuallyFromTrack(const G4Track* aTrack);
+ /**
+ * Set the endpoint energy.
+ * @param[in] e The endpoint energy.
+ */
inline void setEndpointEnergy(G4double e) {
m_endpointEnergy = e;
}
+ /**
+ * Get the endpoint energy.
+ * @return The endpoint energy in GeV.
+ */
G4double getEndPointEnergy() {
return m_endpointEnergy;
}
public:
- virtual void AppendStep(const G4Step *aStep);
- virtual void MergeTrajectory(G4VTrajectory *secondTrajectory);
+ /**
+ * Append the information from a G4Step.
+ * @param[in] aStep The G4Step.
+ */
+ void AppendStep(const G4Step *aStep);
+
+ /**
+ * Merge a trajectory into this one.
+ * @param[in] secondTrajectory The Trajectory to be merged.
+ */
+ void MergeTrajectory(G4VTrajectory *secondTrajectory);
+
+ /**
+ * Get the number of point entries.
+ * @return The number of point entries.
+ */
virtual G4int GetPointEntries() const {
return m_posRecord->size();
}
+
+ /**
+ * Get a G4VTrajectoryPoint by index.
+ * @param[in] i The index.
+ * @return The trajectory point at index.
+ */
virtual G4VTrajectoryPoint* GetPoint(G4int i) const {
return (*m_posRecord)[i];
}
slic/include
diff -u -r1.35 -r1.36
--- TrajectoryManager.hh 1 Jul 2013 21:01:30 -0000 1.35
+++ TrajectoryManager.hh 6 Nov 2013 00:23:36 -0000 1.36
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/TrajectoryManager.hh,v 1.35 2013/07/01 21:01:30 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/TrajectoryManager.hh,v 1.36 2013/11/06 00:23:36 jeremy Exp $
#ifndef SLIC_TRAJECTORYMANAGER_HH
#define SLIC_TRAJECTORYMANAGER_HH 1
@@ -24,217 +24,381 @@
namespace slic {
/**
+ * @class TrajectoryManager
*
- * @brief Provides runtime management of trajectories and track information,
- * mainly to provide enough data for correct settings of MCParticle
- * data in LcioMcpManager.
+ * @brief Provides runtime management of Trajectory and TrackInformation objects,
+ * mainly to update them so that the LcioMcpManager can apply the correct status
+ * settings to output MCParticles.
*
* @todo Add current track ID and G4Track instance variables to simplify
* internal handling and function signatures.
*/
class TrajectoryManager: public Module, public Singleton<TrajectoryManager> {
-public:
- typedef std::map<G4int, Trajectory*> TrackIDToTrajectoryMap;
public:
- virtual ~TrajectoryManager();
- TrajectoryManager();
+
+ /**
+ * Map of track ID to Trajectory.
+ */
+ typedef std::map<G4int, Trajectory*> TrackIDToTrajectoryMap;
public:
- // beginEvent action
- void beginEvent(const G4Event*) {
- clearTrackIDToTrajectoryMap();
- }
-
- // preTracking action
- void preTracking(const G4Track*);
-
- // postTracking action
- void postTracking(const G4Track*);
-
- // stepping action
- void stepping(const G4Step*);
-
- // find trajectory by track ID
- Trajectory* findTrajectory(G4int trkID);
-
- // find trajectory by const track
- Trajectory* findTrajectory(const G4Track* aTrack) {
- return findTrajectory(aTrack->GetTrackID());
- }
-
- // find trajectory by track
- Trajectory* findTrajectory(G4Track* aTrack) {
- return findTrajectory((const_cast<const G4Track*>(aTrack))->GetTrackID());
- }
-
- void printTrackIDToTrajectoryMap() {
- log() << LOG::debug << "TrackIDToTrajectoryMap" << LOG::done;
- log() << LOG::debug << "trackID | trjPtr" << LOG::done;
- for (TrackIDToTrajectoryMap::iterator iter = m_trackIDToTrajectory.begin();
- iter != m_trackIDToTrajectory.end(); iter++) {
- log() << LOG::debug << iter->first << " " << iter->second << LOG::done;
- }
- }
-
- // set the TrackingManager
- inline void setTrackingManager(const G4TrackingManager* trkMgr) {
- m_trackingManager = const_cast<G4TrackingManager*>(trkMgr);
- }
+ /**
+ * Class destructor.
+ */
+ virtual ~TrajectoryManager();
+
+ /**
+ * Class constructor.
+ */
+ TrajectoryManager();
-private:
+public:
- // handle a primary track
- void handlePrimaryTrack(const G4Track* aTrack);
+ /**
+ * Begin of event action.
+ * Clears the TrackIDToTrajectoryMap for new data.
+ * @param[in] event The G4Event that is beginning.
+ */
+ void beginEvent(const G4Event* event) {
+ clearTrackIDToTrajectoryMap();
+ }
+
+ /**
+ * Pre-tracking action.
+ * @param[in] track The new G4Track.
+ */
+ void preTracking(const G4Track* track);
+
+ /**
+ * Post-tracking action.
+ * @param[in] track The G4Track that is about to be deleted.
+ */
+ void postTracking(const G4Track* track);
+
+ /**
+ * The stepping action.
+ * @param[in] step The current G4Step.
+ */
+ void stepping(const G4Step* step);
+
+ /**
+ * Find a Trajectory by trackID.
+ * @param[in] trackID The track ID.
+ * @return The matching Trajectory or null if not found.
+ */
+ Trajectory* findTrajectory(G4int trackID);
+
+ /**
+ * Find a Trajectory from a G4Track.
+ * @param[in] aTrack The G4Track.
+ * @return The matching Trajectory or null if not found.
+ */
+ Trajectory* findTrajectory(const G4Track* aTrack) {
+ return findTrajectory(aTrack->GetTrackID());
+ }
+
+ /**
+ * Find a Trajectory from a G4Track.
+ * @param[in] aTrack The G4Track.
+ * @return The matching Trajectory or null if not found.
+ */
+ Trajectory* findTrajectory(G4Track* aTrack) {
+ return findTrajectory((const_cast<const G4Track*>(aTrack))->GetTrackID());
+ }
+
+ /**
+ * Print out the TrackIDToTrajectoryMap.
+ */
+ void printTrackIDToTrajectoryMap() {
+ log() << LOG::debug << "TrackIDToTrajectoryMap" << LOG::done;
+ log() << LOG::debug << "trackID | trjPtr" << LOG::done;
+ for (TrackIDToTrajectoryMap::iterator iter = m_trackIDToTrajectory.begin(); iter != m_trackIDToTrajectory.end(); iter++) {
+ log() << LOG::debug << iter->first << " " << iter->second << LOG::done;
+ }
+ }
+
+ /**
+ * Set the G4TrackingManager.
+ * @param[in] trackManager The G4TrackingManager to be used.
+ */
+ inline void setTrackingManager(const G4TrackingManager* trackManager) {
+ m_trackingManager = const_cast<G4TrackingManager*>(trackManager);
+ }
- // setup primary track info
- void setPrimaryTrackInformation(const G4Track* aTrack);
+private:
- // handle a secondary track
- void handleSecondaryTrack(const G4Track* aTrack);
+ /**
+ * Handle a primary track, e.g. one without a parent.
+ * This function will set its TrackInformation and create a Trajectory for it.
+ * @param[in] The G4Track which is a primary.
+ */
+ void handlePrimaryTrack(const G4Track* aTrack);
+
+ /**
+ * Setup the TrackInformation for a primary track.
+ * @param[in] aTrack The G4Track which is a primary.
+ */
+ void setPrimaryTrackInformation(const G4Track* aTrack);
+
+ /**
+ * Handle a secondary track, which is the daughter of another.
+ * This method will set the status flags on this track's Trajectory,
+ * or create a TrackInformation object and Trajectory for it,
+ * if needed.
+ * @param[in] aTrack The G4Track which is a secondary.
+ */
+ void handleSecondaryTrack(const G4Track* aTrack);
+
+ /**
+ * Create a Trajectory for a secondary G4Track. Called from handleSecondaryTrack().
+ * @param[in] aTrack The secondary G4Track.
+ */
+ Trajectory* createSecondaryTrajectory(const G4Track* aTrack);
+
+ /**
+ * Setup the TrackInformation for a secondary.
+ * @param[in] aTrack The secondary G4Track.
+ */
+ void setupSecondaryTrackInformation(const G4Track* aTrack);
+
+ /**
+ * Copy the G4Track's TrackInformation to its secodaries.
+ * @param[in] aTrack The parent G4Track.
+ */
+ void copySecondaryTrackInformationFromParent(const G4Track* aTrack);
+
+ /**
+ * Check if this track requires manual trajectory setup, e.g. if it
+ * has a SimTrackerHit assigned to it but no Trajectory is being stored.
+ * @param[in] aTrack The G4Track.
+ * @return True if G4Track needs a Trajectory to be setup; false if not.
+ */
+ bool needsManualTrajectorySetup(const G4Track* aTrack);
+
+ /**
+ * Set the final status flag of a G4Track.
+ * @param[in] aTrack The G4Track.
+ */
+ void setTrajectoryFinalStatus(const G4Track* aTrack);
+
+ /**
+ * Get the number of secondaries at the endpoint of the track.
+ * @param[in] aTrack The G4Track.
+ * @return The number of secondaries produced at the end of the track.
+ */
+ G4int getNumberOfSecondariesAtEnd(const G4Track* aTrack);
+
+ /**
+ * Return true if this track is primary, i.e. it has no parent.
+ * @return True if this track is primary; false if it is a secondary.
+ */
+ inline bool isPrimaryTrack(const G4Track* aTrack) const {
+ return (aTrack->GetParentID() == 0);
+ }
+
+ /**
+ * Return true if energy is less than region's threshold to create a trajectory or if this
+ * flag has been set on the TrackInformation.
+ * @return True if track is below threshold; false if not.
+ */
+ inline bool isBelowThreshold(const G4Track* aTrack) const {
+ return ((aTrack->GetKineticEnergy() < UserRegionInformation::getRegionInformation(aTrack)->getThreshold())
+ || (TrackInformation::getTrackInformation(aTrack)->getBelowThreshold() == true));
+ }
+
+ /**
+ * Check if the particle is backscattered back into a tracking region.
+ * This checks that the original tracking status is "not in a tracking region",
+ * which works ok because this function is only relevent when the track is
+ * currently within the tracking region.
+ * @return true if track is backscattered; false if not.
+ */
+ inline bool isBackscatter(const G4Track* aTrack) const {
+ return TrackInformation::getTrackInformation(aTrack)->getOriginalTrackingStatus() != TrackInformation::eInTrackingRegion;
+ }
+
+ /**
+ * Return true if the G4Track associated with the G4Step is in the "alive" state.
+ * @return true if the G4Track from the G4Step is alive; false if not.
+ */
+ bool isAlive(const G4Step* aStep) {
+ return aStep->GetTrack()->GetTrackStatus() == fAlive;
+ }
+
+ /**
+ * Get the current Trajectory from the G4TrackingManager.
+ * @return The Trajectory from the G4TrackingManager.
+ */
+ Trajectory* getCurrentTrajectory() {
+ return static_cast<Trajectory*>(m_trackingManager->GimmeTrajectory());
+ }
+
+ /**
+ * Fill the track ID to Trajectory map from the G4Event.
+ * @param[in] event The G4Event.
+ * @param[in] clearIt Set to true to clear the map before filling it.
+ */
+ void fillTrajectoryMap(const G4Event* event, bool clearIt = true);
+
+ /**
+ * Add a Trajectory to map by its track ID.
+ * @param[in] trajectory The Trajectory to add.
+ */
+ void addTrackIDToTrajectoryLink(Trajectory* trajectory);
+
+ /**
+ * Clear the TrackIDToTrajectoryMap.
+ */
+ void clearTrackIDToTrajectoryMap() {
+ m_trackIDToTrajectory.clear();
+ }
+
+ /**
+ * Set the tracking flag from the UserRegionInformation, i.e. in or outside tracking region.
+ * @param[out] trackInformation The TrackInformation to update.
+ * @param[in] regionInformation The region information with the status.
+ */
+ void setTrackingFlagFromRegionInformation(TrackInformation* trackInformation, UserRegionInformation* regionInformation);
+
+ /**
+ * Using the parent's endpoint and the secondaries starting position to determine
+ * the value of the vertexIsNotEndpointOfParent flag.
+ * @param[in] endpoint The parent's endpoint.
+ * @param[in] secondary The secondary G4Track.
+ * @return true if vertex is not endpoint of parent; false if not.
+ */
+ bool vertexIsNotEndpointOfParent(const G4ThreeVector& endpoint, G4Track* secondary) {
+ //assert(secondary);
+
+ bool r = false;
+
+ if (!endpoint.isNear(secondary->GetPosition())) {
+ r = true;
+ }
+
+ return r;
+ }
+
+ /**
+ * Get the Trajectory's point position by index.
+ * @param[in] trajectory The Trajectory.
+ * @param[in] positionIndex The index into the vector of point positions.
+ * @return The Trajectory's point position.
+ */
+ static G4ThreeVector getTrajectoryPointPosition(Trajectory* trajectory, G4int positionIndex = 0) {
+ // check null trajectory
+ if (!trajectory) {
+ G4Exception("TrajectoryManager::getTrajectoryPointPosition()", "", FatalException, "Trajectory is null.");
+ }
+
+ // get number of trajectories
+ G4int numPnts = trajectory->GetPointEntries();
+
+ // check idx argument against number of trajectories
+ if ((positionIndex > (numPnts - 1)) || positionIndex < 0) {
+ G4Exception("TrajectoryManager::getTrajectoryPointPosition()", "", FatalException, "The trajectory position index is invalid.");
+ }
+
+ // return point at idx
+ return trajectory->GetPoint(positionIndex)->GetPosition();
+ }
+
+ /**
+ * Get a Trajectory's vertex point, which is the first entry in the point position vector.
+ * @param[in] The Trajectory.
+ * @return The point position at the vertex.
+ */
+ inline static G4ThreeVector getTrajectoryVertex(Trajectory* trajectory) {
+ return getTrajectoryPointPosition(trajectory, 0);
+ }
+
+ /**
+ * Get a trajectory's endpoint, which is the last entry in the point position vector.
+ * @param[in] trajectory The Trajectory.
+ * @return The Trajectory's endpoint position.
+ */
+ inline static G4ThreeVector getTrajectoryEndpoint(Trajectory* trajectory) {
+ return getTrajectoryPointPosition(trajectory, trajectory->GetPointEntries() - 1);
+ }
+
+ /**
+ * Create a new trajectory from a G4Track.
+ * @param[in] aTrack The source G4Track.
+ * @return The output Trajectory from the track data.
+ */
+ Trajectory* createTrajectoryFromTrack(const G4Track* aTrack);
+
+ /**
+ * Get the current Trajectory being processed.
+ * @return Pointer to the current trajectory being processed.
+ */
+ inline Trajectory* getCurrentTrajectory() const {
+ return m_currentTrajectory;
+ }
+
+ /**
+ * Get the current G4Track being processed.
+ * @return The current G4Track.
+ */
+ inline const G4Track* getCurrentTrack() const {
+ return m_currentTrack;
+ }
+
+ /**
+ * Get the current track ID.
+ * @return The current G4Track's ID.
+ */
+ inline G4int getCurrentTrackID() const {
+ return m_currentTrackID;
+ }
+
+ /**
+ * Print the status flags of a G4Track.
+ * @param[in] track The G4Track.
+ */
+ void printStatusFlags(const G4Track* track);
+
+ /**
+ * Print the status flags from the TrackInformation.
+ * @param[in] trackInformation The TrackInformation.
+ */
+ void printStatusFlags(TrackInformation* trackInformation);
+
+ /**
+ * Print the data of the G4Track.
+ * @param[in] track The G4Track.
+ * @param[in] isSecondary Set to true if track is a secondary; false if not.
+ */
+ void printTrack(const G4Track* track, bool isSecondary = false);
+
+ /**
+ * Print out the Trajectory.
+ * @param[in] trajectory The Trajectory.
+ */
+ void printTrajectory(const Trajectory* trajectory);
+
+ /**
+ * Print out the secondaries of the current track.
+ */
+ void printSecondaries();
+
+ /**
+ * Print out physical volume information from the G4StepPoint.
+ * @param[in] stepPoint The G4StepPoint.
+ */
+ void printPhysVolDbg(G4StepPoint* stepPoint);
- // setup trajectory for a secondary track in handleSecondaryTrack()
- Trajectory* createSecondaryTrajectory(const G4Track* aTrack);
-
- // setup track info for secondary in tracking region
- void setupSecondaryTrackInformation(const G4Track* aTrack);
-
- // setup secondary track info
- void copySecondaryTrackInformationFromParent(const G4Track* aTrack);
-
- // check if this track requires manual trajectory setup
- bool needsManualTrajectorySetup(const G4Track* aTrack);
-
- // set final status of track in postTracking
- void setTrajectoryFinalStatus(const G4Track* aTrack);
-
- // count num secondaries at track's end
- G4int getNumberOfSecondariesAtEnd(const G4Track* aTrack);
-
- // does this track represent a primary particle, i.e. is parent trkID = 0?
- inline bool isPrimaryTrack(const G4Track* aTrack) const {
- return (aTrack->GetParentID() == 0);
- }
-
- /**
- * Return true if energy is less than region's threshold to create a trajectory or if the
- * flag has been set on the track info; False if not.
- */
- inline bool isBelowThreshold(const G4Track* aTrack) const {
- return ((aTrack->GetKineticEnergy()
- < UserRegionInformation::getRegionInformation(aTrack)->getThreshold())
- || (TrackInformation::getTrackInformation(aTrack)->getBelowThreshold() == true));
- }
-
- /*
- Check if original tracking status is not in a tracking region,
- which works ok because this function is only relavent when track
- is currently in the tracking region.
- */
- inline bool isBackscatter(const G4Track* aTrack) const {
- return TrackInformation::getTrackInformation(aTrack)->getOriginalTrackingStatus()
- != TrackInformation::eInTrackingRegion;
- }
-
- // is track status = alive?
- bool isAlive(const G4Step* aStep) {
- return aStep->GetTrack()->GetTrackStatus() == fAlive;
- }
-
- // get trajectory from tracking manager
- Trajectory* getCurrentTrajectory() {
- return static_cast<Trajectory*>(m_trackingManager->GimmeTrajectory());
- }
-
- void fillTrackIDToTrajectoryMap(const G4Event*, bool clearIt = true);
- void addTrackIDToTrajectoryLink(Trajectory*);
-
- void clearTrackIDToTrajectoryMap() {
- m_trackIDToTrajectory.clear();
- }
-
- // debug printers
- void printStatusFlags(const G4Track* trk);
- void printStatusFlags(TrackInformation* trkInfo);
- void printTrack(const G4Track* trk, bool isSecondary = false);
- void printTrajectory(const Trajectory* trj);
- void printSecondaries();
-
- void setTrackingFlagFromRegionInformation(TrackInformation* trk_info, UserRegionInformation* reg_info);
-
- void printPhysVolDbg(G4StepPoint* stepPnt);
-
- // use parent's endpoint and the seco track position to determine vertexIsNotEndpointOfParent flag
- bool vertexIsNotEndpointOfParent(const G4ThreeVector& parEndpoint, G4Track* secoTrack) {
- assert( secoTrack);
-
- bool r = false;
-
- if (!parEndpoint.isNear(secoTrack->GetPosition())) {
- r = true;
- }
-
- return r;
- }
-
- // get trajectory point 3vect
- static G4ThreeVector getTrajectoryPointPosition(Trajectory* trj, G4int pos_idx = 0) {
- // check null trajectory
- if (!trj) {
- G4Exception("TrajectoryManager::getTrajectoryPointPosition()", "", FatalException,
- "Trajectory is null.");
- }
-
- // get number of trajectories
- G4int numPnts = trj->GetPointEntries();
-
- // check idx argument against number of trajectories
- if ((pos_idx > (numPnts - 1)) || pos_idx < 0) {
- G4Exception("TrajectoryManager::getTrajectoryPointPosition()", "", FatalException,
- "The trajectory position index is invalid.");
- }
-
- // return point at idx
- return trj->GetPoint(pos_idx)->GetPosition();
- }
-
- // get a trajectory's vertex point
- static G4ThreeVector getTrajectoryVertex(Trajectory* trj) {
- return getTrajectoryPointPosition(trj, 0);
- }
-
- // get a trajectory's endpoint
- static G4ThreeVector getTrajectoryEndpoint(Trajectory* trj) {
- return getTrajectoryPointPosition(trj, trj->GetPointEntries() - 1);
- }
-
- // create a trajectory from track's data
- Trajectory* createTrajectoryFromTrack(const G4Track* aTrack);
-
- /**
- * @return Pointer to the current trajectory being processed.
- */
- inline Trajectory* getCurrentTrajectory() const {
- return m_currentTrajectory;
- }
-
- inline const G4Track* getCurrentTrack() const {
- return m_currentTrack;
- }
-
- inline G4int getCurrentTrackID() const {
- return m_currentTrackID;
- }
private:
- G4TrackingManager* m_trackingManager;
- TrackIDToTrajectoryMap m_trackIDToTrajectory;
- Trajectory* m_currentTrajectory;
- const G4Track* m_currentTrack;
- G4int m_currentTrackID;
+ G4TrackingManager* m_trackingManager;
+ TrackIDToTrajectoryMap m_trackIDToTrajectory;
+ Trajectory* m_currentTrajectory;
+ const G4Track* m_currentTrack;
+ G4int m_currentTrackID;
};
}
slic/include
diff -u -r1.4 -r1.5
--- VRML2Writer.hh 27 Nov 2012 19:32:18 -0000 1.4
+++ VRML2Writer.hh 6 Nov 2013 00:23:36 -0000 1.5
@@ -15,24 +15,80 @@
namespace slic {
/**
- * A simple standalone VRML2 writer that dumps the detector geometry in hierarchical format.
+ * @class VRML2Writer
+ * @brief A simple, standalone VRML2 writer that dumps the detector geometry in a hierarchical format.
*/
class VRML2Writer {
+
public:
- VRML2Writer(const std::string& filename);
+
+ /**
+ * Class constructor.
+ */
+ VRML2Writer(const std::string& filename);
+
+ /**
+ * Class destructor.
+ */
~VRML2Writer();
+
+ /**
+ * Write out VRML to the current file.
+ */
void write();
private:
- void processTopVolume(G4VPhysicalVolume*);
- void processPhysicalVolume(G4VPhysicalVolume*);
- void processVisualization(G4VPhysicalVolume*);
- void processSolid(G4VSolid*);
- void processBox(G4Box*);
- void processPolyhedron(G4Polyhedron*);
- void writeLine(const std::string&);
+ /**
+ * Recursively process volumes from the top.
+ * @param[in] The top volume.
+ */
+ void processTopVolume(G4VPhysicalVolume* volume);
+
+ /**
+ * Process a physical volume.
+ * @param[in] volume The physical volume.
+ */
+ void processPhysicalVolume(G4VPhysicalVolume* volume);
+
+ /**
+ * Process the visualization settings of the volume.
+ * @param[in] volume The physical volume.
+ */
+ void processVisualization(G4VPhysicalVolume* volume);
+
+ /**
+ * Process a solid.
+ * @param[in] solid The G4VSolid.
+ */
+ void processSolid(G4VSolid* solid);
+
+ /**
+ * Process a box shape.
+ * @param[in] box The G4Box.
+ */
+ void processBox(G4Box* box);
+
+ /**
+ * Process a polyhedron.
+ * @param[in] poly The G4Polyhedron.
+ */
+ void processPolyhedron(G4Polyhedron* poly);
+
+ /**
+ * Write a line into the output.
+ * @param[in] line The line of output.
+ */
+ void writeLine(const std::string& line);
+
+ /**
+ * Indent once in the output.
+ */
void indent();
+
+ /**
+ * Remove a level of indentation.
+ */
void unindent();
private:
slic/include
diff -u -r1.2 -r1.3
--- VRML2WriterMessenger.hh 27 Nov 2012 19:32:18 -0000 1.2
+++ VRML2WriterMessenger.hh 6 Nov 2013 00:23:36 -0000 1.3
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/VRML2WriterMessenger.hh,v 1.2 2012/11/27 19:32:18 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/VRML2WriterMessenger.hh,v 1.3 2013/11/06 00:23:36 jeremy Exp $
#ifndef SLIC_VRML2WRITERMESSENGER_HH
#define SLIC_VRML2WRITERMESSENGER_HH 1
@@ -10,13 +10,33 @@
class G4UIcmdWithAString;
namespace slic {
+
+/**
+ * @class VRML2WriterMessenger
+ * @brief This is the G4UImessenger for the VRML2Writer class.
+ */
class VRML2WriterMessenger: public G4UImessenger {
+
public:
+
+ /**
+ * Class constructor.
+ */
VRML2WriterMessenger();
+
+ /**
+ * Class destructor.
+ */
virtual ~VRML2WriterMessenger();
public:
- virtual void SetNewValue(G4UIcommand* cmd, G4String newVals);
+
+ /**
+ * Execute macro command.
+ * @param[in] cmd The macro command.
+ * @param[in] newValues The command values.
+ */
+ void SetNewValue(G4UIcommand* cmd, G4String newVals);
private:
G4UIdirectory* m_vrmlDir;
slic/src
diff -N HepPDTManager.cc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ HepPDTManager.cc 6 Nov 2013 00:23:37 -0000 1.1
@@ -0,0 +1,84 @@
+#include "HepPDTManager.hh"
+
+namespace slic {
+
+HepPDTManager::HepPDTManager() :
+ Module("HepPDTManager"), m_datacol(0), m_fileSet(false) {
+ log().setOutputLevel(LOG::debug);
+}
+
+HepPDTManager::~HepPDTManager() {
+ delete m_datacol;
+}
+
+HepPDT::ParticleDataTable* HepPDTManager::getParticleDataTable() {
+ if (m_datacol == 0) {
+ loadParticleData();
+ }
+ return m_datacol;
+}
+
+void HepPDTManager::setParticleDataFile(std::string pdfile) {
+ m_pdfile = pdfile;
+ m_fileSet = true;
+}
+
+void HepPDTManager::loadParticleData() {
+ // See if we can get the data file from the environment if it wasn't setup via CL or G4 macro.
+ if (!m_fileSet) {
+ char *heppdt = getenv("HEPPDT_BASE");
+ if (heppdt) {
+ m_pdfile = std::string(heppdt) + std::string("/data/particle.tbl");
+ } else {
+ log() << LOG::error << "Could not find particle.tbl!" << LOG::done;
+ return;
+ }
+ }
+
+ std::ifstream pdfile(m_pdfile.c_str());
+ if (!pdfile) {
+#ifdef SLIC_LOG
+ log() << LOG::error << "error reading file " << m_pdfile << LOG::done;
+#endif
+ return;
+ }
+
+ m_datacol = new HepPDT::ParticleDataTable("Particle Data Table");
+ HepPDT::TableBuilder *tb = new HepPDT::TableBuilder((*m_datacol));
+ if (!addParticleTable(pdfile, (*tb))) {
+#ifdef SLIC_LOG
+ log() << LOG::error << "error reading lines from " << m_pdfile << LOG::done;
+#endif
+ }
+
+ delete tb;
+ tb = 0;
+ pdfile.close();
+
+ // DEBUG
+ //printParticleData();
+}
+
+void HepPDTManager::printParticleData() {
+ log() << LOG::always << "-- HepPDT Particle Data Table --" << LOG::endl;
+ log() << "ParticleDataTable has " << m_datacol->size() << " particles"
+ << LOG::endl;
+
+ for (HepPDT::ParticleDataTable::const_iterator it = m_datacol->begin();
+ it != m_datacol->end(); it++) {
+ HepPDT::ParticleID id = it->first;
+ HepPDT::ParticleData pdata = it->second;
+
+ log() << LOG::always << id.pid() << " " << id.PDTname();
+
+ if (id.isSUSY()) {
+ log() << " <-- SUSY particle";
+ }
+
+ log() << LOG::endl;
+ }
+
+ log() << LOG::done;
+}
+
+} // namespace slic
slic/src
diff -u -r1.4 -r1.5
--- CommandQueue.cc 27 Nov 2012 19:32:19 -0000 1.4
+++ CommandQueue.cc 6 Nov 2013 00:23:36 -0000 1.5
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/CommandQueue.cc,v 1.4 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/CommandQueue.cc,v 1.5 2013/11/06 00:23:36 jeremy Exp $
#include "CommandQueue.hh"
@@ -10,21 +10,21 @@
log() << LOG::always << "************************" << LOG::done;
log() << LOG::always << "* Geant4 Command Queue *" << LOG::done;
log() << LOG::always << "************************" << LOG::done;
- for (CmdVecType::iterator iter = cmdsBegin(); iter != cmdsEnd(); iter++) {
+ for (CommandVectorType::iterator iter = cmdsBegin(); iter != cmdsEnd(); iter++) {
log() << LOG::always << *iter << LOG::done;
}
log() << LOG::always << LOG::done;
}
void CommandQueue::execute() {
- for (CmdVecType::iterator iter = cmdsBegin(); iter != cmdsEnd(); iter++) {
+ for (CommandVectorType::iterator iter = cmdsBegin(); iter != cmdsEnd(); iter++) {
std::string cmd = *iter;
G4UImanager::GetUIpointer()->ApplyCommand(cmd);
}
}
-CommandQueue::CmdVecType::iterator CommandQueue::find(const std::string& str) {
- CmdVecType::iterator iter = m_commands.begin();
+CommandQueue::CommandVectorType::iterator CommandQueue::find(const std::string& str) {
+ CommandVectorType::iterator iter = m_commands.begin();
for (; iter != m_commands.end(); iter++) {
if ((*iter).find(str) != std::string::npos) {
break;
slic/src
diff -u -r1.9 -r1.10
--- LcioEventSource.cc 27 Nov 2012 19:32:19 -0000 1.9
+++ LcioEventSource.cc 6 Nov 2013 00:23:37 -0000 1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioEventSource.cc,v 1.9 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioEventSource.cc,v 1.10 2013/11/06 00:23:37 jeremy Exp $
#include "LcioEventSource.hh"
// slic
@@ -80,7 +80,7 @@
if (m_event) {
- mcpColl = LcioMcpManager::instance()->findMcpCollection(m_event);
+ mcpColl = LcioMcpManager::instance()->findParticleCollection(m_event);
if (mcpColl == 0) {
G4Exception("", "", FatalException, "No Mcp collection found in LCIO input event.");
slic/src
diff -u -r1.23 -r1.24
--- LcioFileNamer.cc 26 Jun 2013 01:57:02 -0000 1.23
+++ LcioFileNamer.cc 6 Nov 2013 00:23:37 -0000 1.24
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioFileNamer.cc,v 1.23 2013/06/26 01:57:02 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioFileNamer.cc,v 1.24 2013/11/06 00:23:37 jeremy Exp $
// SLIC
#include "LcioFileNamer.hh"
@@ -36,6 +36,9 @@
m_defaultFields.push_back("geometry");
}
+LcioFileNamer::~LcioFileNamer() {
+}
+
std::string LcioFileNamer::getFieldValue(std::string field) {
std::string value;
slic/src
diff -u -r1.32 -r1.33
--- LcioHitsCollectionBuilder.cc 2 Oct 2013 02:05:47 -0000 1.32
+++ LcioHitsCollectionBuilder.cc 6 Nov 2013 00:23:37 -0000 1.33
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioHitsCollectionBuilder.cc,v 1.32 2013/10/02 02:05:47 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioHitsCollectionBuilder.cc,v 1.33 2013/11/06 00:23:37 jeremy Exp $
// SLIC
#include "LcioHitsCollectionBuilder.hh"
@@ -39,7 +39,7 @@
m_mcpManager = LcioMcpManager::instance();
// setup default coll flag for cal hits
- setCalFlagDefaults();
+ setFlagDefaults();
// Set store momentum bit for TrackerHits
m_trkCollFlag.setBit(LCIO::THBIT_MOMENTUM);
@@ -175,7 +175,7 @@
return collVec;
}
-void LcioHitsCollectionBuilder::setCalFlagDefaults() {
+void LcioHitsCollectionBuilder::setFlagDefaults() {
m_calCollFlag.setBit(LCIO::CHBIT_LONG);
m_calCollFlag.setBit(LCIO::CHBIT_ID1);
}
@@ -235,7 +235,7 @@
simCalHit->setPosition(pos);
// copy Mcp contrib info; energy is also incremented by contrib addition
- addMcpContribs(calHit, simCalHit);
+ addParticleContributions(calHit, simCalHit);
// compare edep of calHit with simHit when debugging
//#ifdef SLIC_DEBUG
@@ -262,53 +262,54 @@
}
// create trk hit from G4
-IMPL::SimTrackerHitImpl* LcioHitsCollectionBuilder::createHit(TrackerHit* trkHit) {
- SimTrackerHitImpl* simTrkHit = new SimTrackerHitImpl();
+IMPL::SimTrackerHitImpl* LcioHitsCollectionBuilder::createHit(TrackerHit* trackerHit) {
+
+ SimTrackerHitImpl* simTrackerHit = new SimTrackerHitImpl();
// position in mm
- const G4ThreeVector hitPos = trkHit->getPosition();
+ const G4ThreeVector hitPos = trackerHit->getPosition();
double pos[3] = { hitPos.x(), hitPos.y(), hitPos.z() };
- simTrkHit->setPosition(pos);
+ simTrackerHit->setPosition(pos);
// momentum in GeV
- const G4ThreeVector& momentum = trkHit->getMomentum();
- simTrkHit->setMomentum(momentum.x() / GeV, momentum.y() / GeV, momentum.z() / GeV);
+ const G4ThreeVector& momentum = trackerHit->getMomentum();
+ simTrackerHit->setMomentum(momentum.x() / GeV, momentum.y() / GeV, momentum.z() / GeV);
// pathLength = distance between exit and entry points in mm
- simTrkHit->setPathLength(trkHit->getLength());
+ simTrackerHit->setPathLength(trackerHit->getLength());
// dEdx in GeV (LCIO units)
- float edep = trkHit->getEdep();
- simTrkHit->setEDep(edep / GeV);
+ float edep = trackerHit->getEdep();
+ simTrackerHit->setEDep(edep / GeV);
// time in NS
- float tEdep = trkHit->getTdep();
- simTrkHit->setTime(tEdep);
+ float tEdep = trackerHit->getTdep();
+ simTrackerHit->setTime(tEdep);
// Cell ID.
//#if LCIO_VERSION_GE(1, 60)
// New method for 64-bit IDs.
- simTrkHit->setCellID0(trkHit->getId());
+ simTrackerHit->setCellID0(trackerHit->getId());
//#else
// Old method for 32-bit IDs.
//simTrkHit->setCellID(trkHit->getId());
//#endif
// MCP using McpManager
- MCParticleImpl* mcp = m_mcpManager->getMaps()->findMcpFromTrackID(trkHit->getTrackID());
+ MCParticleImpl* mcp = m_mcpManager->getMaps()->findParticle(trackerHit->getTrackID());
if (!mcp) {
log().error(
- "No MCP found for trackID <" + StringUtil::toString(trkHit->getTrackID()) + "> for trk hit.");
+ "No MCP found for trackID <" + StringUtil::toString(trackerHit->getTrackID()) + "> for trk hit.");
} else {
- simTrkHit->setMCParticle(mcp);
+ simTrackerHit->setMCParticle(mcp);
}
- return simTrkHit;
+ return simTrackerHit;
}
// add an MCParticle hit contribution from G4 to LCIO
-void LcioHitsCollectionBuilder::addMcpContribs(CalorimeterHit* g4CalHit,
+void LcioHitsCollectionBuilder::addParticleContributions(CalorimeterHit* g4CalHit,
IMPL::SimCalorimeterHitImpl* simCalHit) {
// Create empty hit contrib list.
HitContributionList contribs;
@@ -330,7 +331,7 @@
const HitContribution& contrib = (*iter);
// Get the MCParticle pointer from the track ID.
- MCParticleImpl* contribMcp = m_mcpManager->getMaps()->findMcpFromTrackID(contrib.getTrackID());
+ MCParticleImpl* contribMcp = m_mcpManager->getMaps()->findParticle(contrib.getTrackID());
if (contribMcp != 0) {
// Add the MCParticle contribution to the hit.
@@ -378,7 +379,7 @@
// old track id in new combined list?
HitContribution* trk_contrib = 0;
- if ((trk_contrib = findMcpHitContribByTrackID((*iter).getTrackID(), combinedContrib))) {
+ if ((trk_contrib = findHitContribution((*iter).getTrackID(), combinedContrib))) {
// Add to the energy deposition.
trk_contrib->incrEdep((*iter).getEdep());
@@ -394,7 +395,7 @@
}
}
-HitContribution* LcioHitsCollectionBuilder::findMcpHitContribByTrackID(int trk_id,
+HitContribution* LcioHitsCollectionBuilder::findHitContribution(int trk_id,
HitContributionList& contribs) {
HitContribution* c = 0;
for (HitContributionList::iterator iter = contribs.begin(); iter != contribs.end(); iter++) {
@@ -407,7 +408,7 @@
return c;
}
-EVENT::LCEvent* LcioHitsCollectionBuilder::createHCsFromG4Event(const G4Event* g4evt, EVENT::LCEvent* lcevt) {
+EVENT::LCEvent* LcioHitsCollectionBuilder::createHitCollectionsFromEvent(const G4Event* g4evt, EVENT::LCEvent* lcevt) {
// set instance vars
m_currentG4Event = g4evt;
m_currentLCEvent = lcevt;
slic/src
diff -u -r1.95 -r1.96
--- LcioManager.cc 1 Jul 2013 21:01:31 -0000 1.95
+++ LcioManager.cc 6 Nov 2013 00:23:37 -0000 1.96
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.95 2013/07/01 21:01:31 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.96 2013/11/06 00:23:37 jeremy Exp $
#include "LcioManager.hh"
// slic
@@ -418,8 +418,7 @@
}
void LcioManager::createHitsCollections() {
- m_HCBuilder->createHCsFromG4Event(G4EventManager::GetEventManager()->GetNonconstCurrentEvent(),
- m_currentLCEvent);
+ m_HCBuilder->createHitCollectionsFromEvent(G4EventManager::GetEventManager()->GetNonconstCurrentEvent(), m_currentLCEvent);
}
void LcioManager::reset() {
slic/src
diff -u -r1.24 -r1.25
--- LcioMcpFactory.cc 30 Jul 2013 21:25:48 -0000 1.24
+++ LcioMcpFactory.cc 6 Nov 2013 00:23:37 -0000 1.25
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpFactory.cc,v 1.24 2013/07/30 21:25:48 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpFactory.cc,v 1.25 2013/11/06 00:23:37 jeremy Exp $
#include "LcioMcpFactory.hh"
// slic
@@ -28,411 +28,431 @@
namespace slic {
LcioMcpFactory::LcioMcpFactory(LcioMcpManager* manager) :
- Module("LcioMcpFactory"), m_manager(manager), m_finalColl(0), m_currentTrajectoryContainer(0) {
+ Module("LcioMcpFactory"), m_manager(manager), m_finalColl(0), m_currentTrajectoryContainer(
+ 0) {
}
LcioMcpFactory::~LcioMcpFactory() {
}
void LcioMcpFactory::createFinalMcpCollection(const G4Event* event) {
- // new coll for final Mcps
- m_finalColl = static_cast<LCCollectionVec*>(m_manager->getFinalMcpCollection());
+ // new coll for final Mcps
+ m_finalColl =
+ static_cast<LCCollectionVec*>(m_manager->getFinalMcpCollection());
- // Set current G4TrajectoryContainer
- m_currentTrajectoryContainer = event->GetTrajectoryContainer();
+ // Set current G4TrajectoryContainer
+ m_currentTrajectoryContainer = event->GetTrajectoryContainer();
- // Check if using StdHep or LCIO e.g. a file-based source?
- if (EventSourceManager::instance()->isFileSource()) {
- // Create from the initial coll of Mcp.
- createFinalMcpCollectionFromInitial(m_manager->getInitialMcpCollection());
- }
- // G4 source using trajectories only.
- else {
- // Create from trajectory container of current G4Event.
- createFinalMcpCollectionFromTrajectoryContainer(m_currentTrajectoryContainer);
- }
+ // Check if using StdHep or LCIO e.g. a file-based source?
+ if (EventSourceManager::instance()->isFileSource()) {
+ // Create from the initial coll of Mcp.
+ createFinalCollectionFromInitial(
+ m_manager->getInitialMcpCollection());
+ }
+ // G4 source using trajectories only.
+ else {
+ // Create from trajectory container of current G4Event.
+ createFinalCollectionFromTrajectories(
+ m_currentTrajectoryContainer);
+ }
- // Fill supplementary collection with MCParticle endpoint energies.
- fillMcpEndPointEnergy(m_finalColl);
+ // Fill supplementary collection with MCParticle endpoint energies.
+ fillEndPointEnergy(m_finalColl);
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromTrajectory(Trajectory* trj) {
+IMPL::MCParticleImpl* LcioMcpFactory::fromTrajectory(Trajectory* trj) {
#ifdef SLIC_LOG
- log() << LOG::debug << "createMcpFromTrajectory() - trackId: " << trj->GetTrackID() << LOG::done;
- log() << LOG::debug << "trj PDG: " << trj->GetParticleDefinition()->GetPDGEncoding() << LOG::done;
+ log() << LOG::debug << "createMcpFromTrajectory() - trackId: " << trj->GetTrackID() << LOG::done;
+ log() << LOG::debug << "trj PDG: " << trj->GetParticleDefinition()->GetPDGEncoding() << LOG::done;
#endif
- // new Mcp
- MCParticleImpl* mcp = new MCParticleImpl();
+ // new Mcp
+ MCParticleImpl* mcp = new MCParticleImpl();
- // PDG
- mcp->setPDG(trj->GetPDGEncoding());
+ // PDG
+ mcp->setPDG(trj->GetPDGEncoding());
- // mom
- G4ThreeVector mom = trj->GetInitialMomentum() / GeV;
- float fmom[3] = { mom.x(), mom.y(), mom.z() };
- mcp->setMomentum(fmom);
+ // mom
+ G4ThreeVector mom = trj->GetInitialMomentum() / GeV;
+ float fmom[3] = { mom.x(), mom.y(), mom.z() };
+ mcp->setMomentum(fmom);
- // Get particle def.
- const G4ParticleDefinition* pdef = trj->GetParticleDefinition();
+ // Get particle def.
+ const G4ParticleDefinition* pdef = trj->GetParticleDefinition();
- // To store mass for new particle.
- G4double m = 0;
+ // To store mass for new particle.
+ G4double m = 0;
- /*
- * For particles from extended particle table supplied by slic, use the StdHep mass instead.
- * Also, use the StdHep mass for PDG codes Geant4 doesn't know that aren't in particle.tbl.
- */
- if (pdef == 0
- || (pdef->GetParticleType().compare("extended") == 0
- || pdef->GetParticleType().compare("susy") == 0)) {
- // Get the primary particle from the LCIO data map.
- MCParticle* primaryMcp = LcioMcpManager::instance()->getMaps()->findPrimaryInitialMcpFromTrajectory(
- trj);
+ /*
+ * For particles from extended particle table supplied by slic, use the StdHep mass instead.
+ * Also, use the StdHep mass for PDG codes Geant4 doesn't know that aren't in particle.tbl.
+ */
+ if (pdef == 0
+ || (pdef->GetParticleType().compare("extended") == 0
+ || pdef->GetParticleType().compare("susy") == 0)) {
+ // Get the primary particle from the LCIO data map.
+ MCParticle* primaryMcp =
+ LcioMcpManager::instance()->getMaps()->findInitialParticle(
+ trj);
- // Require that this particle have a matching primary MCParticle to get mass.
- if (primaryMcp != 0) {
- m = primaryMcp->getMass();
+ // Require that this particle have a matching primary MCParticle to get mass.
+ if (primaryMcp != 0) {
+ m = primaryMcp->getMass();
#ifdef SLIC_LOG
- log() << "mass from primary: " << m << LOG::endl;
+ log() << "mass from primary: " << m << LOG::endl;
#endif
- }
- // Need a primary particle to get mass.
- else {
- G4Exception("", "", FatalException, "Could not find required LCIO primary particle.");
- }
- }
- // Use Geant4's mass from the particle definition, which is appropriate for SM particles.
- else {
- m = trj->GetParticleDefinition()->GetPDGMass() / GeV;
+ }
+ // Need a primary particle to get mass.
+ else {
+ G4Exception("", "", FatalException,
+ "Could not find required LCIO primary particle.");
+ }
+ }
+ // Use Geant4's mass from the particle definition, which is appropriate for SM particles.
+ else {
+ m = trj->GetParticleDefinition()->GetPDGMass() / GeV;
#ifdef SLIC_LOG
- log() << "mass from pdef: " << m << LOG::endl;
+ log() << "mass from pdef: " << m << LOG::endl;
#endif
- }
+ }
- // mass
- mcp->setMass(m);
+ // mass
+ mcp->setMass(m);
- // charge
- mcp->setCharge(trj->GetCharge());
+ // charge
+ mcp->setCharge(trj->GetCharge());
- // begin and end points
- G4int npts = trj->GetPointEntries();
+ // begin and end points
+ G4int npts = trj->GetPointEntries();
- // begin pnt
- G4VTrajectoryPoint* beginTrjPnt = trj->GetPoint(0);
- G4ThreeVector beginPos = beginTrjPnt->GetPosition() / mm;
- double fBeginPos[3] = { beginPos.x(), beginPos.y(), beginPos.z() };
- mcp->setVertex(fBeginPos);
+ // begin pnt
+ G4VTrajectoryPoint* beginTrjPnt = trj->GetPoint(0);
+ G4ThreeVector beginPos = beginTrjPnt->GetPosition() / mm;
+ double fBeginPos[3] = { beginPos.x(), beginPos.y(), beginPos.z() };
+ mcp->setVertex(fBeginPos);
- // end pnt
- G4VTrajectoryPoint* endTrjPnt = trj->GetPoint(npts - 1);
- G4ThreeVector endPos = endTrjPnt->GetPosition() / mm;
- double fEndPos[3] = { endPos.x(), endPos.y(), endPos.z() };
- mcp->setEndpoint(fEndPos);
+ // end pnt
+ G4VTrajectoryPoint* endTrjPnt = trj->GetPoint(npts - 1);
+ G4ThreeVector endPos = endTrjPnt->GetPosition() / mm;
+ double fEndPos[3] = { endPos.x(), endPos.y(), endPos.z() };
+ mcp->setEndpoint(fEndPos);
- // time
- mcp->setTime(trj->GetGlobalTime());
+ // time
+ mcp->setTime(trj->GetGlobalTime());
- // set status codes from trajectory info (with no dep on any associated Mcps)
- LcioMcpStatusSetter::setMcpStatusCodesFromTrajectory(trj, mcp);
+ // set status codes from trajectory info (with no dep on any associated Mcps)
+ LcioMcpStatusSetter::setStatusCodesFromTrajectory(trj, mcp);
- // add to map of trkID -> mcp
+ // add to map of trkID -> mcp
#ifdef SLIC_LOG
- log() << LOG::debug << "adding trackId <" << trj->GetTrackID() << "> to MCP <" << mcp << "> link." << LOG::done;
+ log() << LOG::debug << "adding trackId <" << trj->GetTrackID() << "> to MCP <" << mcp << "> link." << LOG::done;
#endif
- m_manager->getMaps()->addTrackIDToMcpLink(trj->GetTrackID(), mcp);
+ m_manager->getMaps()->addTrackToMCParticle(trj->GetTrackID(), mcp);
- return mcp;
+ return mcp;
}
// FIXME: This method doesn't seem to work correctly!
-void LcioMcpFactory::createFinalMcpCollectionFromTrajectoryContainer(
- G4TrajectoryContainer* m_currentTrajectoryContainer) {
- if (m_currentTrajectoryContainer) {
- // loop over trj cont
- int n_trj = m_currentTrajectoryContainer->entries();
- for (int i = 0; i < n_trj; i++) {
- Trajectory* trj = static_cast<Trajectory*>((*m_currentTrajectoryContainer)[i]);
+void LcioMcpFactory::createFinalCollectionFromTrajectories(
+ G4TrajectoryContainer* m_currentTrajectoryContainer) {
+ if (m_currentTrajectoryContainer) {
+ // loop over trj cont
+ int n_trj = m_currentTrajectoryContainer->entries();
+ for (int i = 0; i < n_trj; i++) {
+ Trajectory* trj =
+ static_cast<Trajectory*>((*m_currentTrajectoryContainer)[i]);
- // Only add primary trajectories; daughters are picked up within.
- if (trj->GetParentID() == 0) {
+ // Only add primary trajectories; daughters are picked up within.
+ if (trj->GetParentID() == 0) {
#ifdef SLIC_LOG
- log() << LOG::debug << "Making primary MCParticle for trajectory with trackID <" << trj->GetTrackID() << ">." << LOG::done;
+ log() << LOG::debug << "Making primary MCParticle for trajectory with trackID <" << trj->GetTrackID() << ">." << LOG::done;
#endif
- // Create MCParticle output from trajectory.
- MCParticleImpl* mcp = createMcpFromTrajectory(trj);
+ // Create MCParticle output from trajectory.
+ MCParticleImpl* mcp = fromTrajectory(trj);
- // Add to the final MCParticle collection.
- m_finalColl->addElement(mcp);
+ // Add to the final MCParticle collection.
+ m_finalColl->addElement(mcp);
- // Process the daughters.
+ // Process the daughters.
#ifdef SLIC_LOG
- log() << LOG::debug << "Making primary MCParticle for trajectory with trackID <" << trj->GetTrackID() << ">." << LOG::done;
+ log() << LOG::debug << "Making primary MCParticle for trajectory with trackID <" << trj->GetTrackID() << ">." << LOG::done;
#endif
- addMcpDaughtersFromTrajectoryContainer(mcp, trj->GetTrackID());
- }
- }
- } else {
- G4Exception("", "", FatalException, "G4TrajectoryContainer is null!");
- }
+ createDaughters(mcp, trj->GetTrackID());
+ }
+ }
+ } else {
+ G4Exception("", "", FatalException, "G4TrajectoryContainer is null!");
+ }
- // DEBUG
- LcioMcpManager::instance()->getMaps()->printTrackToMcpMap();
+ // DEBUG
+ LcioMcpManager::instance()->getMaps()->printTracksToParticles();
}
-void LcioMcpFactory::addMcpDaughtersFromTrajectoryContainer(MCParticleImpl* parMcp, int parTrkID) {
+void LcioMcpFactory::createDaughters(
+ MCParticleImpl* parMcp, int parTrkID) {
#ifdef SLIC_LOG
- log() << LOG::debug << "addMcpDaughtersFromTraj - parTrkId <" << parTrkID << ">." << LOG::done;
+ log() << LOG::debug << "addMcpDaughtersFromTraj - parTrkId <" << parTrkID << ">." << LOG::done;
#endif
- // loop over trj cont
- int n_trj = m_currentTrajectoryContainer->entries();
- for (int i = 0; i < n_trj; i++) {
- Trajectory* trj = static_cast<Trajectory*>((*m_currentTrajectoryContainer)[i]);
+ // loop over trj cont
+ int n_trj = m_currentTrajectoryContainer->entries();
+ for (int i = 0; i < n_trj; i++) {
+ Trajectory* trj =
+ static_cast<Trajectory*>((*m_currentTrajectoryContainer)[i]);
- if (trj->GetParentID() == parTrkID) {
+ if (trj->GetParentID() == parTrkID) {
- // lkp dau Mcp by track ID
- MCParticleImpl* dauMcp = m_manager->getMaps()->findMcpFromTrackID(trj->GetTrackID());
+ // lkp dau Mcp by track ID
+ MCParticleImpl* dauMcp = m_manager->getMaps()->findParticle(
+ trj->GetTrackID());
- if (dauMcp == 0) {
- dauMcp = createMcpFromTrajectory(trj);
- }
+ if (dauMcp == 0) {
+ dauMcp = fromTrajectory(trj);
+ }
- if (dauMcp == 0)
- G4Exception("", "", FatalException, "Failed to create MCParticle.");
+ if (dauMcp == 0)
+ G4Exception("", "", FatalException,
+ "Failed to create MCParticle.");
- // add this to final coll
- m_finalColl->addElement(dauMcp);
+ // add this to final coll
+ m_finalColl->addElement(dauMcp);
- // Recursively add daughters of this daughter.
- addMcpDaughtersFromTrajectoryContainer(dauMcp, trj->GetTrackID());
+ // Recursively add daughters of this daughter.
+ createDaughters(dauMcp, trj->GetTrackID());
- // Set the parent particle in the daughter.
- dauMcp->addParent(parMcp);
- }
- }
+ // Set the parent particle in the daughter.
+ dauMcp->addParent(parMcp);
+ }
+ }
}
-void LcioMcpFactory::createFinalMcpCollectionFromInitial(EVENT::LCCollection* mcpVecInitial) {
- // coll must exist
- if (mcpVecInitial) {
- // get num Mcp in coll
- int numInitMcp = mcpVecInitial->getNumberOfElements();
+void LcioMcpFactory::createFinalCollectionFromInitial(
+ EVENT::LCCollection* mcpVecInitial) {
+ // coll must exist
+ if (mcpVecInitial) {
+ // get num Mcp in coll
+ int numInitMcp = mcpVecInitial->getNumberOfElements();
- // coll must have members
- if (numInitMcp > 0) {
- // loop over input Mcp coll
- for (int i = 0; i < numInitMcp; i++) {
+ // coll must have members
+ if (numInitMcp > 0) {
+ // loop over input Mcp coll
+ for (int i = 0; i < numInitMcp; i++) {
#ifdef SLIC_LOG
- log() << LOG::debug << "proc initial MCP: " << i << LOG::done;
+ log() << LOG::debug << "proc initial MCP: " << i << LOG::done;
#endif
- // get Mcp
- MCParticleImpl* mcp = static_cast<MCParticleImpl*>(mcpVecInitial->getElementAt(i));
-
- // create only from Mcp primaries, e.g. no parents
- if (LcioMcpUtil::isPrimary(mcp)) {
-#ifdef SLIC_LOG
- log() << LOG::debug << "isPrimary" << LOG::done;
-#endif
-
- createMcpFromInitialRecurse(mcp);
- }
- }
- } else {
- G4Exception("", "", FatalException, "Initial McpVec has no members.");
- }
- } else {
- G4Exception("", "", FatalException, "Initial McpVec ptr is null.");
- }
+ // get Mcp
+ MCParticleImpl* mcp =
+ static_cast<MCParticleImpl*>(mcpVecInitial->getElementAt(
+ i));
+
+ // create only from Mcp primaries, e.g. no parents
+ if (LcioMcpUtil::isPrimary(mcp)) {
+#ifdef SLIC_LOG
+ log() << LOG::debug << "isPrimary" << LOG::done;
+#endif
+
+ fromInitialRecurse(mcp);
+ }
+ }
+ } else {
+ G4Exception("", "", FatalException,
+ "Initial McpVec has no members.");
+ }
+ } else {
+ G4Exception("", "", FatalException, "Initial McpVec ptr is null.");
+ }
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromInitialRecurse(EVENT::MCParticle* mcpInit) {
+IMPL::MCParticleImpl* LcioMcpFactory::fromInitialRecurse(EVENT::MCParticle* mcpInit) {
#ifdef SLIC_LOG
- log() << LOG::debug << "createMcpFromInitialRecurse: " << m_manager->getMCParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
+ log() << LOG::debug << "createMcpFromInitialRecurse: " << m_manager->getParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
#endif
- MCParticleImpl* mcp = 0;
+ MCParticleImpl* mcp = 0;
- // find associated primary
- G4PrimaryParticle* g4primary = m_manager->getMaps()->findPrimaryFromMcp(mcpInit);
+ // find associated primary
+ G4PrimaryParticle* g4primary = m_manager->getMaps()->findPrimary(
+ mcpInit);
- // no associated primary with this initial mcp?
- if (!g4primary) {
+ // no associated primary with this initial mcp?
+ if (!g4primary) {
#ifdef SLIC_LOG
- log() << LOG::debug << "initialOnly" << LOG::done;
+ log() << LOG::debug << "initialOnly" << LOG::done;
#endif
- // create from initial Mcp only
- mcp = createMcpFromInitialOnly(mcpInit);
- }
- // create from primary
- else {
+ // create from initial Mcp only
+ mcp = fromInitialOnly(mcpInit);
+ }
+ // create from primary
+ else {
#ifdef SLIC_LOG
- log() << LOG::debug << "fromPrimary" << LOG::done;
+ log() << LOG::debug << "fromPrimary" << LOG::done;
#endif
- // create it from primary
- mcp = createMcpFromPrimary(g4primary, mcpInit);
- }
+ // create it from primary
+ mcp = fromPrimary(g4primary, mcpInit);
+ }
- // return the output MCP
- return mcp;
+ // return the output MCP
+ return mcp;
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromInitialOnly(EVENT::MCParticle* mcpInit) {
- log() << LOG::debug << "createMcpFromInitialOnly: "
- << m_manager->getMCParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
+IMPL::MCParticleImpl* LcioMcpFactory::fromInitialOnly(
+ EVENT::MCParticle* mcpInit) {
+ log() << LOG::debug << "createMcpFromInitialOnly: "
+ << m_manager->getParticleIndex(
+ m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
- // copy shallow the initial
- MCParticleImpl* mcp = createMcpShallowCopy(mcpInit);
+ // copy shallow the initial
+ MCParticleImpl* mcp = shallowCopy(mcpInit);
- // should add to Mcp map here?
- m_manager->getMaps()->addInitialMcpToFinalMcpLink(mcpInit, mcp);
+ // should add to Mcp map here?
+ m_manager->getMaps()->addInitialParticleToFinal(mcpInit, mcp);
- // given initial, create and add daughters
- addMcpDaughtersFromInitial(mcp, mcpInit);
+ // given initial, create and add daughters
+ addDaughtersFromInitial(mcp, mcpInit);
- // add to final coll
- m_finalColl->addElement(mcp);
+ // add to final coll
+ m_finalColl->addElement(mcp);
- return mcp;
+ return mcp;
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromPrimary(G4PrimaryParticle* primary,
- EVENT::MCParticle* mcpInit) {
+IMPL::MCParticleImpl* LcioMcpFactory::fromPrimary(
+ G4PrimaryParticle* primary, EVENT::MCParticle* mcpInit) {
#ifdef SLIC_LOG
- log() << LOG::done << "createMcpFromPrimary - MCP idx <" << m_manager->getMCParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << ">" << LOG::done;
+ log() << LOG::done << "createMcpFromPrimary - MCP idx <" << m_manager->getParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << ">" << LOG::done;
#endif
- int trkID = primary->GetTrackID();
+ int trkID = primary->GetTrackID();
#ifdef SLIC_LOG
- if (trkID <= 0)
- {
- log() << "WARNING: trkID <" << trkID << "> looks bad" << LOG::done;
- }
- log() << LOG::done << "primary TID <" << trkID << ">" << LOG::done;
+ if (trkID <= 0)
+ {
+ log() << "WARNING: trkID <" << trkID << "> looks bad" << LOG::done;
+ }
+ log() << LOG::done << "primary TID <" << trkID << ">" << LOG::done;
#endif
- MCParticleImpl* mcp = 0;
- Trajectory* trj = TrajectoryManager::instance()->findTrajectory(trkID);
+ MCParticleImpl* mcp = 0;
+ Trajectory* trj = TrajectoryManager::instance()->findTrajectory(trkID);
- // No trajectory was created.
- if (!trj) {
+ // No trajectory was created.
+ if (!trj) {
#ifdef SLIC_LOG
- log() << LOG::debug << "initialAndPrimary" << LOG::done;
+ log() << LOG::debug << "initialAndPrimary" << LOG::done;
#endif
- // Recursively create particles from primary and initial MCParticles.
- mcp = createMcpFromInitialAndPrimary(primary, mcpInit);
+ // Recursively create particles from primary and initial MCParticles.
+ mcp = fromInitialAndPrimary(primary, mcpInit);
- }
- // Found a trajectory.
- else {
+ }
+ // Found a trajectory.
+ else {
#ifdef SLIC_LOG
- log() << LOG::debug << "initialAndTrajectory" << LOG::done;
+ log() << LOG::debug << "initialAndTrajectory" << LOG::done;
#endif
- // Recursively create MCParticles from a trajectory and the initial MCParticle.
- mcp = createMcpFromInitialAndTrajectory(trj, mcpInit);
+ // Recursively create MCParticles from a trajectory and the initial MCParticle.
+ mcp = fromInitialAndTrajectory(trj, mcpInit);
- }
+ }
- // Set generator status from initial particle.
- mcp->setGeneratorStatus(mcpInit->getGeneratorStatus());
+ // Set generator status from initial particle.
+ mcp->setGeneratorStatus(mcpInit->getGeneratorStatus());
- // Primary particles do not originate in the simulation.
- mcp->setCreatedInSimulation(false);
+ // Primary particles do not originate in the simulation.
+ mcp->setCreatedInSimulation(false);
- // Link the input MCP to an output MCP.
- m_manager->getMaps()->addInitialMcpToFinalMcpLink(mcpInit, mcp);
+ // Link the input MCP to an output MCP.
+ m_manager->getMaps()->addInitialParticleToFinal(mcpInit, mcp);
//#ifdef SLIC_LOG
// log() << LOG::debug << "createMcpFromPrimary() - adding trackId <" << trj->GetTrackID() << "> to MCP <" << mcp << "> link." << LOG::done;
//#endif
// Link the track ID to the output particle.
- if (trkID > 0) {
- m_manager->getMaps()->addTrackIDToMcpLink(trkID, mcp);
- } else {
+ if (trkID > 0) {
+ m_manager->getMaps()->addTrackToMCParticle(trkID, mcp);
+ } else {
#ifdef SLIC_LOG
- log() << LOG::debug << "WARNING: not adding trkID <" << trkID << "> to map!" << LOG::done;
+ log() << LOG::debug << "WARNING: not adding trkID <" << trkID << "> to map!" << LOG::done;
#endif
- }
+ }
//#ifdef SLIC_LOG
// log() << LOG::done;
//#endif
- return mcp;
+ return mcp;
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromInitialAndPrimary(G4PrimaryParticle* primary,
- EVENT::MCParticle* mcpInit) {
- log() << LOG::done << "createMcpFromInitialAndPrimary: "
- << m_manager->getMCParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
-
- /*
- * Create new Mcp from primary particle,
- * shallow copy only (no recursion).
- */
- MCParticleImpl* mcpNew = createMcpFromPrimaryShallowCopy(primary);
-
- /* Get vertex from initial particle, because primary does not have it -- was immediately decayed */
- double vtx[3] = { mcpInit->getVertex()[0], mcpInit->getVertex()[1], mcpInit->getVertex()[2] };
- mcpNew->setVertex(vtx);
-
- /* setup primary's daughters */
- createDaughtersFromPrimary(primary, /* this primary */
- mcpInit, /* associated initial Mcp particle */
- mcpNew /* parent Mcp particle */
- );
+IMPL::MCParticleImpl* LcioMcpFactory::fromInitialAndPrimary(
+ G4PrimaryParticle* primary, EVENT::MCParticle* mcpInit) {
+ log() << LOG::done << "createMcpFromInitialAndPrimary: "
+ << m_manager->getParticleIndex(
+ m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
+
+ /*
+ * Create new Mcp from primary particle,
+ * shallow copy only (no recursion).
+ */
+ MCParticleImpl* mcpNew = fromPrimaryShallowCopy(primary);
+
+ /* Get vertex from initial particle, because primary does not have it -- was immediately decayed */
+ double vtx[3] = { mcpInit->getVertex()[0], mcpInit->getVertex()[1],
+ mcpInit->getVertex()[2] };
+ mcpNew->setVertex(vtx);
+
+ /* setup primary's daughters */
+ daughtersFromPrimary(primary, /* this primary */
+ mcpInit, /* associated initial Mcp particle */
+ mcpNew /* parent Mcp particle */
+ );
#ifdef SLIC_DEBUG
- if (mcpNew->getDaughters().size() == 0)
- {
+ if (mcpNew->getDaughters().size() == 0)
+ {
#ifdef SLIC_LOG
- log() << LOG::debug << "No Mcp daughters added." << LOG::done;
+ log() << LOG::debug << "No Mcp daughters added." << LOG::done;
#endif
- }
+ }
#endif
- // Copy spin and color flow information if LCIO version is compatible.
+ // Copy spin and color flow information if LCIO version is compatible.
#if LCIO_VERSION_GE(1, 60)
- copySpinAndColorFlow(mcpInit, mcpNew);
+ copySpinAndColorFlow(mcpInit, mcpNew);
#endif
- // done with particle; add to coll
- m_finalColl->addElement(mcpNew);
+ // done with particle; add to coll
+ m_finalColl->addElement(mcpNew);
- return mcpNew;
+ return mcpNew;
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromInitialAndTrajectory(Trajectory* trj,
- EVENT::MCParticle* mcpInit) {
+IMPL::MCParticleImpl* LcioMcpFactory::fromInitialAndTrajectory(
+ Trajectory* trj, EVENT::MCParticle* mcpInit) {
#ifdef SLIC_LOG
- log() << LOG::done << "createMcpFromInitialAndTrajectory: " << m_manager->getMCParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
+ log() << LOG::done << "createMcpFromInitialAndTrajectory: " << m_manager->getParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
#endif
- // shallow copy create with basic info and no daughters
- IMPL::MCParticleImpl* mcp = createMcpFromTrajectory(trj);
+ // shallow copy create with basic info and no daughters
+ IMPL::MCParticleImpl* mcp = fromTrajectory(trj);
- // set generator status and created in sim flag
- LcioMcpStatusSetter::setGeneratorStatus(mcpInit, mcp);
+ // set generator status and created in sim flag
+ LcioMcpStatusSetter::setGeneratorStatus(mcpInit, mcp);
- // loop over all trajectories to find trajectory daughter
- int numTrj = m_currentTrajectoryContainer->entries();
+ // loop over all trajectories to find trajectory daughter
+ int numTrj = m_currentTrajectoryContainer->entries();
#ifdef SLIC_LOG
- log() << LOG::done << "nTrajectoryDau: " << numTrj << LOG::done;
+ log() << LOG::done << "nTrajectoryDau: " << numTrj << LOG::done;
#endif
//#ifdef SLIC_LOG
@@ -442,191 +462,197 @@
// }
//#endif
- for (int j = 0; j < numTrj; j++) {
+ for (int j = 0; j < numTrj; j++) {
- Trajectory* thisTrj = static_cast<Trajectory*>((*m_currentTrajectoryContainer)[j]);
+ Trajectory* thisTrj =
+ static_cast<Trajectory*>((*m_currentTrajectoryContainer)[j]);
- // found daughter
- if (thisTrj->GetParentID() == trj->GetTrackID()) {
+ // found daughter
+ if (thisTrj->GetParentID() == trj->GetTrackID()) {
#ifdef SLIC_LOG
- log() << LOG::debug << "Trajectory with trackID <" << trj->GetTrackID() << "> has parent with trackID <" << thisTrj->GetParentID() << ">" << LOG::done;
+ log() << LOG::debug << "Trajectory with trackID <" << trj->GetTrackID() << "> has parent with trackID <" << thisTrj->GetParentID() << ">" << LOG::done;
#endif
- // find matching primary Mcp input particle
- MCParticle* mcpPrim = m_manager->getMaps()->findPrimaryInitialMcpFromTrajectory(thisTrj);
+ // find matching primary Mcp input particle
+ MCParticle* mcpPrim =
+ m_manager->getMaps()->findInitialParticle(
+ thisTrj);
- // create MCP output particle from this input daughter
- MCParticleImpl* mcpDauNew = createMcpFromInitialAndTrajectory(thisTrj, mcpPrim);
+ // create MCP output particle from this input daughter
+ MCParticleImpl* mcpDauNew = fromInitialAndTrajectory(
+ thisTrj, mcpPrim);
- // set parent link of new daughter
- mcpDauNew->addParent(mcp);
- }
- // DEBUG
- //else
- //{
- // log() << LOG::done << "BAD NEWS! Could not find Trajectory <" << j << "> with TID <" << trj->GetTrackID() << ">" << LOG::done;
- //}
- // END DEBUG
- }
+ // set parent link of new daughter
+ mcpDauNew->addParent(mcp);
+ }
+ // DEBUG
+ //else
+ //{
+ // log() << LOG::done << "BAD NEWS! Could not find Trajectory <" << j << "> with TID <" << trj->GetTrackID() << ">" << LOG::done;
+ //}
+ // END DEBUG
+ }
- // add to collection
- m_finalColl->addElement(mcp);
+ // add to collection
+ m_finalColl->addElement(mcp);
- return mcp;
+ return mcp;
}
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpShallowCopy(EVENT::MCParticle* mcp) {
- IMPL::MCParticleImpl* mcpNew = new IMPL::MCParticleImpl();
+IMPL::MCParticleImpl* LcioMcpFactory::shallowCopy(
+ EVENT::MCParticle* mcp) {
+ IMPL::MCParticleImpl* mcpNew = new IMPL::MCParticleImpl();
- mcpNew->setPDG(mcp->getPDG());
+ mcpNew->setPDG(mcp->getPDG());
- float p[3] = { mcp->getMomentum()[0], mcp->getMomentum()[1], mcp->getMomentum()[2] };
+ float p[3] = { mcp->getMomentum()[0], mcp->getMomentum()[1],
+ mcp->getMomentum()[2] };
- mcpNew->setMomentum(p);
- mcpNew->setMass(mcp->getMass());
+ mcpNew->setMomentum(p);
+ mcpNew->setMass(mcp->getMass());
- double vtx[3] = { mcp->getVertex()[0], mcp->getVertex()[1], mcp->getVertex()[2] };
- mcpNew->setVertex(vtx);
+ double vtx[3] = { mcp->getVertex()[0], mcp->getVertex()[1],
+ mcp->getVertex()[2] };
+ mcpNew->setVertex(vtx);
- mcpNew->setGeneratorStatus(mcp->getGeneratorStatus());
- mcpNew->setSimulatorStatus(0);
- mcpNew->setCharge(mcp->getCharge());
- mcpNew->setTime(mcp->getTime());
+ mcpNew->setGeneratorStatus(mcp->getGeneratorStatus());
+ mcpNew->setSimulatorStatus(0);
+ mcpNew->setCharge(mcp->getCharge());
+ mcpNew->setTime(mcp->getTime());
-#if LCIO_VERSION_GE(1, 60)
- copySpinAndColorFlow(mcp, mcpNew);
-#endif
+ copySpinAndColorFlow(mcp, mcpNew);
- return mcpNew;
+ return mcpNew;
}
// FIXME: Need to pass along colorflow and spin in this method???
-IMPL::MCParticleImpl* LcioMcpFactory::createMcpFromPrimaryShallowCopy(G4PrimaryParticle* primary) {
- // new MCP
- MCParticleImpl* mcp = new MCParticleImpl();
+IMPL::MCParticleImpl* LcioMcpFactory::fromPrimaryShallowCopy(
+ G4PrimaryParticle* primary) {
+ // new MCP
+ MCParticleImpl* mcp = new MCParticleImpl();
- // PDG
- mcp->setPDG(primary->GetPDGcode());
+ // PDG
+ mcp->setPDG(primary->GetPDGcode());
- // momentum
- G4ThreeVector pVec = primary->GetMomentum() / GeV;
- float p[3] = { pVec.x(), pVec.y(), pVec.z() };
- mcp->setMomentum(p);
+ // momentum
+ G4ThreeVector pVec = primary->GetMomentum() / GeV;
+ float p[3] = { pVec.x(), pVec.y(), pVec.z() };
+ mcp->setMomentum(p);
- // mass
- mcp->setMass(primary->GetMass() / GeV);
+ // mass
+ mcp->setMass(primary->GetMass() / GeV);
#ifdef SLIC_LOG
- log() << "mass from primary: " << mcp->getMass() << LOG::endl;
+ log() << "mass from primary: " << mcp->getMass() << LOG::endl;
#endif
- // FIXME: Wrong if G4PrimaryParticle actually has valid charge. (Can it happen?)
- mcp->setCharge(LcioMcpManager::m_NAN);
+ // FIXME: Wrong if G4PrimaryParticle actually has valid charge. (Can it happen?)
+ mcp->setCharge(LcioMcpManager::m_NAN);
- return mcp;
+ return mcp;
}
// create LCIO MCParticles from daughters, setting proper linkage
-void LcioMcpFactory::createDaughtersFromPrimary(G4PrimaryParticle* primary, EVENT::MCParticle* mcpInit,
- IMPL::MCParticleImpl* mcpPar) {
+void LcioMcpFactory::daughtersFromPrimary(G4PrimaryParticle* primary, EVENT::MCParticle* initial, IMPL::MCParticleImpl* parentParticle) {
#ifdef SLIC_LOG
- log() << LOG::debug << "createDaughtersFromPrimary" << LOG::done;
- log() << LOG::debug << "primary: " << primary << LOG::done;
- log() << LOG::debug << "trkID: " << primary->GetTrackID() << LOG::done;
- log() << LOG::debug << "mcpInit: " << mcpInit << LOG::done;
- log() << LOG::debug << "mcpPar: " << mcpPar << LOG::done;
+ log() << LOG::debug << "createDaughtersFromPrimary" << LOG::done;
+ log() << LOG::debug << "primary: " << primary << LOG::done;
+ log() << LOG::debug << "trkID: " << primary->GetTrackID() << LOG::done;
+ log() << LOG::debug << "mcpInit: " << initial << LOG::done;
+ log() << LOG::debug << "parentParticle: " << parentParticle << LOG::done;
#endif
- // loop over primary daughters
- G4PrimaryParticle* primDau = primary->GetDaughter();
- while (primDau) {
+ // loop over primary daughters
+ G4PrimaryParticle* primaryDaughter = primary->GetDaughter();
+ while (primaryDaughter) {
- // find input Mcp for the primary dau
- MCParticle* mcpDau = m_manager->getMaps()->findDaughterMcpFromPrimary(mcpInit, primDau);
+ // find input Mcp for the primary dau
+ MCParticle* mcpDau = m_manager->getMaps()->findDaughterParticle(initial, primaryDaughter);
- // must find it or die
- if (0 == mcpDau) {
- G4Exception("", "", FatalException, "Mcp daughter was not found.");
- }
+ // must find it or die
+ if (0 == mcpDau) {
+ G4Exception("", "", FatalException, "Mcp daughter was not found.");
+ }
- // create dau Mcp
- MCParticleImpl* mcpDauNew = createMcpFromPrimary(primDau, mcpDau);
+ // create dau Mcp
+ MCParticleImpl* mcpDauNew = fromPrimary(primaryDaughter, mcpDau);
- // make mcpPar the parent
- mcpDauNew->addParent(mcpPar);
+ // make mcpPar the parent
+ mcpDauNew->addParent(parentParticle);
- // get next primary dau
- primDau = primDau->GetNext();
- }
+ // get next primary dau
+ primaryDaughter = primaryDaughter->GetNext();
+ }
}
-void LcioMcpFactory::addMcpDaughtersFromInitial(IMPL::MCParticleImpl* mcpNew, EVENT::MCParticle* mcpInit) {
+void LcioMcpFactory::addDaughtersFromInitial(IMPL::MCParticleImpl* mcpNew,
+ EVENT::MCParticle* mcpInit) {
#ifdef SLIC_LOG
- log() << LOG::debug << "addMcpDaughtersFromInitial: " << m_manager->getMCParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
+ log() << LOG::debug << "addMcpDaughtersFromInitial: " << m_manager->getParticleIndex(m_manager->getInitialMcpCollection(), mcpInit) << LOG::done;
#endif
- int numDau = mcpInit->getDaughters().size();
+ int numDau = mcpInit->getDaughters().size();
- for (int i = 0; i < numDau; i++) {
- // child of input particle
- MCParticle* mcpChildInit = mcpInit->getDaughters()[i];
+ for (int i = 0; i < numDau; i++) {
+ // child of input particle
+ MCParticle* mcpChildInit = mcpInit->getDaughters()[i];
- // use a search function to avoid insert when null!
- MCParticleImpl* mcpChildFinal = m_manager->getMaps()->findFinalParticleFromInitial(mcpChildInit);
+ // use a search function to avoid insert when null!
+ MCParticleImpl* mcpChildFinal =
+ m_manager->getMaps()->findFinalParticle(
+ mcpChildInit);
- // if not added already
- if (mcpChildFinal == 0) {
- // create daughter
- mcpChildFinal = createMcpFromInitialRecurse(mcpChildInit);
- }
+ // if not added already
+ if (mcpChildFinal == 0) {
+ // create daughter
+ mcpChildFinal = fromInitialRecurse(mcpChildInit);
+ }
- // add parent regardless of above; maybe new MCP or already created
- mcpChildFinal->addParent(mcpNew);
- }
+ // add parent regardless of above; maybe new MCP or already created
+ mcpChildFinal->addParent(mcpNew);
+ }
}
-void LcioMcpFactory::fillMcpEndPointEnergy(LCCollectionVec* mcpColl) {
- /* Add endpoint energies to LCGenericObject collection. */
- LcioMcpMaps* maps = LcioMcpManager::instance()->getMaps();
- LCCollectionVec* epColl = new LCCollectionVec(LCIO::LCGENERICOBJECT);
- for (LCCollectionVec::iterator it = mcpColl->begin(); it != mcpColl->end(); it++) {
+void LcioMcpFactory::fillEndPointEnergy(LCCollectionVec* mcpColl) {
+ /* Add endpoint energies to LCGenericObject collection. */
+ LcioMcpMaps* maps = LcioMcpManager::instance()->getMaps();
+ LCCollectionVec* epColl = new LCCollectionVec(LCIO::LCGENERICOBJECT);
+ for (LCCollectionVec::iterator it = mcpColl->begin(); it != mcpColl->end(); it++) {
- MCParticle* mcp = static_cast<MCParticle*>(*it);
- G4int trkID = maps->findTrackIDFromFinalMcp(mcp);
- double epE = -1.0;
- if (trkID != -1) {
- Trajectory* trj = TrajectoryManager::instance()->findTrajectory(trkID);
+ MCParticle* mcp = static_cast<MCParticle*>(*it);
+ G4int trkID = maps->findTrack(mcp);
+ double epE = -1.0;
+ if (trkID != -1) {
+ Trajectory* trj = TrajectoryManager::instance()->findTrajectory(
+ trkID);
- if (0 != trj) {
- epE = trj->getEndPointEnergy();
- }
- }
+ if (0 != trj) {
+ epE = trj->getEndPointEnergy();
+ }
+ }
- LCGenericObjectImpl* obj = new LCGenericObjectImpl();
- obj->setFloatVal(0, epE);
- epColl->push_back(obj);
- }
- LcioManager::instance()->getCurrentLCEvent()->addCollection(epColl, "MCParticleEndPointEnergy");
+ LCGenericObjectImpl* obj = new LCGenericObjectImpl();
+ obj->setFloatVal(0, epE);
+ epColl->push_back(obj);
+ }
+ LcioManager::instance()->getCurrentLCEvent()->addCollection(epColl, "MCParticleEndPointEnergy");
}
-#if LCIO_VERSION_GE(1, 60)
-void LcioMcpFactory::copySpinAndColorFlow(MCParticle* mcp1, MCParticle* mcp2)
-{
- // Set spin.
- const float* spin1 = mcp1->getSpin();
- float spin2[3];
- spin2[0] = spin1[0];
[truncated at 1000 lines; 28 more skipped]
slic/src
diff -u -r1.6 -r1.7
--- LcioMcpFilter.cc 27 Nov 2012 19:32:19 -0000 1.6
+++ LcioMcpFilter.cc 6 Nov 2013 00:23:37 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpFilter.cc,v 1.6 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpFilter.cc,v 1.7 2013/11/06 00:23:37 jeremy Exp $
#include "LcioMcpFilter.hh"
// slic
@@ -49,7 +49,7 @@
#endif
// make new Mcp (function checks if gen part)
- makeMcp(mcp, genMcpColl);
+ makeParticle(mcp, genMcpColl);
// add to coll
//if ( simMcp ) {
@@ -73,7 +73,7 @@
return genMcpColl;
}
-IMPL::MCParticleImpl* LcioMcpFilter::makeMcp(EVENT::MCParticle* mcp, EVENT::LCCollection* mcpColl) {
+IMPL::MCParticleImpl* LcioMcpFilter::makeParticle(EVENT::MCParticle* mcp, EVENT::LCCollection* mcpColl) {
IMPL::MCParticleImpl* mcpGen = 0;
// has non-0 gen status and was not added?
@@ -145,7 +145,7 @@
if (dauMcp) {
// make a new dau (could be null )
- IMPL::MCParticleImpl* newDauMcp = makeMcp(dauMcp, mcpColl);
+ IMPL::MCParticleImpl* newDauMcp = makeParticle(dauMcp, mcpColl);
// made a new dau?
if (newDauMcp) {
slic/src
diff -u -r1.74 -r1.75
--- LcioMcpManager.cc 26 Jun 2013 01:57:02 -0000 1.74
+++ LcioMcpManager.cc 6 Nov 2013 00:23:37 -0000 1.75
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpManager.cc,v 1.74 2013/06/26 01:57:02 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpManager.cc,v 1.75 2013/11/06 00:23:37 jeremy Exp $
#include "LcioMcpManager.hh"
// slic
@@ -109,7 +109,7 @@
#endif
}
-EVENT::LCCollection* LcioMcpManager::findMcpCollection(EVENT::LCEvent* event) {
+EVENT::LCCollection* LcioMcpManager::findParticleCollection(EVENT::LCEvent* event) {
const std::vector<std::string>* collNames = event->getCollectionNames();
EVENT::LCCollection* mcpColl = 0;
@@ -124,7 +124,7 @@
return mcpColl;
}
-EVENT::LCCollection* LcioMcpManager::findMcpCollection(const std::string& collName) {
+EVENT::LCCollection* LcioMcpManager::findParticleCollection(const std::string& collName) {
return m_mcpColls[collName];
}
@@ -136,13 +136,13 @@
}
}
-EVENT::LCCollection* LcioMcpManager::createMcpCollection(const std::string& collName) {
+EVENT::LCCollection* LcioMcpManager::createParticleCollection(const std::string& collName) {
#ifdef SLIC_LOG
log() << LOG::debug << "creating mcp coll <" << collName << ">" << LOG::done;
#endif
LCCollection* coll = 0;
- if (findMcpCollection(collName)) {
+ if (findParticleCollection(collName)) {
G4Exception("", "", FatalException, "Attempting to create duplicate Mcp collection.");
} else {
coll = new LCCollectionVec(LCIO::MCPARTICLE);
@@ -191,16 +191,16 @@
// get MCP collection generated at EndOfEvent
EVENT::LCCollection* LcioMcpManager::getFinalMcpCollection() {
- if (!findMcpCollection("final")) {
- createMcpCollection("final");
+ if (!findParticleCollection("final")) {
+ createParticleCollection("final");
}
return m_mcpColls["final"];
}
EVENT::LCCollection* LcioMcpManager::getInitialMcpCollection() {
- if (!findMcpCollection("initial")) {
- createMcpCollection("initial");
+ if (!findParticleCollection("initial")) {
+ createParticleCollection("initial");
}
return m_mcpColls["initial"];
@@ -232,12 +232,8 @@
}
}
-double LcioMcpManager::getNoChargeFlag() const {
- return m_NAN;
-}
-
void LcioMcpManager::printMcpCollection(const std::string& collName) {
- LCCollection* coll = findMcpCollection(collName);
+ LCCollection* coll = findParticleCollection(collName);
if (coll != 0) {
printMcpCollection(collName, coll);
@@ -250,10 +246,10 @@
}
void LcioMcpManager::printMcpCollection(const std::string& collName, EVENT::LCCollection* coll) {
- m_printer->printMcpCollection(collName, coll);
+ m_printer->printParticleCollection(collName, coll);
}
-int LcioMcpManager::getMCParticleIndex(EVENT::LCCollection* collection, EVENT::MCParticle* particle) {
+int LcioMcpManager::getParticleIndex(EVENT::LCCollection* collection, EVENT::MCParticle* particle) {
if (collection->getTypeName() != LCIO::MCPARTICLE)
return -1;
slic/src
diff -u -r1.7 -r1.8
--- LcioMcpMaps.cc 27 Nov 2012 19:32:19 -0000 1.7
+++ LcioMcpMaps.cc 6 Nov 2013 00:23:37 -0000 1.8
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpMaps.cc,v 1.7 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpMaps.cc,v 1.8 2013/11/06 00:23:37 jeremy Exp $
#include "LcioMcpMaps.hh"
// slic
@@ -19,14 +19,14 @@
LcioMcpMaps::~LcioMcpMaps() {
}
-void LcioMcpMaps::addTrackIDToMcpLink(G4int trkID, MCParticleImpl* mcp) {
- assert( mcp);
- assert(trkID > 0);
+void LcioMcpMaps::addTrackToMCParticle(G4int trackID, MCParticleImpl* particle) {
+ assert(particle);
+ assert(trackID > 0);
- m_trackToMcp[trkID] = mcp;
+ m_trackToMcp[trackID] = particle;
}
-MCParticleImpl* LcioMcpMaps::findMcpFromTrackID(G4int trkID) const {
+MCParticleImpl* LcioMcpMaps::findParticle(G4int trkID) const {
MCParticleImpl* mcp = 0;
for (TrackToMcpMap::const_iterator iter = m_trackToMcp.begin(); iter != m_trackToMcp.end(); iter++) {
if (iter->first == trkID) {
@@ -38,7 +38,7 @@
}
/* Find the trackID for the final MCParticle. */
-G4int LcioMcpMaps::findTrackIDFromFinalMcp(MCParticle* mcp) const {
+G4int LcioMcpMaps::findTrack(MCParticle* mcp) const {
G4int trkID = -1;
for (TrackToMcpMap::const_iterator iter = m_trackToMcp.begin(); iter != m_trackToMcp.end(); iter++) {
if (iter->second == mcp) {
@@ -49,7 +49,7 @@
return trkID;
}
-MCParticle* LcioMcpMaps::findPrimaryInitialMcpFromTrajectory(Trajectory* trj) const {
+MCParticle* LcioMcpMaps::findInitialParticle(Trajectory* trj) const {
MCParticle* mcpPrim = 0;
G4int trjTrkID = trj->GetTrackID();
@@ -65,7 +65,7 @@
MCParticle* mcpPre = static_cast<MCParticle*>(initMcpColl->getElementAt(k));
// do we have matching primary for this Mcp?
- G4PrimaryParticle* primaryMatch = findPrimaryFromMcp(mcpPre);
+ G4PrimaryParticle* primaryMatch = findPrimary(mcpPre);
if (primaryMatch) {
// found matching primary to this input trajectory
@@ -80,13 +80,13 @@
return mcpPrim;
}
-MCParticle* LcioMcpMaps::findDaughterMcpFromPrimary(MCParticle* mcpInit, G4PrimaryParticle* primDau) const {
+MCParticle* LcioMcpMaps::findDaughterParticle(MCParticle* mcpInit, G4PrimaryParticle* primDau) const {
// loop over Mcp input particle's daughters
MCParticle* mcpDau = 0;
int numMcpDau = mcpInit->getDaughters().size();
for (int i = 0; i < numMcpDau; i++) {
// does ith Mcp dau match this primary?
- if (findPrimaryFromMcp(mcpInit->getDaughters()[i]) == primDau) {
+ if (findPrimary(mcpInit->getDaughters()[i]) == primDau) {
// found it
mcpDau = mcpInit->getDaughters()[i];
break;
@@ -97,7 +97,7 @@
return mcpDau;
}
-MCParticleImpl* LcioMcpMaps::findFinalParticleFromInitial(MCParticle* mcpInit) const {
+MCParticleImpl* LcioMcpMaps::findFinalParticle(MCParticle* mcpInit) const {
MCParticleImpl* mcpFinal = 0;
for (InitMcpToMcpMap::const_iterator iter = m_initMcpToMcp.begin(); iter != m_initMcpToMcp.end();
iter++) {
@@ -110,7 +110,7 @@
return mcpFinal;
}
-G4PrimaryParticle* LcioMcpMaps::findPrimaryFromMcp(MCParticle* mcp) const {
+G4PrimaryParticle* LcioMcpMaps::findPrimary(MCParticle* mcp) const {
G4PrimaryParticle *pp = 0;
for (McpToPrimaryMap::const_iterator iter = m_McpToPrimary.begin(); iter != m_McpToPrimary.end();
iter++) {
@@ -123,12 +123,12 @@
return pp;
}
-void LcioMcpMaps::addMcpToPrimaryLink(MCParticle* mcp, G4PrimaryParticle* primary) {
+void LcioMcpMaps::addParticleToPrimary(MCParticle* mcp, G4PrimaryParticle* primary) {
m_McpToPrimary[mcp] = primary;
}
-void LcioMcpMaps::addInitialMcpToFinalMcpLink(MCParticle* mcpInit, MCParticleImpl* mcpFinal) {
- m_initMcpToMcp[mcpInit] = mcpFinal;
+void LcioMcpMaps::addInitialParticleToFinal(MCParticle* initial, MCParticleImpl* final) {
+ m_initMcpToMcp[initial] = final;
}
void LcioMcpMaps::clear() {
@@ -140,13 +140,13 @@
void LcioMcpMaps::printMaps() {
log() << LOG::debug << "Printing maps..." << LOG::done;
- printTrackToMcpMap();
- printMcpToPrimaryMap();
- printInitMcpToMcpMap();
+ printTracksToParticles();
+ printParticlesToPrimaries();
+ printInitialParticleToFinal();
// TrajectoryManager::instance()->printTrackIDToTrajectoryMap();
}
-void LcioMcpMaps::printTrackToMcpMap() {
+void LcioMcpMaps::printTracksToParticles() {
log() << LOG::debug << "Printing track to Mcp map..." << LOG::done;
log() << LOG::debug << "*** TrackToMcpMap ***" << LOG::done;
@@ -157,7 +157,7 @@
log() << LOG::debug << LOG::done;
}
-void LcioMcpMaps::printMcpToPrimaryMap() {
+void LcioMcpMaps::printParticlesToPrimaries() {
log() << LOG::debug << "Printing Mcp to primary map..." << LOG::done;
log() << LOG::debug << LOG::done;
@@ -170,7 +170,7 @@
log() << LOG::debug << LOG::done;
}
-void LcioMcpMaps::printInitMcpToMcpMap() {
+void LcioMcpMaps::printInitialParticleToFinal() {
log() << LOG::debug << "Printing InitMcp to Mcp map..." << LOG::done;
log() << LOG::debug << LOG::done;
slic/src
diff -u -r1.21 -r1.22
--- LcioMcpPrinter.cc 26 Jun 2013 01:57:02 -0000 1.21
+++ LcioMcpPrinter.cc 6 Nov 2013 00:23:37 -0000 1.22
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpPrinter.cc,v 1.21 2013/06/26 01:57:02 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpPrinter.cc,v 1.22 2013/11/06 00:23:37 jeremy Exp $
// SLIC
#include "LcioMcpPrinter.hh"
@@ -41,13 +41,13 @@
LcioMcpPrinter::~LcioMcpPrinter() {
}
-void LcioMcpPrinter::printMcpCollection(const std::string& collName, EVENT::LCCollection* coll) {
+void LcioMcpPrinter::printParticleCollection(const std::string& collName, EVENT::LCCollection* coll) {
m_coll = coll;
m_collName = collName;
- printMcpCollection();
+ printParticleCollection();
}
-void LcioMcpPrinter::printMcpCollection() {
+void LcioMcpPrinter::printParticleCollection() {
head();
if (m_coll != 0) {
@@ -63,7 +63,7 @@
LCCollectionVec* vec = static_cast<LCCollectionVec*>(m_coll);
for (LCCollectionVec::iterator iter = vec->begin(); iter != vec->end(); iter++) {
- printMcp(static_cast<EVENT::MCParticle*>(*iter));
+ printParticle(static_cast<EVENT::MCParticle*>(*iter));
}
#ifdef SLIC_LOG
@@ -89,11 +89,11 @@
line();
}
-void LcioMcpPrinter::printMcp(EVENT::MCParticle* mcp) {
+void LcioMcpPrinter::printParticle(EVENT::MCParticle* mcp) {
// index
log().getOutputStream().width(idx_width);
log().getOutputStream() << left;
- log() << LOG::debug << findMcpIndex(mcp);
+ log() << LOG::debug << findParticleIndex(mcp);
sep();
@@ -112,13 +112,13 @@
// parents
log().getOutputStream().width(par_width);
- log() << LOG::debug << left << makeIdxVecString(findParentIndices(mcp));
+ log() << LOG::debug << left << makeIndexVectorString(findParentIndices(mcp));
sep();
// daughters
log().getOutputStream().width(dau_width);
- log() << LOG::debug << left << makeIdxVecString(findDaughterIndices(mcp));
+ log() << LOG::debug << left << makeIndexVectorString(findDaughterIndices(mcp));
sep();
@@ -194,11 +194,11 @@
+ StringUtil::toString(mcp->hasLeftDetector()) + " " + StringUtil::toString(mcp->isStopped());
}
-std::string LcioMcpPrinter::makeIdxVecString(const IdxVec& idxVec) {
+std::string LcioMcpPrinter::makeIndexVectorString(const IndexVector& idxVec) {
std::string idx_vec;
idx_vec = "[ ";
- for (IdxVec::const_iterator iter = idxVec.begin(); iter != idxVec.end(); iter++) {
+ for (IndexVector::const_iterator iter = idxVec.begin(); iter != idxVec.end(); iter++) {
int this_idx = (*iter);
idx_vec += StringUtil::toString(this_idx) + " ";
}
@@ -207,27 +207,27 @@
return idx_vec;
}
-LcioMcpPrinter::IdxVec LcioMcpPrinter::findDaughterIndices(EVENT::MCParticle* mcp) {
- IdxVec dauIdxs;
+LcioMcpPrinter::IndexVector LcioMcpPrinter::findDaughterIndices(EVENT::MCParticle* mcp) {
+ IndexVector dauIdxs;
const EVENT::MCParticleVec& dauVec = mcp->getDaughters();
for (EVENT::MCParticleVec::const_iterator iter = dauVec.begin(); iter != dauVec.end(); iter++) {
- dauIdxs.push_back(findMcpIndex((const_cast<MCParticle*>(*iter))));
+ dauIdxs.push_back(findParticleIndex((const_cast<MCParticle*>(*iter))));
}
return dauIdxs;
}
-LcioMcpPrinter::IdxVec LcioMcpPrinter::findParentIndices(EVENT::MCParticle* mcp) {
- IdxVec parIdxs;
+LcioMcpPrinter::IndexVector LcioMcpPrinter::findParentIndices(EVENT::MCParticle* mcp) {
+ IndexVector parIdxs;
const EVENT::MCParticleVec& parVec = mcp->getParents();
for (EVENT::MCParticleVec::const_iterator iter = parVec.begin(); iter != parVec.end(); iter++) {
- parIdxs.push_back(findMcpIndex((const_cast<MCParticle*>(*iter))));
+ parIdxs.push_back(findParticleIndex((const_cast<MCParticle*>(*iter))));
}
return parIdxs;
}
-int LcioMcpPrinter::findMcpIndex(EVENT::MCParticle* mcp) {
+int LcioMcpPrinter::findParticleIndex(EVENT::MCParticle* mcp) {
int idx = 0;
bool fnd = false;
LCCollectionVec* mcpCollVec = static_cast<LCCollectionVec*>(m_coll);
slic/src
diff -u -r1.6 -r1.7
--- LcioMcpStatusSetter.cc 27 Nov 2012 19:32:19 -0000 1.6
+++ LcioMcpStatusSetter.cc 6 Nov 2013 00:23:37 -0000 1.7
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpStatusSetter.cc,v 1.6 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpStatusSetter.cc,v 1.7 2013/11/06 00:23:37 jeremy Exp $
#include "LcioMcpStatusSetter.hh"
// slic
@@ -9,7 +9,7 @@
using EVENT::MCParticle;
namespace slic {
-IMPL::MCParticleImpl* LcioMcpStatusSetter::setMcpStatusCodesFromTrajectory(Trajectory* trj,
+IMPL::MCParticleImpl* LcioMcpStatusSetter::setStatusCodesFromTrajectory(Trajectory* trj,
MCParticleImpl* mcp) {
// set vertexIsNotEndOfParent flag
LcioMcpStatusSetter::setVertexIsNotEndpointOfParentFlag(trj, mcp);
slic/src
diff -u -r1.3 -r1.4
--- LcioMcpUtil.cc 27 Nov 2012 19:32:19 -0000 1.3
+++ LcioMcpUtil.cc 6 Nov 2013 00:23:37 -0000 1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioMcpUtil.cc,v 1.3 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioMcpUtil.cc,v 1.4 2013/11/06 00:23:37 jeremy Exp $
#include "LcioMcpUtil.hh"
namespace slic {
@@ -7,7 +7,7 @@
return (mcp->getParents().size() == 0);
}
-G4double LcioMcpUtil::computeMcpDistance(IMPL::MCParticleImpl* mcp1, IMPL::MCParticleImpl* mcp2) {
+G4double LcioMcpUtil::computeParticleDistance(IMPL::MCParticleImpl* mcp1, IMPL::MCParticleImpl* mcp2) {
return computeDistance(mcp1->getVertex(), mcp2->getVertex());
}
slic/src
diff -u -r1.41 -r1.42
--- LcioPrimaryGenerator.cc 26 Jun 2013 01:57:02 -0000 1.41
+++ LcioPrimaryGenerator.cc 6 Nov 2013 00:23:37 -0000 1.42
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/LcioPrimaryGenerator.cc,v 1.41 2013/06/26 01:57:02 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioPrimaryGenerator.cc,v 1.42 2013/11/06 00:23:37 jeremy Exp $
// SLIC
#include "LogStream.hh"
@@ -103,7 +103,7 @@
// check if case 1 (PreDecay)
if (numPar > 0) {
parMcp = dynamic_cast<MCParticleImpl*>(mcp->getParents()[0]);
- g4parent = m_mcpManager->getMaps()->findPrimaryFromMcp(parMcp);
+ g4parent = m_mcpManager->getMaps()->findPrimary(parMcp);
// Check if the particle has parents, in which case it needs a predecay.
if (g4parent != 0) {
@@ -111,7 +111,7 @@
isPreDecay = true;
#ifdef SLIC_LOG
log() << "PREDECAY" << LOG::done;
- log() << LOG::debug << "parent idx: " << LcioMcpManager::instance()->getMCParticleIndex(mcpVec, parMcp) << LOG::done;
+ log() << LOG::debug << "parent idx: " << LcioMcpManager::instance()->getParticleIndex(mcpVec, parMcp) << LOG::done;
#endif
}
}
@@ -139,7 +139,7 @@
IMPL::MCParticleImpl* firstDau =
dynamic_cast<IMPL::MCParticleImpl*>(mcp->getDaughters()[0]);
- dist = LcioMcpUtil::computeMcpDistance(mcp, firstDau);
+ dist = LcioMcpUtil::computeParticleDistance(mcp, firstDau);
#ifdef SLIC_LOG
log() << LOG::debug << "mcpDistance=" << dist << LOG::done;
@@ -177,7 +177,7 @@
// create a primary
if (createPrimary) {
- thePrimary = createPrimaryParticleFromMcp(mcp);
+ thePrimary = createPrimaryParticle(mcp);
// set daughters for PreDecay
if (isPreDecay) {
@@ -222,14 +222,14 @@
// create a vertex, add primary and set in event
if (createVertex) {
- theVertex = createPrimaryVertexFromMcp(mcp);
+ theVertex = createPrimaryVertex(mcp);
theVertex->SetPrimary(thePrimary);
anEvent->AddPrimaryVertex(theVertex);
}
// insert mcp, primary pair into LcioManager's map (could be null)
if (thePrimary) {
- m_mcpManager->getMaps()->addMcpToPrimaryLink(mcp, thePrimary);
+ m_mcpManager->getMaps()->addParticleToPrimary(mcp, thePrimary);
}
#ifdef SLIC_LOG
@@ -238,7 +238,7 @@
}
}
-G4PrimaryParticle* LcioPrimaryGenerator::createPrimaryParticleFromMcp(IMPL::MCParticleImpl* mcp) {
+G4PrimaryParticle* LcioPrimaryGenerator::createPrimaryParticle(IMPL::MCParticleImpl* mcp) {
G4PrimaryParticle* primary = new G4PrimaryParticle(mcp->getPDG(), mcp->getMomentum()[0] * GeV,
mcp->getMomentum()[1] * GeV, mcp->getMomentum()[2] * GeV);
primary->SetMass(mcp->getMass() * GeV);
@@ -246,7 +246,7 @@
return primary;
}
-G4PrimaryVertex* LcioPrimaryGenerator::createPrimaryVertexFromMcp(IMPL::MCParticleImpl* mcp) {
+G4PrimaryVertex* LcioPrimaryGenerator::createPrimaryVertex(IMPL::MCParticleImpl* mcp) {
#ifdef SLIC_LOG
log() << "createPrimaryVertexFromMcp" << LOG::done;
log() << "particle time: " << mcp->getTime() << LOG::done;
slic/src
diff -u -r1.9 -r1.10
--- StdHepEventSource.cc 27 Nov 2012 19:32:19 -0000 1.9
+++ StdHepEventSource.cc 6 Nov 2013 00:23:37 -0000 1.10
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/StdHepEventSource.cc,v 1.9 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/StdHepEventSource.cc,v 1.10 2013/11/06 00:23:37 jeremy Exp $
#include "StdHepEventSource.hh"
// slic
@@ -72,10 +72,10 @@
if (!isEOF()) {
// set convertor's coll
- m_convertor->setCurrentMcpCollection(LcioMcpManager::instance()->getInitialMcpCollection());
+ m_convertor->setParticleCollection(LcioMcpManager::instance()->getInitialMcpCollection());
// run convertor
- m_convertor->fillCurrentMcpCollectionFromStdHep();
+ m_convertor->fillParticleCollection();
}
}
slic/src
diff -u -r1.43 -r1.44
--- StdHepToLcioConvertor.cc 27 Nov 2012 19:32:19 -0000 1.43
+++ StdHepToLcioConvertor.cc 6 Nov 2013 00:23:37 -0000 1.44
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.43 2012/11/27 19:32:19 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/StdHepToLcioConvertor.cc,v 1.44 2013/11/06 00:23:37 jeremy Exp $
#include "StdHepToLcioConvertor.hh"
// slic
@@ -39,15 +39,15 @@
StdHepToLcioConvertor::~StdHepToLcioConvertor() {
}
-void StdHepToLcioConvertor::setCurrentMcpCollection(EVENT::LCCollection* mcpColl) {
+void StdHepToLcioConvertor::setParticleCollection(EVENT::LCCollection* mcpColl) {
m_currentMcpColl = mcpColl;
}
-EVENT::LCCollection* StdHepToLcioConvertor::getCurrentMcpCollection() {
+EVENT::LCCollection* StdHepToLcioConvertor::getParticleCollection() {
return m_currentMcpColl;
}
-void StdHepToLcioConvertor::fillCurrentMcpCollectionFromStdHep() {
+void StdHepToLcioConvertor::fillParticleCollection() {
// Reset the MCParticle list.
//m_currentMcpColl->clear();
//G4cout << "m_currentMcpColl.size =" << m_currentMcpColl->getNumberOfElements() << G4endl;
@@ -77,7 +77,7 @@
#endif
// create MCP and add to coll
- createMcpFromStdHep(ihep);
+ createParticle(ihep);
#ifdef SLIC_LOG
log() << LOG::debug << LOG::endl << "--" << LOG::endl << LOG::done;
@@ -140,7 +140,7 @@
#endif
}
-IMPL::MCParticleImpl* StdHepToLcioConvertor::createMcpFromStdHep(int ihep) {
+IMPL::MCParticleImpl* StdHepToLcioConvertor::createParticle(int ihep) {
// new MCP
MCParticleImpl* mcp = new MCParticleImpl();
@@ -233,7 +233,7 @@
if (parVec.size() > 0) {
for (std::vector<int>::iterator it = parVec.begin(); it != parVec.end(); it++) {
if (*it != ihep) {
- addMcpParent(*it, mcp);
+ addParent(*it, mcp);
}
//#ifdef SLIC_LOG
// else
@@ -250,7 +250,7 @@
// log() << LOG::debug << "setupDaughters for ihep <" << ihep << "> and MCParticle <" << mcp << ">" << LOG::done;
//#endif
#ifdef SLIC_LOG
- log() << LOG::debug << "MCParticle idx: " << LcioMcpManager::instance()->getMCParticleIndex(LcioMcpManager::instance()->getInitialMcpCollection(), mcp) << LOG::done;
+ log() << LOG::debug << "MCParticle idx: " << LcioMcpManager::instance()->getParticleIndex(LcioMcpManager::instance()->getInitialMcpCollection(), mcp) << LOG::done;
#endif
// get dau indices
@@ -263,7 +263,7 @@
#endif
// Check for valid daughter indices. Some generators such as Whizard put bad values in these fields.
- if (!isValidDaughterIndex(dau1_idx) || !isValidDaughterIndex(dau2_idx)) {
+ if (!isValidIndex(dau1_idx) || !isValidIndex(dau2_idx)) {
#ifdef SLIC_LOG
log() << LOG::debug << "ihep <" << ihep << "> has invalid daughter index range <" << dau1_idx << ", " << dau2_idx << ">." << LOG::done;
#endif
@@ -288,7 +288,7 @@
if (dauVec.size() > 0) {
for (std::vector<int>::iterator it = dauVec.begin(); it != dauVec.end(); it++) {
if (*it != ihep) {
- addMcpDaughter(*it, mcp);
+ addDaughter(*it, mcp);
}
#ifdef SLIC_LOG
else
@@ -327,7 +327,7 @@
return isPar;
}
-void StdHepToLcioConvertor::addMcpDaughter(int dauIdx, IMPL::MCParticleImpl* parMcp) {
+void StdHepToLcioConvertor::addDaughter(int dauIdx, IMPL::MCParticleImpl* parMcp) {
if (dauIdx >= 0) {
MCParticleImpl* dauMcp = static_cast<MCParticleImpl*>(m_currentMcpColl->getElementAt(dauIdx));
@@ -361,7 +361,7 @@
}
}
-void StdHepToLcioConvertor::addMcpParent(int parIdx, IMPL::MCParticleImpl* mcp) {
+void StdHepToLcioConvertor::addParent(int parIdx, IMPL::MCParticleImpl* mcp) {
#ifdef SLIC_LOG
log() << LOG::debug << "addMcpParent" << LOG::done;
#endif
slic/src
diff -u -r1.53 -r1.54
--- TrajectoryManager.cc 1 Jul 2013 21:01:31 -0000 1.53
+++ TrajectoryManager.cc 6 Nov 2013 00:23:37 -0000 1.54
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/TrajectoryManager.cc,v 1.53 2013/07/01 21:01:31 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/TrajectoryManager.cc,v 1.54 2013/11/06 00:23:37 jeremy Exp $
// slic
#include "TrajectoryManager.hh"
@@ -509,7 +509,7 @@
return numSecoAtEnd;
}
-void TrajectoryManager::fillTrackIDToTrajectoryMap(const G4Event* anEvent, bool clearIt) {
+void TrajectoryManager::fillTrajectoryMap(const G4Event* anEvent, bool clearIt) {
#ifdef SLIC_LOG
log() << LOG::verbose << "fillTrackIDToTrajectoryMap()" << LOG::endl;
#endif
CVSspam 0.2.12