CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
VirtualJetProducerHelper.cc
Go to the documentation of this file.
2 
3 #include <cmath>
4 #include <algorithm>
5 
7 {
8  if (r12 == 0) return M_PI;
9  if (r12 >= 2) return 0;
10  return 2 * acos(r12/2) - 0.5*r12*sqrt(std::max(0.0 , 4 - r12*r12));
11 }
12 
13 double reco::helper::VirtualJetProducerHelper::intersection(double r12, double r23, double r13)
14 {
15  if (r12 >= 2 || r23 >= 2 || r13 >= 2) return 0;
16  const double r12_2 = r12*r12;
17  const double r13_2 = r13*r13;
18  const double temp = (r12_2 + r13_2 - r23*r23);
19  const double T2 = std::max(0.0 , 4*r12_2*r13_2 - temp*temp);
20  const double common = 0.5*( intersection(r12) + intersection(r13) + intersection(r23) - M_PI + sqrt(T2)/2 );
21  return common;
22 }
23 
24 double reco::helper::VirtualJetProducerHelper::intersection(double r12, double r23, double r13, double a12, double a23, double a13)
25 {
26  if (r12 >= 2 || r23 >= 2 || r13 >= 2) return 0;
27  const double r12_2 = r12*r12;
28  const double r13_2 = r13*r13;
29  const double temp = (r12_2 + r13_2 - r23*r23);
30  const double T2 = std::max(0.0 , 4*r12_2*r13_2 - temp*temp);
31  const double common = 0.5*( a12 + a13 + a23 - M_PI + sqrt(T2)/2 );
32  return common;
33 }
34 
const T & max(const T &a, const T &b)
T sqrt(T t)
Definition: SSEVec.h:48
#define M_PI
Definition: BFit3D.cc:3