BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
BesEmcDetectorMessenger.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oreiented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Descpirtion: EMC detector
5//Author: Fu Chengdong
6//Created: Sep 4, 2003
7//Comment:
8//---------------------------------------------------------------------------//
9//
11
12#include "G4ThreeVector.hh"
13#include "BesEmcConstruction.hh"
14#include "BesEmcGeometry.hh"
15#include "G4UIdirectory.hh"
16#include "G4UIcmdWithAString.hh"
17#include "G4UIcmdWithAnInteger.hh"
18#include "G4UIcmdWithADoubleAndUnit.hh"
19#include "G4UIcmdWith3VectorAndUnit.hh"
20#include "G4UIcmdWithoutParameter.hh"
21#include "G4Material.hh"
22//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
23
25 BesEmcConstruction* BesDet,
26 BesEmcGeometry* besEMCGeometry)
27:BesEmc(BesDet)
28{
29 fBesEmcGeometry=besEMCGeometry;
30
31 BesdetDir = new G4UIdirectory("/calor/");
32 BesdetDir->SetGuidance("Bes calorimeter detector control.");
33
34 verboseCmd = new G4UIcmdWithAnInteger("/calor/verbose",this);
35 verboseCmd->SetGuidance("Set Verbose level of calor management category.");
36 verboseCmd->SetGuidance(" 0 : Important information");
37 verboseCmd->SetGuidance(" 1 : Base information");
38 verboseCmd->SetGuidance(" 2 : More...");
39 verboseCmd->SetParameterName("level",true);
40 verboseCmd->SetRange("level>=0");
41 verboseCmd->SetDefaultValue(0);
42
43 CryMaterCmd = new G4UIcmdWithAString("/calor/setCryMat",this);
44 CryMaterCmd->SetGuidance("Select Material of the Crystal.");
45 CryMaterCmd->SetParameterName("choice",true,true);
46 // CryMaterCmd->AvailableForStates(Idle);
47
48 CasingMaterCmd = new G4UIcmdWithAString("/calor/setCasMat",this);
49 CasingMaterCmd->SetGuidance("Select Material of the Casing.");
50 CasingMaterCmd->SetParameterName("choice",true,true);
51 // CasingMaterCmd->AvailableForStates(Idle);
52
53 CasingThickCmd = new G4UIcmdWith3VectorAndUnit("/calor/setCasThick",this);
54 CasingThickCmd->SetGuidance("Set Thickness of the Casing");
55 CasingThickCmd->SetParameterName("TyvekThk","AlThk","MylarThk",true);
56 CasingThickCmd->SetRange("Size>=0.");
57 CasingThickCmd->SetUnitCategory("Length");
58 CasingThickCmd->SetDefaultValue(fBesEmcGeometry->GetCasingThickness()/mm);
59 CasingThickCmd->SetDefaultUnit("mm");
60 // CasingThickCmd->AvailableForStates(Idle);
61
62 SizeRminCmd = new G4UIcmdWithADoubleAndUnit("/calor/setSizeRmin",this);
63 SizeRminCmd->SetGuidance("Set Rmin size of the barrel calorimeter");
64 SizeRminCmd->SetParameterName("Size",true);
65 SizeRminCmd->SetRange("Size>0.");
66 SizeRminCmd->SetUnitCategory("Length");
67 SizeRminCmd->SetDefaultValue(fBesEmcGeometry->GetBSCRmin()/cm);
68 SizeRminCmd->SetDefaultUnit("cm");
69 // SizeRminCmd->AvailableForStates(Idle);
70
71 NbPhiCmd = new G4UIcmdWithAnInteger("/calor/setNbPhi",this);
72 NbPhiCmd->SetGuidance("Set number of crystals at phi direction.");
73 NbPhiCmd->SetParameterName("NbCrystals",false);
74 NbPhiCmd->SetRange("NbCrystals>0 && NbCrystals<=150");
75 // NbPhiCmd->AvailableForStates(Idle);
76
77 NbThetaCmd = new G4UIcmdWithAnInteger("/calor/setNbTheta",this);
78 NbThetaCmd->SetGuidance("Set number of crystals at theta direction.");
79 NbThetaCmd->SetParameterName("NbCrystals",false);
80 NbThetaCmd->SetRange("NbCrystals>0 && NbCrystals<=22");
81 // NbThetaCmd->AvailableForStates(Idle);
82
83 StartIDThetaCmd = new G4UIcmdWithAnInteger("/calor/setStartTheta",this);
84 StartIDThetaCmd->SetGuidance("Set ID of starting crystals at theta direction.");
85 StartIDThetaCmd->SetParameterName("IDCrystal",false);
86 StartIDThetaCmd->SetRange("IDCrystal>=0 && IDCrystal<22");
87 // StartIDThetaCmd->AvailableForStates(Idle);
88
89 LengthCmd = new G4UIcmdWithADoubleAndUnit("/calor/setCryLength",this);
90 LengthCmd->SetGuidance("Set Length of crystals of barrel calorimeter");
91 LengthCmd->SetParameterName("Size",true);
92 LengthCmd->SetRange("Size>0.");
93 LengthCmd->SetUnitCategory("Length");
94 LengthCmd->SetDefaultValue(fBesEmcGeometry->GetBSCCryLength()/cm);
95 LengthCmd->SetDefaultUnit("cm");
96 // LengthCmd->AvailableForStates(Idle);
97
98 UpdateCmd = new G4UIcmdWithoutParameter("/calor/update",this);
99 UpdateCmd->SetGuidance("Update calorimeter geometry.");
100 UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
101 UpdateCmd->SetGuidance("if you changed geometrical value(s).");
102 // UpdateCmd->AvailableForStates(Idle);
103
104 MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/calor/setField",this);
105 MagFieldCmd->SetGuidance("Define magnetic field.");
106 MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
107 MagFieldCmd->SetParameterName("Bz",true);
108 MagFieldCmd->SetRange("Bz>=0.");
109 MagFieldCmd->SetUnitCategory("Magnetic flux density");
110 MagFieldCmd->SetDefaultValue(BesEmc->GetMagField()/tesla);
111 MagFieldCmd->SetDefaultUnit("tesla");
112 // MagFieldCmd->AvailableForStates(Idle);
113}
114
115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116
118{
119 delete verboseCmd;
120 delete LengthCmd;
121 delete NbPhiCmd; delete NbThetaCmd;
122 delete StartIDThetaCmd;
123 delete CryMaterCmd; delete CasingMaterCmd;
124 delete CasingThickCmd;
125 delete SizeRminCmd;
126 delete UpdateCmd;
127 delete MagFieldCmd;
128 delete BesdetDir;
129}
130
131//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
132
133void BesEmcDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
134{
135 if( command == verboseCmd )
136 {
137 BesEmc->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
138 }
139
140 if( command == CryMaterCmd )
141 { BesEmc->SetCrystalMaterial(newValue);}
142
143 if( command == CasingMaterCmd )
144 { BesEmc->SetCasingMaterial(newValue);}
145
146 if( command == CasingThickCmd )
147 { BesEmc->SetCasingThickness(CasingThickCmd->GetNew3VectorValue(newValue));}
148
149 if( command == SizeRminCmd )
150 { BesEmc->SetBSCRmin(SizeRminCmd->GetNewDoubleValue(newValue));}
151
152 if( command == NbPhiCmd )
153 { BesEmc->SetBSCNbPhi(NbPhiCmd->GetNewIntValue(newValue));}
154
155 if( command == NbThetaCmd )
156 { BesEmc->SetBSCNbTheta(NbThetaCmd->GetNewIntValue(newValue));}
157
158 if( command == StartIDThetaCmd )
159 { BesEmc->SetStartIDTheta(StartIDThetaCmd->GetNewIntValue(newValue));}
160
161 if( command == LengthCmd )
162 { BesEmc->SetBSCCrystalLength(LengthCmd->GetNewDoubleValue(newValue));}
163
164 if( command == UpdateCmd )
165 { BesEmc->UpdateGeometry(); }
166
167 if( command == MagFieldCmd )
168 { BesEmc->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
169}
170
171//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
172
173G4String BesEmcDetectorMessenger::GetCurrentValue(G4UIcommand * command)
174{
175 G4String cv;
176
177 if( command == verboseCmd )
178 { cv = verboseCmd->ConvertToString(BesEmc->GetVerboseLevel()); }
179
180 if( command == CryMaterCmd )
181 { cv = BesEmc->GetCrystalMaterial()->GetName(); }
182
183 if( command == CasingMaterCmd )
184 { cv = BesEmc->GetCasingMaterial()->GetName(); }
185
186 return cv;
187}
188
189//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetMagField(G4double)
void SetCasingThickness(G4ThreeVector)
void SetBSCCrystalLength(G4double)
void SetCrystalMaterial(G4String)
void SetCasingMaterial(G4String)
G4Material * GetCasingMaterial()
void SetVerboseLevel(G4int val)
G4Material * GetCrystalMaterial()
BesEmcDetectorMessenger(BesEmcConstruction *, BesEmcGeometry *)
void SetNewValue(G4UIcommand *, G4String)
G4String GetCurrentValue(G4UIcommand *)
G4double GetBSCCryLength()
G4double GetBSCRmin()
G4ThreeVector GetCasingThickness()