Changeset 3666 for trunk/MagicSoft/Mars/mastro
- Timestamp:
- 04/06/04 13:41:56 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mastro
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstro.cc
r3596 r3666 85 85 Double_t MAstro::Dms2Hor(Int_t deg, UInt_t min, Double_t sec, Char_t sgn) 86 86 { 87 return Hms2Sec(deg, min, sec, sgn)/ 15.;87 return Hms2Sec(deg, min, sec, sgn)/54000.; 88 88 } 89 89 -
trunk/MagicSoft/Mars/mastro/MAstroCamera.cc
r3568 r3666 148 148 149 149 // -------------------------------------------------------------------------- 150 void MAstroCamera::AddPrimitives(Option_t *o) 150 // 151 // Options: 152 // 153 // '*' Draw the mean of the reflections on all mirrors 154 // '.' Draw a dot for the reflection on each mirror 155 // 156 void MAstroCamera::AddPrimitives(TString o) 151 157 { 152 158 if (!fTime || !fObservatory || !fMirrors) … … 156 162 } 157 163 158 TString opt(o); 159 if (opt.IsNull()) 160 opt = "*."; 161 162 const Bool_t hashist = opt.Contains("h", TString::kIgnoreCase); 163 const Bool_t hasmean = opt.Contains("*", TString::kIgnoreCase); 164 const Bool_t hasdot = opt.Contains(".", TString::kIgnoreCase); 165 const Bool_t usecam = opt.Contains("c", TString::kIgnoreCase); 164 if (o.IsNull()) 165 o = "*."; 166 167 const Bool_t hashist = o.Contains("h", TString::kIgnoreCase); 168 const Bool_t hasmean = o.Contains("*", TString::kIgnoreCase); 169 const Bool_t hasdot = o.Contains(".", TString::kIgnoreCase); 170 const Bool_t usecam = o.Contains("c", TString::kIgnoreCase); 166 171 167 172 // Get camera -
trunk/MagicSoft/Mars/mastro/MAstroCamera.h
r3568 r3666 22 22 23 23 Int_t ConvertToPad(const TVector3 &w, TVector2 &v) const; 24 void AddPrimitives( Option_t *o);25 void SetRangePad( ) { }24 void AddPrimitives(TString o); 25 void SetRangePad(Option_t *o) { } 26 26 void ExecuteEvent(Int_t event, Int_t mp1, Int_t mp2); 27 27 -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
r3571 r3666 147 147 MAstroCatalog::~MAstroCatalog() 148 148 { 149 if (fTime) 150 delete fTime; 151 if (fObservatory) 152 delete fObservatory; 153 154 fToolTip->Hide(); 155 delete fToolTip; 156 157 DeleteMap(); 158 149 // First disconnect the EventInfo... 159 150 // FIXME: There must be an easier way! 160 151 TIter Next(gROOT->GetListOfCanvases()); … … 164 155 "EventInfo(Int_t,Int_t,Int_t,TObject*)"); 165 156 157 // Now delete the data members 158 if (fTime) 159 delete fTime; 160 if (fObservatory) 161 delete fObservatory; 162 163 fToolTip->Hide(); 164 delete fToolTip; 165 166 DeleteMap(); 166 167 } 167 168 … … 438 439 void MAstroCatalog::Paint(Option_t *o) 439 440 { 440 SetRangePad( );441 SetRangePad(o); 441 442 442 443 if (TestBit(kHasChanged)) 443 444 DrawPrimitives(o); 445 446 PaintMap(); 444 447 } 445 448 … … 458 461 459 462 // draw star on the camera display 460 TMarker *tip=new TMarker(x, y, transparent ? kDot : kFullDot Large);;463 TMarker *tip=new TMarker(x, y, transparent ? kDot : kFullDotMedium);; 461 464 tip->SetMarkerColor(kBlack); 462 465 AddMap(tip, new TString(str)); … … 517 520 w *= 1./w(2); 518 521 519 w *= TMath::RadToDeg(); 520 v.Set(w(0), w(1)); 522 w *= TMath::RadToDeg(); // FIXME: *conversion factor? 523 v.Set(TestBit(kMirrorX) ? -w(0) : w(0), 524 TestBit(kMirrorY) ? -w(1) : w(1)); 521 525 522 526 if (w(2)<0) 523 527 return kERROR; 524 528 525 return w(0)>gPad->GetX1() && w(1)>gPad->GetY1() &&526 w(0)<gPad->GetX2() && w(1)<gPad->GetY2();529 return v.X()>gPad->GetX1() && v.Y()>gPad->GetY1() && 530 v.X()<gPad->GetX2() && v.Y()<gPad->GetY2(); 527 531 } 528 532 … … 610 614 dx[0] = d[0]+dirs[i][0]; 611 615 dy[0] = d[1]+dirs[i][1]; 612 613 //cout << dx[0] << " " << dy[0] << endl;614 616 615 617 // Draw corresponding line and iterate through grid … … 756 758 757 759 txt.Prepend("#splitline{"); 758 759 txt += Form(" \\theta=%.1fh ", fmod(zd+270,180)-90); 760 txt += Form("\\phi=%.1f\\circ ", fmod(az+720, 360)); 761 txt += Form(" / \\rho=%.1f\\circ", rho*TMath::RadToDeg()); 760 txt += Form(" \\theta=%.1f\\circ ", fmod(zd+270,180)-90); 761 txt += Form("\\phi=%.1f\\circ ", fmod(az+720, 360)); 762 txt += Form(" / \\rho=%.1f\\circ", rho*TMath::RadToDeg()); 762 763 txt += "}{<"; 763 764 txt += fTime->GetSqlDateTime(); … … 767 768 768 769 // -------------------------------------------------------------------------- 769 void MAstroCatalog::AddPrimitives(Option_t *o) 770 { 771 const Bool_t local = TString(o).Contains("local", TString::kIgnoreCase); 772 773 cout << "Opt: " << o << endl; 770 // 771 // To overlay the catalog make sure, that in any case you are using 772 // the 'same' option. 773 // 774 // If you want to overlay this on top of any picture which is created 775 // by derotation of the camera plain you have to use the 'mirror' option 776 // the compensate the mirroring of the image in the camera plain. 777 // 778 // If you have already compensated this by x=-x and y=-y when creating 779 // the histogram you can simply overlay the catalog. 780 // 781 // To overlay the catalog on a 2D histogram the histogram must have 782 // units of degrees (which are plain, like you directly convert the 783 // camera units by multiplication to degrees) 784 // 785 // To be 100% exact you must use the option 'plain' which assumes a plain 786 // screen. This is not necessary for the MAGIC-camera because the 787 // difference between both is less than 1e-3. 788 // 789 // You should always be aware of the fact, that the shown stars and the 790 // displayed grid is the ideal case, like a reflection on a virtual 791 // perfectly aligned central mirror. In reality the star-positions are 792 // smeared to the edge of the camera the more the distance to the center 793 // is, such that the center of gravity of the light distribution might 794 // be more far away from the center than the display shows. 795 // 796 // 797 void MAstroCatalog::AddPrimitives(TString o) 798 { 799 const Bool_t same = o.Contains("same", TString::kIgnoreCase); 800 const Bool_t local = o.Contains("local", TString::kIgnoreCase); 801 const Bool_t mirx = o.Contains("mirrorx", TString::kIgnoreCase); 802 const Bool_t miry = o.Contains("mirrory", TString::kIgnoreCase); 803 const Bool_t mirror = o.Contains("mirror", TString::kIgnoreCase) && !mirx && !miry; 804 805 // X is vice versa, because ra is defined anti-clockwise 806 mirx || mirror ? ResetBit(kMirrorX) : SetBit(kMirrorX); 807 miry || mirror ? SetBit(kMirrorY) : ResetBit(kMirrorY); 774 808 775 809 const TRotation rot(GetGrid(local)); … … 782 816 TVector2 s(v->Phi(), v->Theta()); 783 817 if (Convert(rot, s)==kTRUE) 784 DrawStar(s.X(), -(TMath::Pi()/2-s.Y()), *v, kFALSE); 785 } 786 787 TPaveText *pv = new TPaveText(0.01, 0.90, 0.63, 0.99, "brNDC"); 788 pv->AddText(GetPadTitle()); 789 AddMap(pv); 818 DrawStar(s.X(), s.Y(), *v, kFALSE); 819 } 820 821 if (!same) 822 { 823 TPaveText *pv = new TPaveText(0.01, 0.90, 0.63, 0.99, "brNDC"); 824 pv->AddText(GetPadTitle()); 825 AddMap(pv); 826 } 790 827 791 828 TMarker *mk=new TMarker(0, 0, kMultiply); … … 796 833 797 834 // -------------------------------------------------------------------------- 798 void MAstroCatalog::SetRangePad() 799 { 800 const Double_t edge = fRadiusFOV/TMath::Sqrt(2.); 801 gPad->Range(-edge, -edge, edge, edge); 802 803 const Float_t w = gPad->GetWw(); 804 const Float_t h = gPad->GetWh(); 805 806 if (w<h) 807 gPad->Range(-edge, -edge*h/w, edge, edge*h/w); 808 else 809 gPad->Range(-edge*w/h, -edge, edge*w/h, edge); 835 void MAstroCatalog::SetRangePad(Option_t *o) 836 { 837 if (TString(o).Contains("same", TString::kIgnoreCase)) 838 return; 839 840 const Double_t edge = fRadiusFOV/TMath::Sqrt(2.); 841 gPad->Range(-edge, -edge, edge, edge); 842 843 const Float_t w = gPad->GetWw(); 844 const Float_t h = gPad->GetWh(); 845 846 if (w<h) 847 gPad->Range(-edge, -edge*h/w, edge, edge*h/w); 848 else 849 gPad->Range(-edge*w/h, -edge, edge*w/h, edge); 810 850 } 811 851 … … 815 855 DeleteMap(); 816 856 817 SetRangePad( );857 SetRangePad(o); 818 858 819 859 TStopwatch clk; … … 827 867 AppendPad(o); 828 868 829 // Append all objects to pad830 DrawMap();831 832 869 ResetBit(kHasChanged); 833 870 } 834 871 835 872 // -------------------------------------------------------------------------- 836 void MAstroCatalog:: DrawMap()873 void MAstroCatalog::PaintMap() 837 874 { 838 875 Long_t key, val; 839 876 TExMapIter map(&fMapG); 840 877 while (map.Next(key, val)) 841 ((TObject*)key)-> Draw();878 ((TObject*)key)->Paint(); 842 879 } 843 880 … … 1016 1053 fToolTip->Show(x+4, y+4); 1017 1054 } 1055 /* 1056 void MAstroCatalog::RecursiveRemove(TObject *obj) 1057 { 1058 ULong_t hash; 1059 Long_t key, val; 1060 1061 TExMapIter map(&fMapG); 1062 while (map.Next(hash, key, val)) 1063 { 1064 if (key != (Long_t)obj) 1065 continue; 1066 1067 fMapG.Remove(hash, key); 1068 delete (TObject*)(key); 1069 if (val) 1070 delete (TString*)(val); 1071 break; 1072 } 1073 } 1074 */ -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.h
r3568 r3666 94 94 95 95 virtual Int_t ConvertToPad(const TVector3 &w, TVector2 &v) const; 96 virtual void AddPrimitives( Option_t *o);97 virtual void SetRangePad( );96 virtual void AddPrimitives(TString o); 97 virtual void SetRangePad(Option_t *o); 98 98 99 99 Int_t Convert(const TRotation &rot, TVector2 &v) const; … … 105 105 void Paint(Option_t *o=""); 106 106 Int_t DistancetoPrimitive(Int_t px, Int_t py); 107 void DrawMap(); 107 //void RecursiveRemove(TObject *obj); 108 void PaintMap(); 108 109 void DeleteMap() 109 110 { … … 117 118 118 119 delete (TString*)(val); 119 /* 120 Long_t key2, val2; 121 TExMapIter map2(&fMapG); 122 while (map2.Next(key2, val2)) 123 if (val==val2) 124 { 125 delete (TObject*)key; 126 fMapG.Remove(key); 127 }*/ 120 /* 121 Long_t key2, val2; 122 TExMapIter map2(&fMapG); 123 while (map2.Next(key2, val2)) 124 if (val==val2) 125 { 126 delete (TObject*)key; 127 fMapG.Remove(key); 128 } 129 */ 128 130 } 129 131 fMapG.Delete(); … … 134 136 kHasChanged = BIT(15), 135 137 kGuiActive = BIT(16), 136 kPlainScreen = BIT(17) 138 kPlainScreen = BIT(17), 139 kMirrorX = BIT(18), 140 kMirrorY = BIT(19) 137 141 }; 138 142 … … 140 144 MVector3 fRaDec; // pointing position 141 145 142 MObservatory *fObservatory; // Possible obervator alocation146 MObservatory *fObservatory; // Possible obervatory location 143 147 MTime *fTime; // Possible observation time 144 148 … … 153 157 void AddMap(TObject *k, void *v=0) 154 158 { 155 k->SetBit(kCanDelete);156 k->SetBit(kCannotPick);159 //k->SetBit(kCanDelete); 160 //k->SetBit(kCannotPick); 157 161 fMapG.Add(fMapG.GetSize(), (Long_t)k, (Long_t)v); 158 162 } … … 164 168 void SetTime(const MTime &time); 165 169 void SetObservatory(const MObservatory &obs); 166 void SetLimMag(Double_t mag) { fLimMag=mag; 170 void SetLimMag(Double_t mag) { fLimMag=mag; Update(); } // *MENU* *ARGS={mag=>fLimMag} 167 171 void SetRadiusFOV(Double_t deg) 168 172 {
Note:
See TracChangeset
for help on using the changeset viewer.