1 #include "StEmcUtil/projection/StEmcPosition.h"
2 #include "StEmcUtil/geometry/StEmcGeom.h"
4 #include "StGammaEventMaker.h"
5 #include "StGammaEvent.h"
6 #include "StGammaRawMaker.h"
7 #include "StBarrelEmcCluster.h"
9 #include "StBarrelEmcClusterMaker.h"
18 StBarrelEmcClusterMaker::StBarrelEmcClusterMaker(
const char *name):
StMaker(name)
20 mHighTowerThreshold = 3.6;
21 mClusterThreshold = 5.1;
27 int StBarrelEmcClusterMaker::Init()
31 mGammaEventMaker =
dynamic_cast<StGammaEventMaker*
>(GetMakerInheritsFrom(
"StGammaEventMaker"));
32 assert(mGammaEventMaker);
35 mGammaRawMaker =
dynamic_cast<StGammaRawMaker*
>(GetMakerInheritsFrom(
"StGammaRawMaker"));
36 assert(mGammaRawMaker);
38 return StMaker::Init();
48 mVertex.SetXYZ(0,0,0);
50 for(
unsigned i = 0; i < mClusters.size(); ++i)
69 if (mGammaEventMaker->event()) mVertex = mGammaEventMaker->event()->
vertex();
72 for(
int id = 1;
id <= 4800; ++id)
75 if(
StGammaTower* tower = mGammaRawMaker->tower(
id, kBEmcTower))
80 if (tower->energy > mHighTowerThreshold)
88 if(cluster && cluster->energy() > mClusterThreshold)
90 mClusters.push_back(cluster);
100 LOG_DEBUG <<
"Make() - Number of BEMC clusters: " << mClusters.size() << endm;
102 for(
unsigned int i = 0; i < mClusters.size(); ++i)
104 LOG_DEBUG <<
"---------- BEMC CLUSTER #" << i <<
" ----------" << endm;
105 LOG_DEBUG << *mClusters[i] << endm;
130 float energy = tower->energy;
134 getTowerPosition(
id, position);
139 cluster->setSeed(tower);
142 for (
int deta = -1; deta <= 1; ++deta)
146 for (
int dphi = -1; dphi <= 1; ++dphi)
150 if(deta == 0 && dphi == 0)
continue;
156 if(
StGammaTower* neighbor = mGammaRawMaker->tower(neighborId, kBEmcTower))
163 if (tower->energy > neighbor->energy)
166 cluster->setTower(deta, dphi, neighbor);
167 TVector3 neighborPosition;
168 getTowerPosition(neighborId, neighborPosition);
169 position += neighborPosition * neighbor->energy;
170 energy += neighbor->energy;
185 position *= 1.0 / energy;
188 cluster->setEnergy(energy);
189 cluster->setPosition(position);
192 TVector3 momentum = position - mVertex;
193 momentum.SetMag(energy);
194 cluster->setMomentum(momentum);
204 void StBarrelEmcClusterMaker::getTowerPosition(
int id, TVector3& position)
const
207 StEmcGeom::instance(
"bemc")->getXYZ(
id, x, y, z);
208 position.SetXYZ(x, y, z);
virtual void Clear(Option_t *option="")
User defined functions.
TVector3 & vertex()
Returns muDst file from which event originated.
Int_t getNextTowerId(Float_t eta, Float_t phi, Int_t nTowersdEta, Int_t nTowersdPhi) const
Return neighbor tower id's.
void Clear(Option_t *option="")
User defined functions.