|
[Rivet-svn] rivet: Extended functionality to replace BinnedHistogram. Still ...Rivet Mercurial rivet at projects.hepforge.orgSat Oct 1 05:30:02 BST 2016
details: https://rivet.hepforge.org/hg/rivet/rev/4f28b57abe44 branches: changeset: 5546:4f28b57abe44 user: Leif Lönnblad <leif.lonnblad at thep.lu.se> date: Fri Sep 30 21:17:28 2016 +0200 description: Extended functionality to replace BinnedHistogram. Still not tested. diffs (truncated from 436 to 50 lines): --- a/include/Rivet/Tools/CentralityHistogram.hh Thu Sep 29 11:06:23 2016 +0200 +++ b/include/Rivet/Tools/CentralityHistogram.hh Fri Sep 30 21:17:28 2016 +0200 @@ -24,12 +24,16 @@ /// be responsible for calculating a centrality estimate for each /// event. CentralityHistogram() - : _currentHist(Histo1DPtr()), _overSamplingFactor(10), _weightsum(0.0) {} + : _currentHist(Histo1DPtr()), _currentCEst(-1.0), + _overSamplingFactor(10), _weightsum(0.0) { + _percentiles.insert(0.0); + _percentiles.insert(1.0); + } /// Set the centrality projection to be used. Note that this /// projection must have already been declared to Rivet. void setProjection(string pname) { - _centralityEstimatorName = pname; + _estimator = pname; } /// Return the class name. @@ -45,13 +49,8 @@ /// Note that (cmin=0, cmax=5), means the five percent LEAST /// central events. - void add(Histo1DPtr hist, double cmin, double cmax) { - _originalHists[make_pair(cmin, cmax)] = hist; - _percentiles.insert(0.0); - _percentiles.insert(cmin); - _percentiles.insert(cmax); - _percentiles.insert(100.0); - } + void add(Histo1DPtr hist, double cmin, double cmax, + double cestmin = -1.0, double cestmax = -1.0 ); /// Setup the CentralityHistogram for the given event. Must be /// called for every event before any fill. Optionally an explicit @@ -62,37 +61,37 @@ /// Fill the histogram that lies in the same region as @a bin with the value /// @a x of weight @a weight. void fill(double x, double weight = 1.0) { - _getHist()->fill(x, weight); + if ( _currentHist ) _currentHist->fill(x, weight); + for ( auto h : _ready ) + if ( h.second.inRange(_currentCEst) ) + h.second._hist->fill(x, weight); } /// Fill histo bin i with the given weight void fillBin(size_t i, double weight = 1.0) {
More information about the Rivet-svn mailing list |