00001 //////////////////////////////////////////////////////////////////////// 00002 // $Id: AlignBC.h,v 1.1 2006/09/25 14:26:09 lebedev Exp $ 00003 // 00004 // lebedev@physics.harvard.edu 00005 //////////////////////////////////////////////////////////////////////// 00006 00007 #ifndef TRK_ALIGN_BC 00008 #define TRK_ALIGN_BC 00009 00010 #include "JobControl/JobCModuleFactory.h" 00011 #include "Geometry/GChamGeo.h" 00012 #include <TObject.h> 00013 #include <string> 00014 #include <vector> 00015 00016 //...................................................................... 00017 class BCAlignNt : public TObject { 00018 public: 00019 BCAlignNt() {;} 00020 00021 int nclust; 00022 float chi2; 00023 float par[4]; 00024 float u[3][4]; 00025 float ufit[3][4]; 00026 float uperp[3][4]; 00027 float z1, z2; 00028 float chi2rm[3][4]; 00029 float resid[3][4]; 00030 00031 ClassDef(BCAlignNt, 1); // Ntuple for BC alignment summary 00032 }; 00033 00034 //...................................................................... 00035 /// Module which takes BC track segments and determines alignment 00036 /// constants for all planes. 00037 /// One needs 6 parameters to determine a coordinate system: 00038 /// three 3D points minus 2 equations which normalizes the (1, 0, 0) 00039 /// and (0, 1, 0) vectors, minus 1 equation which ensures their 00040 /// orthogonality. 00041 /// If length scale is set by wire spacing, then fixed parameters can 00042 /// be chosen as z of BC3, wide-angle planes of BC3 and BC1, and 00043 /// orientation of BC3 in xy-plane. 00044 /// 00045 /// This module is currently meant to do "rough" alignment, i.e. w/o 00046 /// using drift time information. Hence, it is unlikely that 00047 /// XZ or YZ rotations or z-positions will be fit for correctly. 00048 /// Nevertheless, ignoring rotations in xz and yz planes, we have 00049 /// 6 parameters per chamber (4 planes, z, xy-angle), of which we 00050 /// must fix at least 6 in order for minimization to be meaningful. 00051 /// 00052 /// @author Andre Lebedev 00053 /// 00054 class AlignBC : public JobCModule { 00055 public: 00056 typedef struct { 00057 float fWire[kNBC][kNPlane]; // Wire can be a cluster, e.g. 80.5 00058 float fT[kNBC][kNPlane]; 00059 float fWeight[kNBC][kNPlane]; 00060 } TrkInfo_t; 00061 00062 AlignBC(const char* version); 00063 ~AlignBC() {;} 00064 00065 JobCResult Ana(const EDMEventHandle& evt); 00066 00067 void NewRun(int run, int subrun); 00068 void EndRun(int run, int subrun); 00069 void Update(const CfgConfig& c); 00070 00071 private: 00072 //static double ComputeChi2(TrkInfo_t& ti); 00073 bool Fit(const TrkInfo_t* trk, BCAlignNt* nt, bool resolve = false); 00074 bool PreenTrackList(double res[3][4]); 00075 bool RoughAlign(); 00076 bool FineAlign(); 00077 void FillNt(const char* name, bool resolve); 00078 void WriteToDB(int run); 00079 00080 private: 00081 static AlignBC* fsModule; 00082 static double fZ1, fZ2; ///< Z locations that determine track params 00083 std::vector<TrkInfo_t*> fTrkInfo; 00084 00085 int fDoFineAlign; 00086 int fMaxAlignAttempt; 00087 int fMinNClust; ///< Minimum number of clusters per track 00088 int fMinNTrack; 00089 int fMaxNTrackEvt; 00090 std::string fTrkFolder; // Folder where tracks are found 00091 double fOkRoughShift; 00092 double fOkFineShift; 00093 double fDriftVel; 00094 float fMinTime; 00095 float fMaxTime; 00096 int fFillNt; 00097 }; 00098 00099 #endif // TRK_ALIGN_BC 00100 00101 ////////////////////////////////////////////////////////////////////////
1.4.7