ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4TrackingMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4TrackingMessenger.cc
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 //
28 //---------------------------------------------------------------
29 //
30 // G4TrackingMessenger.cc
31 //
32 // Description:
33 // This is a messenger class to interface to exchange information
34 // between tracking and stepping managers and UI.
35 //
36 // Contact:
37 // Questions and comments to this code should be sent to
38 // Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
39 // Makoto Asai (e-mail: asai@kekvax.kek.jp)
40 // Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
41 //
42 //---------------------------------------------------------------
43 
44 #include "G4TrackingMessenger.hh"
45 #include "G4UIdirectory.hh"
47 #include "G4UIcmdWithAnInteger.hh"
48 #include "G4UImanager.hh"
49 #include "globals.hh"
50 #include "G4TrackingManager.hh"
51 #include "G4SteppingManager.hh"
52 #include "G4TrackStatus.hh"
53 #include "G4ios.hh"
55 #include "G4PropagatorInField.hh"
57 
61 : trackingManager(trMan)
62 {
64 
65  TrackingDirectory = new G4UIdirectory("/tracking/");
66  TrackingDirectory->SetGuidance("TrackingManager and SteppingManager control commands.");
67 
68  AbortCmd = new G4UIcmdWithoutParameter("/tracking/abort",this);
69  AbortCmd->SetGuidance("Abort current G4Track processing.");
70 
71 
72  ResumeCmd = new G4UIcmdWithoutParameter("/tracking/resume",this);
73  ResumeCmd->SetGuidance("Resume current G4Track processing.");
74 
75  StoreTrajectoryCmd = new G4UIcmdWithAnInteger("/tracking/storeTrajectory",this);
76  StoreTrajectoryCmd->SetGuidance("Store trajectories or not.");
77  StoreTrajectoryCmd->SetGuidance(" 0 : Don't Store trajectories.");
78  StoreTrajectoryCmd->SetGuidance(" !=0 : Store trajectories.");
79  StoreTrajectoryCmd->SetGuidance(" 1 : Choose G4Trajectory as default.");
80  StoreTrajectoryCmd->SetGuidance(" 2 : Choose G4SmoothTrajectory as default.");
81  StoreTrajectoryCmd->SetGuidance(" 3 : Choose G4RichTrajectory as default.");
82  StoreTrajectoryCmd->SetGuidance(" 4 : Choose G4RichTrajectory with auxiliary points as default.");
83  StoreTrajectoryCmd->SetParameterName("Store",true);
85  StoreTrajectoryCmd->SetRange("Store >=0 && Store <= 4");
86 
87 
88  VerboseCmd = new G4UIcmdWithAnInteger("/tracking/verbose",this);
89 #ifdef G4VERBOSE
90  VerboseCmd->SetGuidance("Set Verbose level of tracking category.");
91  VerboseCmd->SetGuidance(" -1 : Silent.");
92  VerboseCmd->SetGuidance(" 0 : Silent.");
93  VerboseCmd->SetGuidance(" 1 : Minimum information of each Step.");
94  VerboseCmd->SetGuidance(" 2 : Addition to Level=1, info of secondary particles.");
95  VerboseCmd->SetGuidance(" 3 : Addition to Level=1, pre/postStepoint information");
96  VerboseCmd->SetGuidance(" after all AlongStep/PostStep process executions.");
97  VerboseCmd->SetGuidance(" 4 : Addition to Level=3, pre/postStepoint information");
98  VerboseCmd->SetGuidance(" at each AlongStepPostStep process execution.");
99  VerboseCmd->SetGuidance(" 5 : Addition to Level=4, proposed Step length information");
100  VerboseCmd->SetGuidance(" from each AlongStepPostStep process.");
101  VerboseCmd->SetParameterName("verbose_level",true);
103  VerboseCmd->SetRange("verbose_level >=-1 ");
104 #else
105  VerboseCmd->SetGuidance("You need to recompile the tracking category defining G4VERBOSE ");
106 #endif
107 }
108 
112 {
113  delete TrackingDirectory;
114  delete AbortCmd;
115  delete ResumeCmd;
116  delete StoreTrajectoryCmd;
117  delete VerboseCmd;
118 }
119 
123 {
124  if( command == VerboseCmd ){
126  }
127 
128  if( command == AbortCmd ){
130  G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
131  }
132 
133  if( command == ResumeCmd ){
134  G4UImanager::GetUIpointer()->ApplyCommand("/control/exit");
135  }
136 
137  static G4ThreadLocal G4IdentityTrajectoryFilter* auxiliaryPointsFilter = 0;
138  if(!auxiliaryPointsFilter) auxiliaryPointsFilter = new G4IdentityTrajectoryFilter;
139  if( command == StoreTrajectoryCmd ){
140  G4int trajType = StoreTrajectoryCmd->ConvertToInt(newValues);
141  if(trajType==2||trajType==4)
142  {
144  ->GetPropagatorInField()->SetTrajectoryFilter(auxiliaryPointsFilter);
145  }
146  else
147  {
150  }
152  }
153 }
154 
155 
159 {
160  if( command == VerboseCmd ){
162  }
163  else if( command == StoreTrajectoryCmd ){
165  }
166  return G4String('\0');
167 }
168 
169 
170 
171 
172 
173 
174 
175 
176 
177 
178 
179 
180