Changeset 2615 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 12/07/03 14:48:11 (21 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MBending.cc
r2568 r2615 65 65 #include <TMinuit.h> 66 66 67 #include " timer.h"67 #include "MTime.h" 68 68 69 69 ClassImp(MBending); … … 262 262 } 263 263 264 Timert;264 MTime t; 265 265 t.Now(); 266 266 267 fout << "MAGIC1 " << t .GetTimeStr()<< endl;267 fout << "MAGIC1 " << t << endl; 268 268 fout << "S 00 000000 000000 0000000" << endl; 269 269 fout << setprecision(8); … … 285 285 } 286 286 287 AltAz MBending::AddOffsets(const AltAz &aa) const 288 { 289 // Correct [rad] 290 // zdaz [rad] 291 AltAz p = aa; 292 293 const AltAz I(fIe, fIa); 294 p += I; 295 296 return p; 297 } 298 299 AltAz MBending::SubtractOffsets(const AltAz &aa) const 300 { 301 // Correct [rad] 302 // zdaz [rad] 303 AltAz p = aa; 304 305 const AltAz I(fIe, fIa); 306 p -= I; 307 308 return p; 309 } 310 311 AltAz MBending::CalcAnAw(const AltAz &p, Int_t sign) const 312 { 313 // Corrections for AN and AW without approximations 314 // as done by Patrick Wallace. The approximation cannot 315 // be used for MAGIC because the correctioon angle 316 // AW (~1.5deg) is not small enough. 317 318 // Vector in cartesian coordinates 319 TVector3 v(1., 1., 1.); 320 321 // Set Azimuth and Elevation 322 v.SetPhi(p.Az()); 323 v.SetTheta(TMath::Pi()/2-p.Alt()); 324 325 // Rotate around the x- and y-axis 326 v.RotateY(sign*fAn); 327 v.RotateX(sign*fAw); 328 329 // Calculate Delta Azimuth and Delta Elevation 330 AltAz d(TMath::Pi()/2-v.Theta(), v.Phi()); 331 d -= p; 332 d *= sign; 333 334 // Fix 'direction' of output depending on input vector 335 if (sign*p.Alt()>TMath::Pi()/2) 336 d.Alt(d.Alt()-TMath::Pi()); 337 338 // Align correction into [-180,180] 339 while (d.Az()>TMath::Pi()) 340 d.Az(d.Az()-TMath::Pi()*2); 341 while (d.Az()<-TMath::Pi()) 342 d.Az(d.Az()+TMath::Pi()*2); 343 344 return d; 345 } 346 347 287 348 AltAz MBending::Correct(const AltAz &aa) const 288 349 { … … 350 411 DEBUG(cout << "Bend2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl); 351 412 352 // New Corrections for AW and AN: 353 TVector3 v2(1.,1.,1.); // Vector in cartesian coordinates 354 // Set Azimuth and Elevation 355 v2.SetPhi(p.Az()); 356 v2.SetTheta(TMath::Pi()/2-p.Alt()); 357 // Rotate around the x- and y-axis 358 v2.RotateX(fAw); 359 v2.RotateY(fAn); 360 // Get Azimuth and Elevation 361 p.Az(v2.Phi()); 362 p.Alt(TMath::Pi()/2-v2.Theta()); 363 364 /* 365 // Old correction terms for An and Aw: 366 cout << fAw << " " << cos(p.Az()) << " " << tan(p.Alt()) << endl; 367 cout << fAw* cos(p.Az())*tan(p.Alt())*180/3.1415 << endl; 368 369 const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt())); 370 const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt())); 371 p += AW; 372 p += AN; 413 const AltAz ANAW(CalcAnAw(p, -1)); 414 p += ANAW; 415 416 /* Old correction terms for An and Aw: 417 const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt())); 418 const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt())); 419 p += AW; 420 p += AN; 373 421 */ 374 375 376 377 422 378 423 DEBUG(cout << "Bend1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl); … … 389 434 } 390 435 391 AltAz MBending:: AddOffsets(const AltAz &aa) const436 AltAz MBending::CorrectBack(const AltAz &aa) const 392 437 { 393 438 // Correct [rad] … … 395 440 AltAz p = aa; 396 441 397 const AltAz I(fIe, fIa);398 p += I;399 400 return p;401 }402 403 AltAz MBending::CorrectBack(const AltAz &aa) const404 {405 // Correct [rad]406 // zdaz [rad]407 AltAz p = aa;408 409 442 DEBUG(cout << setprecision(16)); 410 443 DEBUG(cout << "Back0: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl); … … 418 451 DEBUG(cout << "Back1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl); 419 452 420 /* 421 //Old correction terms for An and Aw: 453 /* Old correction terms for An and Aw: 422 454 const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt())); 423 455 const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt())); … … 426 458 */ 427 459 428 // New Corrections for AN and AW: 429 TVector3 v(1.,1.,1.); // Vector in cartesian coordinates 430 // Set Azimuth and Elevation 431 v.SetPhi(p.Az()); 432 v.SetTheta(TMath::Pi()/2-p.Alt()); 433 // Rotate around the x- and y-axis 434 v.RotateY(-fAn); 435 v.RotateX(-fAw); 436 // Get Azimuth and Elevation 437 p.Az(v.Phi()); 438 p.Alt(TMath::Pi()/2-v.Theta()); 439 460 const AltAz ANAW(CalcAnAw(p, -1)); 461 p -= ANAW; 440 462 441 463 DEBUG(cout << "Back2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl); … … 498 520 } 499 521 500 AltAz MBending::SubtractOffsets(const AltAz &aa) const501 {502 // Correct [rad]503 // zdaz [rad]504 AltAz p = aa;505 506 const AltAz I(fIe, fIa);507 p -= I;508 509 return p;510 }511 512 513 522 ZdAz MBending::Correct(const ZdAz &zdaz) const 514 523 { -
trunk/MagicSoft/Cosy/main/MBending.h
r2518 r2615 53 53 54 54 static Double_t Sign(Double_t val, Double_t alt); 55 AltAz CalcAnAw(const AltAz &p, Int_t sign) const; 55 56 56 57 public: -
trunk/MagicSoft/Cosy/main/MCaos.cc
r2280 r2615 12 12 #include <TCanvas.h> 13 13 14 #include "MTime.h" 15 14 16 #include "Led.h" 15 17 #include "Ring.h" … … 18 20 19 21 #include "coord.h" 20 #include "base/timer.h"21 22 22 23 void MCaos::ReadResources(const char *name="leds.txt") … … 306 307 } 307 308 308 void MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const Timer&t)309 void MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t) 309 310 { 310 311 Leds &leds = *fLeds; … … 354 355 355 356 // FIXME! 356 static const Timert0(t);357 fEvtTime = (double)t-(double)t0;357 static const MTime t0(t); 358 fEvtTime = t-t0; 358 359 359 360 if (fHistpr) -
trunk/MagicSoft/Cosy/main/MCaos.h
r2278 r2615 15 15 class TGraph; 16 16 17 class Timer;17 class MTime; 18 18 class ZdAz; 19 19 … … 68 68 void ResetHistograms(); 69 69 70 void Run(byte *img, bool printl, bool printr, const ZdAz &pos, const Timer&t);70 void Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t); 71 71 }; 72 72 -
trunk/MagicSoft/Cosy/main/MCosy.cc
r2613 r2615 18 18 19 19 #include "MGCosy.h" 20 #include "MTime.h" 20 21 #include "MDriveCom.h" 21 22 #include "MStarguider.h" … … 25 26 26 27 #include "macs.h" 27 #include "base/timer.h"28 28 #include "shaftencoder.h" 29 29 … … 341 341 return; 342 342 343 Timert;343 MTime t; 344 344 t.Now(); 345 345 lout << t << " - MCosy::WaitForEndMovement aborted..."; … … 449 449 const ZdAz d = dst*kRad2Deg; 450 450 451 Timert;451 MTime t; 452 452 t.Now(); 453 453 lout << t << " - Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl; … … 958 958 959 959 sla.Now(); 960 lout << sla << " - Start tracking:";960 lout << sla.GetTime() << " - Start tracking:"; 961 961 lout << " Ra: " << xy.X() << "h " << "Dec: " << xy.Y() << "\xb0" << endl; 962 962 /*#ifdef EXPERT … … 1105 1105 StopMovement(); 1106 1106 1107 lout << sla << " - Tracking stopped." << endl;1107 lout << sla.GetTime() << " - Tracking stopped." << endl; 1108 1108 } 1109 1109 … … 2184 2184 fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1); 2185 2185 } 2186 2186 /* 2187 2187 void MCosy::ConstructorSE(Int_t id4, Int_t id5, Int_t id6) 2188 2188 { … … 2231 2231 fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1); 2232 2232 } 2233 2234 MCosy::MCosy( int mode,const char *dev, const int baud, MLog &out)2233 */ 2234 MCosy::MCosy(/*int mode,*/ const char *dev, const int baud, MLog &out) 2235 2235 : Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(MDriveCom::kStopped) 2236 2236 { … … 2242 2242 const Int_t id5 = env.GetValue("Zd_Id-SE2", 5); //5 2243 2243 const Int_t id6 = env.GetValue("Az_Id-SE", 6); //6 2244 2244 /* 2245 2245 lout << "- Program in "; 2246 2246 switch (mode) 2247 2247 { 2248 2248 case 0: 2249 lout << "<<Standard mode>>" << endl; 2249 lout << "<<Standard mode>>" << endl;*/ 2250 2250 fBending.Load("bending.txt"); 2251 Constructor(id1, id2, id3, id4, id5, id6); 2251 Constructor(id1, id2, id3, id4, id5, id6);/* 2252 2252 break; 2253 2253 case 1: … … 2260 2260 ConstructorDemo(); 2261 2261 } 2262 2262 */ 2263 2263 lout.SetOutputGui(fWin->GetLog(), kTRUE); 2264 2264 … … 2267 2267 fAz->SetDisplay(fWin->GetLabel1()); 2268 2268 2269 int i=0; 2270 char name[100]; 2269 // 2270 // open tpoint file 2271 // 2272 MTime time; 2273 TString name; 2271 2274 while (1) 2272 2275 { 2273 sprintf(name, "tpoint/tpoint%03d.txt", i++); 2276 time.Now(); 2277 name = Form("tpoint/tpoint_%s.txt", (const char*)time.GetFileName()); 2274 2278 if (gSystem->AccessPathName(name, kFileExists)) 2275 2279 break; 2276 2280 } 2277 2278 Timer time;2279 time.Now();2280 2281 2281 2282 cout << "TPoint File ********* " << name << " ********** " << endl; -
trunk/MagicSoft/Cosy/main/MCosy.h
r2518 r2615 168 168 169 169 void Constructor(Int_t id1, Int_t id2, Int_t id3, Int_t id4, Int_t id5, Int_t id6); 170 void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);171 void ConstructorDemo();170 //void ConstructorSE(Int_t id1, Int_t id2, Int_t id3); 171 //void ConstructorDemo(); 172 172 173 173 void ReadConfig(); … … 176 176 177 177 public: 178 MCosy( int mode,const char *dev, const int baud, MLog &out=gLog);178 MCosy(/*int mode,*/ const char *dev, const int baud, MLog &out=gLog); 179 179 ~MCosy(); 180 180 -
trunk/MagicSoft/Cosy/main/MStarguider.cc
r2613 r2615 839 839 static unsigned long n0 = n; 840 840 841 Timer t(tm);841 MTime t(*tm); 842 842 843 843 const Double_t d = t-fTime; … … 894 894 if (fDisplay->IsEntryChecked(IDM_kCatalog)) 895 895 { 896 Timer time(tm);896 MTime time(*tm); 897 897 898 898 XY xy = fCRaDec->GetCoordinates(); … … 934 934 if (fDisplay->IsEntryChecked(IDM_kCatalog)) 935 935 { 936 // FIXME: Necessary? 936 937 fSao->Now(); 937 938 AltAz aa = fSao->CalcAltAzFromPix(fDx, fDy)*kRad2Deg; -
trunk/MagicSoft/Cosy/main/MStarguider.h
r2278 r2615 5 5 #include <TGFrame.h> 6 6 #endif 7 7 8 #include "PixClient.h" 9 8 10 #ifndef MARS_MObservatory 9 11 #include "MObservatory.h" 12 #endif 13 14 #ifndef MARS_MTime 15 #include "MTime.h" 10 16 #endif 11 17 … … 14 20 15 21 #include "coord.h" 16 #include "timer.h"17 22 18 23 class TArrayF; … … 76 81 77 82 TTimer *fTimer; 78 TimerfTime;83 MTime fTime; 79 84 80 85 Int_t fDx;
Note:
See TracChangeset
for help on using the changeset viewer.