source: trunk/source/geometry/volumes/src/G4TouchableHistory.cc @ 1337

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

tag geant4.9.4 beta 1 + modifs locales

File size: 3.2 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: G4TouchableHistory.cc,v 1.15 2009/11/06 11:10:35 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30//
31// class G4TouchableHistory Implementation
32//
33// ----------------------------------------------------------------------
34
35#include "G4TouchableHistory.hh"
36
37G4Allocator<G4TouchableHistory> aTouchableHistoryAllocator;
38
39G4TouchableHistory::G4TouchableHistory()
40  : frot(G4RotationMatrix()),
41    ftlate(G4ThreeVector(0.,0.,0.)),
42    fhistory()
43{
44   G4VPhysicalVolume* pPhysVol=0;
45   fhistory.SetFirstEntry(pPhysVol);
46}
47
48G4TouchableHistory::G4TouchableHistory( const G4NavigationHistory &history )
49  : fhistory(history)
50{
51  G4AffineTransform tf(fhistory.GetTopTransform().Inverse());
52  ftlate = tf.NetTranslation();
53  frot = tf.NetRotation();
54}
55
56G4TouchableHistory::~G4TouchableHistory()
57{
58}
59
60const G4ThreeVector&
61G4TouchableHistory::GetTranslation(G4int depth) const
62{
63  // The value returned will change at the next call
64  // Copy it if you want to use it!
65  //
66  static G4ThreeVector currTranslation;
67  if(depth==0.0)
68  {
69    return ftlate;
70  }
71  else
72  {
73    currTranslation =
74      fhistory.GetTransform(CalculateHistoryIndex(depth)).NetTranslation();
75    return currTranslation;
76  }
77}
78
79const G4RotationMatrix*
80G4TouchableHistory::GetRotation(G4int depth) const
81{
82  // The value returned will change at the next call
83  // Copy it if you want to use it!
84  //
85  static G4RotationMatrix rotM;
86
87  if(depth==0.0)
88  {
89    return &frot;
90  }
91  else
92  {
93    rotM = fhistory.GetTransform(CalculateHistoryIndex(depth)).NetRotation();
94    return &rotM;
95  }
96}
Note: See TracBrowser for help on using the repository browser.