StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcSvtBarrelHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcSvtBarrelHitCollection.cc,v 2.3 2005/01/27 23:40:48 calderon Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez, March 2000
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Svt Barrel Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcSvtBarrelHitCollection.cc,v $
13  * Revision 2.3 2005/01/27 23:40:48 calderon
14  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
15  *
16  * Revision 2.2 2000/04/19 18:32:23 calderon
17  * Added check for SSD in barrel collection
18  * put default numbers for l, d, w in SvtHitCollection
19  *
20  * Revision 2.1 2000/03/06 18:05:22 calderon
21  * 1) Modified SVT Hits storage scheme from layer-ladder-wafer to
22  * barrel-ladder-wafer.
23  * 2) Added Rich Hit class and collection, and links to them in other
24  * classes.
25  *
26  *
27  **************************************************************************/
28 #include "StMcSvtBarrelHitCollection.hh"
29 
30 static const char rcsid[] = "$Id: StMcSvtBarrelHitCollection.cc,v 2.3 2005/01/27 23:40:48 calderon Exp $";
32 StMcSvtBarrelHitCollection::StMcSvtBarrelHitCollection()
33 {
34  mBarrelNumber = -1;
35 }
36 
37 StMcSvtBarrelHitCollection::~StMcSvtBarrelHitCollection() { /* noop */ }
38 
39 void
40 StMcSvtBarrelHitCollection::setBarrelNumber(int i)
41 {
42  if (mBarrelNumber == -1) mBarrelNumber = i;
43 }
44 
45 unsigned int
46 StMcSvtBarrelHitCollection::numberOfLadders() const
47 {
48  switch (mBarrelNumber) {
49  case 0:
50  return 8;
51  break;
52  case 1:
53  return 12;
54  break;
55  case 2:
56  return 16;
57  break;
58  case 3:
59  return 20;
60  break;
61  default:
62  return 0;
63  }
64 }
65 
66 unsigned long
67 StMcSvtBarrelHitCollection::numberOfHits() const
68 {
69  unsigned long sum = 0;
70  for (unsigned int j=0; j<numberOfLadders(); j++) {
71  for (unsigned int k=0; k<mLadders[j].numberOfWafers(); k++) {
72  sum += mLadders[j].wafer(k)->hits().size();
73  }
74  }
75  return sum;
76 }
77 
79 StMcSvtBarrelHitCollection::ladder(unsigned int i)
80 {
81  if (i < numberOfLadders())
82  return &(mLadders[i]);
83  else
84  return 0;
85 }
86 
88 StMcSvtBarrelHitCollection::ladder(unsigned int i) const
89 {
90  if (i < numberOfLadders())
91  return &(mLadders[i]);
92  else
93  return 0;
94 }
95