14 #include <TLorentzVector.h>
15 #include <TProcessID.h>
17 #include "StRoot/St_base/StMessMgr.h"
18 #include "StRoot/StEvent/StEvent.h"
21 #include "StRoot/StEvent/StFmsHit.h"
23 #include "StRoot/StEvent/StRunInfo.h"
34 TLorentzVector compute4Momentum(
const TVector3& xyz, Double_t energy) {
35 TVector3 mom3 = xyz.Unit() * energy;
36 return TLorentzVector(mom3, energy);
41 : StMaker(name), mFmsDbMaker(NULL), mObjectCount(0) { }
56 return StMaker::InitRun(runNumber);
68 LOG_ERROR <<
"StFmsPointMaker::Make() - failed to initialise tower " <<
69 "lists for the event" << endm;
72 return StMaker::Make();
82 StMaker::Clear(option);
86 StEvent*
event =
static_cast<StEvent*
>(GetInputDS(
"StEvent"));
89 fms =
event->fmsCollection();
92 LOG_ERROR <<
"StFmsPointMaker did not find "
93 <<
"an StFmsCollection in StEvent" << endm;
100 if (!fmsCollection) {
117 if (!clustering.
cluster(towers)) {
122 for (
auto cluster = clusters.begin(); cluster != clusters.end(); ++cluster) {
131 float centerOfMassEnergy(500.);
132 const StEvent*
event =
static_cast<const StEvent*
>(GetInputDS(
"StEvent"));
134 if (event->runInfo()) {
135 centerOfMassEnergy =
event->runInfo()->centerOfMassEnergy();
140 typedef TowerList::const_iterator TowerIter;
141 for (TowerIter i = towers.begin(); i != towers.end(); ++i) {
142 Esum += i->hit()->energy();
144 return Esum >= 0.f && Esum <= centerOfMassEnergy;
149 const int detectorId,
155 if (!(cluster->
x() > 0. && cluster->
y() > 0.)) {
163 cluster->
x(), cluster->
y(), detectorId);
166 for (Int_t np = 0; np < cluster->
nPhotons(); np++) {
175 fmsCollection->
points().push_back(point);
176 cluster->
points().push_back(point);
179 typedef std::list<FMSCluster::StFmsTower*>::const_iterator TowerIter;
180 std::list<FMSCluster::StFmsTower*>& towers = towerCluster->
towers();
181 for (TowerIter i = towers.begin(); i != towers.end(); ++i) {
182 if ((*i)->hit()->adc() >= 1) {
183 cluster->
hits().push_back((*i)->hit());
200 photon.
xPos, photon.
yPos, detectorId);
201 point->
setX(xyz.x());
202 point->
setY(xyz.y());
209 if (!fmsCollection) {
212 StSPtrVecFmsHit& hits = fmsCollection->
hits();
213 for (StSPtrVecFmsHitIterator i = hits.begin(); i != hits.end(); ++i) {
215 const int detector = hit->detectorId();
221 if (hit->adc() > 0) {
225 TowerMap::iterator low =
mTowers.lower_bound(detector);
226 if (low ==
mTowers.end() ||
mTowers.key_comp()(detector, low->first)) {
232 mTowers[detector].push_back(tower);
242 if (row < 1 || column < 1) {
249 if (fabs(row - 17.5) < 8 && column < 9) {
253 if (fabs(17.5 - row) + column > 27.) {
259 if (fabs(row - 12.5) < 5 && column < 6) {
272 if (nRows < 0 || row > nRows) {
276 if (nColumns < 0 || column > nColumns) {
bool isValidChannel(int detector, int row, int col)
bool validateTowerEnergySum(const TowerList &towers) const
Bool_t initialize(StFmsDbMaker *fmsDbMaker)
bool processTowerCluster(FMSCluster::StFmsTowerCluster *towerCluster, int detectorId, StFmsCollection *fmsCollection)
StFmsPoint * makeFmsPoint(const FMSCluster::StFmsFittedPhoton &photon, int detectorId)
Int_t nColumn(Int_t detectorId)
number of rows
void setNParentClusterPhotons(Int_t nclph)
Int_t InitRun(Int_t runNumber)
void setCluster(StFmsCluster *cluster)
void Clear(Option_t *option="")
Declaration of StFmsCluster, a group of adjacent FMS hits.
void setFourMomentum(const TLorentzVector &p4)
Float_t xPos
Fitted (relative) x-position.
void setParentClusterId(Int_t cluid)
int mObjectCount
Object count in event for use with TRef.
Declaration of StFmsTower, a simple FMS tower wrapper.
Int_t getColumnNumber(Int_t detectorId, Int_t ch)
get the row number for the channel
Float_t energy
Fitted energy.
Declaration of StFmsEventClusterer, manager class for clustering.
Bool_t initialize(StFmsDbMaker *database)
TowerMap mTowers
One for each sub-detector, keyed by detector ID.
void setDetectorId(UShort_t detector)
StFmsDbMaker * mFmsDbMaker
Access to FMS database information.
Declaration of StFmsTowerCluster, a cluster of FMS towers.
Declaration of StFmsPointMaker, the FMS cluster/photon maker.
Int_t getRowNumber(Int_t detectorId, Int_t ch)
maximum number of channels
StSPtrVecFmsPoint & points()
Int_t nRow(Int_t detectorId)
type of the detector
void addCluster(StFmsCluster *)
StFmsFittedPhoton * photons()
Declaration of StFmsPoint, the StEvent FMS photon structure.
StPtrVecFmsPoint & points()
void setEnergy(Float_t energy)
Declaration of StFmsFittedPhoton, a photon fitted to an FMS cluster.
void setDetectorId(UShort_t detector)
std::list< std::unique_ptr< StFmsTowerCluster > > ClusterList
void setId(Float_t cluid)
TVector3 localToGlobalCoordinates(Double_t x, Double_t y, Int_t detectorId) const
bool populateTowerLists()
std::vector< FMSCluster::StFmsTower > TowerList
int clusterDetector(TowerList *towers, int detectorId, StFmsCollection *fmsCollection)
StFmsPointMaker(const char *name="StFmsPointMaker")
Float_t yPos
Fitted (relative) y-position.
unsigned int numberOfPoints() const
Bool_t cluster(std::vector< FMSCluster::StFmsTower > *towers)
TVector3 columnRowToGlobalCoordinates(Double_t column, Double_t row, Int_t detectorId) const
StFmsCollection * getFmsCollection()
void setFourMomentum(TLorentzVector p4)
FMSCluster::StFmsGeometry mGeometry
Access to current FMS geometry.