Geant4  10.01.p03
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  const std::map<G4String,G4AttDef>* attDefs = fpPVModel->GetAttDefs();
88  std::vector<G4AttValue>* attValues = fpPVModel->CreateCurrentAttValues();
89  fos << G4AttCheck(attValues, attDefs);
90  delete attValues;
91  fpPVModel->Abort(); // No need to look further.
92  }
93  }
94 }
void ProcessVolume(const G4VSolid &)
const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4PhysicalVolumeModel * fpPVModel
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