00001 #ifndef __StEEmcSmdCluster_h__ 00002 #define __StEEmcSmdCluster_h__ 00003 00042 #include <cassert> 00043 #include <TObject.h> 00044 #include "StEEmcPool/StEEmcA2EMaker/StEEmcStrip.h" 00045 #include "StEEmcPool/StEEmcA2EMaker/StEEmcTower.h" 00046 00047 #include "StEEmcBaseCluster.h" 00048 00049 class TH1F; 00050 00051 class StEmcCluster; 00052 00053 class StEEmcSmdCluster : public StEEmcBaseCluster { 00054 public: 00055 StEEmcSmdCluster(); 00056 StEEmcSmdCluster ( const StEEmcSmdCluster &c ); 00057 virtual ~StEEmcSmdCluster(){ /* nada */ }; 00058 00059 void add(const StEEmcStrip &strip, Float_t weight=1.0 ); // Add an SMD strip to this cluster with the specified weight 00060 void add(const StEEmcStripVec_t &strips ); 00061 00062 Float_t energy()const {return mEnergy;} // Return the energy of this cluster 00063 Float_t mean()const {return mMean;} // Return the mean strip number of this cluster 00064 Float_t sigma()const {return mSigma;} // Return the sigma -- sqrt(variance) -- of the cluster 00065 00066 void mean(Float_t x){ mMean=x; } // Set the mean of the cluster 00067 void sigma(Float_t s){ mSigma=s; } // Set the width of the cluster 00068 //void energy( Float_t e){ mEnergy=e; } // Set the energy of the cluster 00069 00070 Float_t energy( Int_t nmax, Option_t *opts="mean" ) const; // Return the energy of this cluster summed over +/- nmax strips about either the mean (opts=="mean") or seed (opts=="seed") smd strip. 00071 Float_t sigma( Int_t nmax, Option_t *opts="mean" ) const; // As above, but returns sigma instead of energy 00072 00073 Int_t size()const {return (Int_t)mSize;} // Return the size (number of strips) of the cluster 00074 00075 StEEmcTowerVec_t &towers() {return mMatchedTowers;} // Return list of towers matching this cluster 00076 const StEEmcTowerVec_t &towers() const {return mMatchedTowers;} // Return list of towers matching this cluster 00077 Int_t numberOfMatchedTowers() const {return (Int_t)mMatchedTowers.size();} // Return number of towers matching this cluster 00078 StEEmcTower &tower(Int_t t) {return mMatchedTowers[t];} // Return a specific tower matching this SMD cluster 00079 const StEEmcTower &tower(Int_t t) const {return mMatchedTowers[t];} // Return a specific tower matching this SMD cluster 00080 00082 Bool_t operator<( const StEEmcSmdCluster &other ) const { return this->energy() < other.energy(); } 00083 Bool_t operator>( const StEEmcSmdCluster &other ) const { return this->energy() > other.energy(); } 00084 00085 Int_t numberOfStrips()const{ return (Int_t)mStrips.size(); } // Returns the number of SMD strips in the cluster 00086 00088 StEEmcStrip &strip(Int_t s){ return mStrips[s]; } 00089 const StEEmcStrip &strip(Int_t s)const{ return mStrips[s]; } 00090 00091 Float_t weight(Int_t s)const{ return mWeights[s]; } 00092 00094 StEEmcStrip &seed(){ assert(mStrips.size()>0); return mStrips[0]; } 00095 const StEEmcStrip &seed() const { assert(mStrips.size()>0); return mStrips[0]; } 00096 00097 Int_t plane() const { return mPlane; } // Return the plane of the cluster 00098 Int_t sector() const { return mSector; } // Return the sector of the cluster 00099 void sector( Int_t s ) { mSector=s; } // Set the sector 00100 void plane( Int_t p ){ mPlane = p; } // Set the plane 00101 00104 StEmcCluster *stemc(); 00106 void stemc( StEmcCluster *c ){ mEmcCluster = c; } 00107 00108 void print(Option_t *opts="") const; 00109 void printLine(Bool_t endline=false) const; 00110 00113 Int_t next(Int_t direct) const { if(direct>0) return mRight; else if(direct<0) return mLeft; else return -999; } 00114 00115 void copy( TH1F *h ) const; 00116 00117 protected: 00118 00120 StEEmcStripVec_t mStrips; 00121 00122 std::vector<Float_t> mWeights; 00123 00125 Int_t mSize; 00126 00128 Float_t mSumXW; 00130 Float_t mSumX2W; 00131 00133 Float_t mMean; 00135 Float_t mSigma; 00137 Int_t mPlane; 00139 Int_t mSector; 00140 00142 StEEmcTowerVec_t mMatchedTowers; 00143 00145 Int_t mLeft; 00147 Int_t mRight; 00148 00150 StEmcCluster *mEmcCluster; 00151 00152 ClassDef(StEEmcSmdCluster,1); 00153 }; 00154 //inline Bool_t StEEmcSmdCluster::operator>(StEEmcSmdCluster &other){ return (energy() > other.energy()); } 00155 00156 00158 inline Bool_t inner( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.mean()<you.mean(); } 00160 inline Bool_t outer( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.mean()>you.mean(); } 00162 inline Bool_t Energy( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.energy()>you.energy(); } 00164 inline Bool_t Key( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.key()<you.key(); } 00165 00166 typedef std::vector<StEEmcSmdCluster> StEEmcSmdClusterVec_t; 00167 00168 ostream& operator<<(ostream &out, const StEEmcSmdCluster &c ); 00169 00170 #endif
1.5.9