source: trunk/source/geometry/solids/test/SBT/include/SBTrun.hh @ 1316

Last change on this file since 1316 was 1316, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 5.0 KB
Line 
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// SBTrun.hh
28//
29// Definition of the batch solid test
30//
31
32#ifndef SBTrun_hh
33#define SBTrun_hh
34
35#include <iostream>
36#include "G4VSolid.hh"
37#include "G4ThreeVector.hh"
38
39
40class SBTVisManager;
41
42//
43// This is a list of points we keep track of. The definition below
44// is a little sloppy.
45//
46class SBTrunPointList {
47        public:
48        SBTrunPointList( G4int size );
49        ~SBTrunPointList();
50       
51        void AddPoint( G4ThreeVector newPoint );
52        inline G4ThreeVector operator[] (G4int i ) const { return pointList[i]; }
53       
54        inline G4int NumPoints() const { return numPoints; }
55       
56        protected:
57        G4ThreeVector   *pointList;
58        G4int           numPoints;
59        G4int           maxPoints;
60};
61
62
63
64class SBTrun {
65
66        public:
67        SBTrun();
68        ~SBTrun();
69        void SetDefaults();
70       
71        void RunTest( const G4VSolid *testVolume, std::ostream &logger );
72
73        G4int DrawError( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex,
74                         SBTVisManager *visManager ) const;
75        G4int DebugInside( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex ) const;
76        G4int DebugToInP( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex ) const;
77        G4int DebugToInPV( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex ) const;
78        G4int DebugToOutP( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex ) const;
79        G4int DebugToOutPV( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex ) const;
80        G4int DebugSurfNorm( const G4VSolid *testVolume, std::istream &logger, const G4int errorIndex ) const;
81
82        inline void SetTarget( const G4ThreeVector &newTarget ) { target = newTarget; }
83        inline G4ThreeVector GetTarget() const { return target; }
84
85        inline void SetWidths( const G4ThreeVector &newWidths ) { widths = newWidths; }
86        inline G4ThreeVector GetWidths() const { return widths; }
87       
88        inline void SetGrids( const G4ThreeVector &newGrids ) { grids = newGrids; }
89        inline G4ThreeVector GetGrids() const { return grids; }
90       
91        inline void SetMaxPoints( const G4int newMaxPoints ) { maxPoints = newMaxPoints; }
92        inline G4int GetMaxPoints() const { return maxPoints; }
93       
94        inline void SetMaxErrors( const G4int newMaxErrors ) { maxErrors = newMaxErrors; }
95        inline G4int GetMaxErrors() const { return maxErrors; }
96
97  static G4String GetCurrentSolid(void) ; 
98  static void SetCurrentSolid(G4String SolidName) ;
99
100        protected:
101        G4ThreeVector   GetRandomPoint() const;
102        G4double        GaussianRandom(const G4double cutoff) const;
103       
104        void    TestOutsidePoint( const G4VSolid *testVolume, G4int *nError,
105                                  const SBTrunPointList *inside, const SBTrunPointList *outside, 
106                                  const G4ThreeVector point, std::ostream &logger );
107        void    TestInsidePoint(  const G4VSolid *testVolume, G4int *nError,
108                                  const SBTrunPointList *inside, const G4ThreeVector point, std::ostream &logger );
109
110        void    ReportError( G4int *nError, const G4ThreeVector p, 
111                             const G4ThreeVector v, G4double distance,
112                             const G4String comment, std::ostream &logger );
113        void    ClearErrors();         
114        G4int   CountErrors() const;           
115       
116        G4int   GetLoggedPV( std::istream &logger, const G4int errorIndex,
117                             G4ThreeVector &p, G4ThreeVector &v        ) const;
118       
119        protected:
120        G4ThreeVector   target,
121                        widths,
122                        grids;
123        G4int           maxPoints,
124                        maxErrors;
125       
126                       
127       
128        typedef struct sSBTrunErrorList {
129                G4String        message;
130                G4int           nUsed;
131                struct sSBTrunErrorList *next;
132        } SBTrunErrorList;
133       
134        SBTrunErrorList *errorList;
135
136        private:
137  static G4String CurrentSolid; /* Solid to be tested, used to visualize */
138   
139
140};
141
142#endif
Note: See TracBrowser for help on using the repository browser.