28 #include <Math/Functions.h>
29 #include <Math/SMatrix.h>
30 #include <Math/SVector.h>
38 const double piMass = 0.13957018;
39 const double piMassSquared = piMass * piMass;
40 const double protonMass = 0.938272046;
41 const double protonMassSquared = protonMass * protonMass;
42 const double kShortMass = 0.497614;
43 const double lambdaMass = 1.115683;
46 typedef ROOT::Math::SMatrix<double, 3, 3, ROOT::Math::MatRepSym<double, 3>>
SMatrixSym3D;
47 typedef ROOT::Math::SVector<double, 3>
SVector3;
94 if (theTrackHandle->empty())
108 referencePos = referenceVtx.position();
113 std::vector<reco::TrackRef> theTrackRefs;
114 std::vector<reco::TransientTrack> theTransTracks;
117 for (reco::TrackCollection::const_iterator iTk = theTrackCollection->begin(); iTk != theTrackCollection->end();
127 theTrackRefs.push_back(
std::move(tmpRef));
129 theTransTracks.push_back(
std::move(tmpTransient));
135 for (
unsigned int trdx1 = 0; trdx1 < theTrackRefs.size(); ++trdx1) {
136 for (
unsigned int trdx2 = trdx1 + 1; trdx2 < theTrackRefs.size(); ++trdx2) {
142 if (theTrackRefs[trdx1]->
charge() < 0. && theTrackRefs[trdx2]->charge() > 0.) {
143 negativeTrackRef = theTrackRefs[trdx1];
144 positiveTrackRef = theTrackRefs[trdx2];
145 negTransTkPtr = &theTransTracks[trdx1];
146 posTransTkPtr = &theTransTracks[trdx2];
147 }
else if (theTrackRefs[trdx1]->
charge() > 0. && theTrackRefs[trdx2]->charge() < 0.) {
148 negativeTrackRef = theTrackRefs[trdx2];
149 positiveTrackRef = theTrackRefs[trdx1];
150 negTransTkPtr = &theTransTracks[trdx2];
151 posTransTkPtr = &theTransTracks[trdx1];
162 if (!posImpact.isValid() || !negImpact.isValid())
176 if ((cxPt.
x() * cxPt.
x() + cxPt.
y() * cxPt.
y()) > 120. * 120. ||
std::abs(cxPt.
z()) > 300.)
189 double totalESq = totalE * totalE;
191 double massSquared = totalESq - totalPSq;
196 std::vector<reco::TransientTrack> transTracks;
197 transTracks.reserve(2);
198 transTracks.push_back(*posTransTkPtr);
199 transTracks.push_back(*negTransTkPtr);
205 theRecoVertex = theKalmanFitter.
vertex(transTracks);
209 theRecoVertex = theAdaptiveFitter.
vertex(transTracks);
222 totalCov = referenceVtx.covariance() + theVtx.
covariance();
223 SVector3 distVecXY(vtxPos.x() - referencePos.x(), vtxPos.y() - referencePos.y(), 0.);
224 double distMagXY = ROOT::Math::Mag(distVecXY);
225 double sigmaDistMagXY =
sqrt(ROOT::Math::Similarity(totalCov, distVecXY)) / distMagXY;
232 vtxPos.x() - referencePos.x(), vtxPos.y() - referencePos.y(), vtxPos.z() - referencePos.z());
233 double distMagXYZ = ROOT::Math::Mag(distVecXYZ);
234 double sigmaDistMagXYZ =
sqrt(ROOT::Math::Similarity(totalCov, distVecXYZ)) / distMagXYZ;
240 double tkHitPosLimitSquared =
244 double posTkHitPosD2 = (posTkHitPos.x() - referencePos.x()) * (posTkHitPos.x() - referencePos.x()) +
245 (posTkHitPos.y() - referencePos.y()) * (posTkHitPos.y() - referencePos.y());
246 if (posTkHitPosD2 < tkHitPosLimitSquared)
251 double negTkHitPosD2 = (negTkHitPos.x() - referencePos.x()) * (negTkHitPos.x() - referencePos.x()) +
252 (negTkHitPos.y() - referencePos.y()) * (negTkHitPos.y() - referencePos.y());
253 if (negTkHitPosD2 < tkHitPosLimitSquared)
257 std::unique_ptr<TrajectoryStateClosestToPoint> trajPlus;
258 std::unique_ptr<TrajectoryStateClosestToPoint> trajMins;
259 std::vector<reco::TransientTrack> theRefTracks;
267 for (std::vector<reco::TransientTrack>::iterator iTrack = theRefTracks.begin(); iTrack != theRefTracks.end();
269 if (iTrack->track().charge() > 0.) {
270 thePositiveRefTrack = &*iTrack;
271 }
else if (iTrack->track().charge() < 0.) {
272 theNegativeRefTrack = &*iTrack;
275 if (thePositiveRefTrack ==
nullptr || theNegativeRefTrack ==
nullptr)
288 if (trajPlus.get() ==
nullptr || trajMins.get() ==
nullptr || !trajPlus->isValid() || !trajMins->isValid())
296 double dx = theVtx.
x() - referencePos.x();
297 double dy = theVtx.
y() - referencePos.y();
298 double px = totalP.x();
299 double py = totalP.y();
306 double dz = theVtx.
z() - referencePos.z();
307 double pz = totalP.z();
315 double piPlusE =
sqrt(positiveP.mag2() + piMassSquared);
316 double piMinusE =
sqrt(negativeP.mag2() + piMassSquared);
317 double protonE =
sqrt(positiveP.mag2() + protonMassSquared);
318 double antiProtonE =
sqrt(negativeP.mag2() + protonMassSquared);
319 double kShortETot = piPlusE + piMinusE;
320 double lambdaEtot = protonE + piMinusE;
321 double lambdaBarEtot = antiProtonE + piPlusE;
331 double vtxNdof(theVtx.
ndof());
342 if (positiveP.mag2() > negativeP.mag2()) {
352 thePiPlusCand.
setTrack(positiveTrackRef);
356 thePiMinusCand.
setTrack(negativeTrackRef);
360 theProtonCand.
setTrack(positiveTrackRef);
364 theAntiProtonCand.
setTrack(negativeTrackRef);
369 theKshort->addDaughter(thePiPlusCand);
370 theKshort->addDaughter(thePiMinusCand);
371 theKshort->setPdgId(310);
372 addp4.
set(*theKshort);
374 theKshorts.push_back(
std::move(*theKshort));
381 addp4.
set(*theLambda);
383 theLambdas.push_back(
std::move(*theLambda));
389 addp4.
set(*theLambdaBar);
391 theLambdas.push_back(
std::move(*theLambdaBar));
398 theKshort = theLambda = theLambdaBar =
nullptr;