| [1316] | 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 | // $Id: testG4TwistedTubs.cc,v 1.4 2006/06/29 18:49:55 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name:
|
|---|
| 29 | //
|
|---|
| 30 |
|
|---|
| 31 | // testG4TwistedTubs
|
|---|
| 32 | //
|
|---|
| 33 | // Test file for class G4TwistedTubs
|
|---|
| 34 | //
|
|---|
| 35 | // Ensure asserts are compiled in
|
|---|
| 36 |
|
|---|
| 37 | #include <assert.h>
|
|---|
| 38 | #include <cmath>
|
|---|
| 39 |
|
|---|
| 40 | #include "globals.hh"
|
|---|
| 41 | #include "geomdefs.hh"
|
|---|
| 42 |
|
|---|
| 43 | #include "ApproxEqual.hh"
|
|---|
| 44 |
|
|---|
| 45 | #include "G4ThreeVector.hh"
|
|---|
| 46 | #include "G4TwistedTubs.hh"
|
|---|
| 47 | #include "G4RotationMatrix.hh"
|
|---|
| 48 | #include "G4AffineTransform.hh"
|
|---|
| 49 | #include "G4VoxelLimits.hh"
|
|---|
| 50 |
|
|---|
| 51 | G4bool testG4TwistedTubs()
|
|---|
| 52 | {
|
|---|
| 53 | G4ThreeVector pzero(0,0,0);
|
|---|
| 54 |
|
|---|
| 55 | G4ThreeVector pbigx(100,0,0),pbigy(0,100,0),pbigz(0,0,100);
|
|---|
| 56 | G4ThreeVector pbigmx(-100,0,0),pbigmy(0,-100,0),pbigmz(0,0,-100);
|
|---|
| 57 | G4ThreeVector pin1 ;
|
|---|
| 58 |
|
|---|
| 59 | double Rin=10*cm;
|
|---|
| 60 | double Rout=15*cm;
|
|---|
| 61 | double alpha=10*deg;
|
|---|
| 62 | double phi1=90*deg;
|
|---|
| 63 | double len=40*cm;
|
|---|
| 64 |
|
|---|
| 65 | G4TwistedTubs t1("Solid Twisted Tub #1",alpha,Rin,Rout,len,phi1);
|
|---|
| 66 |
|
|---|
| 67 | G4ThreeVector Spoint ;
|
|---|
| 68 | G4ThreeVector Opoint ;
|
|---|
| 69 | G4ThreeVector dir ;
|
|---|
| 70 | G4double dist ;
|
|---|
| 71 | G4ThreeVector nvec ;
|
|---|
| 72 |
|
|---|
| 73 | for ( int i = 0 ; i < 10 ; i++ ) {
|
|---|
| 74 | // G4cout << "Event " << i << G4endl << G4endl ;
|
|---|
| 75 | Spoint = t1.GetPointOnSurface() ;
|
|---|
| 76 | nvec = t1.SurfaceNormal(Spoint) ;
|
|---|
| 77 | dir = - nvec ;
|
|---|
| 78 | dist = t1.DistanceToIn(Spoint,dir/dir.mag()) ;
|
|---|
| 79 | G4cout << "Spoint " << Spoint << " " << dist << G4endl ;
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | return true;
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | int main()
|
|---|
| 87 | {
|
|---|
| 88 | #ifdef NDEBUG
|
|---|
| 89 | G4Exception("FAIL: *** Assertions must be compiled in! ***");
|
|---|
| 90 | #endif
|
|---|
| 91 | assert(testG4TwistedTubs());
|
|---|
| 92 | return 0;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|