15 vector<pair<JetDistance, double> > popped_distances;
24 while (!_distances.empty()) {
27 if (JetsUnmerged(dist)) {
32 double weight =
exp(-_rigidity * (dist.
dij - dmin) / dmin);
33 popped_distances.push_back(make_pair(dist,
weight));
35 if (
weight / norm < _truncation_fctr)
40 double rand(Rand()), tot_weight(0.);
41 for (
vector<pair<JetDistance, double> >::iterator it = popped_distances.begin(); it != popped_distances.end(); it++) {
42 tot_weight += (*it).second / norm;
43 if (tot_weight >= rand) {
45 omega *= ((*it).second);
51 for (
vector<pair<JetDistance, double> >::reverse_iterator it = popped_distances.rbegin();
52 it != popped_distances.rend();
54 if (JetsUnmerged((*it).first))
55 _distances.push((*it).first);
66 ComputeAllDistances(
cs.jets());
69 while (!_distances.empty() && jd.dij != -1.) {
73 _merged_jets[jd.j1] =
true;
74 _merged_jets[jd.j2] =
true;
77 cs.plugin_record_ij_recombination(jd.j1, jd.j2, 1., new_jet);
78 if (!JetUnmerged(new_jet))
79 edm::LogError(
"QJets Clustering") <<
"Problem with FastJet::plugin_record_ij_recombination";
80 ComputeNewDistanceMeasures(
cs, new_jet);
82 double j1pt =
cs.jets()[jd.j1].perp();
83 double j2pt =
cs.jets()[jd.j2].perp();
86 _merged_jets[jd.j2] =
true;
87 cs.plugin_record_iB_recombination(jd.j2, 1.);
90 _merged_jets[jd.j1] =
true;
91 cs.plugin_record_iB_recombination(jd.j1, 1.);
94 jd = GetNextDistance();
98 cs.plugin_associate_extras(extras);
101 int num_merged_final(0);
102 for (
unsigned int i = 0;
i <
cs.jets().size();
i++)
103 if (JetUnmerged(
i)) {
105 cs.plugin_record_iB_recombination(
i, 1.);
108 if (!(num_merged_final < 2))
109 edm::LogError(
"QJets Clustering") <<
"More than 1 jet remains after reclustering";
114 fastjet::PseudoJet sum(0., 0., 0., 0.);
115 for (vector<fastjet::PseudoJet>::const_iterator it =
cs.jets().begin(); it !=
cs.jets().end(); it++)
117 _dcut = 2. * _dcut_fctr * sum.m() / sum.perp();
121 double pt1 =
cs.jets()[jd.
j1].perp();
122 double pt2 =
cs.jets()[jd.
j2].perp();
123 fastjet::PseudoJet sum_jet =
cs.jets()[jd.
j1] +
cs.jets()[jd.
j2];
124 double sum_pt = sum_jet.perp();
126 double d2 =
cs.jets()[jd.
j1].plain_distance(
cs.jets()[jd.
j2]);
127 return (d2 > _dcut * _dcut) && (z < _zcut);
131 for (
unsigned int i = 0;
i < inp.size() - 1;
i++) {
133 for (
unsigned int j =
i + 1;
j < inp.size();
j++) {
137 if (jd.
j1 != jd.
j2) {
138 jd.
dij = d_ij(inp[
i], inp[
j]);
147 for (
unsigned int i = 0;
i <
cs.jets().size();
i++)
148 if (JetUnmerged(
i) &&
i != new_jet) {
157 double Qjets::d_ij(
const fastjet::PseudoJet& v1,
const fastjet::PseudoJet& v2)
const {
158 double p1 = v1.perp();
159 double p2 = v2.perp();
172 ret = _rnEngine->flat();
void ComputeNewDistanceMeasures(fastjet::ClusterSequence &cs, unsigned int new_jet)
void Cluster(fastjet::ClusterSequence &cs)
bool JetsUnmerged(const JetDistance &jd) const
void SetRandSeed(unsigned int seed)
constexpr bool isNotFinite(T x)
ret
prodAgent to be discontinued
bool Prune(JetDistance &jd, fastjet::ClusterSequence &cs)
Log< level::Error, false > LogError
void computeDCut(fastjet::ClusterSequence &cs)
double d_ij(const fastjet::PseudoJet &v1, const fastjet::PseudoJet &v2) const
JetDistance GetNextDistance()
void ComputeAllDistances(const std::vector< fastjet::PseudoJet > &inp)
bool JetUnmerged(int num) const