34#include "fastjet/internal/TilingExtent.hh"
38FASTJET_BEGIN_NAMESPACE
41 _determine_rapidity_extent(cs.
jets());
45 _determine_rapidity_extent(particles);
48void TilingExtent::_determine_rapidity_extent(
const vector<PseudoJet> & particles) {
54 vector<double> counts(nbins, 0);
59 _minrap = numeric_limits<double>::max();
60 _maxrap = -numeric_limits<double>::max();
62 for (
unsigned i = 0; i < particles.size(); i++) {
64 if (particles[i].E() == abs(particles[i].pz()))
continue;
65 double rap = particles[i].rap();
66 if (rap < _minrap) _minrap = rap;
67 if (rap > _maxrap) _maxrap = rap;
72 if (ibin < 0) ibin = 0;
73 if (ibin >= nbins) ibin = nbins - 1;
77 if (_minrap > _maxrap) {
91 for (
unsigned i = 0; i < particles.size(); i++) {
92 double rap = particles[i].pz() > 0 ? _maxrap : _minrap;
94 if (ibin < 0) ibin = 0;
95 if (ibin >= nbins) ibin = nbins - 1;
101 double max_in_bin = 0;
102 for (ibin = 0; ibin < nbins; ibin++) {
103 if (max_in_bin < counts[ibin]) max_in_bin = counts[ibin];
114 const double allowed_max_fraction = 0.25;
116 const double min_multiplicity = 4;
118 double allowed_max_cumul = floor(max(max_in_bin * allowed_max_fraction, min_multiplicity));
120 if (allowed_max_cumul > max_in_bin) allowed_max_cumul = max_in_bin;
125 for (ibin = 0; ibin < nbins; ibin++) {
126 cumul_lo += counts[ibin];
127 if (cumul_lo >= allowed_max_cumul) {
128 double y = ibin-nrap;
129 if (y > _minrap) _minrap = y;
133 assert(ibin != nbins);
134 _cumul2 += cumul_lo*cumul_lo;
141 for (ibin = nbins-1; ibin >= 0; ibin--) {
142 cumul_hi += counts[ibin];
143 if (cumul_hi >= allowed_max_cumul) {
144 double y = ibin-nrap+1;
145 if (y < _maxrap) _maxrap = y;
155 assert(ibin_hi >= ibin_lo);
158 if (ibin_hi == ibin_lo) {
164 _cumul2 = pow(
double(cumul_lo + cumul_hi - counts[ibin_hi]), 2);
168 _cumul2 += cumul_hi*cumul_hi;
171 for (ibin = ibin_lo+1; ibin < ibin_hi; ibin++) {
172 _cumul2 += counts[ibin]*counts[ibin];
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...
TilingExtent(ClusterSequence &cs)
constructor that takes a ClusterSequence in a state where the initial particles have been set up,...