00001
00006 #ifndef __TVIRTUALSPECTROMETER_h
00007 #define __TVIRTUALSPECTROMETER_h
00008
00009 #include <iostream>
00010
00011 #include <TROOT.h>
00012 #include <TObject.h>
00013 #include <TTree.h>
00014
00015 #define alignMode_SVD 0
00016 #define alignMode_Linear 1
00017 #define alignMode_Parabolic 2
00039 class TVirtualSpectrometer : public TObject {
00040 public:
00041 TVirtualSpectrometer( Int_t nOrbitBPMs, Int_t nChicaneBPMs );
00042 virtual ~TVirtualSpectrometer();
00043
00051 Int_t alignSystem( Long64_t iEv1, Long64_t iEv2, Int_t mode );
00052
00057 void setMagnetLocations( Double_t z1, Double_t z2 ) { _zB1 = z1; _zB2 = z2; }
00058
00063 void setMagnetFields( Double_t Bdl1, Double_t Bdl2 ) { _Bdl1 = Bdl1; _Bdl2 = Bdl2; }
00064
00068 Int_t getChicaneResiduals( void );
00069
00072 Double_t getEnergy( Long64_t iev );
00073
00074
00079 virtual Int_t setTree( TTree *t ) = 0;
00080
00081
00088 virtual Int_t getEvent( Long64_t iev ) = 0;
00089
00091 void showAlignment( void );
00092
00093 protected:
00094 TTree *_dataTree;
00096 Int_t _nOrbitBPMs;
00097 Double_t *_xOrbitPos;
00098 Double_t *_zOrbitPos;
00101 Int_t _nChicaneBPMs;
00102 Double_t *_xChicanePos;
00103 Double_t *_zChicanePos;
00105 private:
00106 Int_t _alignMode;
00108 Int_t _getSVDCoefficients( Long64_t iEv1, Long64_t iEv2 );
00109 Int_t _getAlignmentConstants( Long64_t iEv1, Long64_t iEv2 );
00110
00111 Double_t *_xOrbitAlignOffset;
00112 Double_t *_xOrbitCorrPos;
00113 Double_t *_xChicaneAlignOffset;
00114 Double_t *_xChicaneCorrPos;
00115 Double_t *_xChicaneResidual;
00117 Double_t **_cSVD;
00118
00119 Double_t _zB1;
00120 Double_t _zB2;
00121 Double_t _Bdl1;
00122 Double_t _Bdl2;
00123
00124 ClassDef( TVirtualSpectrometer, 1 )
00125 };
00126
00127 #endif