StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcFtpcHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcFtpcHitCollection.cc,v 2.2 2005/01/27 23:40:47 calderon Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez, Oct 1999
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Ftpc Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcFtpcHitCollection.cc,v $
13  * Revision 2.2 2005/01/27 23:40:47 calderon
14  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
15  *
16  * Revision 2.1 1999/12/14 07:04:49 calderon
17  * Numbering scheme as per SVT request.
18  *
19  * Revision 2.0 1999/11/17 02:00:59 calderon
20  * Completely revised for new StEvent
21  *
22  *
23  **************************************************************************/
24 #include "StMcFtpcHitCollection.hh"
25 #include "StMcFtpcHit.hh"
26 
27 static const char rcsid[] = "$Id: StMcFtpcHitCollection.cc,v 2.2 2005/01/27 23:40:47 calderon Exp $";
28 
29 ClassImp(StMcFtpcHitCollection)
30 
32 
33 StMcFtpcHitCollection::~StMcFtpcHitCollection() { /* noop */ }
34 
35 bool
36 StMcFtpcHitCollection::addHit(StMcFtpcHit* hit)
37 {
38  unsigned int p;
39  if (hit && (p = hit->plane()-1) < mNumberOfPlanes) {
40  mPlanes[p].hits().push_back(hit);
41  return true;
42  }
43  else
44  return false;
45 }
46 
47 unsigned int
48 StMcFtpcHitCollection::numberOfPlanes() const { return mNumberOfPlanes; }
49 
50 unsigned long
51 StMcFtpcHitCollection::numberOfHits() const
52 {
53  unsigned long sum = 0;
54  for (int i=0; i<mNumberOfPlanes; i++)
55  sum += mPlanes[i].numberOfHits();
56 
57  return sum;
58 }
59 
61 StMcFtpcHitCollection::plane(unsigned int i)
62 {
63  if (i < mNumberOfPlanes)
64  return &(mPlanes[i]);
65  else
66  return 0;
67 }
68 
70 StMcFtpcHitCollection::plane(unsigned int i) const
71 {
72  if (i < mNumberOfPlanes)
73  return &(mPlanes[i]);
74  else
75  return 0;
76 }