14 switch (parametrization) {
18 inv = 1.0/initialP4.mass();
19 for (
int i = 0;
i < 4;
i++) {
20 covariance(3,
i) *= inv;
22 covariance(3,3) *= inv;
26 inv = 1.0/initialP4.energy();
27 for (
int i = 0;
i < 4;
i++) {
28 covariance(3,
i) *= inv;
30 covariance(3,3) *= inv;
40 switch (parametrization) {
56 return sqrt(covariance(0,0));
59 return sqrt(covariance(0,0)) * (p4.P2());
63 return getResolE(parametrization,covariance,p4);
74 switch (parametrization) {
80 double pti2 = 1.0/(p4.Perp2());
81 return sqrt( ( covariance(0,0) * p4.Px()*p4.Px() +
82 covariance(1,1) * p4.Py()*p4.Py() +
83 2*covariance(0,1) * p4.Px()*p4.Py()) * pti2 );
91 double a =
sin(p4.Theta());
92 double b = p4.P() *
cos(p4.Theta());
93 return sqrt(a*a*covariance(0,0) + b*b*covariance(1,1) + 2*a*b*covariance(0,1));
100 double a = - (p*
p) *
sin(p4.Theta());
101 double b = p *
cos(p4.Theta());
102 return sqrt(a*a*covariance(0,0) + b*b*covariance(1,1) + 2*a*b*covariance(0,1));
107 return sqrt(covariance(0,0));
118 switch (parametrization) {
123 return 1.0/p4.P2() *
sqrt(covariance(0,0));
126 return sqrt(covariance(0,0));
133 return 1.0/p4.P2() *
getResolP(parametrization, covariance, p4);
144 switch (parametrization) {
149 return sqrt(covariance(0,0));
159 derivs[0] =
sin(p4.Theta()) *
cos(p4.Phi());
163 derivs[1] = p *
cos(p4.Theta()) *
cos(p4.Phi());
164 derivs[2] = p *
sin(p4.Theta()) * -
sin(p4.Phi());
172 double a =
cos(p4.Phi());
173 double b = - p4.Pt() *
sin(p4.Phi());
174 return sqrt(a*a*covariance(0,0) + 2*a*b*covariance(2,0) + b*b*covariance(2,2));
186 switch (parametrization) {
191 return sqrt(covariance(1,1));
201 derivs[0] =
sin(p4.Theta()) *
sin(p4.Phi());
205 derivs[1] = p *
cos(p4.Theta()) *
sin(p4.Phi());
206 derivs[2] = p *
sin(p4.Theta()) *
cos(p4.Phi());
214 double a =
sin(p4.Phi());
215 double b = p4.Pt() *
cos(p4.Phi());
216 return sqrt(a*a*covariance(0,0) + 2*a*b*covariance(2,0) + b*b*covariance(2,2));
228 switch (parametrization) {
233 return sqrt(covariance(2,2));
240 double a =
cos(p4.Theta());
241 double b = -p4.P() *
sin(p4.Theta());
242 return sqrt(a*a*covariance(0,0) + 2*a*b*covariance(1,0) + b*b*covariance(1,1));
248 double a = -p*p*
cos(p4.Theta());
249 double b = -p *
sin(p4.Theta());
250 return sqrt(a*a*covariance(0,0) + 2*a*b*covariance(1,0) + b*b*covariance(1,1));
256 double s =
sin(p4.Theta()),
c =
cos(p4.Theta());
258 double b = - p4.Pt() / (s*
s);
259 return sqrt(a*a*covariance(0,0) + 2*a*b*covariance(1,0) + b*b*covariance(1,1));
264 double a = sinh(p4.Eta());
265 double b = p4.Et() * cosh(p4.Eta());
266 return sqrt(a*a*covariance(0,0) + 2*a*b*covariance(1,0) + b*b*covariance(1,1));
279 switch (parametrization) {
283 return sqrt(covariance(3,3));
288 double a = 1.0/
sin(p4.Theta());
289 double b = - a*a* p4.Et() *
cos(p4.Theta());
290 return sqrt(a*a*covariance(0,0) + b*b*covariance(1,1) + 2*a*b*covariance(0,1));
295 double th = p4.Theta();
296 double a = 1.0/
sin(th);
297 double b = a* p4.Et() *
cos(th);
298 return sqrt(a*a*covariance(0,0) + b*b*covariance(1,1) + 2*a*b*covariance(0,1));
305 return sqrt(ROOT::Math::Similarity(xoE, covariance));
311 return sqrt(ROOT::Math::Similarity(xoE, covariance));
316 double einv = 1.0/p4.E();
317 double a = p4.P()*einv;
318 double b = p4.M()*einv;
319 return sqrt(a*a*covariance(0,0) + b*b*covariance(3,3) + 2*a*b*covariance(0,3));
324 return p4.P()/p4.E() *
sqrt(covariance(0,0));
330 return p*p*p/p4.E()*
sqrt(covariance(0,0));
343 switch (parametrization) {
348 double pt2 = p4.Perp2();
349 double pz2 = ROOT::Math::Square(p4.Pz()),
p2 = pt2 + pz2;
350 double e2OverP4 = ROOT::Math::Square(p4.E()/
p2);
352 derivs *= (1.0/p4.Et());
353 derivs[0] *= pz2 * e2OverP4;
354 derivs[1] *= pz2 * e2OverP4;
355 derivs[2] *= -pt2 * e2OverP4;
357 return sqrt(ROOT::Math::Similarity(derivs, covariance));
362 double st =
sin(p4.Theta()), ct =
cos(p4.Theta());
363 return sqrt( st*st * covariance(3,3) +
364 ROOT::Math::Square(ct*p4.E()) * covariance(1,1) +
365 2*st*ct*p4.E() * covariance(1,3)
371 return sqrt(covariance(0,0));
377 double pt2 = p4.Perp2();
378 double p2 = pt2 + ROOT::Math::Square(p4.Pz());
379 double e2 = p2 + p4.M2();
381 double et =
sqrt(e2 * s2);
384 derivs[0] *= (s2 + e2*pi2*(1.0 - pt2*
pi2) );
385 derivs[1] *= (s2 + e2*pi2*(1.0 - pt2*
pi2) );
386 derivs[2] *= (s2 - e2*pt2*pi2*
pi2);
389 return sqrt(ROOT::Math::Similarity(derivs, covariance));
392 return sqrt(ROOT::Math::Similarity(derivs, covariance));
398 double s =
sin(p4.Theta()),
c =
cos(p4.Theta());
401 return sqrt(ROOT::Math::Similarity(derivs, covariance));
406 double s =
sin(p4.Theta()),
c =
cos(p4.Theta());
408 double a = p4.P()* s /
e;
410 return sqrt(a*a*covariance(0,0) + b*b*covariance(1,1) + 2*a*b*covariance(0,1));
415 double s =
sin(p4.Theta()),
c =
cos(p4.Theta());
416 double p = p4.P(),
e = p4.E();
417 double a = ( - p * p * p /
e ) * s;
419 return sqrt(a*a*covariance(0,0) + b*b*covariance(1,1) + 2*a*b*covariance(0,1));
433 switch (parametrization) {
444 return sqrt(covariance(3,3));
448 double dMdE = p4.E()/p4.M(), dMdP = - p4.P()/p4.M();
449 return sqrt( dMdP*dMdP*covariance(0,0) +
450 2*dMdP*dMdE*covariance(0,3) +
451 dMdE*dMdE*covariance(3,3));
456 derivs *= 1.0/p4.M();
457 return sqrt(ROOT::Math::Similarity(derivs, covariance));
470 return -1.0/
sin(theta);
475 double e =
exp(-eta);
476 return -2.0/(e + 1.0/
e);
482 switch (parametrization) {
495 return sqrt(covariance(1,1));
505 switch (parametrization) {
511 double pt2 = p4.Perp2();
512 double p = p4.P(),
pi = 1.0/
p, pi3 =
pi*
pi*
pi;
513 double dacos = - p/
sqrt(pt2);
515 derivs[0] = -p4.Px() * p4.Pz() * dacos * pi3;
516 derivs[1] = -p4.Py() * p4.Pz() * dacos * pi3;
517 derivs[2] = pt2 * dacos * pi3;
525 return sqrt(covariance(1,1));
537 double pt2 = p4.Perp2();
538 switch (parametrization) {
542 return sqrt( ROOT::Math::Square(p4.Px()) * covariance(1,1) +
543 ROOT::Math::Square(p4.Py()) * covariance(0,0) +
544 -2*p4.Px()*p4.Py() * covariance(0,1)
552 return sqrt(covariance(2,2));
double getResolEt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double DetaDtheta(double theta)
double getResolPz(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPy(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolP(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPx(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPt(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolPhi(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
Sin< T >::type sin(const T &t)
double getResolM(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
void rescaleForKinFitter(const pat::CandKinResolution::Parametrization parametrization, AlgebraicSymMatrix44 &covariance, const math::XYZTLorentzVector &initialP4)
Geom::Theta< T > theta() const
double getResolPInv(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolE(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
parametrization
specify parametrization (see SWGuidePATKinematicResolutions for more details)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
ROOT::Math::SMatrix< double, 4, 4, ROOT::Math::MatRepSym< double, 4 > > AlgebraicSymMatrix44
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepSym< double, 3 > > AlgebraicSymMatrix33
Cos< T >::type cos(const T &t)
ROOT::Math::SVector< double, 3 > AlgebraicVector3
Abs< T >::type abs(const T &t)
double DthetaDeta(double eta)
math::XYZTLorentzVector LorentzVector
et
define resolution functions of each parameter
double getResolEta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
double getResolTheta(pat::CandKinResolution::Parametrization parametrization, const AlgebraicSymMatrix44 &covariance, const pat::CandKinResolution::LorentzVector &p4)
ROOT::Math::SVector< double, 4 > AlgebraicVector4