ATLAS Offline Software
Loading...
Searching...
No Matches
Calorimeter
CaloUtils
src
CaloWeightInterpolator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//-----------------------------------------------------------------------
6
// File and Version Information:
7
// $Id: CaloWeightInterpolator.cxx,v 1.9 2009-01-27 09:09:15 gunal Exp $
8
//
9
// Description: see CaloWeightInterpolator.h
10
//
11
// Environment:
12
// Software developed for the ATLAS Detector at CERN LHC
13
//
14
// Author List:
15
// Sven Menke
16
//
17
//-----------------------------------------------------------------------
18
19
//-----------------------
20
// This Struct's Header --
21
//-----------------------
22
#include "
CaloUtils/CaloWeightInterpolator.h
"
23
//#include "CaloWeightInterpolator.h"
24
#include <iostream>
25
26
double
CaloWeightInterpolator::getWeight
(std::vector<double> & w,
27
std::vector<double> &
x
) {
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
}
CaloWeightInterpolator.h
x
#define x
CaloWeightInterpolator::getWeight
static double getWeight(std::vector< double > &w, std::vector< double > &x)
Definition
CaloWeightInterpolator.cxx:26
Generated on
for ATLAS Offline Software by
1.14.0