34 #include "fastjet/internal/TilingExtent.hh" 38 FASTJET_BEGIN_NAMESPACE
41 _determine_rapidity_extent(cs.
jets());
44 TilingExtent::TilingExtent(
const vector<PseudoJet> &particles) {
45 _determine_rapidity_extent(particles);
48 void 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;
78 double max_in_bin = 0;
79 for (ibin = 0; ibin < nbins; ibin++) {
80 if (max_in_bin < counts[ibin]) max_in_bin = counts[ibin];
91 const double allowed_max_fraction = 0.25;
93 const double min_multiplicity = 4;
95 double allowed_max_cumul = floor(max(max_in_bin * allowed_max_fraction, min_multiplicity));
97 if (allowed_max_cumul > max_in_bin) allowed_max_cumul = max_in_bin;
102 for (ibin = 0; ibin < nbins; ibin++) {
103 cumul_lo += counts[ibin];
104 if (cumul_lo >= allowed_max_cumul) {
105 double y = ibin-nrap;
106 if (y > _minrap) _minrap = y;
110 assert(ibin != nbins);
111 _cumul2 += cumul_lo*cumul_lo;
118 for (ibin = nbins-1; ibin >= 0; ibin--) {
119 cumul_hi += counts[ibin];
120 if (cumul_hi >= allowed_max_cumul) {
121 double y = ibin-nrap+1;
122 if (y < _maxrap) _maxrap = y;
132 assert(ibin_hi >= ibin_lo);
135 if (ibin_hi == ibin_lo) {
141 _cumul2 = pow(
double(cumul_lo + cumul_hi - counts[ibin_hi]), 2);
145 _cumul2 += cumul_hi*cumul_hi;
148 for (ibin = ibin_lo+1; ibin < ibin_hi; ibin++) {
149 _cumul2 += counts[ibin]*counts[ibin];
156 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...