Project

General

Profile

Support #1089 » SciFiEvent.cc

Dobbs, Adam, 05 August 2012 02:48

 
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 "src/common_cpp/DataStructure/SciFiEvent.hh"
18

    
19

    
20
namespace MAUS {
21

    
22
SciFiEvent::SciFiEvent() {
23
  _scifihits.resize(0);
24
  _scifidigits.resize(0);
25
  _scificlusters.resize(0);
26
  _scifispacepoints.resize(0);
27
  _scifiseeds.resize(0);
28
  _scifistraightprtracks.resize(0);
29
  _scifihelicalprtracks.resize(0);
30
}
31

    
32
SciFiEvent::SciFiEvent(const SciFiEvent& _scifievent) {
33
    _scifihits.resize(_scifievent._scifihits.size());
34
    for (unsigned int i = 0; i < _scifievent._scifihits.size(); ++i) {
35
      _scifihits[i] = new SciFiHit(*_scifievent._scifihits[i]);
36
    }
37

    
38
    _scifidigits.resize(_scifievent._scifidigits.size());
39
    for (unsigned int i = 0; i < _scifievent._scifidigits.size(); ++i) {
40
      _scifidigits[i] = new SciFiDigit(*_scifievent._scifidigits[i]);
41
    }
42

    
43
    _scificlusters.resize(_scifievent._scificlusters.size());
44
    for (unsigned int i = 0; i < _scifievent._scificlusters.size(); ++i) {
45
      _scificlusters[i] = new SciFiCluster(*_scifievent._scificlusters[i]);
46
    }
47

    
48
    _scifispacepoints.resize(_scifievent._scifispacepoints.size());
49
    for (unsigned int i = 0; i < _scifievent._scifispacepoints.size(); ++i) {
50
      _scifispacepoints[i] = new SciFiSpacePoint(*_scifievent._scifispacepoints[i]);
51
    }
52

    
53
    _scifiseeds.resize(_scifievent._scifiseeds.size());
54
    for (unsigned int i = 0; i < _scifievent._scifiseeds.size(); ++i) {
55
      _scifiseeds[i] = new SciFiSpacePoint(*_scifievent._scifiseeds[i]);
56
    }
57

    
58
    _scifistraightprtracks.resize(_scifievent._scifistraightprtracks.size());
59
    for (unsigned int i = 0; i < _scifievent._scifistraightprtracks.size(); ++i) {
60
      _scifistraightprtracks[i] = _scifievent._scifistraightprtracks[i];
61
    }
62

    
63
    _scifihelicalprtracks.resize(_scifievent._scifihelicalprtracks.size());
64
    for (unsigned int i = 0; i < _scifievent._scifihelicalprtracks.size(); ++i) {
65
      _scifihelicalprtracks[i] = _scifievent._scifihelicalprtracks[i];
66
    }
67

    
68
    // *this = _scifievent;
69
}
70

    
71
SciFiEvent& SciFiEvent::operator=(const SciFiEvent& _scifievent) {
72
    if (this == &_scifievent) {
73
        return *this;
74
    }
75

    
76
    _scifihits.resize(_scifievent._scifihits.size());
77
    for (unsigned int i = 0; i < _scifievent._scifihits.size(); ++i) {
78
      _scifihits[i] = new SciFiHit(*_scifievent._scifihits[i]);
79
    }
80

    
81
    _scifidigits.resize(_scifievent._scifidigits.size());
82
    for (unsigned int i = 0; i < _scifievent._scifidigits.size(); ++i) {
83
      _scifidigits[i] = new SciFiDigit(*_scifievent._scifidigits[i]);
84
    }
85

    
86
        _scifispacepoints.resize(_scifievent._scifispacepoints.size());
87
    for (unsigned int i = 0; i < _scifievent._scifispacepoints.size(); ++i) {
88
      _scifispacepoints[i] = new SciFiSpacePoint(*_scifievent._scifispacepoints[i]);
89
    }
90

    
91
    _scifiseeds.resize(_scifievent._scifiseeds.size());
92
    for (unsigned int i = 0; i < _scifievent._scifiseeds.size(); ++i) {
93
      _scifiseeds[i] = new SciFiSpacePoint(*_scifievent._scifiseeds[i]);
94
    }
95

    
96
    _scifistraightprtracks.resize(_scifievent._scifistraightprtracks.size());
97
    for (unsigned int i = 0; i < _scifievent._scifistraightprtracks.size(); ++i) {
98
      _scifistraightprtracks[i] = _scifievent._scifistraightprtracks[i];
99
    }
100

    
101
    _scifihelicalprtracks.resize(_scifievent._scifihelicalprtracks.size());
102
    for (unsigned int i = 0; i < _scifievent._scifihelicalprtracks.size(); ++i) {
103
      _scifihelicalprtracks[i] = _scifievent._scifihelicalprtracks[i];
104
    }
105

    
106
    return *this;
107
}
108

    
109
SciFiEvent::~SciFiEvent() {
110

    
111
  std::vector<SciFiHit*>::iterator hit;
112
  for (hit = _scifihits.begin(); hit!= _scifihits.end(); ++hit) {
113
    delete (*hit);
114
  }
115

    
116
  std::vector<SciFiDigit*>::iterator digit;
117
  for (digit = _scifidigits.begin(); digit!= _scifidigits.end(); ++digit) {
118
    delete (*digit);
119
  }
120

    
121
  std::vector<SciFiCluster*>::iterator cluster;
122
  for (cluster = _scificlusters.begin(); cluster!= _scificlusters.end(); ++cluster) {
123
    delete (*cluster);
124
  }
125

    
126
  std::vector<SciFiSpacePoint*>::iterator spoint;
127
  for (spoint = _scifispacepoints.begin(); spoint!= _scifispacepoints.end(); ++spoint) {
128
    delete (*spoint);
129
  }
130

    
131
  std::vector<SciFiSpacePoint*>::iterator seed;
132
  for (seed = _scifiseeds.begin(); seed!= _scifiseeds.end(); ++seed) {
133
    delete (*seed);
134
  }
135
}
136

    
137
} // ~namespace MAUS
(3-3/3)