musPrimaryGeneratorMessenger.cc

Go to the documentation of this file.
00001 #include "musrPrimaryGeneratorMessenger.hh"
00002 
00003 #include "musrPrimaryGeneratorAction.hh"
00004 #include "G4UIcmdWithAString.hh"
00005 #include "G4UIcmdWithADoubleAndUnit.hh"
00006 #include "G4UIcmdWithADouble.hh"
00007 
00008 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00009 
00010 musrPrimaryGeneratorMessenger::musrPrimaryGeneratorMessenger(musrPrimaryGeneratorAction* musrGun)
00011 :musrAction(musrGun)
00012 { 
00013  
00014   setxvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/xvertex",this);
00015   setxvertexCmd->SetGuidance(" Set x coord. of the primary vertex.");
00016   setxvertexCmd->SetParameterName("xv",true);
00017   setxvertexCmd->SetDefaultValue(0.0*mm) ; 
00018   
00019   setyvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/yvertex",this);
00020   setyvertexCmd->SetGuidance(" Set y coord. of the primary vertex.");
00021   setyvertexCmd->SetParameterName("yv",true);
00022   setyvertexCmd->SetDefaultValue(0.0*mm) ; 
00023   
00024   setzvertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/zvertex",this);
00025   setzvertexCmd->SetGuidance(" Set z coord. of the primary vertex.");
00026   setzvertexCmd->SetParameterName("zv",true);
00027   setzvertexCmd->SetDefaultValue(0.0*m) ; 
00028 
00029   setpxanglevertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/pxanglevertex",this);
00030   setpxanglevertexCmd->SetGuidance(" Set px angle of the primary vertex.");
00031   setpxanglevertexCmd->SetParameterName("pxv",true);
00032   setpxanglevertexCmd->SetDefaultValue(0.0*mm) ; 
00033   
00034   setpyanglevertexCmd = new G4UIcmdWithADoubleAndUnit("/gun/pyanglevertex",this);
00035   setpyanglevertexCmd->SetGuidance(" Set py angle of the primary vertex.");
00036   setpyanglevertexCmd->SetParameterName("pyv",true);
00037   setpyanglevertexCmd->SetDefaultValue(0.0*mm) ; 
00038 
00039 
00040   setMomentumCmd = new G4UIcmdWithADouble("/gun/momentum",this);
00041   setMomentumCmd->SetGuidance(" Set magnitude of the momentum");
00042   setMomentumCmd->SetParameterName("p",true);
00043   setMomentumCmd->SetDefaultValue(0.0) ; 
00044 
00045   setBeamWidthCmd = new G4UIcmdWithADouble("/gun/beamwidth",this);
00046   setBeamWidthCmd->SetGuidance(" Set FWHM of the beam spot");
00047   setBeamWidthCmd->SetParameterName("w",true);
00048   setBeamWidthCmd->SetDefaultValue(40.*mm) ; 
00049   
00050 }
00051 
00052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00053 
00054 musrPrimaryGeneratorMessenger::~musrPrimaryGeneratorMessenger()
00055 {
00056   delete setxvertexCmd;
00057   delete setyvertexCmd;
00058   delete setzvertexCmd;
00059   delete setpxanglevertexCmd;
00060   delete setpyanglevertexCmd;
00061   delete setMomentumCmd;
00062   delete setBeamWidthCmd;
00063 }
00064 
00065 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00066 
00067 void musrPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
00068 { 
00069   if( command == setxvertexCmd)
00070    { musrAction->Setxvertex(setxvertexCmd->GetNewDoubleValue(newValue));}
00071   if( command == setyvertexCmd)
00072    { musrAction->Setyvertex(setyvertexCmd->GetNewDoubleValue(newValue));}
00073   if( command == setzvertexCmd)
00074    { musrAction->Setzvertex(setzvertexCmd->GetNewDoubleValue(newValue));}
00075   if( command == setpxanglevertexCmd)
00076    { musrAction->Setpxanglevertex(setpxanglevertexCmd->GetNewDoubleValue(newValue));}
00077   if( command == setpyanglevertexCmd)
00078    { musrAction->Setpyanglevertex(setpyanglevertexCmd->GetNewDoubleValue(newValue));}
00079   if( command == setMomentumCmd)
00080    { musrAction->SetMomentum(setMomentumCmd->GetNewDoubleValue(newValue));}
00081     if( command == setBeamWidthCmd)
00082      { musrAction->SetBeamWidth(setBeamWidthCmd->GetNewDoubleValue(newValue));}
00083 }
00084 
00085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
00086 

Generated on Mon Mar 27 12:19:54 2006 for MUSR by  doxygen 1.4.6