~9marusia6/maus/beamlinesimulation

« back to all changes in this revision

Viewing changes to src/common_cpp/DataStructure/MCEvent.cc

  • Committer: Chris Rogers
  • Date: 2012-03-19 16:58:18 UTC
  • mfrom: (659.1.14 release-candidate)
  • Revision ID: chris.rogers@stfc.ac.uk-20120319165818-phqgtdhvj210d44d
ReleaseĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
#include "src/common_cpp/DataStructure/Track.hh"
18
 
#include "src/common_cpp/DataStructure/Hit.hh"
19
18
#include "src/common_cpp/DataStructure/VirtualHit.hh"
20
19
#include "src/common_cpp/DataStructure/Primary.hh"
21
20
 
24
23
namespace MAUS {
25
24
 
26
25
MCEvent::MCEvent()
27
 
       : _primary(NULL), _virtuals(NULL), _hits(NULL), _tracks(NULL) {
 
26
       : _primary(NULL), _virtuals(NULL), _sci_fi_hits(NULL), _tof_hits(NULL),
 
27
         _special_virtual_hits(NULL), _tracks(NULL) {
28
28
}
29
29
 
30
30
MCEvent::MCEvent(const MCEvent& md)
31
 
       : _primary(NULL), _virtuals(NULL), _hits(NULL), _tracks(NULL) {
 
31
       : _primary(NULL), _virtuals(NULL), _sci_fi_hits(NULL), _tof_hits(NULL),
 
32
         _special_virtual_hits(NULL), _tracks(NULL) {
32
33
  *this = md;
33
34
}
34
35
 
54
55
        _virtuals = new VirtualHitArray(*md._virtuals);
55
56
    }
56
57
 
57
 
 
58
 
    if (_hits != NULL) {
59
 
        delete _hits;
60
 
    }
61
 
    if (md._hits == NULL) {
62
 
        _hits = NULL;
63
 
    } else {
64
 
        _hits = new HitArray(*md._hits);
 
58
    if (_sci_fi_hits != NULL) {
 
59
        delete _sci_fi_hits;
 
60
    }
 
61
    if (md._sci_fi_hits == NULL) {
 
62
        _sci_fi_hits = NULL;
 
63
    } else {
 
64
        _sci_fi_hits = new SciFiHitArray(*md._sci_fi_hits);
 
65
    }
 
66
 
 
67
    if (_tof_hits != NULL) {
 
68
        delete _tof_hits;
 
69
    }
 
70
    if (md._tof_hits == NULL) {
 
71
        _tof_hits = NULL;
 
72
    } else {
 
73
        _tof_hits = new TOFHitArray(*md._tof_hits);
 
74
    }
 
75
 
 
76
    if (_special_virtual_hits != NULL) {
 
77
        delete _special_virtual_hits;
 
78
    }
 
79
    if (md._special_virtual_hits == NULL) {
 
80
        _special_virtual_hits = NULL;
 
81
    } else {
 
82
        _special_virtual_hits =
 
83
                          new SpecialVirtualHitArray(*md._special_virtual_hits);
65
84
    }
66
85
 
67
86
    if (_primary != NULL) {
85
104
        delete _virtuals;
86
105
        _virtuals = NULL;
87
106
    }
88
 
    if (_hits != NULL) {
89
 
        delete _hits;
90
 
        _hits = NULL;
 
107
    if (_sci_fi_hits != NULL) {
 
108
        delete _sci_fi_hits;
 
109
        _sci_fi_hits = NULL;
 
110
    }
 
111
    if (_tof_hits != NULL) {
 
112
        delete _tof_hits;
 
113
        _tof_hits = NULL;
 
114
    }
 
115
    if (_special_virtual_hits != NULL) {
 
116
        delete _special_virtual_hits;
 
117
        _special_virtual_hits = NULL;
91
118
    }
92
119
    if (_primary != NULL) {
93
120
        delete _primary;
117
144
    _virtuals = hits;
118
145
}
119
146
 
120
 
HitArray* MCEvent::GetHits() const {
121
 
    return _hits;
122
 
}
123
 
 
124
 
void MCEvent::SetHits(HitArray* hits) {
125
 
    if (_hits != NULL) {
126
 
        delete _hits;
127
 
    }
128
 
    _hits = hits;
 
147
SciFiHitArray* MCEvent::GetSciFiHits() const {
 
148
    return _sci_fi_hits;
 
149
}
 
150
 
 
151
void MCEvent::SetSciFiHits(SciFiHitArray* hits) {
 
152
    if (_sci_fi_hits != NULL) {
 
153
        delete _sci_fi_hits;
 
154
    }
 
155
    _sci_fi_hits = hits;
 
156
}
 
157
 
 
158
TOFHitArray* MCEvent::GetTOFHits() const {
 
159
    return _tof_hits;
 
160
}
 
161
 
 
162
void MCEvent::SetTOFHits(TOFHitArray* hits) {
 
163
    if (_tof_hits != NULL) {
 
164
        delete _tof_hits;
 
165
    }
 
166
    _tof_hits = hits;
 
167
}
 
168
 
 
169
SpecialVirtualHitArray* MCEvent::GetSpecialVirtualHits() const {
 
170
    return _special_virtual_hits;
 
171
}
 
172
 
 
173
void MCEvent::SetSpecialVirtualHits(SpecialVirtualHitArray* hits) {
 
174
    if (_special_virtual_hits != NULL) {
 
175
        delete _special_virtual_hits;
 
176
    }
 
177
    _special_virtual_hits = hits;
129
178
}
130
179
 
131
180
Primary* MCEvent::GetPrimary() const {