StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcPxlHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcPxlHitCollection.cc,v 2.1 2013/03/25 23:50:36 perev Exp $
4  * $Log: StMcPxlHitCollection.cc,v $
5  * Revision 2.1 2013/03/25 23:50:36 perev
6  * Mustafa.Pxl add
7  *
8  *
9  * Author: Manuel Calderon de la Barca Sanchez
10  *
11  * ***************************************************************************
12  *
13  * Description: Monte Carlo PXL Hit Collection class
14  *
15  **************************************************************************/
16 #include "StMcPxlHitCollection.hh"
17 #include "StMcPxlHit.hh"
18 
19 static const char rcsid[] = "$Id: StMcPxlHitCollection.cc,v 2.1 2013/03/25 23:50:36 perev Exp $";
20 
21 ClassImp(StMcPxlHitCollection)
22 
24 {
25  /* noop */
26 }
27 
28 StMcPxlHitCollection::~StMcPxlHitCollection()
29 {
30  /* noop */
31 }
32 
33 bool
34 StMcPxlHitCollection::addHit(StMcPxlHit* hit)
35 {
36  unsigned int s, l, w;
37  if (hit &&
38  (s = hit->sector() - 1) < kNumberOfSectors &&
39  (l = hit->ladder() - 1) < mSectors[s].numberOfLadders() &&
40  (w = hit->sensor() - 1) < mSectors[s].ladder(l)->numberOfSensors())
41  {
42  mSectors[s].ladder(l)->sensor(w)->hits().push_back(hit);
43  return true;
44  }
45  else
46  return false;
47 }
48 
49 unsigned int
50 StMcPxlHitCollection::numberOfHits() const
51 {
52  unsigned int sum = 0;
53  for (int iSec = 0; iSec < kNumberOfSectors; iSec++)
54  {
55  for (unsigned int iLad = 0; iLad < mSectors[iSec].numberOfLadders(); iLad++)
56  {
57  for (unsigned int iSen = 0; iSen < mSectors[iSec].ladder(iLad)->numberOfSensors(); iSen++)
58  {
59  sum += mSectors[iSec].ladder(iLad)->sensor(iSen)->hits().size();
60  }
61  }
62  }
63  return sum;
64 }
65 
67 StMcPxlHitCollection::sector(unsigned int i)
68 {
69  return (i < kNumberOfSectors) ? &(mSectors[i]) : 0;
70 }
71 
73 StMcPxlHitCollection::sector(unsigned int i) const
74 {
75  return (i < kNumberOfSectors) ? &(mSectors[i]) : 0;
76 }
77 /***************************************************************************
78  *
79  * $Id: StMcPxlHitCollection.cc,v 2.1 2013/03/25 23:50:36 perev Exp $
80  *
81  * Author: Manuel Calderon de la Barca Sanchez, Oct 1999
82  ***************************************************************************
83  *
84  * Description: Monte Carlo Pixel Hit Collection class
85  *
86  ***************************************************************************
87  *
88  * $Log: StMcPxlHitCollection.cc,v $
89  * Revision 2.1 2013/03/25 23:50:36 perev
90  * Mustafa.Pxl add
91  *
92  * Revision 2.2 2005/07/06 21:47:45 calderon
93  * remove old ifdef, now all classes are persistent.
94  *
95  * Revision 2.1 2003/08/20 18:50:21 calderon
96  * Addition of Tof classes and Pixel classes. Modified track, event, and
97  * container code to reflect this.
98  * Fix bug in StMcVertex and in clearing of some hit collections.
99  *
100  * Revision 2.1 1999/12/14 07:04:49 calderon
101  * Numbering scheme as per SVT request.
102  *
103  * Revision 2.0 1999/11/17 02:00:59 calderon
104  * Completely revised for new StEvent
105  *
106  *
107  **************************************************************************/
int sector() const
Definition: StMcPxlHit.hh:33
int ladder() const
Definition: StMcPxlHit.hh:37
int sensor() const
Definition: StMcPxlHit.hh:41