StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcEtrHitCollection.cc
1 /***************************************************************************
2  *
3  ***************************************************************************/
4 #include "StMcEtrHitCollection.hh"
5 #include "StMcEtrHit.hh"
6 
7 static const char rcsid[] = "$Id: StMcEtrHitCollection.cc,v 2.1 2012/03/22 01:06:09 perev Exp $";
8 
9 ClassImp(StMcEtrHitCollection)
10 
12 
13 StMcEtrHitCollection::~StMcEtrHitCollection()
14 {
15  // If the hit provides its own new/delete operator.
16  for (unsigned int i=0; i<mHits.size(); i++) {
17  delete mHits[i];
18  mHits[i]=0;
19  }
20 }
21 
22 
23 bool
24 StMcEtrHitCollection::addHit(StMcEtrHit* hit)
25 {
26  unsigned int p;
27  if (hit && (p = hit->layer()) < mNumberOfLayers && (p = hit->sector()) < mNumberOfSectors) {
28  mHits.push_back(hit);
29  return true;
30  }
31  else
32  return false;
33 }
34 
35 unsigned int
36 StMcEtrHitCollection::numberOfLayers() const { return mNumberOfLayers; }
37 
38 unsigned int
39 StMcEtrHitCollection::numberOfSectors() const { return mNumberOfSectors; }
40 
41 unsigned long
42 StMcEtrHitCollection::numberOfHits() const
43 {
44  return mHits.size();
45 }
46 
47 const StSPtrVecMcEtrHit&
48 StMcEtrHitCollection::hits() const { return mHits; }
49 
50 StSPtrVecMcEtrHit&
51 StMcEtrHitCollection::hits() { return mHits; }
52