source: trunk/source/geometry/navigation/src/G4GeomTestErrorList.cc@ 1274

Last change on this file since 1274 was 1228, checked in by garnier, 16 years ago

update geant4.9.3 tag

File size: 4.8 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// $Id: G4GeomTestErrorList.cc,v 1.3 2006/06/29 18:36:36 gunter Exp $
28// GEANT4 tag $Name: geant4-09-03 $
29//
30// --------------------------------------------------------------------
31// GEANT 4 class source file
32//
33// G4GeomTestErrorList
34//
35// Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu)
36// --------------------------------------------------------------------
37
38#include "G4GeomTestErrorList.hh"
39#include "G4VPhysicalVolume.hh"
40#include "G4TransportationManager.hh"
41#include "G4TouchableHistoryHandle.hh"
42
43//
44// Constructor
45//
46G4GeomTestErrorList::G4GeomTestErrorList( const G4VPhysicalVolume *theMother )
47 : mother(theMother)
48{
49 FindGlobalCoordinateSystem();
50}
51
52
53//
54// Destructor
55//
56G4GeomTestErrorList::~G4GeomTestErrorList() {;}
57
58
59//
60// AddError
61//
62// Add a new Error point to our list, where the point
63// is given in the coordinate system of the mother
64//
65void G4GeomTestErrorList::AddError( const G4ThreeVector &s1,
66 const G4ThreeVector &s2 )
67{
68 segments.push_back( Segment(s1,s2) );
69}
70
71
72//
73// Accessors
74//
75const G4VPhysicalVolume *G4GeomTestErrorList::GetMother() const
76{
77 return mother;
78}
79
80
81//
82// Return number of segments
83//
84G4int G4GeomTestErrorList::NumError() const
85{
86 return segments.size();
87}
88
89
90//
91// GetMotherPoints
92//
93// Return start and end points in the coordinate system
94// of the mother
95//
96void G4GeomTestErrorList::GetMotherPoints( G4int i,
97 G4ThreeVector &s1,
98 G4ThreeVector &s2 ) const
99{
100 s1 = segments[i].GetS1();
101 s2 = segments[i].GetS2();
102}
103
104
105//
106// GetGlobalPoints
107//
108// Return start and end points in the global coordinate system
109//
110void G4GeomTestErrorList::GetGlobalPoints( G4int i,
111 G4ThreeVector &s1,
112 G4ThreeVector &s2 ) const
113{
114 s1 = globalTranslation + globalRotation*segments[i].GetS1();
115 s2 = globalTranslation + globalRotation*segments[i].GetS2();
116}
117
118
119//
120// GetOneDaughtPoints
121//
122// Return start and end points in the coordinate system of
123// a daughter
124//
125void G4GeomTestErrorList::GetOneDaughtPoints( const G4VPhysicalVolume *daught,
126 G4int i,
127 G4ThreeVector &s1,
128 G4ThreeVector &s2 ) const
129{
130 const G4RotationMatrix *rotation = daught->GetFrameRotation();
131 const G4ThreeVector &translation = daught->GetFrameTranslation();
132
133 if (rotation) {
134 s1 = (*rotation)*(translation + segments[i].GetS1());
135 s2 = (*rotation)*(translation + segments[i].GetS2());
136 }
137 else {
138 s1 = translation + segments[i].GetS1();
139 s2 = translation + segments[i].GetS2();
140 }
141}
142
143
144//
145// FindGlobalCoordinateSystem
146//
147// Calculate rotation & translation to global coordinates
148//
149void G4GeomTestErrorList::FindGlobalCoordinateSystem()
150{
151 G4TouchableHistoryHandle aTouchable =
152 G4TransportationManager::GetTransportationManager()->
153 GetNavigatorForTracking()->CreateTouchableHistoryHandle();
154 G4AffineTransform globTransform =
155 aTouchable->GetHistory()->GetTopTransform().Inverse();
156
157 globalTranslation = globTransform.NetTranslation();
158 globalRotation = globTransform.NetRotation();
159}
Note: See TracBrowser for help on using the repository browser.