12 _Var(
const std::function<VarFunc_t>& fun)
13 : fFunc(fun), fID(fgNextID++)
38 const double va =
fA(sr);
39 const double vb =
fB(sr);
77 const double va =
fA(sr);
78 const double vb =
fB(sr);
79 const double vc =
fC(sr);
116 template<
class T> _Var<T>
118 const _Var<T>& b,
int nb,
double b0,
double b1)
125 template Var Var2D(
const Var&,
const Binning&,
const Var&,
const Binning&);
128 template Var Var2D(
const Var&,
int,
double,
double,
const Var&,
int,
double,
double);
132 template<
class T> _Var<T>
141 template<
class T> _Var<T>
143 const _Var<T>& b,
int nb,
double b0,
double b1,
144 const _Var<T>& c,
int nc,
double c0,
double c1)
152 template Var Var3D(
const Var&,
const Binning&,
const Var&,
const Binning&,
const Var&,
const Binning&);
155 template Var Var3D(
const Var&,
int,
double,
double,
const Var&,
int,
double,
double,
const Var&,
int,
double,
double);
156 template SpillVar Var3D(
const SpillVar&,
int,
double,
double,
const SpillVar&,
int,
double,
double,
const SpillVar&,
int,
double,
double);
178 template<
class T> _Var<T>
181 static std::map<std::pair<int, int>,
int> ids;
182 const std::pair<int, int> key(a.
ID(), b.
ID());
185 return _Var<T>([
a, b](
const T* sr){
return a(sr) * b(sr);},
189 const _Var<T> ret([a, b](
const T* sr){
return a(sr) * b(sr);});
196 template<
class T> _Var<T>
199 static std::map<std::pair<int, int>,
int> ids;
200 const std::pair<int, int> key(a.
ID(), b.
ID());
205 const double denom = b(sr);
207 return a(sr) / denom;
214 const _Var<T> ret([a, b](
const T* sr)
216 const double denom = b(sr);
218 return a(sr) / denom;
228 template<
class T> _Var<T>
231 static std::map<std::pair<int, int>,
int> ids;
232 const std::pair<int, int> key(a.
ID(), b.
ID());
235 return _Var<T>([
a, b](
const T* sr){
return a(sr) + b(sr);},
239 const _Var<T> ret([a, b](
const T* sr){
return a(sr) + b(sr);});
246 template<
class T> _Var<T>
249 static std::map<std::pair<int, int>,
int> ids;
250 const std::pair<int, int> key(a.
ID(), b.
ID());
253 return _Var<T>([
a, b](
const T* sr){
return a(sr) - b(sr);},
257 const _Var<T> ret([a, b](
const T* sr){
return a(sr) - b(sr);});
264 template class _Var<caf::SRSpillProxy>;
265 template class _Var<caf::SRSliceProxy>;
267 template<
class T>
int _Var<T>::fgNextID = 0;
Represent the binning of a Spectrum's x-axis.
int ID() const
Vars with the same definition will have the same ID.
double operator()(const T *sr) const
_Var< T > Var2D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb)
Variable formed from two input variables.
double operator()(const T *sr) const
process_name opflashCryoW ana
_Var< T > operator-(const _Var< T > &a, const _Var< T > &b)
caf::Proxy< caf::SRSlice > SRSliceProxy
_Var< caf::SRSliceProxy > Var
Representation of a variable to be retrieved from a caf::StandardRecord object.
_Var< T > Var3D(const _Var< T > &a, const Binning &binsa, const _Var< T > &b, const Binning &binsb, const _Var< T > &c, const Binning &binsc)
This is just like a Var2D, but useful for 3D Spectra.
Var Constant(double c)
Use to weight events up and down by some factor.
_Var< caf::SRSpillProxy > SpillVar
Equivalent of Var acting on caf::SRSpill.
EnsembleSpectrum operator*(const EnsembleRatio &lhs, const EnsembleSpectrum &rhs)
int FindBin(float x) const
EnsembleRatio operator/(const EnsembleSpectrum &lhs, const EnsembleSpectrum &rhs)
_Var< T > operator+(const _Var< T > &a, const _Var< T > &b)
Var Sqrt(const Var &v)
Use to take sqrt of a var.
then echo File list $list not found else cat $list while read file do echo $file sed s
_Var(const std::function< VarFunc_t > &fun)
std::function can wrap a real function, function object, or lambda
Var2DFunc(const _Var< T > &a, const Binning binsa, const _Var< T > &b, const Binning binsb)
Var Scaled(const Var &v, double s)
Use to rescale another variable.
Most useful for combining weights.
static Binning Simple(int n, double lo, double hi, const std::vector< std::string > &labels={})
Var3DFunc(const _Var< T > &a, const Binning binsa, const _Var< T > &b, const Binning binsb, const _Var< T > &c, const Binning binsc)