Changeset 1802 for trunk/MagicSoft
- Timestamp:
- 03/02/03 16:55:47 (22 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 5 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r1801 r1802 1 1 -*-*- END -*-*- 2 3 2003/03/02 - Daniela Dorner, Thomas Bretz (LaPalma): 4 5 * Makefile: 6 - removed dummy 7 - exchnged caos, candrv 8 - removed MCint.o 9 - added cosy.so 10 11 * starg.cc: 12 - echanged to use png reading mode 13 14 * caos/Led.[h,cc], caos/Leds.[h,cc], caos/Ring.[h,cc], 15 caos/Ring.[h,cc]: 16 - added Print 17 18 * caos/Led.h: 19 - added compare 20 - added issortable 21 22 * caos/Ring.cc: 23 - changed output 24 25 * caos/Rings.cc: 26 - fixed some minor bugs 27 28 * gui/GuiLinkDef.h, gui/Makefile; 29 - added MGPngReader.[h,cc] 30 31 * gui/MGPngReader.[h,cc]: 32 - added 33 34 * gui/MGStarguider.cc: 35 - release grabbed mouse 36 - removed ExitLoop 37 38 * gui/MGStarguider.h: 39 - changed derivement from Camera to PixClient 40 41 * videodev/Camera.[h,cc]: 42 - changed to use PixClient 43 44 * videodev/Makefile, videodev/VideodevLinkDef.h: 45 - added PixClient 46 47 * videodev/PixClient.[h,cc] 48 - added 49 50 51 2 52 2003/02/27 - Thomas Bretz (LaPalma): 3 53 -
trunk/MagicSoft/Cosy/Makefile
r1801 r1802 20 20 # 21 21 22 PROGRAMS = testse starg cosy dummy23 SOLIB = 22 PROGRAMS = testse cosy starg 23 SOLIB = cosy.so 24 24 CINT = M 25 25 INCLUDES = -I. -Imain -Ibase -Icandrv -Iincl -Igui -Ivideodev -Icatalog -Idevdrv … … 40 40 main \ 41 41 gui \ 42 caos \43 candrv \44 42 catalog \ 45 43 videodev \ 46 44 devdrv \ 45 candrv \ 46 caos \ 47 47 base \ 48 48 slalib … … 75 75 $(CXX) $(CXXFLAGS) $(LIBS) $(OBJS) $@.o $(MARS_LIB) $(ROOTGLIBS) -o $@ 76 76 77 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) MCint.o77 $(SOLIB): $(LIBRARIES) $(OBJS) $(HEADERS) 78 78 @echo " Linking $(SOLIB) ..." 79 79 $(CXX) -shared $(CXXFLAGS) $(SUBDIRS:=/*.o) $(ROOTGLIBS) -o $@ -
trunk/MagicSoft/Cosy/caos/Led.cc
r1798 r1802 1 1 #include "Led.h" 2 2 3 #include <iostream.h> 3 4 #include <TMath.h> 4 5 … … 11 12 fPhi = TMath::ATan2(fY-ring.GetY(), fX-ring.GetX())*180/TMath::Pi(); 12 13 } 14 15 void Led::Print(Option_t *o=NULL) const 16 { 17 cout << "Led: "; 18 cout << "x=" << fX << "+-" << fDx << ", "; 19 cout << "y=" << fY << "+-" << fDy << ", "; 20 cout << "phi=" << fPhi << "+-" << fDphi << ", "; 21 cout << "mag=" << fMag << endl; 22 } -
trunk/MagicSoft/Cosy/caos/Led.h
r1798 r1802 27 27 } 28 28 29 Double_t GetX() const { return fX; } 30 Double_t GetY() const { return fY; } 31 Double_t GetDx() const { return fDx; } 32 Double_t GetDy() const { return fDy; } 33 Double_t GetMag() const { return fMag; } 29 Int_t Compare(const TObject *obj) const 30 { 31 const Led *const l = (Led*)obj; 32 33 if (fPhi<l->fPhi) 34 return -1; 35 36 if (fPhi>l->fPhi) 37 return 1; 38 39 return 0; 40 } 41 42 Double_t GetX() const { return fX; } 43 Double_t GetY() const { return fY; } 44 Double_t GetDx() const { return fDx; } 45 Double_t GetDy() const { return fDy; } 46 Double_t GetPhi() const { return fPhi; } 47 Double_t GetDphi() const { return fDphi; } 48 Double_t GetMag() const { return fMag; } 49 50 Bool_t IsSortable() const { return kTRUE; } 34 51 35 52 void CalcPhi(const Ring &ring); 53 54 void Print(Option_t *o=NULL) const; 36 55 37 56 ClassDef(Led, 1) -
trunk/MagicSoft/Cosy/caos/Leds.cc
r1798 r1802 1 1 #include "Leds.h" 2 3 #include <iostream.h> 2 4 3 5 #include "Led.h" … … 9 11 new ((*this)[i]) Led(x, y, dx, dy, mag); 10 12 } 13 14 void Leds::Print(Option_t *o=NULL) const 15 { 16 cout << "Number of Leds: " << GetEntries() << endl; 17 TClonesArray::Print(); 18 } -
trunk/MagicSoft/Cosy/caos/Leds.h
r1798 r1802 10 10 class Leds : public TClonesArray 11 11 { 12 private:13 12 public: 14 13 Leds() : TClonesArray("Led", 1) {} … … 27 26 Led &operator()(int i) { return *(Led*)((*(Leds*)this)[i]); } 28 27 28 void Print(Option_t *o=NULL) const; 29 29 30 ClassDef(Leds, 1) 30 31 }; -
trunk/MagicSoft/Cosy/caos/Ring.cc
r1798 r1802 20 20 if (h1==0) 21 21 { 22 23 22 cout << "h1==0" <<endl; 23 return kFALSE; 24 24 } 25 25 } … … 38 38 } 39 39 40 Float_t w1 = leds(i).GetX() - leds(j).GetX();41 Float_t w2 = leds(j).GetX() - leds(k).GetX();40 const Float_t w1 = leds(i).GetX() - leds(j).GetX(); 41 const Float_t w2 = leds(j).GetX() - leds(k).GetX(); 42 42 43 Float_t m1 = -w1/h1;44 Float_t m2 = -w2/h2;43 const Float_t m1 = -w1/h1; 44 const Float_t m2 = -w2/h2; 45 45 46 46 if (m2-m1==0) 47 47 { 48 cout << " m2-m1==0" << endl;48 cout << "All three points in a row! (m2-m1==0)" << endl; 49 49 return kFALSE; 50 50 } … … 66 66 fR = 0; 67 67 68 fDx=0; 69 fDy=0; 70 fDr=0; 71 72 if (n<1) 73 return; 74 68 75 for (int i=0; i<n; i++) 69 76 { 70 const Ring &ring = *(Ring*)((Rings&)rings)[i];77 const Ring &ring = rings(i); 71 78 72 79 fX += ring.GetX(); … … 79 86 fR /= n; 80 87 88 if (n<2) 89 return; 90 81 91 // 82 92 // deviation of x- and y coordinate and radius 83 93 // 84 Float_t sumx=0;85 Float_t sumy=0;86 Float_t sumr=0;87 88 94 for (int i=0; i<n; i++) 89 95 { 90 const Ring &ring = *(Ring*)((Rings&)rings)[i];96 const Ring &ring = rings(i); 91 97 92 sumx += sqr(ring.GetX()-fX);93 sumy += sqr(ring.GetY()-fY);94 sumr += sqr(ring.GetR()-fR);98 fDx += sqr(ring.GetX()-fX); 99 fDy += sqr(ring.GetY()-fY); 100 fDr += sqr(ring.GetR()-fR); 95 101 } 96 102 97 fDx=sqrt(sumx)/(n-1); 98 fDy=sqrt(sumy)/(n-1); 99 fDr=sqrt(sumr)/(n-1); 100 103 fDx=sqrt(fDx)/(n-1); 104 fDy=sqrt(fDy)/(n-1); 105 fDr=sqrt(fDr)/(n-1); 101 106 } 102 107 108 void Ring::Print(Option_t *o=NULL) const 109 { 110 cout << "Ring: "; 111 cout << "x=" << fX << "+-" << fDx << ", "; 112 cout << "y=" << fY << "+-" << fDy << ", "; 113 cout << "r=" << fR << "+-" << fDr << ", "; 114 cout << "phi=" << fPhi << "+-" << fDphi << endl; 115 } 116 -
trunk/MagicSoft/Cosy/caos/Ring.h
r1798 r1802 41 41 void InterpolCenters(const Rings &rings); 42 42 43 void Print(Option_t *o=NULL) const; 44 43 45 ClassDef(Ring, 1) 44 46 }; -
trunk/MagicSoft/Cosy/caos/Rings.cc
r1798 r1802 1 1 #include "Rings.h" 2 3 #include <iostream.h> 2 4 3 5 #include "Led.h" … … 6 8 ClassImp(Rings); 7 9 8 Int_tRings::CalcCenters(const Leds &leds)10 void Rings::CalcCenters(const Leds &leds) 9 11 { 10 12 int nPoints = leds.GetEntries(); … … 15 17 for (int k=j+1; k<nPoints; k++) 16 18 { 17 Ring &ring = * (Ring*)(*this)[n];19 Ring &ring = *new ((*this)[n]) Ring; 18 20 19 ring.CalcCenter(leds, i, j, k); 21 if (!ring.CalcCenter(leds, i, j, k)) 22 { 23 RemoveAt(n); 24 continue; 25 } 20 26 21 27 n++; 22 28 } 23 return n; 29 30 Expand(n); 24 31 } 25 32 … … 31 38 32 39 // 33 // angles v and relative angle w40 // angles v 34 41 // 35 for (int j=0; j<leds.GetEntries(); j++) 42 const int n=leds.GetEntries(); 43 44 for (int j=0; j<n; j++) 36 45 leds(j).CalcPhi(fCenter); 37 46 } 47 48 void Rings::Print(Option_t *o=NULL) const 49 { 50 cout << "Number of Rings: " << GetEntries() << endl; 51 TClonesArray::Print(); 52 cout << "Center: " << endl; 53 fCenter.Print(); 54 } -
trunk/MagicSoft/Cosy/caos/Rings.h
r1798 r1802 17 17 Ring fCenter; 18 18 19 Int_tCalcCenters(const Leds &leds);19 void CalcCenters(const Leds &leds); 20 20 21 21 public: 22 22 Rings() : TClonesArray("Ring", 1) {} 23 23 24 //25 // rings.CalcRings(leds);26 //27 24 void CalcRings(Leds &leds); 25 26 void Print(Option_t *o=NULL) const; 27 28 const Ring &operator()(int i) const { return *(Ring*)((*(Rings*)this)[i]); } 29 Ring &operator()(int i) { return *(Ring*)((*(Rings*)this)[i]); } 30 31 const Ring &GetCenter() const { return fCenter; } 28 32 29 33 ClassDef(Rings, 1) -
trunk/MagicSoft/Cosy/gui/GuiLinkDef.h
r1109 r1802 19 19 #pragma link C++ class MGCosy+; 20 20 #pragma link C++ class MGStarguider+; 21 #pragma link C++ class MGPngReader+; 21 22 22 23 #endif -
trunk/MagicSoft/Cosy/gui/MGStarguider.cc
r1758 r1802 73 73 74 74 MGStarguider::MGStarguider(MObservatory::LocationName_t key) 75 : Camera(),TGMainFrame(gClient->GetRoot(), 768, 700), fObservatory(key), fDx((768-kZOOM)/2), fDy((512-kZOOM)/2)76 { 77 gVirtualX->GrabButton(fId, kButton2, /*kButtonPressMask|kButtonReleaseMask|*/kNone, kNone, kNone, kNone);75 : TGMainFrame(gClient->GetRoot(), 768, 700), fObservatory(key), fDx((768-kZOOM)/2), fDy((512-kZOOM)/2) 76 { 77 gVirtualX->GrabButton(fId, kButton2, 0, 0, 0, 0, kTRUE); 78 78 79 79 … … 233 233 MGStarguider::~MGStarguider() 234 234 { 235 gVirtualX->GrabButton(0, kButton2, 0, 0, 0, 0, kFALSE); 236 235 237 fTimer->TurnOff(); 236 238 delete fTimer; … … 252 254 cout << "EventDisplay::CloseWindow: Exit Application Loop." << endl; 253 255 254 ExitLoop(); 256 /*ExitLoop();*/ 257 //cout << "FIXME: ExitLoop not called!!!!!!" << endl; 255 258 256 259 gSystem->ExitLoop(); -
trunk/MagicSoft/Cosy/gui/MGStarguider.h
r1758 r1802 5 5 #include <TGFrame.h> 6 6 #endif 7 #ifndef CAMERA_H 8 #include "Camera.h" 9 #endif 7 #include "PixClient.h" 10 8 11 9 #include "MGList.h" … … 31 29 class MStarList; 32 30 33 class MGStarguider : public Camera, public TGMainFrame31 class MGStarguider : public PixClient, public TGMainFrame 34 32 { 35 33 private: -
trunk/MagicSoft/Cosy/gui/Makefile
r1110 r1802 21 21 22 22 INCLUDES = -I. -I.. -I../base -I../slalib -I../candrv -I../incl \ 23 -I../catalog -I../videodev -I../main 23 -I../catalog -I../videodev -I../main -I../caos 24 24 25 25 # @code … … 40 40 MGVelocity.cc \ 41 41 MGStarguider.cc \ 42 MGSkyPosition.cc 42 MGPngReader.cc \ 43 MGSkyPosition.cc \ 44 MGMenu.cc 43 45 44 46 SRCS = $(SRCFILES) -
trunk/MagicSoft/Cosy/starg.cc
r1758 r1802 1 #include <iostream.h>2 3 1 #include <TROOT.h> 4 2 #include <TApplication.h> 5 3 4 #include <iostream.h> 5 6 6 #include "MGStarguider.h" 7 #include "MGPngReader.h" 8 #include "Camera.h" 9 #include "PngReader.h" 10 #include "PixClient.h" 7 11 8 12 /* ---------------------------------------------------------------------- */ … … 16 20 TApplication *app=new TApplication("Starguider", &argc, argv); 17 21 18 MGStarguider starg(MObservatory::kMagic1);22 Bool_t dummy = kFALSE; 19 23 20 starg.Loop(0); 24 for (int i=0; i<argc; i++) 25 { 26 TString arg(argv[i]); 27 if (arg=="-d") 28 dummy = kTRUE; 29 } 21 30 22 app->Run(kTRUE); 31 PixClient *client=new MGPngReader(MObservatory::kMagic1); 32 33 if (dummy) 34 { 35 cout << " --> Starting in dummy-mode. <--" << endl; 36 PngReader *read=new PngReader(*client); 37 app->Run(kTRUE); 38 read->ExitLoop(); 39 delete read; 40 // delete client; 41 } 42 else 43 { 44 cout << " --> Starting in real-mode. <--" << endl; 45 //PixClient *client=new MGStarguider(MObservatory::kMagic1); 46 Camera *cam = new Camera(*client); 47 cam->Loop(0); 48 app->Run(kTRUE); 49 cam->ExitLoop(); 50 delete cam; 51 // delete client; 52 } 53 54 delete client; 55 56 57 cout << "Application end...." << endl; 23 58 24 59 cout << "Exit." << endl; -
trunk/MagicSoft/Cosy/videodev/Camera.cc
r1531 r1802 102 102 } 103 103 104 Camera::Camera( ) : fd(-1), iBufferSize(0)104 Camera::Camera(PixClient &client) : fd(-1), iBufferSize(0), fClient(client) 105 105 { 106 106 cout << "Starting thread..." << flush; … … 192 192 193 193 194 void Camera::ProcessFrame(const unsigned long n, byte *img,195 struct timeval *tm)196 {197 cout << "Img: " << n << " " << (void*)img << endl;198 }199 200 194 void *Camera::MapThread(void *arg) 201 195 { … … 251 245 break; 252 246 253 ProcessFrame(i, (byte*)fImg, &fTime);247 fClient.ProcessFrame(i, (byte*)fImg, &fTime); 254 248 i++; 255 249 } … … 258 252 { 259 253 LoopStep(i); 260 ProcessFrame(i, (byte*)fImg, &fTime);254 fClient.ProcessFrame(i, (byte*)fImg, &fTime); 261 255 i++; 262 256 } 263 257 264 258 LoopStep(i); 265 ProcessFrame(i, (byte*)fImg, &fTime);259 fClient.ProcessFrame(i, (byte*)fImg, &fTime); 266 260 i++; 267 261 -
trunk/MagicSoft/Cosy/videodev/Camera.h
r1266 r1802 14 14 #endif 15 15 16 17 typedef unsigned char byte; 16 #include "PixClient.h" 18 17 19 18 class Camera … … 51 50 pthread_cond_t fCond; 52 51 52 PixClient &fClient; 53 53 54 // 54 55 // Hardware dependant functions … … 74 75 75 76 public: 76 Camera( );77 Camera(PixClient &client); 77 78 virtual ~Camera(); 78 79 … … 96 97 // Execution of one frame - this function may be overloaded! 97 98 // 98 virtual void ProcessFrame(const unsigned long n,99 byte *img, struct timeval *tm);99 //virtual void ProcessFrame(const unsigned long n, 100 // byte *img, struct timeval *tm); 100 101 101 102 // -
trunk/MagicSoft/Cosy/videodev/Makefile
r1691 r1802 20 20 # @endcode 21 21 22 INCLUDES = -I. -I.. -I../incl -I../base -I /usr/X11R6/include22 INCLUDES = -I. -I.. -I../incl -I../base -I../caos -I/usr/X11R6/include 23 23 24 24 # @code … … 32 32 33 33 SRCFILES = Camera.cc \ 34 PngReader.cc \ 35 PixClient.cc \ 34 36 Filter.cc \ 35 37 Filter2.cc \ 38 CaosFilter.cc \ 36 39 Writer.cc 37 40 -
trunk/MagicSoft/Cosy/videodev/VideodevLinkDef.h
r1691 r1802 8 8 #pragma link C++ class Filter+; 9 9 #pragma link C++ class Filter2+; 10 #pragma link C++ class CaosFilter+; 10 11 11 12 #pragma link C++ class Camera+; 13 #pragma link C++ class PngReader+; 12 14 13 15 #endif
Note:
See TracChangeset
for help on using the changeset viewer.