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

#include <ML2AcceleratorConstructionMessenger.hh>

Inheritance diagram for CML2AcceleratorConstructionMessenger:
G4UImessenger

Public Member Functions

 CML2AcceleratorConstructionMessenger (CML2AcceleratorConstruction *acceleratorConstructor)
 
 ~CML2AcceleratorConstructionMessenger (void)
 
void SetNewValue (G4UIcommand *cmd, G4String newValue)
 
void SetReferenceWorld (G4bool bOV)
 
- 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 62 of file ML2AcceleratorConstructionMessenger.hh.

Constructor & Destructor Documentation

CML2AcceleratorConstructionMessenger::CML2AcceleratorConstructionMessenger ( CML2AcceleratorConstruction acceleratorConstructor)

Definition at line 51 of file ML2AcceleratorConstructionMessenger.cc.

References python.hepunit::mm, CML2AcceleratorConstruction::setAcceleratorMacFileName(), CML2AcceleratorConstruction::setAcceleratorName(), G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), G4UIcmdWithAString::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcommand::SetGuidance(), CML2AcceleratorConstruction::setIsoCentre(), and CML2AcceleratorConstruction::setRotation90Y().

51  : pAcceleratorConstructor (acceleratorConstructor)
52 {
53  bOnlyVisio=false;
54  AcceleratorName=new G4UIcmdWithAString("/accelerator/AcceleratorName",this);
55  AcceleratorName->SetDefaultValue("acc1");
56  AcceleratorName->SetGuidance("accelerator name to select among those implemented (acc1)");
57  pAcceleratorConstructor->setAcceleratorName("acc1");
58 
59  acceleratorMacFileName=new G4UIcmdWithAString("/accelerator/AcceleratorMacFileName",this);
60  acceleratorMacFileName->SetDefaultValue("");
61  acceleratorMacFileName->SetGuidance("full path and macro file name containing specific setup data for the accelerator chosen");
62  pAcceleratorConstructor->setAcceleratorMacFileName("");
63 
64 
65  rotationX =new G4UIcmdWithADoubleAndUnit("/accelerator/rotationX", this);
66  rotationX ->SetDefaultUnit("deg");
67  rotationX ->SetDefaultValue(0.);
68  rotationX->SetGuidance("angles of rotation along X [deg]");
69 
70  isoCentre=new G4UIcmdWithADoubleAndUnit("/accelerator/isoCentre", this);
71  isoCentre->SetDefaultUnit("mm");
72  isoCentre->SetDefaultValue(1000.);
73  isoCentre->SetGuidance("distance between the isocentre and the target of the accelerator");
74  pAcceleratorConstructor->setIsoCentre(1000.*mm);
75 
76 
77  bRotate90Y =new G4UIcmdWithABool("/accelerator/rotation90Y", this);
78  bRotate90Y ->SetDefaultValue(false);
79  bRotate90Y->SetGuidance("to rotate the accelerator of 90 deg around the Y axis (true)");
80  pAcceleratorConstructor->setRotation90Y(false);
81 }
void SetDefaultValue(G4bool defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
CML2AcceleratorConstructionMessenger::~CML2AcceleratorConstructionMessenger ( void  )

Definition at line 83 of file ML2AcceleratorConstructionMessenger.cc.

84 {
85  delete AcceleratorName;
86  delete rotationX ;
87  delete acceleratorMacFileName;
88  delete isoCentre;
89  delete bRotate90Y;
90 }

Member Function Documentation

void CML2AcceleratorConstructionMessenger::SetNewValue ( G4UIcommand cmd,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 91 of file ML2AcceleratorConstructionMessenger.cc.

References CML2AcceleratorConstruction::addAcceleratorRotationsX(), G4UImanager::ApplyCommand(), CML2PhantomConstruction::GetInstance(), CML2PrimaryGenerationAction::GetInstance(), G4UIcmdWithABool::GetNewBoolValue(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithADoubleAndUnit::GetNewUnitValue(), G4UImanager::GetUIpointer(), CML2PhantomConstruction::resetSensDet(), CML2AcceleratorConstruction::rotateAccelerator(), CML2AcceleratorConstruction::setAcceleratorMacFileName(), CML2AcceleratorConstruction::setAcceleratorName(), CML2AcceleratorConstruction::setIsoCentre(), CML2PrimaryGenerationAction::setRotation(), and CML2AcceleratorConstruction::setRotation90Y().

92 {
93 
94  if (cmd==AcceleratorName)
95  {pAcceleratorConstructor->setAcceleratorName(newValue);}
96 
97  if (cmd==acceleratorMacFileName)
98  {pAcceleratorConstructor->setAcceleratorMacFileName(newValue);}
99 
100 
101  if (cmd==rotationX)
102  {
103  if (bOnlyVisio)
104  {
105  G4RotationMatrix *rm=pAcceleratorConstructor->rotateAccelerator(rotationX ->GetNewDoubleValue(newValue));
108 // what follows seems to be necessary to have a good refresh
110  G4String command;
111  command = "/run/beamOn 0";
112  UI->ApplyCommand(command);
113  command = "/vis/viewer/flush";
114  UI->ApplyCommand(command);
115  }
116  else
117  {
118  pAcceleratorConstructor->addAcceleratorRotationsX(rotationX ->GetNewDoubleValue(newValue));
119  }
120  }
121 
122  if (cmd==isoCentre)
123  {
124  isoCentre->GetNewUnitValue(newValue);
125  pAcceleratorConstructor->setIsoCentre(isoCentre->GetNewDoubleValue(newValue));
126  }
127  if (cmd==bRotate90Y)
128  {pAcceleratorConstructor->setRotation90Y(bRotate90Y->GetNewBoolValue(newValue));}
129 }
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void setRotation(G4RotationMatrix *val)
static CML2PrimaryGenerationAction * GetInstance(void)
static CML2PhantomConstruction * GetInstance(void)
static G4double GetNewUnitValue(const char *paramString)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
void CML2AcceleratorConstructionMessenger::SetReferenceWorld ( G4bool  bOV)
inline

Definition at line 68 of file ML2AcceleratorConstructionMessenger.hh.

Referenced by CML2AcceleratorConstruction::Construct().

68 {bOnlyVisio=bOV;}

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