CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
BesMdcDigitizerMessenger.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Description: passing parameters to BesMdcDigitizer
5//Author: Yuan Ye
6//Created: May , 2005
7//Modified:
8//Comment:
9//---------------------------------------------------------------------------//
10
12#include "BesMdcDigitizer.hh"
13#include "G4UIdirectory.hh"
14#include "G4UIcommand.hh"
15#include "G4UIcmdWithAnInteger.hh"
16#include "G4UIcmdWithADouble.hh"
17#include "G4UIcmdWithAString.hh"
18#include "G4ios.hh"
19#include <sstream>
20
22:mdcDigitizer(pointer)
23{
24 noiseDirectory = new G4UIdirectory("/mdc/noise/");
25 noiseDirectory->SetGuidance("BESIII MDC noise control");
26
27 //Noise On/Off command
28 noiseFlag = new G4UIcmdWithAnInteger("/mdc/noise/flag",this);
29 noiseFlag->SetGuidance("whether to add noise to MdcDigi.");
30 noiseFlag->SetParameterName("MdcNoiseFlag",false);
31 noiseFlag->SetRange("MdcNoiseFlag>=0");
32 // noiseFlag->SetDefaultValue(0);
33
34 //Noise type command
35 noiseType = new G4UIcmdWithAnInteger("/mdc/noise/type",this);
36 noiseType->SetGuidance("select noise type.");
37 noiseType->SetParameterName("MdcNoiseType",false);
38 noiseType->SetRange("MdcNoiseType>=0");
39 // noiseType->SetDefaultValue(3);
40
41 //Noise Level command
42 noiseLevel = new G4UIcmdWithADouble("/mdc/noise/level",this);
43 noiseLevel->SetGuidance("noise level");
44 noiseLevel->SetParameterName("MdcNoiseLevel",false);
45 noiseLevel->SetRange("MdcNoiseLevel>=0.");
46 // noiseLevel->SetDefaultValue(0.1);
47
48 digiDirectory = new G4UIdirectory("/mdc/digi/");
49 digiDirectory->SetGuidance("BESIII MDC digitizer control");
50
51 //T channel smear On/Off command
52 smearFlag = new G4UIcmdWithAnInteger("/mdc/digi/smearflag",this);
53 smearFlag->SetGuidance("whether to do T smear to MdcDigi.");
54 smearFlag->SetParameterName("MdcSmearFlag",true);
55 smearFlag->SetRange("MdcSmearFlag>=0");
56 smearFlag->SetDefaultValue(1);
57
58 //Space resolution command
59 mdcDRes = new G4UIcmdWithADouble("/mdc/digi/spaceres",this);
60 mdcDRes->SetGuidance("value of space resolution");
61 mdcDRes->SetParameterName("MdcDRes",false);
62 mdcDRes->SetRange("MdcDRes>0");
63
64 effDirectory = new G4UIdirectory("/mdc/eff/");
65 effDirectory->SetGuidance("BESIII MDC wire efficiency control");
66
67 //Eff. source command
68 effFlag = new G4UIcmdWithAnInteger("/mdc/eff/flag",this);
69 effFlag->SetGuidance("Get eff. from 0: CalSvc; 1: mac file");
70 effFlag->SetParameterName("MdcEffFlag",false);
71 effFlag->SetRange("MdcEffFlag>=0");
72 // effFlag->SetDefaultValue(0);
73
74 G4UIparameter* parameter;
75 G4bool omittable;
76
77 //Eff. command
78 layerEff = new G4UIcommand("/mdc/eff/eff",this);
79 layerEff->SetGuidance("Set eff. of MDC layers");
80
81 parameter = new G4UIparameter("layer",'i',omittable = false);
82 parameter->SetGuidance("Which layer to be modified");
83 parameter->SetParameterRange("layer >= -1 && layer < 43");
84 parameter->SetDefaultValue(-1);
85 layerEff->SetParameter(parameter);
86
87 parameter = new G4UIparameter("eff",'d',omittable = false);
88 parameter->SetGuidance("Eff. value");
89 parameter->SetParameterRange("eff >= 0. && eff <=1.");
90 parameter->SetDefaultValue(1.);
91 layerEff->SetParameter(parameter);
92}
93
95{
96 delete noiseDirectory;
97 delete noiseFlag;
98 delete noiseType;
99 delete noiseLevel;
100 delete digiDirectory;
101 delete smearFlag;
102 delete mdcDRes;
103 delete effDirectory;
104 delete effFlag;
105 delete layerEff;
106}
107
108void BesMdcDigitizerMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
109{
110 if( command == noiseFlag) {
111 mdcDigitizer->SetNoiseFlag(noiseFlag->GetNewIntValue(newValue));
112 }else if(command==noiseType){
113 mdcDigitizer->SetNoiseType(noiseType->GetNewIntValue(newValue));
114 }else if(command==noiseLevel){
115 mdcDigitizer->SetNoiseLevel(noiseLevel->GetNewDoubleValue(newValue));
116 }else if(command==smearFlag){
117 mdcDigitizer->SetSmearFlag(smearFlag->GetNewIntValue(newValue));
118 }else if(command==mdcDRes){
119 mdcDigitizer->SetMdcDRes(mdcDRes->GetNewDoubleValue(newValue));
120 }else if(command==effFlag){
121 mdcDigitizer->SetEffFlag(effFlag->GetNewIntValue(newValue));
122 }else if(command==layerEff){
123 G4int layer;
124 G4double eff;
125 std::istringstream is ((char*)newValue.data());
126 is >> layer >> eff;
127 mdcDigitizer->SetEff(layer, eff);
128 }
129}
130
131
132
133
134
135
136
137
138
139
140
141
142
143
void SetNewValue(G4UIcommand *command, G4String newValues)
BesMdcDigitizerMessenger(BesMdcDigitizer *)
void SetMdcDRes(G4double res)
void SetNoiseType(G4int type)
void SetNoiseFlag(G4int flag)
void SetEffFlag(G4int flag)
void SetNoiseLevel(G4double level)
void SetSmearFlag(G4int flag)
void SetEff(G4int layer, G4double eff)