VGM Version 5.3
Loading...
Searching...
No Matches
IsotopeMap.cxx
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The RootGM package of the Virtual Geometry Model
5// Copyright (C) 2007 - 2010 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 Root isotopes.
16//
17// Author: Ivana Hrivnacova; IPN Orsay
18
20
22
23#include "TGeoElement.h"
24
25RootGM::IsotopeMap* RootGM::IsotopeMap::fgInstance = 0;
26
27//_____________________________________________________________________________
29{
31
32 if (!fgInstance) new IsotopeMap();
33
34 return fgInstance;
35}
36
37//_____________________________________________________________________________
38RootGM::IsotopeMap::IsotopeMap() : fTGeoIsotopes(), 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, TGeoIsotope* tgeoIsotope)
65{
67
68 fTGeoIsotopes[iIsotope] = tgeoIsotope;
69 fVgmIsotopes[tgeoIsotope] = iIsotope;
70}
71
72//_____________________________________________________________________________
74{
76
77 std::cout << "Geant4 Isotopes Map: " << std::endl;
78
79 int counter = 0;
81 for (i = fTGeoIsotopes.begin(); i != fTGeoIsotopes.end(); i++) {
82 VGM::IIsotope* iIsotope = (*i).first;
83 TGeoIsotope* tgeoIsotope = (*i).second;
84
85 std::cout << " " << counter++ << "th entry:"
86 << " vgmIsotope " << iIsotope << " " << iIsotope->Name()
87 << " tgeoIsotope " << tgeoIsotope << " "
88 << tgeoIsotope->GetName() << std::endl;
89 }
90}
91
92//_____________________________________________________________________________
93TGeoIsotope* RootGM::IsotopeMap::GetIsotope(VGM::IIsotope* iIsotope) const
94{
96
97 TGeoIsotopeMapCIterator i = fTGeoIsotopes.find(iIsotope);
98 if (i != fTGeoIsotopes.end())
99 return (*i).second;
100 else
101 return 0;
102}
103
104//_____________________________________________________________________________
105VGM::IIsotope* RootGM::IsotopeMap::GetIsotope(TGeoIsotope* tgeoIsotope) const
106{
108
109 VgmIsotopeMapCIterator i = fVgmIsotopes.find(tgeoIsotope);
110 if (i != fVgmIsotopes.end())
111 return (*i).second;
112 else
113 return 0;
114}
The map between VGM and Root isotopes.
Definition IsotopeMap.h:36
virtual ~IsotopeMap()
TGeoIsotope * GetIsotope(VGM::IIsotope *iIsotope) const
TGeoIsotopeMap::const_iterator TGeoIsotopeMapCIterator
Definition IsotopeMap.h:39
void Print() const
static IsotopeMap * Instance()
VgmIsotopeMap::const_iterator VgmIsotopeMapCIterator
Definition IsotopeMap.h:42
void AddIsotope(VGM::IIsotope *, TGeoIsotope *)
The VGM interface to elements.
Definition IIsotope.h:28
virtual std::string Name() const =0
Return the name of this element.