| 71 | } |
| 72 | |
| 73 | void G4GPSModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) |
| 74 | // The main task of a model is to describe itself to the graphics scene |
| 75 | // handler (a object which inherits G4VSceneHandler, which inherits |
| 76 | // G4VGraphicsScene). |
| 77 | { |
| 78 | G4GeneralParticleSourceData* pGPSData = G4GeneralParticleSourceData::Instance(); |
| 79 | // Note: As far as I can see, if this is the first time Instance has been |
| 80 | // called, it will, nevertheless, instantiate a default source, Type:"Point", |
| 81 | // Shaep: "NULL", which will be drawn as a small circle at the origin of |
| 82 | // coordinates whether you have set up GPS or not. Sorry, can't think of a |
| 83 | // way to avoid that. Mostly, of course, you will only invoke this function, |
| 84 | // if you have - or are about to - set up GPS, in which case all will be well. |
| 85 | if (!pGPSData) return; |
| 86 | |
| 87 | G4int nSources = pGPSData->GetSourceVectorSize(); |
| 88 | for (G4int iSource = 0; iSource < nSources; ++iSource) { |
| 89 | |
| 90 | const G4SingleParticleSource* pCurrentSingleSource = pGPSData->GetCurrentSource(iSource); |
| 91 | if (!pCurrentSingleSource) return; |
| 92 | |
| 93 | const G4SPSPosDistribution* pSPSPosDistribution = pCurrentSingleSource->GetPosDist(); |
| 94 | if (!pSPSPosDistribution) return; |
| 95 | |
| 96 | G4String Type = pSPSPosDistribution->GetPosDisType(); |
| 97 | G4String Shape = pSPSPosDistribution->GetPosDisShape(); |
| 98 | // Type can be: Point, Plane, Surface or Volume |
| 99 | // Shape can be: Square, Circle, Ellipse, Rectangle, |
| 100 | // Sphere, Ellipsoid, Cylinder, Parallelepiped |
| 101 | // G4cout |
| 102 | // << "G4GPSModel::DescribeYourselfTo" |
| 103 | // << ": PosDisType: " << Type |
| 104 | // << ", Shape: " << Shape |
| 105 | // << G4endl; |
| 106 | |
| 107 | const G4double& halfx = pSPSPosDistribution->GetHalfX(); |
| 108 | const G4double& halfy = pSPSPosDistribution->GetHalfY(); |
| 109 | const G4double& halfz = pSPSPosDistribution->GetHalfZ(); |
| 110 | const G4double& Radius = pSPSPosDistribution->GetRadius(); |
| 111 | const G4double& Radius0 = pSPSPosDistribution->GetRadius0(); |
| 112 | const G4double& ParAlpha = pSPSPosDistribution->GetParAlpha(); |
| 113 | const G4double& ParTheta = pSPSPosDistribution->GetParTheta(); |
| 114 | const G4double& ParPhi = pSPSPosDistribution->GetParPhi(); |
| 115 | |
| 116 | const G4ThreeVector& Rotx = pSPSPosDistribution->GetRotx(); |
| 117 | const G4ThreeVector& Roty = pSPSPosDistribution->GetRoty(); |
| 118 | const G4ThreeVector& Rotz = pSPSPosDistribution->GetRotz(); |
| 119 | |
| 120 | const G4ThreeVector& position = pSPSPosDistribution->GetCentreCoords(); |
| 121 | G4Transform3D transform(CLHEP::HepXHat,CLHEP::HepYHat,CLHEP::HepZHat,Rotx,Roty,Rotz); |
| 122 | transform = G4Translate3D(position) * transform; |
| 123 | |
| 124 | G4double surfaceTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance(); |
| 125 | G4double smallHalfThickness = 10.*surfaceTolerance; |
| 126 | |
| 127 | G4VisAttributes gpsAtts; |
| 128 | gpsAtts.SetColour(fColour); |
| 129 | gpsAtts.SetForceSolid(); |
| 130 |
no test coverage detected