BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/TrkBase/TrkBase-00-01-12/TrkBase/TrkOutAvgTimeCalculator.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkOutAvgTimeCalculator.h,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $
4//
5// Description:
6// class TrkOutAvgTimeCalculater. A simple implementation of TrkTimeCalculator
7// that takes the weighted average of all selected hot's times assuming a
8// Gaussian error, but rejecting outliers based on their pull.
9//
10// Environment:
11// Software developed for the BaBar Detector at the SLAC B-Factory.
12//
13// Copyright Information:
14// Copyright (C) 2001 UC, San Diego
15//
16// Author List:
17// Gerhard Raven 7/19/01
18//------------------------------------------------------------------------
19
20#ifndef TRKOUTAVGTIMECALCULATOR_HH
21#define TRKOUTAVGTIMECALCULATOR_HH
22
23#include "TrkBase/TrkTimeCalculator.h"
24#include <assert.h>
25#include <math.h>
26
28public:
29 TrkOutAvgTimeCalculator(const TrkHotSelector& selector,double maxpull);
31// The Function
32 virtual bool trackTime(const TrkRecoTrk& trk,
33 double& time, double& timeerr,
34 int& nHotsUsed) const;
35private:
36// disallow
39
40 double _maxpull;
41
42 class ws {
43 public:
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;}
53 private:
54 double sigma2() const { return double(1)/_w;}
55 double _w,_wx;
56 unsigned _n;
57 };
58};
59#endif
GPStime & operator+=(GPStime &t, const double &dt)
const Int_t n
Double_t x[10]
Double_t time
bool operator==(const EventID &lhs, const EventID &rhs)
double w
TrkOutAvgTimeCalculator(const TrkHotSelector &selector, double maxpull)
virtual ~TrkOutAvgTimeCalculator()
virtual bool trackTime(const TrkRecoTrk &trk, double &time, double &timeerr, int &nHotsUsed) const