BmnRoot
Loading...
Searching...
No Matches
BmnNdetEvent.cxx
Go to the documentation of this file.
1
#include "
BmnNdetEvent.h
"
2
3
#include "FairLogger.h"
4
5
#include <iostream>
6
7
BmnNdetEvent::BmnNdetEvent
()
8
: TNamed(
"BmnNdetEvent"
,
"NdetEvent"
)
9
, fCells(new TClonesArray(
"BmnNdetCell"
))
10
{}
11
12
BmnNdetEvent::~BmnNdetEvent
()
13
{
14
if
(fCells) {
15
fCells->Delete();
16
delete
fCells;
17
fCells =
nullptr
;
18
}
19
}
20
21
BmnNdetEvent::BmnNdetEvent
(
const
BmnNdetEvent
& other)
22
: TNamed(other)
23
, fCells(new TClonesArray(
"BmnNdetCell"
, other.fCells->GetSize()))
24
{
25
for
(
int
i
= 0;
i
< other.fCells->GetEntriesFast(); ++
i
) {
26
new
((*fCells)[
i
])
BmnNdetCell
(*(
BmnNdetCell
*)other.fCells->At(
i
));
27
}
28
}
29
30
BmnNdetEvent::BmnNdetEvent
(
BmnNdetEvent
&& other) noexcept
31
: TNamed(std::move(other))
32
, fCells(other.fCells)
33
{
34
other.fCells =
nullptr
;
35
}
36
37
BmnNdetEvent
&
BmnNdetEvent::operator=
(
const
BmnNdetEvent
& other)
38
{
39
if
(
this
!= &other) {
40
TNamed::operator=(other);
41
42
if
(fCells) {
43
fCells->Delete();
44
delete
fCells;
45
}
46
47
fCells =
new
TClonesArray(
"BmnNdetCell"
, other.fCells->GetSize());
48
for
(
int
i
= 0;
i
< other.fCells->GetEntriesFast(); ++
i
) {
49
new
((*fCells)[
i
])
BmnNdetCell
(*(
BmnNdetCell
*)other.fCells->At(
i
));
50
}
51
}
52
return
*
this
;
53
}
54
55
BmnNdetEvent
&
BmnNdetEvent::operator=
(
BmnNdetEvent
&& other)
noexcept
56
{
57
if
(
this
!= &other) {
58
TNamed::operator=(std::move(other));
59
60
if
(fCells) {
61
fCells->Delete();
62
delete
fCells;
63
}
64
65
fCells = other.fCells;
66
other.fCells =
nullptr
;
67
}
68
return
*
this
;
69
}
70
71
void
BmnNdetEvent::AddCell
(
BmnNdetCell
* cell)
72
{
73
if
(!
GetCell
(cell->
GetAddress
())) {
74
new
((*fCells)[fCells->GetEntriesFast()])
BmnNdetCell
(*cell);
75
}
else
{
76
LOG(error) <<
"BmnNdetEvent::AddCell. Tried to duplicate address."
;
77
return
;
78
}
79
}
80
81
BmnNdetCell
*
BmnNdetEvent::GetCell
(uint32_t address)
82
{
83
for
(
int
i
= 0;
i
< fCells->GetEntriesFast(); ++
i
) {
84
BmnNdetCell
* cell = (
BmnNdetCell
*)fCells->At(
i
);
85
if
(cell->
GetAddress
() == address) {
86
return
cell;
87
}
88
}
89
return
nullptr
;
90
}
91
92
BmnNdetCell
*
BmnNdetEvent::GetCell
(uint32_t ArmId, uint32_t RowId, uint32_t ColumnId, uint32_t LayerId)
93
{
94
uint32_t address =
BmnNdetAddress::GetAddress
(ArmId, RowId, ColumnId, LayerId);
95
return
GetCell
(address);
96
}
97
98
void
BmnNdetEvent::reset
()
99
{
100
if
(fCells) {
101
fCells->Delete();
102
}
103
}
104
105
void
BmnNdetEvent::ResetCells
()
106
{
107
for
(
int
i
= 0;
i
< fCells->GetEntriesFast(); ++
i
) {
108
BmnNdetCell
* cell = (
BmnNdetCell
*)fCells->At(
i
);
109
cell->
ResetTimeEnergy
();
110
}
111
}
i
int i
Definition
P4_F32vec4.h:22
BmnNdetAddress::GetAddress
static uint32_t GetAddress(uint32_t ArmId, uint32_t RowId, uint32_t ColumnId, uint32_t LayerId)
Return address.
Definition
BmnNdetAddress.h:39
BmnNdetCell
Definition
BmnNdetCell.h:11
BmnNdetCell::GetAddress
uint32_t GetAddress() const
Definition
BmnNdetCell.h:44
BmnNdetCell::ResetTimeEnergy
void ResetTimeEnergy()
Definition
BmnNdetCell.cxx:88
BmnNdetEvent
Class for Bmn Ndet data container in event.
Definition
BmnNdetEvent.h:20
BmnNdetEvent::~BmnNdetEvent
virtual ~BmnNdetEvent()
Definition
BmnNdetEvent.cxx:12
BmnNdetEvent::BmnNdetEvent
BmnNdetEvent()
Default constructor.
Definition
BmnNdetEvent.cxx:7
BmnNdetEvent::GetCell
BmnNdetCell * GetCell(uint32_t address)
Get a cell based on its address.
Definition
BmnNdetEvent.cxx:81
BmnNdetEvent::reset
void reset()
Zero all fields.
Definition
BmnNdetEvent.cxx:98
BmnNdetEvent::AddCell
void AddCell(BmnNdetCell *cell)
Add a cell to the event.
Definition
BmnNdetEvent.cxx:71
BmnNdetEvent::operator=
BmnNdetEvent & operator=(const BmnNdetEvent &)
Definition
BmnNdetEvent.cxx:37
BmnNdetEvent::ResetCells
void ResetCells()
Reset time and energy for all cells.
Definition
BmnNdetEvent.cxx:105
BmnNdetEvent.h
detectors
ndet
BmnNdetEvent.cxx
Generated on Fri May 15 2026 10:40:52 for BmnRoot by
1.9.8