ATLAS Offline Software
Loading...
Searching...
No Matches
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
6#include <stdexcept>
7#include <iostream>
8
10{
13 return true;
14 else
15 return false;
16}
17
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);
34 }
35
36 return *this;
37}
38
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
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);
60 }
61}
62
64{
65 for(unsigned i=0; i<m_MPV.size(); ++i)
66 delete m_MPV[i];
67 m_MPV.clear();
68}
69
74
75void 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
86{
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
94{
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
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
119{
120 return *m_MPV[i];
121}
GeoMaterialPropertyVector & operator=(const GeoMaterialPropertyVector &right)
std::vector< GeoMPVEntry * > m_MPV
void AddElement(double aPhotonMomentum, double aPropertyValue)