00001 #ifndef ANP_FILLKNN_H
00002 #define ANP_FILLKNN_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include <map>
00018 #include <iostream>
00019 #include <string>
00020 #include <vector>
00021
00022
00023 #include "PhysicsNtuple/AlgEvent.h"
00024 #include "PhysicsNtuple/AlgSnarl.h"
00025
00026
00027 #include "Node.h"
00028
00029 class TFile;
00030
00031 namespace Lit
00032 {
00033 class LikeModule;
00034 }
00035
00036 namespace Anp
00037 {
00038 class FillkNN : public AlgSnarl, public AlgEvent
00039 {
00040 public:
00041
00042 FillkNN();
00043 virtual ~FillkNN();
00044
00045 bool Run(Record &record);
00046
00047 bool Run(Event &event, const Record& record, bool pass);
00048
00049 void Config(const Registry ®);
00050
00051 bool Init(const Header &);
00052
00053 void End(const DataBlock &);
00054
00055 private:
00056
00057 typedef std::vector<short> ShortVec;
00058 typedef std::map<short, int> ShortMap;
00059
00060 private:
00061
00062 bool Fill(DataIter beg, DataIter end, double weight);
00063
00064 const DataVec Find(DataIter beg, DataIter end, short keybase) const;
00065
00066 double PidKer(Lit::List::const_iterator beg, Lit::List::const_iterator end) const;
00067
00068 const std::vector<float> Get(DataIter beg, DataIter end, const ShortVec &kvec) const;
00069
00070 double Kernel(const double value) const;
00071
00072 private:
00073
00074 mutable unsigned int fNAbortFind;
00075 unsigned int fNTrackMiss;
00076 unsigned int fNTrackFill;
00077 unsigned int fNEventMiss;
00078 unsigned int fNEventFill;
00079
00080 std::string fDirName;
00081 std::string fFilePath;
00082
00083 int fMaxNEvent;
00084 int fKeyBase;
00085 int fKeySignal;
00086 int fKeyTruth;
00087 int fTrimDelta;
00088
00089 unsigned int fKNeighbor;
00090 unsigned int fKNeighborMod;
00091
00092 bool fAddAll;
00093 bool fAddEvent;
00094 bool fCreateNew;
00095 bool fPrint;
00096 bool fRegression;
00097 bool fTrim;
00098 bool fUseKernel;
00099 bool fUseTrack;
00100
00101 Lit::LikeModule *fModule;
00102
00103 ShortVec fKeys;
00104 ShortVec fTgts;
00105 ShortVec fTypes;
00106 ShortMap fCount;
00107 };
00108 }
00109
00110 #endif