96 lines
3.4 KiB
C++
96 lines
3.4 KiB
C++
//
|
|
// ********************************************************************
|
|
// * License and Disclaimer *
|
|
// * *
|
|
// * The Geant4 software is copyright of the Copyright Holders of *
|
|
// * the Geant4 Collaboration. It is provided under the terms and *
|
|
// * conditions of the Geant4 Software License, included in the file *
|
|
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
|
// * include a list of copyright holders. *
|
|
// * *
|
|
// * Neither the authors of this software system, nor their employing *
|
|
// * institutes,nor the agencies providing financial support for this *
|
|
// * work make any representation or warranty, express or implied, *
|
|
// * regarding this software system or assume any liability for its *
|
|
// * use. Please see the license in the file LICENSE and URL above *
|
|
// * for the full disclaimer and the limitation of liability. *
|
|
// * *
|
|
// * This code implementation is the result of the scientific and *
|
|
// * technical work of the GEANT4 collaboration. *
|
|
// * By using, copying, modifying or distributing the software (or *
|
|
// * any work based on the software) you agree to acknowledge its *
|
|
// * use in resulting scientific publications, and indicate your *
|
|
// * acceptance of all terms of the Geant4 Software license. *
|
|
// ********************************************************************
|
|
//
|
|
//
|
|
// $Id: B03PVolumeStore.cc,v 1.4 2006/06/29 16:35:19 gunter Exp $
|
|
// GEANT4 tag
|
|
//
|
|
// ----------------------------------------------------------------------
|
|
// GEANT 4 class source file
|
|
//
|
|
// B03PVolumeStore.cc
|
|
//
|
|
// ----------------------------------------------------------------------
|
|
|
|
#include "B03PVolumeStore.hh"
|
|
#include <sstream>
|
|
|
|
|
|
#include "G4VPhysicalVolume.hh"
|
|
|
|
B03PVolumeStore::B03PVolumeStore(){}
|
|
B03PVolumeStore::~B03PVolumeStore(){}
|
|
|
|
void B03PVolumeStore::AddPVolume(const G4GeometryCell &cell){
|
|
|
|
B03SetGeometryCell::iterator it =
|
|
fSetGeometryCell.find(cell);
|
|
if (it != fSetGeometryCell.end()) {
|
|
G4cout << "B03PVolumeStore::AddPVolume: cell already stored"
|
|
<< G4endl;
|
|
return;
|
|
}
|
|
|
|
fSetGeometryCell.insert(cell);
|
|
|
|
|
|
}
|
|
|
|
const G4VPhysicalVolume *B03PVolumeStore::
|
|
GetPVolume(const G4String &name) const {
|
|
const G4VPhysicalVolume *pvol = 0;
|
|
for (B03SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
|
|
it != fSetGeometryCell.end(); ++it) {
|
|
const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
|
|
if (vol.GetName() == name) {
|
|
pvol = &vol;
|
|
}
|
|
}
|
|
if (!pvol) {
|
|
G4cout << "B03PVolumeStore::GetPVolume: no physical volume named: "
|
|
<< name << ", found" << G4endl;
|
|
}
|
|
return pvol;
|
|
}
|
|
|
|
G4String B03PVolumeStore::GetPNames() const {
|
|
G4String NameString;
|
|
for (B03SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
|
|
it != fSetGeometryCell.end(); ++it) {
|
|
const G4VPhysicalVolume &vol = it->GetPhysicalVolume();
|
|
std::ostringstream os;
|
|
os << vol.GetName() << "_" << it->GetReplicaNumber()
|
|
<< "\n" << '\0';
|
|
G4String cellname = os.str();
|
|
|
|
// G4String cellname(vol.GetName());
|
|
// cellname += G4String("_");
|
|
// cellname += std::str(it->GetReplicaNumber());
|
|
|
|
NameString += cellname;
|
|
}
|
|
return NameString;
|
|
}
|