ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
RawTowerGeomContainerv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file RawTowerGeomContainerv1.cc
1
#include "
RawTowerGeomContainerv1.h
"
2
3
#include "
RawTowerGeom.h
"
4
5
#include <cassert>
6
#include <cstdlib>
7
#include <iostream>
8
#include <map>
9
#include <utility>
10
11
using namespace
std;
12
13
RawTowerGeomContainerv1::RawTowerGeomContainerv1
(
RawTowerDefs::CalorimeterId
caloid)
14
: _caloid(caloid)
15
{
16
}
17
18
RawTowerGeomContainerv1::~RawTowerGeomContainerv1
()
19
{
20
Reset
();
//make sure everything is deleted
21
}
22
23
RawTowerGeomContainerv1::ConstRange
24
RawTowerGeomContainerv1::get_tower_geometries
(
void
)
const
25
{
26
return
make_pair<ConstIterator, ConstIterator>(
_geoms
.begin(),
_geoms
.end());
27
}
28
29
RawTowerGeomContainerv1::Range
30
RawTowerGeomContainerv1::get_tower_geometries
(
void
)
31
{
32
return
make_pair<Iterator, Iterator>(
_geoms
.begin(),
_geoms
.end());
33
}
34
35
RawTowerGeomContainerv1::ConstIterator
36
RawTowerGeomContainerv1::add_tower_geometry
(
RawTowerGeom
* geo)
37
{
38
assert(geo);
39
40
if
(
RawTowerDefs::decode_caloid
(geo->
get_id
()) !=
get_calorimeter_id
())
41
{
42
cout <<
"RawTowerGeomContainerv1::add_tower_geometry - Fatal Error - "
43
"attempting to add tower geometry with id = "
44
<< geo->
get_id
()
45
<<
" with CaloID = "
<<
RawTowerDefs::decode_caloid
(geo->
get_id
())
46
<<
" to this container of CaloID = "
<<
get_calorimeter_id
() <<
"."
;
47
geo->
identify
(cout);
48
exit
(2);
49
}
50
51
Iterator
it
=
_geoms
.find(geo->
get_id
());
52
if
(it !=
_geoms
.end())
53
{
54
cout
55
<<
"RawTowerGeomContainerv1::add_tower_geometry - WARNING - replace tower geometry for tower #"
56
<< geo->
get_id
() <<
". This Old tower will be deleted: "
;
57
it->second->identify(cout);
58
59
delete
it->second;
60
_geoms
.erase(it);
61
}
62
63
_geoms
[geo->
get_id
()] = geo;
64
return
_geoms
.find(geo->
get_id
());
65
}
66
67
RawTowerGeom
*
68
RawTowerGeomContainerv1::get_tower_geometry
(
RawTowerDefs::keytype
key)
69
{
70
Iterator
it
=
_geoms
.find(key);
71
if
(it !=
_geoms
.end())
72
{
73
return
it->second;
74
}
75
return
NULL;
76
}
77
78
int
RawTowerGeomContainerv1::isValid
()
const
79
{
80
return
(!
_geoms
.empty());
81
}
82
83
void
RawTowerGeomContainerv1::Reset
()
84
{
85
while
(
_geoms
.begin() !=
_geoms
.end())
86
{
87
delete
_geoms
.begin()->second;
88
_geoms
.erase(
_geoms
.begin());
89
}
90
}
91
92
void
RawTowerGeomContainerv1::identify
(std::ostream& os)
const
93
{
94
os <<
"RawTowerGeomContainerv1, number of tower geometries: "
<<
size
()
95
<< std::endl;
96
}
coresoftware
blob
master
offline
packages
CaloBase
RawTowerGeomContainerv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:34
using
1.8.2 with
ECCE GitHub integration