Geant4  10.02.p02
G4TouchableDumpScene.cc
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 // $Id: G4TouchableDumpScene.cc 66773 2013-01-12 14:48:08Z allison $
28 //
29 //
30 // John Allison 15th May 2014.
31 // An artificial scene to dump touchable attributes.
32 
33 #include "G4TouchableDumpScene.hh"
34 
35 #include "G4VSolid.hh"
36 #include "G4Vector3D.hh"
37 #include "G4VPhysicalVolume.hh"
38 #include "G4PhysicalVolumeModel.hh"
39 
40 #include "G4AttValue.hh"
41 #include "G4AttCheck.hh"
42 
44 (std::ostream& os,
45  G4PhysicalVolumeModel* pPVModel,
46  const G4ModelingParameters::PVNameCopyNoPath& requiredTouchable)
47 :fos(os)
48 ,fpPVModel(pPVModel)
49 ,fRequiredTouchable(requiredTouchable)
50 ,fFound(false)
51 {}
52 
54 
56 
57  const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>&
58  fullPVPath = fpPVModel->GetFullPVPath();
59 
60  if (fRequiredTouchable.size() == fullPVPath.size()) {
61  // OK - there's a size match. Check it out.
62 // G4cout << "Size match" << G4endl;
64  std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>::const_iterator
65  iPVNodeId;
66  for (iNameCopyNo = fRequiredTouchable.begin(), iPVNodeId = fullPVPath.begin();
67  iNameCopyNo != fRequiredTouchable.end();
68  ++iNameCopyNo, ++iPVNodeId) {
69 // G4cout
70 // << iNameCopyNo->GetName()
71 // << ',' << iNameCopyNo->GetCopyNo()
72 // << "; " << iPVNodeId->GetPhysicalVolume()->GetName()
73 // << ',' << iPVNodeId->GetPhysicalVolume()->GetCopyNo()
74 // << G4endl;
75  if (!(
76  iNameCopyNo->GetName() ==
77  iPVNodeId->GetPhysicalVolume()->GetName() &&
78  iNameCopyNo->GetCopyNo() ==
79  iPVNodeId->GetPhysicalVolume()->GetCopyNo()
80  )) {
81  break;
82  }
83  }
84  if (iNameCopyNo == fRequiredTouchable.end()) {
85 // G4cout << "Match found" << G4endl;
86  fFound = true;
87 
88  const std::map<G4String,G4AttDef>* attDefs = fpPVModel->GetAttDefs();
89  std::vector<G4AttValue>* attValues = fpPVModel->CreateCurrentAttValues();
90  fos << G4AttCheck(attValues, attDefs);
91  delete attValues;
92 
93  G4Polyhedron* polyhedron = solid.GetPolyhedron();
94  fos << "\nLocal polyhedron coordinates:\n" << *polyhedron;
96  polyhedron->Transform(*transform);
97  fos << "\nGlobal polyhedron coordinates:\n" << *polyhedron;
98 
99  fpPVModel->Abort(); // No need to look further.
100  }
101  }
102 }
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4VSolid.cc:644
void ProcessVolume(const G4VSolid &)
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4Transform3D * GetCurrentTransform() const
const G4PhysicalVolumeModel * fpPVModel
HepGeom::Transform3D G4Transform3D
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
std::vector< PVNameCopyNo > PVNameCopyNoPath
std::vector< G4AttValue > * CreateCurrentAttValues() const
G4ModelingParameters::PVNameCopyNoPath fRequiredTouchable
G4TouchableDumpScene(std::ostream &os, G4PhysicalVolumeModel *pPVModel, const G4ModelingParameters::PVNameCopyNoPath &requiredTouchable)
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator