28 #include <Math/Functions.h> 29 #include <Math/SVector.h> 30 #include <Math/SMatrix.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())
return;
106 referenceVtx = vertices->at(0);
107 referencePos = referenceVtx.position();
114 std::vector<reco::TrackRef> theTrackRefs;
115 std::vector<reco::TransientTrack> theTransTracks;
118 for (reco::TrackCollection::const_iterator iTk = theTrackCollection->begin(); iTk != theTrackCollection->end(); ++iTk) {
126 theTrackRefs.push_back(
std::move(tmpRef));
128 theTransTracks.push_back(
std::move(tmpTransient));
134 for (
unsigned int trdx1 = 0; trdx1 < theTrackRefs.size(); ++trdx1) {
135 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())
continue;
167 if (!cApp.
status())
continue;
173 if (
sqrt(cxPt.
x()*cxPt.
x() + cxPt.
y()*cxPt.
y()) > 120. ||
std::abs(cxPt.
z()) > 300.)
continue;
183 double totalESq = totalE*totalE;
185 double mass =
sqrt(totalESq - totalPSq);
189 std::vector<reco::TransientTrack> transTracks;
190 transTracks.reserve(2);
191 transTracks.push_back(*posTransTkPtr);
192 transTracks.push_back(*negTransTkPtr);
198 theRecoVertex = theKalmanFitter.
vertex(transTracks);
202 theRecoVertex = theAdaptiveFitter.
vertex(transTracks);
204 if (!theRecoVertex.
isValid())
continue;
213 SVector3 distVecXY(vtxPos.x()-referencePos.x(), vtxPos.y()-referencePos.y(), 0.);
214 double distMagXY = ROOT::Math::Mag(distVecXY);
215 double sigmaDistMagXY =
sqrt(ROOT::Math::Similarity(totalCov, distVecXY)) / distMagXY;
220 SVector3 distVecXYZ(vtxPos.x()-referencePos.x(), vtxPos.y()-referencePos.y(), vtxPos.z()-referencePos.z());
221 double distMagXYZ = ROOT::Math::Mag(distVecXYZ);
222 double sigmaDistMagXYZ =
sqrt(ROOT::Math::Similarity(totalCov, distVecXYZ)) / distMagXYZ;
229 double posTkHitPosD2 = (posTkHitPos.x()-referencePos.x())*(posTkHitPos.x()-referencePos.x()) +
230 (posTkHitPos.y()-referencePos.y())*(posTkHitPos.y()-referencePos.y());
235 double negTkHitPosD2 = (negTkHitPos.x()-referencePos.x())*(negTkHitPos.x()-referencePos.x()) +
236 (negTkHitPos.y()-referencePos.y())*(negTkHitPos.y()-referencePos.y());
240 std::unique_ptr<TrajectoryStateClosestToPoint> trajPlus;
241 std::unique_ptr<TrajectoryStateClosestToPoint> trajMins;
242 std::vector<reco::TransientTrack> theRefTracks;
250 for (std::vector<reco::TransientTrack>::iterator iTrack = theRefTracks.begin(); iTrack != theRefTracks.end(); ++iTrack) {
251 if (iTrack->track().charge() > 0.) {
252 thePositiveRefTrack = &*iTrack;
253 }
else if (iTrack->track().charge() < 0.) {
254 theNegativeRefTrack = &*iTrack;
257 if (thePositiveRefTrack ==
nullptr || theNegativeRefTrack ==
nullptr)
continue;
265 if (trajPlus.get() ==
nullptr || trajMins.get() ==
nullptr || !trajPlus->isValid() || !trajMins->isValid())
continue;
272 double dx = theVtx.
x()-referencePos.x();
273 double dy = theVtx.
y()-referencePos.y();
274 double px = totalP.x();
275 double py = totalP.y();
276 double angleXY = (dx*px+dy*py)/(
sqrt(dx*dx+dy*dy)*
sqrt(px*px+py*py));
281 double dz = theVtx.
z()-referencePos.z();
282 double pz = totalP.z();
283 double angleXYZ = (dx*px+dy*py+dz*pz)/(
sqrt(dx*dx+dy*dy+dz*dz)*
sqrt(px*px+py*py+pz*pz));
288 double piPlusE =
sqrt(positiveP.mag2() + piMassSquared);
289 double piMinusE =
sqrt(negativeP.mag2() + piMassSquared);
290 double protonE =
sqrt(positiveP.mag2() + protonMassSquared);
291 double antiProtonE =
sqrt(negativeP.mag2() + protonMassSquared);
292 double kShortETot = piPlusE + piMinusE;
293 double lambdaEtot = protonE + piMinusE;
294 double lambdaBarEtot = antiProtonE + piPlusE;
304 double vtxNdof(theVtx.
ndof());
315 if (positiveP.mag2() > negativeP.mag2()) {
325 thePiPlusCand.
setTrack(positiveTrackRef);
329 thePiMinusCand.
setTrack(negativeTrackRef);
333 theProtonCand.
setTrack(positiveTrackRef);
337 theAntiProtonCand.
setTrack(negativeTrackRef);
342 theKshort->addDaughter(thePiPlusCand);
343 theKshort->addDaughter(thePiMinusCand);
344 theKshort->setPdgId(310);
345 addp4.
set(*theKshort);
347 theKshorts.push_back(
std::move(*theKshort));
354 addp4.
set( *theLambda );
356 theLambdas.push_back(
std::move(*theLambda));
362 addp4.
set(*theLambdaBar);
364 theLambdas.push_back(
std::move(*theLambdaBar));
371 theKshort = theLambda = theLambdaBar =
nullptr;
T getParameter(std::string const &) const
float distance() const override
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > SMatrixSym3D
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrajectoryStateClosestToPoint impactPointTSCP() const
double dxyError() const
error on dxy
edm::EDGetTokenT< std::vector< reco::Vertex > > token_vertices
double y() const
y coordinate
std::vector< Track > TrackCollection
collection of Tracks
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const override
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
bool hasRefittedTracks() const
double vtxDecaySigXYZCut_
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
bool status() const override
edm::EDGetTokenT< reco::TrackCollection > token_tracks
bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb) override
double pt() const
track transverse momentum
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
math::XYZPoint Point
point in the space
Abs< T >::type abs(const T &t)
double chi2() const
chi-squares
double z() const
z coordinate
void fitAll(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::VertexCompositeCandidateCollection &k, reco::VertexCompositeCandidateCollection &l)
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
math::XYZPoint Point
point in the space
unsigned short numberOfValidHits() const
number of valid hits found
V0Fitter(const edm::ParameterSet &theParams, edm::ConsumesCollector &&iC)
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
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...
double dzError() const
error on dz
double x() const
x coordinate
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
const Point & position() const
position
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
std::vector< reco::TransientTrack > const & refittedTracks() const
void set(reco::Candidate &c) const
set up a candidate
double normalizedChi2() const
chi-squared divided by n.d.o.f.
Covariance3DMatrix rotatedCovariance3D() const
ROOT::Math::SVector< double, 3 > SVector3
GlobalPoint crossingPoint() const override
void setTrack(const reco::TrackRef &r)
set reference to track
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setPdgId(int pdgId) final
T const * product() const
GlobalVector momentum() const
double mass() const final
mass