00001 #ifndef TREECOMBINE_H
00002 #define TREECOMBINE_H
00003
00004 #include <iostream>
00005 #include "tree.h"
00006 #include "treesort.h"
00007
00008 #define HASHSIZE 1024
00009 #define HASHMASK 1023
00010
00011 #define magnet_center 275.0 //PLACEHOLDER VALUE
00012
00013 #ifndef DLAYERS
00014 #define DLAYERS 10
00015 #endif
00016
00022 class chi_hash {
00023 public:
00024 chi_hash();
00025 double x, mx, cov[3], chi;
00026 double hit[DLAYERS];
00027 int hits;
00028 chi_hash *next;
00029 private:
00030 };
00031
00032
00033
00039 class treecombine{
00040
00041 public:
00042 treecombine();
00043 ~treecombine();
00044
00045 chi_hash *hasharr[HASHSIZE];
00046
00047 int chi_hashval( int n, Hit **hit );
00048 void chi_hashclear(void);
00049 void chi_hashinsert(Hit **hits, int n, double slope, double xshift, double cov[3],double chi);
00050 int chi_hashfind( Hit **hits, int n, double *slope, double *xshift, double cov[3],double *chi);
00051
00052 int bestx(double *xresult, double dist_cut, Hit *h, Hit **ha);
00053 int bestx(double *xresult,Hit *h,Hit *ha);
00054
00055
00056
00057 void mul_do(int i,int mul,int l,int *r,Hit *hx[DLAYERS][MAXHITPERLINE], Hit **ha);
00058 void weight_lsq(double *slope, double *xshift, double cov[3],double *chi,Hit **hits, int n);
00059 void weight_lsq_r3(double *slope, double *xshift, double cov[3],double *chi,Hit **hits, int n,double z1,int offset,int tlayers);
00060
00061 int selectx(double *xresult,double dist_cut,Det *detec, Hit *hitarray[], Hit **ha);
00062 int contains( double var, Hit **arr, int len);
00063 double detZPosition( Det *det, double x, double slope_x, double *xval );
00064
00065 int TlCheckForX(double x1, double x2, double dx1, double dx2,double z1, double dz,TreeLine *treefill,enum EUppLow up_low,enum ERegion region,enum Etype type,enum Edir wdir,int dlayer, int tlayer,int iteration,int stay_tuned);
00066
00067 int TlMatchHits(double x1,double x2,double z1, double dz,TreeLine *treefill,enum EUppLow up_low,enum ERegion region,enum Etype type,enum Edir dir,int tlayers);
00068
00069 int inAcceptance( enum EUppLow up_low,enum ERegion region,double cx, double mx,double cy, double my);
00070 void TlTreeLineSort(TreeLine *tl,enum EUppLow up_low,enum ERegion region,enum Etype type,enum Edir dir,unsigned long bins,int tlayer,int dlayer);
00071 int TcTreeLineCombine( TreeLine *wu, TreeLine *wv, TreeLine *wx,PartTrack *pt, int tlayer );
00072 int TcTreeLineCombine( TreeLine *wu, TreeLine *wv,PartTrack *pt, int tlayer );
00073 PartTrack *TlTreeCombine(TreeLine *uvl[2],long bins,enum EUppLow up_low,enum ERegion region,enum Etype type,int tlayer,int dlayer);
00074 void ResidualWrite( Event *event);
00075
00076 int r3_TrackFit( int Num, Hit **Hit, double *fit, double *cov, double *chi,double uv2xy[2][2]);
00077 int checkR3(PartTrack *pt,enum EUppLow up_low);
00078
00079
00080
00081
00082
00083
00084 private:
00085
00086
00087 };
00088
00089
00090 #endif