20#ifndef TRKOUTAVGTIMECALCULATOR_HH
21#define TRKOUTAVGTIMECALCULATOR_HH
33 double&
time,
double& timeerr,
34 int& nHotsUsed)
const;
44 ws(
double x=0,
double w=0):_w(
w),_wx(
w*
x),_n(
w>0?1:0) { assert(!(
w<0));}
45 ws& operator+=(
const ws&
x) { _wx +=
x._wx; _w+=
x._w; _n+=
x._n;
return *
this;}
46 ws& operator-=(
const ws&
x) { _wx -=
x._wx; _w-=
x._w; _n-=
x._n;
return *
this;}
47 bool operator==(
const ws&
x)
const {
return _w==
x._w && _wx==
x._wx && _n==
x._n;}
48 bool isPhysical()
const {
return _w>0;}
49 double mean()
const {
return _wx/_w;}
50 double sigma()
const {
return double(1)/sqrt(_w);}
51 double pull(
const ws&
x)
const {
return (mean()-
x.mean())/sqrt(sigma2()+
x.sigma2()); }
52 unsigned n()
const {
return _n;}
54 double sigma2()
const {
return double(1)/_w;}
TrkOutAvgTimeCalculator(const TrkHotSelector &selector, double maxpull)
virtual bool trackTime(const TrkRecoTrk &trk, double &time, double &timeerr, int &nHotsUsed) const
virtual ~TrkOutAvgTimeCalculator()