Geant4  10.00.p02
B03PVolumeStore.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 //
28 //
29 //
30 // $Id: B03PVolumeStore.cc 70074 2013-05-22 21:01:50Z ahoward $
31 // GEANT4 tag
32 //
33 // ----------------------------------------------------------------------
34 // GEANT 4 class source file
35 //
36 // B03PVolumeStore.cc
37 //
38 // ----------------------------------------------------------------------
39 
40 #include "B03PVolumeStore.hh"
41 #include <sstream>
42 
43 
44 #include "G4VPhysicalVolume.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 
58  B03SetGeometryCell::iterator it =
59  fSetGeometryCell.find(cell);
60  if (it != fSetGeometryCell.end()) {
61  G4cout << "B03PVolumeStore::AddPVolume: cell already stored"
62  << G4endl;
63  return;
64  }
65 
66  fSetGeometryCell.insert(cell);
67 
68 
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
74 GetPVolume(const G4String &name) const {
75  const G4VPhysicalVolume *pvol = 0;
76  for (B03SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
77  it != fSetGeometryCell.end(); ++it) {
78  const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
79  if (vol.GetName() == name) {
80  pvol = &vol;
81  }
82  }
83  if (!pvol) {
84  G4cout << "B03PVolumeStore::GetPVolume: no physical volume named: "
85  << name << ", found" << G4endl;
86  }
87  return pvol;
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
91 
93  G4String NameString;
94  for (B03SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
95  it != fSetGeometryCell.end(); ++it) {
96  const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
97  std::ostringstream os;
98  os << vol.GetName() << "_" << it->GetReplicaNumber()
99  << "\n";
100  G4String cellname = os.str();
101 
102  // G4String cellname(vol.GetName());
103  // cellname += G4String("_");
104  // cellname += std::str(it->GetReplicaNumber());
105 
106  NameString += cellname;
107  }
108  return NameString;
109 }
110 
111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4String name
Definition: TRTMaterials.hh:40
B03SetGeometryCell fSetGeometryCell
Definition of the B03PVolumeStore class.
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
#define G4endl
Definition: G4ios.hh:61
G4String GetPNames() const
const G4VPhysicalVolume * GetPVolume(const G4String &name) const
void AddPVolume(const G4GeometryCell &cell)