ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DetectorMessenger.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 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "DetectorMessenger.hh"
34 
35 #include "DetectorConstruction.hh"
36 #include "G4UIdirectory.hh"
37 #include "G4UIcmdWithAString.hh"
38 #include "G4UIcmdWithAnInteger.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45 :G4UImessenger(),fDetector(Det),
46  fTestemDir(0),
47  fDetDir(0),
48  fAbsMaterCmd(0),
49  fAbsThickCmd(0),
50  fAbsSizYZCmd(0),
51  fAbsXposCmd(0),
52  fWorldMaterCmd(0),
53  fWorldXCmd(0),
54  fWorldYZCmd(0)
55 {
56  fTestemDir = new G4UIdirectory("/testem/");
57  fTestemDir->SetGuidance("UI commands specific to this example.");
58 
59  fDetDir = new G4UIdirectory("/testem/det/");
60  fDetDir->SetGuidance("detector construction commands");
61 
62  fAbsMaterCmd = new G4UIcmdWithAString("/testem/det/setAbsMat",this);
63  fAbsMaterCmd->SetGuidance("Select Material of the Absorber.");
64  fAbsMaterCmd->SetParameterName("choice",false);
67 
68  fWorldMaterCmd = new G4UIcmdWithAString("/testem/det/setWorldMat",this);
69  fWorldMaterCmd->SetGuidance("Select Material of the World.");
70  fWorldMaterCmd->SetParameterName("wchoice",false);
73 
74  fAbsThickCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setAbsThick",this);
75  fAbsThickCmd->SetGuidance("Set Thickness of the Absorber");
76  fAbsThickCmd->SetParameterName("SizeZ",false);
77  fAbsThickCmd->SetRange("SizeZ>0.");
78  fAbsThickCmd->SetUnitCategory("Length");
81 
82  fAbsSizYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setAbsYZ",this);
83  fAbsSizYZCmd->SetGuidance("Set sizeYZ of the Absorber");
84  fAbsSizYZCmd->SetParameterName("SizeYZ",false);
85  fAbsSizYZCmd->SetRange("SizeYZ>0.");
86  fAbsSizYZCmd->SetUnitCategory("Length");
89 
90  fAbsXposCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setAbsXpos",this);
91  fAbsXposCmd->SetGuidance("Set X pos. of the Absorber");
92  fAbsXposCmd->SetParameterName("Xpos",false);
93  fAbsXposCmd->SetUnitCategory("Length");
96 
97  fWorldXCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setWorldX",this);
98  fWorldXCmd->SetGuidance("Set X size of the World");
99  fWorldXCmd->SetParameterName("WSizeX",false);
100  fWorldXCmd->SetRange("WSizeX>0.");
101  fWorldXCmd->SetUnitCategory("Length");
104 
105  fWorldYZCmd = new G4UIcmdWithADoubleAndUnit("/testem/det/setWorldYZ",this);
106  fWorldYZCmd->SetGuidance("Set sizeYZ of the World");
107  fWorldYZCmd->SetParameterName("WSizeYZ",false);
108  fWorldYZCmd->SetRange("WSizeYZ>0.");
109  fWorldYZCmd->SetUnitCategory("Length");
112 
113 }
114 
115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116 
118 {
119  delete fAbsMaterCmd;
120  delete fAbsThickCmd;
121  delete fAbsSizYZCmd;
122  delete fAbsXposCmd;
123  delete fWorldMaterCmd;
124  delete fWorldXCmd;
125  delete fWorldYZCmd;
126  delete fDetDir;
127  delete fTestemDir;
128 }
129 
130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
131 
133 {
134  if ( command == fAbsMaterCmd )
135  {fDetector->SetAbsorberMaterial(newValue);}
136 
137  if ( command == fWorldMaterCmd )
138  {fDetector->SetWorldMaterial(newValue);}
139 
140  if ( command == fAbsThickCmd )
142 
143  if ( command == fAbsSizYZCmd )
145 
146  if ( command == fAbsXposCmd )
148 
149  if ( command == fWorldXCmd )
151 
152  if ( command == fWorldYZCmd )
154 
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......