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