StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcFgtHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcFgtHitCollection.cc,v 2.2 2009/10/13 19:14:27 perev Exp $
4  *
5  * Authors: Kai Schweda (FGT Software)
6  * Manuel Calderon de la Barca Sanchez (StMcEvent), Apr 2005
7  ***************************************************************************
8  *
9  * Description: Monte Carlo Forward Gem Tracker (FGT) Hit Collection class
10  *
11  ***************************************************************************
12  *
13  * $Log: StMcFgtHitCollection.cc,v $
14  * Revision 2.2 2009/10/13 19:14:27 perev
15  * Wei-Ming update
16  *
17  * Revision 2.1 2005/04/18 20:11:33 calderon
18  * Addition of Fgt and Fst files. Modified other files to accomodate changes.
19  *
20  *
21  **************************************************************************/
22 #include "StMcFgtHitCollection.hh"
23 #include "StMcFgtHit.hh"
24 
25 static const char rcsid[] = "$Id: StMcFgtHitCollection.cc,v 2.2 2009/10/13 19:14:27 perev Exp $";
26 
27 ClassImp(StMcFgtHitCollection)
28 
30 
31 StMcFgtHitCollection::~StMcFgtHitCollection() { /* noop */ }
32 
33 bool
34 StMcFgtHitCollection::addHit(StMcFgtHit* hit)
35 {
36  unsigned int p;
37  if (hit && (p = hit->layer()) < mNumberOfLayers) { // layer = disk WMZ
38  mLayers[p].hits().push_back(hit);
39  return true;
40  }
41  else
42  return false;
43 }
44 
45 unsigned int
46 StMcFgtHitCollection::numberOfLayers() const { return mNumberOfLayers; }
47 
48 unsigned long
49 StMcFgtHitCollection::numberOfHits() const
50 {
51  unsigned long sum = 0;
52  for (int i=0; i<mNumberOfLayers; i++)
53  sum += mLayers[i].numberOfHits();
54 
55  return sum;
56 }
57 
59 StMcFgtHitCollection::layer(unsigned int i)
60 {
61  if (i < mNumberOfLayers)
62  return &(mLayers[i]);
63  else
64  return 0;
65 }
66 
68 StMcFgtHitCollection::layer(unsigned int i) const
69 {
70  if (i < mNumberOfLayers)
71  return &(mLayers[i]);
72  else
73  return 0;
74 }