CMS 3D CMS Logo

VirtualJetProducerHelper.h
Go to the documentation of this file.
1 #ifndef RecoJets_JetProducers_interface_VirtualJetProducerHelper_h
2 #define RecoJets_JetProducers_interface_VirtualJetProducerHelper_h
3 
4 #include <cmath>
5 #include <algorithm>
6 
7 namespace reco {
8 
9  namespace helper {
10 
11  namespace VirtualJetProducerHelper {
12 
13  // Area of intersection of two unit-radius disks with centers separated by r12.
14  inline double intersection(double r12) {
15  if (r12 == 0)
16  return M_PI;
17  if (r12 >= 2)
18  return 0;
19  return 2 * std::acos(0.5 * r12) - 0.5 * r12 * sqrt(std::max(0.0, 4 - r12 * r12));
20  }
21 
22  // Area of intersection of three unit-radius disks with centers separated by r12, r23, r13.
23  inline double intersection(double r12, double r23, double r13) {
24  if (r12 >= 2 || r23 >= 2 || r13 >= 2)
25  return 0;
26  const double r12_2 = r12 * r12;
27  const double r13_2 = r13 * r13;
28  const double temp = (r12_2 + r13_2 - r23 * r23);
29  const double T2 = std::max(0.0, 4 * r12_2 * r13_2 - temp * temp);
30  const double common = 0.5 * (intersection(r12) + intersection(r13) + intersection(r23) - M_PI + 0.5 * sqrt(T2));
31  return common;
32  }
33  inline double intersection(double r12, double r23, double r13, double a12, double a23, double a13) {
34  if (r12 >= 2 || r23 >= 2 || r13 >= 2)
35  return 0;
36  const double r12_2 = r12 * r12;
37  const double r13_2 = r13 * r13;
38  const double temp = (r12_2 + r13_2 - r23 * r23);
39  const double T2 = std::max(0.0, 4 * r12_2 * r13_2 - temp * temp);
40  const double common = 0.5 * (a12 + a13 + a23 - M_PI + 0.5 * sqrt(T2));
41  return common;
42  }
43 
44  } // namespace VirtualJetProducerHelper
45  } // namespace helper
46 } // namespace reco
47 #endif
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
helper
Definition: helper.py:1
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
reco::helper::VirtualJetProducerHelper::intersection
double intersection(double r12)
Definition: VirtualJetProducerHelper.h:14
trackingPlots.common
common
Definition: trackingPlots.py:206
common
Definition: common.py:1