Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/dna/cellularPhantom/src/DetectorMessenger.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 //       MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
0028 //
0029 // Authors and contributors:
0030 // P. Barberet (a), S. Incerti (a), N. H. Tran (a), L. Morelli (a,b)
0031 //
0032 // a) University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
0033 // b) Politecnico di Milano, Italy
0034 //
0035 // If you use this code, please cite the following publication:
0036 // P. Barberet et al.,
0037 // "Monte-Carlo dosimetry on a realistic cell monolayer
0038 // geometry exposed to alpha particles."
0039 // Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
0040 // doi: 110.1088/0031-9155/57/8/2189
0041 // -----------------------------------------------------------------------------
0042 
0043 #include "DetectorMessenger.hh"
0044 #include "DetectorConstruction.hh"
0045 
0046 #include "G4UIcmdWithAString.hh"
0047 #include "G4UIcmdWithADoubleAndUnit.hh"
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 DetectorMessenger::DetectorMessenger(DetectorConstruction * det)
0052 :G4UImessenger(), fDetector(det)
0053 {
0054   fPhantomDir = new G4UIdirectory("/phantom/");
0055   fPhantomDir->SetGuidance(" Cell phantom settings");
0056 
0057   fNameCmd = new G4UIcmdWithAString("/phantom/fileName",this);
0058   fNameCmd->SetGuidance("Select phantom file name");
0059   fNameCmd->SetParameterName("fileName",true);
0060   fNameCmd->SetDefaultValue("phantom.dat");
0061   fNameCmd->AvailableForStates(G4State_PreInit);
0062 
0063   fMatCmd = new G4UIcmdWithAString("/phantom/mediumMat",this);
0064   fMatCmd->SetGuidance("Select material for the phantom medium");
0065   fMatCmd->SetParameterName("mediumMat",true);
0066   fMatCmd->AvailableForStates(G4State_PreInit);
0067 
0068   fDenRedCmd = new G4UIcmdWithADoubleAndUnit("/phantom/redDen",this);
0069   fDenRedCmd->SetGuidance("Select density for the red volume");
0070   fDenRedCmd->SetParameterName("redDen",true);
0071   fDenRedCmd->SetDefaultValue(1.);
0072   fDenRedCmd->SetDefaultUnit("g/cm3");
0073   fDenRedCmd->AvailableForStates(G4State_PreInit);
0074 
0075   fDenGreenCmd = new G4UIcmdWithADoubleAndUnit("/phantom/greenDen",this);
0076   fDenGreenCmd->SetGuidance("Select density for the green volume");
0077   fDenGreenCmd->SetParameterName("greenDen",true);
0078   fDenGreenCmd->SetDefaultValue(1.);
0079   fDenGreenCmd->SetDefaultUnit("g/cm3");
0080   fDenGreenCmd->AvailableForStates(G4State_PreInit);
0081 
0082   fDenBlueCmd = new G4UIcmdWithADoubleAndUnit("/phantom/blueDen",this);
0083   fDenBlueCmd->SetGuidance("Select density for the blue volume");
0084   fDenBlueCmd->SetParameterName("blueDen",true);
0085   fDenBlueCmd->SetDefaultValue(1.);
0086   fDenBlueCmd->SetDefaultUnit("g/cm3");
0087   fDenBlueCmd->AvailableForStates(G4State_PreInit);
0088 
0089   fShiftXCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftX",this);
0090   fShiftXCmd->SetGuidance("Set phantom X shift");
0091   fShiftXCmd->SetParameterName("shiftX",true);
0092   fShiftXCmd->SetDefaultValue(0.);
0093   fShiftXCmd->SetDefaultUnit("um");
0094   fShiftXCmd->AvailableForStates(G4State_PreInit);
0095 
0096   fShiftYCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftY",this);
0097   fShiftYCmd->SetGuidance("Set phantom Y shift");
0098   fShiftYCmd->SetParameterName("shiftY",true);
0099   fShiftYCmd->SetDefaultValue(0.);
0100   fShiftYCmd->SetDefaultUnit("um");
0101   fShiftYCmd->AvailableForStates(G4State_PreInit);
0102 
0103   fShiftZCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftZ",this);
0104   fShiftZCmd->SetGuidance("Set phantom Z shift");
0105   fShiftZCmd->SetParameterName("shiftZ",true);
0106   fShiftZCmd->SetDefaultValue(0.);
0107   fShiftZCmd->SetDefaultUnit("um");
0108   fShiftZCmd->AvailableForStates(G4State_PreInit);
0109 
0110   fMediumSizeXYCmd = new G4UIcmdWithADoubleAndUnit("/phantom/mediumSizeXY",this);
0111   fMediumSizeXYCmd->SetGuidance("Set cellular medium size XY");
0112   fMediumSizeXYCmd->SetParameterName("mediumSizeXY",false);
0113   fMediumSizeXYCmd->SetDefaultUnit("um");
0114   fMediumSizeXYCmd->AvailableForStates(G4State_PreInit);
0115 
0116   fMediumSizeZCmd = new G4UIcmdWithADoubleAndUnit("/phantom/mediumSizeZ",this);
0117   fMediumSizeZCmd->SetGuidance("Set cellular medium size Z");
0118   fMediumSizeZCmd->SetParameterName("mediumSizeZ",false);
0119   fMediumSizeZCmd->SetDefaultUnit("um");
0120   fMediumSizeZCmd->AvailableForStates(G4State_PreInit);
0121 
0122   fWorldDir = new G4UIdirectory("/world/");
0123   fWorldDir->SetGuidance(" World volume settings");
0124 
0125   fWorldSizeXYCmd = new G4UIcmdWithADoubleAndUnit("/world/sizeXY",this);
0126   fWorldSizeXYCmd->SetGuidance("Set world size XY");
0127   fWorldSizeXYCmd->SetParameterName("sizeXY",false);
0128   fWorldSizeXYCmd->SetDefaultUnit("um");
0129   fWorldSizeXYCmd->AvailableForStates(G4State_PreInit);
0130 
0131   fWorldSizeZCmd = new G4UIcmdWithADoubleAndUnit("/world/sizeZ",this);
0132   fWorldSizeZCmd->SetGuidance("Set world size Z");
0133   fWorldSizeZCmd->SetParameterName("sizeZ",false);
0134   fWorldSizeZCmd->SetDefaultUnit("um");
0135   fWorldSizeZCmd->AvailableForStates(G4State_PreInit);
0136 }
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0139 
0140 DetectorMessenger::~DetectorMessenger()
0141 {
0142   delete fWorldDir;
0143   delete fPhantomDir;
0144   delete fNameCmd;
0145   delete fMatCmd;
0146   delete fDenRedCmd;
0147   delete fDenGreenCmd;
0148   delete fDenBlueCmd;
0149   delete fShiftXCmd;
0150   delete fShiftYCmd;
0151   delete fShiftZCmd;
0152   delete fMediumSizeXYCmd;
0153   delete fMediumSizeZCmd;
0154   delete fWorldSizeXYCmd;
0155   delete fWorldSizeZCmd;
0156 }
0157 
0158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0159 
0160 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0161 {
0162   if( command == fMatCmd ) {
0163     fDetector->SetTargetMaterial(newValue);
0164   }
0165   else if(command == fDenRedCmd) {
0166     fDetector->SetRedDensity(fDenRedCmd->GetNewDoubleValue(newValue));
0167   }
0168   else if(command == fDenGreenCmd) {
0169     fDetector->SetGreenDensity(fDenGreenCmd->GetNewDoubleValue(newValue));
0170   }
0171   else if(command == fDenBlueCmd) {
0172     fDetector->SetBlueDensity(fDenBlueCmd->GetNewDoubleValue(newValue));
0173   }
0174   else if (command == fShiftXCmd) {
0175     fDetector->SetShiftX(fShiftXCmd->GetNewDoubleValue(newValue));
0176   }
0177   else if (command == fShiftYCmd) {
0178     fDetector->SetShiftY(fShiftYCmd->GetNewDoubleValue(newValue));
0179   }
0180   else if (command == fShiftZCmd) {
0181     fDetector->SetShiftZ(fShiftZCmd->GetNewDoubleValue(newValue));
0182   }
0183   else if (command == fMediumSizeXYCmd) {
0184     fDetector->SetMediumSizeXY(fMediumSizeXYCmd->GetNewDoubleValue(newValue));
0185   }
0186   else if (command == fMediumSizeZCmd) {
0187     fDetector->SetMediumSizeZ(fMediumSizeZCmd->GetNewDoubleValue(newValue));
0188   }
0189   else if (command == fWorldSizeXYCmd) {
0190     fDetector->SetWorldSizeXY(fWorldSizeXYCmd->GetNewDoubleValue(newValue));
0191   }
0192   else if (command == fWorldSizeZCmd) {
0193     fDetector->SetWorldSizeZ(fWorldSizeZCmd->GetNewDoubleValue(newValue));
0194   }
0195   else if(command == fNameCmd) {
0196     fDetector->SetPhantomFileName(newValue);
0197   }
0198 }