Geant4 10.7.0
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, based on G4PhysicalVolumeSearchScene
30// An artificial scene to find physical volumes. Instead of returning the
31// first occurrence (G4PhysicalVolumeSearchScene) this class (note the extra
32// 's' in the name of this class) returns a vector of all occurrences.
33// It can match a physical volume name with the required match. The latter can
34// be of the form "/regexp/", where regexp is a regular expression (see C++
35// regex), or a plain string, in which case there must be an exact match.
36
37#ifndef G4PHYSICALVOLUMESSEARCHSCENE_HH
38#define G4PHYSICALVOLUMESSEARCHSCENE_HH
39
40#include "G4PseudoScene.hh"
41
42#include "G4VPhysicalVolume.hh"
44
46{
47public:
48
50 (G4PhysicalVolumeModel* pSearchVolumeModel, // usually a world
51 const G4String& requiredPhysicalVolumeName,
52 G4int requiredCopyNo = -1); // -1 means any copy no
53
55
56 struct Findings
57 {
59 (G4VPhysicalVolume* pSearchPV,
60 G4VPhysicalVolume* pFoundPV,
61 G4int foundPVCopyNo = 0,
62 G4int foundDepth = 0,
63 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
64 foundBasePVPath =
65 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>(),
66 G4Transform3D foundObjectTransformation = G4Transform3D())
67 : fpSearchPV(pSearchPV)
68 , fpFoundPV(pFoundPV)
69 , fFoundPVCopyNo(foundPVCopyNo)
70 , fFoundDepth(foundDepth)
71 , fFoundBasePVPath(foundBasePVPath)
72 , fFoundObjectTransformation(foundObjectTransformation) {}
74 : fpSearchPV(nullptr)
75 , fpFoundPV(tp.fpTouchablePV)
76 , fFoundPVCopyNo(tp.fCopyNo)
77 , fFoundDepth(0)
78 , fFoundBasePVPath(tp.fTouchableBaseFullPVPath)
79 , fFoundObjectTransformation(tp.fTouchableGlobalTransform) {}
80 G4VPhysicalVolume* fpSearchPV; // Searched physical volume.
81 G4VPhysicalVolume* fpFoundPV; // Found physical volume.
82 G4int fFoundPVCopyNo; // Found Copy number.
83 G4int fFoundDepth; // Found depth.
84 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
85 fFoundBasePVPath; // Base path (e.g., empty for world volume)
86 G4Transform3D fFoundObjectTransformation; // Found transformation.
87 };
88
89 const std::vector<Findings>& GetFindings() const
90 {return fFindings;}
91
92private:
93
94 class Matcher {
95 public:
96 Matcher(const G4String& requiredMatch);
97 G4bool Match(const G4String&);
98 // Match the string with the required match. The latter can be of the form
99 // "/regexp/", where regexp is a regular expression (see C++ regex),
100 // or a plain string, in which case there must be an exact match.
101 private:
102 G4bool fRegexFlag; // True if fRequiredMatch is of the form "/.../".
103 G4String fRequiredMatch;
104 };
105
106 void ProcessVolume(const G4VSolid&);
107
108 const G4PhysicalVolumeModel* fpSearchVolumesModel;
109 Matcher fMatcher;
110 G4int fRequiredCopyNo;
111 std::vector<Findings> fFindings;
112};
113
114#endif
HepGeom::Transform3D G4Transform3D
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const std::vector< Findings > & GetFindings() const
Findings(G4VPhysicalVolume *pSearchPV, G4VPhysicalVolume *pFoundPV, G4int foundPVCopyNo=0, G4int foundDepth=0, std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > foundBasePVPath=std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID >(), G4Transform3D foundObjectTransformation=G4Transform3D())
std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > fFoundBasePVPath
Findings(const G4PhysicalVolumeModel::TouchableProperties &tp)