CMS 3D CMS Logo

PFTauTransverseImpactParameter.cc
Go to the documentation of this file.
2 #include "TMatrixT.h"
3 #include "TMatrixTSym.h"
4 #include "TVectorT.h"
5 using namespace reco;
6 
7 PFTauTransverseImpactParameter::PFTauTransverseImpactParameter(const Point& pca, double thedxy, double thedxy_error,
8  const Point& pca3d, double theip3d, double theip3d_error, const VertexRef& PV)
9  : pca_(pca),
10  dxy_(thedxy),
11  dxy_error_(thedxy_error),
12  pca3d_(pca3d),
13  ip3d_(theip3d),
14  ip3d_error_(theip3d_error),
15  PV_(PV),
16  hasSV_(false),
17  FlightLengthSig_(0.)
18 {}
19 
20 PFTauTransverseImpactParameter::PFTauTransverseImpactParameter(const Point& pca, double thedxy, double thedxy_error,
21  const Point& pca3d, double theip3d, double theip3d_error, const VertexRef& PV,
22  const Point& theFlightLength, double theFlightLengthSig, const VertexRef& SV)
23  : pca_(pca),
24  dxy_(thedxy),
25  dxy_error_(thedxy_error),
26  pca3d_(pca3d),
27  ip3d_(theip3d),
28  ip3d_error_(theip3d_error),
29  PV_(PV),
30  hasSV_(true),
31  FlightLength_(theFlightLength),
32  FlightLengthSig_(theFlightLengthSig),
33  SV_(SV)
34 {}
35 
37 {
38  return new PFTauTransverseImpactParameter(*this);
39 }
40 
42 {
43  if ( PV_.isNonnull() ) return PV_->position();
44  else return PFTauTransverseImpactParameter::Point(0.,0.,0.);
45 }
46 
48 {
49  CovMatrix cov;
50  for ( int i = 0; i < dimension; ++i ) {
51  for ( int j = 0; j < dimension; ++j ) {
52  cov(i,j) = PV_->covariance(i,j);
53  }
54  }
55  return cov;
56 }
57 
59 {
60  return FlightLength_;
61 }
62 
64  if ( hasSV_ ) {
65  //std::cout << "<PFTauTransverseImpactParameter::flightLengthSig>:" << std::endl;
66  //VertexDistance3D vtxdist;
67  //std::cout << "oldValue = " << vtxdist.distance(*PV_, *SV_).significance() << std::endl; // transforms using the jacobian then computes distance/uncertainty
68  //std::cout << "newValue = " << FlightLengthSig_ << std::endl;
69  return FlightLengthSig_;
70  }
71  return -9.9;
72 }
73 
75  if ( hasSV_ ) return SV_->position();
76  else return PFTauTransverseImpactParameter::Point(0.,0.,0.);
77 }
78 
80  CovMatrix cov;
81  if ( !hasSV_ ) return cov;
82  for ( int i = 0; i < dimension; ++i ) {
83  for ( int j = 0; j < dimension; ++j ) {
84  cov(i,j) = SV_->covariance(i,j);
85  }
86  }
87  return cov;
88 }
89 
91  CovMatrix cov;
92  const CovMatrix& sv = secondaryVertexCov();
93  const CovMatrix& pv = primaryVertexCov();
94  for ( int i = 0; i < dimension; ++i ) {
95  for ( int j = 0; j < dimension; ++j ) {
96  cov(i,j) = sv(i,j) + pv(i,j);
97  }
98  }
99  return cov;
100 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
PFTauTransverseImpactParameter * clone() const
def pv(vc)
Definition: MetAnalyzer.py:7
fixed size matrix