00001
00002 #ifndef __GFGAMMA_H
00003 #define __GFGAMMA_H 1
00004
00005 #include <math.h>
00006 #include "GaudiKernel/MsgStream.h"
00007 #include "TkrRecon/GFparticle.h"
00008
00009
00010 class GFpair : public GFbase
00011
00012 {
00013 public:
00014
00015
00016 GFpair(double xene, enum SiCluster::view axis, double sigmaCut,
00017 double energy,int ist, const Ray& testRay,
00018 bool doit = true);
00019 ~GFpair() {
00020 delete _mGFbest;
00021 delete _mGFpair;
00022 }
00023
00024
00025 void flagAllHits(int iflag=1);
00026 void unFlagAllHits();
00027
00028 bool empty() const;
00029 bool accept() const;
00030 void clear();
00031 void writeOut(MsgStream& log) const;
00032
00033
00034
00035 GFtrack* getBest() const {return _mGFbest;}
00036 GFtrack* getPair() const {return _mGFpair;}
00037
00038 double weightSlope() const {return m_weightBest;}
00039 double errorSlope() const {return m_errorSlope;}
00040
00041 int numTogether() const {return m_together;}
00042 int numSplit() const {return m_split;}
00043 int numOne() const {return m_one;}
00044 int numSharedHits() const {return m_shared;}
00045 int numEmpty() const {return m_empty;}
00046
00047
00048 void draw(gui::DisplayRep& v);
00049
00050 protected:
00051
00052
00053 void ini();
00054
00055 void step(int kplane);
00056 void anastep(int kplane);
00057 void fit();
00058 bool end() const;
00059 void kill();
00060 void setAlive();
00061
00062 void contability(int kplane);
00063 void loadGFdata();
00064
00065
00066
00067 void setIniEnergy();
00068 void setDecideBest(bool decideBest) {m_decideBest = decideBest;}
00069 void setStatus(StatusPair newStatus);
00070
00071
00072 StatusPair status() const {return m_status;}
00073 void newStatus(int klayer);
00074 bool forceSplit(int klayer) const;
00075
00076
00077 void stepTogether(int kplane);
00078 void stepSplit(int kplane);
00079 void selfishStepSplit(int kplane);
00080
00081
00082 void decideBest();
00083 void swap();
00084
00085
00086 Vector doDirection(const GFtrack* _GFtrk1, const GFtrack* _GFtrk2,
00087 double& weight1, double& errorSlope);
00088 Vector doDirection(double& weight1);
00089 Vector doDirectionXene(double xene, double& weight1);
00090 double doEnergy(const GFtrack* _GFtrk1, const GFtrack* _GFtrk2);
00091
00092
00093 bool allowedShareHit(const GFtrack* _GFtrack) const;
00094 void removeWorseStep(GFtrack* _GFtrk1, GFtrack* _GFtrk2);
00095 void resizeSharedHits();
00096
00097 private:
00098
00099 friend class GFgamma;
00100
00101 double m_xEne;
00102 SiCluster::view m_axis;
00103
00104 StatusPair m_status;
00105 bool m_decideBest;
00106
00107
00108 double m_weightBest;
00109 double m_errorSlope;
00110
00111
00112 int m_together;
00113 int m_split;
00114 int m_one;
00115 int m_shared;
00116 int m_empty;
00117
00118 protected:
00119
00120
00121 GFtrack* _mGFbest;
00122 GFtrack* _mGFpair;
00123
00124 GFtrack* _mGFalive;
00125 };
00126
00127
00128 class GFgamma : public GFbase
00129
00130 {
00131 public:
00132
00133 GFgamma(double xene,
00134 double sigmaCut,
00135 double energy,
00136 int ist,
00137 const Ray& testRay);
00138 ~GFgamma() {
00139 delete _mXpair;
00140 delete _mYpair;
00141 }
00142
00143
00144 void flagAllHits(int iflag=1);
00145 void unFlagAllHits();
00146
00147 bool empty() const;
00148 bool accept() const;
00149 void clear();
00150 void writeOut(MsgStream& log) const;
00151
00152
00153
00154 bool conflictPattern() const {return m_conflictPattern;}
00155 bool fix() const {return m_fixTopology;}
00156 GFpair* getXpair() const {return _mXpair;}
00157 GFpair* getYpair() const {return _mYpair;}
00158 GFtrack* getBest(SiCluster::view axis) const {
00159 if (axis == SiCluster::X) return _mXpair->getBest();
00160 else return _mYpair->getBest();
00161 }
00162 GFtrack* getPair(SiCluster::view axis) const {
00163 if (axis == SiCluster::X) return _mXpair->getPair();
00164 else return _mYpair->getPair();
00165 }
00166 Point getFirstHit() const;
00167
00168 int numTogether() const {return m_together;}
00169 int numSplit() const {return m_split;}
00170 int numOne() const {return m_one;}
00171
00172
00173 bool veto() const;
00174 double Qbest();
00175 static bool accept(const GFdata&, const GFdata&);
00176
00177
00178 void draw(gui::DisplayRep& v);
00179
00180 protected:
00181
00182
00183 void ini();
00184
00185 void step(int kplane);
00186 void anastep(int kplane);
00187 void fit();
00188 bool end() const;
00189 void kill();
00190 void setAlive();
00191
00192 void contability(int kplane);
00193 void loadGFdata();
00194
00195
00196
00197 void construct();
00198 void setDecideBest(bool decideBest);
00199
00200
00201 StatusPair newStatus();
00202 void connectStep();
00203 void associateStep();
00204 void topologyStep();
00205 void associateStatus(StatusPair status);
00206
00207 void associateAnaStep();
00208 void associateAnaStep(GFtrack* _GFtrack1, GFtrack* _GFtrack2);
00209
00210
00211 void decideBest();
00212 void associateFit();
00213
00214
00215 static bool crossingTowers(const GFtrack* _Xtrk1, const GFtrack* _Ytrk1,
00216 const GFtrack* _Xtrk2, const GFtrack* _Ytrk2);
00217
00218 private:
00219
00220 double m_xEne;
00221
00222
00223
00224 bool m_connect;
00225 bool m_associate;
00226 bool m_patternSwap;
00227 bool m_fixTopology;
00228 bool m_decideBest;
00229
00230 bool m_conflictPattern;
00231 bool m_swapDone;
00232
00233
00234 StatusPair m_status;
00235
00236
00237 int m_together;
00238 int m_split;
00239 int m_one;
00240
00241 GFpair* _mXpair;
00242 GFpair* _mYpair;
00243 };
00244
00245 #endif
00246
00247
00248
00249