30 #include <Math/Functions.h>
31 #include <Math/SVector.h>
32 #include <Math/SMatrix.h>
79 std::vector<std::string> qual = theParameters.
getParameter<std::vector<std::string> >(
"trackQualities");
80 for (
unsigned int ndx = 0; ndx < qual.size(); ndx++) {
108 using namespace reco;
116 std::vector<TrackRef> theTrackRefs;
117 std::vector<TransientTrack> theTransTracks;
131 if( !theTrackHandle->size() )
return;
140 for(
unsigned int indx = 0; indx < theTrackHandle->size(); indx++) {
141 TrackRef tmpRef( theTrackHandle, indx );
142 bool quality_ok =
true;
145 for (
unsigned int ndx_ = 0; ndx_ <
qualities.size(); ndx_++) {
152 if( !quality_ok )
continue;
155 if( tmpRef->normalizedChi2() <
tkChi2Cut &&
157 TransientTrack tmpTk( *tmpRef, &(*bFieldHandle), globTkGeomHandle );
165 theTrackRefs.push_back( tmpRef );
166 theTransTracks.push_back( tmpTk );
176 for(
unsigned int trdx1 = 0; trdx1 < theTrackRefs.size(); trdx1++) {
178 for(
unsigned int trdx2 = trdx1 + 1; trdx2 < theTrackRefs.size(); trdx2++) {
181 std::vector<TransientTrack> transTracks;
191 if(theTrackRefs[trdx1]->
charge() < 0. &&
192 theTrackRefs[trdx2]->charge() > 0.) {
193 negativeTrackRef = theTrackRefs[trdx1];
194 positiveTrackRef = theTrackRefs[trdx2];
195 negTransTkPtr = &theTransTracks[trdx1];
196 posTransTkPtr = &theTransTracks[trdx2];
198 else if(theTrackRefs[trdx1]->
charge() > 0. &&
199 theTrackRefs[trdx2]->charge() < 0.) {
200 negativeTrackRef = theTrackRefs[trdx2];
201 positiveTrackRef = theTrackRefs[trdx1];
202 negTransTkPtr = &theTransTracks[trdx2];
203 posTransTkPtr = &theTransTracks[trdx1];
210 transTracks.push_back(*posTransTkPtr);
211 transTracks.push_back(*negTransTkPtr);
220 ClosestApproachInRPhi cApp;
221 cApp.calculate(posState, negState);
222 if( !cApp.status() )
continue;
223 float dca = fabs( cApp.distance() );
226 if (dca < 0. || dca >
tkDCACut)
continue;
227 if (
sqrt( cxPt.x()*cxPt.x() + cxPt.y()*cxPt.y() ) > 120.
228 ||
std::abs(cxPt.z()) > 300.)
continue;
246 double totalESq = totalE*totalE;
249 double mass =
sqrt( totalESq - totalPSq);
259 theRecoVertex = theKalmanFitter.
vertex(transTracks);
264 theRecoVertex = theAdaptiveFitter.
vertex(transTracks);
277 std::vector<TransientTrack> refittedTrax;
286 typedef ROOT::Math::SMatrix<double, 3, 3, ROOT::Math::MatRepSym<double, 3> > SMatrixSym3D;
287 typedef ROOT::Math::SVector<double, 3> SVector3;
291 GlobalPoint beamSpotPos(theBeamSpotHandle->position().x(),
292 theBeamSpotHandle->position().y(),
293 theBeamSpotHandle->position().z());
295 SMatrixSym3D totalCov = theBeamSpotHandle->rotatedCovariance3D() + theVtx.
covariance();
296 SVector3 distanceVector(vtxPos.x() - beamSpotPos.x(),
297 vtxPos.y() - beamSpotPos.y(),
301 double rVtxMag = ROOT::Math::Mag(distanceVector);
302 double sigmaRvtxMag =
sqrt(ROOT::Math::Similarity(totalCov, distanceVector)) / rVtxMag;
309 double posTkHitPosD2 =
310 (posTkHitPos.x()-beamSpotPos.x())*(posTkHitPos.x()-beamSpotPos.x()) +
311 (posTkHitPos.y()-beamSpotPos.y())*(posTkHitPos.y()-beamSpotPos.y());
319 double negTkHitPosD2 =
320 (negTkHitPos.x()-beamSpotPos.x())*(negTkHitPos.x()-beamSpotPos.x()) +
321 (negTkHitPos.y()-beamSpotPos.y())*(negTkHitPos.y()-beamSpotPos.y());
336 std::auto_ptr<TrajectoryStateClosestToPoint> trajPlus;
337 std::auto_ptr<TrajectoryStateClosestToPoint> trajMins;
341 std::vector<TransientTrack>::iterator traxIter = refittedTrax.begin(),
342 traxEnd = refittedTrax.end();
349 for( ; traxIter != traxEnd; ++traxIter) {
350 if( traxIter->track().charge() > 0. ) {
351 thePositiveRefTrack = &*traxIter;
353 else if (traxIter->track().charge() < 0.) {
354 theNegativeRefTrack = &*traxIter;
357 if (thePositiveRefTrack == 0 || theNegativeRefTrack == 0)
continue;
367 if( trajPlus.get() == 0 || trajMins.get() == 0 || !trajPlus->isValid() || !trajMins->isValid() )
continue;
369 posTransTkPtr = negTransTkPtr = 0;
385 double kShortETot = piPlusE + piMinusE;
386 double lambdaEtot = protonE + piMinusE;
387 double lambdaBarEtot = antiProtonE + piPlusE;
389 using namespace reco;
393 totalP.y(), totalP.z(),
396 totalP.y(), totalP.z(),
399 totalP.y(), totalP.z(),
404 double vtxChi2(theVtx.
chi2());
405 double vtxNdof(theVtx.
ndof());
416 if( positiveP.mag() > negativeP.mag() ) {
429 positiveP.y(), positiveP.z(),
431 thePiPlusCand.
setTrack(positiveTrackRef);
435 negativeP.y(), negativeP.z(),
437 thePiMinusCand.
setTrack(negativeTrackRef);
442 positiveP.y(), positiveP.z(),
444 theProtonCand.
setTrack(positiveTrackRef);
448 negativeP.y(), negativeP.z(),
450 theAntiProtonCand.
setTrack(negativeTrackRef);
457 theKshort->addDaughter(thePiPlusCand);
458 theKshort->addDaughter(thePiMinusCand);
459 theKshort->setPdgId(310);
460 addp4.
set( *theKshort );
468 theLambda->addDaughter(theProtonCand);
469 theLambda->addDaughter(thePiMinusCand);
470 theLambda->setPdgId(3122);
471 addp4.set( *theLambda );
478 theLambdaBar->addDaughter(theAntiProtonCand);
479 theLambdaBar->addDaughter(thePiPlusCand);
480 theLambdaBar->setPdgId(-3122);
481 addp4.set( *theLambdaBar );
488 if(theKshort)
delete theKshort;
489 if(theLambda)
delete theLambda;
490 if(theLambdaBar)
delete theLambdaBar;
491 theKshort = theLambda = theLambdaBar = 0;
T getParameter(std::string const &) const
reco::VertexCompositeCandidateCollection theLambdas
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
Measurement1D transverseImpactParameter() const
void fitAll(const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
TrajectoryStateClosestToPoint impactPointTSCP() const
const FreeTrajectoryState & theState() const
double y() const
y coordinate
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const
float totalChiSquared() const
const MagneticField * magField
std::vector< Track > TrackCollection
collection of Tracks
const double piMassSquared
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
bool hasRefittedTracks() const
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
double findV0MassError(const GlobalPoint &vtxPos, const std::vector< reco::TransientTrack > &dauTracks)
const reco::VertexCompositeCandidateCollection & getLambdas() const
double impactParameterSigCut
edm::EDGetTokenT< reco::TrackCollection > token_tracks
const reco::VertexCompositeCandidateCollection & getKshorts() const
const double protonMassSquared
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
const TrackerGeometry * trackerGeom
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
math::XYZPoint Point
point in the space
V0Fitter(const edm::ParameterSet &theParams, edm::ConsumesCollector &&iC)
std::vector< reco::TrackBase::TrackQuality > qualities
double x() const
x coordinate
double significance() const
static TrackQuality qualityByName(const std::string &name)
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
reco::VertexCompositeCandidateCollection theKshorts
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.
void setTrack(const reco::TrackRef &r)
set reference to track
math::XYZTLorentzVector LorentzVector
Lorentz vector.
GlobalVector momentum() const