Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PhysicalVolumesSearchScene.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//
26//
27//
28//
29// John Allison 5th September 2018
30// Originally G4PhysicalVolumeSearchScene, 10th August 1998, which only
31// found the first occurrence of a volume.
32// This class (note the extra 's' in the name) produces a vector of all
33// occurrences. It can match a physical volume name with the required
34// match. The latter can be of the form "/regexp/", where regexp is a
35// regular expression (see C++ regex), or a plain string, in which case
36// there must be an exact match.
37
38#ifndef G4PHYSICALVOLUMESSEARCHSCENE_HH
39#define G4PHYSICALVOLUMESSEARCHSCENE_HH
40
41#include "G4PseudoScene.hh"
42
43#include "G4VPhysicalVolume.hh"
45
47{
48public:
49
51 (G4PhysicalVolumeModel* pSearchVolumeModel, // usually a world
52 const G4String& requiredPhysicalVolumeName,
53 G4int requiredCopyNo = -1); // -1 means any copy no
54
56
57 struct Findings
58 {
60 (G4VPhysicalVolume* pSearchPV,
61 G4VPhysicalVolume* pFoundPV,
62 G4int foundPVCopyNo = 0,
63 G4int foundDepth = 0,
64 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
65 foundBasePVPath =
66 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>(),
67 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
68 foundFullPVPath =
69 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>(),
70 G4Transform3D foundObjectTransformation = G4Transform3D())
71 : fpSearchPV(pSearchPV)
72 , fpFoundPV(pFoundPV)
73 , fFoundPVCopyNo(foundPVCopyNo)
74 , fFoundDepth(foundDepth)
75 , fFoundBasePVPath(foundBasePVPath)
76 , fFoundFullPVPath(foundFullPVPath)
77 , fFoundObjectTransformation(foundObjectTransformation) {}
79 : fpSearchPV(nullptr)
80 , fpFoundPV(tp.fpTouchablePV)
81 , fFoundPVCopyNo(tp.fCopyNo)
82 , fFoundDepth(0)
83 , fFoundBasePVPath(tp.fTouchableBaseFullPVPath)
84 , fFoundFullPVPath(tp.fTouchableFullPVPath)
85 , fFoundObjectTransformation(tp.fTouchableGlobalTransform) {}
86 G4VPhysicalVolume* fpSearchPV; // Searched physical volume.
87 G4VPhysicalVolume* fpFoundPV; // Found physical volume.
88 G4int fFoundPVCopyNo; // Found Copy number.
89 G4int fFoundDepth; // Found depth.
90 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
91 fFoundBasePVPath; // Base path (e.g., empty for world volume)
92 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
93 fFoundFullPVPath; // Full path of found volume
94 G4Transform3D fFoundObjectTransformation; // Found transformation.
95 };
96
97 const std::vector<Findings>& GetFindings() const
98 {return fFindings;}
99
100private:
101
102 class Matcher {
103 public:
104 Matcher(const G4String& requiredMatch);
105 G4bool Match(const G4String&);
106 // Match the string with the required match. The latter can be of the form
107 // "/regexp/", where regexp is a regular expression (see C++ regex),
108 // or a plain string, in which case there must be an exact match.
109 private:
110 G4bool fRegexFlag; // True if fRequiredMatch is of the form "/.../".
111 G4String fRequiredMatch;
112 };
113
114 void ProcessVolume(const G4VSolid&);
115
116 const G4PhysicalVolumeModel* fpSearchVolumesModel;
117 Matcher fMatcher;
118 G4int fRequiredCopyNo;
119 std::vector<Findings> fFindings;
120};
121
122#endif
HepGeom::Transform3D G4Transform3D
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const std::vector< Findings > & GetFindings() const
std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > fFoundFullPVPath
Findings(G4VPhysicalVolume *pSearchPV, G4VPhysicalVolume *pFoundPV, G4int foundPVCopyNo=0, G4int foundDepth=0, std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > foundBasePVPath=std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID >(), std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > foundFullPVPath=std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID >(), G4Transform3D foundObjectTransformation=G4Transform3D())
std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > fFoundBasePVPath
Findings(const G4PhysicalVolumeModel::TouchableProperties &tp)