Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
exrdmMaterialMessenger Class Reference

#include <exrdmMaterialMessenger.hh>

Inheritance diagram for exrdmMaterialMessenger:
G4UImessenger

Public Member Functions

 exrdmMaterialMessenger (exrdmMaterial *)
 
virtual ~exrdmMaterialMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 48 of file exrdmMaterialMessenger.hh.

Constructor & Destructor Documentation

exrdmMaterialMessenger::exrdmMaterialMessenger ( exrdmMaterial exrdmMat)

Definition at line 42 of file exrdmMaterialMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, G4State_PreInit, G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIparameter::SetParameterRange(), and G4UIcommand::SetRange().

43  :G4UImessenger(),
44  fMaterialsManager(exrdmMat),
45  fMaterialDir(0),
46  fListCmd(0),
47  fDeleteIntCmd(0),
48  fDeleteNameCmd(0),
49  fAddCmd(0)
50 {
51  fMaterialDir = new G4UIdirectory("/geometry/material/");
52  fMaterialDir->SetGuidance(" Controls for defining geometry materials" );
53 
54  fAddCmd = new G4UIcommand("/geometry/material/add",this);
55  fAddCmd->SetGuidance(
56  " add a mateial by name, composition formula and density");
57  fAddCmd->SetGuidance(" name: e.g. water ");
58  fAddCmd->SetGuidance(" formula (e.g. H2-O for water");
59  fAddCmd->SetGuidance(" density (in units of g/cm3) : den>0.");
60  G4UIparameter* MatName = new G4UIparameter("material",'s',false);
61  MatName->SetGuidance("material name");
62  fAddCmd->SetParameter(MatName);
63  //
64  G4UIparameter* MatForm = new G4UIparameter("formula",'s',false);
65  MatForm->SetGuidance("material formula");
66  fAddCmd->SetParameter(MatForm);
67  //
68  G4UIparameter* DenPrm = new G4UIparameter("density",'d',false);
69  DenPrm->SetGuidance("density of the material");
70  DenPrm->SetParameterRange("density >0.");
71  fAddCmd->SetParameter(DenPrm);
73 
74  G4UIparameter* StatePrm = new G4UIparameter("state",'s',true);
75  StatePrm->SetGuidance("state of the material (optional): gas | solid");
76  fAddCmd->SetParameter(StatePrm);
78 
79  G4UIparameter* TempPrm = new G4UIparameter("temp",'d',true);
80  TempPrm->SetGuidance("temperature of the material in Kelvin (optional)");
81  fAddCmd->SetParameter(TempPrm);
83 
84  G4UIparameter* PresPrm = new G4UIparameter("pres",'d',true);
85  PresPrm->SetGuidance("pressure of the gas material in Pascal (optional)");
86  fAddCmd->SetParameter(PresPrm);
88  //
89  fDeleteIntCmd = new G4UIcmdWithAnInteger("/geometry/material/delete",this);
90  fDeleteIntCmd->SetGuidance("Delete material by its index");
91  fDeleteIntCmd->SetParameterName("matIdx",false);
92  fDeleteIntCmd->SetRange("matIdx>=0 && matIdx<100");
94 
95  fDeleteNameCmd = new G4UIcmdWithAString("/geometry/material/deleteName",this);
96  fDeleteNameCmd->SetGuidance("Delete material by its name.");
97  fDeleteNameCmd->SetParameterName("DeleteName",false);
99 
100  fListCmd = new G4UIcmdWithoutParameter("/geometry/material/list",this);
101  fListCmd->SetGuidance("List the materials defined");
103 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterRange(const char *theRange)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetGuidance(const char *theGuidance)
exrdmMaterialMessenger::~exrdmMaterialMessenger ( )
virtual

Definition at line 106 of file exrdmMaterialMessenger.cc.

107 {
108  delete fMaterialDir;
109  delete fAddCmd;
110  delete fDeleteIntCmd;
111  delete fDeleteNameCmd;
112  delete fListCmd;
113 }

Member Function Documentation

void exrdmMaterialMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 116 of file exrdmMaterialMessenger.cc.

References exrdmMaterial::AddMaterial(), python.hepunit::cm3, exrdmMaterial::DeleteMaterial(), g(), G4UIcmdWithAnInteger::GetNewIntValue(), exrdmMaterial::ListMaterial(), and eplot::material.

118 {
119  if (command == fDeleteIntCmd) {
120  fMaterialsManager->DeleteMaterial(fDeleteIntCmd->GetNewIntValue(newValue));
121 
122  } else if (command == fDeleteNameCmd) {
123  fMaterialsManager->DeleteMaterial(newValue);
124 
125  } else if (command == fListCmd) {
126  fMaterialsManager->ListMaterial();
127 
128  } else if (command == fAddCmd) {
129  G4double den, tem, pres ;
130  G4String state;
131  char mat[80], form[80], stat[10];
132  stat[0] = ' ';
133  tem = pres = -1.;
134  const char* t = newValue;
135  std::istringstream is(t);
136  is >>mat >>form >>den >>stat >> tem >> pres ;
137  G4String material=mat;
138  G4String formula=form;
139  if (pres == -1.) {
140  state = "";
141  } else {
142  state = stat;
143  }
144  // G4cout<< "stat = " <<state<< "tem = " << tem<< " pre = " << pres << G4endl;
145  // tick *= G4UIcommand::ValueOf(unt);
146  fMaterialsManager->AddMaterial(material,formula,den*g/cm3,state,tem,pres);
147  }
148 }
static G4int GetNewIntValue(const char *paramString)
void AddMaterial(G4String, G4String, G4double, G4String, G4double tem=CLHEP::STP_Temperature, G4double pres=CLHEP::STP_Pressure)
string material
Definition: eplot.py:19
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
void DeleteMaterial(G4int)
double G4double
Definition: G4Types.hh:76

The documentation for this class was generated from the following files: