ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicalVolumeAccessor.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "G4LogicalVolumeStore.hh"
7#include <string>
8#include <assert.h>
9
10G4LogicalVolume* PhysicalVolumeAccessor::GetLV(const std::string& name)
11{
12 G4LogicalVolumeStore *lvs=G4LogicalVolumeStore::GetInstance();
13 for (unsigned int i=0;i<lvs->size();i++)
14 {
15 std::string lname=((lvs->operator[](i))->GetName());
16 if (name==lname)
17 return (lvs->operator[](i));
18 }
19 return nullptr;
20}
21
26
28 const std::string& PVname)
29{
31 assert (m_theLogicalVolume!=nullptr);
32 for (unsigned int i=0;i<m_theLogicalVolume->GetNoDaughters();i++)
33 {
34 G4VPhysicalVolume *pv=m_theLogicalVolume->GetDaughter(i);
35 if (PVname == static_cast<const std::string&>(pv->GetName()))
36 {
37 m_thePhysicalVolumes[pv->GetCopyNo()]=pv;
38 }
39 }
40}
41
42const G4VPhysicalVolume* PhysicalVolumeAccessor::GetPhysicalVolume(int icopy) const
43{
44 auto physVolIter = m_thePhysicalVolumes.find(icopy);
45 if (physVolIter!=m_thePhysicalVolumes.end())
46 return physVolIter->second;
47 else
48 {
49 return nullptr;
50 }
51}
52
54{
55 // assert (m_thePhysicalVolumes.size()==0);
56 for (unsigned int i=0;i<m_theLogicalVolume->GetNoDaughters();i++)
57 {
58 G4VPhysicalVolume *pv=m_theLogicalVolume->GetDaughter(i);
59 if (name == static_cast<const std::string&>(pv->GetName()))
60 {
61 m_thePhysicalVolumes[pv->GetCopyNo()]=pv;
62 }
63 }
64}
void SetPhysicalVolumeList(const std::string &)
const G4VPhysicalVolume * GetPhysicalVolume(int) const
G4LogicalVolume * GetLV(const std::string &)
G4LogicalVolume * m_theLogicalVolume
PhysicalVolumeAccessor(const std::string &)