ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
AGDD
AGDDKernel
src
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
5
#include "
AGDDKernel/AGDDDetectorStore.h
"
6
#include "
AGDDKernel/AGDDSection.h
"
7
#include "
AGDDKernel/AGDDDetector.h
"
8
#include "
AGDDKernel/AGDDTechnology.h
"
9
10
#include <iostream>
11
12
//using AGDDModel::AGDDTechnology;
13
14
AGDDDetectorStore::AGDDDetectorStore
()
15
{
16
}
17
void
AGDDDetectorStore::RegisterDetector
(
AGDDDetector
*s)
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
26
void
AGDDDetectorStore::RegisterTechnology
(
AGDDTechnology
*s)
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
32
m_the_technologies
[n]=s;
33
}
34
void
AGDDDetectorStore::PrintAllDetectors
()
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
49
const
detectorList
&
AGDDDetectorStore::GetDetectorList
()
const
50
{
51
return
m_the_detectors
;
52
}
53
54
std::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
67
AGDDDetector
*
AGDDDetectorStore::GetDetectorByID
(
const
std::string& dt)
const
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
79
template
<
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
}
91
template
<
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
}
AGDDDetectorStore.h
detectorList
std::map< std::string, AGDDDetector * > detectorList
Definition
AGDDDetectorStore.h:15
AGDDDetector.h
AGDDSection.h
AGDDTechnology.h
AGDDDetectorStore::GetDetectorList
detectorList & GetDetectorList()
Definition
AGDDDetectorStore.h:26
AGDDDetectorStore::m_the_technologies
technologyList m_the_technologies
Definition
AGDDDetectorStore.h:35
AGDDDetectorStore::AGDDDetectorStore
AGDDDetectorStore()
Definition
AGDDDetectorStore.cxx:14
AGDDDetectorStore::GetDetectorByID
AGDDDetector * GetDetectorByID(const std::string &) const
Definition
AGDDDetectorStore.cxx:67
AGDDDetectorStore::RegisterDetector
void RegisterDetector(AGDDDetector *)
Definition
AGDDDetectorStore.cxx:17
AGDDDetectorStore::PrintAllDetectors
void PrintAllDetectors()
Definition
AGDDDetectorStore.cxx:34
AGDDDetectorStore::RegisterTechnology
void RegisterTechnology(AGDDTechnology *)
Definition
AGDDDetectorStore.cxx:26
AGDDDetectorStore::GetDetectorsByType
std::vector< T * > GetDetectorsByType() const
Definition
AGDDDetectorStore.cxx:79
AGDDDetectorStore::m_the_detectors
detectorList m_the_detectors
Definition
AGDDDetectorStore.h:34
AGDDDetector
Definition
AGDDDetector.h:15
AGDDTechnology
Definition
AGDDTechnology.h:15
Generated on
for ATLAS Offline Software by
1.17.0