Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
physics
src
TG4ParticlesCheckerMessenger.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Geant4 Virtual Monte Carlo package
3
// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4
// All rights reserved.
5
//
6
// For the licensing terms see geant4_vmc/LICENSE.
7
// Contact: root-vmc@cern.ch
8
//-------------------------------------------------
9
14
15
#include "
TG4ParticlesCheckerMessenger.h
"
16
#include "
TG4Globals.h
"
17
#include "
TG4ParticlesChecker.h
"
18
#include "
TG4UICmdWithAComplexString.h
"
19
20
#include <G4UIcmdWithABool.hh>
21
#include <G4UIcmdWithADouble.hh>
22
#include <G4UIcmdWithAString.hh>
23
#include <G4UIcmdWithAnInteger.hh>
24
#include <G4UIcmdWithoutParameter.hh>
25
#include <G4UIdirectory.hh>
26
27
//_____________________________________________________________________________
28
TG4ParticlesCheckerMessenger::TG4ParticlesCheckerMessenger
(
29
TG4ParticlesChecker
* particlesChecker)
30
:
G4UImessenger
(),
31
fParticlesChecker
(particlesChecker),
32
fDirectory
(0),
33
fSelectedProperty
(
""
),
34
fCheckParticlesCmd
(0),
35
fCheckParticleCmd
(0),
36
fSelectPropertyCmd
(0),
37
fSetCheckingCmd
(0),
38
fSetPrecisionCmd
(0)
39
{
41
42
fDirectory
=
new
G4UIdirectory(
"/mcParticlesChecker/"
);
43
fDirectory
->SetGuidance(
"Particles checker commands."
);
44
45
fCheckParticlesCmd
=
46
new
G4UIcmdWithoutParameter(
"/mcParticlesChecker/checkParticles"
,
this
);
47
fCheckParticlesCmd
->SetGuidance(
48
"Check properties for all instantiated particles"
);
49
fCheckParticlesCmd
->AvailableForStates(G4State_Idle);
50
51
fCheckParticleCmd
=
52
new
G4UIcmdWithAnInteger(
"/mcParticlesChecker/checkParticle"
,
this
);
53
fCheckParticleCmd
->SetGuidance(
54
"Check properties for the particle with given PDG encoding"
);
55
fCheckParticleCmd
->SetParameterName(
"PDGEncoding"
,
false
);
56
fCheckParticleCmd
->AvailableForStates(G4State_Idle);
57
58
fSelectPropertyCmd
=
59
new
G4UIcmdWithAString(
"/mcParticlesChecker/selectProperty"
,
this
);
60
fSelectPropertyCmd
->SetParameterName(
"propertyName"
,
true
);
61
fSelectPropertyCmd
->AvailableForStates(G4State_Idle);
62
63
fSetCheckingCmd
=
64
new
G4UIcmdWithABool(
"/mcParticlesChecker/setChecking"
,
this
);
65
fSetCheckingCmd
->SetGuidance(
"(In)Activate checking for a selected property"
);
66
fSetCheckingCmd
->SetParameterName(
"Checking"
,
false
);
67
fSetCheckingCmd
->AvailableForStates(G4State_Idle);
68
69
fSetPrecisionCmd
=
70
new
G4UIcmdWithADouble(
"/mcParticlesChecker/setPrecision"
,
this
);
71
fSetPrecisionCmd
->SetGuidance(
"Set number of bins in P"
);
72
fSetPrecisionCmd
->SetParameterName(
"nofBinsE"
,
false
);
73
fSetPrecisionCmd
->AvailableForStates(
74
G4State_PreInit, G4State_Init, G4State_Idle);
75
}
76
77
//_____________________________________________________________________________
78
TG4ParticlesCheckerMessenger::~TG4ParticlesCheckerMessenger
()
79
{
81
82
delete
fDirectory
;
83
delete
fCheckParticlesCmd
;
84
delete
fCheckParticleCmd
;
85
delete
fSelectPropertyCmd
;
86
delete
fSetCheckingCmd
;
87
delete
fSetPrecisionCmd
;
88
}
89
90
//
91
// public methods
92
//
93
94
//_____________________________________________________________________________
95
void
TG4ParticlesCheckerMessenger::Init
()
96
{
101
102
G4String candidates;
103
const
std::set<TG4ParticlesChecker::ParticleProperty>& availableProperties =
104
fParticlesChecker
->GetAvailableProperties();
105
std::set<TG4ParticlesChecker::ParticleProperty>::const_iterator it;
106
for
(it = availableProperties.begin(); it != availableProperties.end();
107
it++) {
108
candidates = candidates +
TG4ParticlesChecker::GetParticlePropertyName
(*it);
109
candidates = candidates + G4String(
" "
);
110
}
111
fSelectPropertyCmd
->SetCandidates(candidates);
112
113
G4String guidance =
"Select particle property to be checked.\n"
;
114
guidance = guidance +
"Available: "
;
115
guidance = guidance + candidates;
116
fSelectPropertyCmd
->SetGuidance(guidance);
117
}
118
119
//_____________________________________________________________________________
120
void
TG4ParticlesCheckerMessenger::SetNewValue
(
121
G4UIcommand
* command, G4String newValue)
122
{
124
125
if
(command ==
fCheckParticlesCmd
) {
126
fParticlesChecker
->CheckParticles();
127
}
128
else
if
(command ==
fCheckParticleCmd
) {
129
fParticlesChecker
->CheckParticle(
130
fCheckParticleCmd
->GetNewIntValue(newValue));
131
}
132
else
if
(command ==
fSelectPropertyCmd
) {
133
fSelectedProperty
= newValue;
134
}
135
else
if
(command ==
fSetCheckingCmd
) {
136
if
(
fSelectedProperty
==
""
) {
137
TString text =
"The particle property has to be selected first.\n"
;
138
text = text +
"The command will have no effect."
;
139
TG4Globals::Warning
(
"TG4ParticlesCheckerMessenger"
,
"SetNewValue"
,
140
"The particle property has not been yet seleceted."
);
141
return
;
142
}
143
fParticlesChecker
->SetChecking(
144
TG4ParticlesChecker::GetParticleProperty
(
fSelectedProperty
),
145
fSetCheckingCmd
->GetNewBoolValue(newValue));
146
}
147
else
if
(command ==
fSetPrecisionCmd
) {
148
fParticlesChecker
->SetPrecision(
149
fSetPrecisionCmd
->GetNewDoubleValue(newValue));
150
}
151
}
TG4Globals.h
Definition of the TG4Globals class and basic container types.
TG4ParticlesCheckerMessenger.h
Definition of the TG4ParticlesCheckerMessenger class.
TG4ParticlesChecker.h
Definition of the TG4ParticlesChecker class.
TG4UICmdWithAComplexString.h
Definition of the TG4UICmdWithAComplexString class.
G4UIcommand
G4UImessenger
TG4Globals::Warning
static void Warning(const TString &className, const TString &methodName, const TString &text)
Definition
TG4Globals.cxx:48
TG4ParticlesCheckerMessenger::fCheckParticlesCmd
G4UIcmdWithoutParameter * fCheckParticlesCmd
command: checkParticles
Definition
TG4ParticlesCheckerMessenger.h:68
TG4ParticlesCheckerMessenger::Init
void Init()
Definition
TG4ParticlesCheckerMessenger.cxx:95
TG4ParticlesCheckerMessenger::fSetPrecisionCmd
G4UIcmdWithADouble * fSetPrecisionCmd
command: setPrecision
Definition
TG4ParticlesCheckerMessenger.h:72
TG4ParticlesCheckerMessenger::fSelectPropertyCmd
G4UIcmdWithAString * fSelectPropertyCmd
command: selectProperty
Definition
TG4ParticlesCheckerMessenger.h:70
TG4ParticlesCheckerMessenger::SetNewValue
virtual void SetNewValue(G4UIcommand *command, G4String string)
Definition
TG4ParticlesCheckerMessenger.cxx:120
TG4ParticlesCheckerMessenger::fCheckParticleCmd
G4UIcmdWithAnInteger * fCheckParticleCmd
command: checkParticle
Definition
TG4ParticlesCheckerMessenger.h:69
TG4ParticlesCheckerMessenger::TG4ParticlesCheckerMessenger
TG4ParticlesCheckerMessenger()
Not implemented.
TG4ParticlesCheckerMessenger::fSetCheckingCmd
G4UIcmdWithABool * fSetCheckingCmd
command: setChecking
Definition
TG4ParticlesCheckerMessenger.h:71
TG4ParticlesCheckerMessenger::fDirectory
G4UIdirectory * fDirectory
command directory
Definition
TG4ParticlesCheckerMessenger.h:65
TG4ParticlesCheckerMessenger::fParticlesChecker
TG4ParticlesChecker * fParticlesChecker
associated class
Definition
TG4ParticlesCheckerMessenger.h:64
TG4ParticlesCheckerMessenger::~TG4ParticlesCheckerMessenger
virtual ~TG4ParticlesCheckerMessenger()
Definition
TG4ParticlesCheckerMessenger.cxx:78
TG4ParticlesCheckerMessenger::fSelectedProperty
G4String fSelectedProperty
selected property
Definition
TG4ParticlesCheckerMessenger.h:66
TG4ParticlesChecker
A helper class for comparing the basic particles properties in between Root and Geant4.
Definition
TG4ParticlesChecker.h:39
TG4ParticlesChecker::GetParticlePropertyName
static G4String GetParticlePropertyName(ParticleProperty property)
Definition
TG4ParticlesChecker.cxx:39
TG4ParticlesChecker::GetParticleProperty
static ParticleProperty GetParticleProperty(const G4String &propertyName)
Definition
TG4ParticlesChecker.cxx:69
Generated on
for Geant4 VMC by
1.17.0