source: trunk/examples/advanced/medical_linac/src/MedLinacPhantomMessenger.cc @ 1282

Last change on this file since 1282 was 807, checked in by garnier, 16 years ago

update

File size: 3.6 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//
27// $Id: MedLinacPhantomMessenger.cc,v 1.2 2006/06/29 16:04:33 gunter Exp $
28//
29//  Code developed by: M. Piergentili
30
31#include "MedLinacPhantomMessenger.hh"
32#include "MedLinacPhantomSD.hh"
33#include "G4UIdirectory.hh"
34#include "G4UIcmdWithAString.hh"
35#include "G4UIcmdWithAnInteger.hh"
36#include "G4UIcmdWithADoubleAndUnit.hh"
37#include "G4UIcmdWithoutParameter.hh"
38
39//*********************************************************************
40
41MedLinacPhantomMessenger::MedLinacPhantomMessenger(
42                                           MedLinacPhantomSD* MedLinacPhantom)
43  :MedLinacP(MedLinacPhantom)
44{ 
45
46   
47  MedLinacDir = new G4UIdirectory("/PhantomSD/");
48  MedLinacDir->SetGuidance("phantom parameters in sensitive detector");
49
50  PhantomDimCmd = new G4UIcmdWithADoubleAndUnit("/PhantomSD/dimension",this);
51  PhantomDimCmd->SetGuidance("Set phantom dimension (cm)");
52  PhantomDimCmd->SetParameterName("phantomDim",false);
53  PhantomDimCmd->SetDefaultUnit( "cm" );
54  PhantomDimCmd->SetUnitCategory("Length");
55  PhantomDimCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
56
57  NVoxelsCmd = new G4UIcmdWithAnInteger("/PhantomSD/Nvoxels",this);
58  NVoxelsCmd->SetGuidance("Set number of voxels along one axis");
59  NVoxelsCmd->SetParameterName("numberOfVoxels",false);
60  NVoxelsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
61
62
63}
64
65//****************************************************************************
66MedLinacPhantomMessenger::~MedLinacPhantomMessenger()
67{
68  delete PhantomDimCmd;
69  delete NVoxelsCmd;
70
71  delete MedLinacDir;
72 
73}
74
75//****************************************************************************
76
77void MedLinacPhantomMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
78{ 
79
80  if( command == PhantomDimCmd )
81   { MedLinacP->SetPhantomDimension(PhantomDimCmd->GetNewDoubleValue(newValue));}
82
83  if( command == NVoxelsCmd )
84   { MedLinacP->SetNumberOfPhantomVoxels(NVoxelsCmd->GetNewIntValue(newValue));  }
85
86}
87//****************************************************************************
Note: See TracBrowser for help on using the repository browser.