Geant4  10.01.p02
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: G4TrackingMessenger.cc 77241 2013-11-22 09:55:47Z gcosmo $
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: Katsuya.Amako@kek.jp)
40 // Makoto Asai (e-mail: asai@kekvax.kek.jp)
41 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
42 //
43 //---------------------------------------------------------------
44 
45 #include "G4TrackingMessenger.hh"
46 #include "G4UIdirectory.hh"
48 #include "G4UIcmdWithAnInteger.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"
56 #include "G4PropagatorInField.hh"
58 
62 : trackingManager(trMan)
63 {
65 
66  TrackingDirectory = new G4UIdirectory("/tracking/");
67  TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
68 
69  AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
70  AbortCmd->SetGuidance("Abort current G4Track processing.");
71 
72 
73  ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
74  ResumeCmd->SetGuidance("Resume current G4Track processing.");
75 
76  StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
77  StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
78  StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
79  StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
80  StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
81  StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
82  StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
83  StoreTrajectoryCmd->SetGuidance(" 4 : Choose G4RichTrajectory with auxiliary points as default.");
84  StoreTrajectoryCmd->SetParameterName("Store",true);
86  StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4");
87 
88 
89  VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
90 #ifdef G4VERBOSE
91  VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
92  VerboseCmd->SetGuidance(" -1 : Silent.");
93  VerboseCmd->SetGuidance(" 0 : Silent.");
94  VerboseCmd->SetGuidance(" 1 : Minium information of each Step.");
95  VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
96  VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
97  VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
98  VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
99  VerboseCmd->SetGuidance(" at each AlongStepPostStep process execuation.");
100  VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
101  VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
102  VerboseCmd->SetParameterName("verbose_level",true);
104  VerboseCmd->SetRange("verbose_level >=-1 ");
105 #else
106  VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
107 #endif
108 }
109 
113 {
114  delete TrackingDirectory;
115  delete AbortCmd;
116  delete ResumeCmd;
117  delete StoreTrajectoryCmd;
118  delete VerboseCmd;
119 }
120 
124 {
125  if( command == VerboseCmd ){
127  }
128 
129  if( command == AbortCmd ){
131  G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
132  }
133 
134  if( command == ResumeCmd ){
135  G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
136  }
137 
138  static G4ThreadLocal G4IdentityTrajectoryFilter* auxiliaryPointsFilter = 0;
139  if(!auxiliaryPointsFilter) auxiliaryPointsFilter = new G4IdentityTrajectoryFilter;
140  if( command == StoreTrajectoryCmd ){
141  G4int trajType = StoreTrajectoryCmd->ConvertToInt(newValues);
142  if(trajType==2||trajType==4)
143  {
145  ->GetPropagatorInField()->SetTrajectoryFilter(auxiliaryPointsFilter);
146  }
147  else
148  {
151  }
153  }
154 }
155 
156 
160 {
161  if( command == VerboseCmd ){
163  }
164  else if( command == StoreTrajectoryCmd ){
166  }
167  return G4String('\0');
168 }
169 
170 
171 
172 
173 
174 
175 
176 
177 
178 
179 
180 
181 
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4UIdirectory * TrackingDirectory
G4UIcmdWithAnInteger * VerboseCmd
G4SteppingManager * GetSteppingManager() const
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:371
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
void SetNewValue(G4UIcommand *command, G4String newValues)
G4TrackingManager * trackingManager
void SetStoreTrajectory(G4int value)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4SteppingManager * steppingManager
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:435
static G4TransportationManager * GetTransportationManager()
void SetVerboseLevel(G4int vLevel)
G4UIcmdWithoutParameter * AbortCmd
G4int GetStoreTrajectory() const
G4UIcmdWithAnInteger * StoreTrajectoryCmd
void SetTrajectoryFilter(G4VCurvedTrajectoryFilter *filter)
G4int GetVerboseLevel() const
void SetDefaultValue(G4int defVal)
G4String GetCurrentValue(G4UIcommand *command)
G4PropagatorInField * GetPropagatorInField() const
G4TrackingMessenger(G4TrackingManager *trMan)
G4UIcmdWithoutParameter * ResumeCmd
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
G4Track * GetTrack() const