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;
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->size())
return;
113 std::vector<reco::TrackRef> theTrackRefs;
114 std::vector<reco::TransientTrack> theTransTracks;
117 for (reco::TrackCollection::const_iterator iTk = theTrackCollection->begin(); iTk != theTrackCollection->end(); ++iTk) {
129 theTrackRefs.push_back(std::move(tmpRef));
131 theTransTracks.push_back(std::move(tmpTransient));
137 for (
unsigned int trdx1 = 0; trdx1 < theTrackRefs.size(); ++trdx1) {
138 for (
unsigned int trdx2 = trdx1 + 1; trdx2 < theTrackRefs.size(); ++trdx2) {
145 if (theTrackRefs[trdx1]->
charge() < 0. && theTrackRefs[trdx2]->charge() > 0.) {
146 negativeTrackRef = theTrackRefs[trdx1];
147 positiveTrackRef = theTrackRefs[trdx2];
148 negTransTkPtr = &theTransTracks[trdx1];
149 posTransTkPtr = &theTransTracks[trdx2];
150 }
else if (theTrackRefs[trdx1]->
charge() > 0. && theTrackRefs[trdx2]->charge() < 0.) {
151 negativeTrackRef = theTrackRefs[trdx2];
152 positiveTrackRef = theTrackRefs[trdx1];
153 negTransTkPtr = &theTransTracks[trdx2];
154 posTransTkPtr = &theTransTracks[trdx1];
165 if (!cApp.
status())
continue;
171 if (
sqrt(cxPt.
x()*cxPt.
x() + cxPt.
y()*cxPt.
y()) > 120. ||
std::abs(cxPt.
z()) > 300.)
continue;
181 double totalESq = totalE*totalE;
183 double mass =
sqrt(totalESq - totalPSq);
187 std::vector<reco::TransientTrack> transTracks;
188 transTracks.reserve(2);
189 transTracks.push_back(*posTransTkPtr);
190 transTracks.push_back(*negTransTkPtr);
196 theRecoVertex = theKalmanFitter.
vertex(transTracks);
200 theRecoVertex = theAdaptiveFitter.
vertex(transTracks);
202 if (!theRecoVertex.
isValid())
continue;
210 SVector3 distVecXY(vtxPos.x()-referencePos.x(), vtxPos.y()-referencePos.y(), 0.);
211 double distMagXY = ROOT::Math::Mag(distVecXY);
212 double sigmaDistMagXY =
sqrt(ROOT::Math::Similarity(totalCov, distVecXY)) / distMagXY;
216 SVector3 distVecXYZ(vtxPos.x()-referencePos.x(), vtxPos.y()-referencePos.y(), vtxPos.z()-referencePos.z());
217 double distMagXYZ = ROOT::Math::Mag(distVecXYZ);
218 double sigmaDistMagXYZ =
sqrt(ROOT::Math::Similarity(totalCov, distVecXYZ)) / distMagXYZ;
224 double posTkHitPosD2 = (posTkHitPos.x()-referencePos.x())*(posTkHitPos.x()-referencePos.x()) +
225 (posTkHitPos.y()-referencePos.y())*(posTkHitPos.y()-referencePos.y());
230 double negTkHitPosD2 = (negTkHitPos.x()-referencePos.x())*(negTkHitPos.x()-referencePos.x()) +
231 (negTkHitPos.y()-referencePos.y())*(negTkHitPos.y()-referencePos.y());
235 std::auto_ptr<TrajectoryStateClosestToPoint> trajPlus;
236 std::auto_ptr<TrajectoryStateClosestToPoint> trajMins;
237 std::vector<reco::TransientTrack> theRefTracks;
245 for (std::vector<reco::TransientTrack>::iterator iTrack = theRefTracks.begin(); iTrack != theRefTracks.end(); ++iTrack) {
246 if (iTrack->track().charge() > 0.) {
247 thePositiveRefTrack = &*iTrack;
248 }
else if (iTrack->track().charge() < 0.) {
249 theNegativeRefTrack = &*iTrack;
252 if (thePositiveRefTrack == 0 || theNegativeRefTrack == 0)
continue;
260 if (trajPlus.get() == 0 || trajMins.get() == 0 || !trajPlus->isValid() || !trajMins->isValid())
continue;
267 double dx = theVtx.
x()-referencePos.x();
268 double dy = theVtx.
y()-referencePos.y();
269 double px = totalP.x();
270 double py = totalP.y();
271 double angleXY = (dx*px+dy*py)/(
sqrt(dx*dx+dy*dy)*
sqrt(px*px+py*py));
275 double dz = theVtx.
z()-referencePos.z();
276 double pz = totalP.z();
277 double angleXYZ = (dx*px+dy*py+dz*pz)/(
sqrt(dx*dx+dy*dy+dz*dz)*
sqrt(px*px+py*py+pz*pz));
281 double piPlusE =
sqrt(positiveP.mag2() + piMassSquared);
282 double piMinusE =
sqrt(negativeP.mag2() + piMassSquared);
283 double protonE =
sqrt(positiveP.mag2() + protonMassSquared);
284 double antiProtonE =
sqrt(negativeP.mag2() + protonMassSquared);
285 double kShortETot = piPlusE + piMinusE;
286 double lambdaEtot = protonE + piMinusE;
287 double lambdaBarEtot = antiProtonE + piPlusE;
296 double vtxChi2(theVtx.
chi2());
297 double vtxNdof(theVtx.
ndof());
308 if (positiveP.mag2() > negativeP.mag2()) {
318 thePiPlusCand.
setTrack(positiveTrackRef);
322 thePiMinusCand.
setTrack(negativeTrackRef);
326 theProtonCand.
setTrack(positiveTrackRef);
330 theAntiProtonCand.
setTrack(negativeTrackRef);
335 theKshort->addDaughter(thePiPlusCand);
336 theKshort->addDaughter(thePiMinusCand);
337 theKshort->setPdgId(310);
338 addp4.
set(*theKshort);
340 theKshorts.push_back(std::move(*theKshort));
347 addp4.
set( *theLambda );
349 theLambdas.push_back(std::move(*theLambda));
355 addp4.
set(*theLambdaBar);
357 theLambdas.push_back(std::move(*theLambdaBar));
364 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
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
const FreeTrajectoryState & theState() const
double dxyError() const
error on dxy
edm::EDGetTokenT< std::vector< reco::Vertex > > token_vertices
double y() const
y coordinate
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const
std::vector< Track > TrackCollection
collection of Tracks
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_
const Point & position() const
position
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
virtual GlobalPoint crossingPoint() const
virtual double mass() const
mass
edm::EDGetTokenT< reco::TrackCollection > token_tracks
double pt() const
track transverse momentum
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const
math::XYZPoint Point
point in the space
Abs< T >::type abs(const T &t)
double chi2() const
chi-squares
double z() const
y coordinate
void fitAll(const edm::Event &iEvent, const edm::EventSetup &iSetup, reco::VertexCompositeCandidateCollection &k, reco::VertexCompositeCandidateCollection &l)
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
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
T const * product() const
virtual void setPdgId(int pdgId)
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
void setTrack(const reco::TrackRef &r)
set reference to track
virtual float distance() 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...
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual bool status() const
GlobalVector momentum() const