G4MatScanMessenger Class Reference

#include <G4MatScanMessenger.hh>

Inheritance diagram for G4MatScanMessenger:

G4UImessenger

Public Member Functions

 G4MatScanMessenger (G4MaterialScanner *p1)
virtual ~G4MatScanMessenger ()
virtual G4String GetCurrentValue (G4UIcommand *command)
virtual void SetNewValue (G4UIcommand *command, G4String newValue)

Detailed Description

Definition at line 48 of file G4MatScanMessenger.hh.


Constructor & Destructor Documentation

G4MatScanMessenger::G4MatScanMessenger ( G4MaterialScanner p1  ) 

Definition at line 47 of file G4MatScanMessenger.cc.

References G4UIcommand::AvailableForStates(), G4UIcommand::CategoryOf(), G4State_Idle, G4UIcmdWith3VectorAndUnit::SetDefaultUnit(), G4UIcmdWithAString::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWith3VectorAndUnit::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIparameter::SetParameterCandidates(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithABool::SetParameterName(), G4UIcmdWith3VectorAndUnit::SetParameterName(), G4UIcmdWith3Vector::SetParameterName(), G4UIparameter::SetParameterRange(), and G4UIcommand::UnitsList().

00048 {
00049   theScanner = p1;
00050   G4UIparameter* par;
00051   msDirectory = new G4UIdirectory("/control/matScan/");
00052   msDirectory->SetGuidance("Material scanner commands.");
00053 
00054   scanCmd = new G4UIcmdWithoutParameter("/control/matScan/scan",this);
00055   scanCmd->SetGuidance("Start material scanning.");
00056   scanCmd->SetGuidance("Scanning range should be defined with");
00057   scanCmd->SetGuidance("/control/matScan/theta and /control/matSca/phi commands.");
00058   scanCmd->AvailableForStates(G4State_Idle);
00059 
00060   thetaCmd = new G4UIcommand("/control/matScan/theta",this);
00061   thetaCmd->SetGuidance("Define theta range.");
00062   thetaCmd->SetGuidance("Usage : /control/matScan/theta [nbin] [thetaMin] [thetaSpan] [unit]");
00063   thetaCmd->SetGuidance("Notation of angles :");
00064   thetaCmd->SetGuidance(" theta --- +Z axis : +90 deg. / X-Y plane : 0 deg. / -Z axis : -90 deg.");
00065   par = new G4UIparameter("nbin",'i',false);
00066   par->SetParameterRange("nbin>0");
00067   thetaCmd->SetParameter(par);
00068   par = new G4UIparameter("thetaMin",'d',false);
00069   thetaCmd->SetParameter(par);
00070   par = new G4UIparameter("thetaSpan",'d',true);
00071   par->SetParameterRange("thetaSpan>=0.");
00072   par->SetDefaultValue(0.);
00073   thetaCmd->SetParameter(par);
00074   par = new G4UIparameter("unit",'c',true);
00075   par->SetDefaultValue("deg");
00076   par->SetParameterCandidates(thetaCmd->UnitsList(thetaCmd->CategoryOf("deg")));
00077   thetaCmd->SetParameter(par);
00078 
00079   phiCmd = new G4UIcommand("/control/matScan/phi",this);
00080   phiCmd->SetGuidance("Define phi range.");
00081   phiCmd->SetGuidance("Usage : /control/matScan/phi [nbin] [phiMin] [phiSpan] [unit]");
00082   phiCmd->SetGuidance("Notation of angles :");
00083   phiCmd->SetGuidance(" phi   --- +X axis : 0 deg. / +Y axis : 90 deg. / -X axis : 180 deg. / -Y axis : 270 deg.");
00084   par = new G4UIparameter("nbin",'i',false);
00085   par->SetParameterRange("nbin>0");
00086   phiCmd->SetParameter(par);
00087   par = new G4UIparameter("phiMin",'d',false);
00088   phiCmd->SetParameter(par);
00089   par = new G4UIparameter("phiSpan",'d',true);
00090   par->SetParameterRange("phiSpan>=0.");
00091   par->SetDefaultValue(0.);
00092   phiCmd->SetParameter(par);
00093   par = new G4UIparameter("unit",'c',true);
00094   par->SetDefaultValue("deg");
00095   par->SetParameterCandidates(phiCmd->UnitsList(phiCmd->CategoryOf("deg")));
00096   phiCmd->SetParameter(par);
00097 
00098   singleCmd = new G4UIcommand("/control/matScan/singleMeasure",this);
00099   singleCmd->SetGuidance("Measure thickness for one particular direction.");
00100   singleCmd->SetGuidance("Notation of angles :");
00101   singleCmd->SetGuidance(" theta --- +Z axis : +90 deg. / X-Y plane : 0 deg. / -Z axis : -90 deg.");
00102   singleCmd->SetGuidance(" phi   --- +X axis : 0 deg. / +Y axis : 90 deg. / -X axis : 180 deg. / -Y axis : 270 deg.");
00103   singleCmd->AvailableForStates(G4State_Idle);
00104   par = new G4UIparameter("theta",'d',false);
00105   singleCmd->SetParameter(par);
00106   par = new G4UIparameter("phi",'d',false);
00107   singleCmd->SetParameter(par);
00108   par = new G4UIparameter("unit",'c',true);
00109   par->SetDefaultValue("deg");
00110   par->SetParameterCandidates(singleCmd->UnitsList(singleCmd->CategoryOf("deg")));
00111   singleCmd->SetParameter(par);
00112 
00113   single2Cmd = new G4UIcmdWith3Vector("/control/matScan/singleTo",this);
00114   single2Cmd->SetGuidance("Measure thicknesss for one direction defined by a unit vector.");
00115   single2Cmd->SetParameterName("X","Y","Z",false);
00116 
00117   eyePosCmd = new G4UIcmdWith3VectorAndUnit("/control/matScan/eyePosition",this);
00118   eyePosCmd->SetGuidance("Define the eye position.");
00119   eyePosCmd->SetParameterName("X","Y","Z",true);
00120   eyePosCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
00121   eyePosCmd->SetDefaultUnit("m");
00122 
00123   regSenseCmd = new G4UIcmdWithABool("/control/matScan/regionSensitive",this);
00124   regSenseCmd->SetGuidance("Set region sensitivity.");
00125   regSenseCmd->SetGuidance("This command is automatically set to TRUE");
00126   regSenseCmd->SetGuidance(" if /control/matScan/region command is issued.");
00127   regSenseCmd->SetParameterName("senseFlag",true);
00128   regSenseCmd->SetDefaultValue(false);
00129 
00130   regionCmd = new G4UIcmdWithAString("/control/matScan/region",this);
00131   regionCmd->SetGuidance("Define region name to be scanned.");
00132   regionCmd->SetGuidance("/control/matScan/regionSensitive command is automatically");
00133   regionCmd->SetGuidance("set to TRUE with this command.");
00134   regionCmd->SetParameterName("region",true);
00135   regionCmd->SetDefaultValue("DefaultRegionForTheWorld");
00136 }

G4MatScanMessenger::~G4MatScanMessenger (  )  [virtual]

Definition at line 138 of file G4MatScanMessenger.cc.

00139 {
00140   delete scanCmd;
00141   delete thetaCmd;
00142   delete phiCmd;
00143   delete singleCmd;
00144   delete single2Cmd;
00145   delete eyePosCmd;
00146   delete regSenseCmd;
00147   delete regionCmd;
00148   delete msDirectory;
00149 }


Member Function Documentation

G4String G4MatScanMessenger::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 151 of file G4MatScanMessenger.cc.

References G4UIcommand::ConvertToString(), G4MaterialScanner::GetEyePosition(), G4MaterialScanner::GetNPhi(), G4MaterialScanner::GetNTheta(), G4MaterialScanner::GetPhiMin(), G4MaterialScanner::GetPhiSpan(), G4MaterialScanner::GetRegionName(), G4MaterialScanner::GetRegionSensitive(), G4MaterialScanner::GetThetaMin(), and G4MaterialScanner::GetThetaSpan().

00152 {
00153   G4String currentValue;
00154   if(command==thetaCmd)
00155   {
00156    currentValue = thetaCmd->ConvertToString(theScanner->GetNTheta());
00157    currentValue += " ";
00158    currentValue += thetaCmd->ConvertToString((theScanner->GetThetaMin())/deg);
00159    currentValue += " ";
00160    currentValue += thetaCmd->ConvertToString((theScanner->GetThetaSpan())/deg);
00161   }
00162   else if(command==phiCmd)
00163   {
00164    currentValue = phiCmd->ConvertToString(theScanner->GetNPhi());
00165    currentValue += " ";
00166    currentValue += phiCmd->ConvertToString((theScanner->GetPhiMin())/deg);
00167    currentValue += " ";
00168    currentValue += phiCmd->ConvertToString((theScanner->GetPhiSpan())/deg);
00169   }
00170   else if(command==eyePosCmd)
00171   { currentValue = eyePosCmd->ConvertToString(theScanner->GetEyePosition(),"m"); }
00172   else if(command==regSenseCmd)
00173   { currentValue = regSenseCmd->ConvertToString(theScanner->GetRegionSensitive()); }
00174   else if(command==regionCmd)
00175   { currentValue = theScanner->GetRegionName(); }
00176   return currentValue;
00177 }

void G4MatScanMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 179 of file G4MatScanMessenger.cc.

References G4UIcmdWith3Vector::GetNew3VectorValue(), G4UIcmdWith3VectorAndUnit::GetNew3VectorValue(), G4UIcmdWithABool::GetNewBoolValue(), G4MaterialScanner::GetNPhi(), G4MaterialScanner::GetNTheta(), G4MaterialScanner::GetPhiMin(), G4MaterialScanner::GetPhiSpan(), G4MaterialScanner::GetThetaMin(), G4MaterialScanner::GetThetaSpan(), G4MaterialScanner::Scan(), G4MaterialScanner::SetEyePosition(), G4MaterialScanner::SetNPhi(), G4MaterialScanner::SetNTheta(), G4MaterialScanner::SetPhiMin(), G4MaterialScanner::SetPhiSpan(), G4MaterialScanner::SetRegionName(), G4MaterialScanner::SetRegionSensitive(), G4MaterialScanner::SetThetaMin(), G4MaterialScanner::SetThetaSpan(), G4UImessenger::StoD(), G4UImessenger::StoI(), and G4UIcommand::ValueOf().

00180 {
00181   if(command==scanCmd)
00182   { theScanner->Scan(); }
00183   else if(command==thetaCmd)
00184   {
00185     G4Tokenizer next( newValue );
00186     G4int nbin = StoI(next());
00187     G4double thetaMin = StoD(next());
00188     G4double thetaSpan = StoD(next());
00189     G4String unit = next();
00190     thetaMin *= thetaCmd->ValueOf(unit);
00191     thetaSpan *= thetaCmd->ValueOf(unit);
00192     theScanner->SetNTheta(nbin);
00193     theScanner->SetThetaMin(thetaMin);
00194     theScanner->SetThetaSpan(thetaSpan);
00195   }
00196   else if(command==phiCmd)
00197   {
00198     G4Tokenizer next( newValue );
00199     G4int nbin = StoI(next());
00200     G4double phiMin = StoD(next());
00201     G4double phiSpan = StoD(next());
00202     G4String unit = next();
00203     phiMin *= phiCmd->ValueOf(unit);
00204     phiSpan *= phiCmd->ValueOf(unit);
00205     theScanner->SetNPhi(nbin);
00206     theScanner->SetPhiMin(phiMin);
00207     theScanner->SetPhiSpan(phiSpan);
00208   }
00209   else if(command==eyePosCmd)
00210   { theScanner->SetEyePosition(eyePosCmd->GetNew3VectorValue(newValue)); }
00211   else if(command==regSenseCmd)
00212   { theScanner->SetRegionSensitive(regSenseCmd->GetNewBoolValue(newValue)); }
00213   else if(command==regionCmd)
00214   { if(theScanner->SetRegionName(newValue)) theScanner->SetRegionSensitive(true); }
00215   else if(command==singleCmd || command==single2Cmd)
00216   {
00217     G4int ntheta = theScanner->GetNTheta();
00218     G4double thetaMin = theScanner->GetThetaMin();
00219     G4double thetaSpan = theScanner->GetThetaSpan();
00220     G4int nphi = theScanner->GetNPhi();
00221     G4double phiMin = theScanner->GetPhiMin();
00222     G4double phiSpan = theScanner->GetPhiSpan();
00223 
00224     G4double theta = 0.;
00225     G4double phi = 0.;
00226     if(command==singleCmd)
00227     {
00228       G4Tokenizer next( newValue );
00229       theta = StoD(next());
00230       phi = StoD(next());
00231       G4String unit = next();
00232       theta *= singleCmd->ValueOf(unit);
00233       phi *= singleCmd->ValueOf(unit);
00234     }
00235     else if(command==single2Cmd)
00236     {
00237       G4ThreeVector v = single2Cmd->GetNew3VectorValue(newValue);
00238       theta = 90.*deg - v.theta();
00239       phi = v.phi();
00240     }
00241     theScanner->SetNTheta(1);
00242     theScanner->SetThetaMin(theta);
00243     theScanner->SetThetaSpan(0.);
00244     theScanner->SetNPhi(1);
00245     theScanner->SetPhiMin(phi);
00246     theScanner->SetPhiSpan(0.);
00247     theScanner->Scan();
00248 
00249     theScanner->SetNTheta(ntheta);
00250     theScanner->SetThetaMin(thetaMin);
00251     theScanner->SetThetaSpan(thetaSpan);
00252     theScanner->SetNPhi(nphi);
00253     theScanner->SetPhiMin(phiMin);
00254     theScanner->SetPhiSpan(phiSpan);
00255   }
00256 
00257 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:28 2013 for Geant4 by  doxygen 1.4.7