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.p3 ] [ 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 ]

Diff markup

Differences between /examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc (Version 11.3.0) and /examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc (Version 9.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // Hadrontherapy advanced example for Geant4   <<  26 // $Id: HadrontherapyDetectorMessenger.cc; May 2005
 27 // See more at: https://twiki.cern.ch/twiki/bi <<  27 // ----------------------------------------------------------------------------
 28                                                <<  28 //                 GEANT 4 - Hadrontherapy example
                                                   >>  29 // ----------------------------------------------------------------------------
                                                   >>  30 // Code developed by:
                                                   >>  31 //
                                                   >>  32 // G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
                                                   >>  33 // 
                                                   >>  34 // (a) Laboratori Nazionali del Sud 
                                                   >>  35 //     of the INFN, Catania, Italy
                                                   >>  36 // (b) INFN Section of Genova, Genova, Italy
                                                   >>  37 // 
                                                   >>  38 // * cirrone@lns.infn.it
                                                   >>  39 // ----------------------------------------------------------------------------
 29 #include "HadrontherapyDetectorMessenger.hh"       40 #include "HadrontherapyDetectorMessenger.hh"
 30 #include "HadrontherapyDetectorConstruction.hh     41 #include "HadrontherapyDetectorConstruction.hh"
 31 #include "G4UIdirectory.hh"                        42 #include "G4UIdirectory.hh"
 32 #include "G4UIcmdWith3VectorAndUnit.hh"        <<  43 #include "G4UIcmdWithADoubleAndUnit.hh"
 33 #include "G4UIcmdWithoutParameter.hh"          << 
 34 #include "G4UIcmdWithAString.hh"                   44 #include "G4UIcmdWithAString.hh"
 35 #include "G4SystemOfUnits.hh"                  << 
 36 #include "G4UIcmdWithABool.hh"                 << 
 37                                                    45 
 38 ////////////////////////////////////////////// <<  46 HadrontherapyDetectorMessenger::HadrontherapyDetectorMessenger(
 39 HadrontherapyDetectorMessenger::HadrontherapyD <<  47                      HadrontherapyDetectorConstruction* detector)
 40 :hadrontherapyDetector(detector)               <<  48   :hadrontherapyDetector(detector)
 41 {                                              <<  49 { 
 42     // Change Phantom size                     <<  50   modulatorDir = new G4UIdirectory("/modulator/");
 43     changeThePhantomDir = new G4UIdirectory("/ <<  51   modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
 44     changeThePhantomDir -> SetGuidance("Comman <<  52   
 45     changeThePhantomSizeCmd = new G4UIcmdWith3 <<  53   beamLineDir = new G4UIdirectory("/beamLine/");
 46     changeThePhantomSizeCmd -> SetGuidance("In <<  54   beamLineDir -> SetGuidance("set specification of range shifter");  
 47                                            "\n <<  55 
 48     changeThePhantomSizeCmd -> SetParameterNam <<  56   rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
 49                                                <<  57   rangeShifterDir -> SetGuidance("set specification of range shifter");  
 50                                                <<  58 
 51     changeThePhantomSizeCmd -> SetDefaultUnit( <<  59   firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
 52     changeThePhantomSizeCmd -> SetUnitCandidat <<  60   firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");  
 53     changeThePhantomSizeCmd -> AvailableForSta <<  61  
 54                                                <<  62   secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
 55                                                <<  63   secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");  
 56     // Change Phantom material                 <<  64  
 57     changeThePhantomMaterialCmd = new G4UIcmdW <<  65   rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
 58     changeThePhantomMaterialCmd -> SetGuidance <<  66   rangeStopperDir -> SetGuidance("set specification of stopper");  
 59     changeThePhantomMaterialCmd -> SetParamete <<  67 
 60     changeThePhantomMaterialCmd -> SetDefaultV <<  68   finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
 61     changeThePhantomMaterialCmd -> AvailableFo <<  69   finalCollimatorDir -> SetGuidance("set specification of final collimator");  
 62                                                <<  70 
 63     // Change Phantom position                 <<  71   modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
 64     changeThePhantomPositionCmd = new G4UIcmdW <<  72   modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
 65     changeThePhantomPositionCmd -> SetGuidance <<  73   modulatorAngleCmd -> SetParameterName("Size",false);
 66                                                <<  74   modulatorAngleCmd -> SetRange("Size>=0.");
 67     changeThePhantomPositionCmd -> SetParamete <<  75   modulatorAngleCmd -> SetUnitCategory("Angle");  
 68                                                <<  76   modulatorAngleCmd -> AvailableForStates(G4State_Idle);
 69                                                <<  77   
 70     changeThePhantomPositionCmd -> SetDefaultU <<  78   rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
 71     changeThePhantomPositionCmd -> SetUnitCand <<  79   rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
 72     changeThePhantomPositionCmd -> AvailableFo <<  80   rangeShifterMatCmd -> SetParameterName("choice",false);
 73                                                <<  81   rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
 74                                                <<  82   
 75     updateCmd = new G4UIcmdWithoutParameter("/ <<  83   rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
 76     updateCmd->SetGuidance("Update Phantom/Det <<  84   rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
 77     updateCmd->SetGuidance("This command MUST  <<  85   rangeShifterXSizeCmd -> SetParameterName("Size",false);
 78     updateCmd->SetGuidance("if you changed geo <<  86   rangeShifterXSizeCmd -> SetDefaultUnit("mm");  
 79     updateCmd->AvailableForStates(G4State_Idle <<  87   rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");  
 80                                                <<  88   rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
 81     //  Change detector size                   <<  89   
 82     changeTheDetectorDir = new G4UIdirectory(" <<  90   rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
 83     changeTheDetectorDir -> SetGuidance("Comma <<  91   rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
 84                                                <<  92   rangeShifterXPositionCmd -> SetParameterName("Size",false);
 85     changeTheDetectorSizeCmd = new G4UIcmdWith <<  93   rangeShifterXPositionCmd -> SetDefaultUnit("mm");  
 86     changeTheDetectorSizeCmd -> SetGuidance("I <<  94   rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");  
 87                                             "\ <<  95   rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
 88     changeTheDetectorSizeCmd -> SetParameterNa <<  96   
 89     changeTheDetectorSizeCmd -> SetDefaultUnit <<  97   firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
 90     changeTheDetectorSizeCmd -> SetUnitCandida <<  98   firstScatteringFoilXSizeCmd -> SetGuidance("Set hlaf thickness of first scattering foil");
 91     changeTheDetectorSizeCmd -> AvailableForSt <<  99   firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
 92                                                << 100   firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");  
 93     //  Change the detector to phantom displac << 101   firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");  
 94     changeTheDetectorToPhantomPositionCmd = ne << 102   firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
 95     changeTheDetectorToPhantomPositionCmd -> S << 103   
 96                                                << 104   secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
 97     changeTheDetectorToPhantomPositionCmd -> S << 105   secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
 98                                                << 106   secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
 99                                                << 107   secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");  
100     changeTheDetectorToPhantomPositionCmd -> S << 108   secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");  
101     changeTheDetectorToPhantomPositionCmd -> S << 109   secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
102     changeTheDetectorToPhantomPositionCmd -> A << 110   
103                                                << 111   outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
104     // Change voxels by its size               << 112   outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
105     changeTheDetectorVoxelCmd = new G4UIcmdWit << 113   outerRadiusStopperCmd -> SetParameterName("Size",false);
106     changeTheDetectorVoxelCmd -> SetGuidance(" << 114   outerRadiusStopperCmd -> SetDefaultUnit("mm");  
107                                              " << 115   outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");  
108     changeTheDetectorVoxelCmd -> SetParameterN << 116   outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
109     changeTheDetectorVoxelCmd -> SetDefaultUni << 117   
110     changeTheDetectorVoxelCmd -> SetUnitCandid << 118   innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
111     changeTheDetectorVoxelCmd -> AvailableForS << 119   innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
112                                                << 120   innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
113                                                << 121   innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");  
114     changeTheSource = new G4UIdirectory("/chan << 122   innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");  
115     changeTheSource -> SetGuidance("Command to << 123   innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
116                                                << 
117                                                << 
118                                                << 
119                                                << 
120     ////////////////////////////////////////// << 
121                                                << 
122     VirtualLayer = new G4UIcmdWithABool("/chan << 
123     VirtualLayer -> SetParameterName("VirtualL << 
124     VirtualLayer -> SetDefaultValue("false");  << 
125     VirtualLayer -> SetGuidance("Set if you wa << 
126                                 "\n[usage]: /c << 
127     VirtualLayer -> AvailableForStates(G4State << 
128                                                << 
129                                                << 
130     VirtualLayerPosition = new G4UIcmdWith3Vec << 
131     VirtualLayerPosition -> SetGuidance("Inser << 
132                                         " resp << 
133     VirtualLayerPosition -> SetParameterName(" << 
134                                              " << 
135                                              " << 
136                                                << 
137     VirtualLayerPosition -> SetDefaultUnit("cm << 
138     VirtualLayerPosition -> SetUnitCandidates( << 
139     VirtualLayerPosition -> AvailableForStates << 
140                                                << 
141                                                << 
142                                                << 
143 }                                                 124 }
144                                                   125 
145 ////////////////////////////////////////////// << 
146 HadrontherapyDetectorMessenger::~Hadrontherapy    126 HadrontherapyDetectorMessenger::~HadrontherapyDetectorMessenger()
147 {                                              << 127 { 
148     delete changeThePhantomDir;                << 128   delete innerRadiusFinalCollimatorCmd;  
149     delete changeThePhantomSizeCmd;            << 129   delete outerRadiusStopperCmd;  
150     delete changeThePhantomPositionCmd;        << 130   delete secondScatteringFoilXSizeCmd; 
151     delete changeThePhantomMaterialCmd;        << 131   delete firstScatteringFoilXSizeCmd; 
152     delete updateCmd;                          << 132   delete rangeShifterXPositionCmd;
153     delete changeTheDetectorDir;               << 133   delete rangeShifterXSizeCmd;
154     delete changeTheDetectorSizeCmd;           << 134   delete rangeShifterMatCmd;
155     delete changeTheDetectorToPhantomPositionC << 135   delete modulatorAngleCmd;
156     delete changeTheDetectorVoxelCmd;          << 136   delete finalCollimatorDir; 
157     delete VirtualLayer;                       << 137   delete rangeStopperDir;
158     delete VirtualLayerPosition;               << 138   delete secondScatteringFoilDir;
                                                   >> 139   delete firstScatteringFoilDir; 
                                                   >> 140   delete rangeShifterDir;  
                                                   >> 141   delete beamLineDir; 
                                                   >> 142   delete modulatorDir;   
159 }                                                 143 }
160                                                   144 
161 ////////////////////////////////////////////// << 
162 void HadrontherapyDetectorMessenger::SetNewVal    145 void HadrontherapyDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
163 {                                              << 146 { 
164                                                << 147   if( command == modulatorAngleCmd )
165     if( command == changeThePhantomSizeCmd)    << 148     { hadrontherapyDetector -> SetModulatorAngle
166     {                                          << 149            (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
167         G4ThreeVector size = changeThePhantomS << 150 
168         hadrontherapyDetector -> SetPhantomSiz << 151   if( command == rangeShifterMatCmd )
169     }                                          << 152     { hadrontherapyDetector -> SetRSMaterial(newValue);}
170     else if (command == changeThePhantomPositi << 153 
171     {                                          << 154   if( command == rangeShifterXSizeCmd )
172                                                << 155     { hadrontherapyDetector -> SetRangeShifterXSize
173         G4ThreeVector size = changeThePhantomP << 156             (rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
174         hadrontherapyDetector -> SetPhantomPos << 157 
175     }                                          << 158   if( command == rangeShifterXPositionCmd )
176     else if (command == changeThePhantomMateri << 159     { hadrontherapyDetector -> SetRangeShifterXPosition
177     {                                          << 160                   (rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
178         hadrontherapyDetector -> SetPhantomMat << 161 
179     }                                          << 162   if( command == firstScatteringFoilXSizeCmd )
180     else if (command == changeTheDetectorSizeC << 163     { hadrontherapyDetector -> SetFirstScatteringFoilSize
181     {                                          << 164                   (firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
182         G4ThreeVector size = changeTheDetector << 165 
183         hadrontherapyDetector -> SetDetectorSi << 166   if( command == secondScatteringFoilXSizeCmd )
184     }                                          << 167     { hadrontherapyDetector -> SetSecondScatteringFoilSize
185     else if (command == changeTheDetectorToPha << 168                   (secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
186     {                                          << 169 
187         G4ThreeVector size = changeTheDetector << 170   if( command == outerRadiusStopperCmd )
188         hadrontherapyDetector -> SetDetectorTo << 171     { hadrontherapyDetector -> SetOuterRadiusStopper(
189                                                << 172                     outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
190     }                                          << 173 
191     else if (command == changeTheDetectorVoxel << 174   if( command == innerRadiusFinalCollimatorCmd )
192     {                                          << 175     { hadrontherapyDetector -> SetInnerRadiusFinalCollimator
193         G4ThreeVector size = changeTheDetector << 176                   (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
194         hadrontherapyDetector -> SetVoxelSize( << 
195     }                                          << 
196     else if (command == updateCmd)             << 
197     {                                          << 
198         hadrontherapyDetector -> UpdateGeometr << 
199     }                                          << 
200                                                << 
201     else if(command == VirtualLayer)           << 
202     {                                          << 
203         hadrontherapyDetector->VirtualLayer(Vi << 
204     }                                          << 
205     else if(command == VirtualLayerPosition)   << 
206     {                                          << 
207         G4ThreeVector size = VirtualLayerPosit << 
208                                                << 
209         hadrontherapyDetector -> SetVirtualLay << 
210     }                                          << 
211                                                << 
212 }                                                 177 }
                                                   >> 178 
213                                                   179