StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEEmcIUCluster.cxx
1 
27 #include "StEEmcIUCluster.h"
28 #include "StEvent/StEmcCluster.h"
29 
30 #include <iostream>
31 
32 ClassImp(StEEmcIUCluster);
33 
34 // ----------------------------------------------------------------------------
35 StEEmcIUCluster::StEEmcIUCluster()
36 {
37 
38  mEmcCluster=0;
39  mKey=0;
40  mEnergy=0.;
41 
42 }
43 
44 // ----------------------------------------------------------------------------
45 void StEEmcIUCluster::add( StEEmcTower tower, Float_t weight )
46 {
47 
48  if ( weight * tower.energy() <= 0. ) return;
49  mWeights.push_back(weight);
50  mTowers.push_back( tower );
51 
52  Float_t energy = weight * tower.energy();
53  mEnergy+=energy;
54 
55 }
56 
59  //$$$ if ( mEmcCluster != 0 ) delete mEmcCluster;
60 }
61 
62 
63 // ----------------------------------------------------------------------------
65 {
66 
67  if ( mEmcCluster ) return mEmcCluster;
69 
70  mEmcCluster->setEta( momentum().Eta() );
71  mEmcCluster->setPhi( momentum().Phi() );
72  mEmcCluster->setSigmaEta(-1.);
73  mEmcCluster->setSigmaPhi(-1.);
74  mEmcCluster->setEnergy( energy() );
75  mEmcCluster->SetUniqueID( mKey );
76 #if 1
77  for ( Int_t i=0; i< numberOfTowers(); i++ )
78  {
79  StEmcRawHit *hit=mTowers[i].stemc();
80  assert( hit );
81  mEmcCluster->addHit( hit );
82  }
83 #endif
84 
85  return mEmcCluster;
86 }
87 
89 {
90 
91  std::cout << "cluster key: " << mKey << std::endl;
92  std::cout << "seed tower: " << mTowers[0].name() << std::endl;
93  std::cout << "ntowers: " << mTowers.size() << std::endl;
94  std::cout << "eta: " << mMomentum.Eta() << std::endl;
95  std::cout << "phi: " << mMomentum.Phi() << std::endl;
96  std::cout << "energy: " << mEnergy << std::endl;
97  std::cout << "pt: " << mMomentum.Perp() << std::endl;
98  for ( UInt_t i=0;i<mTowers.size();i++ )
99  {
100  mTowers[i].printLine(); std::cout << " W=" << mWeights[i] << std::endl;
101  }
102 
103 }
void print()
Prints cluster data.
StEmcCluster * stemc()
TVector3 momentum()
Get the momentum of this cluster.
std::vector< Float_t > mWeights
Vector of tower weights.
void add(StEEmcTower, Float_t weight=1.0)
A base class for describing clusters of EEMC towers.
StEmcCluster * mEmcCluster
Pointer to EMC cluster.
StEEmcTowerVec_t mTowers
Vector of towers.
Base class for representing tower, preshower and postshower elements.
Definition: StEEmcTower.h:11
Int_t mKey
Unique cluster ID.
Int_t numberOfTowers()
Get the number of towers in cluster.
TVector3 mMomentum
Momentum.
Float_t energy()
Get energy of this cluster.
void energy(Float_t e)
Set the energy (adc-ped+0.5)/gain for this element.
Definition: StEEmcElement.h:21
Float_t mEnergy
Energy.