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;
T getParameter(std::string const &) const
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > SMatrixSym3D
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void set(reco::Candidate &c) const
set up a candidate
double z() const
z coordinate
float distance() const override
unsigned short numberOfValidHits() const
number of valid hits found
const Point & position() const
position
edm::EDGetTokenT< std::vector< reco::Vertex > > token_vertices
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
T const * product() const
std::vector< Track > TrackCollection
collection of Tracks
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
double vtxDecaySigXYZCut_
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
double pt() const
track transverse momentum
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
GlobalPoint crossingPoint() const override
double dxyError() const
error on dxy
edm::EDGetTokenT< reco::TrackCollection > token_tracks
double dzError() const
error on dz
TrajectoryStateClosestToPoint impactPointTSCP() const
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
math::XYZPoint Point
point in the space
Abs< T >::type abs(const T &t)
void fitAll(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::VertexCompositeCandidateCollection &k, reco::VertexCompositeCandidateCollection &l)
math::XYZPoint Point
point in the space
Covariance3DMatrix rotatedCovariance3D() const
double x() const
x coordinate
V0Fitter(const edm::ParameterSet &theParams, edm::ConsumesCollector &&iC)
double y() const
y coordinate
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
double normalizedChi2() const
chi-squared divided by n.d.o.f.
bool hasRefittedTracks() const
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
XYZPointD XYZPoint
point in space with cartesian internal representation
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
double chi2() const
chi-squares
double mass() const final
mass
GlobalVector momentum() const
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > esTokenMF_
ROOT::Math::SVector< double, 3 > SVector3
void setTrack(const reco::TrackRef &r)
set reference to track
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setPdgId(int pdgId) final
bool status() const override
std::vector< reco::TransientTrack > const & refittedTracks() const
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...