Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TrackingMessenger.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//---------------------------------------------------------------
30//
31// G4TrackingMessenger.cc
32//
33// Description:
34// This is a messenger class to interface to exchange information
35// between tracking and stepping managers and UI.
36//
37// Contact:
38// Questions and comments to this code should be sent to
39// Katsuya Amako (e-mail: [email protected])
40// Makoto Asai (e-mail: [email protected])
41// Takashi Sasaki (e-mail: [email protected])
42//
43//---------------------------------------------------------------
44
46#include "G4UIdirectory.hh"
49#include "G4UImanager.hh"
50#include "globals.hh"
51#include "G4TrackingManager.hh"
52#include "G4SteppingManager.hh"
53#include "G4TrackStatus.hh"
54#include "G4ios.hh"
55
56///////////////////////////////////////////////////////////////////
58///////////////////////////////////////////////////////////////////
59: trackingManager(trMan)
60{
61 steppingManager = trackingManager->GetSteppingManager();
62
63 TrackingDirectory = new G4UIdirectory("/tracking/");
64 TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
65
66 AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
67 AbortCmd->SetGuidance("Abort current G4Track processing.");
68
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->SetParameterName("Store",true);
81 StoreTrajectoryCmd->SetDefaultValue(0);
82 StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 3");
83
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 : Minium 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 execuation.");
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}
105
106////////////////////////////////////////////
108////////////////////////////////////////////
109{
110 delete TrackingDirectory;
111 delete AbortCmd;
112 delete ResumeCmd;
113 delete StoreTrajectoryCmd;
114 delete VerboseCmd;
115}
116
117///////////////////////////////////////////////////////////////////////////////
119///////////////////////////////////////////////////////////////////////////////
120{
121 if( command == VerboseCmd ){
122 trackingManager->SetVerboseLevel(VerboseCmd->ConvertToInt(newValues));
123 }
124
125 if( command == AbortCmd ){
126 steppingManager->GetTrack()->SetTrackStatus(fStopAndKill);
127 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
128 }
129
130 if( command == ResumeCmd ){
131 G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
132 }
133
134 if( command == StoreTrajectoryCmd ){
135 trackingManager->SetStoreTrajectory(StoreTrajectoryCmd->ConvertToInt(newValues));
136 }
137}
138
139
140////////////////////////////////////////////////////////////////////
142////////////////////////////////////////////////////////////////////
143{
144 if( command == VerboseCmd ){
145 return VerboseCmd->ConvertToString(trackingManager->GetVerboseLevel());
146 }
147 else if( command == StoreTrajectoryCmd ){
148 return StoreTrajectoryCmd->ConvertToString(trackingManager->GetStoreTrajectory());
149 }
150 return G4String('\0');
151}
152
153
154
155
156
157
158
159
160
161
162
163
164
@ fStopAndKill
G4Track * GetTrack() const
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4int GetVerboseLevel() const
void SetVerboseLevel(G4int vLevel)
G4SteppingManager * GetSteppingManager() const
void SetStoreTrajectory(G4int value)
G4int GetStoreTrajectory() const
G4TrackingMessenger(G4TrackingManager *trMan)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValues)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:349
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:413
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:369
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:51