StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StSimpleCluster.h
1 
22 #ifndef _ST_SIMPLE_CLUSTER_H_
23 #define _ST_SIMPLE_CLUSTER_H_
24 
25 #include <TObject.h>
26 #include <Rtypes.h>
27 #include <TArrayS.h>
28 #include <TArrayF.h>
29 #include <iostream>
30 #include <vector>
31 #include <list>
32 
33 //#include "StRoot/St_base/StMessMgr.h"
34 
35 //#define ClassDefVec( CLASS );
36 
38 class StSimpleCluster_t;
39 
41 typedef std::vector< StSimpleCluster_t > StSimpleClusterVec_t;
42 typedef std::list< StSimpleCluster_t > StSimpleClusterList_t;
43 
44 // force RootCint.pl to make vector dictionary
45 // ClassDefVec( StSimpleCluster_t );
46 
48 class StSimpleCluster_t : public TObject {
49  public:
50  // constructor
51  StSimpleCluster_t( Short_t mID_in = -1 ) : mID( mID_in ), mSeedIdx(0) { /* */ };
52  ~StSimpleCluster_t() { /* */ };
53 
54  // accessors
55  Short_t getID() const { return mID; };
56  Float_t getEnergy() const { return mE; };
57 
58  TArrayS& getMemberArray() { return mMember; };
59  const TArrayS& getMemberArray() const { return mMember; };
60  Short_t getMember( Int_t i ) const { return mMember[i]; };
61 
62  TArrayF& getWeightArray() { return mWeight; };
63  const TArrayF& getWeightArray() const { return mWeight; };
64  Float_t getWeight( Int_t i ) const { return mWeight[i]; };
65 
66  Int_t getSeedIdx() const { return mSeedIdx; }; // the index of these seed in the internal Member and Weight arrays
67 
68  Int_t getSeedMember() const { return mSeedIdx < mMember.GetSize() ? mMember[mSeedIdx] : -1; };
69  Int_t getSeedWeight() const { return mSeedIdx < mWeight.GetSize() ? mWeight[mSeedIdx] : -1; };
70 
71  Float_t getMeanX() const { return mMeanX; }; // used for both tower and strip clusters
72  Float_t getMeanY() const { return mMeanY; }; // only used for tower clusters
73 
74 
75  // modifiers
76  void setID( const Short_t ID ) { mID = ID; };
77  void setEnergy( const Float_t E ) { mE = E; };
78  void setMemberArray( const TArrayS array ){ mMember = array; };
79  void setWeightArray( const TArrayF array ){ mWeight = array; };
80  void setSeedIdx( Int_t seedIdx ) { mSeedIdx = seedIdx; };
81  void setMeanX( Float_t mean ){ mMeanX = mean; }; // used for both tower and strip clusters
82  void setMeanY( Float_t mean ){ mMeanY = mean; }; // only used for tower clusters
83 
84  // operators
85  StSimpleCluster_t& operator+=( const StSimpleCluster_t& other );
86  // Bool_t operator <(const StSimpleCluster_t& b) const {
87  // return mID < b.mID;
88  // };
89 
90  // for display
91  friend std::ostream &operator<<( std::ostream &out, const StSimpleCluster_t &clus );
92 
93  protected:
94  Short_t mID;
95  Float_t mE, mMeanX, mMeanY;
96  TArrayS mMember;
97  TArrayF mWeight;
98 
99  // keep track of which (if any) of the members is the seed.
100  // defaults to 0.
101  Int_t mSeedIdx;
102 
103  private:
105  ClassDef(StSimpleCluster_t,1); // Simplest class to describe a cluster
106 
107 
108 };
109 
110 std::ostream &operator<<( std::ostream &out, const StSimpleCluster_t &clus );
111 
112 #endif
113 
114 /*
115  * $Id: StSimpleCluster.h,v 1.1 2012/11/26 19:05:56 sgliske Exp $
116  * $Log: StSimpleCluster.h,v $
117  * Revision 1.1 2012/11/26 19:05:56 sgliske
118  * moved from offline/users/sgliske/StRoot/StEEmcPool/StEEmcHitMaker to StRoot/StEEmcPool/StEEmcHitMaker
119  *
120  *
121  */