StRoot  1
StEEmcSmdCluster.h
1 #ifndef __StEEmcSmdCluster_h__
2 #define __StEEmcSmdCluster_h__
3
42 #include <cassert>
43 #include <TObject.h>
44 #include "StEEmcPool/StEEmcA2EMaker/StEEmcStrip.h"
45 #include "StEEmcPool/StEEmcA2EMaker/StEEmcTower.h"
46
47 #include "StEEmcBaseCluster.h"
48
49 class TH1F;
50
51 class StEmcCluster;
52
54 public:
57  virtual ~StEEmcSmdCluster(){ /* nada */ };
58
59  void add(const StEEmcStrip &strip, Float_t weight=1.0 ); // Add an SMD strip to this cluster with the specified weight
60  void add(const StEEmcStripVec_t &strips );
61
62  Float_t energy()const {return mEnergy;} // Return the energy of this cluster
63  Float_t mean()const {return mMean;} // Return the mean strip number of this cluster
64  Float_t sigma()const {return mSigma;} // Return the sigma -- sqrt(variance) -- of the cluster
65
66  void mean(Float_t x){ mMean=x; } // Set the mean of the cluster
67  void sigma(Float_t s){ mSigma=s; } // Set the width of the cluster
68  //void energy( Float_t e){ mEnergy=e; } // Set the energy of the cluster
69
70  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.
71  Float_t sigma( Int_t nmax, Option_t *opts="mean" ) const; // As above, but returns sigma instead of energy
72
73  Int_t size()const {return (Int_t)mSize;} // Return the size (number of strips) of the cluster
74
75  StEEmcTowerVec_t &towers() {return mMatchedTowers;} // Return list of towers matching this cluster
76  const StEEmcTowerVec_t &towers() const {return mMatchedTowers;} // Return list of towers matching this cluster
77  Int_t numberOfMatchedTowers() const {return (Int_t)mMatchedTowers.size();} // Return number of towers matching this cluster
78  StEEmcTower &tower(Int_t t) {return mMatchedTowers[t];} // Return a specific tower matching this SMD cluster
79  const StEEmcTower &tower(Int_t t) const {return mMatchedTowers[t];} // Return a specific tower matching this SMD cluster
80
82  Bool_t operator<( const StEEmcSmdCluster &other ) const { return this->energy() < other.energy(); }
83  Bool_t operator>( const StEEmcSmdCluster &other ) const { return this->energy() > other.energy(); }
84
85  Int_t numberOfStrips()const{ return (Int_t)mStrips.size(); } // Returns the number of SMD strips in the cluster
86
88  StEEmcStrip &strip(Int_t s){ return mStrips[s]; }
89  const StEEmcStrip &strip(Int_t s)const{ return mStrips[s]; }
90
91  Float_t weight(Int_t s)const{ return mWeights[s]; }
92
94  StEEmcStrip &seed(){ assert(mStrips.size()>0); return mStrips[0]; }
95  const StEEmcStrip &seed() const { assert(mStrips.size()>0); return mStrips[0]; }
96
97  Int_t plane() const { return mPlane; } // Return the plane of the cluster
98  Int_t sector() const { return mSector; } // Return the sector of the cluster
99  void sector( Int_t s ) { mSector=s; } // Set the sector
100  void plane( Int_t p ){ mPlane = p; } // Set the plane
101
104  StEmcCluster *stemc();
106  void stemc( StEmcCluster *c ){ mEmcCluster = c; }
107
108  void print(Option_t *opts="") const;
109  void printLine(Bool_t endline=false) const;
110
113  Int_t next(Int_t direct) const { if(direct>0) return mRight; else if(direct<0) return mLeft; else return -999; }
114
115  void copy( TH1F *h ) const;
116
117 protected:
118
120  StEEmcStripVec_t mStrips;
121  std::vector<Float_t> mWeights;
123
125  Int_t mSize;
126
128  Float_t mSumXW;
130  Float_t mSumX2W;
131
133  Float_t mMean;
135  Float_t mSigma;
137  Int_t mPlane;
139  Int_t mSector;
140
142  StEEmcTowerVec_t mMatchedTowers;
143
145  Int_t mLeft;
147  Int_t mRight;
148
151
152  ClassDef(StEEmcSmdCluster,1);
153 };
154 //inline Bool_t StEEmcSmdCluster::operator>(StEEmcSmdCluster &other){ return (energy() > other.energy()); }
155
156
158 inline Bool_t inner( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.mean()<you.mean(); }
160 inline Bool_t outer( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.mean()>you.mean(); }
162 inline Bool_t Energy( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.energy()>you.energy(); }
164 inline Bool_t Key( const StEEmcSmdCluster &me, const StEEmcSmdCluster &you) { return me.key()<you.key(); }
165
166 typedef std::vector<StEEmcSmdCluster> StEEmcSmdClusterVec_t;
167
168 std::ostream& operator<<(std::ostream &out, const StEEmcSmdCluster &c );
169
170 #endif
Int_t mRight
index of next strip to the right
Int_t next(Int_t direct) const
Float_t mEnergy
Energy of this SMD cluster.
Bool_t operator<(const StEEmcSmdCluster &other) const
One cluster is greater than another if energy is greater than the other.
Int_t mSector
Sector.
void stemc(StEmcCluster *c)
Set pointer to StEmcCluster.
Int_t mPlane
Plane.
Int_t mLeft
index of next strip to the left
Float_t mMean
Mean and sigma computed after each strip is added.
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
std::vector< Float_t > mWeights
Vector of strip weights.
StEEmcStrip & seed()
Returns the seed strip (by convention, the first strip added to the cluster).
Int_t key()
Return a unique key assigned by the cluster maker.
StEmcCluster * stemc()
Float_t mSumX2W
Running sums to calculate mean, sigma of cluster.
StEEmcStripVec_t mStrips
Vector of strips belonging to this SMD cluster.
A base class for representing clusters of EEMC smd strips.
Float_t mSigma
Sigma.
StEmcCluster * mEmcCluster
POinter to EMC cluster.
Int_t mSize
Kludge so that root will store number of smd strips.
StEEmcTowerVec_t mMatchedTowers
Vector of hit towers above this SMD cluster.
StEEmcStrip & strip(Int_t s)
Returns the specified smd strip w/in the cluster.
Base class for describing an endcap SMD strip.
Definition: StEEmcStrip.h:8
Float_t mSumXW
Running sums to calculate mean, sigma of cluster.