Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
G4TrackingMessenger Class Reference

#include <G4TrackingMessenger.hh>

Inheritance diagram for G4TrackingMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4TrackingMessenger (G4TrackingManager *trMan)
 
G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
 ~G4TrackingMessenger ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Attributes

G4UIcmdWithoutParameterAbortCmd = nullptr
 
G4UIcmdWithoutParameterResumeCmd = nullptr
 
G4SteppingManagersteppingManager = nullptr
 
G4UIcmdWithAnIntegerStoreTrajectoryCmd = nullptr
 
G4UIdirectoryTrackingDirectory = nullptr
 
G4TrackingManagertrackingManager = nullptr
 
G4UIcmdWithAnIntegerVerboseCmd = nullptr
 

Detailed Description

Definition at line 51 of file G4TrackingMessenger.hh.

Constructor & Destructor Documentation

◆ G4TrackingMessenger()

G4TrackingMessenger::G4TrackingMessenger ( G4TrackingManager trMan)

Definition at line 50 of file G4TrackingMessenger.cc.

52 : trackingManager(trMan)
53{
55
56 TrackingDirectory = new G4UIdirectory("/tracking/");
57 TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
58
59 AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
60 AbortCmd->SetGuidance("Abort current G4Track processing.");
61
62 ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
63 ResumeCmd->SetGuidance("Resume current G4Track processing.");
64
65 StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
66 StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
67 StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
68 StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
69 StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
70 StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
71 StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
72 StoreTrajectoryCmd->SetGuidance(" 4 : Choose G4RichTrajectory with auxiliary points as default.");
75 StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4");
76
77 VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
78#ifdef G4VERBOSE
79 VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
80 VerboseCmd->SetGuidance(" -1 : Silent.");
81 VerboseCmd->SetGuidance(" 0 : Silent.");
82 VerboseCmd->SetGuidance(" 1 : Minimum information of each Step.");
83 VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
84 VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
85 VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
86 VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
87 VerboseCmd->SetGuidance(" at each AlongStepPostStep process execution.");
88 VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
89 VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
90 VerboseCmd->SetParameterName("verbose_level",true);
92 VerboseCmd->SetRange("verbose_level >=-1 ");
93#else
94 VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
95#endif
96}
G4SteppingManager * GetSteppingManager() const
G4SteppingManager * steppingManager
G4UIcmdWithAnInteger * VerboseCmd
G4UIdirectory * TrackingDirectory
G4TrackingManager * trackingManager
G4UIcmdWithAnInteger * StoreTrajectoryCmd
G4UIcmdWithoutParameter * AbortCmd
G4UIcmdWithoutParameter * ResumeCmd
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120

References AbortCmd, G4TrackingManager::GetSteppingManager(), ResumeCmd, G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcommand::SetRange(), steppingManager, StoreTrajectoryCmd, TrackingDirectory, trackingManager, and VerboseCmd.

◆ ~G4TrackingMessenger()

G4TrackingMessenger::~G4TrackingMessenger ( )

Definition at line 99 of file G4TrackingMessenger.cc.

101{
102 delete TrackingDirectory;
103 delete AbortCmd;
104 delete ResumeCmd;
105 delete StoreTrajectoryCmd;
106 delete VerboseCmd;
107}

References AbortCmd, ResumeCmd, StoreTrajectoryCmd, TrackingDirectory, and VerboseCmd.

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4TrackingMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 153 of file G4TrackingMessenger.cc.

155{
156 if( command == VerboseCmd )
157 {
159 }
160 else if( command == StoreTrajectoryCmd )
161 {
162 return StoreTrajectoryCmd
164 }
165 return G4String(1,'\0');
166}
G4int GetVerboseLevel() const
G4int GetStoreTrajectory() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4UIcommand::ConvertToString(), G4TrackingManager::GetStoreTrajectory(), G4TrackingManager::GetVerboseLevel(), StoreTrajectoryCmd, trackingManager, and VerboseCmd.

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetNewValue()

void G4TrackingMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 110 of file G4TrackingMessenger.cc.

112{
113 if( command == VerboseCmd )
114 {
116 }
117
118 if( command == AbortCmd )
119 {
121 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
122 }
123
124 if( command == ResumeCmd )
125 {
126 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
127 }
128
129 static G4ThreadLocal
130 G4IdentityTrajectoryFilter* auxiliaryPointsFilter = nullptr;
131 if(auxiliaryPointsFilter == nullptr)
132 {
133 auxiliaryPointsFilter = new G4IdentityTrajectoryFilter;
134 }
135 if( command == StoreTrajectoryCmd )
136 {
137 G4int trajType = StoreTrajectoryCmd->ConvertToInt(newValues);
138 if(trajType==2||trajType==4)
139 {
141 ->GetPropagatorInField()->SetTrajectoryFilter(auxiliaryPointsFilter);
142 }
143 else
144 {
147 }
149 }
150}
@ fStopAndKill
int G4int
Definition: G4Types.hh:85
void SetTrajectoryFilter(G4VCurvedTrajectoryFilter *filter)
G4Track * GetTrack() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
void SetVerboseLevel(G4int vLevel)
void SetStoreTrajectory(G4int value)
static G4TransportationManager * GetTransportationManager()
G4PropagatorInField * GetPropagatorInField() const
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:557
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
#define G4ThreadLocal
Definition: tls.hh:77

References AbortCmd, G4UImanager::ApplyCommand(), G4UIcommand::ConvertToInt(), fStopAndKill, G4ThreadLocal, G4TransportationManager::GetPropagatorInField(), G4SteppingManager::GetTrack(), G4TransportationManager::GetTransportationManager(), G4UImanager::GetUIpointer(), ResumeCmd, G4TrackingManager::SetStoreTrajectory(), G4Track::SetTrackStatus(), G4PropagatorInField::SetTrajectoryFilter(), G4TrackingManager::SetVerboseLevel(), steppingManager, StoreTrajectoryCmd, trackingManager, and VerboseCmd.

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ AbortCmd

G4UIcmdWithoutParameter* G4TrackingMessenger::AbortCmd = nullptr
private

Definition at line 69 of file G4TrackingMessenger.hh.

Referenced by G4TrackingMessenger(), SetNewValue(), and ~G4TrackingMessenger().

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ ResumeCmd

G4UIcmdWithoutParameter* G4TrackingMessenger::ResumeCmd = nullptr
private

Definition at line 70 of file G4TrackingMessenger.hh.

Referenced by G4TrackingMessenger(), SetNewValue(), and ~G4TrackingMessenger().

◆ steppingManager

G4SteppingManager* G4TrackingMessenger::steppingManager = nullptr
private

Definition at line 64 of file G4TrackingMessenger.hh.

Referenced by G4TrackingMessenger(), and SetNewValue().

◆ StoreTrajectoryCmd

G4UIcmdWithAnInteger* G4TrackingMessenger::StoreTrajectoryCmd = nullptr
private

◆ TrackingDirectory

G4UIdirectory* G4TrackingMessenger::TrackingDirectory = nullptr
private

Definition at line 68 of file G4TrackingMessenger.hh.

Referenced by G4TrackingMessenger(), and ~G4TrackingMessenger().

◆ trackingManager

G4TrackingManager* G4TrackingMessenger::trackingManager = nullptr
private

Definition at line 63 of file G4TrackingMessenger.hh.

Referenced by G4TrackingMessenger(), GetCurrentValue(), and SetNewValue().

◆ VerboseCmd

G4UIcmdWithAnInteger* G4TrackingMessenger::VerboseCmd = nullptr
private

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