LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ExN03DetectorMessenger.cc
Go to the documentation of this file.
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 //
26 //
27 //
28 //
29 
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
34 
36 #include "G4UIdirectory.hh"
37 #include "G4UIcmdWithAString.hh"
38 #include "G4UIcmdWithAnInteger.hh"
39 #include "G4UIcmdWithADoubleAndUnit.hh"
40 #include "G4UIcmdWithoutParameter.hh"
41 
42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43 
45  ExN03DetectorConstruction* ExN03Det)
46 :ExN03Detector(ExN03Det)
47 {
48  N03Dir = new G4UIdirectory("/N03/");
49  N03Dir->SetGuidance("UI commands of this example");
50 
51  detDir = new G4UIdirectory("/N03/det/");
52  detDir->SetGuidance("detector control");
53 
54  AbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
55  AbsMaterCmd->SetGuidance("Select Material of the Absorber.");
56  AbsMaterCmd->SetParameterName("choice",false);
57  AbsMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
58 
59  GapMaterCmd = new G4UIcmdWithAString("/N03/det/setGapMat",this);
60  GapMaterCmd->SetGuidance("Select Material of the Gap.");
61  GapMaterCmd->SetParameterName("choice",false);
62  GapMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
63 
64  AbsThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setAbsThick",this);
65  AbsThickCmd->SetGuidance("Set Thickness of the Absorber");
66  AbsThickCmd->SetParameterName("Size",false);
67  AbsThickCmd->SetRange("Size>=0.");
68  AbsThickCmd->SetUnitCategory("Length");
69  AbsThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
70 
71  GapThickCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setGapThick",this);
72  GapThickCmd->SetGuidance("Set Thickness of the Gap");
73  GapThickCmd->SetParameterName("Size",false);
74  GapThickCmd->SetRange("Size>=0.");
75  GapThickCmd->SetUnitCategory("Length");
76  GapThickCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
77 
78  SizeYZCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setSizeYZ",this);
79  SizeYZCmd->SetGuidance("Set tranverse size of the calorimeter");
80  SizeYZCmd->SetParameterName("Size",false);
81  SizeYZCmd->SetRange("Size>0.");
82  SizeYZCmd->SetUnitCategory("Length");
83  SizeYZCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
84 
85  NbLayersCmd = new G4UIcmdWithAnInteger("/N03/det/setNbOfLayers",this);
86  NbLayersCmd->SetGuidance("Set number of layers.");
87  NbLayersCmd->SetParameterName("NbLayers",false);
88  NbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
89  NbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
90 
91  UpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
92  UpdateCmd->SetGuidance("Update calorimeter geometry.");
93  UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
94  UpdateCmd->SetGuidance("if you changed geometrical value(s).");
95  UpdateCmd->AvailableForStates(G4State_Idle);
96 
97  MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/N03/det/setField",this);
98  MagFieldCmd->SetGuidance("Define magnetic field.");
99  MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
100  MagFieldCmd->SetParameterName("Bz",false);
101  MagFieldCmd->SetUnitCategory("Magnetic flux density");
102  MagFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
103 }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
108 {
109  delete NbLayersCmd;
110  delete AbsMaterCmd; delete GapMaterCmd;
111  delete AbsThickCmd; delete GapThickCmd;
112  delete SizeYZCmd; delete UpdateCmd;
113  delete MagFieldCmd;
114  delete detDir;
115  delete N03Dir;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
120 void ExN03DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
121 {
122  if( command == AbsMaterCmd )
123  { ExN03Detector->SetAbsorberMaterial(newValue);}
124 
125  if( command == GapMaterCmd )
126  { ExN03Detector->SetGapMaterial(newValue);}
127 
128  if( command == AbsThickCmd )
130  ->GetNewDoubleValue(newValue));}
131 
132  if( command == GapThickCmd )
133  { ExN03Detector->SetGapThickness(GapThickCmd->GetNewDoubleValue(newValue));}
134 
135  if( command == SizeYZCmd )
136  { ExN03Detector->SetCalorSizeYZ(SizeYZCmd->GetNewDoubleValue(newValue));}
137 
138  if( command == NbLayersCmd )
139  { ExN03Detector->SetNbOfLayers(NbLayersCmd->GetNewIntValue(newValue));}
140 
141  if( command == UpdateCmd )
143 
144  if( command == MagFieldCmd )
145  { ExN03Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
146 }
147 
148 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4UIcmdWithADoubleAndUnit * AbsThickCmd
G4UIcmdWithAnInteger * NbLayersCmd
void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithADoubleAndUnit * SizeYZCmd
G4UIcmdWithoutParameter * UpdateCmd
ExN03DetectorConstruction * ExN03Detector
G4UIcmdWithAString * AbsMaterCmd
G4UIcmdWithAString * GapMaterCmd
G4UIcmdWithADoubleAndUnit * GapThickCmd
ExN03DetectorMessenger(ExN03DetectorConstruction *)
G4UIcmdWithADoubleAndUnit * MagFieldCmd