CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkOutAvgTimeCalculator Class Reference

#include <TrkOutAvgTimeCalculator.h>

+ Inheritance diagram for TrkOutAvgTimeCalculator:

Public Member Functions

 TrkOutAvgTimeCalculator (const TrkHotSelector &selector, double maxpull)
 
virtual ~TrkOutAvgTimeCalculator ()
 
virtual bool trackTime (const TrkRecoTrk &trk, double &time, double &timeerr, int &nHotsUsed) const
 
- Public Member Functions inherited from TrkTimeCalculator
 TrkTimeCalculator (const TrkHotSelector &selector)
 
virtual ~TrkTimeCalculator ()
 
virtual bool trackTime (const TrkRecoTrk &trk, double &time, double &timeerr, int &nHotsUsed) const =0
 
bool trackTime (const TrkRecoTrk &trk, double &time, double &timeerr) const
 

Additional Inherited Members

- Protected Member Functions inherited from TrkTimeCalculator
bool useHot (const TrkHitOnTrk &x) const
 

Detailed Description

Definition at line 27 of file TrkOutAvgTimeCalculator.h.

Constructor & Destructor Documentation

◆ TrkOutAvgTimeCalculator()

TrkOutAvgTimeCalculator::TrkOutAvgTimeCalculator ( const TrkHotSelector selector,
double  maxpull 
)

Definition at line 25 of file TrkOutAvgTimeCalculator.cxx.

25 :
26 TrkTimeCalculator(selector),_maxpull(maxpull)
27{}

◆ ~TrkOutAvgTimeCalculator()

TrkOutAvgTimeCalculator::~TrkOutAvgTimeCalculator ( )
virtual

Definition at line 29 of file TrkOutAvgTimeCalculator.cxx.

30{}

Member Function Documentation

◆ trackTime()

bool TrkOutAvgTimeCalculator::trackTime ( const TrkRecoTrk trk,
double &  time,
double &  timeerr,
int &  nHotsUsed 
) const
virtual

Implements TrkTimeCalculator.

Definition at line 33 of file TrkOutAvgTimeCalculator.cxx.

36{
37 const TrkHitList *hotlist = trk.hits();
38 std::vector<ws> l;
39 ws sum;
40 for(TrkHitList::hot_iterator i(hotlist->begin());i!=hotlist->end();++i){
41 double hottime,hottimeerr;
42 if(!useHot(*i) || !i->timeResid(hottime,hottimeerr)) continue;
43 hottime*=1e9; hottimeerr*=1e9;
44 ws x(hottime,double(1)/(hottimeerr*hottimeerr));
45 l.push_back(x);
46 sum +=x;
47 }
48 if (_maxpull>0 && sum.n()>2 && sum.isPhysical()) { // do pull based pruning
49 std::vector<ws>::iterator worst=l.end();
50 do {
51 worst=l.end(); double worstPull = _maxpull;
52 for(std::vector<ws>::iterator i=l.begin();i!=l.end();++i) {
53 ws u(sum); u-=*i;
54 if (!u.isPhysical()) {
55#ifdef MDCPATREC_WARNING
56 std::cout<<"ErrMsg(warning) rounding problem?" << std::endl;
57#endif
58 continue;
59 }
60 double p = fabs(u.pull( *i ));
61 if (p>worstPull) { worstPull = p; worst = i; }
62 }
63 if (worst!=l.end()) {
64 sum-=*worst; l.erase(worst);
65 }
66 } while (sum.isPhysical() && sum.n()>2 && worst!=l.end());
67 }
68 if (sum.isPhysical()) {
69 time = sum.mean()*1e-9 + trk.trackT0();;
70 timeerr = sum.sigma()*1e-9;
71 nHotsUsed = sum.n();
72 return true;
73 }
74 return false;
75}
Double_t x[10]
Double_t time
hot_iterator begin() const
Definition: TrkHitList.h:45
hot_iterator end() const
Definition: TrkHitList.h:46
TrkHitList * hits()
Definition: TrkRecoTrk.h:107
double trackT0() const
Definition: TrkRecoTrk.cxx:140
bool useHot(const TrkHitOnTrk &x) const

The documentation for this class was generated from the following files: