27 #include "StEEmcCluster.h"
28 #include "StEvent/StEmcCluster.h"
32 #include "StEEmcUtil/EEmcGeom/EEmcGeomDefs.h"
33 #include "StEEmcUtil/EEmcGeom/EEmcGeomSimple.h"
38 StEEmcCluster::StEEmcCluster()
49 mMomentum=TVector3(0,0,0);
62 mSumEta2W=other.mSumEta2W;
63 mSumEtaW=other.mSumEtaW;
64 mSumPhi2W=other.mSumPhi2W;
65 mSumPhiW=other.mSumPhi2W;
71 mPosition=other.mPosition;
72 mMatched=other.mMatched;
74 for ( UInt_t ii=0;ii<other.
mTowers.size();ii++ )
75 mTowers.push_back( other.
mTowers[ii] );
90 if ( weight * tower.
energy() <= 0. )
return;
114 mPosition *= ( kEEmcZSMD /
mMomentum.CosTheta() );
116 if ( TMath::Abs(mPosition.Eta())>100.0 ) {
117 Warning(
"add",
"Cluster eta is crazy!");
121 mNumberOfElements=
mTowers.size();
164 std::cout <<
"cluster key: " << mKey << std::endl;
165 std::cout <<
"seed tower: " <<
mTowers[0].name() << std::endl;
168 std::cout <<
"fphi: " <<
fracPhibin() << std::endl;
169 std::cout <<
"energy: " <<
mEnergy << std::endl;
170 std::cout <<
"pt: " <<
mMomentum.Perp() << std::endl;
171 std::cout <<
"eta: " <<
mMomentum.Eta() << std::endl;
172 std::cout <<
"phi: " <<
mMomentum.Phi() << std::endl;
174 for ( UInt_t i=0;i<
mTowers.size();i++ )
176 mTowers[i].printLine(); std::cout <<
" W=" <<
mWeights[i] << std::endl;
181 void StEEmcCluster::printLine(Bool_t Endl)
const
184 if ( Endl ) std::cout << std::endl;
191 for ( UInt_t i=0;i<
mTowers.size();i++ )
205 for ( UInt_t i=0;i<
mTowers.size();i++ )
218 for ( UInt_t i=0;i<
mTowers.size();i++ )
226 Float_t mean=sumE/sumw;
227 Float_t var=sumE2/sumw-mean*mean;
228 return TMath::Sqrt(var);
232 Int_t StEEmcCluster::numberOfEtabins()
const
234 Int_t etabins[12];
for ( Int_t ii=0;ii<12;ii++ ) etabins[ii]=0;
235 for ( UInt_t ii=0;ii<
mTowers.size();ii++ ) etabins[
mTowers[ii].etabin() ]++;
237 for ( Int_t ii=0;ii<12;ii++ )
if ( etabins[ii] ) count++;
242 Int_t StEEmcCluster::numberOfPhibins()
const
244 Int_t phibins[60];
for ( Int_t ii=0;ii<12;ii++ ) phibins[ii]=0;
245 for ( UInt_t ii=0;ii<
mTowers.size();ii++ ) phibins[
mTowers[ii].phibin() ]++;
247 for ( Int_t ii=0;ii<12;ii++ )
if ( phibins[ii] ) count++;
TVector3 momentum() const
TVector3 getTowerCenter(const UInt_t sec, const UInt_t sub, const UInt_t etabin) const
Bool_t isNeighbor(const StEEmcTower &t) const
Float_t fracEtabin() const
Returns the fractional mean etabin.
TVector3 mMomentum
Momentum.
void add(const StEEmcTower &t, Float_t weight=1.0)
Bool_t hasTower(const StEEmcTower &tower) const
Returns true if the specified tower is in the cluster.
StEEmcTowerVec_t mTowers
Vector of towers.
Float_t weight(Int_t t) const
Get the weight associated with tower.
void print() const
Prints cluster data.
Int_t etabin() const
Returns the etabin of this tower, pre- or postshower element.
Int_t subsector() const
Returns subsector of this tower, pre- or postshower element.
Base class for representing tower, preshower and postshower elements.
Bool_t isNeighbor(const StEEmcTower &tower) const
Returns true if tower is adjacent to any tower in the cluster.
Int_t sector() const
Returns sector of this tower, pre- or postshower element.
Int_t numberOfTowers() const
Get the number of towers in cluster.
Float_t energy() const
Get energy of this cluster.
Int_t phibin() const
Returns the phibin of this tower.
A base class for describing clusters of EEMC towers.
StEmcCluster * mEmcCluster
Pointer to EMC cluster.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
std::vector< Float_t > mWeights
Vector of tower weights.
Float_t fracPhibin() const
Returns the fractional mean phibin.