File indexing completed on 2025-09-16 08:56:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #ifndef G4PHYSICALVOLUMESSEARCHSCENE_HH
0039 #define G4PHYSICALVOLUMESSEARCHSCENE_HH
0040
0041 #include "G4PseudoScene.hh"
0042
0043 #include "G4VPhysicalVolume.hh"
0044 #include "G4PhysicalVolumeModel.hh"
0045
0046 class G4PhysicalVolumesSearchScene: public G4PseudoScene
0047 {
0048 public:
0049
0050 G4PhysicalVolumesSearchScene
0051 (G4PhysicalVolumeModel* pSearchVolumeModel,
0052 const G4String& requiredPhysicalVolumeName,
0053 G4int requiredCopyNo = -1);
0054
0055 virtual ~G4PhysicalVolumesSearchScene () {}
0056
0057 struct Findings
0058 {
0059 Findings
0060 (G4VPhysicalVolume* pSearchPV,
0061 G4VPhysicalVolume* pFoundPV,
0062 G4int foundPVCopyNo = 0,
0063 G4int foundDepth = 0,
0064 const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>&
0065 foundBasePVPath = std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>(),
0066 const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>&
0067 foundFullPVPath = std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>(),
0068 const G4Transform3D& foundObjectTransformation = G4Transform3D())
0069 : fpSearchPV(pSearchPV)
0070 , fpFoundPV(pFoundPV)
0071 , fFoundPVCopyNo(foundPVCopyNo)
0072 , fFoundDepth(foundDepth)
0073 , fFoundBasePVPath(foundBasePVPath)
0074 , fFoundFullPVPath(foundFullPVPath)
0075 , fFoundObjectTransformation(foundObjectTransformation) {}
0076 Findings(const G4PhysicalVolumeModel::TouchableProperties& tp)
0077 : fpSearchPV(nullptr)
0078 , fpFoundPV(tp.fpTouchablePV)
0079 , fFoundPVCopyNo(tp.fCopyNo)
0080 , fFoundDepth(0)
0081 , fFoundBasePVPath(tp.fTouchableBaseFullPVPath)
0082 , fFoundFullPVPath(tp.fTouchableFullPVPath)
0083 , fFoundObjectTransformation(tp.fTouchableGlobalTransform) {}
0084 G4VPhysicalVolume* fpSearchPV;
0085 G4VPhysicalVolume* fpFoundPV;
0086 G4int fFoundPVCopyNo;
0087 G4int fFoundDepth;
0088 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
0089 fFoundBasePVPath;
0090 std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>
0091 fFoundFullPVPath;
0092 G4Transform3D fFoundObjectTransformation;
0093 };
0094
0095 const std::vector<Findings>& GetFindings() const
0096 {return fFindings;}
0097
0098 private:
0099
0100 class Matcher {
0101 public:
0102 Matcher(const G4String& requiredMatch);
0103 G4bool Match(const G4String&);
0104
0105
0106
0107 private:
0108 G4bool fRegexFlag;
0109 G4String fRequiredMatch;
0110 };
0111
0112 void ProcessVolume(const G4VSolid&);
0113
0114 const G4PhysicalVolumeModel* fpSearchVolumesModel;
0115 Matcher fMatcher;
0116 G4int fRequiredCopyNo;
0117 std::vector<Findings> fFindings;
0118 };
0119
0120 #endif