34 #include "fastjet/internal/TilingExtent.hh"
38 FASTJET_BEGIN_NAMESPACE
41 _determine_rapidity_extent(cs.
jets());
44 void TilingExtent::_determine_rapidity_extent(
const vector<PseudoJet> & particles) {
50 vector<double> counts(nbins, 0);
55 _minrap = numeric_limits<double>::max();
56 _maxrap = -numeric_limits<double>::max();
58 for (
unsigned i = 0; i < particles.size(); i++) {
60 if (particles[i].E() == abs(particles[i].pz()))
continue;
61 double rap = particles[i].rap();
62 if (rap < _minrap) _minrap = rap;
63 if (rap > _maxrap) _maxrap = rap;
68 if (ibin < 0) ibin = 0;
69 if (ibin >= nbins) ibin = nbins - 1;
74 double max_in_bin = 0;
75 for (ibin = 0; ibin < nbins; ibin++) {
76 if (max_in_bin < counts[ibin]) max_in_bin = counts[ibin];
87 const double allowed_max_fraction = 0.25;
89 const double min_multiplicity = 4;
91 double allowed_max_cumul = floor(max(max_in_bin * allowed_max_fraction, min_multiplicity));
93 if (allowed_max_cumul > max_in_bin) allowed_max_cumul = max_in_bin;
98 for (ibin = 0; ibin < nbins; ibin++) {
99 cumul_lo += counts[ibin];
100 if (cumul_lo >= allowed_max_cumul) {
101 double y = ibin-nrap;
102 if (y > _minrap) _minrap = y;
106 assert(ibin != nbins);
107 _cumul2 += cumul_lo*cumul_lo;
114 for (ibin = nbins-1; ibin >= 0; ibin--) {
115 cumul_hi += counts[ibin];
116 if (cumul_hi >= allowed_max_cumul) {
117 double y = ibin-nrap+1;
118 if (y < _maxrap) _maxrap = y;
128 assert(ibin_hi >= ibin_lo);
131 if (ibin_hi == ibin_lo) {
137 _cumul2 = pow(
double(cumul_lo + cumul_hi - counts[ibin_hi]), 2);
141 _cumul2 += cumul_hi*cumul_hi;
144 for (ibin = ibin_lo+1; ibin < ibin_hi; ibin++) {
145 _cumul2 += counts[ibin]*counts[ibin];
152 FASTJET_END_NAMESPACE
const std::vector< PseudoJet > & jets() const
allow the user to access the internally stored _jets() array, which contains both the initial particl...