/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/TrkBase/TrkBase-00-01-12/TrkBase/TrkFunctors.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: TrkFunctors.h,v 1.2 2007/11/13 07:27:23 codeman Exp $
00004 //
00005 // Description:
00006 //      general, simple tracking predicates
00007 //
00008 //      All classes (or structs) here should inherit from either
00009 //      unary_function< X, Z> or binary_function<X,Y,Z> and
00010 //      provide Z operator()(const X&,const Y&) const.
00011 //
00012 // Environment:
00013 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00014 //
00015 // Author List:
00016 //      Gerhard Raven
00017 //------------------------------------------------------------------------
00018 #ifndef TRKFUNCTORS_H
00019 #define TRKFUNCTORS_H
00020 #include <functional>
00021 
00022 #include "TrkBase/TrkHitOnTrk.h"
00023 #include "TrkBase/TrkErrCode.h"
00024 class TrkHitOnTrkUpdater;
00025 class TrkRep;
00026 
00027 namespace TrkBase { namespace Functors {
00028 
00029 
00030 
00031         class cloneHot : public std::unary_function<TrkHitOnTrk,TrkHitOnTrk*> {
00032         public:
00033                 cloneHot(TrkRep *parentRep, const TrkDifTraj* trkTraj=0) : _r(parentRep), _t(trkTraj) {}
00034 
00035                 TrkHitOnTrk *operator()(const TrkHitOnTrk& h) const 
00036                 { return h.clone(_r,_t); }
00037         private:
00038                 TrkRep *_r;
00039                 const TrkDifTraj* _t;
00040         };
00041 
00042         template <class T> struct takeAddress : std::unary_function<T,T*> {
00043                 T* operator()(T& t) { return &t; }
00044         };
00045 
00046 
00047         // Functors which are only accessible by inheriting from TrkHitOnTrkUpdater
00048         // FIXME: maybe these should live in the TrkHitOnTrkUpdater namespace instead???
00049 
00050         class updateMeasurement : public std::unary_function<TrkHitOnTrk,TrkErrCode> {
00051         public:
00052                 TrkErrCode operator()(TrkHitOnTrk& h) const
00053                 { return h.updateMeasurement(_t,_m); }
00054         private:
00055                 // Only TrkHitOnTrkUpdater can create one of these...
00056                 friend class ::TrkHitOnTrkUpdater;
00057                 updateMeasurement(const TrkDifTraj* traj=0,bool maintainAmbiguity=false) : _t(traj), _m(maintainAmbiguity) {}
00058                 const TrkDifTraj *_t;
00059                 bool _m;
00060         };
00061 
00062         class setActive : public std::unary_function<TrkHitOnTrk,void> {
00063         public:
00064                 TrkHitOnTrk* operator()(TrkHitOnTrk& h) const
00065                 { return h.setActive(_a); }
00066                 TrkHitOnTrk* operator()(TrkHitOnTrk*& h) const
00067                 { return h->setActive(_a); }
00068         private:
00069                 // Only TrkHitOnTrkUpdater can create one of these...
00070                 friend class ::TrkHitOnTrkUpdater;
00071                 setActive(bool active) : _a(active){}
00072                 bool _a;
00073         };
00074 
00075         class setParent : public std::unary_function<TrkHitOnTrk,void> {
00076         public:
00077                 TrkHitOnTrk* operator()(TrkHitOnTrk& h) const
00078                 { return h.setParent(_p); }
00079         private:
00080                 // Only TrkHitOnTrkUpdater can create one of these...
00081                 friend class ::TrkHitOnTrkUpdater;
00082                 setParent(TrkRep* parent) : _p(parent){}
00083                 TrkRep* _p;
00084         };
00085 }}
00086 #endif

Generated on Tue Nov 29 23:13:42 2016 for BOSS_7.0.2 by  doxygen 1.4.7