~jan.greis/maus/1811

« back to all changes in this revision

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

  • Committer: Adam Dobbs
  • Date: 2016-01-13 11:31:12 UTC
  • mfrom: (659.2.18 release-candidate)
  • Revision ID: phuccj@gmail.com-20160113113112-bhbguupn50eyvd0z
Tags: MAUS-v1.4, MAUS-v1.4.0
MAUS-v1.4.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
#include "DataStructure/EMRSpillData.hh"
18
 
#include "DataStructure/EMRPlaneHit.hh"
19
18
 
20
19
namespace MAUS {
21
20
 
22
21
EMRSpillData::EMRSpillData()
23
 
  : _emrplanehitarray() {
24
 
}
25
 
 
26
 
EMRSpillData::EMRSpillData(const EMRSpillData& _emrspilldata)
27
 
  : _emrplanehitarray() {
28
 
  *this = _emrspilldata;
29
 
}
30
 
 
31
 
EMRSpillData& EMRSpillData::operator=(const EMRSpillData& _emrspilldata) {
32
 
  if (this == &_emrspilldata) {
 
22
  : _emrbarhits(), _emreventtracks() {
 
23
}
 
24
 
 
25
EMRSpillData::EMRSpillData(const EMRSpillData& emrsd)
 
26
  : _emrbarhits(), _emreventtracks() {
 
27
  *this = emrsd;
 
28
}
 
29
 
 
30
EMRSpillData& EMRSpillData::operator=(const EMRSpillData& emrsd) {
 
31
  if (this == &emrsd)
33
32
      return *this;
34
 
  }
35
 
  this->_emrplanehitarray = _emrspilldata._emrplanehitarray;
36
 
  for (size_t i = 0; i < this->_emrplanehitarray.size(); i++)
37
 
    this->_emrplanehitarray[i] = new EMRPlaneHit(*(this->_emrplanehitarray[i]));
 
33
 
 
34
  this->SetEMRBarHitArray(emrsd._emrbarhits);
 
35
 
 
36
  this->_emreventtracks = emrsd._emreventtracks;
 
37
  for (size_t i = 0; i < this->_emreventtracks.size(); i++)
 
38
    this->_emreventtracks[i] = new EMREventTrack(*(this->_emreventtracks[i]));
38
39
 
39
40
  return *this;
40
41
}
41
42
 
42
43
EMRSpillData::~EMRSpillData() {
43
 
  int nph = _emrplanehitarray.size();
44
 
  for (int i = 0; i < nph; i++)
45
 
    delete _emrplanehitarray[i];
46
 
 
47
 
  _emrplanehitarray.resize(0);
48
 
}
49
 
 
50
 
EMRPlaneHitArray EMRSpillData::GetEMRPlaneHitArray() const {
51
 
  return _emrplanehitarray;
52
 
}
53
 
 
54
 
void EMRSpillData::SetEMRPlaneHitArray(EMRPlaneHitArray emrplanehitarray) {
55
 
  int nplhits = _emrplanehitarray.size();
56
 
  for (int i = 0; i < nplhits; i++) {
57
 
    if (_emrplanehitarray[i] != NULL)
58
 
        delete _emrplanehitarray[i];
 
44
 
 
45
  for (size_t i = 0; i < _emreventtracks.size(); i++)
 
46
    delete _emreventtracks[i];
 
47
 
 
48
  _emreventtracks.resize(0);
 
49
}
 
50
 
 
51
void EMRSpillData::SetEMREventTrackArray(EMREventTrackArray emreventtracks) {
 
52
 
 
53
  for (size_t i = 0; i < _emreventtracks.size(); i++) {
 
54
    if (_emreventtracks[i] != NULL)
 
55
        delete _emreventtracks[i];
59
56
  }
60
 
  _emrplanehitarray = emrplanehitarray;
61
 
}
62
 
}
63
 
 
 
57
  _emreventtracks = emreventtracks;
 
58
}
 
59
} // namespace MAUS