Changeset 4966 for trunk/MagicSoft/Mars/mpointing
- Timestamp:
- 09/13/04 08:57:58 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mpointing
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpointing/MPointing.cc
r4804 r4966 80 80 #include "MTime.h" 81 81 82 ClassImp(AltAz); 83 ClassImp(ZdAz); 82 84 ClassImp(MPointing); 83 85 … … 602 604 } 603 605 606 TVector3 MPointing::Correct(const TVector3 &v) const 607 { 608 // Correct [rad] 609 // zdaz [rad] 610 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 611 AltAz c = Correct(p); 612 TVector3 rc; 613 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 614 return rc; 615 } 616 604 617 ZdAz MPointing::CorrectBack(const ZdAz &zdaz) const 605 618 { … … 611 624 } 612 625 626 TVector3 MPointing::CorrectBack(const TVector3 &v) const 627 { 628 // Correct [rad] 629 // zdaz [rad] 630 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 631 AltAz c = CorrectBack(p); 632 TVector3 rc; 633 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 634 return rc; 635 } 636 613 637 void MPointing::SetParameters(const Double_t *par, Int_t n) 614 638 { -
trunk/MagicSoft/Mars/mpointing/MPointing.h
r4804 r4966 4 4 #ifndef ROOT_TArrayD 5 5 #include <TArrayD.h> 6 #endif 7 8 #ifndef ROOT_TVector3 9 #include <TVector3.h> 6 10 #endif 7 11 … … 24 28 Double_t Alt() const { return fX; } 25 29 Double_t Az() const { return fY; } 30 ClassDef(AltAz, 1) 26 31 }; 27 32 … … 34 39 Double_t Zd() const { return fX; } 35 40 Double_t Az() const { return fY; } 41 ClassDef(ZdAz, 1) 36 42 }; 37 43 #endif … … 95 101 void Reset(); 96 102 97 ZdAz Correct(const ZdAz &zdaz) const; 98 AltAz Correct(const AltAz &aaz) const; 99 100 ZdAz CorrectBack(const ZdAz &zdaz) const; 101 AltAz CorrectBack(const AltAz &aaz) const; 102 103 ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); } 104 AltAz operator()(const AltAz &aaz) const { return Correct(aaz); } 103 ZdAz Correct(const ZdAz &zdaz) const; 104 AltAz Correct(const AltAz &aaz) const; 105 TVector3 Correct(const TVector3 &v) const; 106 107 ZdAz CorrectBack(const ZdAz &zdaz) const; 108 AltAz CorrectBack(const AltAz &aaz) const; 109 TVector3 CorrectBack(const TVector3 &v) const; 110 111 ZdAz operator()(const ZdAz &zdaz) const { return Correct(zdaz); } 112 AltAz operator()(const AltAz &aaz) const { return Correct(aaz); } 113 TVector3 operator()(const TVector3 &v) const { return Correct(v); } 105 114 106 115 ZdAz operator()(const ZdAz &zdaz, void (*fcn)(ZdAz &zdaz, Double_t *par)) const … … 122 131 } 123 132 133 TVector3 operator()(const TVector3 &aaz, void (*fcn)(TVector3 &aaz, Double_t *par)) const 134 { 135 Double_t par[fNumPar]; 136 GetParameters(par); 137 TVector3 v = aaz; 138 fcn(v, par); 139 return v; 140 } 141 124 142 AltAz AddOffsets(const AltAz &aa) const; 125 143 ZdAz AddOffsets(const ZdAz &zdaz) const … … 129 147 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az()); 130 148 } 149 TVector3 AddOffsets(const TVector3 &v) const 150 { 151 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 152 AltAz c = AddOffsets(p); 153 TVector3 rc; 154 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 155 return rc; 156 } 131 157 132 158 AltAz SubtractOffsets(const AltAz &aa) const; … … 136 162 AltAz c = SubtractOffsets(p); 137 163 return ZdAz(TMath::Pi()/2-c.Alt(), c.Az()); 164 } 165 TVector3 SubtractOffsets(const TVector3 &v) const 166 { 167 AltAz p(TMath::Pi()/2-v.Theta(), v.Phi()); 168 AltAz c = SubtractOffsets(p); 169 TVector3 rc; 170 rc.SetMagThetaPhi(1, TMath::Pi()/2-c.Alt(), c.Az()); 171 return rc; 138 172 } 139 173 -
trunk/MagicSoft/Mars/mpointing/MSrcPosFromModel.cc
r4844 r4966 39 39 #include "MPointing.h" 40 40 #include "MSrcPosCam.h" 41 #include "MAstro.h" 42 #include "MAstroCatalog.h" // MVector3 41 43 #include "MAstroSky2Local.h" 42 44 #include "MPointingPos.h" … … 57 59 fTitle = title ? title : ""; 58 60 59 fPoint0401 = new MPointing("bending 0401.txt");61 fPoint0401 = new MPointing("bending-fit.txt"); 60 62 fPoint0405 = new MPointing("bending0405.txt"); 61 fPointOld = new MPointing("bending-old.txt");62 fPointNew = new MPointing("bending0408.txt");63 63 } 64 64 … … 67 67 delete fPoint0401; 68 68 delete fPoint0405; 69 delete fPointOld;70 delete fPointNew;71 69 } 72 70 … … 97 95 return kFALSE; 98 96 } 99 /*100 fReport = (MReportDrive*)pList->FindObject("MReportDrive");101 if (!fReport)102 {103 *fLog << err << "MReportDrive not found... aborting." << endl;104 return kFALSE;105 }106 97 107 98 fObservatory = (MObservatory*)pList->FindObject("MObservatory"); … … 119 110 } 120 111 121 fTime2 = (MTime*)pList->FindObject("MTimeDrive", "MTime");122 if (!fTime2)123 {124 *fLog << err << "MTimeDrive not found... aborting." << endl;125 return kFALSE;126 }127 */128 112 fSrcPos = (MSrcPosCam*)pList->FindCreateObj("MSrcPosCam"); 129 113 if (!fSrcPos) … … 132 116 return kTRUE; 133 117 } 134 /*135 TVector2 MSrcPosFromModel::CalcXYinCamera(const ZdAz &pos0, const ZdAz &pos1) const136 {137 MVector3 p0, p1;138 p0.SetZdAz(pos0.X(), pos0.Y());139 p1.SetZdAz(pos1.X(), pos1.Y());140 118 141 return CalcXYinCamera(p0, p1);142 }143 144 // --------------------------------------------------------------------------145 //146 // Loc0LocToCam147 //148 // Input : (theta0, phi0) direction for the position (0,0) in the camera149 // ( theta, phi) some other direction150 //151 // Output : (X, Y) position in the camera corresponding to (theta, phi)152 //153 TVector2 MSrcPosFromModel::CalcXYinCamera(const MVector3 &pos0, const MVector3 &pos) const154 {155 const Double_t theta0 = pos0.Theta();156 const Double_t phi0 = pos0.Phi();157 158 const Double_t theta = pos.Theta();159 const Double_t phi = pos.Phi();160 161 //--------------------------------------------162 163 // pos0[3] = TMath::Cos(theta0)164 165 const Double_t YC0 = TMath::Cos(theta0)*TMath::Tan(theta)*TMath::Cos(phi-phi0) - TMath::Sin(theta0);166 const Double_t YC1 = TMath::Cos(theta0) + TMath::Sin(theta0)*TMath::Tan(theta);167 const Double_t YC = YC0 / YC1;168 169 //--------------------------------------------170 171 const Double_t XC0 = TMath::Cos(theta0) - YC*TMath::Sin(theta0);172 const Double_t XC = -TMath::Sin(phi-phi0) * TMath::Tan(theta) * XC0;173 174 //--------------------------------------------175 return TVector2(XC, -YC);176 }177 */178 119 // -------------------------------------------------------------------------- 179 120 // … … 182 123 Int_t MSrcPosFromModel::Process() 183 124 { 184 MPointing *conv1 = 0; 185 MPointing *conv2 = 0; 125 MPointing *conv = 0; 186 126 187 if (!conv1 && fRun->GetRunNumber()<26237) 188 { 189 conv1 = fPoint0401; 190 conv2 = fPointOld; 191 } 192 if (!conv1 && fRun->GetRunNumber()<31684) 193 { 194 conv1 = fPoint0405; 195 conv2 = fPointOld; 196 } 197 /* 198 MVector3 sky; 199 sky.SetRaDec(fPointPos->GetRaRad(), fPointPos->GetDecRad()); 200 MVector3 loc = MAstroSky2Local(*fTime2, *fObservatory)*sky; 201 ZdAz za(loc.Theta(), loc.Phi()); 202 */ 127 if (!conv && fRun->GetRunNumber()<26237) 128 conv = fPoint0401; 129 if (!conv && fRun->GetRunNumber()<31684) 130 conv = fPoint0405; 203 131 204 // Get current pointing position from Drive system 205 ZdAz za(fPointPos->GetZd(), fPointPos->GetAz()); 206 za *= TMath::DegToRad(); 132 MVector3 sky; 133 sky.SetRaDec(fPointPos->GetRaRad(), fPointPos->GetDecRad()); 207 134 208 // Get c orresponding Shaftencoder positions for 'Used-Mode'209 const ZdAz za2 = conv1->Correct(za); // [deg] --> [se]210 // Get corre sponding Shaftencoder positions for 'Correct-Mode'211 const ZdAz za1 = conv2->Correct(za); // [deg] --> [se]135 // Get current star position (off center) 136 MVector3 vl2 = MAstroSky2Local(*fTime, *fObservatory)*sky; 137 // Get corrected position camera center) 138 TVector3 vl1 = conv->Correct(vl2); 212 139 213 // The difference of the shaftencoder positions for both model 214 // correspond in a first order approximation to the misspointing 215 TVector2 v0 = TVector2(za2.Y()-za1.Y(), za2.X()-za1.X()); 216 217 // Convert misspointing to millimeters 218 v0 *= TMath::RadToDeg()/fGeom->GetConvMm2Deg(); 140 // Calculate x,y of za2 141 TVector2 d = MAstro::GetDistOnPlain(vl1, vl2, fGeom->GetCameraDist()*1000); 219 142 220 143 // Set Source position 221 fSrcPos->SetXY(v0); 222 223 /* 224 TVector2 v0 = CalcXYinCamera(za1, za0)*fGeom->GetCameraDist()*(-1000); 225 TVector2 v1 = CalcXYinCamera(za0, za1)*fGeom->GetCameraDist()*(+1000); 226 227 fSrcPos->SetXY(TVector2(0,0)); // v1 228 229 za0 *= TMath::RadToDeg(); 230 za1 *= TMath::RadToDeg(); 231 232 *fLog << warn << endl; 233 *fLog << "-1-> " << za0.X() << " " << za0.Y() << " " << v0.X() << " " << v0.Y() << " " << v0.X()*fGeom->GetConvMm2Deg() << " " << v0.Y()*fGeom->GetConvMm2Deg() << endl; 234 *fLog << "-2-> " << za1.X() << " " << za1.Y() << " " << v1.X() << " " << v1.Y() << " " << v1.X()*fGeom->GetConvMm2Deg() << " " << v1.Y()*fGeom->GetConvMm2Deg() << endl; 235 236 Double_t rho = fPointPos->RotationAngle(*fObservatory, *fTime2); 237 *fLog << "-3-> " << rho*TMath::RadToDeg() << endl; 238 239 v1=v1.Rotate(-rho); 240 *fLog << "-4-> " << " " << " " << " " << " " << v1.X() << " " << v1.Y() << " " << v1.X()*fGeom->GetConvMm2Deg() << " " << v1.Y()*fGeom->GetConvMm2Deg() << endl; 241 242 */ 243 /* 244 *fLog << dbg << endl; 245 *fLog << "Time: " << setprecision(12) << fTime2->GetMjd() << " " << *fTime2 << endl; 246 *fLog << setprecision(6); 247 */ 144 fSrcPos->SetXY(d); 248 145 249 146 return kTRUE; -
trunk/MagicSoft/Mars/mpointing/MSrcPosFromModel.h
r4825 r4966 10 10 #endif 11 11 12 //class MVector3;13 12 class MPointingPos; 14 13 class MSrcPosCam; … … 16 15 class MPointing; 17 16 class MRawRunHeader; 18 //class MTime; 19 //class MObservatory; 20 //class MReportDrive; 21 //class ZdAz; 17 class MTime; 18 class MObservatory; 22 19 23 20 class MSrcPosFromModel : public MTask … … 28 25 MGeomCam *fGeom; //! Camera geometry 29 26 MRawRunHeader *fRun; //! Run Header storing the run-number 30 //MTime *fTime; 31 //MTime *fTime2; 32 //MReportDrive *fReport; 33 //MObservatory *fObservatory; 27 MTime *fTime; 28 MObservatory *fObservatory; 34 29 35 30 MPointing *fPoint0401; //! Pointing Model used since 1/2004 36 31 MPointing *fPoint0405; //! Pointing Model used since 5/2004 37 38 MPointing *fPointOld; //! Pointing Model valid until 8/200439 MPointing *fPointNew; //! Pointing Model valid since 8/200440 32 41 33 Int_t PreProcess(MParList *pList); -
trunk/MagicSoft/Mars/mpointing/PointingLinkDef.h
r4826 r4966 14 14 #pragma link C++ class MSrcPosFromModel+; 15 15 16 #pragma link C++ class AltAz+; 17 #pragma link C++ class ZdAz+; 18 16 19 #endif
Note:
See TracChangeset
for help on using the changeset viewer.