Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TrackingMessenger Class Reference

#include <G4TrackingMessenger.hh>

Inheritance diagram for G4TrackingMessenger:

Public Member Functions

 G4TrackingMessenger (G4TrackingManager *trMan)
 ~G4TrackingMessenger () override
void SetNewValue (G4UIcommand *command, G4String newValues) override
G4String GetCurrentValue (G4UIcommand *command) override
Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
virtual ~G4UImessenger ()
G4bool CommandsShouldBeInMaster () const

Additional Inherited Members

Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
G4String LtoS (G4long l)
G4String DtoS (G4double a)
G4String BtoS (G4bool b)
G4int StoI (const G4String &s)
G4long StoL (const G4String &s)
G4double StoD (const G4String &s)
G4bool StoB (const G4String &s)
void AddUIcommand (G4UIcommand *newCommand)
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
template<typename T>
T * CreateCommand (const G4String &cname, const G4String &dsc)
Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
G4String baseDirName = ""
G4bool commandsShouldBeInMaster = false

Detailed Description

Definition at line 52 of file G4TrackingMessenger.hh.

Constructor & Destructor Documentation

◆ G4TrackingMessenger()

G4TrackingMessenger::G4TrackingMessenger ( G4TrackingManager * trMan)

Definition at line 58 of file G4TrackingMessenger.cc.

60 : trackingManager(trMan)
61{
62 steppingManager = trackingManager->GetSteppingManager();
63
64 TrackingDirectory = new G4UIdirectory("/tracking/");
65 TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
66
67 AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort", this);
68 AbortCmd->SetGuidance("Abort current G4Track processing.");
69
70 ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume", this);
71 ResumeCmd->SetGuidance("Resume current G4Track processing.");
72
73 StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory", this);
74 StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
75 StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
76 StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
77 StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
78 StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
79 StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
80 StoreTrajectoryCmd->SetGuidance(" 4 : Choose G4RichTrajectory with auxiliary points as default.");
81 StoreTrajectoryCmd->SetParameterName("Store", true);
82 StoreTrajectoryCmd->SetDefaultValue(0);
83 StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4");
84
85 VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose", this);
86#ifdef G4VERBOSE
87 VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
88 VerboseCmd->SetGuidance(" -1 : Silent.");
89 VerboseCmd->SetGuidance(" 0 : Silent.");
90 VerboseCmd->SetGuidance(" 1 : Minimum information of each Step.");
91 VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
92 VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
93 VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
94 VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
95 VerboseCmd->SetGuidance(" at each AlongStepPostStep process execution.");
96 VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
97 VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
98 VerboseCmd->SetParameterName("verbose_level", true);
99 VerboseCmd->SetDefaultValue(0);
100 VerboseCmd->SetRange("verbose_level >=-1 ");
101#else
102 VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
103#endif
104}

◆ ~G4TrackingMessenger()

G4TrackingMessenger::~G4TrackingMessenger ( )
override

Definition at line 107 of file G4TrackingMessenger.cc.

109{
110 delete TrackingDirectory;
111 delete AbortCmd;
112 delete ResumeCmd;
113 delete StoreTrajectoryCmd;
114 delete VerboseCmd;
115 delete auxiliaryPointsFilter;
116}

Member Function Documentation

◆ GetCurrentValue()

G4String G4TrackingMessenger::GetCurrentValue ( G4UIcommand * command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 192 of file G4TrackingMessenger.cc.

194{
195 if (command == VerboseCmd) {
196 return VerboseCmd->ConvertToString(trackingManager->GetVerboseLevel());
197 }
198 if (command == StoreTrajectoryCmd) {
199 return StoreTrajectoryCmd->ConvertToString(trackingManager->GetStoreTrajectory());
200 }
201 return G4String(1, '\0');
202}

◆ SetNewValue()

void G4TrackingMessenger::SetNewValue ( G4UIcommand * command,
G4String newValues )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 119 of file G4TrackingMessenger.cc.

121{
122 if (command == VerboseCmd) {
123 trackingManager->SetVerboseLevel(VerboseCmd->ConvertToInt(newValues));
124 }
125
126 if (command == AbortCmd) {
127 steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
128 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
129 }
130
131 if (command == ResumeCmd) {
132 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
133 }
134
135 if (command == StoreTrajectoryCmd) {
136 G4int trajType = StoreTrajectoryCmd->ConvertToInt(newValues);
137 if (trajType == 2 || trajType == 4) {
138
139 if (nullptr == auxiliaryPointsFilter) {
140 auxiliaryPointsFilter = new G4IdentityTrajectoryFilter;
141 }
144 ->SetTrajectoryFilter(auxiliaryPointsFilter);
145 }
146 else {
149 ->SetTrajectoryFilter(nullptr);
150 }
151 trackingManager->SetStoreTrajectory(trajType);
152
153 // Make sure cloning works for sub-event parallel mode
154 if(G4Threading::IsMasterThread() && trajType>0) {
155 static G4bool traj_1 = false, traj_2 = false, traj_3 = false;
156 G4VTrajectory* traj = nullptr;
157 G4VTrajectoryPoint* trajp = nullptr;
158 switch (trajType) {
159 case 1:
160 if(!traj_1) {
161 traj = new G4ClonedTrajectory();
162 trajp = new G4ClonedTrajectoryPoint();
163 traj_1 = true;
164 }
165 break;
166 case 2:
167 if(!traj_2) {
168 traj = new G4ClonedSmoothTrajectory();
169 trajp = new G4ClonedSmoothTrajectoryPoint();
170 traj_2 = true;
171 }
172 break;
173 case 3:
174 case 4:
175 if(!traj_3) {
176 traj = new G4ClonedRichTrajectory();
177 trajp = new G4ClonedRichTrajectoryPoint();
178 traj_3 = true;
179 }
180 break;
181 default:
182 break;
183 }
184 if(traj!=nullptr) delete traj;
185 if(trajp!=nullptr) delete trajp;
186 }
187 }
188
189}
@ fStopAndKill
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
void SetTrajectoryFilter(G4VCurvedTrajectoryFilter *filter)
static G4TransportationManager * GetTransportationManager()
G4PropagatorInField * GetPropagatorInField() const
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()
G4bool IsMasterThread()

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