ATLAS Offline Software
Loading...
Searching...
No Matches
RDBMaterialManager.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef GEOMODELSVC_RDBMATERIALMANAGER_H
6#define GEOMODELSVC_RDBMATERIALMANAGER_H
7
14
17#include "GeoModelKernel/GeoIntrusivePtr.h"
18#include "GeoModelKernel/GeoElement.h"
20
21#include <string>
22#include <string_view>
23#include <vector>
24#include <iosfwd>
25
26class GeoMaterial;
27class ISvcLocator;
28
30
31 public:
32
33 // Constructor:
34 RDBMaterialManager(ISvcLocator* pSvcLocator);
35
36 // Destructor:
38
39 // Query the material:
40 virtual const GeoMaterial *getMaterial(std::string_view name) override;
41
42 // Query the elements:
43 virtual const GeoElement *getElement(const std::string & name) override;
44
45 // Query the elements (by atomic number):
46 virtual const GeoElement *getElement(unsigned int atomicNumber) override;
47
48 // Add new material
49 virtual void addMaterial(const std::string& space, GeoMaterial* material) override;
50
52 virtual StoredMaterialManager::MaterialMapIterator end() const override;
53
54 // Number of materials in the manager
55 virtual size_t size() override;
56
57 virtual std::ostream & printAll(std::ostream & o) const override;
58 //default std::cout output
59 virtual std::ostream & printAll() const override;
60 private:
61
62 StatusCode readMaterialsFromDB(ISvcLocator* pSvcLocator);
63
65
66 GeoElement *searchElementVector (const std::string & name) const;
67 GeoElement *searchElementVector (const unsigned int atomicNumber) const;
68 GeoMaterial *searchMaterialMap (std::string_view name) const;
69
71
72 using GeoEleVec = std::vector<GeoIntrusivePtr<GeoElement>>;
75
77 {
78 DetectorAuxData(const std::string& prim_key
79 , IRDBRecordset_ptr materials
80 , IRDBRecordset_ptr matcomponents)
81 : m_prim_key(prim_key)
82 , m_materials(std::move(materials))
83 , m_matcomponents(std::move(matcomponents))
84 {}
85
86 std::string m_prim_key{};
89 };
90
91 std::map<std::string,DetectorAuxData> m_detData;
92};
93
94
95#endif
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
GeoMaterial * searchMaterialMap(std::string_view name) const
StatusCode readMaterialsFromDB(ISvcLocator *pSvcLocator)
virtual StoredMaterialManager::MaterialMapIterator end() const override
std::vector< GeoIntrusivePtr< GeoElement > > GeoEleVec
virtual void addMaterial(const std::string &space, GeoMaterial *material) override
std::map< std::string, DetectorAuxData > m_detData
virtual StoredMaterialManager::MaterialMapIterator begin() const override
RDBMaterialManager(ISvcLocator *pSvcLocator)
IRDBRecordset_ptr m_elements
virtual std::ostream & printAll() const override
GeoElement * searchElementVector(const std::string &name) const
virtual const GeoMaterial * getMaterial(std::string_view name) override
StoredMaterialManager::MaterialMap m_materialMap
virtual size_t size() override
virtual ~RDBMaterialManager()
virtual const GeoElement * getElement(const std::string &name) override
StoredMaterialManager()=default
MaterialMap::const_iterator MaterialMapIterator
std::map< std::string, GeoIntrusivePtr< GeoMaterial >, std::less<> > MaterialMap
STL namespace.
DetectorAuxData(const std::string &prim_key, IRDBRecordset_ptr materials, IRDBRecordset_ptr matcomponents)