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;
102 if (theTrackHandle->empty())
116 referencePos = referenceVtx.position();
121 std::vector<reco::TrackRef> theTrackRefs;
122 std::vector<reco::TransientTrack> theTransTracks;
125 for (reco::TrackCollection::const_iterator iTk = theTrackCollection->begin(); iTk != theTrackCollection->end();
135 theTrackRefs.push_back(
std::move(tmpRef));
137 theTransTracks.push_back(
std::move(tmpTransient));
143 for (
unsigned int trdx1 = 0; trdx1 < theTrackRefs.size(); ++trdx1) {
144 for (
unsigned int trdx2 = trdx1 + 1; trdx2 < theTrackRefs.size(); ++trdx2) {
150 if (theTrackRefs[trdx1]->
charge() < 0. && theTrackRefs[trdx2]->charge() > 0.) {
151 negativeTrackRef = theTrackRefs[trdx1];
152 positiveTrackRef = theTrackRefs[trdx2];
153 negTransTkPtr = &theTransTracks[trdx1];
154 posTransTkPtr = &theTransTracks[trdx2];
155 }
else if (theTrackRefs[trdx1]->
charge() > 0. && theTrackRefs[trdx2]->charge() < 0.) {
156 negativeTrackRef = theTrackRefs[trdx2];
157 positiveTrackRef = theTrackRefs[trdx1];
158 negTransTkPtr = &theTransTracks[trdx2];
159 posTransTkPtr = &theTransTracks[trdx1];
165 negativeTrackRef = theTrackRefs[trdx1];
166 positiveTrackRef = theTrackRefs[trdx2];
167 negTransTkPtr = &theTransTracks[trdx1];
168 posTransTkPtr = &theTransTracks[trdx2];
177 if (!posImpact.isValid() || !negImpact.isValid())
189 const double cxPtR2 = cxPt.
x() * cxPt.x() + cxPt.y() * cxPt.y();
190 if (cxPtR2 > 120. * 120. ||
std::abs(cxPt.z()) > 300.)
212 double totalESq = totalE * totalE;
214 double massSquared = totalESq - totalPSq;
219 std::vector<reco::TransientTrack> transTracks;
220 transTracks.reserve(2);
221 transTracks.push_back(*posTransTkPtr);
222 transTracks.push_back(*negTransTkPtr);
225 const GlobalError dummyError(1.0
e-3, 0.0, 1.0
e-3, 0.0, 0.0, 1.0
e-3);
230 theRecoVertex = theKalmanFitter.
vertex(transTracks);
234 theRecoVertex = theAdaptiveFitter.
vertex(transTracks);
248 totalCov = referenceVtx.covariance() + theVtx.
covariance();
249 SVector3 distVecXY(vtxPos.x() - referencePos.x(), vtxPos.y() - referencePos.y(), 0.);
250 double distMagXY = ROOT::Math::Mag(distVecXY);
255 double sigmaDistMagXY =
sqrt(ROOT::Math::Similarity(totalCov, distVecXY)) / distMagXY;
262 vtxPos.x() - referencePos.x(), vtxPos.y() - referencePos.y(), vtxPos.z() - referencePos.z());
263 double distMagXYZ = ROOT::Math::Mag(distVecXYZ);
264 double sigmaDistMagXYZ =
sqrt(ROOT::Math::Similarity(totalCov, distVecXYZ)) / distMagXYZ;
270 double tkHitPosLimitSquared =
274 double posTkHitPosD2 = (posTkHitPos.x() - referencePos.x()) * (posTkHitPos.x() - referencePos.x()) +
275 (posTkHitPos.y() - referencePos.y()) * (posTkHitPos.y() - referencePos.y());
276 if (posTkHitPosD2 < tkHitPosLimitSquared)
281 double negTkHitPosD2 = (negTkHitPos.x() - referencePos.x()) * (negTkHitPos.x() - referencePos.x()) +
282 (negTkHitPos.y() - referencePos.y()) * (negTkHitPos.y() - referencePos.y());
283 if (negTkHitPosD2 < tkHitPosLimitSquared)
287 std::unique_ptr<TrajectoryStateClosestToPoint> trajPlus;
288 std::unique_ptr<TrajectoryStateClosestToPoint> trajMins;
289 std::vector<reco::TransientTrack> theRefTracks;
297 for (std::vector<reco::TransientTrack>::iterator iTrack = theRefTracks.begin(); iTrack != theRefTracks.end();
299 if (iTrack->track().charge() > 0.) {
300 thePositiveRefTrack = &*iTrack;
301 }
else if (iTrack->track().charge() < 0.) {
302 theNegativeRefTrack = &*iTrack;
305 if (thePositiveRefTrack ==
nullptr || theNegativeRefTrack ==
nullptr)
318 if (trajPlus.get() ==
nullptr || trajMins.get() ==
nullptr || !trajPlus->isValid() || !trajMins->isValid())
326 double dx = theVtx.
x() - referencePos.x();
327 double dy = theVtx.
y() - referencePos.y();
328 double px = totalP.x();
329 double py = totalP.y();
336 double dz = theVtx.
z() - referencePos.z();
337 double pz = totalP.z();
345 double piPlusE =
sqrt(positiveP.mag2() + piMassSquared);
346 double piMinusE =
sqrt(negativeP.mag2() + piMassSquared);
347 double protonE =
sqrt(positiveP.mag2() + protonMassSquared);
348 double antiProtonE =
sqrt(negativeP.mag2() + protonMassSquared);
349 double kShortETot = piPlusE + piMinusE;
350 double lambdaEtot = protonE + piMinusE;
351 double lambdaBarEtot = antiProtonE + piPlusE;
361 double vtxNdof(theVtx.
ndof());
372 if (positiveP.mag2() > negativeP.mag2()) {
382 thePiPlusCand.
setTrack(positiveTrackRef);
386 thePiMinusCand.
setTrack(negativeTrackRef);
390 theProtonCand.
setTrack(positiveTrackRef);
394 theAntiProtonCand.
setTrack(negativeTrackRef);
399 theKshort->addDaughter(thePiPlusCand);
400 theKshort->addDaughter(thePiMinusCand);
401 theKshort->setPdgId(310);
402 addp4.
set(*theKshort);
404 theKshorts.push_back(
std::move(*theKshort));
411 addp4.
set(*theLambda);
413 theLambdas.push_back(
std::move(*theLambda));
419 addp4.
set(*theLambdaBar);
421 theLambdas.push_back(
std::move(*theLambdaBar));
428 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
TrackCharge charge() const
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 innerOuterTkDCAThreshold_
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...