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
PHG4ScintillatorSlatContainer.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file PHG4ScintillatorSlatContainer.cc
1
#include "
PHG4ScintillatorSlatContainer.h
"
2
3
#include "
PHG4ScintillatorSlat.h
"
// for PHG4ScintillatorSlat
4
#include "
PHG4ScintillatorSlatDefs.h
"
5
6
#include <cstdlib>
7
8
void
PHG4ScintillatorSlatContainer::Reset
()
9
{
10
while
(
slatmap
.begin() !=
slatmap
.end())
11
{
12
delete
slatmap
.begin()->second;
13
slatmap
.erase(
slatmap
.begin());
14
}
15
return
;
16
}
17
18
void
PHG4ScintillatorSlatContainer::identify
(std::ostream&
os
)
const
19
{
20
std::map<unsigned int, PHG4ScintillatorSlat*>::const_iterator iter;
21
os <<
"Number of slats: "
<<
size
() << std::endl;
22
for
(iter =
slatmap
.begin(); iter !=
slatmap
.end(); ++iter)
23
{
24
os <<
"slat key 0x"
<< std::hex << iter->first << std::dec << std::endl;
25
(iter->second)->
identify
();
26
}
27
return
;
28
}
29
30
PHG4ScintillatorSlatContainer::ConstIterator
31
PHG4ScintillatorSlatContainer::AddScintillatorSlat
(
const
PHG4ScintillatorSlatDefs::keytype
key,
PHG4ScintillatorSlat
* newslat)
32
{
33
if
(
slatmap
.find(key) !=
slatmap
.end())
34
{
35
std::cout <<
"PHG4ScintillatorSlatContainer::AddScintillatorSlatSpecifyKey: duplicate key: "
<< key <<
" exiting now"
<< std::endl;
36
exit(1);
37
}
38
newslat->
set_key
(key);
39
slatmap
[key] = newslat;
40
return
slatmap
.find(key);
41
}
42
43
PHG4ScintillatorSlatContainer::ConstRange
44
PHG4ScintillatorSlatContainer::getScintillatorSlats
(
const
short
icolumn)
const
45
{
46
if
((icolumn >>
PHG4ScintillatorSlatDefs::columnbits
) > 0)
47
{
48
std::cout <<
" column id too large: "
<< icolumn << std::endl;
49
exit(1);
50
}
51
// unsigned int shiftval = detid << slat_idbits;
52
PHG4ScintillatorSlatDefs::keytype
keylow = icolumn <<
PHG4ScintillatorSlatDefs::columnbits
;
53
PHG4ScintillatorSlatDefs::keytype
keyup = ((icolumn + 1) << PHG4ScintillatorSlatDefs::columnbits) - 1;
54
// cout << "keylow: 0x" << hex << keylow << dec << std::endl;
55
// cout << "keyup: 0x" << hex << keyup << dec << std::endl;
56
ConstRange
retpair;
57
retpair.first =
slatmap
.lower_bound(keylow);
58
retpair.second =
slatmap
.upper_bound(keyup);
59
return
retpair;
60
}
61
62
PHG4ScintillatorSlatContainer::ConstRange
63
PHG4ScintillatorSlatContainer::getScintillatorSlats
()
const
64
{
65
return
std::make_pair(
slatmap
.begin(),
slatmap
.end());
66
}
67
68
PHG4ScintillatorSlat
*
69
PHG4ScintillatorSlatContainer::findScintillatorSlat
(
PHG4ScintillatorSlatDefs::keytype
key)
70
{
71
PHG4ScintillatorSlatContainer::ConstIterator
it
=
slatmap
.find(key);
72
73
if
(it !=
slatmap
.end())
74
{
75
return
it->second;
76
}
77
78
return
nullptr
;
79
}
80
81
double
82
PHG4ScintillatorSlatContainer::getTotalEdep
()
const
83
{
84
ConstIterator
iter;
85
double
totalenergy = 0;
86
for
(iter =
slatmap
.begin(); iter !=
slatmap
.end(); ++iter)
87
{
88
totalenergy += iter->second->get_edep();
89
}
90
return
totalenergy;
91
}
coresoftware
blob
master
simulation
g4simulation
g4detectors
PHG4ScintillatorSlatContainer.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:13
using
1.8.2 with
sPHENIX GitHub integration