~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

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

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * along with MAUS.  If not, see <http://www.gnu.org/licenses/>.
15
15
 */
16
16
 
17
 
#include <iostream>
18
 
 
19
 
#include "src/common_cpp/DataStructure/Spill.hh"
 
17
#include "DataStructure/Spill.hh"
20
18
 
21
19
namespace MAUS {
22
20
 
23
21
Spill::Spill()
24
 
        : _daq(NULL), _scalars(NULL), _emr(NULL), _mc(NULL), _recon(NULL),
 
22
        : _daq(NULL), _scalars(NULL), _mc(NULL), _recon(NULL),
25
23
          _spill_number(0), _run_number(0), _daq_event_type(), _errors(),
26
24
          _test(NULL) {
27
25
}
28
26
 
29
27
Spill::Spill(const Spill& md)
30
 
        : _daq(NULL), _scalars(NULL), _emr(NULL), _mc(NULL), _recon(NULL),
 
28
        : _daq(NULL), _scalars(NULL), _mc(NULL), _recon(NULL),
31
29
          _spill_number(0), _run_number(0), _daq_event_type(), _errors(),
32
30
          _test(NULL) {
33
31
  *this = md;
55
53
        _scalars = new Scalars(*md._scalars);
56
54
    }
57
55
 
58
 
    if (_emr != NULL) {
59
 
        delete _emr;
60
 
    }
61
 
    if (md._emr == NULL) {
62
 
        _emr = NULL;
63
 
    } else {
64
 
        _emr = new EMRSpillData(*md._emr);
65
 
    }
66
 
 
67
56
    if (_mc != NULL) {
68
57
        for (size_t i = 0; i < _mc->size(); ++i) {
69
58
            delete (*_mc)[i];
73
62
    if (md._mc == NULL) {
74
63
        _mc = NULL;
75
64
    } else {
76
 
        _mc = new MCEventArray(*md._mc);
 
65
        _mc = new MCEventPArray(*md._mc);
77
66
    }
78
67
 
79
68
    if (_recon != NULL) {
85
74
    if (md._recon == NULL) {
86
75
        _recon = NULL;
87
76
    } else {
88
 
        _recon = new ReconEventArray(*md._recon);
 
77
        _recon = new ReconEventPArray(*md._recon);
89
78
    }
90
79
 
91
80
    _daq_event_type = md._daq_event_type;
107
96
    if (_scalars != NULL) {
108
97
        delete _scalars;
109
98
    }
110
 
    if (_emr != NULL) {
111
 
        delete _emr;
112
 
    }
 
99
 
113
100
    if (_mc != NULL) {
114
101
        for (size_t i = 0; i < _mc->size(); ++i) {
115
102
            delete (*_mc)[i];
127
114
    }
128
115
}
129
116
 
130
 
void Spill::SetScalars(Scalars* scalars) {
 
117
void Spill::SetScalars(Scalars *scalars) {
131
118
  _scalars = scalars;
132
119
}
133
120
 
135
122
  return _scalars;
136
123
}
137
124
 
138
 
void Spill::SetEMRSpillData(EMRSpillData* emr) {
139
 
  _emr = emr;
140
 
}
141
 
 
142
 
EMRSpillData* Spill::GetEMRSpillData() const {
143
 
  return _emr;
144
 
}
145
 
 
146
 
void Spill::SetMCEvents(MCEventArray* mc) {
 
125
void Spill::SetMCEvents(MCEventPArray* mc) {
147
126
  _mc = mc;
148
127
}
149
128
 
150
 
MCEventArray* Spill::GetMCEvents() const {
 
129
MCEventPArray* Spill::GetMCEvents() const {
151
130
  return _mc;
152
131
}
153
132
 
154
 
void Spill::SetReconEvents(ReconEventArray* recon) {
 
133
void Spill::SetReconEvents(ReconEventPArray* recon) {
155
134
  _recon = recon;
156
135
}
157
136
 
158
 
ReconEventArray* Spill::GetReconEvents() const {
 
137
ReconEventPArray* Spill::GetReconEvents() const {
159
138
  return _recon;
160
139
}
161
140
 
162
 
void Spill::SetDAQData(DAQData* daq) {
 
141
void Spill::SetDAQData(DAQData *daq) {
163
142
  _daq = daq;
164
143
}
165
144
 
191
170
    return _daq_event_type;
192
171
}
193
172
 
194
 
 
195
173
void Spill::SetErrors(ErrorsMap errors) {
196
174
  _errors = errors;
197
175
}