Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/eFLASH_radiotherapy/src/FlashDetectorMessenger.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //////////////////////////////////////////////////////////////////////////////////////////////
0028 
0029 #include "FlashDetectorMessenger.hh"
0030 #include "FlashDetectorConstruction.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWith3VectorAndUnit.hh"
0033 #include "G4UIcmdWithoutParameter.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"  
0036 #include "G4UIcmdWithABool.hh"
0037 
0038 #include "G4SystemOfUnits.hh"
0039 
0040 /////////////////////////////////////////////////////////////////////////////
0041 FlashDetectorMessenger::FlashDetectorMessenger(FlashDetectorConstruction* detector)
0042   :flashDetector(detector)
0043 {
0044     // fChange Phantom size
0045     fChangeThePhantomDir = new G4UIdirectory("/fChangePhantom/");
0046     fChangeThePhantomDir -> SetGuidance("Command to fChange the Phantom Size/position");
0047 
0048      // fChange Phantom material 
0049     fChangeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
0050     fChangeThePhantomMaterialCmd -> SetGuidance("fChange the Phantom and the detector material"); 
0051     fChangeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
0052     fChangeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
0053     fChangeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
0054 
0055     // fChange Detector size
0056     fChangeTheDetectorDir = new G4UIdirectory("/changeDetector/");
0057     fChangeTheDetectorDir -> SetGuidance("Command to fChange the Detector Size");
0058 
0059     // fChange Detector material 
0060     fChangeTheDetectorMaterialCmd = new G4UIcmdWithAString("/changeDetector/material", this);
0061     fChangeTheDetectorMaterialCmd  -> SetGuidance("fChange the Phantom and the detector material"); 
0062     fChangeTheDetectorMaterialCmd  -> SetParameterName("PhantomMaterial", false);
0063     fChangeTheDetectorMaterialCmd  -> AvailableForStates(G4State_Idle);
0064 
0065 
0066     fUpdateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
0067     fUpdateCmd->SetGuidance("Update Phantom/Detector geometry.");
0068     fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0069     fUpdateCmd->SetGuidance("if you fChanged geometrical value(s).");
0070     fUpdateCmd->AvailableForStates(G4State_Idle);
0071 
0072     fUpdateCmd_d = new G4UIcmdWithoutParameter("/changeDetector/update",this);
0073     fUpdateCmd_d->SetGuidance("Update Detector geometry.");
0074     fUpdateCmd_d->SetGuidance("This command MUST be applied before \"beamOn\" ");
0075     fUpdateCmd_d->SetGuidance("if you fChanged geometrical value(s).");
0076     fUpdateCmd_d->AvailableForStates(G4State_Idle);
0077 
0078     fActivateDetArrayCmd = new G4UIcmdWithABool("/changeDetector/activateArray", this);
0079     fActivateDetArrayCmd -> SetParameterName("true/false", true);
0080     fActivateDetArrayCmd -> SetGuidance("Activate detector array.");
0081     fActivateDetArrayCmd -> SetGuidance("This command must be applied before /run/initialize");
0082     fActivateDetArrayCmd -> AvailableForStates(G4State_PreInit);
0083    }
0084 
0085 /////////////////////////////////////////////////////////////////////////////
0086 FlashDetectorMessenger::~FlashDetectorMessenger()
0087 {
0088 
0089 
0090   delete fChangeThePhantomDir;
0091     delete fChangeTheDetectorDir;
0092   
0093     delete fChangeThePhantomMaterialCmd;
0094     delete fChangeTheDetectorMaterialCmd; 
0095 
0096     delete fActivateDetArrayCmd;
0097     
0098 }
0099 
0100 /////////////////////////////////////////////////////////////////////////////
0101 void FlashDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0102 {
0103     
0104  
0105   if (command == fChangeThePhantomMaterialCmd)
0106   {
0107       flashDetector -> SetPhantomMaterial(newValue);
0108   }
0109 
0110     else if (command == fChangeTheDetectorMaterialCmd)
0111   {
0112       flashDetector -> SetDetectorMaterial(newValue);
0113   }
0114 
0115   else if (command == fActivateDetArrayCmd){
0116     G4bool fbool = fActivateDetArrayCmd -> GetNewBoolValue(newValue);
0117     flashDetector -> ActivateDetArray(fbool);
0118   }
0119   
0120 }