GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
Public Member Functions
GGSScoringManagerMessenger Class Reference

Messenger for the GGSScoringManager singleton. More...

#include <GGSScoringManagerMessenger.h>

Inheritance diagram for GGSScoringManagerMessenger:
Inheritance graph
[legend]
Collaboration diagram for GGSScoringManagerMessenger:
Collaboration graph
[legend]

Public Member Functions

 GGSScoringManagerMessenger ()
 Constructor.
 
 ~GGSScoringManagerMessenger ()
 Destructor.
 
void SetNewValue (G4UIcommand *command, G4String logVolName)
 Concrete implementation of the SetNewValue method of base class. More...
 
void CreateAddCommand (const G4String &sdClassName)
 Creates the command to add the specified sensitive detector class to logical volumes. More...
 

Detailed Description

Messenger for the GGSScoringManager singleton.

Definition at line 19 of file GGSScoringManagerMessenger.h.

Member Function Documentation

void GGSScoringManagerMessenger::CreateAddCommand ( const G4String &  sdClassName)

Creates the command to add the specified sensitive detector class to logical volumes.

Parameters
sdClassNamethe name of the sd class.

Definition at line 32 of file GGSScoringManagerMessenger.cpp.

32  {
33 
34  // Check if the command already exists
35  G4String cmdName(_cmdBaseName);
36  cmdName.append(sdClassName);
37  for (unsigned int iCmd = 0; iCmd < _commands.size(); iCmd++) {
38  if (_commands[iCmd]->GetCommandName() == cmdName)
39  return;
40  }
41 
42  // Create the command
43  G4UIcmdWithAString *newCmd = new G4UIcmdWithAString(cmdName, this);
44  newCmd->SetGuidance(
45  G4String("Add a sensitive detector of type ").append(sdClassName).append(" to the specified logical volume"));
46  newCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
47  _commands.push_back(newCmd);
48 }
void GGSScoringManagerMessenger::SetNewValue ( G4UIcommand *  command,
G4String  logVolName 
)

Concrete implementation of the SetNewValue method of base class.

Since the only commands handled by this messenger are build commands, the second argument will always be a logical volume name

Parameters
commandThe UI command.
logVolNamethe logical volume name.

Definition at line 52 of file GGSScoringManagerMessenger.cpp.

52  {
53 
54  for (unsigned int iCmd = 0; iCmd < _commands.size(); iCmd++) {
55  if (command == _commands[iCmd]) {
56  G4String sdClassName = command->GetCommandName().substr(3); // Remove "add" prefix
57  GGSScoringManager::GetInstance().AddSDToLogVol(sdClassName, logVolName);
58  }
59  }
60 }
static GGSScoringManager & GetInstance()
Singleton getter.
void AddSDToLogVol(const G4String &sdClassName, const G4String &logVolNameAndParams)
Adds a sensitive detector to a logical volume (class factory approach).

The documentation for this class was generated from the following files: