StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMcSsdHitCollection.cc
1 /***************************************************************************
2  *
3  * $Id: StMcSsdHitCollection.cc,v 2.3 2005/11/22 21:44:52 fisyak Exp $
4  *
5  * Author: Manuel Calderon de la Barca Sanchez, Oct 1999
6  ***************************************************************************
7  *
8  * Description: Monte Carlo Ssd Hit Collection class
9  *
10  ***************************************************************************
11  *
12  * $Log: StMcSsdHitCollection.cc,v $
13  * Revision 2.3 2005/11/22 21:44:52 fisyak
14  * Add compress Print for McEvent, add Ssd collections
15  *
16  * Revision 2.2 2005/01/27 23:40:47 calderon
17  * Adding persistency to StMcEvent as a step for Virtual MonteCarlo.
18  *
19  * Revision 2.1 2004/09/14 05:00:30 calderon
20  * Added support for Ist, Ssd and changes to Pixel, from "El Kai".
21  *
22  * Revision 2.1 2003/08/20 18:50:21 calderon
23  * Addition of Tof classes and Ssd classes. Modified track, event, and
24  * container code to reflect this.
25  * Fix bug in StMcVertex and in clearing of some hit collections.
26  *
27  * Revision 2.1 1999/12/14 07:04:49 calderon
28  * Numbering scheme as per SVT request.
29  *
30  * Revision 2.0 1999/11/17 02:00:59 calderon
31  * Completely revised for new StEvent
32  *
33  *
34  **************************************************************************/
35 #include "StMcSsdHitCollection.hh"
36 #include "StMcSsdHit.hh"
37 
38 static const char rcsid[] = "$Id: StMcSsdHitCollection.cc,v 2.3 2005/11/22 21:44:52 fisyak Exp $";
39 
40 ClassImp(StMcSsdHitCollection)
41 
43 
44 StMcSsdHitCollection::~StMcSsdHitCollection() { /* noop */ }
45 
46 bool
47 StMcSsdHitCollection::addHit(StMcSsdHit* hit)
48 {
49  unsigned int p, w;
50  if (hit &&
51  (p = hit->ladder()-1) < mNumberOfLadders &&
52  (w = hit->wafer()-1) < ladder(p)->numberOfWafers()) {
53  ladder(p)->wafer(w)->hits().push_back(hit);
54  return true;
55  }
56  else
57  return false;
58 }
59 
60 unsigned int
61 StMcSsdHitCollection::numberOfLadders() const { return mNumberOfLadders; }
62 
63 unsigned long
64 StMcSsdHitCollection::numberOfHits() const
65 {
66  unsigned long sum = 0;
67  for (int i=0; i<mNumberOfLadders; i++)
68  sum += mLadders[i].numberOfHits();
69 
70  return sum;
71 }
72 
74 StMcSsdHitCollection::ladder(unsigned int i)
75 {
76  if (i < mNumberOfLadders)
77  return &(mLadders[i]);
78  else
79  return 0;
80 }
81 
83 StMcSsdHitCollection::ladder(unsigned int i) const
84 {
85  if (i < mNumberOfLadders)
86  return &(mLadders[i]);
87  else
88  return 0;
89 }