00001
00002
00003
00004
00005
00006
00008 #ifndef ALGFITTRACKCAM_H
00009 #define ALGFITTRACKCAM_H
00010
00011 #include "Algorithm/AlgBase.h"
00012 #include "CandFitTrackCam/CandFitTrackCamHandle.h"
00013 #include "RecoBase/CandStripHandle.h"
00014 #include "RecoBase/AlgReco.h"
00015 #include "RecoBase/AlgTrack.h"
00016 #include <vector>
00017 #include "Validity/VldContext.h"
00018 #include "DataUtil/PlaneOutline.h"
00019
00020 using std::vector;
00021
00022 class CandTrackHandle;
00023
00024 typedef struct{
00025 CandStripHandle* csh;
00026 }StripStruct;
00027
00028 typedef struct{
00029 double TPos;
00030 double ZPos;
00031 double PlaneView;
00032 double TPosError;
00033 }TrkDataStruct;
00034
00035 typedef struct{
00036 double x_k0;
00037 double x_k1;
00038 double x_k2;
00039 double x_k3;
00040 double x_k4;
00041 }FiltDataStruct;
00042
00043
00044 class AlgFitTrackCam : public AlgBase, public AlgReco, public AlgTrack
00045 {
00046
00047 public:
00048 AlgFitTrackCam();
00049 virtual ~AlgFitTrackCam();
00050
00051 virtual void RunAlg(AlgConfig &ac, CandHandle &ch, CandContext &cx);
00052
00053 void InitialFramework(const CandSliceHandle* slice, CandContext &cx);
00054 void RunTheFitter(CandFitTrackCamHandle &cth);
00055
00056 void StoreFilteredData(const int NewPlane);
00057 void FillGapsInTrack();
00058 bool FindTheStrips(CandFitTrackCamHandle &cth, bool MakeTheTrack);
00059 void GetFitData(int Plane1, int Plane2);
00060
00061 void ShowerStrips();
00062 void RemoveTrkHitsInShw();
00063 void ShowerSwim();
00064
00065 void GoBackwards();
00066 void GoForwards();
00067
00068 bool GetCombiPropagator(const int Plane, const int NewPlane, const bool GoForward);
00069 bool Swim(double* StateVector, double* Output, const int Plane, const int NewPlane, const bool GoForward,
00070 double* dS=0, double* Range=0, double* dE=0);
00071 bool Swim(double* StateVector, double* Output, const double zbeg, const int NewPlane, const bool GoForward,
00072 double* dS=0, double* Range=0, double* dE=0);
00073 bool Swim(double* StateVector, double* Output, const int Plane, const double zend, const bool GoForward,
00074 double* dS=0, double* Range=0, double* dE=0);
00075
00076 void GetInitialCovarianceMatrix(const bool FirstIteration);
00077 void GetNoiseMatrix(const int Plane, const int NewPlane);
00078 void ExtrapCovMatrix();
00079 void CalcKalmanGain(const int NewPlane);
00080 void UpdateStateVector(const int Plane, const int NewPlane, const bool GoForward);
00081 void UpdateCovMatrix();
00082 void MoveArrays();
00083 void CheckValues(double* Input, const int NewPlane);
00084
00085 void SetTrackProperties(CandFitTrackCamHandle &cth);
00086 void SetPropertiesFromFinderTrack(CandFitTrackCamHandle &cth);
00087 void TimingFit(CandFitTrackCamHandle &cth);
00088 void SetRangeAnddS(CandFitTrackCamHandle& cth);
00089
00090 void SpectrometerSwim(CandFitTrackCamHandle &cth);
00091 void CleanNDLists(CandFitTrackHandle &cth, CandContext &cx);
00092 bool NDPlaneIsActive(int plane, float u, float v, float projErr);
00093 void GenerateNDSpectStrips(const CandSliceHandle* slice, CandContext &cx);
00094 virtual void Trace(const char *c) const;
00095
00096 void ResetCovarianceMatrix();
00097 double NDStripBegTime(CandStripHandle* Strip, double U=0, double V=0);
00098
00099 double MajorityCurvature();
00100
00101 private:
00102 vector<StripStruct> SlcStripData[490];
00103 vector<StripStruct> InitTrkStripData[490];
00104
00105 vector<TrkDataStruct> TrkStripData[490];
00106
00107 vector<FiltDataStruct> FilteredData[490];
00108
00109 Int_t nbfield;
00110 Double_t bave;
00111 Bool_t EndofRange;
00112 Int_t EndofRangePlane;
00113 Bool_t LastIteration;
00114 double x_k4_biased;
00115 double eqp_biased;
00116 int UseGeoSwimmer;
00117 double x_k[5];
00118 double x_k_minus[5];
00119 double C_k[5][5];
00120 double C_k_minus[5][5];
00121 double C_k_intermediate[5][5];
00122 double F_k[5][5];
00123 double F_k_minus[5][5];
00124 double Q_k[5][5];
00125 double Q_k_minus[5][5];
00126 double K_k[5];
00127
00128 int H_k[5];
00129 int Identity[5][5];
00130
00131 double VtxCov[5];
00132 double EndCov[5];
00133
00134 int MaxPlane;
00135 int MinPlane;
00136
00137 double DeltaZ;
00138 double DeltaPlane;
00139
00140 VldContext* vldc;
00141 const CandTrackHandle* track;
00142
00143 bool debug;
00144
00145 bool ZIncreasesWithTime;
00146 bool PassTrack;
00147
00148 bool SaveData;
00149 bool SwimThroughShower;
00150
00151 int ShowerEntryPlane;
00152
00153 int NIter;
00154 int TotalNSwimFail;
00155
00156 int NumFinderStrips;
00157 double MeanTrackTime;
00158 PlaneOutline fPL;
00159
00160 double StripListTime;
00161
00162
00163 double Beta2InvCoeff;
00164 double InitMaxqp;
00165 double InitMaxqpfrac;
00166 double InputThresholdEndofRange;
00167 double LastIterationMaxqp;
00168 int AllowOldChargeFlipCheck;
00169
00170 ClassDef(AlgFitTrackCam,3)
00171 };
00172
00173 #endif // ALGFITTRACKCAM_H