1 |
#ifndef Alignment_TwoBodyDecay_TwoBodyDecayUncertainty_h
|
2 |
#define Alignment_TwoBodyDecay_TwoBodyDecayUncertainty_h
|
3 |
|
4 |
#include <iomanip>
|
5 |
#include "Alignment/TwoBodyDecay/interface/TwoBodyDecay.h"
|
6 |
#include "Alignment/TwoBodyDecay/interface/TwoBodyDecayParameters.h"
|
7 |
|
8 |
class TwoBodyDecayUncertainty
|
9 |
{
|
10 |
public:
|
11 |
|
12 |
enum ParameterName { X = 0, Y = 1, Z = 2, PX = 3, PY = 4, PZ = 5, THETA = 6, PHI = 7, MASS = 8 };
|
13 |
|
14 |
TwoBodyDecayUncertainty(const TwoBodyDecay& info, const double & mass):
|
15 |
m_(mass), parameters_(info.parameters()), covariance_(info.covariance()) {init();}
|
16 |
|
17 |
std::pair<AlgebraicVector, AlgebraicVector> cartesianSecondaryMomenta()
|
18 |
{ AlgebraicVector a(3); a[0]=plusPx(); a[1]=plusPy(); a[2]=plusPz();
|
19 |
AlgebraicVector b(3); b[0]=minusPx(); b[1]=minusPy(); b[2]=minusPz();
|
20 |
return std::make_pair(a, b);
|
21 |
}
|
22 |
|
23 |
std::pair<double,double> errorSecondaryMomentaP();
|
24 |
std::pair<double,double> errorSecondaryMomentaPT();
|
25 |
|
26 |
std::pair<double,double> errorSecondaryMomentaPx()
|
27 |
{ return errorSecondaryMomentaComponent(1); }
|
28 |
std::pair<double,double> errorSecondaryMomentaPy()
|
29 |
{ return errorSecondaryMomentaComponent(2); }
|
30 |
std::pair<double,double> errorSecondaryMomentaPz()
|
31 |
{ return errorSecondaryMomentaComponent(3); }
|
32 |
|
33 |
std::pair<double,double> errorSecondaryMomentaComponent(unsigned char k)
|
34 |
{
|
35 |
double p = 0;
|
36 |
double m = 0;
|
37 |
for (unsigned int i=0;i<9;i++)
|
38 |
for (unsigned int j=0;j<9;j++)
|
39 |
{
|
40 |
p += (finalPlusP_[i])[k][0] *(finalPlusP_[j])[k][0] *covariance_[i][j];
|
41 |
m += (finalMinusP_[i])[k][0]*(finalMinusP_[j])[k][0]*covariance_[i][j];
|
42 |
}
|
43 |
return std::make_pair(p,m);
|
44 |
}
|
45 |
|
46 |
double plusPx() const {return finalPlus_[1][0];}
|
47 |
double plusPy() const {return finalPlus_[2][0];}
|
48 |
double plusPz() const {return finalPlus_[3][0];}
|
49 |
double plusP() const {return sqrt(plusPx()*plusPx()+plusPy()*plusPy()+plusPz()*plusPz()); }
|
50 |
|
51 |
double minusPx() const {return finalMinus_[1][0];}
|
52 |
double minusPy() const {return finalMinus_[2][0];}
|
53 |
double minusPz() const {return finalMinus_[3][0];}
|
54 |
double minusP() const {return sqrt(minusPx()*minusPx()+minusPy()*minusPy()+minusPz()*minusPz()); }
|
55 |
|
56 |
|
57 |
|
58 |
private:
|
59 |
double m_;
|
60 |
AlgebraicVector parameters_;
|
61 |
AlgebraicSymMatrix covariance_;
|
62 |
double pT2_;
|
63 |
double p2_;
|
64 |
double pT_;
|
65 |
double p_;
|
66 |
|
67 |
AlgebraicMatrix rotationA_;
|
68 |
AlgebraicMatrix rotationB_;
|
69 |
AlgebraicMatrix rotation_;
|
70 |
AlgebraicMatrix lorentz_;
|
71 |
std::vector<AlgebraicMatrix> rotationAp_;
|
72 |
std::vector<AlgebraicMatrix> rotationBp_;
|
73 |
std::vector<AlgebraicMatrix> rotationp_;
|
74 |
std::vector<AlgebraicMatrix> lorentzP_;
|
75 |
|
76 |
AlgebraicMatrix momentumPlus_;
|
77 |
AlgebraicMatrix momentumMinus_;
|
78 |
std::vector<AlgebraicMatrix> momentumPlusP_;
|
79 |
std::vector<AlgebraicMatrix> momentumMinusP_;
|
80 |
|
81 |
AlgebraicMatrix finalPlus_;
|
82 |
AlgebraicMatrix finalMinus_;
|
83 |
std::vector<AlgebraicMatrix> finalPlusP_;
|
84 |
std::vector<AlgebraicMatrix> finalMinusP_;
|
85 |
|
86 |
|
87 |
void init();
|
88 |
void RotationMatrixA();
|
89 |
void RotationMatrixB();
|
90 |
void Momentum();
|
91 |
void LorentzMatrix();
|
92 |
|
93 |
void displayMatrix(const std::string& name, const AlgebraicMatrix& mat)
|
94 |
{
|
95 |
std::cout << "Matrix called '" << name << "'"<<std::endl;
|
96 |
for (int i=0;i<mat.num_row();i++)
|
97 |
{
|
98 |
for (int j=0;j<mat.num_col();j++)
|
99 |
{
|
100 |
std::cout.width(13);
|
101 |
std::cout << mat[i][j];
|
102 |
}
|
103 |
std::cout<<std::endl;
|
104 |
}
|
105 |
}
|
106 |
|
107 |
};
|
108 |
|
109 |
#endif
|