StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFgtCollection.h
1 /***************************************************************************
2  *
3  * $Id: StFgtCollection.h,v 2.2 2013/01/08 19:54:03 ullrich Exp $
4  * Author: S. Gliske, Oct 2011
5  *
6  ***************************************************************************
7  *
8  * Description: FGT data collection for StEvent.
9  *
10  ***************************************************************************
11  *
12  * $Log: StFgtCollection.h,v $
13  * Revision 2.2 2013/01/08 19:54:03 ullrich
14  * Added mNumTimeBins and access functions.
15  *
16  * Revision 2.1 2012/04/16 20:20:49 ullrich
17  * Initial Revision
18  *
19  *
20  **************************************************************************/
21 
22 #ifndef _ST_FGT_COLLECTION_H_
23 #define _ST_FGT_COLLECTION_H_
24 
25 #include "StObject.h"
26 #include "StFgtStripCollection.h"
27 #include "StFgtHitCollection.h"
28 #include "StFgtPointCollection.h"
29 #include "StEnumerations.h"
30 
31 class StFgtCollection : public StObject {
32 public:
33  // constructors
35  // StFgtCollection( const StFgtCollection& other ); ---> use default
36  // StFgtCollection& operator=( const StFgtCollection& other ); ---> use default
37 
38  // deconstructor
39  ~StFgtCollection();
40 
41  size_t getNumDiscs() const;
42  size_t getNumStrips() const; // overall
43  size_t getNumStrips( unsigned short discIdx) const; // per disc
44  size_t getNumHits() const; // overall
45  size_t getNumHits( unsigned short discIdx ) const; // per disc
46  size_t getNumPoints() const;
47  size_t getNumTimeBins() const;
48  void setNumTimeBins(size_t nTimebin);
49  // note: ownership of all pointers is retained by the containers.
50  // Do not deleted any pointers received from this class.
51 
52  StFgtStripCollection* getStripCollection( unsigned short discIdx );
53  const StFgtStripCollection* getStripCollection( unsigned short discIdx ) const;
54 
55  StFgtHitCollection* getHitCollection( unsigned short discIdx );
56  const StFgtHitCollection* getHitCollection( unsigned short discIdx ) const;
57 
58  StFgtPointCollection* getPointCollection();
59  const StFgtPointCollection* getPointCollection() const;
60 
61  void Clear( Option_t *opts = "" );
62 
63 protected:
64  friend class StMuDstMaker; // needed for StMuDstMaker
65 
66  StFgtStripCollection mStripCollection[kFgtNumDiscs];
67  StFgtHitCollection mHitCollection[kFgtNumDiscs];
68  StFgtPointCollection mPointCollection;
69  size_t mNumTimeBins;
70 private:
71  ClassDef(StFgtCollection,2);
72 };
73 
74 
75 // inline functions
76 
77 inline StFgtStripCollection* StFgtCollection::getStripCollection( unsigned short discIdx ) {
78  return (discIdx < kFgtNumDiscs ? &mStripCollection[discIdx] : 0 );
79 };
80 
81 inline size_t StFgtCollection::getNumTimeBins() const {
82  return mNumTimeBins;
83 };
84 
85 inline void StFgtCollection::setNumTimeBins(size_t nTimeBins) {
86  mNumTimeBins=nTimeBins;
87 };
88 
89 inline const StFgtStripCollection* StFgtCollection::getStripCollection( unsigned short discIdx ) const {
90  return (discIdx < kFgtNumDiscs ? &mStripCollection[discIdx] : 0 );
91 };
92 
93 inline StFgtHitCollection* StFgtCollection::getHitCollection( unsigned short discIdx ) {
94  return (discIdx < kFgtNumDiscs ? &mHitCollection[discIdx] : 0 );
95 };
96 
97 inline const StFgtHitCollection* StFgtCollection::getHitCollection( unsigned short discIdx ) const {
98  return (discIdx < kFgtNumDiscs ? &mHitCollection[discIdx] : 0 );
99 };
100 
101 inline size_t StFgtCollection::getNumDiscs() const{
102  return kFgtNumDiscs;
103 };
104 
105 // sum of all the strips over all discs
106 inline size_t StFgtCollection::getNumStrips() const {
107  size_t n = 0;
108  for( const StFgtStripCollection* ptr = &mStripCollection[0]; ptr != &mStripCollection[kFgtNumDiscs]; ++ptr )
109  n += ptr->getNumStrips();
110  return n;
111 };
112 
113 // number of strips hit on one disc
114 inline size_t StFgtCollection::getNumStrips( unsigned short discIdx ) const{
115  return (discIdx < kFgtNumDiscs ? mStripCollection[discIdx].getNumStrips() : 0 );
116 };
117 
118 // sum of all the hits over all discs
119 inline size_t StFgtCollection::getNumHits() const {
120  size_t n = 0;
121  for( const StFgtHitCollection* ptr = &mHitCollection[0]; ptr != &mHitCollection[kFgtNumDiscs]; ++ptr )
122  n += ptr->getNumHits();
123  return n;
124 };
125 
126 // number of hits hit on one disc
127 inline size_t StFgtCollection::getNumHits( unsigned short discIdx ) const{
128  return (discIdx < kFgtNumDiscs ? mHitCollection[discIdx].getNumHits() : 0 );
129 };
130 
131 inline StFgtPointCollection* StFgtCollection::getPointCollection() {
132  return &mPointCollection;
133 };
134 
135 inline const StFgtPointCollection* StFgtCollection::getPointCollection() const {
136  return &mPointCollection;
137 };
138 
139 // number of points on one disc
140 inline size_t StFgtCollection::getNumPoints() const{
141  return mPointCollection.getNumPoints();
142 };
143 
144 #endif