Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 07:50:57

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file B02PVolumeStore.cc
0027 /// \brief Implementation of the B02PVolumeStore class
0028 
0029 // ----------------------------------------------------------------------
0030 // GEANT 4 class source file
0031 //
0032 // B02PVolumeStore.cc
0033 //
0034 // ----------------------------------------------------------------------
0035 
0036 #include "B02PVolumeStore.hh"
0037 
0038 #include "G4VPhysicalVolume.hh"
0039 
0040 #include <sstream>
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 B02PVolumeStore::B02PVolumeStore() {}
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 B02PVolumeStore::~B02PVolumeStore() {}
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 
0052 void B02PVolumeStore::AddPVolume(const G4GeometryCell& cell)
0053 {
0054   B02SetGeometryCell::iterator it = fSetGeometryCell.find(cell);
0055   if (it != fSetGeometryCell.end()) {
0056     G4cout << "B02PVolumeStore::AddPVolume: cell already stored" << G4endl;
0057     return;
0058   }
0059 
0060   fSetGeometryCell.insert(cell);
0061 }
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 
0065 const G4VPhysicalVolume* B02PVolumeStore::GetPVolume(const G4String& name) const
0066 {
0067   const G4VPhysicalVolume* pvol = 0;
0068   for (B02SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
0069        it != fSetGeometryCell.end(); ++it)
0070   {
0071     const G4VPhysicalVolume& vol = it->GetPhysicalVolume();
0072     if (vol.GetName() == name) {
0073       pvol = &vol;
0074     }
0075   }
0076   if (!pvol) {
0077     G4cout << "B02PVolumeStore::GetPVolume: no physical volume named: " << name << ", found"
0078            << G4endl;
0079   }
0080   return pvol;
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 
0085 G4String B02PVolumeStore::GetPNames() const
0086 {
0087   G4String NameString;
0088   for (B02SetGeometryCell::const_iterator it = fSetGeometryCell.begin();
0089        it != fSetGeometryCell.end(); ++it)
0090   {
0091     const G4VPhysicalVolume& vol = it->GetPhysicalVolume();
0092     std::ostringstream os;
0093     os << vol.GetName() << "_" << it->GetReplicaNumber() << "\n";
0094     G4String cellname = os.str();
0095 
0096     //    G4String cellname(vol.GetName());
0097     //    cellname += G4String("_");
0098     //    cellname += std::str(it->GetReplicaNumber());
0099 
0100     NameString += cellname;
0101   }
0102   return NameString;
0103 }
0104 
0105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0106 
0107 G4int B02PVolumeStore::Size()
0108 {
0109   return fSetGeometryCell.size();
0110 }
0111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......