45 #include "StPxlCluster.h"
46 #include "StPxlRawHitMaker/StPxlRawHit.h"
63 return mRawHitVec.size();
69 mRawHitVec.push_back(rawHit);
73 bool StPxlCluster::compareSecond(
const pair<int, int> &pair1,
const pair<int, int> &pair2)
75 return pair1.second < pair2.second;
84 int nRawHits_ = nRawHits();
86 for (
int i = 0; i < nRawHits_; i++) {
87 columnSum += mRawHitVec[i]->column();
88 rowSum += mRawHitVec[i]->row();
91 mColumnCenter = columnSum / float(nRawHits_);
92 mRowCenter = rowSum / float(nRawHits_);
96 if (embeddingShortCut) {
return;}
97 map<int, int> idTruthMap;
98 for (
int i = 0; i < nRawHits_; i++) {
101 if (mRawHitVec[i]->idTruth()) {idTruthMap[mRawHitVec[i]->idTruth()] ++;}
105 if (!idTruthMap.empty()) {
106 mIdTruth = max_element(idTruthMap.begin(), idTruthMap.end(), compareSecond)->first;
void summarize(int embeddingShortCut=0)
calculate column center, row center, and most frequent idTruth among raw hits
void addRawHit(const StPxlRawHit *rawHit)
add a raw hit to the cluster
Int_t nRawHits() const
number of raw hits