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] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 //       MONTE CARLO SIMULATION OF REALISTIC GEOMETRY FROM MICROSCOPES IMAGES
 28 //
 29 // Authors and contributors:
 30 // P. Barberet, S. Incerti, N. H. Tran, L. Morelli
 31 //
 32 // University of Bordeaux, CNRS, LP2i, UMR5797, Gradignan, France
 33 //
 34 // If you use this code, please cite the following publication:
 35 // P. Barberet et al.,
 36 // "Monte-Carlo dosimetry on a realistic cell monolayer
 37 // geometry exposed to alpha particles."
 38 // Ph. Barberet et al 2012 Phys. Med. Biol. 57 2189
 39 // doi: 110.1088/0031-9155/57/8/2189
 40 // --------------------------------------------------------------------------------
 41 
 42 #include "DetectorMessenger.hh"
 43 #include "DetectorConstruction.hh"
 44 
 45 #include "G4UIcmdWithAString.hh"
 46 #include "G4UIcmdWithADoubleAndUnit.hh"
 47 
 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 49 
 50 DetectorMessenger::DetectorMessenger(DetectorConstruction * det)
 51 :G4UImessenger(), fDetector(det)
 52 {
 53   fPhantomDir = new G4UIdirectory("/phantom/");
 54   fPhantomDir->SetGuidance(" Cell phantom settings");
 55 
 56   fNameCmd = new G4UIcmdWithAString("/phantom/fileName",this);
 57   fNameCmd->SetGuidance("Select phantom file name");
 58   fNameCmd->SetParameterName("fileName",true);
 59   fNameCmd->SetDefaultValue("phantom.dat");
 60   fNameCmd->AvailableForStates(G4State_PreInit);
 61 
 62   fMatCmd = new G4UIcmdWithAString("/phantom/mediumMat",this);
 63   fMatCmd->SetGuidance("Select material for the phantom medium");
 64   fMatCmd->SetParameterName("mediumMat",true);
 65   fMatCmd->AvailableForStates(G4State_PreInit);
 66 
 67   fDenRedCmd = new G4UIcmdWithADoubleAndUnit("/phantom/redDen",this);
 68   fDenRedCmd->SetGuidance("Select density for the red volume");
 69   fDenRedCmd->SetParameterName("redDen",true);
 70   fDenRedCmd->SetDefaultValue(1.);
 71   fDenRedCmd->SetDefaultUnit("g/cm3");
 72   fDenRedCmd->AvailableForStates(G4State_PreInit);
 73 
 74   fDenGreenCmd = new G4UIcmdWithADoubleAndUnit("/phantom/greenDen",this);
 75   fDenGreenCmd->SetGuidance("Select density for the green volume");
 76   fDenGreenCmd->SetParameterName("greenDen",true);
 77   fDenGreenCmd->SetDefaultValue(1.);
 78   fDenGreenCmd->SetDefaultUnit("g/cm3");
 79   fDenGreenCmd->AvailableForStates(G4State_PreInit);
 80 
 81   fDenBlueCmd = new G4UIcmdWithADoubleAndUnit("/phantom/blueDen",this);
 82   fDenBlueCmd->SetGuidance("Select density for the blue volume");
 83   fDenBlueCmd->SetParameterName("blueDen",true);
 84   fDenBlueCmd->SetDefaultValue(1.);
 85   fDenBlueCmd->SetDefaultUnit("g/cm3");
 86   fDenBlueCmd->AvailableForStates(G4State_PreInit);
 87 
 88   fShiftXCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftX",this);
 89   fShiftXCmd->SetGuidance("Set phantom X shift");
 90   fShiftXCmd->SetParameterName("shiftX",true);
 91   fShiftXCmd->SetDefaultValue(0.);
 92   fShiftXCmd->SetDefaultUnit("um");
 93   fShiftXCmd->AvailableForStates(G4State_PreInit);
 94 
 95   fShiftYCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftY",this);
 96   fShiftYCmd->SetGuidance("Set phantom Y shift");
 97   fShiftYCmd->SetParameterName("shiftY",true);
 98   fShiftYCmd->SetDefaultValue(0.);
 99   fShiftYCmd->SetDefaultUnit("um");
100   fShiftYCmd->AvailableForStates(G4State_PreInit);
101 
102   fShiftZCmd = new G4UIcmdWithADoubleAndUnit("/phantom/shiftZ",this);
103   fShiftZCmd->SetGuidance("Set phantom Z shift");
104   fShiftZCmd->SetParameterName("shiftZ",true);
105   fShiftZCmd->SetDefaultValue(0.);
106   fShiftZCmd->SetDefaultUnit("um");
107   fShiftZCmd->AvailableForStates(G4State_PreInit);
108 
109   fMediumSizeXYCmd = new G4UIcmdWithADoubleAndUnit("/phantom/mediumSizeXY",this);
110   fMediumSizeXYCmd->SetGuidance("Set cellular medium size XY");
111   fMediumSizeXYCmd->SetParameterName("mediumSizeXY",false);
112   fMediumSizeXYCmd->SetDefaultUnit("um");
113   fMediumSizeXYCmd->AvailableForStates(G4State_PreInit);
114 
115   fMediumSizeZCmd = new G4UIcmdWithADoubleAndUnit("/phantom/mediumSizeZ",this);
116   fMediumSizeZCmd->SetGuidance("Set cellular medium size Z");
117   fMediumSizeZCmd->SetParameterName("mediumSizeZ",false);
118   fMediumSizeZCmd->SetDefaultUnit("um");
119   fMediumSizeZCmd->AvailableForStates(G4State_PreInit);
120 
121   fWorldDir = new G4UIdirectory("/world/");
122   fWorldDir->SetGuidance(" World volume settings");
123 
124   fWorldSizeXYCmd = new G4UIcmdWithADoubleAndUnit("/world/sizeXY",this);
125   fWorldSizeXYCmd->SetGuidance("Set world size XY");
126   fWorldSizeXYCmd->SetParameterName("sizeXY",false);
127   fWorldSizeXYCmd->SetDefaultUnit("um");
128   fWorldSizeXYCmd->AvailableForStates(G4State_PreInit);
129 
130   fWorldSizeZCmd = new G4UIcmdWithADoubleAndUnit("/world/sizeZ",this);
131   fWorldSizeZCmd->SetGuidance("Set world size Z");
132   fWorldSizeZCmd->SetParameterName("sizeZ",false);
133   fWorldSizeZCmd->SetDefaultUnit("um");
134   fWorldSizeZCmd->AvailableForStates(G4State_PreInit);
135 }
136 
137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138 
139 DetectorMessenger::~DetectorMessenger()
140 {
141   delete fWorldDir;
142   delete fPhantomDir;
143   delete fNameCmd;
144   delete fMatCmd;
145   delete fDenRedCmd;
146   delete fDenGreenCmd;
147   delete fDenBlueCmd;
148   delete fShiftXCmd;
149   delete fShiftYCmd;
150   delete fShiftZCmd;
151   delete fMediumSizeXYCmd;
152   delete fMediumSizeZCmd;
153   delete fWorldSizeXYCmd;
154   delete fWorldSizeZCmd;
155 }
156 
157 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158 
159 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
160 {
161   if( command == fMatCmd ) {
162     fDetector->SetTargetMaterial(newValue);
163   }
164   else if(command == fDenRedCmd) {
165     fDetector->SetRedDensity(fDenRedCmd->GetNewDoubleValue(newValue));
166   }
167   else if(command == fDenGreenCmd) {
168     fDetector->SetGreenDensity(fDenGreenCmd->GetNewDoubleValue(newValue));
169   }
170   else if(command == fDenBlueCmd) {
171     fDetector->SetBlueDensity(fDenBlueCmd->GetNewDoubleValue(newValue));
172   }
173   else if (command == fShiftXCmd) {
174     fDetector->SetShiftX(fShiftXCmd->GetNewDoubleValue(newValue));
175   }
176   else if (command == fShiftYCmd) {
177     fDetector->SetShiftY(fShiftYCmd->GetNewDoubleValue(newValue));
178   }
179   else if (command == fShiftZCmd) {
180     fDetector->SetShiftZ(fShiftZCmd->GetNewDoubleValue(newValue));
181   }
182   else if (command == fMediumSizeXYCmd) {
183     fDetector->SetMediumSizeXY(fMediumSizeXYCmd->GetNewDoubleValue(newValue));
184   }
185   else if (command == fMediumSizeZCmd) {
186     fDetector->SetMediumSizeZ(fMediumSizeZCmd->GetNewDoubleValue(newValue));
187   }
188   else if (command == fWorldSizeXYCmd) {
189     fDetector->SetWorldSizeXY(fWorldSizeXYCmd->GetNewDoubleValue(newValue));
190   }
191   else if (command == fWorldSizeZCmd) {
192     fDetector->SetWorldSizeZ(fWorldSizeZCmd->GetNewDoubleValue(newValue));
193   }
194   else if(command == fNameCmd) {
195     fDetector->SetPhantomFileName(newValue);
196   }
197 }
198