StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFstCollection.cxx
1 #include "StEvent/StFstConsts.h"
2 #include "StFstUtil/StFstCollection.h"
4 //constructor
5 StFstCollection::StFstCollection() : StObject()
6 {
7  // set the wedge field for some of the collections
8  for ( int i = 0; i < kFstNumWedges; ++i ) {
9  mRawHitCollection[i].setWedge( i );
10  mClusterCollection[i].setWedge( i );
11  }
12 
13  mNumTimeBins = kFstNumTimeBins; //reasonable default
14 };
15 
16 //deconstructor
17 StFstCollection::~StFstCollection()
18 {
19  for ( int i = 0; i < kFstNumWedges; ++i ) {
20  mRawHitCollection[i].Clear("");
21  mClusterCollection[i].Clear("");
22  }
23 };
24 
25 unsigned char StFstCollection::getNumTimeBins() const
26 {
27  return mNumTimeBins;
28 };
29 
30 void StFstCollection::setNumTimeBins(unsigned char nTimeBins)
31 {
32  mNumTimeBins = nTimeBins;
33 };
34 
35 StFstRawHitCollection *StFstCollection::getRawHitCollection( int wedge )
36 {
37  return ((wedge >= 0 && wedge < kFstNumWedges) ? &mRawHitCollection[wedge] : 0 );
38 };
39 
40 const StFstRawHitCollection *StFstCollection::getRawHitCollection(int wedge ) const
41 {
42  return ((wedge >= 0 && wedge < kFstNumWedges) ? &mRawHitCollection[wedge] : 0 );
43 };
44 
45 StFstClusterCollection *StFstCollection::getClusterCollection( int wedge )
46 {
47  return ((wedge >= 0 && wedge < kFstNumWedges) ? &mClusterCollection[wedge] : 0 );
48 };
49 
50 const StFstClusterCollection *StFstCollection::getClusterCollection( int wedge ) const
51 {
52  return ((wedge >= 0 && wedge < kFstNumWedges) ? &mClusterCollection[wedge] : 0 );
53 };
54 
55 //sum of all the raw hits over all wedges
56 size_t StFstCollection::getNumRawHits() const
57 {
58  size_t n = 0;
59 
60  for ( const StFstRawHitCollection *ptr = &mRawHitCollection[0]; ptr != &mRawHitCollection[kFstNumWedges]; ++ptr )
61  n += ptr->getNumRawHits();
62 
63  return n;
64 };
65 
66 //number of raw hits on one wedge
67 size_t StFstCollection::getNumRawHits( int wedge ) const
68 {
69  return ((wedge >= 0 && wedge < kFstNumWedges) ? mRawHitCollection[wedge].getNumRawHits() : 0 );
70 };
71 
72 //sum of all the clusters over all wedges
73 size_t StFstCollection::getNumClusters() const
74 {
75  size_t n = 0;
76 
77  for ( const StFstClusterCollection *ptr = &mClusterCollection[0]; ptr != &mClusterCollection[kFstNumWedges]; ++ptr )
78  n += ptr->getNumClusters();
79 
80  return n;
81 };
82 
83 //number of clusters on one wedge
84 size_t StFstCollection::getNumClusters( int wedge ) const
85 {
86  return ((wedge >= 0 && wedge < kFstNumWedges) ? mClusterCollection[wedge].getNumClusters() : 0 );
87 };
88 
89 
90 ClassImp(StFstCollection);