CGEM BOSS
6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
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
27
class
TrkOutAvgTimeCalculator
:
public
TrkTimeCalculator
{
28
public
:
29
TrkOutAvgTimeCalculator
(
const
TrkHotSelector
& selector,
double
maxpull);
30
virtual
~TrkOutAvgTimeCalculator
();
31
// The Function
32
virtual
bool
trackTime
(
const
TrkRecoTrk
& trk,
33
double
&
time
,
double
& timeerr,
34
int
& nHotsUsed)
const
;
35
private
:
36
// disallow
37
TrkOutAvgTimeCalculator
(
const
TrkOutAvgTimeCalculator
&);
38
TrkOutAvgTimeCalculator
& operator = (
const
TrkOutAvgTimeCalculator
&);
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
x
Double_t x[10]
Definition
DataBase/tau_mode.c:57
time
Double_t time
Definition
DataBase/tau_mode.c:7
TrkTimeCalculator.h
TrkHotSelector
Definition
TrkHotSelector.h:24
TrkOutAvgTimeCalculator
Definition
TrkOutAvgTimeCalculator.h:27
TrkOutAvgTimeCalculator::TrkOutAvgTimeCalculator
TrkOutAvgTimeCalculator(const TrkHotSelector &selector, double maxpull)
Definition
TrkOutAvgTimeCalculator.cxx:25
TrkOutAvgTimeCalculator::trackTime
virtual bool trackTime(const TrkRecoTrk &trk, double &time, double &timeerr, int &nHotsUsed) const
Definition
TrkOutAvgTimeCalculator.cxx:33
TrkOutAvgTimeCalculator::~TrkOutAvgTimeCalculator
virtual ~TrkOutAvgTimeCalculator()
Definition
TrkOutAvgTimeCalculator.cxx:29
TrkRecoTrk
Definition
TrkRecoTrk.h:71
TrkTimeCalculator
Definition
TrkTimeCalculator.h:25
6.6.5.h
Reconstruction
MdcPatRec
TrkBase
TrkBase-00-01-12
TrkBase
TrkOutAvgTimeCalculator.h
Generated by
1.12.0