00001 #ifndef CHAINHELPER_H
00002 #define CHAINHELPER_H
00003
00004 #include <vector>
00005 #include "NueAna/ParticlePID/ParticleFinder/Chain.h"
00006 #include <map>
00007 #include "Conventions/Detector.h"
00008
00009 #include "TObject.h"
00010
00011 struct foundpath
00012 {
00013
00014 double start_t;
00015 double start_z;
00016 double end_t;
00017 double end_z;
00018 double energy;
00019 double muonlike;
00020 int entries;
00021 std::vector<int> path;
00022
00023 foundpath():start_t(0.0),start_z(0.0),end_t(0.0),end_z(0.0),energy(0.0),muonlike(0.0),entries(0){};
00024
00025 };
00026
00027
00028
00029 class ChainHelper :public TObject
00030 {
00031 public:
00032
00033 ChainHelper();
00034 ~ChainHelper();
00035
00036
00037 std::vector<Chain > working;
00038 std::vector<Chain > finished;
00039
00040 std::vector<Chain > particles;
00041
00042 int parents;
00043 int muonlikechains;
00044 int emlikechains;
00045 int totalchains;
00046
00047 void insert(double it, double iz, double ie, int my_cluster_id);
00048
00049 Chain * split(Chain * d);
00050
00051 Chain * SplitAt(Chain * c, double splitpointz);
00052
00053 Chain AttachAt(Chain *mother, Chain * daughter, double z);
00054
00055 void AdjustLevel(Chain * c, int level);
00056 void AttachAsChild(Chain * parent, Chain * child);
00057
00058 void Reset();
00059
00060
00061 void print_finished();
00062 void finish();
00063
00064 void SetDetector(Detector::Detector_t d){detector=d;};
00065
00066 void matchChains();
00067
00068
00069 std::vector<int> FindMaxPath();
00070 std::pair< std::vector<int>, double> FindMaxPath(Chain * c);
00071
00072
00073 int NewChain();
00074
00075 void ChangeHitId(int oldid, int newid);
00076
00077 std::vector<int> GetAllChildren(Chain *c);
00078
00079 void add_to_plane(double it, double iz, double ie, int cluster_id);
00080 void process_plane();
00081
00082 std::vector<double> pending_t;
00083 std::vector<double> pending_z;
00084 std::vector<double> pending_e;
00085 std::vector<int> pending_cluster_id;
00086
00087 Chain* GetChain(int id);
00088 void DeleteChain(int id);
00089
00090 double max_z_gap;
00091 double max_slope;
00092
00093 int found_max_path;
00094
00095 std::vector<int> maxpath;
00096
00097 void AddFinishedChain(Chain c);
00098
00099
00100 std::vector<foundpath> FindPaths(Chain*c);
00101
00102
00103 double vtx_z;
00104 double vtx_t;
00105
00106 private:
00107
00108
00109 std::map<int, int> idhelper;
00110
00111 Detector::Detector_t detector;
00112 ClassDef(ChainHelper,1);
00113
00114 };
00115
00116
00117 struct LTId
00118 {
00119 bool operator()(Chain a, Chain b)
00120 {
00121 return a.myId < b.myId;
00122 }
00123 };
00124
00125
00126
00127
00128 #endif
00129