76 #include "StPrimaryVertex.h"
77 #include "StPrimaryTrack.h"
80 #include "StTrackNode.h"
81 #include "StGlobalTrack.h"
83 #include "StTrackGeometry.h"
86 static const
char rcsid[] = "$Id:
StPrimaryVertex.cxx,v 2.20 2013/01/15 23:31:05 fisyak Exp $";
91 void StPrimaryVertex::init()
94 mVertexFinderId = undefinedVertexFinder;
95 memset(mBeg, 0, mEnd-mBeg+1);
98 StPrimaryVertex::~StPrimaryVertex() {};
101 StPrimaryVertex::type()
const {
return kEventVtxId; }
104 StPrimaryVertex::numberOfDaughters()
const
106 return mDaughters.size();
108 UInt_t StPrimaryVertex::numberOfGoodTracks()
const {
110 for (UInt_t i=0; i<mDaughters.size(); i++) {
112 if (track && track->flag() >= 0 && track->fitTraits().numberOfFitPoints() >= NoFitPointCutForGoodTrack()) no++;
118 StPrimaryVertex::daughter(UInt_t i)
120 return i < mDaughters.size() ? mDaughters[i] : 0;
124 StPrimaryVertex::daughter(UInt_t i)
const
126 return i < mDaughters.size() ? mDaughters[i] : 0;
133 for (UInt_t i=0; i<mDaughters.size(); i++)
134 if (filter(mDaughters[i])) vec.push_back(mDaughters[i]);
139 StPrimaryVertex::addDaughter(
StTrack* t)
143 if (p->type() == primary) {
144 mDaughters.push_back(p);
151 StPrimaryVertex::removeDaughter(
StTrack* t)
155 StSPtrVecPrimaryTrackIterator iter;
156 if (p->type() == primary) {
157 for (iter=mDaughters.begin(); iter != mDaughters.end(); iter++)
159 mDaughters.erase(iter);
166 StPrimaryVertex::setParent(
StTrack*)
168 cerr <<
"StPrimaryVertex::setParent(): StPrimaryVertex cannot have a parent." << endl;
171 void StPrimaryVertex::setTrackNumbers() {
172 mNumMatchesWithTOF = 0;
173 mNumMatchesWithCTB = 0;
174 mNumMatchesWithBEMC = 0;
175 mNumMatchesWithEEMC = 0;
176 mNumNotMatchesWithTOF = 0;
177 mNumNotMatchesWithCTB = 0;
178 mNumNotMatchesWithBEMC = 0;
179 mNumNotMatchesWithEEMC = 0;
180 mNumTracksCrossingCentralMembrane = 0;
182 mNumTracksWithPromptHit = 0;
183 mNumTracksTpcWestOnly = mNumTracksTpcEastOnly = 0;
186 UInt_t nDaughters = numberOfDaughters();
187 UShort_t n_trk_vtx = 0;
188 for (UInt_t i = 0; i < nDaughters; i++) {
190 if (! pTrack)
continue;
193 mMeanDip += TMath::PiOver2() - g3.theta();
194 mSumOfTrackPt += g3.perp();
195 if (! pTrack->flagExtension()) {
197 const StTrack *gTrack = node->track(global);
198 if (gTrack) pTrack->setFlagExtension(gTrack->flagExtension());
200 if (pTrack->isCtbMatched() ) mNumMatchesWithCTB++;
201 if (pTrack->isCtbNotMatched() ) mNumNotMatchesWithCTB++;
202 if (pTrack->isToFMatched() ) mNumMatchesWithTOF++;
203 if (pTrack->isToFNotMatched() ) mNumNotMatchesWithTOF++;
204 if ((pTrack->flagExtension() & 7) > 0) {
205 if (pTrack->isBemcMatched() ) mNumMatchesWithBEMC += 1;
206 if (pTrack->isEemcMatched() ) mNumMatchesWithEEMC += 1;
208 if (pTrack->isBemcNotMatched()) mNumNotMatchesWithBEMC++;
209 if (pTrack->isEemcNotMatched()) mNumNotMatchesWithEEMC++;
210 if (pTrack->isMembraneCrossingTrack()) mNumTracksCrossingCentralMembrane++;
211 if (pTrack->isPostXTrack()) mNumPostXTracks++;
212 if (pTrack-> isPromptTrack()) mNumTracksWithPromptHit++;
213 if (pTrack->isWestTpcOnly()) mNumTracksTpcWestOnly++;
214 if (pTrack->isEastTpcOnly()) mNumTracksTpcEastOnly++;
216 if (n_trk_vtx > 0) mMeanDip /= n_trk_vtx;
220 UInt_t nGoodTpcTracks = 0, nTpcTracks = 0;
221 UInt_t nDaughters = v.numberOfDaughters();
222 for (UInt_t i=0; i < nDaughters; i++) {
224 if (! pTrack)
continue;
225 Int_t good = (pTrack->flag() > 0 && pTrack->fitTraits().numberOfFitPoints() >= StVertex::NoFitPointCutForGoodTrack()) ? 1 : 0;
226 if (pTrack->fitTraits().numberOfFitPoints(kTpcId)) {
227 nTpcTracks++; nGoodTpcTracks+=good;
230 const Char_t *
beam = (v.isBeamConstrained()) ?
"B" :
" ";
232 os << Form(
"%1s:",beam);
233 if (v.numPostXTracks() < 10) os << Form(
"%i/",v.numPostXTracks());
235 if (v.numTracksWithPromptHit() < 10) os << Form(
"%i/",v.numTracksWithPromptHit());
237 if (v.numTracksCrossingCentralMembrane() < 10) os << Form(
"%i/",v.numTracksCrossingCentralMembrane());
239 if ((v.numMatchesWithCTB()+v.numMatchesWithBTOF()) < 10) os << Form(
"%i/",(v.numMatchesWithCTB()+v.numMatchesWithBTOF()));
241 if ((v.numMatchesWithBEMC()+v.numMatchesWithEEMC()) < 10) os << Form(
"%i/",(v.numMatchesWithBEMC()+v.numMatchesWithEEMC()));
243 if (v.numTracksTpcWestOnly() < 10) os << Form(
"%i/",v.numTracksTpcWestOnly());
245 if (v.numTracksTpcEastOnly() < 10) os << Form(
"%i",v.numTracksTpcEastOnly());
247 const Float_t *xyz = v.position().xyz();
248 const Float_t *dxyz = v.positionError().xyz();
249 for (Int_t i = 0; i < 3; i++) os << Form(
"%8.3f+/-%5.3f,",xyz[i],dxyz[i]);
250 os <<
" Prob/Chi2: " << Form(
"%5.3f/%7.2f",v.probChiSquared(),v.chiSquared())
251 <<
" Rank: " << Form(
"%8.1f",v.ranking())
252 << Form(
" U/T/G: %4i,%4i,%4i", v.numTracksUsedInFinder(),nDaughters,v.numberOfGoodTracks());
253 if (nTpcTracks != nDaughters || nGoodTpcTracks != v.numberOfGoodTracks()) {
254 os << Form(
" TPC:%4i,%4i",nTpcTracks,nGoodTpcTracks);
257 os << Form(
" IdT: %5i Q: %4i", v.idTruth(), v.qaTruth());