#include <InvariantMassFromVertex.h>
Public Types | |
typedef ROOT::Math::PxPyPzMVector | LorentzVector |
Public Member Functions | |
Measurement1D | invariantMass (const CachingVertex< 5 > &vertex, const std::vector< double > &masses) const |
Measurement1D | invariantMass (const CachingVertex< 5 > &vertex, const double mass) const |
GlobalVector | momentum (const CachingVertex< 5 > &vertex) const |
LorentzVector | p4 (const CachingVertex< 5 > &vertex, const std::vector< double > &masses) const |
LorentzVector | p4 (const CachingVertex< 5 > &vertex, const double mass) const |
Private Types | |
typedef ReferenceCountingPointer < LinearizedTrackState< 5 > > | RefCountedLinearizedTrackState |
typedef ReferenceCountingPointer < RefittedTrackState< 5 > > | RefCountedRefittedTrackState |
typedef ReferenceCountingPointer < VertexTrack< 5 > > | RefCountedVertexTrack |
Private Member Functions | |
double | uncertainty (const LorentzVector &p4, const CachingVertex< 5 > &vertex, const std::vector< double > &masses) const |
Class building a resulting output tree out of the information provided by KinematicParticleVertexFitter.
Definition at line 20 of file InvariantMassFromVertex.h.
typedef ROOT::Math::PxPyPzMVector InvariantMassFromVertex::LorentzVector |
Definition at line 23 of file InvariantMassFromVertex.h.
typedef ReferenceCountingPointer<LinearizedTrackState<5> > InvariantMassFromVertex::RefCountedLinearizedTrackState [private] |
Definition at line 49 of file InvariantMassFromVertex.h.
typedef ReferenceCountingPointer<RefittedTrackState<5> > InvariantMassFromVertex::RefCountedRefittedTrackState [private] |
Definition at line 50 of file InvariantMassFromVertex.h.
typedef ReferenceCountingPointer<VertexTrack<5> > InvariantMassFromVertex::RefCountedVertexTrack [private] |
Definition at line 48 of file InvariantMassFromVertex.h.
Measurement1D InvariantMassFromVertex::invariantMass | ( | const CachingVertex< 5 > & | vertex, |
const std::vector< double > & | masses | ||
) | const |
Definition at line 71 of file InvariantMassFromVertex.cc.
References LogDebug, p4(), CachingVertex< N >::tkToTkCovarianceIsAvailable(), CachingVertex< N >::tracks(), and uncertainty().
Referenced by invariantMass().
{ // Check that tkToTkCovarianceIsAvailable if (!vertex.tkToTkCovarianceIsAvailable()) { LogDebug("InvariantMassFromVertex") << "Fit failed: vertex has not been smoothed\n"; return Measurement1D(0.,0.); } if (vertex.tracks().size() != masses.size()) { LogDebug("InvariantMassFromVertex") << "Vector of masses does not have the same size as tracks in vertex\n"; return Measurement1D(0.,0.); } LorentzVector totalP4 = p4(vertex, masses); double u = uncertainty(totalP4, vertex, masses); // std::cout << u<<std::endl; return Measurement1D(totalP4.M(), u ); }
Measurement1D InvariantMassFromVertex::invariantMass | ( | const CachingVertex< 5 > & | vertex, |
const double | mass | ||
) | const |
Definition at line 64 of file InvariantMassFromVertex.cc.
References invariantMass(), and CachingVertex< N >::tracks().
{ return invariantMass(vertex, std::vector<double>(vertex.tracks().size(), mass)); }
GlobalVector InvariantMassFromVertex::momentum | ( | const CachingVertex< 5 > & | vertex | ) | const |
Definition at line 42 of file InvariantMassFromVertex.cc.
References LogDebug, CachingVertex< N >::tkToTkCovarianceIsAvailable(), and CachingVertex< N >::tracks().
Referenced by p4().
{ GlobalVector momentum_; // Check that tkToTkCovarianceIsAvailable if (!vertex.tkToTkCovarianceIsAvailable()) { LogDebug("InvariantMassFromVertex") << "Fit failed: vertex has not been smoothed\n"; return momentum_; } std::vector<RefCountedVertexTrack> refTracks = vertex.tracks(); std::vector<RefCountedVertexTrack>::const_iterator i_s = refTracks.begin(); for( ;i_s !=refTracks.end() ; ++i_s) { momentum_ += (**i_s).refittedState()->freeTrajectoryState().momentum(); } return momentum_; }
InvariantMassFromVertex::LorentzVector InvariantMassFromVertex::p4 | ( | const CachingVertex< 5 > & | vertex, |
const double | mass | ||
) | const |
four-momentum Lorentz vector
Definition at line 5 of file InvariantMassFromVertex.cc.
References p4(), and CachingVertex< N >::tracks().
InvariantMassFromVertex::LorentzVector InvariantMassFromVertex::p4 | ( | const CachingVertex< 5 > & | vertex, |
const std::vector< double > & | masses | ||
) | const |
four-momentum Lorentz vector
Definition at line 11 of file InvariantMassFromVertex.cc.
References LogDebug, momentum(), CachingVertex< N >::tkToTkCovarianceIsAvailable(), CachingVertex< N >::tracks(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by invariantMass(), and p4().
{ LorentzVector totalP4; // Check that tkToTkCovarianceIsAvailable if (!vertex.tkToTkCovarianceIsAvailable()) { LogDebug("InvariantMassFromVertex") << "Fit failed: vertex has not been smoothed\n"; return totalP4; } if (vertex.tracks().size() != masses.size()) { LogDebug("InvariantMassFromVertex") << "Vector of masses does not have the same size as tracks in vertex\n"; return totalP4; } std::vector<RefCountedVertexTrack> refTracks = vertex.tracks(); std::vector<RefCountedVertexTrack>::const_iterator i_s = refTracks.begin(); std::vector<double>::const_iterator i_m = masses.begin(); for( ;i_s !=refTracks.end(), i_m != masses.end(); ++i_s, ++i_m) { GlobalVector momentum = (**i_s).refittedState()->freeTrajectoryState().momentum(); totalP4 += LorentzVector(momentum.x(), momentum.y(), momentum.z(), *i_m); } return totalP4; }
double InvariantMassFromVertex::uncertainty | ( | const LorentzVector & | p4, |
const CachingVertex< 5 > & | vertex, | ||
const std::vector< double > & | masses | ||
) | const [private] |
Definition at line 96 of file InvariantMassFromVertex.cc.
References a, funct::cos(), Exception, phi, CachingVertex< N >::position(), rho, funct::sin(), findQualityFiles::size, mathSSE::sqrt(), funct::tan(), theta(), CachingVertex< N >::tkToTkCovariance(), CachingVertex< N >::tracks(), and z.
Referenced by invariantMass().
{ std::vector<RefCountedVertexTrack> refTracks = vertex.tracks(); int size = refTracks.size(); AlgebraicMatrix cov(3*size,3*size); AlgebraicMatrix jac(1,3*size); double energy_total = totalP4.E(); std::vector<RefCountedVertexTrack>::const_iterator rt_i = refTracks.begin(); std::vector<double>::const_iterator i_m = masses.begin(); int i_int = 0; for( ;rt_i !=refTracks.end(), i_m != masses.end(); ++rt_i, ++i_m) { double a; AlgebraicVector5 param = (**rt_i).refittedState()->parameters(); // rho, theta, phi,tr_im, z_im double rho = param[0]; double theta = param[1]; double phi = param[2]; double mass = *i_m; if ((**rt_i).linearizedTrack()->charge()!=0) { a = -(**rt_i).refittedState()->freeTrajectoryState().parameters().magneticFieldInInverseGeV(vertex.position()).z() * (**rt_i).refittedState()->freeTrajectoryState().parameters ().charge(); if (a==0.) throw cms::Exception("InvariantMassFromVertex", "Field is 0"); } else { a = 1; } double energy_local = sqrt(a*a/(rho*rho)*(1+1/(tan(theta)*tan(theta))) + mass*mass); jac(1,i_int*3+1) = (-(energy_total/energy_local*a*a/(rho*rho*rho*sin(theta)*sin(theta)) ) + totalP4.X()*a/(rho*rho)*cos(phi) + totalP4.Y()*a/(rho*rho)*sin(phi) + totalP4.Z()*a/(rho*rho*tan(theta)) )/totalP4.M(); //dm / drho jac(1,i_int*3+2) = (-(energy_total/energy_local*a*a/(rho*rho*sin(theta)*sin(theta)*tan(theta)) ) + totalP4.Z()*a/(rho*sin(theta)*sin(theta)) )/totalP4.M();//dm d theta jac(1,i_int*3+3) = ( totalP4.X()*sin(phi) - totalP4.Y()*cos(phi) )*a/(rho*totalP4.M()); //dm/dphi // momentum corellatons: diagonal elements of the matrix cov.sub(i_int*3 + 1, i_int*3 + 1,asHepMatrix<6>((**rt_i).fullCovariance()).sub(4,6)); //off diagonal elements: track momentum - track momentum corellations int j_int = 0; for(std::vector<RefCountedVertexTrack>::const_iterator rt_j = refTracks.begin(); rt_j != refTracks.end(); rt_j++) { if(i_int < j_int) { AlgebraicMatrix i_k_cov_m = asHepMatrix<3,3>(vertex.tkToTkCovariance((*rt_i),(*rt_j))); cov.sub(i_int*3 + 1, j_int*3 + 1,i_k_cov_m); cov.sub(j_int*3 + 1, i_int*3 + 1,i_k_cov_m.T()); } j_int++; } i_int++; } // std::cout<<"jac"<<jac<<std::endl; // std::cout<<"cov"<<cov<<std::endl; // std::cout << "final result"<<(jac*cov*jac.T())<<std::endl; return sqrt((jac*cov*jac.T())(1,1)); }