VGM Version 5.3
Loading...
Searching...
No Matches
PlacementMap.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The Geant4GM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
12//
13// Class PlacementMap
14// ---------------------
15// The map between VGM and Geant4 placements.
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
20
22
23#include "G4VPhysicalVolume.hh"
24
25Geant4GM::PlacementMap* Geant4GM::PlacementMap::fgInstance = 0;
26
27//_____________________________________________________________________________
29{
31
32 if (!fgInstance) new Geant4GM::PlacementMap();
33
34 return fgInstance;
35}
36
37//_____________________________________________________________________________
38Geant4GM::PlacementMap::PlacementMap() : fG4Placements(), fVgmPlacements()
39{
41
42 fgInstance = this;
43}
44
45//_____________________________________________________________________________
47{
49}
50
51//_____________________________________________________________________________
53{
54 //
55 fgInstance = 0;
56}
57
58//_____________________________________________________________________________
60 VGM::IPlacement* iPlacement, G4VPhysicalVolume* g4Placement)
61{
63
64 fG4Placements[iPlacement] = g4Placement;
65 fVgmPlacements[g4Placement] = iPlacement;
66}
67
68//_____________________________________________________________________________
70 VGM::IPlacement* iPlacement) const
71{
73
74 G4PlacementMapCIterator i = fG4Placements.find(iPlacement);
75 if (i != fG4Placements.end())
76 return (*i).second;
77 else
78 return 0;
79}
80
81//_____________________________________________________________________________
83 G4VPhysicalVolume* pv) const
84{
86
87 VgmPlacementMapCIterator i = fVgmPlacements.find(pv);
88 if (i != fVgmPlacements.end())
89 return (*i).second;
90 else
91 return 0;
92}
The map between VGM and Geant4 placements.
static PlacementMap * Instance()
VgmPlacementMap::const_iterator VgmPlacementMapCIterator
void AddPlacement(VGM::IPlacement *, G4VPhysicalVolume *)
G4VPhysicalVolume * GetPlacement(VGM::IPlacement *iPlacement) const
G4PlacementMap::const_iterator G4PlacementMapCIterator
The VGM interface to positions of volumes.
Definition IPlacement.h:44