BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
TrkFunctors.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: TrkFunctors.h,v 1.2 2007/11/13 07:27:23 codeman Exp $
4//
5// Description:
6// general, simple tracking predicates
7//
8// All classes (or structs) here should inherit from either
9// unary_function< X, Z> or binary_function<X,Y,Z> and
10// provide Z operator()(const X&,const Y&) const.
11//
12// Environment:
13// Software developed for the BaBar Detector at the SLAC B-Factory.
14//
15// Author List:
16// Gerhard Raven
17//------------------------------------------------------------------------
18#ifndef TRKFUNCTORS_H
19#define TRKFUNCTORS_H
20#include <functional>
21
22#include "TrkBase/TrkHitOnTrk.h"
23#include "TrkBase/TrkErrCode.h"
25class TrkRep;
26
27namespace TrkBase { namespace Functors {
28
29
30
31 class cloneHot : public std::unary_function<TrkHitOnTrk,TrkHitOnTrk*> {
32 public:
33 cloneHot(TrkRep *parentRep, const TrkDifTraj* trkTraj=0) : _r(parentRep), _t(trkTraj) {}
34
36 { return h.clone(_r,_t); }
37 private:
38 TrkRep *_r;
39 const TrkDifTraj* _t;
40 };
41
42 template <class T> struct takeAddress : std::unary_function<T,T*> {
43 T* operator()(T& t) { return &t; }
44 };
45
46
47 // Functors which are only accessible by inheriting from TrkHitOnTrkUpdater
48 // FIXME: maybe these should live in the TrkHitOnTrkUpdater namespace instead???
49
50 class updateMeasurement : public std::unary_function<TrkHitOnTrk,TrkErrCode> {
51 public:
53 { return h.updateMeasurement(_t,_m); }
54 private:
55 // Only TrkHitOnTrkUpdater can create one of these...
56 friend class ::TrkHitOnTrkUpdater;
57 updateMeasurement(const TrkDifTraj* traj=0,bool maintainAmbiguity=false) : _t(traj), _m(maintainAmbiguity) {}
58 const TrkDifTraj *_t;
59 bool _m;
60 };
61
62 class setActive : public std::unary_function<TrkHitOnTrk,void> {
63 public:
65 { return h.setActive(_a); }
67 { return h->setActive(_a); }
68 private:
69 // Only TrkHitOnTrkUpdater can create one of these...
70 friend class ::TrkHitOnTrkUpdater;
71 setActive(bool active) : _a(active){}
72 bool _a;
73 };
74
75 class setParent : public std::unary_function<TrkHitOnTrk,void> {
76 public:
78 { return h.setParent(_p); }
79 private:
80 // Only TrkHitOnTrkUpdater can create one of these...
81 friend class ::TrkHitOnTrkUpdater;
82 setParent(TrkRep* parent) : _p(parent){}
83 TrkRep* _p;
84 };
85}}
86#endif
cloneHot(TrkRep *parentRep, const TrkDifTraj *trkTraj=0)
Definition: TrkFunctors.h:33
TrkHitOnTrk * operator()(const TrkHitOnTrk &h) const
Definition: TrkFunctors.h:35
TrkHitOnTrk * operator()(TrkHitOnTrk &h) const
Definition: TrkFunctors.h:64
TrkHitOnTrk * operator()(TrkHitOnTrk *&h) const
Definition: TrkFunctors.h:66
TrkHitOnTrk * operator()(TrkHitOnTrk &h) const
Definition: TrkFunctors.h:77
TrkErrCode operator()(TrkHitOnTrk &h) const
Definition: TrkFunctors.h:52
virtual TrkErrCode updateMeasurement(const TrkDifTraj *traj, bool maintainAmbiguity)=0
virtual TrkHitOnTrk * clone(TrkRep *parentRep, const TrkDifTraj *trkTraj=0) const =0
Definition: TrkRep.h:43
int t()
Definition: t.c:1