ATLAS Offline Software
Static Public Member Functions | List of all members
CaloWeightInterpolator Struct Reference

calculates an interpolated weight in n dimensions More...

#include <CaloWeightInterpolator.h>

Collaboration diagram for CaloWeightInterpolator:

Static Public Member Functions

static double getWeight (std::vector< double > &w, std::vector< double > &x)
 

Detailed Description

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.

Member Function Documentation

◆ getWeight()

double CaloWeightInterpolator::getWeight ( std::vector< double > &  w,
std::vector< double > &  x 
)
static

Definition at line 26 of file CaloWeightInterpolator.cxx.

27  {
28  // check input
29  if ( w.size() > 1 ) {
30  if ( w.size() != (unsigned long)(1<<x.size()) ) {
31  std::cerr << "CaloWeightInterpolator::getWeight(): vectors have wrong dimension"
32  << std::endl;
33  return 0;
34  }
35  if ( x[0] < 0 || x[0] > 1 ) {
36  std::cerr << "CaloWeightInterpolator::getWeight(): coordinate " << x[0]
37  << " out of allowed range [0,1]"
38  << std::endl;
39  return 0;
40  }
41  std::vector<double> w1(w.size()>>1);
42  std::vector<double> x1(x.size()-1);
43  std::copy(x.begin()+1,x.end(),x1.begin());
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]);
46  }
47  return getWeight(w1,x1);
48  }
49  else return w[0];
50 }

The documentation for this struct was generated from the following files:
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
x
#define x
lumiFormat.i
int i
Definition: lumiFormat.py:85
calibdata.copy
bool copy
Definition: calibdata.py:27
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
CaloWeightInterpolator::getWeight
static double getWeight(std::vector< double > &w, std::vector< double > &x)
Definition: CaloWeightInterpolator.cxx:26