ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE06DetectorMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RE06DetectorMessenger.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 
31 #include "RE06DetectorMessenger.hh"
32 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAString.hh"
36 #include "G4UIcmdWithABool.hh"
37 #include "G4UIcmdWithAnInteger.hh"
38 #include "G4Material.hh"
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
43  : G4UImessenger(),
44  fDetector(det),
45  fDirectory(0),
46  fAbsMaterialCmd(0),
47  fGapMaterialCmd(0),
48  fNumLayerCmd(0),
49  fSerialCmd(0),
50  fVerboseCmd(0),
51  fAddMaterialCmd(0)
52 {
53  fDirectory = new G4UIdirectory("/RE06/");
54  fDirectory->SetGuidance("UI commands of this example");
55 
56  G4String matList;
58  for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
59  {
60  matList += (*matTbl)[i]->GetName();
61  matList += " ";
62  }
63 
64  fAbsMaterialCmd = new G4UIcmdWithAString("/RE06/setAbsMat",this);
65  fAbsMaterialCmd->SetGuidance("Select Material of the Absorber.");
66  fAbsMaterialCmd->SetParameterName("choice",false);
69 
70  fGapMaterialCmd = new G4UIcmdWithAString("/RE06/setGapMat",this);
71  fGapMaterialCmd->SetGuidance("Select Material of the Gap.");
72  fGapMaterialCmd->SetParameterName("choice",false);
75 
76  fNumLayerCmd = new G4UIcmdWithAnInteger("/RE06/numberOfLayers",this);
77  fNumLayerCmd->SetGuidance("Set number of layers.");
78  fNumLayerCmd->SetParameterName("nl",false);
80  fNumLayerCmd->SetRange("nl>0");
81 
82  fSerialCmd = new G4UIcmdWithABool("/RE06/serialGeometry",this);
84  ->SetGuidance("Select calorimeters to be placed in serial or parallel.");
85  fSerialCmd->SetParameterName("serialize",false);
87 
88  fVerboseCmd = new G4UIcmdWithAnInteger("/RE06/verbose",this);
89  fVerboseCmd->SetGuidance("Set verbosity level");
90  fVerboseCmd->SetParameterName("verbose",false);
92  fVerboseCmd->SetRange("verbose>=0");
93 
94  fAddMaterialCmd = new G4UIcmdWithABool("/RE06/AddMaterial",this);
95  fAddMaterialCmd->SetGuidance("Add materials ");
96  fAddMaterialCmd->SetParameterName("dummy",true);
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
103 {
104  delete fAbsMaterialCmd;
105  delete fGapMaterialCmd;
106  delete fNumLayerCmd;
107  delete fSerialCmd;
108  delete fDirectory;
109 }
110 
112 {
113  if( command == fAbsMaterialCmd ) {
114  fDetector->SetAbsorberMaterial(newValue);
115 
116  } else if( command == fGapMaterialCmd ){
117  fDetector->SetGapMaterial(newValue);
118 
119  } else if( command == fNumLayerCmd ) {
121 
122  } else if( command == fSerialCmd ) {
124 
125  } else if( command == fVerboseCmd ) {
127 
128  } else if( command == fAddMaterialCmd ) {
131  }
132 }
133 
134 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
135 
137 {
138  G4String ans;
139  if( command == fAbsMaterialCmd ){
141 
142  } else if( command == fGapMaterialCmd ){
143  ans=fDetector->GetGapMaterial();
144 
145  } else if( command == fNumLayerCmd ) {
147 
148  } else if( command == fSerialCmd ){
150 
151  } else if( command == fSerialCmd ) {
153 
154  } else if( command == fVerboseCmd ) {
156 
157  }
158  return ans;
159 }
160 
161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
162 
164 {
165  G4String matList;
167  for(size_t i=0;i<G4Material::GetNumberOfMaterials();i++)
168  {
169  matList += (*matTbl)[i]->GetName();
170  matList += " ";
171  }
172 
173  if(fAbsMaterialCmd !=0) {
174  fAbsMaterialCmd->SetCandidates(matList);
175  }
176  if (fGapMaterialCmd !=0) {
177  fGapMaterialCmd->SetCandidates(matList);
178  }
179 }
180 
181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......