| 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 | // G4InteractiveSolid.cc
|
|---|
| 28 | //
|
|---|
| 29 | // Implementation of a messenger for constructing solids interactively
|
|---|
| 30 | //
|
|---|
| 31 |
|
|---|
| 32 | #include "SBTrun.hh"
|
|---|
| 33 |
|
|---|
| 34 | #include "G4InteractiveSolid.hh"
|
|---|
| 35 | #include "G4UIdirectory.hh"
|
|---|
| 36 | #include "G4UIcmdWithPargs.hh"
|
|---|
| 37 | #include "G4UIcmdPargDouble.hh"
|
|---|
| 38 | #include "G4UIcmdPargInteger.hh"
|
|---|
| 39 | #include "G4UIcmdPargListDouble.hh"
|
|---|
| 40 |
|
|---|
| 41 | #include "G4Box.hh"
|
|---|
| 42 | #include "G4Cons.hh"
|
|---|
| 43 | #include "G4Orb.hh"
|
|---|
| 44 | #include "G4Para.hh"
|
|---|
| 45 | #include "G4Sphere.hh"
|
|---|
| 46 | #include "G4Torus.hh"
|
|---|
| 47 | #include "G4Trap.hh"
|
|---|
| 48 | #include "G4Trd.hh"
|
|---|
| 49 | #include "G4Tubs.hh"
|
|---|
| 50 | #include "G4Ellipsoid.hh"
|
|---|
| 51 | #include "G4EllipticalCone.hh"
|
|---|
| 52 | #include "G4EllipticalTube.hh"
|
|---|
| 53 | #include "G4ExtrudedSolid.hh"
|
|---|
| 54 | #include "G4Hype.hh"
|
|---|
| 55 | #include "G4Polycone.hh"
|
|---|
| 56 | #include "G4Polyhedra.hh"
|
|---|
| 57 | #include "G4TessellatedSolid.hh"
|
|---|
| 58 | #include "G4TriangularFacet.hh"
|
|---|
| 59 | #include "G4QuadrangularFacet.hh"
|
|---|
| 60 | #include "G4Tet.hh"
|
|---|
| 61 | #include "G4TwistedBox.hh"
|
|---|
| 62 | #include "G4TwistedTrap.hh"
|
|---|
| 63 | #include "G4TwistedTrd.hh"
|
|---|
| 64 | #include "G4TwistedTubs.hh"
|
|---|
| 65 |
|
|---|
| 66 | #include "G4IntersectionSolid.hh"
|
|---|
| 67 | #include "G4SubtractionSolid.hh"
|
|---|
| 68 | #include "G4UnionSolid.hh"
|
|---|
| 69 |
|
|---|
| 70 | //
|
|---|
| 71 | // Constructor
|
|---|
| 72 | //
|
|---|
| 73 | G4InteractiveSolid::G4InteractiveSolid( const G4String &prefix )
|
|---|
| 74 | {
|
|---|
| 75 | //
|
|---|
| 76 | // Hmmm... well, how about a reasonable default?
|
|---|
| 77 | //
|
|---|
| 78 | solid = new G4Box( "InteractiveBox", 1.0*m, 1.0*m, 1.0*m );
|
|---|
| 79 |
|
|---|
| 80 | //
|
|---|
| 81 | // Declare messenger directory
|
|---|
| 82 | //
|
|---|
| 83 | volumeDirectory = new G4UIdirectory( prefix );
|
|---|
| 84 | volumeDirectory->SetGuidance( "Solid construction using parameters from the command line" );
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 | //
|
|---|
| 88 | // Declare G4Box
|
|---|
| 89 | //
|
|---|
| 90 | boxArgs[0] = new G4UIcmdPargDouble( "dx", 1.0, m );
|
|---|
| 91 | boxArgs[1] = new G4UIcmdPargDouble( "dy", 1.0, m );
|
|---|
| 92 | boxArgs[2] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 93 | G4String boxPath = prefix+"G4Box";
|
|---|
| 94 | boxCmd = new G4UIcmdWithPargs( boxPath, this, boxArgs, 3 );
|
|---|
| 95 | boxCmd->SetGuidance( "Declare a G4Box solid" );
|
|---|
| 96 |
|
|---|
| 97 | //
|
|---|
| 98 | // Declare G4Cons
|
|---|
| 99 | //
|
|---|
| 100 | consArgs[0] = new G4UIcmdPargDouble( "rmin1", 1.0, m );
|
|---|
| 101 | consArgs[1] = new G4UIcmdPargDouble( "rmax1", 1.0, m );
|
|---|
| 102 | consArgs[2] = new G4UIcmdPargDouble( "rmin2", 1.0, m );
|
|---|
| 103 | consArgs[3] = new G4UIcmdPargDouble( "rmax2", 1.0, m );
|
|---|
| 104 | consArgs[4] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 105 | consArgs[5] = new G4UIcmdPargDouble( "startPhi", 1.0, deg );
|
|---|
| 106 | consArgs[6] = new G4UIcmdPargDouble( "deltaPhi", 1.0, deg );
|
|---|
| 107 | G4String consPath = prefix+"G4Cons";
|
|---|
| 108 | consCmd = new G4UIcmdWithPargs( consPath, this, consArgs, 7 );
|
|---|
| 109 | consCmd->SetGuidance( "Declare a G4Cons solid" );
|
|---|
| 110 |
|
|---|
| 111 | //
|
|---|
| 112 | // Declare G4Orb
|
|---|
| 113 | //
|
|---|
| 114 | orbArgs[0] = new G4UIcmdPargDouble( "r", 1.0, m );
|
|---|
| 115 | G4String orbPath = prefix+"G4Orb";
|
|---|
| 116 | orbCmd = new G4UIcmdWithPargs( orbPath, this, orbArgs, 1 );
|
|---|
| 117 | orbCmd->SetGuidance( "Declare a G4Orb solid" );
|
|---|
| 118 |
|
|---|
| 119 | //
|
|---|
| 120 | // Declare G4Para
|
|---|
| 121 | //
|
|---|
| 122 | paraArgs[0] = new G4UIcmdPargDouble( "dx", 1.0, m );
|
|---|
| 123 | paraArgs[1] = new G4UIcmdPargDouble( "dy", 1.0, m );
|
|---|
| 124 | paraArgs[2] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 125 | paraArgs[3] = new G4UIcmdPargDouble( "alpha", 90, deg );
|
|---|
| 126 | paraArgs[4] = new G4UIcmdPargDouble( "theta", 90, deg );
|
|---|
| 127 | paraArgs[5] = new G4UIcmdPargDouble( "phi", 90, deg );
|
|---|
| 128 | G4String paraPath = prefix+"G4Para";
|
|---|
| 129 | paraCmd = new G4UIcmdWithPargs( paraPath, this, paraArgs, 6 );
|
|---|
| 130 | paraCmd->SetGuidance( "Declare a G4Para solid" );
|
|---|
| 131 |
|
|---|
| 132 | //
|
|---|
| 133 | // Declare G4Sphere
|
|---|
| 134 | //
|
|---|
| 135 | sphereArgs[0] = new G4UIcmdPargDouble( "rmin", 1.0, m );
|
|---|
| 136 | sphereArgs[1] = new G4UIcmdPargDouble( "rmax", 1.0, m );
|
|---|
| 137 | sphereArgs[2] = new G4UIcmdPargDouble( "startPhi", 1.0, deg );
|
|---|
| 138 | sphereArgs[3] = new G4UIcmdPargDouble( "deltaPhi", 1.0, deg );
|
|---|
| 139 | sphereArgs[4] = new G4UIcmdPargDouble( "startTheta", 1.0, deg );
|
|---|
| 140 | sphereArgs[5] = new G4UIcmdPargDouble( "deltaTheta", 1.0, deg );
|
|---|
| 141 | G4String spherePath = prefix+"G4Sphere";
|
|---|
| 142 | sphereCmd = new G4UIcmdWithPargs( spherePath, this, sphereArgs, 6 );
|
|---|
| 143 | sphereCmd->SetGuidance( "Declare a G4Sphere solid" );
|
|---|
| 144 |
|
|---|
| 145 | //
|
|---|
| 146 | // Declare G4Torus
|
|---|
| 147 | //
|
|---|
| 148 | torusArgs[0] = new G4UIcmdPargDouble( "rmin", 1.0, m );
|
|---|
| 149 | torusArgs[1] = new G4UIcmdPargDouble( "rmax", 1.0, m );
|
|---|
| 150 | torusArgs[2] = new G4UIcmdPargDouble( "rtorus", 1.0, m );
|
|---|
| 151 | torusArgs[3] = new G4UIcmdPargDouble( "startPhi", 1.0, deg );
|
|---|
| 152 | torusArgs[4] = new G4UIcmdPargDouble( "deltaPhi", 1.0, deg );
|
|---|
| 153 | G4String torusPath = prefix+"G4Torus";
|
|---|
| 154 | torusCmd = new G4UIcmdWithPargs( torusPath, this, torusArgs, 5 );
|
|---|
| 155 | torusCmd->SetGuidance( "Declare a G4Torus solid" );
|
|---|
| 156 |
|
|---|
| 157 | //
|
|---|
| 158 | // Declare G4Trap
|
|---|
| 159 | //
|
|---|
| 160 | trapArgs[ 0] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 161 | trapArgs[ 1] = new G4UIcmdPargDouble( "theta", 90, deg );
|
|---|
| 162 | trapArgs[ 2] = new G4UIcmdPargDouble( "phi", 1.0, m );
|
|---|
| 163 | trapArgs[ 3] = new G4UIcmdPargDouble( "dy1", 1.0, m );
|
|---|
| 164 | trapArgs[ 4] = new G4UIcmdPargDouble( "dx1", 1.0, m );
|
|---|
| 165 | trapArgs[ 5] = new G4UIcmdPargDouble( "dx2", 1.0, m );
|
|---|
| 166 | trapArgs[ 6] = new G4UIcmdPargDouble( "alpha1", 90, deg );
|
|---|
| 167 | trapArgs[ 7] = new G4UIcmdPargDouble( "dy2", 1.0, m );
|
|---|
| 168 | trapArgs[ 8] = new G4UIcmdPargDouble( "dx3", 1.0, m );
|
|---|
| 169 | trapArgs[ 9] = new G4UIcmdPargDouble( "dx4", 1.0, m );
|
|---|
| 170 | trapArgs[10] = new G4UIcmdPargDouble( "alpha2", 90, deg );
|
|---|
| 171 | G4String trapPath = prefix+"G4Trap";
|
|---|
| 172 | trapCmd = new G4UIcmdWithPargs( trapPath, this, trapArgs, 11 );
|
|---|
| 173 | trapCmd->SetGuidance( "Declare a G4Trap solid" );
|
|---|
| 174 |
|
|---|
| 175 | //
|
|---|
| 176 | // Declare G4Trd
|
|---|
| 177 | //
|
|---|
| 178 | trdArgs[0] = new G4UIcmdPargDouble( "dx1", 1.0, m );
|
|---|
| 179 | trdArgs[1] = new G4UIcmdPargDouble( "dx2", 1.0, m );
|
|---|
| 180 | trdArgs[2] = new G4UIcmdPargDouble( "dy1", 1.0, m );
|
|---|
| 181 | trdArgs[3] = new G4UIcmdPargDouble( "dy2", 1.0, m );
|
|---|
| 182 | trdArgs[4] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 183 | G4String trdPath = prefix+"G4Trd";
|
|---|
| 184 | trdCmd = new G4UIcmdWithPargs( trdPath, this, trdArgs, 5 );
|
|---|
| 185 | trdCmd->SetGuidance( "Declare a G4Trd solid" );
|
|---|
| 186 |
|
|---|
| 187 | //
|
|---|
| 188 | // Declare G4Tubs
|
|---|
| 189 | //
|
|---|
| 190 | tubsArgs[0] = new G4UIcmdPargDouble( "rmin", 1.0, m );
|
|---|
| 191 | tubsArgs[1] = new G4UIcmdPargDouble( "rmax", 1.0, m );
|
|---|
| 192 | tubsArgs[2] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 193 | tubsArgs[3] = new G4UIcmdPargDouble( "startPhi", 1.0, deg );
|
|---|
| 194 | tubsArgs[4] = new G4UIcmdPargDouble( "deltaPhi", 1.0, deg );
|
|---|
| 195 | G4String tubsPath = prefix+"G4Tubs";
|
|---|
| 196 | tubsCmd = new G4UIcmdWithPargs( tubsPath, this, tubsArgs, 5 );
|
|---|
| 197 | tubsCmd->SetGuidance( "Declare a G4Tubs solid" );
|
|---|
| 198 |
|
|---|
| 199 | //
|
|---|
| 200 | // Declare G4Ellipsoid
|
|---|
| 201 | //
|
|---|
| 202 | ellipsoidArgs[0] = new G4UIcmdPargDouble( "dx", 1.0, m );
|
|---|
| 203 | ellipsoidArgs[1] = new G4UIcmdPargDouble( "dy", 1.0, m );
|
|---|
| 204 | ellipsoidArgs[2] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 205 | ellipsoidArgs[3] = new G4UIcmdPargDouble( "zBottomCut", 0, m );
|
|---|
| 206 | ellipsoidArgs[4] = new G4UIcmdPargDouble( "zTopCut", 0, m );
|
|---|
| 207 | G4String ellipsoidPath = prefix+"G4Ellipsoid";
|
|---|
| 208 | ellipsoidCmd = new G4UIcmdWithPargs( ellipsoidPath, this, ellipsoidArgs, 5 );
|
|---|
| 209 | ellipsoidCmd->SetGuidance( "Declare a G4Ellipsoid solid" );
|
|---|
| 210 |
|
|---|
| 211 | //
|
|---|
| 212 | // Declare G4EllipticalCone
|
|---|
| 213 | //
|
|---|
| 214 | elConeArgs[0] = new G4UIcmdPargDouble( "dx", 1.0, 1 );
|
|---|
| 215 | elConeArgs[1] = new G4UIcmdPargDouble( "dy", 1.0, 1 );
|
|---|
| 216 | elConeArgs[2] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 217 | elConeArgs[3] = new G4UIcmdPargDouble( "zTopCut", 1.0, m );
|
|---|
| 218 | G4String elConePath = prefix+"G4EllipticalCone";
|
|---|
| 219 | elConeCmd = new G4UIcmdWithPargs( elConePath, this, elConeArgs, 4 );
|
|---|
| 220 | elConeCmd->SetGuidance( "Declare a G4EllipticalCone solid" );
|
|---|
| 221 |
|
|---|
| 222 | //
|
|---|
| 223 | // Declare G4EllipticalTube
|
|---|
| 224 | //
|
|---|
| 225 | elTubeArgs[0] = new G4UIcmdPargDouble( "dx", 1.0, m );
|
|---|
| 226 | elTubeArgs[1] = new G4UIcmdPargDouble( "dy", 1.0, m );
|
|---|
| 227 | elTubeArgs[2] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 228 | G4String elTubePath = prefix+"G4EllipticalTube";
|
|---|
| 229 | elTubeCmd = new G4UIcmdWithPargs( elTubePath, this, elTubeArgs, 3 );
|
|---|
| 230 | elTubeCmd->SetGuidance( "Declare a G4EllipticalTube solid" );
|
|---|
| 231 |
|
|---|
| 232 | //
|
|---|
| 233 | // Declare G4ExtrudedSolid
|
|---|
| 234 | //
|
|---|
| 235 | extrudedArgs[0] = new G4UIcmdPargInteger( "numPoints", 8 );
|
|---|
| 236 | extrudedArgs[1] = new G4UIcmdPargListDouble( "pgonx", 100, m );
|
|---|
| 237 | extrudedArgs[2] = new G4UIcmdPargListDouble( "pgony", 100, m );
|
|---|
| 238 | extrudedArgs[3] = new G4UIcmdPargInteger( "numSides", 8 );
|
|---|
| 239 | extrudedArgs[4] = new G4UIcmdPargListDouble( "z", 100, m );
|
|---|
| 240 | extrudedArgs[5] = new G4UIcmdPargListDouble( "offx", 100, m );
|
|---|
| 241 | extrudedArgs[6] = new G4UIcmdPargListDouble( "offy", 100, m );
|
|---|
| 242 | extrudedArgs[7] = new G4UIcmdPargListDouble( "scale", 100, 1 );
|
|---|
| 243 | G4String extrudedPath = prefix+"G4ExtrudedSolid";
|
|---|
| 244 | extrudedCmd = new G4UIcmdWithPargs( extrudedPath, this, extrudedArgs, 8 );
|
|---|
| 245 | extrudedCmd->SetGuidance( "Declare a G4ExtrudedSolid solid" );
|
|---|
| 246 |
|
|---|
| 247 | //
|
|---|
| 248 | // Declare G4Hype
|
|---|
| 249 | //
|
|---|
| 250 | hypeArgs[0] = new G4UIcmdPargDouble( "innerRadius", 1.0, m );
|
|---|
| 251 | hypeArgs[1] = new G4UIcmdPargDouble( "outerRadius", 1.0, m );
|
|---|
| 252 | hypeArgs[2] = new G4UIcmdPargDouble( "innerStereo", 1.0, rad );
|
|---|
| 253 | hypeArgs[3] = new G4UIcmdPargDouble( "outerStereo", 1.0, rad );
|
|---|
| 254 | hypeArgs[4] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 255 | G4String hypePath = prefix+"G4Hype";
|
|---|
| 256 | hypeCmd = new G4UIcmdWithPargs( hypePath, this, hypeArgs, 5 );
|
|---|
| 257 | hypeCmd->SetGuidance( "Declare a G4Hype solid" );
|
|---|
| 258 |
|
|---|
| 259 | //
|
|---|
| 260 | // Declare G4Polycone
|
|---|
| 261 | //
|
|---|
| 262 | polyconeArgs[0] = new G4UIcmdPargDouble( "phiStart", 0, deg );
|
|---|
| 263 | polyconeArgs[1] = new G4UIcmdPargDouble( "phiTotal", 0, deg );
|
|---|
| 264 | polyconeArgs[2] = new G4UIcmdPargInteger( "numRZ", 1 );
|
|---|
| 265 | polyconeArgs[3] = new G4UIcmdPargListDouble( "r", 100, m );
|
|---|
| 266 | polyconeArgs[4] = new G4UIcmdPargListDouble( "z", 100, m );
|
|---|
| 267 | G4String polyconePath = prefix+"G4Polycone";
|
|---|
| 268 | polyconeCmd = new G4UIcmdWithPargs( polyconePath, this, polyconeArgs, 5 );
|
|---|
| 269 | polyconeCmd->SetGuidance( "Declare a G4Polycone solid" );
|
|---|
| 270 |
|
|---|
| 271 | //
|
|---|
| 272 | // Declare G4Polycone2
|
|---|
| 273 | //
|
|---|
| 274 | polycone2Args[0] = new G4UIcmdPargDouble( "phiStart", 0, deg );
|
|---|
| 275 | polycone2Args[1] = new G4UIcmdPargDouble( "phiTotal", 0, deg );
|
|---|
| 276 | polycone2Args[2] = new G4UIcmdPargInteger( "numRZ", 1 );
|
|---|
| 277 | polycone2Args[3] = new G4UIcmdPargListDouble( "z", 100, m );
|
|---|
| 278 | polycone2Args[4] = new G4UIcmdPargListDouble( "rin", 100, m );
|
|---|
| 279 | polycone2Args[5] = new G4UIcmdPargListDouble( "rout", 100, m );
|
|---|
| 280 | G4String polycone2Path = prefix+"G4Polycone2";
|
|---|
| 281 | polycone2Cmd = new G4UIcmdWithPargs( polycone2Path, this, polycone2Args, 6 );
|
|---|
| 282 | polycone2Cmd->SetGuidance( "Declare a G4Polycone solid (PCON style)" );
|
|---|
| 283 |
|
|---|
| 284 | //
|
|---|
| 285 | // Declare G4Polyhedra
|
|---|
| 286 | //
|
|---|
| 287 | polyhedraArgs[0] = new G4UIcmdPargDouble( "phiStart", 0, deg );
|
|---|
| 288 | polyhedraArgs[1] = new G4UIcmdPargDouble( "phiTotal", 0, deg );
|
|---|
| 289 | polyhedraArgs[2] = new G4UIcmdPargInteger( "numSides", 8 );
|
|---|
| 290 | polyhedraArgs[3] = new G4UIcmdPargInteger( "numRZ", 1 );
|
|---|
| 291 | polyhedraArgs[4] = new G4UIcmdPargListDouble( "r", 100, m );
|
|---|
| 292 | polyhedraArgs[5] = new G4UIcmdPargListDouble( "z", 100, m );
|
|---|
| 293 | G4String polyhedraPath = prefix+"G4Polyhedra";
|
|---|
| 294 | polyhedraCmd = new G4UIcmdWithPargs( polyhedraPath, this, polyhedraArgs, 6 );
|
|---|
| 295 | polyhedraCmd->SetGuidance( "Declare a G4Polyhedra solid" );
|
|---|
| 296 |
|
|---|
| 297 | //
|
|---|
| 298 | // Declare G4Polyhedra2
|
|---|
| 299 | //
|
|---|
| 300 | polyhedra2Args[0] = new G4UIcmdPargDouble( "phiStart", 0, deg );
|
|---|
| 301 | polyhedra2Args[1] = new G4UIcmdPargDouble( "phiTotal", 0, deg );
|
|---|
| 302 | polyhedra2Args[2] = new G4UIcmdPargInteger( "numSides", 8 );
|
|---|
| 303 | polyhedra2Args[3] = new G4UIcmdPargInteger( "numRZ", 1 );
|
|---|
| 304 | polyhedra2Args[4] = new G4UIcmdPargListDouble( "z", 100, m );
|
|---|
| 305 | polyhedra2Args[5] = new G4UIcmdPargListDouble( "rin", 100, m );
|
|---|
| 306 | polyhedra2Args[6] = new G4UIcmdPargListDouble( "rout", 100, m );
|
|---|
| 307 | G4String polyhedra2Path = prefix+"G4Polyhedra2";
|
|---|
| 308 | polyhedra2Cmd = new G4UIcmdWithPargs( polyhedra2Path, this, polyhedra2Args, 7 );
|
|---|
| 309 | polyhedra2Cmd->SetGuidance( "Declare a G4Polyhedra solid (PGON style)" );
|
|---|
| 310 |
|
|---|
| 311 | //
|
|---|
| 312 | // Declare G4TessellatedSolid
|
|---|
| 313 | //
|
|---|
| 314 | tesselArgs[0] = new G4UIcmdPargInteger("num3", 8 );
|
|---|
| 315 | tesselArgs[1] = new G4UIcmdPargListDouble("p1in3", 100, m );
|
|---|
| 316 | tesselArgs[2] = new G4UIcmdPargListDouble("p2in3", 100, m );
|
|---|
| 317 | tesselArgs[3] = new G4UIcmdPargListDouble("p3in3", 100, m );
|
|---|
| 318 | tesselArgs[4] = new G4UIcmdPargInteger("num4", 8 );
|
|---|
| 319 | tesselArgs[5] = new G4UIcmdPargListDouble("p1in4", 100, m );
|
|---|
| 320 | tesselArgs[6] = new G4UIcmdPargListDouble("p2in4", 100, m );
|
|---|
| 321 | tesselArgs[7] = new G4UIcmdPargListDouble("p3in4", 100, m );
|
|---|
| 322 | tesselArgs[8] = new G4UIcmdPargListDouble("p4in4", 100, m );
|
|---|
| 323 | G4String tesselPath = prefix+"G4TessellatedSolid";
|
|---|
| 324 | tesselCmd = new G4UIcmdWithPargs( tesselPath, this, tesselArgs, 9 );
|
|---|
| 325 | tesselCmd->SetGuidance( "Declare a G4TessellatedSolid solid" );
|
|---|
| 326 |
|
|---|
| 327 | //
|
|---|
| 328 | // Declare G4TessellatedSolid2
|
|---|
| 329 | //
|
|---|
| 330 | tessel2Args[0] = new G4UIcmdPargInteger( "numPoints", 8 );
|
|---|
| 331 | tessel2Args[1] = new G4UIcmdPargListDouble( "pgonx", 100, m );
|
|---|
| 332 | tessel2Args[2] = new G4UIcmdPargListDouble( "pgony", 100, m );
|
|---|
| 333 | tessel2Args[3] = new G4UIcmdPargInteger( "numSides", 8 );
|
|---|
| 334 | tessel2Args[4] = new G4UIcmdPargListDouble( "z", 100, m );
|
|---|
| 335 | tessel2Args[5] = new G4UIcmdPargListDouble( "offx", 100, m );
|
|---|
| 336 | tessel2Args[6] = new G4UIcmdPargListDouble( "offy", 100, m );
|
|---|
| 337 | tessel2Args[7] = new G4UIcmdPargListDouble( "scale", 100, 1 );
|
|---|
| 338 | G4String tessel2Path = prefix+"G4TessellatedSolid2";
|
|---|
| 339 | tessel2Cmd = new G4UIcmdWithPargs( tessel2Path, this, tessel2Args, 8 );
|
|---|
| 340 | tessel2Cmd->SetGuidance( "Declare a G4TessellatedSolid solid as an extruded solid" );
|
|---|
| 341 |
|
|---|
| 342 | //
|
|---|
| 343 | // Declare G4Tet
|
|---|
| 344 | //
|
|---|
| 345 | tetArgs[0] = new G4UIcmdPargListDouble( "p1", 3, m );
|
|---|
| 346 | tetArgs[1] = new G4UIcmdPargListDouble( "p2", 3, m );
|
|---|
| 347 | tetArgs[2] = new G4UIcmdPargListDouble( "p3", 3, m );
|
|---|
| 348 | tetArgs[3] = new G4UIcmdPargListDouble( "p4", 3, m );
|
|---|
| 349 | G4String tetPath = prefix+"G4Tet";
|
|---|
| 350 | tetCmd = new G4UIcmdWithPargs( tetPath, this, tetArgs, 4 );
|
|---|
| 351 | tetCmd->SetGuidance( "Declare a G4Tet solid" );
|
|---|
| 352 |
|
|---|
| 353 | //
|
|---|
| 354 | // Declare G4TwistedBox
|
|---|
| 355 | //
|
|---|
| 356 | twistedBoxArgs[0] = new G4UIcmdPargDouble( "phi", 0.0, deg );
|
|---|
| 357 | twistedBoxArgs[1] = new G4UIcmdPargDouble( "dx", 1.0, m );
|
|---|
| 358 | twistedBoxArgs[2] = new G4UIcmdPargDouble( "dy", 1.0, m );
|
|---|
| 359 | twistedBoxArgs[3] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 360 | G4String twistedBoxPath = prefix+"G4TwistedBox";
|
|---|
| 361 | twistedBoxCmd = new G4UIcmdWithPargs( twistedBoxPath, this, twistedBoxArgs, 4 );
|
|---|
| 362 | twistedBoxCmd->SetGuidance( "Declare a G4TwistedBox solid" );
|
|---|
| 363 |
|
|---|
| 364 | //
|
|---|
| 365 | // Declare regular G4TwistedTrap
|
|---|
| 366 | //
|
|---|
| 367 | //
|
|---|
| 368 | twistedTrapArgs[0] = new G4UIcmdPargDouble( "phi", 0.0, deg );
|
|---|
| 369 | twistedTrapArgs[1] = new G4UIcmdPargDouble( "dx1", 1.0, m );
|
|---|
| 370 | twistedTrapArgs[2] = new G4UIcmdPargDouble( "dx2", 1.0, m );
|
|---|
| 371 | twistedTrapArgs[3] = new G4UIcmdPargDouble( "dy", 1.0, m );
|
|---|
| 372 | twistedTrapArgs[4] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 373 | G4String twistedTrapPath = prefix+"G4TwistedTrap";
|
|---|
| 374 | twistedTrapCmd = new G4UIcmdWithPargs( twistedTrapPath, this, twistedTrapArgs, 5 );
|
|---|
| 375 | twistedTrapCmd->SetGuidance( "Declare a regular G4TwistedTrap solid" );
|
|---|
| 376 |
|
|---|
| 377 |
|
|---|
| 378 | //
|
|---|
| 379 | // Declare general G4TwistedTrap
|
|---|
| 380 | //
|
|---|
| 381 | twistedTrap2Args[ 0] = new G4UIcmdPargDouble( "phi", 0.0, deg );
|
|---|
| 382 | twistedTrap2Args[ 1] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 383 | twistedTrap2Args[ 2] = new G4UIcmdPargDouble( "theta", 0.0, deg );
|
|---|
| 384 | twistedTrap2Args[ 3] = new G4UIcmdPargDouble( "phi", 1.0, deg );
|
|---|
| 385 | twistedTrap2Args[ 4] = new G4UIcmdPargDouble( "dy1", 1.0, m );
|
|---|
| 386 | twistedTrap2Args[ 5] = new G4UIcmdPargDouble( "dx1", 1.0, m );
|
|---|
| 387 | twistedTrap2Args[ 6] = new G4UIcmdPargDouble( "dx2", 1.0, m );
|
|---|
| 388 | twistedTrap2Args[ 7] = new G4UIcmdPargDouble( "dy2", 1.0, m );
|
|---|
| 389 | twistedTrap2Args[ 8] = new G4UIcmdPargDouble( "dx3", 1.0, m );
|
|---|
| 390 | twistedTrap2Args[ 9] = new G4UIcmdPargDouble( "dx4", 1.0, m );
|
|---|
| 391 | twistedTrap2Args[10] = new G4UIcmdPargDouble( "alpha", 0.0, deg );
|
|---|
| 392 | G4String twistedTrap2Path = prefix+"G4TwistedTrap2";
|
|---|
| 393 | twistedTrap2Cmd = new G4UIcmdWithPargs( twistedTrap2Path, this, twistedTrap2Args, 11 );
|
|---|
| 394 | twistedTrap2Cmd->SetGuidance( "Declare a general G4TwistedTrap solid" );
|
|---|
| 395 |
|
|---|
| 396 | //
|
|---|
| 397 | // Declare G4TwistedTrd
|
|---|
| 398 | //
|
|---|
| 399 | //
|
|---|
| 400 | twistedTrdArgs[0] = new G4UIcmdPargDouble( "dx1", 1.0, m );
|
|---|
| 401 | twistedTrdArgs[1] = new G4UIcmdPargDouble( "dx2", 1.0, m );
|
|---|
| 402 | twistedTrdArgs[2] = new G4UIcmdPargDouble( "dy1", 1.0, m );
|
|---|
| 403 | twistedTrdArgs[3] = new G4UIcmdPargDouble( "dy2", 1.0, m );
|
|---|
| 404 | twistedTrdArgs[4] = new G4UIcmdPargDouble( "dz", 1.0, m );
|
|---|
| 405 | twistedTrdArgs[5] = new G4UIcmdPargDouble( "phi", 0.0, deg );
|
|---|
| 406 | G4String twistedTrdPath = prefix+"G4TwistedTrd";
|
|---|
| 407 | twistedTrdCmd = new G4UIcmdWithPargs( twistedTrdPath, this, twistedTrdArgs, 6 );
|
|---|
| 408 | twistedTrdCmd->SetGuidance( "Declare a regular G4TwistedTrd solid" );
|
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 | //
|
|---|
| 412 | // Declare G4TwistedTubs
|
|---|
| 413 | //
|
|---|
| 414 | twistedTubsArgs[0] = new G4UIcmdPargDouble( "phi", 0.0, deg );
|
|---|
| 415 | twistedTubsArgs[1] = new G4UIcmdPargDouble( "rmin", 1.0, m );
|
|---|
| 416 | twistedTubsArgs[2] = new G4UIcmdPargDouble( "rmax", 1.0, m );
|
|---|
| 417 | twistedTubsArgs[3] = new G4UIcmdPargDouble( "zneg", 1.0, m );
|
|---|
| 418 | twistedTubsArgs[4] = new G4UIcmdPargDouble( "zpos", 1.0, m );
|
|---|
| 419 | twistedTubsArgs[5] = new G4UIcmdPargInteger( "nseg", 1 );
|
|---|
| 420 | twistedTubsArgs[6] = new G4UIcmdPargDouble( "totphi", 360.0, deg );
|
|---|
| 421 | G4String twistedTubsPath = prefix+"G4TwistedTubs";
|
|---|
| 422 | twistedTubsCmd = new G4UIcmdWithPargs( twistedTubsPath, this, twistedTubsArgs, 7 );
|
|---|
| 423 | twistedTubsCmd->SetGuidance( "Declare a G4TwistedTubs solid" );
|
|---|
| 424 |
|
|---|
| 425 | //
|
|---|
| 426 | // Declare DircTest
|
|---|
| 427 | //
|
|---|
| 428 | G4String dircTestPath = prefix+"DircTest";
|
|---|
| 429 | dircTestCmd = new G4UIcmdWithPargs( dircTestPath, this, 0, 0 );
|
|---|
| 430 | dircTestCmd->SetGuidance( "Declare a DircTest solid" );
|
|---|
| 431 |
|
|---|
| 432 | //
|
|---|
| 433 | // Declare BooleanSolid1
|
|---|
| 434 | //
|
|---|
| 435 | G4String BooleanSolid1Path = prefix+"BooleanSolid";
|
|---|
| 436 | BooleanSolid1Cmd = new G4UIcmdWithPargs( BooleanSolid1Path, this, 0, 0 );
|
|---|
| 437 | BooleanSolid1Cmd->SetGuidance( "Declare a Boolean solid #1" );
|
|---|
| 438 | }
|
|---|
| 439 |
|
|---|
| 440 |
|
|---|
| 441 | //
|
|---|
| 442 | // Destructor
|
|---|
| 443 | //
|
|---|
| 444 | G4InteractiveSolid::~G4InteractiveSolid()
|
|---|
| 445 | {
|
|---|
| 446 | if (solid) delete solid;
|
|---|
| 447 |
|
|---|
| 448 | delete boxCmd;
|
|---|
| 449 | DeleteArgArray( boxArgs, sizeof( boxArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 450 |
|
|---|
| 451 | delete consCmd;
|
|---|
| 452 | DeleteArgArray( consArgs, sizeof( consArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 453 |
|
|---|
| 454 | delete orbCmd;
|
|---|
| 455 | DeleteArgArray( orbArgs, sizeof( orbArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 456 |
|
|---|
| 457 | delete paraCmd;
|
|---|
| 458 | DeleteArgArray( paraArgs, sizeof( paraArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 459 |
|
|---|
| 460 | delete sphereCmd;
|
|---|
| 461 | DeleteArgArray( sphereArgs, sizeof( sphereArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 462 |
|
|---|
| 463 | delete torusCmd;
|
|---|
| 464 | DeleteArgArray( torusArgs, sizeof( torusArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 465 |
|
|---|
| 466 | delete trapCmd;
|
|---|
| 467 | DeleteArgArray( trapArgs, sizeof( trapArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 468 |
|
|---|
| 469 | delete trdCmd;
|
|---|
| 470 | DeleteArgArray( trdArgs, sizeof( trdArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 471 |
|
|---|
| 472 | delete tubsCmd;
|
|---|
| 473 | DeleteArgArray( tubsArgs, sizeof( tubsArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 474 |
|
|---|
| 475 | delete ellipsoidCmd;
|
|---|
| 476 | DeleteArgArray( ellipsoidArgs, sizeof(ellipsoidArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 477 |
|
|---|
| 478 | delete elConeCmd;
|
|---|
| 479 | DeleteArgArray( elConeArgs, sizeof( elConeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 480 |
|
|---|
| 481 | delete elTubeCmd;
|
|---|
| 482 | DeleteArgArray( elTubeArgs, sizeof( elTubeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 483 |
|
|---|
| 484 | delete extrudedCmd;
|
|---|
| 485 | DeleteArgArray( extrudedArgs, sizeof( extrudedArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 486 |
|
|---|
| 487 | delete hypeCmd;
|
|---|
| 488 | DeleteArgArray( hypeArgs, sizeof( hypeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 489 |
|
|---|
| 490 | delete polyconeCmd;
|
|---|
| 491 | DeleteArgArray( polyconeArgs, sizeof( polyconeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 492 |
|
|---|
| 493 | delete polyhedraCmd;
|
|---|
| 494 | DeleteArgArray( polyhedraArgs, sizeof(polyhedraArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 495 |
|
|---|
| 496 | delete tesselCmd;
|
|---|
| 497 | DeleteArgArray( tesselArgs, sizeof( tesselArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 498 |
|
|---|
| 499 | delete tessel2Cmd;
|
|---|
| 500 | DeleteArgArray( tessel2Args, sizeof( tessel2Args)/sizeof(G4UIcmdParg**) );
|
|---|
| 501 |
|
|---|
| 502 | delete tetCmd;
|
|---|
| 503 | DeleteArgArray( tetArgs, sizeof( tetArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 504 |
|
|---|
| 505 | delete twistedBoxCmd;
|
|---|
| 506 | DeleteArgArray( twistedBoxArgs, sizeof( twistedBoxArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 507 |
|
|---|
| 508 | delete twistedTrapCmd;
|
|---|
| 509 | DeleteArgArray( twistedTrapArgs, sizeof( twistedTrapArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 510 |
|
|---|
| 511 | delete twistedTrap2Cmd;
|
|---|
| 512 | DeleteArgArray( twistedTrap2Args, sizeof( twistedTrap2Args)/sizeof(G4UIcmdParg**) );
|
|---|
| 513 |
|
|---|
| 514 | delete twistedTrdCmd;
|
|---|
| 515 | DeleteArgArray( twistedTrdArgs, sizeof( twistedTrdArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 516 |
|
|---|
| 517 | delete twistedTubsCmd;
|
|---|
| 518 | DeleteArgArray( twistedTubsArgs, sizeof( twistedTubsArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 519 | }
|
|---|
| 520 |
|
|---|
| 521 |
|
|---|
| 522 | //
|
|---|
| 523 | // DeleteArgArray
|
|---|
| 524 | //
|
|---|
| 525 | void G4InteractiveSolid::DeleteArgArray( G4UIcmdParg **array, const G4int nItem )
|
|---|
| 526 | {
|
|---|
| 527 | G4UIcmdParg **togo = array;
|
|---|
| 528 | while( togo < array+nItem ) {
|
|---|
| 529 | delete *togo;
|
|---|
| 530 | togo++;
|
|---|
| 531 | }
|
|---|
| 532 | }
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 | //
|
|---|
| 536 | // MakeMeABox
|
|---|
| 537 | //
|
|---|
| 538 | void G4InteractiveSolid::MakeMeABox( G4String values )
|
|---|
| 539 | {
|
|---|
| 540 | if (boxCmd->GetArguments( values )) {
|
|---|
| 541 | delete solid;
|
|---|
| 542 |
|
|---|
| 543 | G4UIcmdPargDouble *dxArg = (G4UIcmdPargDouble *)boxArgs[0],
|
|---|
| 544 | *dyArg = (G4UIcmdPargDouble *)boxArgs[1],
|
|---|
| 545 | *dzArg = (G4UIcmdPargDouble *)boxArgs[2];
|
|---|
| 546 |
|
|---|
| 547 | solid = new G4Box( "interactiveBox", dxArg->GetValue(),
|
|---|
| 548 | dyArg->GetValue(),
|
|---|
| 549 | dzArg->GetValue() );
|
|---|
| 550 | }
|
|---|
| 551 | else
|
|---|
| 552 | G4cerr << "G4Box not created" << G4endl;
|
|---|
| 553 | }
|
|---|
| 554 |
|
|---|
| 555 |
|
|---|
| 556 | //
|
|---|
| 557 | // MakeMeACons
|
|---|
| 558 | //
|
|---|
| 559 | void G4InteractiveSolid::MakeMeACons( G4String values )
|
|---|
| 560 | {
|
|---|
| 561 | if (consCmd->GetArguments( values )) {
|
|---|
| 562 | delete solid;
|
|---|
| 563 |
|
|---|
| 564 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)consArgs;
|
|---|
| 565 |
|
|---|
| 566 | solid = new G4Cons( "interactiveCons", dArg[0]->GetValue(),
|
|---|
| 567 | dArg[1]->GetValue(),
|
|---|
| 568 | dArg[2]->GetValue(),
|
|---|
| 569 | dArg[3]->GetValue(),
|
|---|
| 570 | dArg[4]->GetValue(),
|
|---|
| 571 | dArg[5]->GetValue(),
|
|---|
| 572 | dArg[6]->GetValue() );
|
|---|
| 573 | }
|
|---|
| 574 | else
|
|---|
| 575 | G4cerr << "G4Cons not created" << G4endl;
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 |
|
|---|
| 579 | //
|
|---|
| 580 | // MakeMeAnOrb
|
|---|
| 581 | //
|
|---|
| 582 | void G4InteractiveSolid::MakeMeAnOrb( G4String values )
|
|---|
| 583 | {
|
|---|
| 584 | if (orbCmd->GetArguments( values )) {
|
|---|
| 585 | delete solid;
|
|---|
| 586 |
|
|---|
| 587 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)orbArgs;
|
|---|
| 588 |
|
|---|
| 589 | solid = new G4Orb( "interactiveOrb", dArg[0]->GetValue());
|
|---|
| 590 | }
|
|---|
| 591 | else
|
|---|
| 592 | G4cerr << "G4Orb not created" << G4endl;
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 |
|
|---|
| 596 | //
|
|---|
| 597 | // MakeMeAPara
|
|---|
| 598 | //
|
|---|
| 599 | void G4InteractiveSolid::MakeMeAPara( G4String values )
|
|---|
| 600 | {
|
|---|
| 601 | if (paraCmd->GetArguments( values )) {
|
|---|
| 602 | delete solid;
|
|---|
| 603 |
|
|---|
| 604 | G4UIcmdPargDouble *dxArg = (G4UIcmdPargDouble *)paraArgs[0],
|
|---|
| 605 | *dyArg = (G4UIcmdPargDouble *)paraArgs[1],
|
|---|
| 606 | *dzArg = (G4UIcmdPargDouble *)paraArgs[2],
|
|---|
| 607 | *alphaArg = (G4UIcmdPargDouble *)paraArgs[3],
|
|---|
| 608 | *thetaArg = (G4UIcmdPargDouble *)paraArgs[4],
|
|---|
| 609 | *phiArg = (G4UIcmdPargDouble *)paraArgs[5];
|
|---|
| 610 |
|
|---|
| 611 | solid = new G4Para( "interactivePara", dxArg->GetValue(),
|
|---|
| 612 | dyArg->GetValue(),
|
|---|
| 613 | dzArg->GetValue(),
|
|---|
| 614 | alphaArg->GetValue(),
|
|---|
| 615 | thetaArg->GetValue(),
|
|---|
| 616 | phiArg->GetValue() );
|
|---|
| 617 | }
|
|---|
| 618 | else
|
|---|
| 619 | G4cerr << "G4Para not created" << G4endl;
|
|---|
| 620 | }
|
|---|
| 621 |
|
|---|
| 622 |
|
|---|
| 623 | //
|
|---|
| 624 | // MakeMeASphere
|
|---|
| 625 | //
|
|---|
| 626 | void G4InteractiveSolid::MakeMeASphere( G4String values )
|
|---|
| 627 | {
|
|---|
| 628 | if (sphereCmd->GetArguments( values )) {
|
|---|
| 629 | delete solid;
|
|---|
| 630 |
|
|---|
| 631 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)sphereArgs;
|
|---|
| 632 |
|
|---|
| 633 | solid = new G4Sphere( "interactiveSphere", dArg[0]->GetValue(),
|
|---|
| 634 | dArg[1]->GetValue(),
|
|---|
| 635 | dArg[2]->GetValue(),
|
|---|
| 636 | dArg[3]->GetValue(),
|
|---|
| 637 | dArg[4]->GetValue(),
|
|---|
| 638 | dArg[5]->GetValue() );
|
|---|
| 639 | }
|
|---|
| 640 | else
|
|---|
| 641 | G4cerr << "G4Sphere not created" << G4endl;
|
|---|
| 642 | }
|
|---|
| 643 |
|
|---|
| 644 |
|
|---|
| 645 | //
|
|---|
| 646 | // MakeMeATorus
|
|---|
| 647 | //
|
|---|
| 648 | void G4InteractiveSolid::MakeMeATorus( G4String values )
|
|---|
| 649 | {
|
|---|
| 650 | if (torusCmd->GetArguments( values )) {
|
|---|
| 651 | delete solid;
|
|---|
| 652 |
|
|---|
| 653 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)torusArgs;
|
|---|
| 654 |
|
|---|
| 655 | solid = new G4Torus( "interactiveTorus", dArg[0]->GetValue(),
|
|---|
| 656 | dArg[1]->GetValue(),
|
|---|
| 657 | dArg[2]->GetValue(),
|
|---|
| 658 | dArg[3]->GetValue(),
|
|---|
| 659 | dArg[4]->GetValue() );
|
|---|
| 660 | }
|
|---|
| 661 | else
|
|---|
| 662 | G4cerr << "G4Torus not created" << G4endl;
|
|---|
| 663 | }
|
|---|
| 664 |
|
|---|
| 665 |
|
|---|
| 666 | //
|
|---|
| 667 | // MakeMeATrap
|
|---|
| 668 | //
|
|---|
| 669 | void G4InteractiveSolid::MakeMeATrap( G4String values )
|
|---|
| 670 | {
|
|---|
| 671 | if (trapCmd->GetArguments( values )) {
|
|---|
| 672 | delete solid;
|
|---|
| 673 |
|
|---|
| 674 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)trapArgs;
|
|---|
| 675 |
|
|---|
| 676 | solid = new G4Trap( "interactiveTrap", dArg[0]->GetValue(),
|
|---|
| 677 | dArg[1]->GetValue(),
|
|---|
| 678 | dArg[2]->GetValue(),
|
|---|
| 679 | dArg[3]->GetValue(),
|
|---|
| 680 | dArg[4]->GetValue(),
|
|---|
| 681 | dArg[5]->GetValue(),
|
|---|
| 682 | dArg[6]->GetValue(),
|
|---|
| 683 | dArg[7]->GetValue(),
|
|---|
| 684 | dArg[8]->GetValue(),
|
|---|
| 685 | dArg[9]->GetValue(),
|
|---|
| 686 | dArg[10]->GetValue() );
|
|---|
| 687 | }
|
|---|
| 688 | else
|
|---|
| 689 | G4cerr << "G4Trap not created" << G4endl;
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 |
|
|---|
| 693 | //
|
|---|
| 694 | // MakeMeATrd
|
|---|
| 695 | //
|
|---|
| 696 | void G4InteractiveSolid::MakeMeATrd( G4String values )
|
|---|
| 697 | {
|
|---|
| 698 | if (trdCmd->GetArguments( values )) {
|
|---|
| 699 | delete solid;
|
|---|
| 700 |
|
|---|
| 701 | G4UIcmdPargDouble *dx1Arg = (G4UIcmdPargDouble *)trdArgs[0],
|
|---|
| 702 | *dx2Arg = (G4UIcmdPargDouble *)trdArgs[1],
|
|---|
| 703 | *dy1Arg = (G4UIcmdPargDouble *)trdArgs[2],
|
|---|
| 704 | *dy2Arg = (G4UIcmdPargDouble *)trdArgs[3],
|
|---|
| 705 | *dzArg = (G4UIcmdPargDouble *)trdArgs[4];
|
|---|
| 706 |
|
|---|
| 707 | solid = new G4Trd( "interactiveTrd", dx1Arg->GetValue(),
|
|---|
| 708 | dx2Arg->GetValue(),
|
|---|
| 709 | dy1Arg->GetValue(),
|
|---|
| 710 | dy2Arg->GetValue(),
|
|---|
| 711 | dzArg->GetValue() );
|
|---|
| 712 | }
|
|---|
| 713 | else
|
|---|
| 714 | G4cerr << "G4Trd not created" << G4endl;
|
|---|
| 715 | }
|
|---|
| 716 |
|
|---|
| 717 |
|
|---|
| 718 | //
|
|---|
| 719 | // MakeMeATubs
|
|---|
| 720 | //
|
|---|
| 721 | void G4InteractiveSolid::MakeMeATubs( G4String values )
|
|---|
| 722 | {
|
|---|
| 723 | if (tubsCmd->GetArguments( values )) {
|
|---|
| 724 | delete solid;
|
|---|
| 725 |
|
|---|
| 726 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)tubsArgs;
|
|---|
| 727 |
|
|---|
| 728 | solid = new G4Tubs( "interactiveTubs", dArg[0]->GetValue(),
|
|---|
| 729 | dArg[1]->GetValue(),
|
|---|
| 730 | dArg[2]->GetValue(),
|
|---|
| 731 | dArg[3]->GetValue(),
|
|---|
| 732 | dArg[4]->GetValue() );
|
|---|
| 733 | }
|
|---|
| 734 | else
|
|---|
| 735 | G4cerr << "G4Tubs not created" << G4endl;
|
|---|
| 736 | }
|
|---|
| 737 |
|
|---|
| 738 |
|
|---|
| 739 | //
|
|---|
| 740 | // MakeMeAnEllipsoid
|
|---|
| 741 | //
|
|---|
| 742 | void G4InteractiveSolid::MakeMeAnEllipsoid( G4String values )
|
|---|
| 743 | {
|
|---|
| 744 | if (ellipsoidCmd->GetArguments( values )) {
|
|---|
| 745 | delete solid;
|
|---|
| 746 |
|
|---|
| 747 | G4UIcmdPargDouble *dxArg = (G4UIcmdPargDouble *)ellipsoidArgs[0],
|
|---|
| 748 | *dyArg = (G4UIcmdPargDouble *)ellipsoidArgs[1],
|
|---|
| 749 | *dzArg = (G4UIcmdPargDouble *)ellipsoidArgs[2],
|
|---|
| 750 | *pzBottomCutArg = (G4UIcmdPargDouble *)ellipsoidArgs[3],
|
|---|
| 751 | *pzTopCutArg = (G4UIcmdPargDouble *)ellipsoidArgs[4];
|
|---|
| 752 |
|
|---|
| 753 | solid = new G4Ellipsoid( "interactiveEllipsoid",
|
|---|
| 754 | dxArg->GetValue(),
|
|---|
| 755 | dyArg->GetValue(),
|
|---|
| 756 | dzArg->GetValue(),
|
|---|
| 757 | pzBottomCutArg->GetValue(),
|
|---|
| 758 | pzTopCutArg->GetValue() );
|
|---|
| 759 | }
|
|---|
| 760 | else
|
|---|
| 761 | G4cerr << "G4Ellipsoid not created" << G4endl;
|
|---|
| 762 | }
|
|---|
| 763 |
|
|---|
| 764 |
|
|---|
| 765 | //
|
|---|
| 766 | // MakeMeAnEllipticalTube
|
|---|
| 767 | //
|
|---|
| 768 | void G4InteractiveSolid::MakeMeAnEllipticalCone( G4String values )
|
|---|
| 769 | {
|
|---|
| 770 | if (elConeCmd->GetArguments( values )) {
|
|---|
| 771 | delete solid;
|
|---|
| 772 |
|
|---|
| 773 | G4UIcmdPargDouble *dxArg = (G4UIcmdPargDouble *)elConeArgs[0],
|
|---|
| 774 | *dyArg = (G4UIcmdPargDouble *)elConeArgs[1],
|
|---|
| 775 | *dzArg = (G4UIcmdPargDouble *)elConeArgs[2],
|
|---|
| 776 | *pzTopCutArg = (G4UIcmdPargDouble *)elConeArgs[3];
|
|---|
| 777 |
|
|---|
| 778 | G4cout << "Making G4EllipticalCone: "
|
|---|
| 779 | << dxArg->GetValue() << " "
|
|---|
| 780 | << dyArg->GetValue() << " "
|
|---|
| 781 | << dzArg->GetValue() << " "
|
|---|
| 782 | << pzTopCutArg->GetValue() << G4endl;
|
|---|
| 783 |
|
|---|
| 784 | solid = new G4EllipticalCone( "interactiveEllipticalCone",
|
|---|
| 785 | dxArg->GetValue(),
|
|---|
| 786 | dyArg->GetValue(),
|
|---|
| 787 | dzArg->GetValue(),
|
|---|
| 788 | pzTopCutArg->GetValue() );
|
|---|
| 789 | }
|
|---|
| 790 | else
|
|---|
| 791 | G4cerr << "G4EllipticalCone not created" << G4endl;
|
|---|
| 792 | }
|
|---|
| 793 |
|
|---|
| 794 | //
|
|---|
| 795 | // MakeMeAnEllipticalTube
|
|---|
| 796 | //
|
|---|
| 797 | void G4InteractiveSolid::MakeMeAnEllipticalTube( G4String values )
|
|---|
| 798 | {
|
|---|
| 799 | if (elTubeCmd->GetArguments( values )) {
|
|---|
| 800 | delete solid;
|
|---|
| 801 |
|
|---|
| 802 | G4UIcmdPargDouble *dxArg = (G4UIcmdPargDouble *)elTubeArgs[0],
|
|---|
| 803 | *dyArg = (G4UIcmdPargDouble *)elTubeArgs[1],
|
|---|
| 804 | *dzArg = (G4UIcmdPargDouble *)elTubeArgs[2];
|
|---|
| 805 |
|
|---|
| 806 | solid = new G4EllipticalTube( "interactiveEllipticalTube",
|
|---|
| 807 | dxArg->GetValue(),
|
|---|
| 808 | dyArg->GetValue(),
|
|---|
| 809 | dzArg->GetValue() );
|
|---|
| 810 | }
|
|---|
| 811 | else
|
|---|
| 812 | G4cerr << "G4EllipticalTube not created" << G4endl;
|
|---|
| 813 | }
|
|---|
| 814 |
|
|---|
| 815 | //
|
|---|
| 816 | // MakeMeAnExtrudedSolid
|
|---|
| 817 | //
|
|---|
| 818 | void G4InteractiveSolid::MakeMeAnExtrudedSolid( G4String values )
|
|---|
| 819 | {
|
|---|
| 820 | if (extrudedCmd->GetArguments( values )) {
|
|---|
| 821 | delete solid;
|
|---|
| 822 |
|
|---|
| 823 | G4UIcmdPargInteger *numPointsArg = (G4UIcmdPargInteger*)extrudedArgs[0];
|
|---|
| 824 | G4UIcmdPargListDouble *pgonxArg = (G4UIcmdPargListDouble *)extrudedArgs[1],
|
|---|
| 825 | *pgonyArg = (G4UIcmdPargListDouble *)extrudedArgs[2];
|
|---|
| 826 |
|
|---|
| 827 |
|
|---|
| 828 | G4UIcmdPargInteger *numSidesArg = (G4UIcmdPargInteger*)extrudedArgs[3];
|
|---|
| 829 | G4UIcmdPargListDouble *zArg = (G4UIcmdPargListDouble *)extrudedArgs[4],
|
|---|
| 830 | *offxArg = (G4UIcmdPargListDouble *)extrudedArgs[5],
|
|---|
| 831 | *offyArg = (G4UIcmdPargListDouble *)extrudedArgs[6],
|
|---|
| 832 | *scaleArg = (G4UIcmdPargListDouble *)extrudedArgs[7];
|
|---|
| 833 |
|
|---|
| 834 | std::vector<G4TwoVector> polygon;
|
|---|
| 835 | for ( G4int i=0; i<numPointsArg->GetValue(); ++i ) {
|
|---|
| 836 | polygon.push_back(G4TwoVector(pgonxArg->GetValues()[i], pgonyArg->GetValues()[i]));
|
|---|
| 837 | }
|
|---|
| 838 |
|
|---|
| 839 | std::vector<G4ExtrudedSolid::ZSection> zsections;
|
|---|
| 840 | for ( G4int i=0; i<numSidesArg->GetValue(); ++i ) {
|
|---|
| 841 | zsections.push_back(G4ExtrudedSolid::ZSection(
|
|---|
| 842 | zArg->GetValues()[i],
|
|---|
| 843 | G4TwoVector(offxArg->GetValues()[i], offyArg->GetValues()[i]),
|
|---|
| 844 | scaleArg->GetValues()[i]));
|
|---|
| 845 | }
|
|---|
| 846 |
|
|---|
| 847 | solid = new G4ExtrudedSolid("interactiveExtrudedSolid", polygon, zsections);
|
|---|
| 848 | }
|
|---|
| 849 | else
|
|---|
| 850 | G4cerr << "G4ExtrudedSolid not created" << G4endl;
|
|---|
| 851 | }
|
|---|
| 852 |
|
|---|
| 853 | //
|
|---|
| 854 | // MakeMeAHype
|
|---|
| 855 | //
|
|---|
| 856 | void G4InteractiveSolid::MakeMeAHype( G4String values )
|
|---|
| 857 | {
|
|---|
| 858 | if (hypeCmd->GetArguments( values )) {
|
|---|
| 859 | delete solid;
|
|---|
| 860 |
|
|---|
| 861 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)hypeArgs;
|
|---|
| 862 |
|
|---|
| 863 | solid = new G4Hype( "interactiveHype", dArg[0]->GetValue(),
|
|---|
| 864 | dArg[1]->GetValue(),
|
|---|
| 865 | dArg[2]->GetValue(),
|
|---|
| 866 | dArg[3]->GetValue(),
|
|---|
| 867 | dArg[4]->GetValue() );
|
|---|
| 868 | G4cout << *solid << G4endl;
|
|---|
| 869 | }
|
|---|
| 870 | else
|
|---|
| 871 | G4cerr << "G4Hype not created" << G4endl;
|
|---|
| 872 | }
|
|---|
| 873 |
|
|---|
| 874 |
|
|---|
| 875 | //
|
|---|
| 876 | // MakeMeAPolycone
|
|---|
| 877 | //
|
|---|
| 878 | void G4InteractiveSolid::MakeMeAPolycone( G4String values )
|
|---|
| 879 | {
|
|---|
| 880 | if (polyconeCmd->GetArguments( values )) {
|
|---|
| 881 | G4UIcmdPargDouble *phiStartArg = (G4UIcmdPargDouble *)polyconeArgs[0];
|
|---|
| 882 | G4UIcmdPargDouble *phiTotalArg = (G4UIcmdPargDouble *)polyconeArgs[1];
|
|---|
| 883 | G4UIcmdPargInteger *numRZArg = (G4UIcmdPargInteger *)polyconeArgs[2];
|
|---|
| 884 | G4UIcmdPargListDouble *rArg = (G4UIcmdPargListDouble *)polyconeArgs[3];
|
|---|
| 885 | G4UIcmdPargListDouble *zArg = (G4UIcmdPargListDouble *)polyconeArgs[4];
|
|---|
| 886 |
|
|---|
| 887 | //
|
|---|
| 888 | // Check consistency
|
|---|
| 889 | //
|
|---|
| 890 | G4int numRZ = numRZArg->GetValue();
|
|---|
| 891 | if (numRZ != rArg->GetNItem() ||
|
|---|
| 892 | numRZ != zArg->GetNItem() ) {
|
|---|
| 893 | G4cerr << "numRZ inconsistent among polycone arguments" << G4endl;
|
|---|
| 894 | G4cerr << "G4Polycone not created" << G4endl;
|
|---|
| 895 | return;
|
|---|
| 896 | }
|
|---|
| 897 |
|
|---|
| 898 | delete solid;
|
|---|
| 899 | solid = new G4Polycone( "interactivePolycone",
|
|---|
| 900 | phiStartArg->GetValue(),
|
|---|
| 901 | phiTotalArg->GetValue(),
|
|---|
| 902 | numRZ,
|
|---|
| 903 | rArg->GetValues(),
|
|---|
| 904 | zArg->GetValues() );
|
|---|
| 905 | }
|
|---|
| 906 | else
|
|---|
| 907 | G4cerr << "G4Polycone not created" << G4endl;
|
|---|
| 908 | }
|
|---|
| 909 |
|
|---|
| 910 |
|
|---|
| 911 | //
|
|---|
| 912 | // MakeMeAPolycone2
|
|---|
| 913 | //
|
|---|
| 914 | void G4InteractiveSolid::MakeMeAPolycone2( G4String values )
|
|---|
| 915 | {
|
|---|
| 916 | if (polycone2Cmd->GetArguments( values )) {
|
|---|
| 917 | G4UIcmdPargDouble *phiStartArg = (G4UIcmdPargDouble *)polycone2Args[0];
|
|---|
| 918 | G4UIcmdPargDouble *phiTotalArg = (G4UIcmdPargDouble *)polycone2Args[1];
|
|---|
| 919 | G4UIcmdPargInteger *numRZArg = (G4UIcmdPargInteger *)polycone2Args[2];
|
|---|
| 920 | G4UIcmdPargListDouble *zArg = (G4UIcmdPargListDouble *)polycone2Args[3];
|
|---|
| 921 | G4UIcmdPargListDouble *rInArg = (G4UIcmdPargListDouble *)polycone2Args[4];
|
|---|
| 922 | G4UIcmdPargListDouble *rOutArg = (G4UIcmdPargListDouble *)polycone2Args[5];
|
|---|
| 923 |
|
|---|
| 924 | //
|
|---|
| 925 | // Check consistency
|
|---|
| 926 | //
|
|---|
| 927 | G4int numRZ = numRZArg->GetValue();
|
|---|
| 928 | if (numRZ != zArg->GetNItem() ||
|
|---|
| 929 | numRZ != rInArg->GetNItem() ||
|
|---|
| 930 | numRZ != rOutArg->GetNItem() ) {
|
|---|
| 931 | G4cerr << "numRZ inconsistent among polycone arguments" << G4endl;
|
|---|
| 932 | G4cerr << "G4Polycone not created" << G4endl;
|
|---|
| 933 | return;
|
|---|
| 934 | }
|
|---|
| 935 |
|
|---|
| 936 | delete solid;
|
|---|
| 937 | solid = new G4Polycone( "interactivePolycone",
|
|---|
| 938 | phiStartArg->GetValue(),
|
|---|
| 939 | phiTotalArg->GetValue(),
|
|---|
| 940 | numRZ,
|
|---|
| 941 | zArg->GetValues(),
|
|---|
| 942 | rInArg->GetValues(),
|
|---|
| 943 | rOutArg->GetValues() );
|
|---|
| 944 | }
|
|---|
| 945 | else
|
|---|
| 946 | G4cerr << "G4Polycone not created" << G4endl;
|
|---|
| 947 | }
|
|---|
| 948 |
|
|---|
| 949 |
|
|---|
| 950 | //
|
|---|
| 951 | // MakeMeAPolyhedra
|
|---|
| 952 | //
|
|---|
| 953 | void G4InteractiveSolid::MakeMeAPolyhedra( G4String values )
|
|---|
| 954 | {
|
|---|
| 955 | if (polyhedraCmd->GetArguments( values )) {
|
|---|
| 956 | G4UIcmdPargDouble *phiStartArg = (G4UIcmdPargDouble *)polyhedraArgs[0];
|
|---|
| 957 | G4UIcmdPargDouble *phiTotalArg = (G4UIcmdPargDouble *)polyhedraArgs[1];
|
|---|
| 958 | G4UIcmdPargInteger *numSidesArg = (G4UIcmdPargInteger *)polyhedraArgs[2];
|
|---|
| 959 | G4UIcmdPargInteger *numRZArg = (G4UIcmdPargInteger *)polyhedraArgs[3];
|
|---|
| 960 | G4UIcmdPargListDouble *rArg = (G4UIcmdPargListDouble *)polyhedraArgs[4];
|
|---|
| 961 | G4UIcmdPargListDouble *zArg = (G4UIcmdPargListDouble *)polyhedraArgs[5];
|
|---|
| 962 |
|
|---|
| 963 | //
|
|---|
| 964 | // Check consistency
|
|---|
| 965 | //
|
|---|
| 966 | G4int numRZ = numRZArg->GetValue();
|
|---|
| 967 | if (numRZ != rArg->GetNItem() ||
|
|---|
| 968 | numRZ != zArg->GetNItem() ) {
|
|---|
| 969 | G4cerr << "numRZ inconsistent among polyhedra arguments" << G4endl;
|
|---|
| 970 | G4cerr << "G4Polyhedra not created" << G4endl;
|
|---|
| 971 | return;
|
|---|
| 972 | }
|
|---|
| 973 |
|
|---|
| 974 | delete solid;
|
|---|
| 975 | solid = new G4Polyhedra( "interactivePolyhedra",
|
|---|
| 976 | phiStartArg->GetValue(),
|
|---|
| 977 | phiTotalArg->GetValue(),
|
|---|
| 978 | numSidesArg->GetValue(),
|
|---|
| 979 | numRZ,
|
|---|
| 980 | rArg->GetValues(),
|
|---|
| 981 | zArg->GetValues() );
|
|---|
| 982 | }
|
|---|
| 983 | else
|
|---|
| 984 | G4cerr << "G4Polyhedra not created" << G4endl;
|
|---|
| 985 | }
|
|---|
| 986 |
|
|---|
| 987 |
|
|---|
| 988 | //
|
|---|
| 989 | // MakeMeAPolyhedra2
|
|---|
| 990 | //
|
|---|
| 991 | void G4InteractiveSolid::MakeMeAPolyhedra2( G4String values )
|
|---|
| 992 | {
|
|---|
| 993 | if (polyhedra2Cmd->GetArguments( values )) {
|
|---|
| 994 | G4UIcmdPargDouble *phiStartArg = (G4UIcmdPargDouble *)polyhedra2Args[0];
|
|---|
| 995 | G4UIcmdPargDouble *phiTotalArg = (G4UIcmdPargDouble *)polyhedra2Args[1];
|
|---|
| 996 | G4UIcmdPargInteger *numSidesArg = (G4UIcmdPargInteger *)polyhedra2Args[2];
|
|---|
| 997 | G4UIcmdPargInteger *numRZArg = (G4UIcmdPargInteger *)polyhedra2Args[3];
|
|---|
| 998 | G4UIcmdPargListDouble *zArg = (G4UIcmdPargListDouble *)polyhedra2Args[4];
|
|---|
| 999 | G4UIcmdPargListDouble *rinArg = (G4UIcmdPargListDouble *)polyhedra2Args[5];
|
|---|
| 1000 | G4UIcmdPargListDouble *routArg = (G4UIcmdPargListDouble *)polyhedra2Args[6];
|
|---|
| 1001 |
|
|---|
| 1002 | //
|
|---|
| 1003 | // Check consistency
|
|---|
| 1004 | //
|
|---|
| 1005 | G4int numRZ = numRZArg->GetValue();
|
|---|
| 1006 | if (numRZ != zArg->GetNItem() ||
|
|---|
| 1007 | numRZ != rinArg->GetNItem() ||
|
|---|
| 1008 | numRZ != routArg->GetNItem() ) {
|
|---|
| 1009 | G4cerr << "numRZ inconsistent among polyhedra arguments" << G4endl;
|
|---|
| 1010 | G4cerr << "G4Polyhedra not created" << G4endl;
|
|---|
| 1011 | return;
|
|---|
| 1012 | }
|
|---|
| 1013 |
|
|---|
| 1014 | delete solid;
|
|---|
| 1015 | solid = new G4Polyhedra( "interactivePolyhedra",
|
|---|
| 1016 | phiStartArg->GetValue(),
|
|---|
| 1017 | phiTotalArg->GetValue(),
|
|---|
| 1018 | numSidesArg->GetValue(),
|
|---|
| 1019 | numRZ,
|
|---|
| 1020 | zArg->GetValues(),
|
|---|
| 1021 | rinArg->GetValues(),
|
|---|
| 1022 | routArg->GetValues() );
|
|---|
| 1023 | }
|
|---|
| 1024 | else
|
|---|
| 1025 | G4cerr << "G4Polyhedra not created" << G4endl;
|
|---|
| 1026 | }
|
|---|
| 1027 |
|
|---|
| 1028 |
|
|---|
| 1029 | //
|
|---|
| 1030 | // MakeMeATessellatedSolid
|
|---|
| 1031 | //
|
|---|
| 1032 | void G4InteractiveSolid::MakeMeATessellatedSolid( G4String values )
|
|---|
| 1033 | {
|
|---|
| 1034 | if (tesselCmd->GetArguments( values )) {
|
|---|
| 1035 |
|
|---|
| 1036 | G4UIcmdPargInteger *num3Arg = (G4UIcmdPargInteger*)tesselArgs[0];
|
|---|
| 1037 | G4UIcmdPargListDouble *p1in3Arg = (G4UIcmdPargListDouble *)tesselArgs[1],
|
|---|
| 1038 | *p2in3Arg = (G4UIcmdPargListDouble *)tesselArgs[2],
|
|---|
| 1039 | *p3in3Arg = (G4UIcmdPargListDouble *)tesselArgs[3];
|
|---|
| 1040 |
|
|---|
| 1041 | G4UIcmdPargInteger *num4Arg = (G4UIcmdPargInteger*)tesselArgs[4];
|
|---|
| 1042 | G4UIcmdPargListDouble *p1in4Arg = (G4UIcmdPargListDouble *)tesselArgs[5],
|
|---|
| 1043 | *p2in4Arg = (G4UIcmdPargListDouble *)tesselArgs[6],
|
|---|
| 1044 | *p3in4Arg = (G4UIcmdPargListDouble *)tesselArgs[7],
|
|---|
| 1045 | *p4in4Arg = (G4UIcmdPargListDouble *)tesselArgs[8];
|
|---|
| 1046 |
|
|---|
| 1047 | //
|
|---|
| 1048 | // Check consistency
|
|---|
| 1049 | //
|
|---|
| 1050 | G4int num3 = num3Arg->GetValue();
|
|---|
| 1051 | G4int nump1in3 = p1in3Arg->GetNItem();
|
|---|
| 1052 | G4int nump2in3 = p2in3Arg->GetNItem();
|
|---|
| 1053 | G4int nump3in3 = p3in3Arg->GetNItem();
|
|---|
| 1054 | if ( nump1in3 != 3*num3 || nump2in3 != 3*num3 || nump3in3 != 3*num3 ) {
|
|---|
| 1055 | G4cerr << "Wrong number of points coordinates among triangular tessel arguments" << G4endl;
|
|---|
| 1056 | G4cerr << "G4TessellatedSolid not created" << G4endl;
|
|---|
| 1057 | return;
|
|---|
| 1058 | }
|
|---|
| 1059 | G4int num4 = num4Arg->GetValue();
|
|---|
| 1060 | G4int nump1in4 = p1in4Arg->GetNItem();
|
|---|
| 1061 | G4int nump2in4 = p2in4Arg->GetNItem();
|
|---|
| 1062 | G4int nump3in4 = p3in4Arg->GetNItem();
|
|---|
| 1063 | G4int nump4in4 = p4in4Arg->GetNItem();
|
|---|
| 1064 | if ( nump1in4 != 3*num4 || nump2in4 != 3*num4 || nump3in4 != 3*num4 || nump4in4 != 3*num4) {
|
|---|
| 1065 | G4cerr << "Wrong number of points coordinates among quadrangular tessel arguments" << G4endl;
|
|---|
| 1066 | G4cerr << "G4TessellatedSolid not created" << G4endl;
|
|---|
| 1067 | return;
|
|---|
| 1068 | }
|
|---|
| 1069 |
|
|---|
| 1070 | delete solid;
|
|---|
| 1071 |
|
|---|
| 1072 | G4TessellatedSolid* tessel
|
|---|
| 1073 | = new G4TessellatedSolid( "interactiveTessellatedSolid");
|
|---|
| 1074 |
|
|---|
| 1075 | for ( G4int i=0; i<num3; ++i) {
|
|---|
| 1076 | G4ThreeVector p1(p1in3Arg->GetValues()[3*i+0], p1in3Arg->GetValues()[3*i+1], p1in3Arg->GetValues()[3*i+2]);
|
|---|
| 1077 | G4ThreeVector p2(p2in3Arg->GetValues()[3*i+0], p2in3Arg->GetValues()[3*i+1], p2in3Arg->GetValues()[3*i+2]);
|
|---|
| 1078 | G4ThreeVector p3(p3in3Arg->GetValues()[3*i+0], p3in3Arg->GetValues()[3*i+1], p3in3Arg->GetValues()[3*i+2]);
|
|---|
| 1079 | tessel->AddFacet(new G4TriangularFacet(p1, p2, p3, ABSOLUTE));
|
|---|
| 1080 | }
|
|---|
| 1081 |
|
|---|
| 1082 | for ( G4int i=0; i<num4; ++i) {
|
|---|
| 1083 | G4ThreeVector p1(p1in4Arg->GetValues()[3*i+0], p1in4Arg->GetValues()[3*i+1], p1in4Arg->GetValues()[3*i+2]);
|
|---|
| 1084 | G4ThreeVector p2(p2in4Arg->GetValues()[3*i+0], p2in4Arg->GetValues()[3*i+1], p2in4Arg->GetValues()[3*i+2]);
|
|---|
| 1085 | G4ThreeVector p3(p3in4Arg->GetValues()[3*i+0], p3in4Arg->GetValues()[3*i+1], p3in4Arg->GetValues()[3*i+2]);
|
|---|
| 1086 | G4ThreeVector p4(p4in4Arg->GetValues()[3*i+0], p4in4Arg->GetValues()[3*i+1], p4in4Arg->GetValues()[3*i+2]);
|
|---|
| 1087 | tessel->AddFacet(new G4QuadrangularFacet(p1, p2, p3, p4, ABSOLUTE));
|
|---|
| 1088 | }
|
|---|
| 1089 | tessel->SetSolidClosed(true);
|
|---|
| 1090 | G4cout << *tessel << G4endl;
|
|---|
| 1091 | solid = tessel;
|
|---|
| 1092 |
|
|---|
| 1093 | }
|
|---|
| 1094 | else
|
|---|
| 1095 | G4cerr << "G4TessellatedSolid not created" << G4endl;
|
|---|
| 1096 | }
|
|---|
| 1097 |
|
|---|
| 1098 | //
|
|---|
| 1099 | // MakeMeAnTessellatedSolid2
|
|---|
| 1100 | //
|
|---|
| 1101 | void G4InteractiveSolid::MakeMeATessellatedSolid2( G4String values )
|
|---|
| 1102 | {
|
|---|
| 1103 | if (tessel2Cmd->GetArguments( values )) {
|
|---|
| 1104 | delete solid;
|
|---|
| 1105 |
|
|---|
| 1106 | G4UIcmdPargInteger *numPointsArg = (G4UIcmdPargInteger*)tessel2Args[0];
|
|---|
| 1107 | G4UIcmdPargListDouble *pgonxArg = (G4UIcmdPargListDouble *)tessel2Args[1],
|
|---|
| 1108 | *pgonyArg = (G4UIcmdPargListDouble *)tessel2Args[2];
|
|---|
| 1109 |
|
|---|
| 1110 |
|
|---|
| 1111 | G4UIcmdPargInteger *numSidesArg = (G4UIcmdPargInteger*)tessel2Args[3];
|
|---|
| 1112 | G4UIcmdPargListDouble *zArg = (G4UIcmdPargListDouble *)tessel2Args[4],
|
|---|
| 1113 | *offxArg = (G4UIcmdPargListDouble *)tessel2Args[5],
|
|---|
| 1114 | *offyArg = (G4UIcmdPargListDouble *)tessel2Args[6],
|
|---|
| 1115 | *scaleArg = (G4UIcmdPargListDouble *)tessel2Args[7];
|
|---|
| 1116 |
|
|---|
| 1117 | std::vector<G4TwoVector> polygon;
|
|---|
| 1118 | for ( G4int i=0; i<numPointsArg->GetValue(); ++i ) {
|
|---|
| 1119 | polygon.push_back(G4TwoVector(pgonxArg->GetValues()[i], pgonyArg->GetValues()[i]));
|
|---|
| 1120 | }
|
|---|
| 1121 |
|
|---|
| 1122 | std::vector<G4ExtrudedSolid::ZSection> zsections;
|
|---|
| 1123 | for ( G4int i=0; i<numSidesArg->GetValue(); ++i ) {
|
|---|
| 1124 | zsections.push_back(G4ExtrudedSolid::ZSection(
|
|---|
| 1125 | zArg->GetValues()[i],
|
|---|
| 1126 | G4TwoVector(offxArg->GetValues()[i], offyArg->GetValues()[i]),
|
|---|
| 1127 | scaleArg->GetValues()[i]));
|
|---|
| 1128 | }
|
|---|
| 1129 |
|
|---|
| 1130 | G4ExtrudedSolid* xtru
|
|---|
| 1131 | = new G4ExtrudedSolid("interactiveTessellatedSolid", polygon, zsections);
|
|---|
| 1132 | solid = new G4TessellatedSolid(*xtru);
|
|---|
| 1133 | delete xtru;
|
|---|
| 1134 |
|
|---|
| 1135 | }
|
|---|
| 1136 | else
|
|---|
| 1137 | G4cerr << "G4TessellatedSolid not created" << G4endl;
|
|---|
| 1138 | }
|
|---|
| 1139 |
|
|---|
| 1140 |
|
|---|
| 1141 | //
|
|---|
| 1142 | // MakeMeATet
|
|---|
| 1143 | //
|
|---|
| 1144 | void G4InteractiveSolid::MakeMeATet( G4String values )
|
|---|
| 1145 | {
|
|---|
| 1146 | if (tetCmd->GetArguments( values )) {
|
|---|
| 1147 | G4UIcmdPargListDouble *p1Arg = (G4UIcmdPargListDouble *)tetArgs[0];
|
|---|
| 1148 | G4UIcmdPargListDouble *p2Arg = (G4UIcmdPargListDouble *)tetArgs[1];
|
|---|
| 1149 | G4UIcmdPargListDouble *p3Arg = (G4UIcmdPargListDouble *)tetArgs[2];
|
|---|
| 1150 | G4UIcmdPargListDouble *p4Arg = (G4UIcmdPargListDouble *)tetArgs[3];
|
|---|
| 1151 |
|
|---|
| 1152 | //
|
|---|
| 1153 | // Check consistency
|
|---|
| 1154 | //
|
|---|
| 1155 | G4int numCoor1 = p1Arg->GetNItem();
|
|---|
| 1156 | G4int numCoor2 = p2Arg->GetNItem();
|
|---|
| 1157 | G4int numCoor3 = p3Arg->GetNItem();
|
|---|
| 1158 | G4int numCoor4 = p4Arg->GetNItem();
|
|---|
| 1159 | if (numCoor1 != 3 || numCoor2 != 3 || numCoor3 != 3 || numCoor4 != 3 ) {
|
|---|
| 1160 | G4cerr << "Wrong number of points coordinates among tet arguments" << G4endl;
|
|---|
| 1161 | G4cerr << "G4Tet not created" << G4endl;
|
|---|
| 1162 | return;
|
|---|
| 1163 | }
|
|---|
| 1164 |
|
|---|
| 1165 | delete solid;
|
|---|
| 1166 | G4ThreeVector p1(p1Arg->GetValues()[0], p1Arg->GetValues()[1], p1Arg->GetValues()[2]);
|
|---|
| 1167 | G4ThreeVector p2(p2Arg->GetValues()[0], p2Arg->GetValues()[1], p2Arg->GetValues()[2]);
|
|---|
| 1168 | G4ThreeVector p3(p3Arg->GetValues()[0], p3Arg->GetValues()[1], p3Arg->GetValues()[2]);
|
|---|
| 1169 | G4ThreeVector p4(p4Arg->GetValues()[0], p4Arg->GetValues()[1], p4Arg->GetValues()[2]);
|
|---|
| 1170 |
|
|---|
| 1171 | solid = new G4Tet( "interactiveTet", p1, p2, p3, p4 );
|
|---|
| 1172 | }
|
|---|
| 1173 | else
|
|---|
| 1174 | G4cerr << "G4Tet not created" << G4endl;
|
|---|
| 1175 | }
|
|---|
| 1176 |
|
|---|
| 1177 |
|
|---|
| 1178 | //
|
|---|
| 1179 | // MakeMeABox
|
|---|
| 1180 | //
|
|---|
| 1181 | void G4InteractiveSolid::MakeMeATwistedBox( G4String values )
|
|---|
| 1182 | {
|
|---|
| 1183 | if (twistedBoxCmd->GetArguments( values )) {
|
|---|
| 1184 | delete solid;
|
|---|
| 1185 |
|
|---|
| 1186 | G4UIcmdPargDouble *phiArg = (G4UIcmdPargDouble *)twistedBoxArgs[0],
|
|---|
| 1187 | *dxArg = (G4UIcmdPargDouble *)twistedBoxArgs[1],
|
|---|
| 1188 | *dyArg = (G4UIcmdPargDouble *)twistedBoxArgs[2],
|
|---|
| 1189 | *dzArg = (G4UIcmdPargDouble *)twistedBoxArgs[3];
|
|---|
| 1190 |
|
|---|
| 1191 | solid = new G4TwistedBox( "interactiveTwistedBox",
|
|---|
| 1192 | phiArg->GetValue(),
|
|---|
| 1193 | dxArg->GetValue(),
|
|---|
| 1194 | dyArg->GetValue(),
|
|---|
| 1195 | dzArg->GetValue() );
|
|---|
| 1196 |
|
|---|
| 1197 | G4cout << *solid << G4endl;
|
|---|
| 1198 | }
|
|---|
| 1199 | else
|
|---|
| 1200 | G4cerr << "G4TwistedBox not created" << G4endl;
|
|---|
| 1201 | }
|
|---|
| 1202 |
|
|---|
| 1203 | //
|
|---|
| 1204 | // MakeMeATwistedTrap
|
|---|
| 1205 | //
|
|---|
| 1206 | void G4InteractiveSolid::MakeMeATwistedTrap( G4String values )
|
|---|
| 1207 | {
|
|---|
| 1208 | if (twistedTrapCmd->GetArguments( values )) {
|
|---|
| 1209 | delete solid;
|
|---|
| 1210 |
|
|---|
| 1211 | G4UIcmdPargDouble *phiArg = (G4UIcmdPargDouble *)twistedTrapArgs[0],
|
|---|
| 1212 | *dx1Arg = (G4UIcmdPargDouble *)twistedTrapArgs[1],
|
|---|
| 1213 | *dx2Arg = (G4UIcmdPargDouble *)twistedTrapArgs[2],
|
|---|
| 1214 | *dyArg = (G4UIcmdPargDouble *)twistedTrapArgs[3],
|
|---|
| 1215 | *dzArg = (G4UIcmdPargDouble *)twistedTrapArgs[4];
|
|---|
| 1216 |
|
|---|
| 1217 | solid = new G4TwistedTrap( "interactiveTwistedTrap",
|
|---|
| 1218 | phiArg->GetValue(),
|
|---|
| 1219 | dx1Arg->GetValue(),
|
|---|
| 1220 | dx2Arg->GetValue(),
|
|---|
| 1221 | dyArg->GetValue(),
|
|---|
| 1222 | dzArg->GetValue() );
|
|---|
| 1223 | }
|
|---|
| 1224 | else
|
|---|
| 1225 | G4cerr << "G4TwistedTrap not created" << G4endl;
|
|---|
| 1226 | }
|
|---|
| 1227 |
|
|---|
| 1228 |
|
|---|
| 1229 | //
|
|---|
| 1230 | // MakeMeATwistedTrap
|
|---|
| 1231 | //
|
|---|
| 1232 | void G4InteractiveSolid::MakeMeATwistedTrap2( G4String values )
|
|---|
| 1233 | {
|
|---|
| 1234 | if (twistedTrap2Cmd->GetArguments( values )) {
|
|---|
| 1235 | delete solid;
|
|---|
| 1236 |
|
|---|
| 1237 | G4UIcmdPargDouble **dArg = (G4UIcmdPargDouble **)twistedTrap2Args;
|
|---|
| 1238 |
|
|---|
| 1239 | solid = new G4TwistedTrap( "interactiveTwistedTrap2",
|
|---|
| 1240 | dArg[0]->GetValue(),
|
|---|
| 1241 | dArg[1]->GetValue(),
|
|---|
| 1242 | dArg[2]->GetValue(),
|
|---|
| 1243 | dArg[3]->GetValue(),
|
|---|
| 1244 | dArg[4]->GetValue(),
|
|---|
| 1245 | dArg[5]->GetValue(),
|
|---|
| 1246 | dArg[6]->GetValue(),
|
|---|
| 1247 | dArg[7]->GetValue(),
|
|---|
| 1248 | dArg[8]->GetValue(),
|
|---|
| 1249 | dArg[9]->GetValue(),
|
|---|
| 1250 | dArg[10]->GetValue() );
|
|---|
| 1251 | }
|
|---|
| 1252 | else
|
|---|
| 1253 | G4cerr << "G4TwistedTrap2 not created" << G4endl;
|
|---|
| 1254 | }
|
|---|
| 1255 |
|
|---|
| 1256 | //
|
|---|
| 1257 | // MakeMeATwistedTrd
|
|---|
| 1258 | //
|
|---|
| 1259 | void G4InteractiveSolid::MakeMeATwistedTrd( G4String values )
|
|---|
| 1260 | {
|
|---|
| 1261 | if (twistedTrdCmd->GetArguments( values )) {
|
|---|
| 1262 | delete solid;
|
|---|
| 1263 |
|
|---|
| 1264 | G4UIcmdPargDouble *dx1Arg = (G4UIcmdPargDouble *)twistedTrdArgs[0],
|
|---|
| 1265 | *dx2Arg = (G4UIcmdPargDouble *)twistedTrdArgs[1],
|
|---|
| 1266 | *dy1Arg = (G4UIcmdPargDouble *)twistedTrdArgs[2],
|
|---|
| 1267 | *dy2Arg = (G4UIcmdPargDouble *)twistedTrdArgs[3],
|
|---|
| 1268 | *dzArg = (G4UIcmdPargDouble *)twistedTrdArgs[4],
|
|---|
| 1269 | *phiArg = (G4UIcmdPargDouble *)twistedTrdArgs[5];
|
|---|
| 1270 |
|
|---|
| 1271 | solid = new G4TwistedTrd( "interactiveTwistedTrd",
|
|---|
| 1272 | dx1Arg->GetValue(),
|
|---|
| 1273 | dx2Arg->GetValue(),
|
|---|
| 1274 | dy1Arg->GetValue(),
|
|---|
| 1275 | dy2Arg->GetValue(),
|
|---|
| 1276 | dzArg->GetValue(),
|
|---|
| 1277 | phiArg->GetValue() );
|
|---|
| 1278 | }
|
|---|
| 1279 | else
|
|---|
| 1280 | G4cerr << "G4TwistedTrd not created" << G4endl;
|
|---|
| 1281 | }
|
|---|
| 1282 |
|
|---|
| 1283 |
|
|---|
| 1284 | //
|
|---|
| 1285 | // MakeMeATwistedTubs
|
|---|
| 1286 | //
|
|---|
| 1287 | void G4InteractiveSolid::MakeMeATwistedTubs( G4String values )
|
|---|
| 1288 | {
|
|---|
| 1289 | if (twistedTubsCmd->GetArguments( values )) {
|
|---|
| 1290 | delete solid;
|
|---|
| 1291 |
|
|---|
| 1292 | G4UIcmdPargDouble *phiArg = (G4UIcmdPargDouble *)twistedTubsArgs[0];
|
|---|
| 1293 | G4UIcmdPargDouble *rminArg = (G4UIcmdPargDouble *)twistedTubsArgs[1];
|
|---|
| 1294 | G4UIcmdPargDouble *rmaxArg = (G4UIcmdPargDouble *)twistedTubsArgs[2];
|
|---|
| 1295 | G4UIcmdPargDouble *znegArg = (G4UIcmdPargDouble *)twistedTubsArgs[3];
|
|---|
| 1296 | G4UIcmdPargDouble *zposArg = (G4UIcmdPargDouble *)twistedTubsArgs[4];
|
|---|
| 1297 | G4UIcmdPargInteger *nsegArg = (G4UIcmdPargInteger *)twistedTubsArgs[5];
|
|---|
| 1298 | G4UIcmdPargDouble *totphiArg = (G4UIcmdPargDouble *)twistedTubsArgs[6];
|
|---|
| 1299 |
|
|---|
| 1300 | solid = new G4TwistedTubs( "interactiveTwistedTubs",
|
|---|
| 1301 | phiArg->GetValue(),
|
|---|
| 1302 | rminArg->GetValue(),
|
|---|
| 1303 | rmaxArg->GetValue(),
|
|---|
| 1304 | znegArg->GetValue(),
|
|---|
| 1305 | zposArg->GetValue(),
|
|---|
| 1306 | nsegArg->GetValue(),
|
|---|
| 1307 | totphiArg->GetValue() );
|
|---|
| 1308 |
|
|---|
| 1309 | G4cout << *solid << G4endl;
|
|---|
| 1310 | }
|
|---|
| 1311 | else
|
|---|
| 1312 | G4cerr << "G4TwistedTubs not created" << G4endl;
|
|---|
| 1313 | }
|
|---|
| 1314 |
|
|---|
| 1315 |
|
|---|
| 1316 | //
|
|---|
| 1317 | // MakeMeDircTest
|
|---|
| 1318 | //
|
|---|
| 1319 | void G4InteractiveSolid::MakeMeDircTest()
|
|---|
| 1320 | {
|
|---|
| 1321 | delete solid;
|
|---|
| 1322 |
|
|---|
| 1323 | G4Tubs *outside = new G4Tubs( "OuterFrame", // name (arbitrary)
|
|---|
| 1324 | 1.0*m, // inner radius
|
|---|
| 1325 | 1.1*m, // outer radius
|
|---|
| 1326 | 0.01*m, // half-thickness in z
|
|---|
| 1327 | -15*deg, // start angle
|
|---|
| 1328 | 30*deg ); // total angle
|
|---|
| 1329 |
|
|---|
| 1330 | G4Box *cutout = new G4Box( "Cutout", // name (arbitrary)
|
|---|
| 1331 | 0.02*m, // half-width (x)
|
|---|
| 1332 | 0.25*m, // half-height (y)
|
|---|
| 1333 | 0.01001*m ); // half-thickness (z)
|
|---|
| 1334 |
|
|---|
| 1335 | G4Transform3D tran = G4Translate3D( 1.03*m, 0.0, 0.0 );
|
|---|
| 1336 |
|
|---|
| 1337 | solid = new G4SubtractionSolid( "drcExample", outside, cutout, tran );
|
|---|
| 1338 | }
|
|---|
| 1339 |
|
|---|
| 1340 | //
|
|---|
| 1341 | // BooleanSolid1Test
|
|---|
| 1342 | //
|
|---|
| 1343 | void G4InteractiveSolid::MakeMeBooleanSolid1(G4String)
|
|---|
| 1344 | {
|
|---|
| 1345 | /*
|
|---|
| 1346 | G4IntersectionSolid.hh G4SubtractionSolid.hh G4UnionSolid.hh
|
|---|
| 1347 | all CSGs : Box Tubs Sphere Cons Torus
|
|---|
| 1348 | So: Boolean type operation and 2 CSG Objects with parameters for each (..)
|
|---|
| 1349 | plus a transformation to apply to the second solid
|
|---|
| 1350 | */
|
|---|
| 1351 | delete solid;
|
|---|
| 1352 | BooleanOp OperationType;
|
|---|
| 1353 |
|
|---|
| 1354 | //OperationType = INTERSECTION;
|
|---|
| 1355 | OperationType = SUBTRACTION;
|
|---|
| 1356 |
|
|---|
| 1357 | /*
|
|---|
| 1358 | G4Tubs *outside = new G4Tubs( "OuterFrame", // name (arbitrary)
|
|---|
| 1359 | 1.0*m, // inner radius
|
|---|
| 1360 | 1.1*m, // outer radius
|
|---|
| 1361 | 0.50*m, // half-thickness in z
|
|---|
| 1362 | 0*deg, // start angle
|
|---|
| 1363 | 180*deg ); // total angle
|
|---|
| 1364 | */
|
|---|
| 1365 | /*
|
|---|
| 1366 | G4Torus *outside = new G4Torus( "interactiveTorus",
|
|---|
| 1367 | 0.2*m,
|
|---|
| 1368 | 0.8*m,
|
|---|
| 1369 | 1.4*m,
|
|---|
| 1370 | 0*deg,
|
|---|
| 1371 | 360*deg );
|
|---|
| 1372 | */
|
|---|
| 1373 |
|
|---|
| 1374 | G4Cons *outside = new G4Cons( "OuterFrame",
|
|---|
| 1375 | 0.6*m, // pRmin1
|
|---|
| 1376 | 1.0*m, // pRmax1
|
|---|
| 1377 | 0.2*m, // pRmin2
|
|---|
| 1378 | 0.8*m, // pRmax2
|
|---|
| 1379 | 0.2*m,
|
|---|
| 1380 | 0*deg,
|
|---|
| 1381 | 180*deg );
|
|---|
| 1382 |
|
|---|
| 1383 | /* Dirctest Box cutout
|
|---|
| 1384 | G4Box *cutout = new G4Box( "Cutout", // name (arbitrary)
|
|---|
| 1385 | 0.02*m, // half-width (x)
|
|---|
| 1386 | 0.25*m, // half-height (y)
|
|---|
| 1387 | 0.01001*m ); // half-thickness (z)
|
|---|
| 1388 | */
|
|---|
| 1389 |
|
|---|
| 1390 | /*
|
|---|
| 1391 | G4Tubs *cutout = new G4Tubs("AnotherTubs",
|
|---|
| 1392 | 1.0*m,
|
|---|
| 1393 | 1.1*m,
|
|---|
| 1394 | 0.50*m,
|
|---|
| 1395 | 0*deg,
|
|---|
| 1396 | 180*deg
|
|---|
| 1397 | );
|
|---|
| 1398 | */
|
|---|
| 1399 |
|
|---|
| 1400 |
|
|---|
| 1401 | G4Cons *cutout = new G4Cons( "OuterFrame",
|
|---|
| 1402 | 0.6*m, // pRmin1
|
|---|
| 1403 | 1.0*m, // pRmax1
|
|---|
| 1404 | 0.2*m, // pRmin2
|
|---|
| 1405 | 0.8*m, // pRmax2
|
|---|
| 1406 | 0.2*m,
|
|---|
| 1407 | 0*deg,
|
|---|
| 1408 | 180*deg );
|
|---|
| 1409 |
|
|---|
| 1410 | /*
|
|---|
| 1411 | G4Torus *cutout = new G4Torus( "interactiveTorus",
|
|---|
| 1412 | 0.2*m,
|
|---|
| 1413 | 0.8*m,
|
|---|
| 1414 | 1.4*m,
|
|---|
| 1415 | 0*deg,
|
|---|
| 1416 | 360*deg );
|
|---|
| 1417 |
|
|---|
| 1418 | */
|
|---|
| 1419 |
|
|---|
| 1420 |
|
|---|
| 1421 | G4RotationMatrix rm;
|
|---|
| 1422 | rm.rotateY(pi/4.0);
|
|---|
| 1423 |
|
|---|
| 1424 | G4Transform3D tran = G4Transform3D(rm,G4ThreeVector(0.0,0.0,0.0));
|
|---|
| 1425 |
|
|---|
| 1426 | /* G4Transform3D tran = G4Translate3D( 1.03*m, 0.0, 0.0 ); */
|
|---|
| 1427 |
|
|---|
| 1428 | switch (OperationType) {
|
|---|
| 1429 | case INTERSECTION:
|
|---|
| 1430 | solid = new G4IntersectionSolid( "drcExample", outside, cutout, tran );
|
|---|
| 1431 | break;
|
|---|
| 1432 | case SUBTRACTION:
|
|---|
| 1433 | solid = new G4SubtractionSolid( "drcExample", outside, cutout, tran );
|
|---|
| 1434 | break;
|
|---|
| 1435 | case UNION:
|
|---|
| 1436 | solid = new G4UnionSolid( "drcExample", outside, cutout, tran );
|
|---|
| 1437 | break;
|
|---|
| 1438 | }
|
|---|
| 1439 |
|
|---|
| 1440 | }
|
|---|
| 1441 |
|
|---|
| 1442 |
|
|---|
| 1443 | // G4VPhysicalVolume* ExN03DetectorConstruction::MakeMeDircTest()
|
|---|
| 1444 |
|
|---|
| 1445 | //
|
|---|
| 1446 | // SetNewValue
|
|---|
| 1447 | //
|
|---|
| 1448 | // Invoked by the UI when the user enters a command
|
|---|
| 1449 | //
|
|---|
| 1450 | void G4InteractiveSolid::SetNewValue( G4UIcommand *command, G4String newValues )
|
|---|
| 1451 | {
|
|---|
| 1452 | /*
|
|---|
| 1453 | We want to retrieve the current solid
|
|---|
| 1454 | So we keep the current solid command
|
|---|
| 1455 | */
|
|---|
| 1456 |
|
|---|
| 1457 |
|
|---|
| 1458 | G4String CurrentSolid = command->GetCommandPath() + " " + newValues ;
|
|---|
| 1459 |
|
|---|
| 1460 | SBTrun::SetCurrentSolid (CurrentSolid);
|
|---|
| 1461 |
|
|---|
| 1462 | if (command == boxCmd)
|
|---|
| 1463 | MakeMeABox( newValues );
|
|---|
| 1464 | else if (command == consCmd)
|
|---|
| 1465 | MakeMeACons( newValues );
|
|---|
| 1466 | else if (command == orbCmd)
|
|---|
| 1467 | MakeMeAnOrb( newValues );
|
|---|
| 1468 | else if (command == paraCmd)
|
|---|
| 1469 | MakeMeAPara( newValues );
|
|---|
| 1470 | else if (command == sphereCmd)
|
|---|
| 1471 | MakeMeASphere( newValues );
|
|---|
| 1472 | else if (command == torusCmd)
|
|---|
| 1473 | MakeMeATorus( newValues );
|
|---|
| 1474 | else if (command == trapCmd)
|
|---|
| 1475 | MakeMeATrap( newValues );
|
|---|
| 1476 | else if (command == trdCmd)
|
|---|
| 1477 | MakeMeATrd( newValues );
|
|---|
| 1478 | else if (command == tubsCmd)
|
|---|
| 1479 | MakeMeATubs( newValues );
|
|---|
| 1480 | else if (command == ellipsoidCmd)
|
|---|
| 1481 | MakeMeAnEllipsoid( newValues );
|
|---|
| 1482 | else if (command == elConeCmd)
|
|---|
| 1483 | MakeMeAnEllipticalCone( newValues );
|
|---|
| 1484 | else if (command == elTubeCmd)
|
|---|
| 1485 | MakeMeAnEllipticalTube( newValues );
|
|---|
| 1486 | else if (command == extrudedCmd)
|
|---|
| 1487 | MakeMeAnExtrudedSolid( newValues );
|
|---|
| 1488 | else if (command == hypeCmd)
|
|---|
| 1489 | MakeMeAHype( newValues );
|
|---|
| 1490 | else if (command == polyconeCmd)
|
|---|
| 1491 | MakeMeAPolycone( newValues );
|
|---|
| 1492 | else if (command == polycone2Cmd)
|
|---|
| 1493 | MakeMeAPolycone2( newValues );
|
|---|
| 1494 | else if (command == polyhedraCmd)
|
|---|
| 1495 | MakeMeAPolyhedra( newValues );
|
|---|
| 1496 | else if (command == polyhedra2Cmd)
|
|---|
| 1497 | MakeMeAPolyhedra2( newValues );
|
|---|
| 1498 | else if (command == tesselCmd)
|
|---|
| 1499 | MakeMeATessellatedSolid( newValues );
|
|---|
| 1500 | else if (command == tessel2Cmd)
|
|---|
| 1501 | MakeMeATessellatedSolid2( newValues );
|
|---|
| 1502 | else if (command == tetCmd)
|
|---|
| 1503 | MakeMeATet( newValues );
|
|---|
| 1504 | else if (command == twistedBoxCmd)
|
|---|
| 1505 | MakeMeATwistedBox( newValues );
|
|---|
| 1506 | else if (command == twistedTrapCmd)
|
|---|
| 1507 | MakeMeATwistedTrap( newValues );
|
|---|
| 1508 | else if (command == twistedTrap2Cmd)
|
|---|
| 1509 | MakeMeATwistedTrap2( newValues );
|
|---|
| 1510 | else if (command == twistedTrdCmd)
|
|---|
| 1511 | MakeMeATwistedTrd( newValues );
|
|---|
| 1512 | else if (command == dircTestCmd)
|
|---|
| 1513 | MakeMeDircTest();
|
|---|
| 1514 | else if (command == twistedTubsCmd)
|
|---|
| 1515 | MakeMeATwistedTubs( newValues );
|
|---|
| 1516 | else if (command == BooleanSolid1Cmd)
|
|---|
| 1517 | MakeMeBooleanSolid1(newValues);
|
|---|
| 1518 |
|
|---|
| 1519 | /* Here to add new boolean solids */
|
|---|
| 1520 |
|
|---|
| 1521 | else
|
|---|
| 1522 | G4Exception( "Unrecognized command" );
|
|---|
| 1523 | }
|
|---|
| 1524 |
|
|---|
| 1525 |
|
|---|
| 1526 | //
|
|---|
| 1527 | // GetCurrentValue
|
|---|
| 1528 | //
|
|---|
| 1529 | G4String G4InteractiveSolid::GetCurrentValue( G4UIcommand *command )
|
|---|
| 1530 | {
|
|---|
| 1531 | if (command == boxCmd)
|
|---|
| 1532 | return ConvertArgsToString( boxArgs, sizeof( boxArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1533 | else if (command == consCmd)
|
|---|
| 1534 | return ConvertArgsToString( consArgs, sizeof( consArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1535 | else if (command == orbCmd)
|
|---|
| 1536 | return ConvertArgsToString( orbArgs, sizeof( orbArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1537 | else if (command == paraCmd)
|
|---|
| 1538 | return ConvertArgsToString( paraArgs, sizeof( paraArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1539 | else if (command == sphereCmd)
|
|---|
| 1540 | return ConvertArgsToString( sphereArgs, sizeof( sphereArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1541 | else if (command == torusCmd)
|
|---|
| 1542 | return ConvertArgsToString( torusArgs, sizeof( torusArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1543 | else if (command == trapCmd)
|
|---|
| 1544 | return ConvertArgsToString( trapArgs, sizeof( trapArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1545 | else if (command == trdCmd)
|
|---|
| 1546 | return ConvertArgsToString( trdArgs, sizeof( trdArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1547 | else if (command == tubsCmd)
|
|---|
| 1548 | return ConvertArgsToString( tubsArgs, sizeof( tubsArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1549 | else if (command == ellipsoidCmd)
|
|---|
| 1550 | return ConvertArgsToString( ellipsoidArgs, sizeof( ellipsoidArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1551 | else if (command == elConeCmd)
|
|---|
| 1552 | return ConvertArgsToString( elConeArgs, sizeof( elConeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1553 | else if (command == elTubeCmd)
|
|---|
| 1554 | return ConvertArgsToString( elTubeArgs, sizeof( elTubeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1555 | else if (command == extrudedCmd)
|
|---|
| 1556 | return ConvertArgsToString( extrudedArgs, sizeof( extrudedArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1557 | else if (command == hypeCmd)
|
|---|
| 1558 | return ConvertArgsToString( hypeArgs, sizeof( hypeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1559 | else if (command == polyconeCmd)
|
|---|
| 1560 | return ConvertArgsToString( polyconeArgs, sizeof( polyconeArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1561 | else if (command == polycone2Cmd)
|
|---|
| 1562 | return ConvertArgsToString( polycone2Args, sizeof(polycone2Args)/sizeof(G4UIcmdParg**) );
|
|---|
| 1563 | else if (command == polyhedraCmd)
|
|---|
| 1564 | return ConvertArgsToString( polyhedraArgs, sizeof(polyhedraArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1565 | else if (command == polyhedra2Cmd)
|
|---|
| 1566 | return ConvertArgsToString( polyhedra2Args, sizeof(polyhedra2Args)/sizeof(G4UIcmdParg**) );
|
|---|
| 1567 | else if (command == tesselCmd)
|
|---|
| 1568 | return ConvertArgsToString( tesselArgs, sizeof( tesselArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1569 | else if (command == tessel2Cmd)
|
|---|
| 1570 | return ConvertArgsToString( tessel2Args, sizeof( tessel2Args)/sizeof(G4UIcmdParg**) );
|
|---|
| 1571 | else if (command == tetCmd)
|
|---|
| 1572 | return ConvertArgsToString( tetArgs, sizeof( tetArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1573 | else if (command == twistedBoxCmd)
|
|---|
| 1574 | return ConvertArgsToString( twistedBoxArgs, sizeof( twistedBoxArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1575 | else if (command == twistedTrapCmd)
|
|---|
| 1576 | return ConvertArgsToString(twistedTrapArgs, sizeof( twistedTrapArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1577 | else if (command == twistedTrap2Cmd)
|
|---|
| 1578 | return ConvertArgsToString(twistedTrap2Args,sizeof(twistedTrap2Args)/sizeof(G4UIcmdParg**) );
|
|---|
| 1579 | else if (command == twistedTrdCmd)
|
|---|
| 1580 | return ConvertArgsToString( twistedTrdArgs, sizeof( twistedTrdArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1581 | else if (command == twistedTubsCmd)
|
|---|
| 1582 | return ConvertArgsToString(twistedTubsArgs, sizeof( twistedTubsArgs)/sizeof(G4UIcmdParg**) );
|
|---|
| 1583 | else if (command == dircTestCmd)
|
|---|
| 1584 | return "";
|
|---|
| 1585 |
|
|---|
| 1586 | G4Exception( "Unrecognized command" );
|
|---|
| 1587 | return "foo!";
|
|---|
| 1588 | }
|
|---|
| 1589 |
|
|---|
| 1590 |
|
|---|
| 1591 | //
|
|---|
| 1592 | // ConvertArgsToString
|
|---|
| 1593 | //
|
|---|
| 1594 | G4String G4InteractiveSolid::ConvertArgsToString( G4UIcmdParg **array, const G4int nItem )
|
|---|
| 1595 | {
|
|---|
| 1596 | G4String answer = "(";
|
|---|
| 1597 |
|
|---|
| 1598 | G4UIcmdParg **togo = array;
|
|---|
| 1599 | while( togo < array+nItem ) {
|
|---|
| 1600 | if (togo > array) answer += ",";
|
|---|
| 1601 | answer += (*togo)->ConvertToString();
|
|---|
| 1602 | togo++;
|
|---|
| 1603 | }
|
|---|
| 1604 |
|
|---|
| 1605 | return answer + ")";
|
|---|
| 1606 | }
|
|---|
| 1607 |
|
|---|
| 1608 |
|
|---|