Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
PHG4CellContainer.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4CellContainer.h
1
// Tell emacs that this is a C++ source
2
// -*- C++ -*-.
3
#ifndef G4DETECTORS_PHG4CELLCONTAINER_H
4
#define G4DETECTORS_PHG4CELLCONTAINER_H
5
6
#include "
PHG4CellDefs.h
"
// for keytype
7
8
#include <
phool/PHObject.h
>
9
10
#include <iostream>
// for cout, ostream
11
#include <map>
12
#include <utility>
// for pair
13
14
class
PHG4Cell
;
15
16
class
PHG4CellContainer
:
public
PHObject
17
{
18
public
:
19
typedef
std::map<PHG4CellDefs::keytype, PHG4Cell *>
Map
;
20
typedef
Map::iterator
Iterator
;
21
typedef
Map::const_iterator
ConstIterator
;
22
typedef
std::pair<Iterator, Iterator>
Range
;
23
typedef
std::pair<ConstIterator, ConstIterator>
ConstRange
;
24
25
PHG4CellContainer
();
26
27
~PHG4CellContainer
()
override
{}
28
29
// from PHObject
30
void
Reset
()
override
;
31
void
identify
(std::ostream &
os
= std::cout)
const override
;
32
33
ConstIterator
AddCell
(
PHG4Cell
*newCell);
34
ConstIterator
AddCellSpecifyKey
(
const
PHG4CellDefs::keytype
key,
PHG4Cell
*newCell);
35
37
void
RemoveCell
(
PHG4CellDefs::keytype
key)
38
{
39
cellmap
.erase(key);
40
}
41
43
void
RemoveCell
(
PHG4Cell
*cell)
44
{
45
Iterator
its =
cellmap
.begin();
46
Iterator
last =
cellmap
.end();
47
for
(; its != last;)
48
{
49
if
(its->second == cell)
50
{
51
cellmap
.erase(its++);
52
}
53
else
54
{
55
++its;
56
}
57
}
58
}
59
60
Iterator
findOrAddCell
(
PHG4CellDefs::keytype
key);
61
63
ConstRange
getCells
(
const
unsigned
short
int
detid)
const
;
64
66
ConstRange
getCells
(
void
)
const
;
67
68
PHG4Cell
*
findCell
(
PHG4CellDefs::keytype
key);
69
70
unsigned
int
size
(
void
)
const
71
{
72
return
cellmap
.size();
73
}
74
75
double
getTotalEdep
()
const
;
76
77
protected
:
78
Map
cellmap
;
79
ClassDefOverride(
PHG4CellContainer
, 1)
80
};
81
82
#endif
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4CellContainer.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:12
using
1.8.2 with
sPHENIX GitHub integration