VGM Version 5.3
Loading...
Searching...
No Matches
IsotopeMap.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 IsotopeMap
14// ------------------
15// The map between VGM and Geant4 isotopes.
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
20
22
23#include "G4Isotope.hh"
24
25Geant4GM::IsotopeMap* Geant4GM::IsotopeMap::fgInstance = 0;
26
27//_____________________________________________________________________________
29{
31
32 if (!fgInstance) new IsotopeMap();
33
34 return fgInstance;
35}
36
37//_____________________________________________________________________________
38Geant4GM::IsotopeMap::IsotopeMap() : fG4Isotopes(), fVgmIsotopes()
39{
41
42 fgInstance = this;
43}
44
45//_____________________________________________________________________________
50
51//_____________________________________________________________________________
53{
54 //
55 fgInstance = 0;
56}
57
58//
59// public methods
60//
61
62//_____________________________________________________________________________
64 VGM::IIsotope* iIsotope, G4Isotope* g4Isotope)
65{
67
68 fG4Isotopes[iIsotope] = g4Isotope;
69 fVgmIsotopes[g4Isotope] = iIsotope;
70}
71
72//_____________________________________________________________________________
74{
76
77 std::cout << "Geant4 Isotopes Map: " << std::endl;
78
79 int counter = 0;
81 for (i = fG4Isotopes.begin(); i != fG4Isotopes.end(); i++) {
82 VGM::IIsotope* iIsotope = (*i).first;
83 G4Isotope* g4Isotope = (*i).second;
84
85 std::cout << " " << counter++ << "th entry:"
86 << " vgmIsotope " << iIsotope << " " << iIsotope->Name()
87 << " g4Isotope " << g4Isotope << " " << g4Isotope->GetName()
88 << std::endl;
89 }
90}
91
92//_____________________________________________________________________________
94{
96
97 G4IsotopeMapCIterator i = fG4Isotopes.find(iIsotope);
98 if (i != fG4Isotopes.end())
99 return (*i).second;
100 else
101 return 0;
102}
103
104//_____________________________________________________________________________
106{
108
109 VgmIsotopeMapCIterator i = fVgmIsotopes.find(Isotope);
110 if (i != fVgmIsotopes.end())
111 return (*i).second;
112 else
113 return 0;
114}
The map between VGM and Geant4 isotopes.
Definition IsotopeMap.h:36
static IsotopeMap * Instance()
void AddIsotope(VGM::IIsotope *, G4Isotope *)
G4IsotopeMap::const_iterator G4IsotopeMapCIterator
Definition IsotopeMap.h:39
VgmIsotopeMap::const_iterator VgmIsotopeMapCIterator
Definition IsotopeMap.h:42
G4Isotope * GetIsotope(VGM::IIsotope *iIsotope) const
VGM implementation for Geant4 Isotope.
Definition Isotope.h:32
The VGM interface to elements.
Definition IIsotope.h:28
virtual std::string Name() const =0
Return the name of this element.