Changeset 9439 for trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
- Timestamp:
- 05/09/09 13:48:12 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/catalog/StarCatalog.cc
r8848 r9439 17 17 using namespace std; 18 18 19 StarCatalog::StarCatalog(MObservatory::LocationName_t key) : SlaStars(key), fW(768), fH(576), fAstro(0), /*fSao(NULL), fSrt(NULL), fEntries(0),*/ fSinAngle(0), fCosAngle(1), fBox (768)19 StarCatalog::StarCatalog(MObservatory::LocationName_t key) : SlaStars(key), fW(768), fH(576), fAstro(0), /*fSao(NULL), fSrt(NULL), fEntries(0),*/ fSinAngle(0), fCosAngle(1), fBoxX(768), fBoxY(576) 20 20 { 21 21 fAstro = new MAstroCatalog; … … 32 32 { 33 33 // pixsize [arcsec/pixel] 34 fPixSize = D2PI/360.0*pixsize/3600; // [rad / (deg*pixel)]34 fPixSize = TMath::DegToRad()*pixsize/3600; // [rad / (deg*pixel)] 35 35 fAstro->SetRadiusFOV(pixsize, 768, 576); 36 // fov = hypot(768, 576)/2*pixsize/3600; 36 37 } 37 38 38 39 double StarCatalog::GetPixSize() const 39 40 { 40 return fPixSize*3600* 360.0/D2PI;41 return fPixSize*3600*TMath::RadToDeg(); 41 42 } 42 43 … … 55 56 void StarCatalog::SetAltAz(const AltAz &altaz) 56 57 { 57 fAltAz = altaz * D2PI/360.0;58 fAltAz = altaz * TMath::DegToRad(); 58 59 fRaDec = CalcRaDec(fAltAz); 59 60 … … 72 73 void StarCatalog::SetRaDec(const RaDec &radec) 73 74 { 74 const RaDec rd = fRaDec* 360.0/D2PI;;75 const RaDec rd = fRaDec*TMath::RadToDeg(); 75 76 76 77 const Bool_t same = … … 78 79 rd.Dec()>radec.Dec()-1e-5 && rd.Dec()<radec.Dec()+1e-5; 79 80 80 fRaDec = radec * D2PI/360.0;81 fRaDec = radec * TMath::DegToRad(); 81 82 fAltAz = CalcAltAz(fRaDec); 82 83 … … 153 154 154 155 void StarCatalog::CalcStars(MStarList &list, int xc, int yc, 155 int xo, int yo) const 156 { 157 // For an apropriate unit conversion to pixels [pix/rad] 158 const Double_t scale = TMath::RadToDeg()*TMath::Sqrt(768*768 + 576*576)/(fAstro->GetRadiusFOV()*2); 159 160 // Offsets to shift [-n/2;n/2] to [0;n] and to 161 // move the stars in the counterdirection of the LEDs 162 const Int_t offx = 768/2 + xo; 163 const Int_t offy = 576/2 + yo; 156 float offx, float offy) const 157 { 158 // const Int_t offx = 768/2 + xo; 159 // const Int_t offy = 576/2 + yo; 164 160 165 161 // Allow catalog stars to be a bit outside [0.2deg] of the 166 162 // monitored window. To get the std behaviour set offset=0 167 const Int_t offset = TMath::Nint(0.2*TMath::DegToRad()*scale); 168 const Int_t box = fBox+offset; 163 const Int_t offset = TMath::Nint(0.2*TMath::DegToRad()/fPixSize); 164 const Int_t boxx = fBoxX+offset; 165 const Int_t boxy = fBoxY+offset; 169 166 170 167 // CalcStars flips the picture in X defaultwise now 171 168 // This defined the box in which stars are really returned 169 const int x0 = TMath::Max((768-xc)-boxx, -offset); 170 const int y0 = TMath::Max(yc-boxy, -offset); 171 const int x1 = TMath::Min((768-xc)+boxx, fW+offset); 172 const int y1 = TMath::Min(yc+boxy, fH+offset); 173 /* 172 174 const int x0 = TMath::Max((768-xc)-box, -offset); 173 const int y0 = TMath::Max(yc-box, -offset);174 175 const int x1 = TMath::Min((768-xc)+box, fW+offset); 175 const int y1 = TMath::Min(yc+box, fH+offset); 176 176 177 const int y0 = TMath::Max(yc-box-100, -offset); 178 const int y1 = TMath::Min(yc+box+100, fH+offset); 179 */ 180 181 /* 177 182 // Align stars into telescope system 178 183 // (Move the telescope to pointing position) … … 181 186 align.RotateY(-(TMath::Pi()/2-fAltAz.Alt())); 182 187 align.RotateZ(TMath::Pi()/2); 188 */ 189 190 TRotation rot; 191 rot.RotateY(-(TMath::Pi()/2-fAltAz.Alt())); 183 192 184 193 // Get List of stars from catalog … … 200 209 const ZdAz za(CalcZdAz(rd)); 201 210 211 TVector3 v; 212 //v.SetMagThetaPhi(1., TMath::Pi()/2-za.Alt(), za.Az()-fAltAz.Az()); 213 v.SetMagThetaPhi(1., za.Zd(), za.Az()-fAltAz.Az()); 214 v *= rot; 215 216 if (v(2)<0) 217 continue; 218 219 // Stretch such, that the Z-component is alwas the same. Now 220 // X and Y contains the intersection point between the star-light 221 // and the plain of a virtual plain screen (ccd...) 222 v *= 1./v(2); 223 224 // Do unit conversion to pixels 225 v *= 1./fPixSize; 226 227 const Double_t x = -v.Y(); 228 const Double_t y = v.X(); 229 230 /* 202 231 // Virtually move telescope to pointing position 203 232 TVector3 loc; … … 215 244 216 245 // Do an apropriate unit conversion to pixels 217 loc *= scale; 218 246 loc *= 1./fPixSize; 247 248 const Double_t x = loc.X(); 249 const Double_t y = loc.Y(); 250 */ 219 251 // if (loc.Mod2()>fRadiusFOV*fRadiusFOV) 220 252 // continue; 221 253 254 222 255 // Rotate by the rotation angle of the video camera 223 256 // and add the offsets on both axis 224 Float_t xx = loc.X()*fCosAngle - loc.Y()*fSinAngle +offx;225 Float_t yy = loc.X()*fSinAngle + loc.Y()*fCosAngle +offy;257 const Double_t xx = x*fCosAngle - y*fSinAngle + 768 - offx; 258 const Double_t yy = x*fSinAngle + y*fCosAngle + offy; 226 259 227 260 // Check if the resulting star is in the … … 235 268 } 236 269 270 /* 237 271 AltAz StarCatalog::CalcAltAzFromPix(Double_t pixx, Double_t pixy) const 238 272 { … … 251 285 return AltAz(-dec, ha+fAltAz.Az()); 252 286 } 287 */ 288 289 ZdAz StarCatalog::CalcDeltaZdAzFromPix(Double_t dpixx, Double_t dpixy) const 290 { 291 double dx = dpixx*fCosAngle + dpixy*fSinAngle; 292 double dy = -dpixx*fSinAngle + dpixy*fCosAngle; 293 294 TVector3 loc(dy, -dx, 1./fPixSize); 295 296 loc.RotateY(TMath::Pi()/2-fAltAz.Alt()); 297 298 return ZdAz(loc.Theta()-TMath::Pi()/2+fAltAz.Alt(), -loc.Phi()); 299 300 /* 301 // Align stars into telescope system 302 // (Move the telescope to pointing position) 303 TRotation align; 304 align.RotateZ(-fAltAz.Az()); 305 align.RotateY(-(TMath::Pi()/2-fAltAz.Alt())); 306 align.RotateZ(TMath::Pi()/2); 307 308 309 TVector3 loc(dx, dy, 1./fPixSize); 310 311 loc *= align.Inverse(); 312 313 cout << (TMath::Pi()/2-loc.Theta()-alt)*TMath::RadToDeg() << " " << (loc.Phi()-az)*TMath::RadToDeg() << endl; 314 315 316 317 TVector3 loc(dx, -dy, 1./fPixSize); 318 319 loc *= align.Inverse(); 320 321 return ZdAz(loc.Theta(), loc.Phi());*/ 322 }
Note:
See TracChangeset
for help on using the changeset viewer.