]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliDetConstructionMessenger.cxx
added Configure(); corrected Construct()
[u/mrichter/AliRoot.git] / AliGeant4 / AliDetConstructionMessenger.cxx
1 // $Id$
2 // Category: geometry
3 //
4 // See the class description in the header file.
5
6 #include "AliDetConstructionMessenger.h"
7 #include "AliDetConstruction.h"
8 #include "AliGlobals.h"
9
10 #include <G4UIcmdWithABool.hh>
11
12 AliDetConstructionMessenger::AliDetConstructionMessenger(
13                                 AliDetConstruction* detConstruction)
14   : fDetConstruction(detConstruction)
15 {
16 //
17   fSetAllSensitiveCmd
18     = new G4UIcmdWithABool("/aliDet/setAllSensitive", this);
19   fSetAllSensitiveCmd 
20     ->SetGuidance("If true: set all logical volumes sensitive.");
21   fSetAllSensitiveCmd 
22     ->SetGuidance("         (Each logical is volume associated with a sensitive");
23   fSetAllSensitiveCmd 
24     ->SetGuidance("          detector.)");
25   fSetAllSensitiveCmd 
26     ->SetGuidance("If false: only volumes defined with a sensitive tracking");
27   fSetAllSensitiveCmd 
28     ->SetGuidance("          medium are associated with a sensitive detector.");
29   fSetAllSensitiveCmd->SetParameterName("sensitivity", false);
30   fSetAllSensitiveCmd->AvailableForStates(PreInit);  
31
32   fSetReadGeometryCmd 
33     = new G4UIcmdWithABool("/aliDet/readGeometry", this);
34   fSetReadGeometryCmd->SetGuidance("Read geometry from g3calls.dat files");
35   fSetReadGeometryCmd->SetParameterName("readGeometry", false);
36   fSetReadGeometryCmd->AvailableForStates(PreInit);  
37  
38   fSetWriteGeometryCmd 
39     = new G4UIcmdWithABool("/aliDet/writeGeometry", this);
40   fSetWriteGeometryCmd->SetGuidance("Write geometry to g3calls.dat file");
41   fSetWriteGeometryCmd->SetParameterName("writeGeometry", false);
42   fSetWriteGeometryCmd->AvailableForStates(PreInit);   
43 }
44
45 AliDetConstructionMessenger::AliDetConstructionMessenger() {
46 //
47 }
48
49 AliDetConstructionMessenger::AliDetConstructionMessenger(
50                                 const AliDetConstructionMessenger& right)
51 {
52 //
53   AliGlobals::Exception(
54     "AliDetConstructionMessenger is protected from copying.");
55 }
56
57 AliDetConstructionMessenger::~AliDetConstructionMessenger() {
58 //
59   delete fSetAllSensitiveCmd;
60   delete fSetReadGeometryCmd;
61   delete fSetWriteGeometryCmd;
62 }
63
64 // operators
65
66 AliDetConstructionMessenger& 
67 AliDetConstructionMessenger::operator=(const AliDetConstructionMessenger& right)
68 {
69   // check assignement to self
70   if (this == &right) return *this;
71
72   AliGlobals::Exception(
73      "AliDetConstructionMessenger is protected from assigning.");
74     
75   return *this;  
76 }    
77           
78 // public methods
79   
80 void AliDetConstructionMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
81 {
82 // Applies command to the associated object.
83 // ---
84
85   if (command == fSetAllSensitiveCmd) {
86     fDetConstruction->SetAllLVSensitive(
87                          fSetAllSensitiveCmd->GetNewBoolValue(newValues));
88   }
89   else if (command == fSetReadGeometryCmd) {
90     fDetConstruction->SetReadGeometry(
91                          fSetReadGeometryCmd->GetNewBoolValue(newValues));
92   }  
93   else if (command == fSetWriteGeometryCmd) {
94     fDetConstruction->SetWriteGeometry(
95                          fSetReadGeometryCmd->GetNewBoolValue(newValues));
96   }    
97 }
98