Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:58

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 //GEANT4 - Depth-of-Interaction enabled Positron emission tomography (PET) advanced example 
0027 
0028                                     //Authors and contributors
0029 
0030 // Author list to be updated, with names of co-authors and contributors from National Institute of Radiological Sciences (NIRS)
0031 
0032 // Abdella M. Ahmed (1, 2), Andrew Chacon (1, 2), Harley Rutherford (1, 2),
0033 // Hideaki Tashima (3), Go Akamatsu (3), Akram Mohammadi (3), Eiji Yoshida (3), Taiga Yamaya (3)
0034 // Susanna Guatelli (2), and Mitra Safavi-Naeini (1, 2)
0035 
0036 // (1) Australian Nuclear Science and Technology Organisation, Australia
0037 // (2) University of Wollongong, Australia
0038 // (3) National Institute of Radiological Sciences, Japan
0039 
0040 #include "G4UIdirectory.hh"
0041 #include "G4UIcmdWithAnInteger.hh"
0042 #include "G4UIcmdWithADouble.hh"
0043 #include "G4UIcmdWithAString.hh"
0044 #include "G4UIcmdWithoutParameter.hh"
0045 
0046 #include "doiPETDetectorConstruction.hh"
0047 #include "doiPETDetectorConstructionMessenger.hh"
0048 #include "G4UIcmdWithADoubleAndUnit.hh"
0049 
0050 #include "G4UIcmdWith3VectorAndUnit.hh"
0051 
0052 
0053 ////////// Constructor //////////////////////////////////////////////
0054 doiPETDetectorConstructionMessenger::doiPETDetectorConstructionMessenger(doiPETDetectorConstruction* det)
0055     :Detector (det)
0056 {
0057     Dir = new G4UIdirectory("/changePhantom/");
0058     Dir->SetGuidance("Choose the phantom");
0059 
0060     ChoosePhantomCmd = new G4UIcmdWithAString("/changePhantom/setPhantom",this);
0061     ChoosePhantomCmd->SetGuidance("Select Phantom type");
0062     ChoosePhantomCmd->SetParameterName("choice",false);
0063     ChoosePhantomCmd->AvailableForStates(G4State_PreInit);
0064 
0065     // Change Phantom position
0066     changeThePhantomPositionCmd = new G4UIcmdWith3VectorAndUnit("/changePhantom/position", this);
0067     changeThePhantomPositionCmd -> SetGuidance("Insert X Y and Z dimensions for the position of the center of the Phantom" " respect to that of the \"World\""); 
0068     changeThePhantomPositionCmd -> SetParameterName("PositionAlongX", "PositionAlongY", "PositionAlongZ", false);
0069     changeThePhantomPositionCmd -> SetDefaultUnit("mm");
0070     changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m"); 
0071     changeThePhantomPositionCmd -> AvailableForStates(G4State_PreInit);
0072 
0073     //Change Phantom Length and Radius
0074     changePhantomRadiusCmd = new G4UIcmdWithADoubleAndUnit("/changePhantom/Radius",this);
0075     changePhantomRadiusCmd->SetGuidance("Set radius of the phantom");
0076     changePhantomRadiusCmd->SetParameterName("radius",false);
0077     changePhantomRadiusCmd->SetUnitCategory("Length");
0078     changePhantomRadiusCmd->SetRange("radius>0");
0079     changePhantomRadiusCmd->AvailableForStates(G4State_PreInit);
0080 
0081     //Change the length of the phantom 
0082     changePhantomLengthCmd = new G4UIcmdWithADoubleAndUnit("/changePhantom/Length",this);
0083     changePhantomLengthCmd->SetGuidance("Set length of the phantom");
0084     changePhantomLengthCmd->SetParameterName("length",false);
0085     changePhantomLengthCmd->SetUnitCategory("Length");
0086     changePhantomLengthCmd->SetRange("length>0");
0087     changePhantomLengthCmd->AvailableForStates(G4State_PreInit);
0088 
0089     //Change the number of sleeves to be placed
0090     changeNumOfSleevesCmd = new G4UIcmdWithAnInteger("/changePhantom/NumberOfSleeves",this);
0091     changeNumOfSleevesCmd->SetParameterName("choice",false);
0092     changeNumOfSleevesCmd->AvailableForStates(G4State_PreInit);
0093 
0094 
0095 }
0096 
0097 ////////// Destructor //////////////////////////////////////////////
0098 doiPETDetectorConstructionMessenger::~doiPETDetectorConstructionMessenger()
0099 {   
0100     delete Dir;
0101     delete ChoosePhantomCmd;
0102         
0103     delete changeThePhantomPositionCmd;
0104     delete changePhantomRadiusCmd;
0105     delete changePhantomLengthCmd;
0106     delete changeNumOfSleevesCmd;
0107 
0108 
0109 }
0110 
0111 ////////// SetNewValue /////////////////////////////////////////////
0112 void doiPETDetectorConstructionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0113 {
0114     if ( command == ChoosePhantomCmd ) Detector->ChangePhantom(newValue);
0115     else if (command == changeThePhantomPositionCmd )
0116     {
0117         G4ThreeVector size = changeThePhantomPositionCmd -> GetNew3VectorValue(newValue);
0118         Detector -> SetPhantomPosition(size);
0119     }
0120     else if (command == changePhantomRadiusCmd)
0121     {
0122         Detector->SetPhantomRadius(changePhantomRadiusCmd->GetNewDoubleValue(newValue));
0123     }
0124     else if (command == changePhantomLengthCmd)
0125     {
0126         Detector->SetPhantomLength(changePhantomLengthCmd->GetNewDoubleValue(newValue));
0127     }
0128     else if (command == changeNumOfSleevesCmd)
0129     {
0130         Detector->SetNumberOfSleeves(changeNumOfSleevesCmd->GetNewIntValue(newValue));
0131     }
0132 }
0133 
0134