| 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 | // SBTvoxel.hh
|
|---|
| 28 | //
|
|---|
| 29 | // Definition of a batch based voxel test
|
|---|
| 30 | //
|
|---|
| 31 | #ifndef SBTvoxel_hh
|
|---|
| 32 | #define SBTvoxel_hh
|
|---|
| 33 |
|
|---|
| 34 | #include "globals.hh"
|
|---|
| 35 | #include "G4ThreeVector.hh"
|
|---|
| 36 | #include "geomdefs.hh"
|
|---|
| 37 | #include <iostream>
|
|---|
| 38 |
|
|---|
| 39 | class G4VSolid;
|
|---|
| 40 | class G4VoxelLimits;
|
|---|
| 41 | class G4AffineTransform;
|
|---|
| 42 |
|
|---|
| 43 | class SBTVisManager;
|
|---|
| 44 |
|
|---|
| 45 | class SBTvoxel {
|
|---|
| 46 | public:
|
|---|
| 47 | SBTvoxel();
|
|---|
| 48 | ~SBTvoxel();
|
|---|
| 49 |
|
|---|
| 50 | void SetDefaults();
|
|---|
| 51 |
|
|---|
| 52 | void RunTest( const G4VSolid *testVolume, std::ostream &logger );
|
|---|
| 53 |
|
|---|
| 54 | void Draw( const G4VSolid *testVolume,
|
|---|
| 55 | const G4VoxelLimits &voxel, const G4AffineTransform &transform,
|
|---|
| 56 | const G4ThreeVector *points, const G4int numPoints,
|
|---|
| 57 | const EAxis axis, const G4double limits[2],
|
|---|
| 58 | SBTVisManager *visManager ) const;
|
|---|
| 59 |
|
|---|
| 60 | void Debug( const G4VSolid *testVolume, const EAxis axis,
|
|---|
| 61 | const G4VoxelLimits &voxel, const G4AffineTransform &transform,
|
|---|
| 62 | const G4ThreeVector *point ) const;
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | void SetTarget( const G4ThreeVector &newTarget ) { target = newTarget; }
|
|---|
| 67 | G4ThreeVector GetTarget() const { return target; }
|
|---|
| 68 |
|
|---|
| 69 | void SetMaxVoxels( const G4int newMaxVoxels ) { maxVoxels = newMaxVoxels; }
|
|---|
| 70 | G4int GetMaxVoxels() const { return maxVoxels; }
|
|---|
| 71 |
|
|---|
| 72 | void SetMaxErrors( const G4int newMaxErrors ) { maxErrors = newMaxErrors; }
|
|---|
| 73 | G4int GetMaxErrors() const { return maxErrors; }
|
|---|
| 74 |
|
|---|
| 75 | inline void SetWidths( const G4ThreeVector &newWidths ) { widths = newWidths; }
|
|---|
| 76 | inline G4ThreeVector GetWidths() const { return widths; }
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 | protected:
|
|---|
| 80 | G4ThreeVector target,
|
|---|
| 81 | widths;
|
|---|
| 82 | G4int maxVoxels,
|
|---|
| 83 | maxErrors;
|
|---|
| 84 |
|
|---|
| 85 | G4bool TestOneVoxel( const G4VSolid *testVolume,
|
|---|
| 86 | const G4VoxelLimits &voxel,
|
|---|
| 87 | const G4AffineTransform &transform,
|
|---|
| 88 | const G4ThreeVector inside[], const G4int numInside,
|
|---|
| 89 | std::ostream &logger ) const;
|
|---|
| 90 |
|
|---|
| 91 | void GetInsidePoints( const G4VSolid *testVolume,
|
|---|
| 92 | G4ThreeVector inside[], G4int *numInside,
|
|---|
| 93 | const G4int numPoints,
|
|---|
| 94 | const G4int numAttempts ) const;
|
|---|
| 95 |
|
|---|
| 96 | G4ThreeVector GetRandomPoint() const;
|
|---|
| 97 |
|
|---|
| 98 | G4double GaussianRandom(const G4double cutoff) const;
|
|---|
| 99 |
|
|---|
| 100 | G4bool GetRandomLimit( G4double x[2], const G4double range ) const;
|
|---|
| 101 |
|
|---|
| 102 | G4VoxelLimits *NewRandomVoxel( const G4ThreeVector &theWidths ) const;
|
|---|
| 103 |
|
|---|
| 104 | void DumpVoxel( const G4VoxelLimits &voxel, std::ostream &logger ) const;
|
|---|
| 105 |
|
|---|
| 106 | void DumpTransform( const G4AffineTransform &transform, std::ostream &logger ) const;
|
|---|
| 107 |
|
|---|
| 108 | void MakeVoxelTestPoints( const G4VoxelLimits &voxel,
|
|---|
| 109 | const EAxis axis, const G4double value,
|
|---|
| 110 | G4ThreeVector testPoints[9] ) const;
|
|---|
| 111 | };
|
|---|
| 112 |
|
|---|
| 113 | #endif
|
|---|