00001 //////////////////////////////////////////////////////////////////////// 00002 // $Id: AlignChamW0.h,v 1.2 2006/12/25 06:29:31 lebedev Exp $ 00003 // 00004 // lebedev@physics.harvard.edu 00005 //////////////////////////////////////////////////////////////////////// 00006 00007 #ifndef TRK_CHAM_ALIGN_H 00008 #define TRK_CHAM_ALIGN_H 00009 00010 #include "JobControl/JobCModuleFactory.h" 00011 #include "Geometry/GChamGeo.h" 00012 #include <TObject.h> 00013 #include <TMinuit.h> 00014 #include <vector> 00015 00016 class TrackSeg; 00017 class WireClust; 00018 class TH1F; 00019 class TH2F; 00020 class TTree; 00021 00022 //...................................................................... 00023 00024 class AlResidNt : public TObject { 00025 public: 00026 AlResidNt() {;} 00027 00028 int nclust; 00029 float u[kNCham][kNPlane]; // U corresponding to actual wire 00030 float ufit[kNCham][kNPlane]; // U from the overal fit (all chambers in) 00031 float uperp[kNCham][kNPlane]; // Measure along the wire (all chambers in) 00032 float resid[kNCham][kNPlane]; // Residual when chamber is not in the fit 00033 float poq; // Momentum with all chambers in 00034 float chi2; // Chi squared, all chambers in 00035 float poqrm[kNCham][kNPlane]; // Momentum with chamber taken out of the fit 00036 float chi2rm[kNCham][kNPlane]; // Chi squared, chamber taken out of the fit 00037 00038 ClassDef(AlResidNt, 2); // Ntuple for residual analysis 00039 }; 00040 00041 //...................................................................... 00042 /// Module which calculates chamber to chamber alignment. At least 00043 /// 2 chambers should be fixed in order for result to make sense. 00044 /// Result can then be rota 00045 class AlignChamW0 : public JobCModule { 00046 public: 00047 typedef struct track__ { 00048 float fWire[kNCham][kNPlane]; ///< Wire number in the cluster 00049 float fWeight[kNCham][kNPlane]; ///< Weight of the wire in the fit 00050 float fPoQ; 00051 float fChi2; 00052 } TrkInfo_t; 00053 00054 AlignChamW0(const char* version); 00055 ~AlignChamW0(); 00056 00057 JobCResult Ana(const EDMEventHandle& evt); 00058 00059 void NewRun(int run, int subrun); 00060 void EndRun(int run, int subrun); 00061 void Update(const CfgConfig& c); 00062 00063 private: 00064 bool AdjustBField(); 00065 double Fit(TrkInfo_t& trk, float* p = 0); 00066 void Fit(AlignChamW0::TrkInfo_t& trk, AlResidNt* nt, int minCham = 0); 00067 void AnaResid(int i); 00068 int PreenTrackList(double res[kNCham][kNPlane], bool withBC); 00069 bool RoughAlign(bool withBC); 00070 00071 private: 00072 bool fFieldOn; 00073 int fNClust[kNCham][kNPlane]; ///< Total number of clusters in each chamber 00074 double fWire0[kNCham][kNPlane]; ///< Initial wire zero for all planes 00075 00076 static AlignChamW0* gsModule; 00077 static int fsCham; ///< Chamber being aligned internally 00078 00079 std::vector<TrkInfo_t> fTrackList; 00080 int fNTrackWithBC; 00081 double fZ0; ///< Z0 -- reference needed to calculate lambda's 00082 00083 std::string fFolder; ///< Folder where to look for tracks 00084 double fOkShift; 00085 int fLoadAlignment; 00086 int fMaxAlignAttempt; ///< Maximum number of attempts before alignment fails 00087 int fMinNClust; ///< Minimum number of clusters in Cham 1-6 00088 int fMinTracks; ///< Minimum number of tracks required to do alignment 00089 int fMinTracksBC; 00090 int fUseBC; 00091 int fAdjustBField; 00092 double fMinMom; 00093 double fMaxMom; 00094 }; 00095 00096 #endif // TRK_CHAM_ALIGN_H 00097 00098 ////////////////////////////////////////////////////////////////////////
1.4.7