Geant4 VMC
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
source
digits+hits
src
TG4SDMessenger.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Geant4 Virtual Monte Carlo package
3
// Copyright (C) 2007 - 2015 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 "
TG4SDMessenger.h
"
16
#include "
TG4SDConstruction.h
"
17
#include "
TG4SDServices.h
"
18
19
#include <G4UIcmdWithABool.hh>
20
#include <G4UIcmdWithAString.hh>
21
#include <G4UIcmdWithoutParameter.hh>
22
#include <G4UIdirectory.hh>
23
24
//______________________________________________________________________________
25
TG4SDMessenger::TG4SDMessenger
(
TG4SDConstruction
* sdConstruction)
26
:
G4UImessenger
(),
27
fSDConstruction
(sdConstruction),
28
fAddSDSelectionCmd
(0),
29
fSetSDSelectionFromTGeoCmd
(0),
30
fSetSVLabelCmd
(0),
31
fSetGflashCmd
(0),
32
fSetExclusiveSDScoringCmd
(0),
33
fPrintUserSDsCmd
(0)
34
{
36
37
fAddSDSelectionCmd
=
new
G4UIcmdWithAString(
"/mcDet/addSDSelection"
,
this
);
38
G4String guidance =
"Selects volumes which will be make sensitive \n"
;
39
guidance +=
40
"(When any selection is applied MCApllication::Stepping() is called only "
;
41
guidance +=
"from the selected volumes.)"
;
42
fAddSDSelectionCmd
->SetGuidance(guidance);
43
fAddSDSelectionCmd
->SetParameterName(
"SDSelection"
,
false
);
44
fAddSDSelectionCmd
->AvailableForStates(G4State_PreInit);
45
46
fSetSDSelectionFromTGeoCmd
=
47
new
G4UIcmdWithABool(
"/mcDet/setSDSelectionFromTGeo"
,
this
);
48
guidance =
"Get sensitive volumes selection from TGeo geometry. \n"
;
49
guidance +=
50
"(When any selection is applied MCApllication::Stepping() is called only "
;
51
guidance +=
"from the selected volumes.)"
;
52
fSetSDSelectionFromTGeoCmd
->SetGuidance(guidance);
53
fSetSDSelectionFromTGeoCmd
->SetParameterName(
"SDSelectionFromTGeo"
,
false
);
54
fSetSDSelectionFromTGeoCmd
->AvailableForStates(G4State_PreInit);
55
56
fSetSVLabelCmd
=
new
G4UIcmdWithAString(
"/mcDet/setSVLabel"
,
this
);
57
guidance =
"Set the string which is used in TGeoVolume::SetOption \n"
;
58
guidance +=
"(to label sensitive volumes (default is \""
;
59
guidance +=
TG4SDConstruction::GetDefaultSVLabel
();
60
guidance +=
"\".)"
;
61
fSetSVLabelCmd
->SetGuidance(guidance);
62
fSetSVLabelCmd
->SetParameterName(
"SVLabel"
,
false
);
63
fSetSVLabelCmd
->AvailableForStates(G4State_PreInit);
64
65
fSetGflashCmd
=
new
G4UIcmdWithABool(
"/mcDet/setGflash"
,
this
);
66
guidance =
"Activate creating sensitive detectors adapted for GFlash."
;
67
fSetGflashCmd
->SetGuidance(guidance);
68
fSetGflashCmd
->SetParameterName(
"Gflash"
,
false
);
69
fSetGflashCmd
->AvailableForStates(G4State_PreInit);
70
71
fSetExclusiveSDScoringCmd
=
72
new
G4UIcmdWithABool(
"/mcDet/setExclusiveSDScoring"
,
this
);
73
guidance =
"Activate scoring by user sensitive detectors only.\n"
;
74
guidance +=
"The MC Application::Stepping() will be not called."
;
75
fSetExclusiveSDScoringCmd
->SetGuidance(guidance);
76
fSetExclusiveSDScoringCmd
->SetParameterName(
"ExclusiveSDScoring"
,
false
);
77
fSetExclusiveSDScoringCmd
->AvailableForStates(G4State_PreInit);
78
79
fPrintUserSDsCmd
=
new
G4UIcmdWithoutParameter(
"/mcDet/printUserSDs"
,
this
);
80
fPrintUserSDsCmd
->SetGuidance(
"Prints user sensitive detectors."
);
81
fPrintUserSDsCmd
->AvailableForStates(G4State_Init, G4State_Idle);
82
}
83
84
//______________________________________________________________________________
85
TG4SDMessenger::~TG4SDMessenger
()
86
{
88
89
delete
fAddSDSelectionCmd
;
90
delete
fSetSDSelectionFromTGeoCmd
;
91
delete
fSetSVLabelCmd
;
92
delete
fSetGflashCmd
;
93
delete
fSetExclusiveSDScoringCmd
;
94
delete
fPrintUserSDsCmd
;
95
}
96
97
//
98
// public methods
99
//
100
101
//______________________________________________________________________________
102
void
TG4SDMessenger::SetNewValue
(
G4UIcommand
* command, G4String newValue)
103
{
105
106
if
(command ==
fAddSDSelectionCmd
) {
107
fSDConstruction
->AddSelection(newValue);
108
}
109
else
if
(command ==
fSetSDSelectionFromTGeoCmd
) {
110
fSDConstruction
->SetSelectionFromTGeo(
111
fSetSDSelectionFromTGeoCmd
->GetNewBoolValue(newValue));
112
}
113
else
if
(command ==
fSetSVLabelCmd
) {
114
fSDConstruction
->SetSensitiveVolumeLabel(newValue);
115
}
116
else
if
(command ==
fSetGflashCmd
) {
117
fSDConstruction
->SetIsGflash(
fSetGflashCmd
->GetNewBoolValue(newValue));
118
}
119
else
if
(command ==
fSetExclusiveSDScoringCmd
) {
120
fSDConstruction
->SetExclusiveSDScoring(
121
fSetExclusiveSDScoringCmd
->GetNewBoolValue(newValue));
122
}
123
else
if
(command ==
fPrintUserSDsCmd
) {
124
TG4SDServices::Instance
()->
PrintUserSensitiveDetectors
();
125
}
126
}
TG4SDConstruction.h
Definition of the TG4SDConstruction class.
TG4SDMessenger.h
Definition of the TG4SDMessenger class.
TG4SDServices.h
Definition of the TG4SDServices class.
G4UIcommand
G4UImessenger
TG4SDConstruction
Sensitive detector construction.
Definition
TG4SDConstruction.h:41
TG4SDConstruction::GetDefaultSVLabel
static const G4String & GetDefaultSVLabel()
Definition
TG4SDConstruction.h:89
TG4SDMessenger::fSetGflashCmd
G4UIcmdWithABool * fSetGflashCmd
setGflash command
Definition
TG4SDMessenger.h:73
TG4SDMessenger::fSetSVLabelCmd
G4UIcmdWithAString * fSetSVLabelCmd
setSVLabel command
Definition
TG4SDMessenger.h:70
TG4SDMessenger::fSDConstruction
TG4SDConstruction * fSDConstruction
associated class
Definition
TG4SDMessenger.h:61
TG4SDMessenger::fSetExclusiveSDScoringCmd
G4UIcmdWithABool * fSetExclusiveSDScoringCmd
setExclusiveSDScoring command
Definition
TG4SDMessenger.h:76
TG4SDMessenger::fSetSDSelectionFromTGeoCmd
G4UIcmdWithABool * fSetSDSelectionFromTGeoCmd
getSDSelectionFromTGeo command
Definition
TG4SDMessenger.h:67
TG4SDMessenger::fAddSDSelectionCmd
G4UIcmdWithAString * fAddSDSelectionCmd
addSDSelection command
Definition
TG4SDMessenger.h:64
TG4SDMessenger::SetNewValue
virtual void SetNewValue(G4UIcommand *command, G4String string)
Definition
TG4SDMessenger.cxx:102
TG4SDMessenger::fPrintUserSDsCmd
G4UIcmdWithoutParameter * fPrintUserSDsCmd
command: printVolumes
Definition
TG4SDMessenger.h:79
TG4SDMessenger::TG4SDMessenger
TG4SDMessenger()
Not implemented.
TG4SDMessenger::~TG4SDMessenger
virtual ~TG4SDMessenger()
Definition
TG4SDMessenger.cxx:85
TG4SDServices::PrintUserSensitiveDetectors
void PrintUserSensitiveDetectors() const
Definition
TG4SDServices.cxx:193
TG4SDServices::Instance
static TG4SDServices * Instance()
Definition
TG4SDServices.h:120
Generated on
for Geant4 VMC by
1.17.0