StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcCluster.cxx
1 #include "StEEmcCluster.h"
2 #include "StEvent/StEmcCluster.h"
3 
4 #include <iostream>
5 
6 ClassImp(StEEmcCluster);
7 
8 // ----------------------------------------------------------------------------
9 StEEmcCluster::StEEmcCluster()
10 {
11 
12  mEmcCluster=0;
13  mKey=0;
14  mEnergy=0.;
15 
16 }
17 
18 // ----------------------------------------------------------------------------
19 void StEEmcCluster::add( StEEmcTower tower, Float_t weight )
20 {
21 
22  if ( weight * tower.energy() <= 0. ) return;
23  mWeights.push_back(weight);
24  mTowers.push_back( tower );
25 
26  Float_t energy = weight * tower.energy();
27  mEnergy+=energy;
28 
29 }
30 
33  //$$$ if ( mEmcCluster != 0 ) delete mEmcCluster;
34 }
35 
36 
37 // ----------------------------------------------------------------------------
39 {
40 
41  if ( mEmcCluster ) return mEmcCluster;
43 
44  mEmcCluster->setEta( momentum().Eta() );
45  mEmcCluster->setPhi( momentum().Phi() );
46  mEmcCluster->setSigmaEta(-1.);
47  mEmcCluster->setSigmaPhi(-1.);
48  mEmcCluster->setEnergy( energy() );
49  mEmcCluster->SetUniqueID( mKey );
50 #if 1
51  for ( Int_t i=0; i< numberOfTowers(); i++ )
52  {
53  StEmcRawHit *hit=mTowers[i].stemc();
54  assert( hit );
55  mEmcCluster->addHit( hit );
56  }
57 #endif
58 
59  return mEmcCluster;
60 }
61 
63 {
64 
65  std::cout << "cluster key: " << mKey << std::endl;
66  std::cout << "seed tower: " << mTowers[0].name() << std::endl;
67  std::cout << "ntowers: " << mTowers.size() << std::endl;
68  std::cout << "eta: " << mMomentum.Eta() << std::endl;
69  std::cout << "phi: " << mMomentum.Phi() << std::endl;
70  std::cout << "energy: " << mEnergy << std::endl;
71  std::cout << "pt: " << mMomentum.Perp() << std::endl;
72  for ( UInt_t i=0;i<mTowers.size();i++ )
73  {
74  mTowers[i].printLine(); std::cout << " W=" << mWeights[i] << std::endl;
75  }
76 
77 }
TVector3 momentum() const
Definition: StEEmcCluster.h:69
TVector3 mMomentum
Momentum.
void add(const StEEmcTower &t, Float_t weight=1.0)
StEEmcTowerVec_t mTowers
Vector of towers.
void print() const
Prints cluster data.
virtual ~StEEmcCluster()
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
StEmcCluster * stemc()
Float_t mEnergy
Energy.
Definition: StEEmcCluster.h:66
Int_t numberOfTowers() const
Get the number of towers in cluster.
Definition: StEEmcCluster.h:76
Float_t energy() const
Get energy of this cluster.
Definition: StEEmcCluster.h:62
A base class for describing clusters of EEMC towers.
Definition: StEEmcCluster.h:50
StEmcCluster * mEmcCluster
Pointer to EMC cluster.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
Definition: StEEmcElement.h:21
std::vector< Float_t > mWeights
Vector of tower weights.