66 #include "Riostream.h"
71 #include "StG2TrackVertexMap.h"
73 #if !defined(ST_NO_NAMESPACES)
80 static const
char rcsid[] = "$Id:
StVertex.cxx,v 2.18 2015/10/09 17:46:15 ullrich Exp $";
81 UInt_t
StVertex::fgNoFitPointCutForGoodTrack = 15;
84 mType = kUndefinedVtxId;
85 memset(mBeg, 0, mEnd-mBeg+1);
89 StVertex::operator==(
const StVertex& v)
const
91 return mType == v.mType &&
93 mPosition == v.mPosition &&
94 mChiSquared == v.mChiSquared;
98 StVertex::operator!=(
const StVertex& v)
const
100 return !(v == *
this);
104 StVertex::covariantMatrix()
const
107 m(1,1) = mCovariantMatrix[0];
108 m(1,2) = m(2,1) = mCovariantMatrix[1];
109 m(2,2) = mCovariantMatrix[2];
110 m(1,3) = m(3,1) = mCovariantMatrix[3];
111 m(2,3) = m(3,2) = mCovariantMatrix[4];
112 m(3,3) = mCovariantMatrix[5];
117 StVertex::positionError()
const
119 return StThreeVectorF(::sqrt(mCovariantMatrix[0]), ::sqrt(mCovariantMatrix[2]), ::sqrt(mCovariantMatrix[5]));
122 void StVertex::setParent(
StTrack* val) { mParent = val; }
123 void StVertex::setCovariantMatrix(
float val[6]) { copy(val, val+6, mCovariantMatrix); }
125 void StVertex::Streamer(TBuffer &R__b)
129 if (R__b.IsReading()) {
131 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
133 Class()->ReadBuffer(R__b,
this, R__v, R__s, R__c);
137 StMeasuredPoint::Streamer(R__b);
138 R__b >> (Int_t&)mType;
141 if (gFile && gFile->GetVersion() < 30000) {R__b >> dumy;}
142 R__b.ReadFastArray(mCovariantMatrix,6);
144 R__b >> mProbChiSquared;
148 R__b.CheckByteCount(R__s, R__c, Class());
153 Class()->WriteBuffer(R__b,
this);
157 void StVertex::setIdTruth() {
158 typedef std::map< Int_t,Float_t> myMap_t;
159 typedef std::pair<Int_t,Float_t> myPair_t;
160 typedef myMap_t::const_iterator myIter_t;
163 UInt_t Ntracks = numberOfDaughters();
166 for (UInt_t l = 0; l < Ntracks; l++) {
167 const StTrack *pTrack = daughter(l);
168 if (! pTrack)
continue;
169 Int_t IdTk = pTrack->idTruth();
170 if (IdTk <= 0)
continue;
171 IdVx = pTrack->idParentVx();
172 if (IdVx <= 0)
continue;
173 qa = pTrack->qaTruth();
if (!qa) qa = 1;
174 idTruths[IdVx] += qa;
176 if (! idTruths.size())
return;
178 Float_t qaBest = 0, qaSum = 0;
179 for (myIter_t it=idTruths.begin(); it!=idTruths.end(); ++it) {
180 qaSum += (*it).second;
181 if ((*it).second < qaBest)
continue;
182 vxBest = (*it).first; qaBest = (*it).second;
184 if (vxBest <= 0 || vxBest > 0xffff)
return;
185 Int_t avgQua = 100*qaBest/(qaSum+1e-10)+0.5;
186 setIdTruth(vxBest,avgQua);
187 Int_t IdParentTk = StG2TrackVertexMap::instance()->IdParentTrack(vxBest);
188 setIdParent(IdParentTk);
191 void StVertex::NotImplemented(
const char *method)
const {
192 cout <<
"StVertex::" << method <<
" is no implemented" << endl;