28 double m0 = mother.m();
29 double m1 = daughter1.m();
30 double m2 = daughter2.m();
31 double m3 = daughter3.m();
32 double sumM2 = m0*m0 + m1*m1 + m2*m2 + m3*m3;
33 double tolerance = 1.0e-9;
38 std::cout <<
"Error: Daughters too heavy!" << std::endl;
40 " < m1+m2+m3: " << m1/
GeV + m2/
GeV + m3/
GeV << std::endl;
43 double m2_12max =
sqr(m0-m3);
44 double m2_12min =
sqr(m1+m2);
45 double m2_23max =
sqr(m0-m1);
46 double m2_23min =
sqr(m2+m3);
52 double m2_23max_12,m2_23min_12;
57 m2_12 = m2_12min + x1*(m2_12max-m2_12min);
59 m2_23 = m2_23min + x2*(m2_23max-m2_23min);
63 E2_12 = (m2_12 - m1*m1 + m2*m2)/(2.0*
sqrt(m2_12));
64 E3_12 = (m0*m0 - m2_12 - m3*m3)/(2.0*
sqrt(m2_12));
67 }
while ((m2_23 > m2_23max_12) || (m2_23 < m2_23min_12));
70 double m2_13 = sumM2 - m2_12 - m2_23;
73 double e1 = (m0*m0 + m1*m1 - m2_23)/(2.0*m0);
74 double e2 = (m0*m0 + m2*m2 - m2_13)/(2.0*m0);
75 double e3 = (m0*m0 + m3*m3 - m2_12)/(2.0*m0);
76 double p1 =
sqrt(e1*e1 - m1*m1);
77 double p2 =
sqrt(e2*e2 - m2*m2);
78 double p3 =
sqrt(e3*e3 - m3*m3);
81 double cos12 = (m1*m1 + m2*m2 + 2.0*e1*e2 - m2_12)/(2.0*p1*p2);
82 double cos13 = (m1*m1 + m3*m3 + 2.0*e1*e3 - m2_13)/(2.0*p1*p3);
83 double cos23 = (m2*m2 + m3*m3 + 2.0*e2*e3 - m2_23)/(2.0*p2*p3);
84 if (fabs(cos12) > 1.0)
std::cout <<
"Error: Undefined angle12!" << std::endl;
85 if (fabs(cos13) > 1.0)
std::cout <<
"Error: Undefined angle13!" << std::endl;
86 if (fabs(cos23) > 1.0)
std::cout <<
"Error: Undefined angle23!" << std::endl;
89 double xi = 2.0 *
pi * G4UniformRand();
95 double theta = acos(2.0 * G4UniformRand() - 1.0);
96 double phi = 2.0 *
pi * G4UniformRand();
97 double psi = 2.0 *
pi * G4UniformRand();
100 ROOT::Math::Rotation3D
rot(ang);
110 ROOT::Math::Boost cmboost(mmm.BoostToCM());
113 if (acos(cos12)+acos(cos13)+acos(cos23)-2.0*
pi > tolerance)
114 std::cout <<
"Error: Total angle not 2pi! " <<
115 acos(cos12)+acos(cos13)+acos(cos23)-2.0*
pi << std::endl;
116 if (fabs(daughter1_orig.px()+daughter2_orig.px()+daughter3_orig.px())/
GeV > tolerance)
117 std::cout <<
"Error: Total 3B Px not conserved! " <<
118 (daughter1_orig.px()+daughter2_orig.px()+daughter3_orig.px())/
GeV << std::endl;
119 if (fabs(daughter1_orig.py()+daughter2_orig.py()+daughter3_orig.py())/
GeV > tolerance)
120 std::cout <<
"Error: Total 3B Py not conserved! " <<
121 (daughter1_orig.py()+daughter2_orig.py()+daughter3_orig.py())/
GeV << std::endl;
122 if (fabs(daughter1_orig.pz()+daughter2_orig.pz()+daughter3_orig.pz())/
GeV > tolerance)
123 std::cout <<
"Error: Total 3B Pz not conserved! " <<
124 (daughter1.pz()+daughter2.pz()+daughter3.pz())/
GeV << std::endl;
132 daughter1.setPx(temp1.Px());
133 daughter1.setPy(temp1.Py());
134 daughter1.setPz(temp1.Pz());
135 daughter1.setE(temp1.e());
137 daughter2.setPx(temp2.Px());
138 daughter2.setPy(temp2.Py());
139 daughter2.setPz(temp2.Pz());
140 daughter2.setE(temp2.e());
142 daughter3.setPx(temp3.Px());
143 daughter3.setPy(temp3.Py());
144 daughter3.setPz(temp3.Pz());
145 daughter3.setE(temp3.e());
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
std::map< std::string, int, std::less< std::string > > psi
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
Cos< T >::type cos(const T &t)
AlgebraicVector EulerAngles