- Timestamp:
- 03/01/04 11:36:44 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3365 r3366 11 11 12 12 13 13 14 2004/03/01: Thomas Bretz 14 15 … … 20 21 - enhanced interpretation of time 21 22 - fixed a bug in determin the file-type 23 24 * mastro/MAstro.[h,cc]: 25 - added Coordinate2Angle 26 - added AngularDistance 27 28 * mastro/MObservatory.[h,cc]: 29 - added data members for sin-/cos-component of latitude 30 - added calculation of rotation angle 31 32 * mhist/MHStarMap.[h,cc]: 33 - changes to use MObservatory member function 22 34 23 35 -
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; } -
trunk/MagicSoft/Mars/mhist/MHStarMap.cc
r3365 r3366 17 17 ! 18 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 19 ! Author(s): Wolfgang Wittek 02/2004 <mailto:wittek@mppmu.mpg.de> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 178 178 Bool_t MHStarMap::ReInit(MParList *pList) 179 179 { 180 MObservatory *obs= (MObservatory*)pList->FindObject(AddSerialNumber("MObservatory"));181 if (! obs)180 fObservatory = (MObservatory*)pList->FindObject(AddSerialNumber("MObservatory")); 181 if (!fObservatory) 182 182 { 183 183 *fLog << err << "MObservatory not found... aborting" << endl; … … 188 188 fCosLat = TMath::Cos(obs->GetPhi()); 189 189 190 *fLog << "fSinLat, fCosLat = " << fSinLat << ", "191 << fCosLat << endl;192 193 190 return kTRUE; 194 191 } … … 196 193 // -------------------------------------------------------------------------- 197 194 // 198 // RotationAngle 199 // 200 // calculates the angle for the rotation of the sky image in the camera; 201 // this angle is a function of the local coordinates (theta, phi) in rad. 202 // 203 // calculate rotation angle alpha of sky image in camera 204 // (see TDAS 00-11, eqs. (18) and (20)) 205 // 206 void MHStarMap::GetRotationAngle(const Double_t &theta, const Double_t &phi, 207 Double_t &cosal, Double_t &sinal) 208 { 209 210 const Double_t sint = TMath::Sin(theta); 211 const Double_t cost = TMath::Cos(theta); 212 213 const Double_t sinp = TMath::Sin(phi); 214 const Double_t cosp = TMath::Cos(phi); 215 216 const Double_t v1 = sint*sinp; 217 const Double_t v2 = fCosLat*cost - fSinLat*sint*cosp; 218 219 const Double_t denom = 1./ TMath::Sqrt(v1*v1 + v2*v2); 220 221 cosal = (fSinLat * sint - fCosLat * cost * cosp) * denom; 222 sinal = fCosLat * sinp * denom; 195 // Calls MObservatory::RotationAngle 196 // 197 void MHStarMap::GetRotationAngle(Double_t &sin, Double_t &cos) 198 { 199 fObservatory->RotationAngle(fMcEvt->GetTelescopeTheta(), 200 fMcEvt->GetTelescopePhi(), sin, cos); 223 201 } 224 202 … … 270 248 Double_t cosal; 271 249 Double_t sinal; 272 GetRotationAngle( theta, phi, cosal, sinal);250 GetRotationAngle(sinal, cosal); 273 251 274 252 if (m>-1 && m<1) -
trunk/MagicSoft/Mars/mhist/MHStarMap.h
r3365 r3366 10 10 class MSrcPosCam; 11 11 class MMcEvt; 12 class MObservatory; 12 13 13 14 class MHStarMap : public MH 14 15 { 15 16 private: 16 MSrcPosCam *fSrcPos; //! 17 MMcEvt *fMcEvt; //! 17 MSrcPosCam *fSrcPos; //! 18 MMcEvt *fMcEvt; //! 19 MObservatory *fObservatory; //! 18 20 19 21 TH2F *fStarMap; //-> … … 23 25 Bool_t fUseMmScale; 24 26 25 Float_t fCosLat; //!26 Float_t fSinLat; //!27 28 27 void PrepareDrawing() const; 29 28 30 29 void Paint(Option_t *opt=""); 31 30 31 void GetRotationAngle(Double_t &sinangle, Double_t &cosangle); 32 32 33 33 Bool_t SetupFill(const MParList *pList); … … 46 46 TH2F *GetHist() { return fStarMap; } 47 47 48 void GetRotationAngle(const Double_t &thetatel, const Double_t &phitel,49 Double_t &cosangle, Double_t &sinangle);50 51 48 void Draw(Option_t *opt=NULL); 52 49 TObject *DrawClone(Option_t *opt=NULL) const;
Note:
See TracChangeset
for help on using the changeset viewer.