]>
Commit | Line | Data |
---|---|---|
676fb573 | 1 | // $Id$ |
2 | // Category: geometry | |
3 | // | |
7005154f | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class AliModulesCompositionMessenger | |
7 | // ------------------------------------ | |
676fb573 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "AliModulesCompositionMessenger.h" | |
11 | #include "AliModulesComposition.h" | |
12 | #include "AliGlobals.h" | |
13 | ||
14 | #include <G4UIdirectory.hh> | |
676fb573 | 15 | #include <G4UIcmdWithoutParameter.hh> |
16 | #include <G4UIcmdWithABool.hh> | |
17 | #include <G4UIcmdWithADoubleAndUnit.hh> | |
18 | ||
3cf9eae1 | 19 | //_____________________________________________________________________________ |
676fb573 | 20 | AliModulesCompositionMessenger::AliModulesCompositionMessenger( |
21 | AliModulesComposition* modulesComposition) | |
22 | : fModulesComposition(modulesComposition) | |
23 | { | |
24 | // | |
25 | fDirectory = new G4UIdirectory("/aliDet/"); | |
26 | fDirectory->SetGuidance("Detector construction control commands."); | |
27 | ||
676fb573 | 28 | fFieldValueCmd = new G4UIcmdWithADoubleAndUnit("/aliDet/fieldValue", this); |
29 | fFieldValueCmd->SetGuidance("Define magnetic field in Z direction."); | |
30 | fFieldValueCmd->SetParameterName("fieldValue", false, false); | |
31 | fFieldValueCmd->SetDefaultUnit("tesla"); | |
32 | fFieldValueCmd->SetUnitCategory("Magnetic flux density"); | |
33 | fFieldValueCmd->AvailableForStates(PreInit,Idle); | |
34 | ||
676fb573 | 35 | fSetReadGeometryCmd |
36 | = new G4UIcmdWithABool("/aliDet/readGeometry", this); | |
37 | fSetReadGeometryCmd->SetGuidance("Read geometry from g3calls.dat files"); | |
38 | fSetReadGeometryCmd->SetParameterName("readGeometry", false); | |
39 | fSetReadGeometryCmd->AvailableForStates(PreInit); | |
40 | ||
41 | fSetWriteGeometryCmd | |
42 | = new G4UIcmdWithABool("/aliDet/writeGeometry", this); | |
43 | fSetWriteGeometryCmd->SetGuidance("Write geometry to g3calls.dat file"); | |
44 | fSetWriteGeometryCmd->SetParameterName("writeGeometry", false); | |
45 | fSetWriteGeometryCmd->AvailableForStates(PreInit); | |
46 | ||
9225847a | 47 | fPrintMaterialsCmd |
48 | = new G4UIcmdWithoutParameter("/aliDet/printMaterials", this); | |
49 | fPrintMaterialsCmd->SetGuidance("Prints all materials."); | |
50 | fPrintMaterialsCmd->AvailableForStates(PreInit, Init, Idle); | |
51 | ||
52 | fGenerateXMLCmd | |
53 | = new G4UIcmdWithoutParameter("/aliDet/generateXML", this); | |
54 | fGenerateXMLCmd->SetGuidance("Generate geometry XML file."); | |
55 | fGenerateXMLCmd->AvailableForStates(Idle); | |
676fb573 | 56 | } |
57 | ||
3cf9eae1 | 58 | //_____________________________________________________________________________ |
676fb573 | 59 | AliModulesCompositionMessenger::AliModulesCompositionMessenger() { |
60 | // | |
61 | } | |
62 | ||
3cf9eae1 | 63 | //_____________________________________________________________________________ |
676fb573 | 64 | AliModulesCompositionMessenger::AliModulesCompositionMessenger( |
65 | const AliModulesCompositionMessenger& right) | |
66 | { | |
67 | // | |
68 | AliGlobals::Exception( | |
69 | "AliModulesCompositionMessenger is protected from copying."); | |
70 | } | |
71 | ||
3cf9eae1 | 72 | //_____________________________________________________________________________ |
676fb573 | 73 | AliModulesCompositionMessenger::~AliModulesCompositionMessenger() { |
74 | // | |
75 | delete fDirectory; | |
676fb573 | 76 | delete fFieldValueCmd; |
676fb573 | 77 | delete fSetReadGeometryCmd; |
78 | delete fSetWriteGeometryCmd; | |
9225847a | 79 | delete fPrintMaterialsCmd; |
80 | delete fGenerateXMLCmd; | |
676fb573 | 81 | } |
82 | ||
83 | // operators | |
84 | ||
3cf9eae1 | 85 | //_____________________________________________________________________________ |
676fb573 | 86 | AliModulesCompositionMessenger& |
87 | AliModulesCompositionMessenger::operator=( | |
88 | const AliModulesCompositionMessenger& right) | |
89 | { | |
90 | // check assignement to self | |
91 | if (this == &right) return *this; | |
92 | ||
93 | AliGlobals::Exception( | |
94 | "AliModulesCompositionMessenger is protected from assigning."); | |
95 | ||
96 | return *this; | |
97 | } | |
98 | ||
99 | // public methods | |
100 | ||
3cf9eae1 | 101 | //_____________________________________________________________________________ |
676fb573 | 102 | void AliModulesCompositionMessenger::SetNewValue(G4UIcommand* command, G4String newValues) |
103 | { | |
104 | // Applies command to the associated object. | |
105 | // --- | |
106 | ||
80ed9a99 | 107 | if (command == fFieldValueCmd) { |
676fb573 | 108 | fModulesComposition |
109 | ->SetMagField(fFieldValueCmd->GetNewDoubleValue(newValues)); | |
110 | } | |
676fb573 | 111 | else if (command == fSetReadGeometryCmd) { |
112 | fModulesComposition->SetReadGeometry( | |
113 | fSetReadGeometryCmd->GetNewBoolValue(newValues)); | |
114 | } | |
115 | else if (command == fSetWriteGeometryCmd) { | |
116 | fModulesComposition->SetWriteGeometry( | |
117 | fSetWriteGeometryCmd->GetNewBoolValue(newValues)); | |
118 | } | |
9225847a | 119 | else if (command == fPrintMaterialsCmd) { |
120 | fModulesComposition->PrintMaterials(); | |
121 | } | |
122 | else if (command == fGenerateXMLCmd) { | |
123 | fModulesComposition->GenerateXMLGeometry(); | |
124 | } | |
676fb573 | 125 | } |