stablejet is hosted by Hepforge, IPPP Durham
StableJet
ClusteringComparison.cc
1 #include <cassert>
2 #include "ClusteringComparison.h"
3 
4 namespace stab {
5  double TransversePairwiseIndex::index(const PseudoJet* inputParticles,
6  const unsigned* clustering1,
7  const unsigned* clustering2,
8  const unsigned len) const
9  {
10  assert(inputParticles);
11  assert(clustering1);
12  assert(clustering2);
13  assert(len);
14 
15  long double c1 = 0.0L, c2 = 0.0L, c3 = 0.0L, c4 = 0.0L;
16 
17  for (unsigned i=1; i<len; ++i)
18  {
19  const double pt_i = inputParticles[i].pt();
20  const unsigned cl_i_1 = clustering1[i];
21  const unsigned cl_i_2 = clustering2[i];
22 
23  for (unsigned j=0; j<i; ++j)
24  {
25  const double weight = inputParticles[j].pt()*pt_i;
26  const bool same_in_1 = (cl_i_1 == clustering1[j]);
27  const bool same_in_2 = (cl_i_2 == clustering2[j]);
28 
29  if (same_in_1 && same_in_2)
30  c1 += weight;
31  else if (same_in_1 && !same_in_2)
32  c3 += weight;
33  else if (!same_in_1 && same_in_2)
34  c4 += weight;
35  else
36  c2 += weight;
37  }
38  }
39 
40  assert(c1 + c2 + c3 + c4 > 0.0L);
41  return combineCounts(c1, c2, c3, c4);
42  }
43 }