ATLAS Offline Software
Loading...
Searching...
No Matches
AGDDDetectorStore.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#include <iostream>
11
12//using AGDDModel::AGDDTechnology;
13
18{
19 std::string n=s->GetName();
20 if (m_the_detectors.find(n) != m_the_detectors.end())
21 std::cout<<" Detector "<<n<<" already in store "<<std::endl;
22 else
23 m_the_detectors[n]=s;
24}
25
27{
28 std::string n=s->GetName();
29 if (m_the_technologies.find(n) != m_the_technologies.end())
30 std::cout<<" Technology "<<n<<" already in store "<<std::endl;
31 else
33}
35{
36 detectorList::const_iterator it = m_the_detectors.begin();
37 detectorList::const_iterator end = m_the_detectors.end();
38 std::cout<<"AGDDDetectorStore::PrintAllDetector"<<std::endl
39 <<"[key] \t name \t subType \t tech"<<std::endl;
40 for( ; it!=end; ++it) {
41 std::cout<<"["<<it->first<<"] :"
42 <<" "<<it->second->GetName()
43 <<" "<<it->second->subType()
44 <<" "<<it->second->tech
45 <<std::endl;
46 }
47}
48
53
54std::vector<AGDDDetector*> AGDDDetectorStore::GetDetectorsByType(const std::string& dt) const
55{
56 std::vector<AGDDDetector*> detectors;
57 const detectorList& theDetectors=GetDetectorList();
58 detectorList::const_iterator it=theDetectors.begin();
59 for (;it!=theDetectors.end();++it)
60 {
61 AGDDDetector* det=(*it).second;
62 if (dt==det->DetectorType()) detectors.push_back(det);
63 }
64 return detectors;
65}
66
68{
69 const detectorList& theDetectors=GetDetectorList();
70 detectorList::const_iterator it=theDetectors.begin();
71 for (;it!=theDetectors.end();++it)
72 {
73 AGDDDetector* det=(*it).second;
74 if (dt==det->DetectorID()) return det;
75 }
76 return 0;
77}
78
79template<class T> std::vector<T*> AGDDDetectorStore::GetDetectorsByType() const
80{
81 std::vector<T*> detectors;
82 const detectorList& theDetectors=GetDetectorList();
83 detectorList::const_iterator it=theDetectors.begin();
84 for (;it!=theDetectors.end();++it)
85 {
86 T* det=dynamic_cast<T*>((*it).second);
87 if (det) detectors.push_back(det);
88 }
89 return detectors;
90}
91template<class T> T* AGDDDetectorStore::GetDetectorByID(const std::string& id) const
92{
93 const detectorList& theDetectors=GetDetectorList();
94 detectorList::const_iterator it=theDetectors.begin();
95 for (;it!=theDetectors.end();++it)
96 {
97 if (id==(*it).second->DetectorID())
98 {
99 T* det=dynamic_cast<T*>((*it).second);
100 if (det) return det;
101 }
102 }
103 return 0;
104}
std::map< std::string, AGDDDetector * > detectorList
detectorList & GetDetectorList()
technologyList m_the_technologies
AGDDDetector * GetDetectorByID(const std::string &) const
void RegisterDetector(AGDDDetector *)
void RegisterTechnology(AGDDTechnology *)
std::vector< T * > GetDetectorsByType() const
detectorList m_the_detectors