1
|
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
|
2
|
*
|
3
|
* MAUS is free software: you can redistribute it and/or modify
|
4
|
* it under the terms of the GNU General Public License as published by
|
5
|
* the Free Software Foundation, either version 3 of the License, or
|
6
|
* (at your option) any later version.
|
7
|
*
|
8
|
* MAUS is distributed in the hope that it will be useful,
|
9
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
* GNU General Public License for more details.
|
12
|
*
|
13
|
* You should have received a copy of the GNU General Public License
|
14
|
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
#include "DataStructure/Global/PrimaryChain.hh"
|
19
|
|
20
|
namespace MAUS {
|
21
|
namespace DataStructure {
|
22
|
namespace Global {
|
23
|
|
24
|
// Default constructor
|
25
|
PrimaryChain::PrimaryChain()
|
26
|
: _mapper_name("") {
|
27
|
_lr_spacepoints = new TRefArray();
|
28
|
_lr_tracks = new TRefArray();
|
29
|
_tracks = new TRefArray();
|
30
|
}
|
31
|
|
32
|
// Copy constructor
|
33
|
PrimaryChain::PrimaryChain(const PrimaryChain &primary_chain)
|
34
|
: _mapper_name(primary_chain._mapper_name) {
|
35
|
_lr_spacepoints = new TRefArray(*primary_chain._lr_spacepoints);
|
36
|
_lr_tracks = new TRefArray(*primary_chain._lr_tracks);
|
37
|
_tracks = new TRefArray(*primary_chain._tracks);
|
38
|
}
|
39
|
|
40
|
// Constructor setting mapper name
|
41
|
PrimaryChain::PrimaryChain(std::string mapper_name)
|
42
|
: _mapper_name(mapper_name) {
|
43
|
_lr_spacepoints = new TRefArray();
|
44
|
_lr_tracks = new TRefArray();
|
45
|
_tracks = new TRefArray();
|
46
|
}
|
47
|
|
48
|
// Destructor
|
49
|
PrimaryChain::~PrimaryChain() {
|
50
|
delete _lr_spacepoints;
|
51
|
delete _lr_tracks;
|
52
|
delete _tracks;
|
53
|
}
|
54
|
|
55
|
// Assignment Operator
|
56
|
PrimaryChain& PrimaryChain::operator=(const PrimaryChain &primary_chain) {
|
57
|
if (this == &primary_chain) {
|
58
|
return *this;
|
59
|
}
|
60
|
_mapper_name = primary_chain._mapper_name;
|
61
|
_lr_spacepoints = new TRefArray(*primary_chain._lr_spacepoints);
|
62
|
_lr_tracks = new TRefArray(*primary_chain._lr_tracks);
|
63
|
_tracks = new TRefArray(*primary_chain._tracks);
|
64
|
return *this;
|
65
|
}
|
66
|
|
67
|
void PrimaryChain::AddLRSpacePoint(SpacePoint* spacepoint) {
|
68
|
_lr_spacepoints->Add(spacepoint);
|
69
|
}
|
70
|
|
71
|
void PrimaryChain::AddLRTrack(Track* track) {
|
72
|
_lr_tracks->Add(track);
|
73
|
}
|
74
|
|
75
|
void PrimaryChain::AddTrack(Track* track) {
|
76
|
_tracks->Add(track);
|
77
|
}
|
78
|
|
79
|
std::vector<SpacePoint*> GetLRSpacePoints() {
|
80
|
std::vector<SpacePoint*> spacepoints;
|
81
|
const SpacePoint* sp = NULL;
|
82
|
int n =_lr_spacepoints->GetEntries();
|
83
|
for (int i = 0; i < n; i++) {
|
84
|
sp = (const SpacePoint*) _lr_spacepoints->At(i);
|
85
|
if (!sp) continue;
|
86
|
spacepoints.push_back(sp);
|
87
|
}
|
88
|
return spacepoints;
|
89
|
}
|
90
|
|
91
|
std::vector<Track*> GetLRTracks() {
|
92
|
std::vector<Track*> tracks;
|
93
|
const Track* track = NULL;
|
94
|
int n = _lr_tracks->GetEntries();
|
95
|
for (int i = 0; i < n; i++) {
|
96
|
track = (Track*) _lr_tracks->At(i);
|
97
|
if (!track) continue;
|
98
|
tracks.push_back(track);
|
99
|
}
|
100
|
return tracks;
|
101
|
}
|
102
|
|
103
|
std::vector<Track*> GetTracks() {
|
104
|
std::vector<Track*> tracks;
|
105
|
const Track* track = NULL;
|
106
|
int n = _tracks->GetEntries();
|
107
|
for (int i = 0; i < n; i++) {
|
108
|
track = (Track*) _tracks->At(i);
|
109
|
if (!track) continue;
|
110
|
tracks.push_back(track);
|
111
|
}
|
112
|
return tracks;
|
113
|
}
|
114
|
|
115
|
std::vector<Track*> GetTracks(std::string mapper_name) {
|
116
|
std::vector<Track*> tracks;
|
117
|
const Track* track = NULL;
|
118
|
int n = _tracks->GetEntries();
|
119
|
for (int i = 0; i < n; i++) {
|
120
|
track = (Track*) _tracks->At(i);
|
121
|
if (!track) continue;
|
122
|
if (track->get_mapper_name() == mapper_name) {
|
123
|
tracks.push_back(track);
|
124
|
}
|
125
|
}
|
126
|
return tracks;
|
127
|
}
|
128
|
|
129
|
void set_mapper_name(std::string mapper_name) {
|
130
|
_mapper_name = mapper_name;
|
131
|
}
|
132
|
|
133
|
std::string get_mapper_name() const {
|
134
|
return _mapper_name
|
135
|
}
|
136
|
} // ~namespace Global
|
137
|
} // ~namespace DataStructure
|
138
|
} // ~namespace MAUS
|