ATLAS Offline Software
Geo2G4ElementFactory.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "Geo2G4ElementFactory.h"
6 #include "GeoModelKernel/GeoElement.h"
7 #include "G4Element.hh"
8 #include <iostream>
9 
11 {
12 }
13 
14 G4Element *Geo2G4ElementFactory::Build(const GeoElement* theEle)
15 {
16  //
17  // Check if this element has already been defined.
18  //
19  const std::string& sym = theEle->getSymbol();
20  const auto itr = m_definedElements.find(sym);
21  if (itr != m_definedElements.end())
22  {
23  return itr->second;
24  }
25  G4Element* elm = new G4Element(theEle->getName(),
26  sym,
27  theEle->getZ(),
28  theEle->getA());
29 
30  m_definedElements.emplace(sym, elm);
31  return elm;
32 }
Geo2G4ElementFactory::Geo2G4ElementFactory
Geo2G4ElementFactory()
Definition: Geo2G4ElementFactory.cxx:10
Geo2G4ElementFactory.h
Geo2G4ElementFactory::Build
G4Element * Build(const GeoElement *)
Definition: Geo2G4ElementFactory.cxx:14
Geo2G4ElementFactory::m_definedElements
elList m_definedElements
Definition: Geo2G4ElementFactory.h:20