Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4GeoNav.hh
Go to the documentation of this file.
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 //
28 //
29 //
30 // $Id$
31 //
32 //
33 // --------------------------------------------------------------
34 // G4GeoNav
35 //
36 // Author: Martin Liendl - Martin.Liendl@cern.ch
37 //
38 // --------------------------------------------------------------
39 //
40 #ifndef G4GeoNav_h
41 #define G4GeoNav_h
42 
43 #include "G4String.hh"
44 #include <vector>
45 #include <regex.h>
46 
47 #include "G4RotationMatrix.hh"
48 #include "G4ThreeVector.hh"
49 #include "G4LogicalVolume.hh"
50 #include "G4VisAttributes.hh"
51 
52 #include "tree.hh"
53 
54 class G4VPhysicalVolume;
56 
57 // qt-free version of G4GeoNav
58 
60 
61 class G4GeoNav
62 {
63 
64 public:
66  ~G4GeoNav();
67  G4LogicalVolume * GetLV() { return theCurLV->data(); }
68 
69  // get next logical volume which name matches aRegExp
70  //G4LogicalVolume * NextLV(const G4String & aRegExp);
71 
72  // returns a vector of LogicalVolumes which names match the aRegExp
73  G4int FilterLV(const G4String & aRegExp,
74  std::vector<G4LogicalVolume*> & result,
75  G4bool stopAtFirst=false);
76  // returns a vector of LogicalVolumes reflecting the hierarchy of theCurLVItem
77  G4int PathLV(std::vector<G4LogicalVolume*> & result);
78  // "cd /CMS/Tr.*/.*Barrel"
79  G4LogicalVolume * ChangeLV(const G4String & aRegExp);
80  // get next lv as seen from the current one
82  // "pwd"
83  G4int PwdLV(std::vector<G4LogicalVolume *>&);
84  // "ls"
85  G4int LsLV(std::vector<G4LogicalVolume *>&);
86  // theSubreeLVItem = theCurLVItem
87  //void CurLVToSubtree() {theSubtreeLVItem = theCurLVItem;};
88  //OlapDetConstr * GetDetConstr();
89  const LVTree::node_t & root() const { return *(theLVTree->root()); }
90 
91 protected:
92 
94 
96  // recursive counting of nodes
97 
98  G4int Tokenize(const G4String &, std::vector<G4String>&);
99 
100  void FindLV(regex_t *, LVTree::node_t * ,
101  std::vector<G4LogicalVolume*>&, G4bool stopAtFirst=false) ;
102 
103  void populateLVTree(LVTree::node_t*); // recursive population of LV-Tree
104 
106  LVTree::node_t * theCurLV; // used in the NewWorld
107  LVTree::node_t * theRootLV; // root of the 'whole' geometry
109 };
110 
111 #endif