Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:05:18

0001 #include "DataFormats/TauReco/interface/PFTauTransverseImpactParameter.h"
0002 #include "TMatrixT.h"
0003 #include "TMatrixTSym.h"
0004 #include "TVectorT.h"
0005 using namespace reco;
0006 
0007 PFTauTransverseImpactParameter::PFTauTransverseImpactParameter(const Point& pca,
0008                                                                double thedxy,
0009                                                                double thedxy_error,
0010                                                                const Point& pca3d,
0011                                                                double theip3d,
0012                                                                double theip3d_error,
0013                                                                const VertexRef& PV)
0014     : pca_(pca),
0015       dxy_(thedxy),
0016       dxy_error_(thedxy_error),
0017       pca3d_(pca3d),
0018       ip3d_(theip3d),
0019       ip3d_error_(theip3d_error),
0020       PV_(PV),
0021       hasSV_(false),
0022       FlightLengthSig_(0.) {}
0023 
0024 PFTauTransverseImpactParameter::PFTauTransverseImpactParameter(const Point& pca,
0025                                                                double thedxy,
0026                                                                double thedxy_error,
0027                                                                const Point& pca3d,
0028                                                                double theip3d,
0029                                                                double theip3d_error,
0030                                                                const VertexRef& PV,
0031                                                                const Point& theFlightLength,
0032                                                                double theFlightLengthSig,
0033                                                                const VertexRef& SV)
0034     : pca_(pca),
0035       dxy_(thedxy),
0036       dxy_error_(thedxy_error),
0037       pca3d_(pca3d),
0038       ip3d_(theip3d),
0039       ip3d_error_(theip3d_error),
0040       PV_(PV),
0041       hasSV_(true),
0042       FlightLength_(theFlightLength),
0043       FlightLengthSig_(theFlightLengthSig),
0044       SV_(SV) {}
0045 
0046 PFTauTransverseImpactParameter* PFTauTransverseImpactParameter::clone() const {
0047   return new PFTauTransverseImpactParameter(*this);
0048 }
0049 
0050 PFTauTransverseImpactParameter::Point PFTauTransverseImpactParameter::primaryVertexPos() const {
0051   if (PV_.isNonnull())
0052     return PV_->position();
0053   else
0054     return PFTauTransverseImpactParameter::Point(0., 0., 0.);
0055 }
0056 
0057 PFTauTransverseImpactParameter::CovMatrix PFTauTransverseImpactParameter::primaryVertexCov() const {
0058   CovMatrix cov;
0059   for (int i = 0; i < dimension; ++i) {
0060     for (int j = 0; j < dimension; ++j) {
0061       cov(i, j) = PV_->covariance(i, j);
0062     }
0063   }
0064   return cov;
0065 }
0066 
0067 const PFTauTransverseImpactParameter::Vector& PFTauTransverseImpactParameter::flightLength() const {
0068   return FlightLength_;
0069 }
0070 
0071 double PFTauTransverseImpactParameter::flightLengthSig() const {
0072   if (hasSV_) {
0073     //std::cout << "<PFTauTransverseImpactParameter::flightLengthSig>:" << std::endl;
0074     //VertexDistance3D vtxdist;
0075     //std::cout << "oldValue = " << vtxdist.distance(*PV_, *SV_).significance() << std::endl; // transforms using the jacobian then computes distance/uncertainty
0076     //std::cout << "newValue = " << FlightLengthSig_ << std::endl;
0077     return FlightLengthSig_;
0078   }
0079   return -9.9;
0080 }
0081 
0082 PFTauTransverseImpactParameter::Point PFTauTransverseImpactParameter::secondaryVertexPos() const {
0083   if (hasSV_)
0084     return SV_->position();
0085   else
0086     return PFTauTransverseImpactParameter::Point(0., 0., 0.);
0087 }
0088 
0089 PFTauTransverseImpactParameter::CovMatrix PFTauTransverseImpactParameter::secondaryVertexCov() const {
0090   CovMatrix cov;
0091   if (!hasSV_)
0092     return cov;
0093   for (int i = 0; i < dimension; ++i) {
0094     for (int j = 0; j < dimension; ++j) {
0095       cov(i, j) = SV_->covariance(i, j);
0096     }
0097   }
0098   return cov;
0099 }
0100 
0101 PFTauTransverseImpactParameter::CovMatrix PFTauTransverseImpactParameter::flightLengthCov() const {
0102   CovMatrix cov;
0103   const CovMatrix& sv = secondaryVertexCov();
0104   const CovMatrix& pv = primaryVertexCov();
0105   for (int i = 0; i < dimension; ++i) {
0106     for (int j = 0; j < dimension; ++j) {
0107       cov(i, j) = sv(i, j) + pv(i, j);
0108     }
0109   }
0110   return cov;
0111 }