~jan.greis/maus/1811

« back to all changes in this revision

Viewing changes to src/common_cpp/DataStructure/EMREventTrack.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:
 
1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk/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
#include "DataStructure/EMREventTrack.hh"
 
18
 
 
19
namespace MAUS {
 
20
 
 
21
EMREventTrack::EMREventTrack()
 
22
  : _emrplanehits(), _emrspacepoints(),
 
23
    _track(), _type(""), _id(-1), _time(-1.),
 
24
    _plane_density_ma(-1.), _plane_density_sa(-1.),
 
25
    _total_charge_ma(-1.), _total_charge_sa(-1.),
 
26
    _charge_ratio_ma(-1.), _charge_ratio_sa(-1.) {
 
27
}
 
28
 
 
29
EMREventTrack::EMREventTrack(const EMREventTrack& emret)
 
30
  : _emrplanehits(), _emrspacepoints(),
 
31
    _track(), _type(""), _id(-1), _time(-1.),
 
32
    _plane_density_ma(-1.), _plane_density_sa(-1.),
 
33
    _total_charge_ma(-1.), _total_charge_sa(-1.),
 
34
    _charge_ratio_ma(-1.), _charge_ratio_sa(-1.) {
 
35
 
 
36
  *this = emret;
 
37
}
 
38
 
 
39
EMREventTrack& EMREventTrack::operator=(const EMREventTrack& emret) {
 
40
  if (this == &emret)
 
41
        return *this;
 
42
 
 
43
  this->_emrplanehits = emret._emrplanehits;
 
44
  for (size_t i = 0; i < this->_emrplanehits.size(); i++)
 
45
    this->_emrplanehits[i] = new EMRPlaneHit(*(this->_emrplanehits[i]));
 
46
 
 
47
  this->_emrspacepoints = emret._emrspacepoints;
 
48
  for (size_t i = 0; i < this->_emrspacepoints.size(); i++)
 
49
    this->_emrspacepoints[i] = new EMRSpacePoint(*(this->_emrspacepoints[i]));
 
50
 
 
51
  this->SetEMRTrack(emret._track);
 
52
  this->SetType(emret._type);
 
53
  this->SetTrackId(emret._id);
 
54
  this->SetTime(emret._time);
 
55
  this->SetPlaneDensityMA(emret._plane_density_ma);
 
56
  this->SetPlaneDensitySA(emret._plane_density_sa);
 
57
  this->SetTotalChargeMA(emret._total_charge_ma);
 
58
  this->SetTotalChargeSA(emret._total_charge_sa);
 
59
  this->SetChargeRatioMA(emret._charge_ratio_ma);
 
60
  this->SetChargeRatioSA(emret._charge_ratio_sa);
 
61
 
 
62
  return *this;
 
63
}
 
64
 
 
65
EMREventTrack::~EMREventTrack() {
 
66
 
 
67
  for (size_t i = 0; i < _emrplanehits.size(); i++)
 
68
    delete _emrplanehits[i];
 
69
 
 
70
  _emrplanehits.resize(0);
 
71
 
 
72
  for (size_t i = 0; i < _emrspacepoints.size(); i++)
 
73
    delete _emrspacepoints[i];
 
74
 
 
75
  _emrspacepoints.resize(0);
 
76
}
 
77
 
 
78
void EMREventTrack::SetEMRPlaneHitArray(EMRPlaneHitArray emrplanehits) {
 
79
 
 
80
  for (size_t i = 0; i < _emrplanehits.size(); i++) {
 
81
    if (_emrplanehits[i] != NULL)
 
82
        delete _emrplanehits[i];
 
83
  }
 
84
  _emrplanehits = emrplanehits;
 
85
}
 
86
 
 
87
void EMREventTrack::SetEMRSpacePointArray(EMRSpacePointArray emrspacepoints) {
 
88
 
 
89
  for (size_t i = 0; i < _emrspacepoints.size(); i++) {
 
90
    if (_emrspacepoints[i] != NULL)
 
91
        delete _emrspacepoints[i];
 
92
  }
 
93
  _emrspacepoints = emrspacepoints;
 
94
}
 
95
} // namespace MAUS