41 #include "StEvent/StFmsCollection.h"
43 #include "StEvent/StFmsHit.h"
44 #include "StEvent/StFmsCluster.h"
45 #include "StEvent/StFmsPoint.h"
46 #include "StEvent/StFpsSlat.h"
47 #include "StEvent/StFmsPointPair.h"
48 #include "StarClassLibrary/StParticleTypes.hh"
50 static const char rcsid[] =
"$Id: StFmsCollection.cxx,v 2.9 2019/06/25 15:56:33 ullrich Exp $";
52 StFmsCollection::StFmsCollection() :
53 mFmsReconstructionFlag(0), mFpsSlatFilled(false), mFpsAssociationFilled(false), mFmsPointPairFilled(false) {
56 StFmsCollection::~StFmsCollection() {
57 for(
unsigned int i=0; i<mPointPairs.size(); i++) {
delete (mPointPairs[i]);}
61 unsigned int StFmsCollection::numberOfHits()
const {
65 unsigned int StFmsCollection::numberOfClusters()
const {
66 return mClusters.size();
69 unsigned int StFmsCollection::numberOfPoints()
const {
70 return mPoints.size();
77 void StFmsCollection::addCluster(
StFmsCluster* cluster) {
78 mClusters.push_back(cluster);
81 void StFmsCollection::addPoint(
StFmsPoint* point) {
82 mPoints.push_back(point);
85 StSPtrVecFmsHit& StFmsCollection::hits() {
89 const StSPtrVecFmsHit& StFmsCollection::hits()
const {
93 StSPtrVecFmsCluster& StFmsCollection::clusters() {
97 const StSPtrVecFmsCluster& StFmsCollection::clusters()
const {
101 StSPtrVecFmsPoint& StFmsCollection::points() {
105 const StSPtrVecFmsPoint& StFmsCollection::points()
const {
109 StSPtrVecFpsSlat& StFmsCollection::fpsSlats() {
110 if(!mFpsAssociationFilled) fillFpsAssociation();
114 StFpsSlat* StFmsCollection::fps(
int slatid){
115 if(!mFpsAssociationFilled) fillFpsAssociation();
116 return mFpsSlats[slatid];
119 void StFmsCollection::fillFpsSlat(){
121 for(
unsigned int i=0; i<kFpsMaxSlat; i++) {
122 mFpsSlats.push_back(
new StFpsSlat(i,0.0));
124 for(
unsigned int i=0; i<numberOfHits(); i++) {
125 if(mHits[i]->detectorId()==kFpsDetId){
126 int slatid=int(mHits[i]->channel());
127 if (slatid>=0 && slatid<kFpsMaxSlat){
128 mFpsSlats[slatid]->setMip(mHits[i]->energy());
135 void StFmsCollection::fillFpsAssociation(){
136 if (!mFpsSlatFilled) fillFpsSlat();
137 for(
unsigned int i=0; i<numberOfPoints(); i++) {
138 for(
int l=1; l<=kFpsNLayer; l++) {
139 for(
int c=0; c<kFpsNCandidate; c++) {
140 int slatid=mPoints[i]->fpsSlatId(l,c);
142 mFpsSlats[slatid]->addPoint(mPoints[i],c);
147 mFpsAssociationFilled=
true;
150 void StFmsCollection::fillFmsPointPair(){
151 int np=numberOfPoints();
153 sortPointsByEnergy();
154 for(
int i=0; i<np-1; i++){
155 if(mPoints[i]->energy()<1.0)
break;
156 for(
int j=i+1; j<np; j++){
157 if(mPoints[j]->energy()<1.0)
break;
162 mPointPairsEnergySorted = mPointPairs;
164 return b->energy() < a->energy();
167 mPointPairsETSorted = mPointPairs;
169 return b->pT() < a->pT();
172 mPointPairsPi0MassSorted = mPointPairs;
174 return fabs(b->mass() - StPionZero::instance()->mass()) > fabs(a->mass() - StPionZero::instance()->mass());
177 mFmsPointPairFilled=
true;
180 unsigned int StFmsCollection::numberOfPointPairs() {
181 if(!mFmsPointPairFilled) fillFmsPointPair();
182 return mPointPairs.size();
185 vector<StFmsPointPair*>& StFmsCollection::pointPairs() {
186 if(!mFmsPointPairFilled) fillFmsPointPair();
190 vector<StFmsPointPair*>& StFmsCollection::pointPairsEnergySorted() {
191 if(!mFmsPointPairFilled) fillFmsPointPair();
192 return mPointPairsEnergySorted;
195 vector<StFmsPointPair*>& StFmsCollection::pointPairsETSorted() {
196 if(!mFmsPointPairFilled) fillFmsPointPair();
197 return mPointPairsETSorted;
200 vector<StFmsPointPair*>& StFmsCollection::pointPairsPi0MassSorted() {
201 if(!mFmsPointPairFilled) fillFmsPointPair();
202 return mPointPairsPi0MassSorted;
205 void StFmsCollection::sortPointsByEnergy() {
207 return b->energy() < a->energy();
211 void StFmsCollection::sortPointsByET() {
213 return b->fourMomentum().perp() < a->fourMomentum().perp();
217 void StFmsCollection::print(
int option) {
218 cout << Form(
"Flag=%x MergeSmallToLarge=%1d GlobalRefit=%1d Try1PhotonFit=%1d NewClusterCateg=%1d ScaleShowerShape=%1d Scale L/S=%f/%f\n",
219 mFmsReconstructionFlag,isMergeSmallToLarge(),isGlobalRefit(),isTry1PhotonFit(),
220 isNewClusterCategorization(),isScaleShowerShape(),scaleShowerShapeLarge(),scaleShowerShapeSmall());
221 cout << Form(
"NHit=%3d NCluster=%3d NPoint=%3d\n",numberOfHits(),numberOfClusters(),numberOfPoints());
222 if(option>=5)
for(
unsigned int i=0; i<numberOfHits(); i++) {hits()[i]->print();}
223 if(option>=4)
for(
unsigned int i=0; i<numberOfClusters(); i++) {clusters()[i]->print();}
224 if(option>=3)
for(
unsigned int i=0; i<mFpsSlats.size(); i++) {fpsSlats()[i]->print(1);}
225 if(option>=2)
for(
unsigned int i=0; i<numberOfPoints(); i++) {points()[i]->print();}
226 if(option>=1)
for(
unsigned int i=0; i<numberOfPointPairs(); i++) {pointPairs()[i]->print();}