StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StIstClusterCollection.cxx
1 #include "StIstCluster.h"
2 #include "StIstClusterCollection.h"
3 #include "St_base/StMessMgr.h"
4 
5 
6 StIstClusterCollection::StIstClusterCollection( int ladder ) : StObject(), mLadder( ladder )
7 {
8 }
9 
10 StIstClusterCollection::~StIstClusterCollection()
11 {
12  Clear("");
13 }
14 
15 void StIstClusterCollection::Clear( Option_t *opt )
16 {
17  //free memory and clear the vector
18  std::vector< StIstCluster * >::iterator vecIter;
19 
20  for ( vecIter = mClusterVec.begin(); vecIter != mClusterVec.end(); ++vecIter ) {
21  if (*vecIter != NULL) {
22  delete *vecIter;
23  *vecIter = NULL;
24  }
25  }
26 
27  mClusterVec.clear();
28 }
29 
30 
31 void StIstClusterCollection::Print(Option_t *opt) const
32 {
33  int clusterIdx = 0;
34 
35  for (std::vector<StIstCluster*>::const_iterator it = mClusterVec.begin(); it != mClusterVec.end(); ++it, ++clusterIdx)
36  {
37  LOG_DEBUG << "cluster: Idx=" << clusterIdx << endm;
38  (*it)->Print();
39  }
40 }
41 
42 
43 vector<StIstCluster *> &StIstClusterCollection::getClusterVec()
44 {
45  return mClusterVec;
46 };
47 
48 const vector<StIstCluster *> &StIstClusterCollection::getClusterVec() const
49 {
50  return mClusterVec;
51 };
52 
53 size_t StIstClusterCollection::getNumClusters() const
54 {
55  return mClusterVec.size();
56 };
57 
58 void StIstClusterCollection::setLadder( int ladder )
59 {
60  mLadder = ladder;
61 };
62 
63 unsigned char StIstClusterCollection::getLadder() const
64 {
65  return mLadder;
66 };
67 
68 ClassImp(StIstClusterCollection);