Privacy and Security Notice

tree.h Source File

tree.h

00001 #ifndef TREE_H
00002 #define TREE_H
00003 
00004 #include<iostream>
00005 
00006 
00007 #define DLAYERS 4               /* max number of detectors of same dir
00008                                    in either the front or the back */
00009 #define TLAYERS 8               /* max number of detectors combined
00010                                    for left-right ambiguity resolution */
00011 #define MAXHITPERLINE 100       /* maximum number of hits in 1 detector plane
00012                                    which will be considered to belong to the
00013                                    track, if several hits are near the line */
00014 #define HSHSIZ 511
00015 #define TREELINABORT 1000 
00016 
00017 class treenode;
00018 class shorttree;
00019 class nodenode;
00020 class shortnode;
00021 class treeregion;
00022 class tree;
00023 class Hit;
00024 class Det;
00025 class TreeLine;
00026 class PartTrack;
00027 class Track;
00028 class Bridge;
00029 class Vertex;
00030 class Event;
00031 class Options;
00032 
00033 //____________________________________________
00034 enum EUppLow    {               /* upper or lower part of the detector */
00035   w_nowhere = -1, w_upper, w_lower
00036 };
00037 enum ERegion {          /* detector region */
00038   r1=1, r2, r3
00039 };
00040 enum Etype      {               /* detector type */
00041   d_drift, d_gem, d_trigscint, d_cerenkov
00042 };
00043 enum Edir       {               /* chamber wire orientation */
00044   null_dir = 0,
00045   u_dir, v_dir, x_dir, y_dir
00046 };
00047 
00048 /*
00049 enum Eorientation{              // tracking orientation 
00050   o_one=1, o_two, o_three, o_four
00051 };
00052 */
00053 
00054 
00055 
00056 
00057 
00058 //____________________________________________
00065 class treenode{
00066 
00067 public:
00068 treenode *genlink;
00069 nodenode *son[4];
00070 int maxlevel,minlevel;
00071 int bits;
00072 int bit[TLAYERS];
00073 int xref;
00074 int pattern_offset;
00075 treenode();
00076 ~treenode();
00077 void print();
00078 
00079 
00080 private:
00081 
00082 };
00083 //____________________________________________
00090 class tree{
00091 
00092 public:
00093 //objects
00094 int maxlevel;                   /* maximum level of the bin division w/in 
00095                                     the treesearch database, i.e.:
00096                                     resolution = (detwidth)/(2^maxlevel)   */
00097 int tlayers;
00098 int hshsiz;
00099 int npat;
00100 treenode *generic[HSHSIZ];
00101 double zList[TLAYERS];
00102 double detwidth;
00103 double rcSET_rMaxSlope;//this needs to be defined by rcSET.rMaxSlope
00104 treenode father;
00105 int xref;
00106 int maxref;
00107 
00108 
00109 //functions
00110 tree();
00111 ~tree();
00112 void rcInitTree();
00113 int consistent(treenode *tst, int level,enum Etype type,enum ERegion region);
00114 treenode * existent(treenode *tst, int hash);
00115 treenode *nodeexists(nodenode *nd, treenode *tr);
00116 treenode * treedup(treenode *todup);
00117 void marklin(treenode *Father,int level,enum Etype type,enum ERegion region);
00118 
00119 void treeout(treenode *tn, int level, int off);
00120 void printtree(treenode *tn);
00121 void freetree();
00122 treeregion * readtree(char *filename, int levels, int tlayers, double rwidth, int dontread);
00123 long writetree(char *fn, treenode *tn, int levels, int tlayers, double width);
00124 treeregion * inittree(char *filename, int levels, int tlayer, double width,enum Etype type, enum ERegion region);
00125 treenode * _inittree(int tlayer,enum Etype type,enum ERegion region);//should be moved to private once inittree() is written
00126 private:
00127 
00128 int _writetree(treenode *tn, FILE *fp, int tlayers);
00129 int _readtree(FILE *f, shorttree *stb, shortnode **fath, int tlayers);
00130 };
00131 //____________________________________________
00141 class nodenode{
00142 
00143 public:
00144 nodenode();
00145 ~nodenode();
00146 nodenode *next;
00147 treenode *tree;
00148 
00149 private:
00150 
00151 };
00152 
00153 
00154 
00155 //____________________________________________
00157 class shortnode{
00158 
00159 public:
00160 shortnode();
00161 ~shortnode();
00162 shortnode *next;
00163 shorttree *tree;
00164 
00165 private:
00166 
00167 };
00168 //____________________________________________
00171 class shorttree{
00172 
00173 public:
00174 shorttree();
00175 ~shorttree();
00176 int maxlevel;
00177 int minlevel,bits;
00178 int xref;
00179 int bit[TLAYERS];
00180 shortnode *son[4];
00181 void print();
00182 
00183 private:
00184 
00185 };
00186 //____________________________________________
00198 class treeregion{
00199 
00200 public:
00201 treeregion();
00202 ~treeregion();
00203 int searchable;
00204 shortnode node;
00205 double rWidth;
00206 int nLayers;
00207 int dLayers;
00208 double rZPos[TLAYERS];
00209 
00210 private:
00211 
00212 };
00213 //____________________________________________
00221 class Hit{
00222 
00223 public:
00224 int wire;//wire ID
00225 double Zpos;//Z position of hit
00226 double rPos1;                   /* rPos1 and                         */
00227 double rPos2;                   /* rPos2 from level II decoding      */
00228 double Resolution;//resolution of this specific hit
00229 double rTrackResolution;//tracking road width around hit
00230 Det *detec;//which detector
00231 Hit *next, *nextdet;//next hit and next hit in same detector
00232 int ID;//event ID
00233 bool  used;             /* hit is used by a track            */
00234 double rResultPos;/* Resulting hit posisition          */
00235 double rPos;                    /* Position of from track finding    */
00236 
00237 private:
00238 
00239 
00240 };
00247 class Det{
00248 
00249 public:
00250 char cName[8];//Name of the chamber
00251 char cType[8];//Detector Type
00252 double Zpos;//Z position
00253 double Rot;//rotation angle
00254 double rRotCos,rRotSin; /* cos and sin of the rotation angle */
00255 double resolution;//resolution of the chamber
00256 double TrackResolution;//tracking resolution
00257 double SlopeMatching;//front/back track segment slope matching
00258 
00259 enum EUppLow upplow;
00260 enum ERegion region;
00261 enum Etype type;
00262 enum Edir dir;
00263 
00264 
00265 double center[2];//x and y position of detector center
00266 double width[3];//width in x and y
00267 double WireSpacing;
00268 double PosOfFirstWire;
00269 double rCos;
00270 double rSin;
00271 int NumOfWires;
00272 Hit *hitbydet;//hitlist
00273 Det *nextsame;//same wire orientation
00274 int samesearched;
00275 
00276 int  ID;                        /*Id representing a detector ID number.  This is needed to separate detectors when comparing hits.  */
00277 
00278 private:
00279 
00280 };
00281 //____________________________________________
00288 class TreeLine {                /* used for found tracks */
00289 
00290 public:
00291   TreeLine();
00292   ~TreeLine();
00293 
00294   bool isvoid;          /* has been found void */
00295   TreeLine *next;       /* link to next list element */
00296   double cx, mx, chi;           /* line parameters... */
00297   double cov_cxmx[3];           /* errors in these */
00298   int a_beg, a_end;             /* bin in tlayer 0 */
00299   int b_beg, b_end;             /* bin in tlayer tlaym1 */
00300   int   numhits;                /* number of hits */
00301   int   numvcmiss;              /* missing hits in vc */
00302   int   nummiss;                /* number of planes without hit */
00303   //enum  Emethod method;               /* treeline generation method  */
00304   Hit   *hits[2*TLAYERS];       /* hitarray */
00305   Hit   thehits[2*TLAYERS];
00306   int   hasharray[2*TLAYERS];
00307   bool Used;                    /* used (part of parttrack) */
00308   int   ID;                     /* adamo ID */
00309   int   r3offset,firstwire,lastwire;
00310 };
00311 //____________________________________________
00317 class PartTrack {
00318 
00319 public:
00320   double x,y;                   /* position at magnet_center */
00321   double mx,my;                 /* slope in x and y       */
00322   double Cov_Xv[4][4];          /* covariance matrix      */
00323   double chi;                   /* combined chi square    */
00324   TreeLine *tline[3];           /* tree line in u v and x */
00325   //Cluster  *cluster;          /* cluster pointed to by track */
00326   double  ECalor;               /* energy in this cluster */
00327   double  clProb;               /* prob. that this cluster belongs to track */
00328   double  pathlenoff;           /* pathlength offset */
00329   double  pathlenslo;           /* pathlength slope  */
00330   PartTrack *next;      /* linked list */
00331   Bridge *bridge;       /* magnetic field bridging */
00332   //enum Emethod method;                /* reconstruction method used */
00333   //struct _trdcollect *trdcol; /* trd information */
00334   int    Used;                  /* used (part of a Track)  */
00335   int    nummiss;               /* missing hits */
00336   int    numhits;               /* used hits */
00337   int    isvoid;                /* marked as being void    */
00338   int    ID;                    /* adamo Id */
00339   
00340   int    triggerhit;            /* Did this track pass through the trigger?*/
00341   double trig[2];               /* x-y position at trigger face */
00342   int cerenkovhit;              /* Did this track pass through the cerenkov bar? */
00343   double cerenkov[2];           /* x-y position at Cerenkov bar face */
00344 };
00345 //____________________________________________
00348 class Track
00349 {
00350 public:
00351   double ZVx,TVx;               /* Vertex posistion in Z and transverse */
00352   double The, Phi;              /* theta and phi of track */
00353   int    AngleCorr;             /* true if theta and phi are corrected for
00354                                    the holding field */
00355   double rDXSl;                 /* bending in the magnet (x direction) */
00356   double chi;                   /* combined chi square */
00357 
00358   double P, ECalor;             /* spect. and calorimeter Energy */
00359 
00360   double XBj, Y, Q2, W2, Nu;    /* kinematix */
00361 
00362   int    RecoEvent;             /* track from mcHits instead of digits */
00363 
00364   Bridge *bridge;               /* magnet matching information */
00365   int    iMagnetMatched;        /* number of magnet hits along track */
00366   int    yTracks;               /* number of y tracks */
00367   
00368   Track *next;          /* next track */
00369   Track *ynext;         /* link for y tracks */
00370   Track *usednext;      /* link of used tracks */
00371 
00372   PartTrack *front;             /* front partial track */
00373   PartTrack *back;              /* back partial track */
00374 
00375   
00376   Vertex    *vertex;            /* vertex of this track */
00377 
00378   //HodoscopeInfo H0;            /* H0        data associated with this track*/
00379   //HodoscopeInfo Hodoscope;     /* Hodoscope data associated with this track*/
00380   //HodoscopeInfo Preshower;     /* Preshower data associated with this track*/
00381   //CerenkovInfo  Cerenkov;      /* Cerenkov data associated with this track*/
00382 
00383   bool   Used;          /* used (part of usedTrack list) */
00384   bool   inBounds;              /* lookup table was usable */
00385   //enum Emethod method;                /* treesearch method in front track */
00386   
00387   //particleID PId;               /* PID info */
00388   int        iCharge;           /* charge of particle */
00389   
00390   int       ID;                 /* adamo ID */
00391 
00392 private:
00393 };
00394 //____________________________________________
00396 class Bridge
00397 {
00398 public:
00399   double xOff, yOff, ySOff;     /* Offset expected from lookup */
00400   double ySlopeMatch;           /* BENDING: slope match in Y   */
00401   double yMatch;                /* match in y */
00402   double ySMatch;               /* matching in Yslope */
00403   double xMatch;                /* match in x */
00404   double Momentum;              /* momentum  */
00405   Hit    *hits[9];              /* matching points in magnet */
00406   //pointList *point;
00407   int ID;
00408 private:
00409 };
00410 //____________________________________________
00412 class Vertex {
00413   double coord[3];              /* coordinates of vertex */
00414   double av[3][3];              /* error matrix */  
00415   double maxresidue;            /* max residue of tracks */
00416   int nTracks;                  /* number of tracks in vertex */
00417   //enum Emethod method;                /* Front Track Treesearch technique */
00418   struct Vertex *next;          /* chained list */
00419   int ID;                       /* adamo ID */
00420 };
00421 //____________________________________________
00424 class Event {
00425 public:
00426   int    ID;
00427   TreeLine  *treeline[2][3][4][4];/* [up/low][region][type][u/v/x/y] */
00428 // Cluster   *cluster[2];       /* [upper/lower] */
00429 //  Cluster   *lumicluster[2];  /* [right/left] */
00430   PartTrack *parttrack[2][3][4];/* [meth][upper/lower][forw/back] */
00431   Track     *track[2];          /* [upper/lower] */
00432   Track     *usedtrack[2];      /* applying chi^2 cuts to the above list */
00433   Vertex    *vertex;            /* all vertices */
00434   int       goodguess;          /* guessed right in electron PID */
00435   struct    _event *next;       /* next event */
00436 private:
00437 };
00438 //____________________________________________
00442 class Options {
00443 
00444 public:
00445 int levels[2][3][4];//pattern resolution
00446 int showEventPattern;
00447 int showMatchingPatterns;
00448 int showMatchedPattern;
00449 private:
00450 
00451 
00452 };
00453 
00454 #endif

Generated on Fri Jan 11 22:33:59 2008 by  doxygen 1.4.6