File: BinnedStatistics.cc

package info (click to toggle)
herwig%2B%2B 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 27,128 kB
  • ctags: 24,739
  • sloc: cpp: 188,949; fortran: 23,193; sh: 11,365; python: 5,069; ansic: 3,539; makefile: 1,865; perl: 2
file content (43 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// -*- C++ -*-
//
// GeneralStatictis.cc is a part of Herwig++ - A multi-purpose Monte Carlo event generator
// Copyright (C) 2002-2012 The Herwig Collaboration
//
// Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the BinnedStatistics class.
//

#include "BinnedStatistics.h"

#include <boost/utility.hpp>
using boost::next;
using boost::prior;

using namespace Herwig;

BinnedStatistics::~BinnedStatistics() {}

void BinnedStatistics::put(PersistentOStream & os) const {
  os << statisticsMap << weightMap
     << selectorMap << lastPoint;
}

void BinnedStatistics::get(PersistentIStream & is) {
  is >> statisticsMap >> weightMap
     >> selectorMap >> lastPoint;
  lastStatistics = &(statisticsMap.upper_bound(lastPoint)->second);
}

void BinnedStatistics::initialize(unsigned int bins) {
  weightMap[1.] = 1.;
  selectorMap[1.] = make_pair(0.,1.);
  double step = 1./bins;
  for ( unsigned int i = 1; i <= bins; ++i ) {
    statisticsMap[i*step] = GeneralStatistics();
  }
}