12 #include <analysis/VertexFitting/RaveInterface/RaveVertexFitter.h>
13 #include <analysis/VertexFitting/RaveInterface/RaveSetup.h>
14 #include <mdst/dataobjects/Track.h>
16 #include <rave/VertexFactory.h>
19 #include <Math/ProbFunc.h>
26 using namespace analysis;
34 B2FATAL(
"RaveSetup::initialize was not called. It has to be called before RaveSetup or RaveVertexFitter are used");
45 B2FATAL(
"RaveSetup::initialize was not called. It has to be called before RaveSetup or RaveVertexFitter are used");
70 rave::Vector6D ravestate(pos.X(), pos.Y(), pos.Z(),
71 mom.X(), mom.Y(), mom.Z());
73 rave::Covariance6D ravecov(cov(0, 0), cov(1, 0), cov(2, 0),
74 cov(1, 1), cov(2, 1), cov(2, 2),
75 cov(3, 0), cov(4, 0), cov(5, 0),
76 cov(3, 1), cov(4, 1), cov(5, 1),
77 cov(3, 2), cov(4, 2), cov(5, 2),
78 cov(3, 3), cov(4, 3), cov(5, 3),
79 cov(4, 4), cov(5, 4), cov(5, 5));
81 return rave::Track(
id, ravestate, ravecov, rave::Charge(aTrackPtr->
getChargeSign()), 1,
90 const TVector3& pos = aParticlePtr->
getVertex();
92 rave::Vector6D ravestate(pos.X(), pos.Y(), pos.Z(), mom.X(), mom.Y(), mom.Z());
96 rave::Covariance6D ravecov(cov(4, 4), cov(4, 5), cov(4, 6),
97 cov(5, 5), cov(5, 6), cov(6, 6),
98 cov(0, 4), cov(1, 4), cov(2, 4),
99 cov(0, 5), cov(1, 5), cov(2, 5),
100 cov(0, 6), cov(1, 6), cov(2, 6),
101 cov(0, 0), cov(0, 1), cov(0, 2),
102 cov(1, 1), cov(1, 2), cov(2, 2));
105 m_raveTracks.emplace_back(
id, ravestate, ravecov, rave::Charge(aParticlePtr->
getCharge() + 0.1), 1, 1);
112 vector<Particle*> daughters = aMotherParticlePtr->
getDaughters();
114 int nDaughters = daughters.size();
115 for (
int i = 0; i not_eq nDaughters; ++i) {
125 if (options ==
"default") {
138 int nOfVertices = -100;
143 const rave::Covariance3D bsCovRave(bsCov(0, 0), bsCov(0, 1), bsCov(0, 2), bsCov(1, 1), bsCov(1, 2), bsCov(2, 2));
159 B2ERROR(
"There is no fitted Vertex. Maybe you did not call fit() or maybe the fit was not successful");
163 B2ERROR(
"The Vertex id " << vertexId <<
" does not correspond to any fitted vertex");
183 const std::vector < std::pair < float, rave::Track > >& weightedTracks =
m_raveVertices[vertexId].weightedTracks();
184 for (
unsigned int i = 0; i not_eq weightedTracks.size(); ++i) {
185 if (weightedTracks[i].second.id() == trackId) {
187 return weightedTracks[i].first;
197 const std::vector < std::pair < float, rave::Track > >& weightedTracks =
m_raveVertices[vertexId].weightedTracks();
198 const int n = weightedTracks.size();
199 vector<int> trackIds(n);
200 for (
int i = 0; i not_eq n; ++i) {
201 trackIds[i] = weightedTracks[i].second.id();
241 Cov(1, 0) = Cov(0, 1);
242 Cov(2, 1) = Cov(1, 2);
243 Cov(2, 0) = Cov(0, 2);
253 B2ERROR(
"RaveVertexFitter: Daughters update works only with a sigle vertex");
258 B2WARNING(
"RaveVertexFitter: Fitted vertex has no refitted tracks");
264 for (
unsigned int i = 0; i < rTracks.size(); i++) {
268 const rave::Covariance6D& fittedCov = rtrk.error();
270 TVector3 x3(fittedV.x(), fittedV.y(), fittedV.z());
273 p4.SetXYZT(fittedP.x(), fittedP.y(), fittedP.z(), fittedE);
275 TMatrixDSym fitted7CovPart =
m_belleDaughters[i]->getMomentumVertexErrorMatrix() ;
278 TMatrixDSym fitted7CovM(7);
279 fitted7CovM(0, 0) = fittedCov.dpxpx(); fitted7CovM(0, 0) = fitted7CovM(0, 0);
280 fitted7CovM(0, 1) = fittedCov.dpxpy(); fitted7CovM(1, 0) = fitted7CovM(0, 1);
281 fitted7CovM(0, 2) = fittedCov.dpxpz(); fitted7CovM(2, 0) = fitted7CovM(0, 2);
282 fitted7CovM(0, 3) = fitted7CovPart(0, 3); fitted7CovM(3, 0) = fitted7CovM(0, 3);
283 fitted7CovM(0, 4) = fittedCov.dxpx(); fitted7CovM(4, 0) = fitted7CovM(0, 4);
284 fitted7CovM(0, 5) = fittedCov.dypx(); fitted7CovM(5, 0) = fitted7CovM(0, 5);
285 fitted7CovM(0, 6) = fittedCov.dzpx(); fitted7CovM(6, 0) = fitted7CovM(0, 6);
287 fitted7CovM(1, 1) = fittedCov.dpypy(); fitted7CovM(1, 1) = fitted7CovM(1, 1);
288 fitted7CovM(1, 2) = fittedCov.dpypz(); fitted7CovM(2, 1) = fitted7CovM(1, 2);
289 fitted7CovM(1, 3) = fitted7CovPart(1, 3); fitted7CovM(3, 1) = fitted7CovM(1, 3);
290 fitted7CovM(1, 4) = fittedCov.dxpy(); fitted7CovM(4, 1) = fitted7CovM(1, 4);
291 fitted7CovM(1, 5) = fittedCov.dypy(); fitted7CovM(5, 1) = fitted7CovM(1, 5);
292 fitted7CovM(1, 6) = fittedCov.dzpy(); fitted7CovM(6, 1) = fitted7CovM(1, 6);
294 fitted7CovM(2, 2) = fittedCov.dpzpz(); fitted7CovM(2, 2) = fitted7CovM(2, 2);
295 fitted7CovM(2, 3) = fitted7CovPart(2, 3); fitted7CovM(3, 2) = fitted7CovM(2, 3);
296 fitted7CovM(2, 4) = fittedCov.dxpz(); fitted7CovM(4, 2) = fitted7CovM(2, 4);
297 fitted7CovM(2, 5) = fittedCov.dypz(); fitted7CovM(5, 2) = fitted7CovM(2, 5);
298 fitted7CovM(2, 6) = fittedCov.dzpz(); fitted7CovM(6, 2) = fitted7CovM(2, 6);
300 fitted7CovM(3, 3) = fitted7CovPart(3, 3); fitted7CovM(3, 3) = fitted7CovM(3, 3);
301 fitted7CovM(3, 4) = fitted7CovPart(3, 4); fitted7CovM(4, 3) = fitted7CovM(3, 4);
302 fitted7CovM(3, 5) = fitted7CovPart(3, 5); fitted7CovM(5, 3) = fitted7CovM(3, 5);
303 fitted7CovM(3, 6) = fitted7CovPart(3, 6); fitted7CovM(6, 3) = fitted7CovM(3, 6);
305 fitted7CovM(4, 4) = fittedCov.dxx(); fitted7CovM(4, 4) = fitted7CovM(4, 4);
306 fitted7CovM(4, 5) = fittedCov.dxy(); fitted7CovM(5, 4) = fitted7CovM(4, 5);
307 fitted7CovM(4, 6) = fittedCov.dxz(); fitted7CovM(6, 4) = fitted7CovM(4, 6);
309 fitted7CovM(5, 5) = fittedCov.dyy(); fitted7CovM(5, 5) = fitted7CovM(5, 5);
310 fitted7CovM(5, 6) = fittedCov.dyz(); fitted7CovM(6, 5) = fitted7CovM(5, 6);
312 fitted7CovM(6, 6) = fittedCov.dzz(); fitted7CovM(6, 6) = fitted7CovM(6, 6);