33 #include <Math/Functions.h>
34 #include <Math/SVector.h>
35 #include <Math/SMatrix.h>
80 std::vector<std::string> qual = theParameters.
getParameter<std::vector<std::string> >(
"trackQualities");
81 for (
unsigned int ndx = 0; ndx < qual.size(); ndx++) {
110 using namespace reco;
115 std::vector<TrackRef> theTrackRefs;
116 std::vector<TransientTrack> theTransTracks;
129 iEvent.
getByLabel(std::string(
"offlineBeamSpot"), theBeamSpotHandle);
130 if( !theTrackHandle->size() )
return;
139 for(
unsigned int indx = 0; indx < theTrackHandle->size(); indx++) {
140 TrackRef tmpRef( theTrackHandle, indx );
141 bool quality_ok =
true;
144 for (
unsigned int ndx_ = 0; ndx_ <
qualities.size(); ndx_++) {
151 if( !quality_ok )
continue;
154 if( tmpRef->normalizedChi2() <
tkChi2Cut &&
156 TransientTrack tmpTk( *tmpRef, &(*bFieldHandle), globTkGeomHandle );
164 theTrackRefs.push_back( tmpRef );
165 theTransTracks.push_back( tmpTk );
175 for(
unsigned int trdx1 = 0; trdx1 < theTrackRefs.size(); trdx1++) {
177 for(
unsigned int trdx2 = trdx1 + 1; trdx2 < theTrackRefs.size(); trdx2++) {
180 std::vector<TransientTrack> transTracks;
190 if(theTrackRefs[trdx1]->
charge() < 0. &&
191 theTrackRefs[trdx2]->charge() > 0.) {
192 negativeTrackRef = theTrackRefs[trdx1];
193 positiveTrackRef = theTrackRefs[trdx2];
194 negTransTkPtr = &theTransTracks[trdx1];
195 posTransTkPtr = &theTransTracks[trdx2];
197 else if(theTrackRefs[trdx1]->
charge() > 0. &&
198 theTrackRefs[trdx2]->charge() < 0.) {
199 negativeTrackRef = theTrackRefs[trdx2];
200 positiveTrackRef = theTrackRefs[trdx1];
201 negTransTkPtr = &theTransTracks[trdx2];
202 posTransTkPtr = &theTransTracks[trdx1];
209 transTracks.push_back(*posTransTkPtr);
210 transTracks.push_back(*negTransTkPtr);
221 if( !cApp.
status() )
continue;
222 float dca = fabs( cApp.
distance() );
225 if (dca < 0. || dca >
tkDCACut)
continue;
226 if (
sqrt( cxPt.x()*cxPt.x() + cxPt.y()*cxPt.y() ) > 120.
227 ||
std::abs(cxPt.z()) > 300.)
continue;
245 double totalESq = totalE*totalE;
248 double mass =
sqrt( totalESq - totalPSq);
256 if(
vtxFitter == std::string(
"KalmanVertexFitter")) {
258 theRecoVertex = theKalmanFitter.
vertex(transTracks);
260 else if (
vtxFitter == std::string(
"AdaptiveVertexFitter")) {
263 theRecoVertex = theAdaptiveFitter.
vertex(transTracks);
276 std::vector<TransientTrack> refittedTrax;
285 typedef ROOT::Math::SMatrix<double, 3, 3, ROOT::Math::MatRepSym<double, 3> > SMatrixSym3D;
286 typedef ROOT::Math::SVector<double, 3> SVector3;
290 GlobalPoint beamSpotPos(theBeamSpotHandle->position().x(),
291 theBeamSpotHandle->position().y(),
292 theBeamSpotHandle->position().z());
294 SMatrixSym3D totalCov = theBeamSpotHandle->covariance3D() + theVtx.
covariance();
295 SVector3 distanceVector(vtxPos.x() - beamSpotPos.x(),
296 vtxPos.y() - beamSpotPos.y(),
300 double rVtxMag = ROOT::Math::Mag(distanceVector);
301 double sigmaRvtxMag =
sqrt(ROOT::Math::Similarity(totalCov, distanceVector)) / rVtxMag;
308 double posTkHitPosD2 =
309 (posTkHitPos.x()-beamSpotPos.x())*(posTkHitPos.x()-beamSpotPos.x()) +
310 (posTkHitPos.y()-beamSpotPos.y())*(posTkHitPos.y()-beamSpotPos.y());
318 double negTkHitPosD2 =
319 (negTkHitPos.x()-beamSpotPos.x())*(negTkHitPos.x()-beamSpotPos.x()) +
320 (negTkHitPos.y()-beamSpotPos.y())*(negTkHitPos.y()-beamSpotPos.y());
340 std::vector<TransientTrack>::iterator traxIter = refittedTrax.begin(),
341 traxEnd = refittedTrax.end();
348 for( ; traxIter != traxEnd; ++traxIter) {
349 if( traxIter->track().charge() > 0. ) {
352 else if (traxIter->track().charge() < 0.) {
360 delete thePositiveRefTrack;
361 delete theNegativeRefTrack;
373 posTransTkPtr = negTransTkPtr = 0;
382 trajPlus = trajMins = 0;
390 double kShortETot = piPlusE + piMinusE;
391 double lambdaEtot = protonE + piMinusE;
392 double lambdaBarEtot = antiProtonE + piPlusE;
394 using namespace reco;
398 totalP.y(), totalP.z(),
401 totalP.y(), totalP.z(),
404 totalP.y(), totalP.z(),
409 double vtxChi2(theVtx.
chi2());
410 double vtxNdof(theVtx.
ndof());
421 if( positiveP.mag() > negativeP.mag() ) {
434 positiveP.y(), positiveP.z(),
436 thePiPlusCand.
setTrack(positiveTrackRef);
440 negativeP.y(), negativeP.z(),
442 thePiMinusCand.
setTrack(negativeTrackRef);
447 positiveP.y(), positiveP.z(),
449 theProtonCand.
setTrack(positiveTrackRef);
453 negativeP.y(), negativeP.z(),
455 theAntiProtonCand.
setTrack(negativeTrackRef);
462 theKshort->addDaughter(thePiPlusCand);
463 theKshort->addDaughter(thePiMinusCand);
464 theKshort->setPdgId(310);
465 addp4.
set( *theKshort );
473 theLambda->addDaughter(theProtonCand);
474 theLambda->addDaughter(thePiMinusCand);
475 theLambda->setPdgId(3122);
476 addp4.set( *theLambda );
483 theLambdaBar->addDaughter(theAntiProtonCand);
484 theLambdaBar->addDaughter(thePiPlusCand);
485 theLambdaBar->setPdgId(-3122);
486 addp4.set( *theLambdaBar );
493 if(theKshort)
delete theKshort;
494 if(theLambda)
delete theLambda;
495 if(theLambdaBar)
delete theLambdaBar;
496 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)
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
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)
virtual GlobalPoint crossingPoint() const
const reco::VertexCompositeCandidateCollection & getLambdas() const
double impactParameterSigCut
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
double chi2() const
chi-squares
double z() const
y coordinate
math::XYZPoint Point
point in the space
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< reco::TransientTrack > refittedTracks() const
std::vector< reco::TrackBase::TrackQuality > qualities
double x() const
x coordinate
double significance() const
static TrackQuality qualityByName(const std::string &name)
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
V0Fitter(const edm::ParameterSet &theParams, const edm::Event &iEvent, const edm::EventSetup &iSetup)
TrajectoryStateClosestToPoint trajectoryStateClosestToPoint(const GlobalPoint &point) const
reco::VertexCompositeCandidateCollection theKshorts
double findV0MassError(const GlobalPoint &vtxPos, std::vector< reco::TransientTrack > dauTracks)
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
virtual float distance() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual bool status() const
GlobalVector momentum() const