Changeset 3366 for trunk/MagicSoft/Mars/mastro
- Timestamp:
- 03/01/04 11:36:44 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mastro
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstro.cc
r3326 r3366 31 31 #include "MAstro.h" 32 32 33 #include <TVector3.h> // TVector3 34 33 35 ClassImp(MAstro); 34 36 … … 183 185 } 184 186 187 // -------------------------------------------------------------------------- 188 // 189 // Interpretes a string ' - 12 30 00.0' or '+ 12 30 00.0' 190 // as floating point value -12.5 or 12.5. If interpretation is 191 // successfull kTRUE is returned, otherwise kFALSE. ret is not 192 // touched if interpretation was not successfull. The successfull 193 // interpreted part is removed from the TString. 194 // 185 195 Bool_t MAstro::String2Angle(TString &str, Double_t &ret) 186 196 { … … 202 212 } 203 213 214 // -------------------------------------------------------------------------- 215 // 216 // Interpretes a string '-12:30:00.0', '12:30:00.0' or '+12:30:00.0' 217 // as floating point value -12.5, 12.5 or 12.5. If interpretation is 218 // successfull kTRUE is returned, otherwise kFALSE. ret is not 219 // touched if interpretation was not successfull. 220 // 221 Bool_t MAstro::Coordinate2Angle(const TString &str, Double_t &ret) 222 { 223 Char_t sgn = str[0]=='-' ? '-' : '+'; 224 Int_t d; 225 UInt_t m; 226 Float_t s; 227 228 const int n=sscanf(str[0]=='+'||str[0]=='-' ? str.Data()+1 : str.Data(), "%d:%d:%f", &d, &m, &s); 229 230 if (n!=3) 231 return kFALSE; 232 233 ret = Dms2Deg(d, m, s, sgn); 234 return kTRUE; 235 } 236 237 // -------------------------------------------------------------------------- 238 // 239 // Return year y, month m and day d corresponding to Mjd. 240 // 204 241 void MAstro::Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d) 205 242 { … … 214 251 } 215 252 253 // -------------------------------------------------------------------------- 254 // 255 // Return Mjd corresponding to year y, month m and day d. 256 // 216 257 Int_t MAstro::Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d) 217 258 { … … 237 278 return 1461L*lm10/4 + (306*((m+9)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904; 238 279 } 280 281 // -------------------------------------------------------------------------- 282 // 283 // theta0, phi0 [rad]: polar angle/zenith distance, azimuth of 1st object 284 // theta1, phi1 [rad]: polar angle/zenith distance, azimuth of 2nd object 285 // AngularDistance [rad]: Angular distance between two objects 286 // 287 Double_t MAstro::AngularDistance(Double_t theta0, Double_t phi0, Double_t theta1, Double_t phi1) 288 { 289 TVector3 v0(1); 290 v0.Rotate(phi0, theta0); 291 292 TVector3 v1(1); 293 v1.Rotate(phi1, theta1); 294 295 return v0.Angle(v1); 296 } -
trunk/MagicSoft/Mars/mastro/MAstro.h
r3326 r3366 38 38 39 39 static Bool_t String2Angle(TString &str, Double_t &ret); 40 static Bool_t Coordinate2Angle(const TString &str, Double_t &ret); 40 41 42 static Double_t AngularDistance(Double_t theta0, Double_t phi0, Double_t theta1, Double_t phi1); 43 41 44 static void Mjd2Ymd(UInt_t mjd, UShort_t &y, Byte_t &m, Byte_t &d); 42 45 static Int_t Ymd2Mjd(UShort_t y, Byte_t m, Byte_t d); -
trunk/MagicSoft/Mars/mastro/MObservatory.cc
r3328 r3366 81 81 fHeight = 2196.5; // m 82 82 fObservatoryName = "Observatorio del Roque de los Muchachos (Magic1)"; 83 return;83 break; 84 84 85 85 case kWuerzburgCity: … … 88 88 fHeight = 300; 89 89 fObservatoryName = "Wuerzburg City"; 90 return; 90 break; 91 } 91 92 92 } 93 fSinLatitude = TMath::Sin(fLatitude); 94 fCosLatitude = TMath::Cos(fLatitude); 93 95 } 94 96 … … 102 104 } 103 105 106 // -------------------------------------------------------------------------- 107 // 108 // RotationAngle 109 // 110 // calculates the angle for the rotation of the sky image in the camera; 111 // this angle is a function of the local coordinates 112 // 113 // theta [rad]: polar angle/zenith distance 114 // phi [rad]: rotation angle/azimuth 115 // 116 // Return sin/cos component of angle 117 // 118 // calculate rotation angle alpha of sky image in camera 119 // (see TDAS 00-11, eqs. (18) and (20)) 120 // 121 void MObservatory::RotationAngle(Double_t theta, Double_t phi, Double_t &sin, Double_t &cos) const 122 { 123 const Double_t sint = TMath::Sin(theta); 124 const Double_t cost = TMath::Cos(theta); 125 126 const Double_t sinl = fSinLatitude*sint; 127 const Double_t cosl = fCosLatitude*cost; 128 129 const Double_t sinp = TMath::Sin(phi); 130 const Double_t cosp = TMath::Cos(phi); 131 132 const Double_t v1 = sint*sinp; 133 const Double_t v2 = cosl - sinl*cosp; 134 135 const Double_t denom = TMath::Sqrt(v1*v1 + v2*v2); 136 137 sin = (fCosLatitude*sinp) / denom; 138 cos = sinl + cosl*cosp / denom; 139 } 140 141 // -------------------------------------------------------------------------- 142 // 143 // RotationAngle 144 // 145 // calculates the angle for the rotation of the sky image in the camera; 146 // this angle is a function of the local coordinates 147 // 148 // theta [rad]: polar angle/zenith distance 149 // phi [rad]: rotation angle/azimuth 150 // 151 // Return RotationAngle in rad 152 // 153 // calculate rotation angle alpha of sky image in camera 154 // (see TDAS 00-11, eqs. (18) and (20)) 155 // 156 Double_t MObservatory::RotationAngle(Double_t theta, Double_t phi) const 157 { 158 const Double_t sint = TMath::Sin(theta); 159 const Double_t cost = TMath::Cos(theta); 160 161 const Double_t sinp = TMath::Sin(phi); 162 const Double_t cosp = TMath::Cos(phi); 163 164 const Double_t v1 = sint*sinp; 165 const Double_t v2 = fCosLatitude*cost - fSinLatitude*sint*cosp; 166 167 const Double_t denom = TMath::Sqrt(v1*v1 + v2*v2); 168 169 return TMath::ASin((fCosLatitude*sinp) / denom); 170 } -
trunk/MagicSoft/Mars/mastro/MObservatory.h
r3326 r3366 23 23 Double_t fLatitude; //! [rad] Latitude of observatory (+ north) 24 24 25 Double_t fSinLatitude; //! Sin component for faster access 26 Double_t fCosLatitude; //! Cos component for faster access 27 25 28 Double_t fHeight; //! [m] height of observatory 26 29 … … 46 49 Double_t GetElong() const { return fLongitude; } //[rad] 47 50 51 Double_t GetSinPhi() const { return fSinLatitude; } 52 Double_t GetCosPhi() const { return fCosLatitude; } 53 48 54 Double_t GetHeight() const { return fHeight; } 55 56 void RotationAngle(Double_t theta, Double_t phi, Double_t &sin, Double_t &cos) const; 57 Double_t RotationAngle(Double_t theta, Double_t phi) const; 49 58 50 59 LocationName_t GetObservatoryKey() const { return fObservatoryKey; }
Note:
See TracChangeset
for help on using the changeset viewer.