Class Reference for E1039 Core & Analysis Software
SQHitVector_v1.cxx
Go to the documentation of this file.
1 /*
2  * SQHitVector_v1.C
3  *
4  * Created on: Oct 29, 2017
5  * Author: yuhw
6  */
7 
8 
9 #include "SQHitVector_v1.h"
10 
11 #include <vector>
12 #include "SQHit.h"
13 
14 using namespace std;
15 
17 
19 : _vector() {
20 }
21 
23  : _vector() {
24  for (ConstIter iter = hitvector.begin();
25  iter != hitvector.end();
26  ++iter) {
27  const SQHit *hit = *iter;
28  _vector.push_back(hit->Clone());
29  }
30 }
31 
33  Reset();
34  for (ConstIter iter = hitvector.begin();
35  iter != hitvector.end();
36  ++iter) {
37  const SQHit *hit = *iter;
38  _vector.push_back(hit->Clone());
39  }
40  return *this;
41 }
42 
44  Reset();
45 }
46 
48  for(auto iter = _vector.begin(); iter!=_vector.end(); ++iter) delete (*iter);
49  _vector.clear();
50 }
51 
52 void SQHitVector_v1::identify(ostream& os) const {
53  os << "SQHitVector_v1: size = " << _vector.size() << endl;
54  return;
55 }
56 
57 const SQHit* SQHitVector_v1::at(const size_t id) const {
58  if(id>= size()) return nullptr;
59  return _vector[id];
60 }
61 
62 SQHit* SQHitVector_v1::at(const size_t id) {
63  if(id>= _vector.size()) return nullptr;
64  return _vector[id];
65 }
66 
67 void SQHitVector_v1::push_back(const SQHit *hit) {
68  _vector.push_back(hit->Clone());
69 }
70 
71 
ClassImp(SQHitVector_v1) SQHitVector_v1
SQHitVector_v1 & operator=(const SQHitVector_v1 &hitmap)
size_t size() const
void Reset()
Clear Event.
ConstIter end() const
const SQHit * at(const size_t idkey) const
void push_back(const SQHit *hit)
virtual ~SQHitVector_v1()
void identify(std::ostream &os=std::cout) const
ConstIter begin() const
std::vector< SQHit * >::const_iterator ConstIter
Definition: SQHitVector.h:37
An SQ interface class to hold one detector hit.
Definition: SQHit.h:20
virtual SQHit * Clone() const
Definition: SQHit.h:35