MollerTargetMessenger.cc

Go to the documentation of this file.
00001 /**
00002  
00003    \file MollerTargetMessenger.cc
00004    \date Tue Mar 13 03:39:45 EDT 2012
00005    \author Peiqing Wang
00006 
00007 */
00008 
00009 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00010 
00011 #include "MollerTargetMessenger.hh"
00012 
00013 // user includes
00014 #include "MollerTarget.hh"
00015 
00016 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00017 
00018 MollerTargetMessenger::MollerTargetMessenger(MollerTarget* myTar)
00019 :myTarget(myTar)
00020 { 
00021   TargetDir = new G4UIdirectory("/moller/target/");
00022   TargetDir -> SetGuidance("target control.");
00023        
00024   TargZPosCmd =  new G4UIcmdWithADoubleAndUnit("/moller/target/setCenterPositionInZ",this);
00025   TargZPosCmd->SetGuidance("Set the Z position of the target center"); 
00026   TargZPosCmd->SetParameterName("Size",true);
00027   //TargZPosCmd->SetRange("Size>=0.");
00028   TargZPosCmd->SetUnitCategory("Length");
00029   TargZPosCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00030 
00031   TargMatCmd = new G4UIcmdWithAString("/moller/target/setTargetMaterial",this);
00032   TargMatCmd->SetGuidance("Select Material of the Target.");
00033   TargMatCmd->SetParameterName("choice",false);
00034   TargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00035 
00036   TargCellMatCmd = new G4UIcmdWithAString("/moller/target/setTargetCellMaterial",this);
00037   TargCellMatCmd->SetGuidance("Select Material of the Target Cell.");
00038   TargCellMatCmd->SetParameterName("choice",false);
00039   TargCellMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00040   
00041   TargLengthCmd = new G4UIcmdWithADoubleAndUnit("/moller/target/setTargetLength",this);
00042   TargLengthCmd->SetGuidance("Set the Target Length.");
00043   TargLengthCmd->SetParameterName("fTargetLength",true, true);
00044   TargLengthCmd->SetDefaultValue(150.);
00045   TargLengthCmd->SetUnitCategory("Length");
00046   TargLengthCmd->SetDefaultUnit("cm");
00047   TargLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00048 }
00049 
00050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00051 
00052 MollerTargetMessenger::~MollerTargetMessenger()
00053 {
00054   delete TargZPosCmd;
00055   delete TargMatCmd;
00056   delete TargCellMatCmd;
00057   delete TargetDir;
00058 }
00059 
00060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00061 
00062 void MollerTargetMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
00063 { 
00064   G4cout << "#### Calling MollerTargetMessenger::SetNewValue() " << newValue << G4endl;
00065 
00066   if( command == TargZPosCmd )
00067    {
00068      G4cout << "#### Messenger: Setting Target Z position to " << newValue << G4endl;
00069      myTarget->SetTargetCenterPositionInZ(TargZPosCmd->GetNewDoubleValue(newValue));
00070    }
00071 
00072   if( command == TargMatCmd )
00073   { 
00074       G4cout << "#### Messenger: Setting Target Material to " << newValue << G4endl;
00075       myTarget->SetTargetMaterial(newValue);
00076   }
00077 
00078   
00079   if( command == TargCellMatCmd )
00080   { 
00081      G4cout << "#### Messenger: Setting Target Cell Material to " << newValue << G4endl;     
00082      myTarget->SetTargetCellMaterial(newValue);
00083   }
00084 
00085   if (command == TargLengthCmd)
00086     { 
00087       G4cout << "#### Messenger: Setting Target Length to " << newValue << G4endl;   
00088       myTarget->SetTargetLength(TargLengthCmd->GetNewDoubleValue(newValue)); }
00089     
00090   G4cout << "#### Leaving MollerTargetMessenger::SetNewValue() " << newValue << G4endl;
00091 }
00092 
00093 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
00094 

Generated on 16 Jun 2013 for mollersim by  doxygen 1.6.1