calculates an interpolated weight in n dimensions
More...
#include <CaloWeightInterpolator.h>
|
static double | getWeight (std::vector< double > &w, std::vector< double > &x) |
|
calculates an interpolated weight in n dimensions
- Version
- $Id: CaloWeightInterpolator.h,v 1.0 2009-06-12 09:09:14 gunal Exp $
- Author
- Sven Menke menke.nosp@m.@mpp.nosp@m.mu.mp.nosp@m.g.de
- Date
- 12-June-2009 helper struct to interpolate the 2^n weights w in n-dimensions by 2^n-1 successive linear interpolations. The order of the vector w is by dimension - i.e. the first dimension changes in every element of w, the second every 2, the 3rd every 4, and so on. The vector x is supposed to carry the n relative positions within the current bin.
Definition at line 25 of file CaloWeightInterpolator.h.
◆ getWeight()
double CaloWeightInterpolator::getWeight |
( |
std::vector< double > & |
w, |
|
|
std::vector< double > & |
x |
|
) |
| |
|
static |
Definition at line 26 of file CaloWeightInterpolator.cxx.
30 if (
w.size() != (
unsigned long)(1<<
x.size()) ) {
31 std::cerr <<
"CaloWeightInterpolator::getWeight(): vectors have wrong dimension"
35 if (
x[0] < 0 ||
x[0] > 1 ) {
36 std::cerr <<
"CaloWeightInterpolator::getWeight(): coordinate " <<
x[0]
37 <<
" out of allowed range [0,1]"
41 std::vector<double> w1(
w.size()>>1);
42 std::vector<double>
x1(
x.size()-1);
44 for(
unsigned int i=0;
i<w1.size();
i++) {
45 w1[
i] =
w[2*
i]+
x[0]*(
w[2*
i+1]-
w[2*
i]);
The documentation for this struct was generated from the following files: