[807] | 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: G4GeoNav.hh,v 1.4 2006/06/29 17:21:58 gunter Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------- |
---|
| 32 | // G4GeoNav |
---|
| 33 | // |
---|
| 34 | // Author: Martin Liendl - Martin.Liendl@cern.ch |
---|
| 35 | // |
---|
| 36 | // -------------------------------------------------------------- |
---|
| 37 | // |
---|
| 38 | #ifndef G4GeoNav_h |
---|
| 39 | #define G4GeoNav_h |
---|
| 40 | |
---|
| 41 | #include "G4String.hh" |
---|
| 42 | #include <vector> |
---|
| 43 | #include <regex.h> |
---|
| 44 | |
---|
| 45 | #include "G4RotationMatrix.hh" |
---|
| 46 | #include "G4ThreeVector.hh" |
---|
| 47 | #include "G4LogicalVolume.hh" |
---|
| 48 | #include "G4VisAttributes.hh" |
---|
| 49 | |
---|
| 50 | #include "tree.hh" |
---|
| 51 | |
---|
| 52 | class G4VPhysicalVolume; |
---|
| 53 | class OlapDetConstr; |
---|
| 54 | |
---|
| 55 | // qt-free version of G4GeoNav |
---|
| 56 | |
---|
| 57 | typedef Tree<G4LogicalVolume*> LVTree; |
---|
| 58 | |
---|
| 59 | class G4GeoNav |
---|
| 60 | { |
---|
| 61 | |
---|
| 62 | public: |
---|
| 63 | G4GeoNav( G4LogicalVolume * root ); |
---|
| 64 | ~G4GeoNav(); |
---|
| 65 | G4LogicalVolume * GetLV() { return theCurLV->data(); } |
---|
| 66 | |
---|
| 67 | // get next logical volume which name matches aRegExp |
---|
| 68 | //G4LogicalVolume * NextLV(const G4String & aRegExp); |
---|
| 69 | |
---|
| 70 | // returns a vector of LogicalVolumes which names match the aRegExp |
---|
| 71 | G4int FilterLV(const G4String & aRegExp, |
---|
| 72 | std::vector<G4LogicalVolume*> & result, |
---|
| 73 | G4bool stopAtFirst=false); |
---|
| 74 | // returns a vector of LogicalVolumes reflecting the hierarchy of theCurLVItem |
---|
| 75 | G4int PathLV(std::vector<G4LogicalVolume*> & result); |
---|
| 76 | // "cd /CMS/Tr.*/.*Barrel" |
---|
| 77 | G4LogicalVolume * ChangeLV(const G4String & aRegExp); |
---|
| 78 | // get next lv as seen from the current one |
---|
| 79 | G4LogicalVolume * NextLV(); |
---|
| 80 | // "pwd" |
---|
| 81 | G4int PwdLV(std::vector<G4LogicalVolume *>&); |
---|
| 82 | // "ls" |
---|
| 83 | G4int LsLV(std::vector<G4LogicalVolume *>&); |
---|
| 84 | // theSubreeLVItem = theCurLVItem |
---|
| 85 | //void CurLVToSubtree() {theSubtreeLVItem = theCurLVItem;}; |
---|
| 86 | //OlapDetConstr * GetDetConstr(); |
---|
| 87 | const LVTree::node_t & root() const { return *(theLVTree->root()); } |
---|
| 88 | |
---|
| 89 | protected: |
---|
| 90 | |
---|
| 91 | void RecursiveFill(LVTree::node_t*); |
---|
| 92 | |
---|
| 93 | void CountSubtreeNodes(LVTree::node_t*,G4int&); |
---|
| 94 | // recursive counting of nodes |
---|
| 95 | |
---|
| 96 | G4int Tokenize(const G4String &, std::vector<G4String>&); |
---|
| 97 | |
---|
| 98 | void FindLV(regex_t *, LVTree::node_t * , |
---|
| 99 | std::vector<G4LogicalVolume*>&, G4bool stopAtFirst=false) ; |
---|
| 100 | |
---|
| 101 | void populateLVTree(LVTree::node_t*); // recursive population of LV-Tree |
---|
| 102 | |
---|
| 103 | LVTree * theLVTree ; |
---|
| 104 | LVTree::node_t * theCurLV; // used in the NewWorld |
---|
| 105 | LVTree::node_t * theRootLV; // root of the 'whole' geometry |
---|
| 106 | LVTree::node_t * theSubtreeEndLVItem; // (un)used ... |
---|
| 107 | }; |
---|
| 108 | |
---|
| 109 | #endif |
---|