ATLAS Offline Software
DetectorDescription
GeoModel
GeoModelUtilities
src
GeoMaterialPropertyVector.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
GeoModelUtilities/GeoMaterialPropertyVector.h
"
6
#include <stdexcept>
7
#include <iostream>
8
9
bool
GeoMaterialPropertyVector::operator ++
()
10
{
11
m_CurrentEntry
++;
12
if
(
m_CurrentEntry
<
m_NumEntries
)
13
return
true
;
14
else
15
return
false
;
16
}
17
18
GeoMaterialPropertyVector
&
GeoMaterialPropertyVector::operator =
(
const
GeoMaterialPropertyVector
& right)
19
{
20
if
(
this
== &right)
return
*
this
;
21
22
for
(
unsigned
i
=0;
i
<
m_MPV
.size(); ++
i
)
23
delete
m_MPV
[
i
];
24
m_MPV
.clear();
25
26
m_NumEntries
= 0;
27
m_CurrentEntry
= -1;
28
29
for
(
int
i
= 0 ;
i
< right.
m_NumEntries
;
i
++)
30
{
31
GeoMPVEntry
*newElement =
new
GeoMPVEntry
(right.
GetEntry
(
i
));
32
m_MPV
.push_back(newElement);
33
m_NumEntries
++;
34
}
35
36
return
*
this
;
37
}
38
39
GeoMaterialPropertyVector::GeoMaterialPropertyVector
(
double
*PhotonMomenta,
40
double
*PropertyValues,
41
int
NumElements)
42
{
43
m_NumEntries
= 0;
44
m_CurrentEntry
= -1;
45
46
for
(
int
i
= 0;
i
< NumElements;
i
++)
47
AddElement
(PhotonMomenta[
i
], PropertyValues[
i
]);
48
}
49
50
GeoMaterialPropertyVector::GeoMaterialPropertyVector
(
const
GeoMaterialPropertyVector
&right)
51
{
52
m_NumEntries
= 0;
53
m_CurrentEntry
= -1;
54
55
for
(
int
i
= 0 ;
i
< right.
m_NumEntries
;
i
++)
56
{
57
GeoMPVEntry
*newElement =
new
GeoMPVEntry
(right.
GetEntry
(
i
));
58
m_MPV
.push_back(newElement);
59
m_NumEntries
++;
60
}
61
}
62
63
GeoMaterialPropertyVector::~GeoMaterialPropertyVector
()
64
{
65
for
(
unsigned
i
=0;
i
<
m_MPV
.size(); ++
i
)
66
delete
m_MPV
[
i
];
67
m_MPV
.clear();
68
}
69
70
void
GeoMaterialPropertyVector::ResetIterator
()
71
{
72
m_CurrentEntry
= -1;
73
}
74
75
void
GeoMaterialPropertyVector::AddElement
(
double
aPhotonMomentum,
76
double
aPropertyValue)
77
{
78
GeoMPVEntry
*newElement;
79
80
newElement =
new
GeoMPVEntry
(aPhotonMomentum, aPropertyValue);
81
m_MPV
.push_back(newElement);
82
m_NumEntries
++;
83
}
84
85
double
GeoMaterialPropertyVector::GetProperty
()
const
86
{
87
if
(
m_CurrentEntry
== -1 ||
m_CurrentEntry
>=
m_NumEntries
)
88
throw
std::runtime_error(
"GeoMaterialPropertyVector::GetProperty ==>Iterator attempted to Retrieve Property out of range"
);
89
else
90
return
m_MPV
[
m_CurrentEntry
]->GetProperty();
91
}
92
93
double
GeoMaterialPropertyVector::GetPhotonMomentum
()
const
94
{
95
if
(
m_CurrentEntry
== -1 ||
m_CurrentEntry
>=
m_NumEntries
)
96
throw
std::runtime_error(
"GeoMaterialPropertyVector::GetPhotonMomentum ==>Iterator attempted to Retrieve Photon Momentum out of range"
);
97
else
98
return
m_MPV
[
m_CurrentEntry
]->GetPhotonMomentum();
99
}
100
101
void
GeoMaterialPropertyVector::DumpVector
()
102
{
103
if
(
m_MPV
.empty())
104
{
105
std::cerr <<
"nothing to dump\n"
;
106
throw
std::runtime_error(
"GeoMaterialPropertyVector::DumpVector ==>Nothing to dump! Vector is empty"
);
107
}
108
109
for
(
int
i
= 0;
i
<
m_NumEntries
;
i
++)
110
{
111
std::cout <<
"m_MPV["
<<
i
<<
"]: "
;
112
m_MPV
[
i
]->DumpEntry();
113
}
114
std::cout <<
" Done DumpVector of "
<<
m_NumEntries
<<
" entries\n"
;
115
116
}
117
118
GeoMPVEntry
GeoMaterialPropertyVector::GetEntry
(
int
i
)
const
119
{
120
return
*
m_MPV
[
i
];
121
}
GeoMaterialPropertyVector::operator=
GeoMaterialPropertyVector & operator=(const GeoMaterialPropertyVector &right)
Definition:
GeoMaterialPropertyVector.cxx:18
GeoMaterialPropertyVector.h
GeoMaterialPropertyVector::AddElement
void AddElement(double aPhotonMomentum, double aPropertyValue)
Definition:
GeoMaterialPropertyVector.cxx:75
GeoMaterialPropertyVector::m_CurrentEntry
int m_CurrentEntry
Definition:
GeoMaterialPropertyVector.h:49
GeoMaterialPropertyVector::m_MPV
std::vector< GeoMPVEntry * > m_MPV
Definition:
GeoMaterialPropertyVector.h:47
GeoMaterialPropertyVector::GetProperty
double GetProperty() const
Definition:
GeoMaterialPropertyVector.cxx:85
GeoMaterialPropertyVector::GetEntry
GeoMPVEntry GetEntry(int i) const
Definition:
GeoMaterialPropertyVector.cxx:118
GeoMaterialPropertyVector::GeoMaterialPropertyVector
GeoMaterialPropertyVector()
Definition:
GeoMaterialPropertyVector.h:18
GeoMaterialPropertyVector::ResetIterator
void ResetIterator()
Definition:
GeoMaterialPropertyVector.cxx:70
GeoMaterialPropertyVector::GetPhotonMomentum
double GetPhotonMomentum() const
Definition:
GeoMaterialPropertyVector.cxx:93
lumiFormat.i
int i
Definition:
lumiFormat.py:85
GeoMPVEntry
Definition:
GeoMPVEntry.h:9
GeoMaterialPropertyVector::~GeoMaterialPropertyVector
~GeoMaterialPropertyVector()
Definition:
GeoMaterialPropertyVector.cxx:63
GeoMaterialPropertyVector::DumpVector
void DumpVector()
Definition:
GeoMaterialPropertyVector.cxx:101
GeoMaterialPropertyVector::m_NumEntries
int m_NumEntries
Definition:
GeoMaterialPropertyVector.h:48
GeoMaterialPropertyVector::operator++
bool operator++()
Definition:
GeoMaterialPropertyVector.cxx:9
GeoMaterialPropertyVector
Definition:
GeoMaterialPropertyVector.h:12
Generated on Thu Nov 7 2024 21:15:43 for ATLAS Offline Software by
1.8.18