Changeset 8756 for trunk/MagicSoft/Mars/mgeom
- Timestamp:
- 10/13/07 19:56:29 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mgeom
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r8399 r8756 473 473 GetNeighbors(arr, pix, r); 474 474 } 475 476 // -------------------------------------------------------------------------- 477 // 478 // Return direction of p2 w.r.t. p1. For more details 479 // see MGeomPix::GetDirection 480 // 481 Int_t MGeomCam::GetDirection(UInt_t p1, UInt_t p2) const 482 { 483 if (p1>fNumPixels || p2>fNumPixels) 484 return -1; 485 486 return operator[](p1).GetDirection(operator[](p2)); 487 } 488 489 // -------------------------------------------------------------------------- 490 // 491 // Get index of neighbor of pixel idx in direction dir, if existing. 492 // 493 Int_t MGeomCam::GetNeighbor(UInt_t idx, Int_t dir) const 494 { 495 if (idx>fNumPixels) 496 return -1; 497 498 const MGeomPix &pix=operator[](idx); 499 500 // 501 // search for the neighbor in the given direction 502 // 503 int i; 504 for (i=0; i<pix.GetNumNeighbors(); i++) 505 if (GetDirection(idx, pix.GetNeighbor(i))==dir) 506 return pix.GetNeighbor(i); 507 508 return -1; 509 } -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r8399 r8756 102 102 void GetNeighbors(TList &arr, const MGeomPix &pix, Float_t r) const; 103 103 104 Int_t GetDirection(UInt_t p1, UInt_t p2) const; 105 Int_t GetNeighbor(UInt_t idx, Int_t dir) const; 106 104 107 virtual void Print(Option_t *opt=NULL) const; 105 108 -
trunk/MagicSoft/Mars/mgeom/MGeomCamDwarf.cc
r8388 r8756 183 183 // distance to (0,0) is retruned. 184 184 // 185 // Due to possible rounding errors we need to use exactly the same 186 // algorithm as for creating the pixels! 187 // 185 188 Int_t MGeomCamDwarf::CalcNumPix(Double_t rad) 186 189 { … … 198 201 // starting number to the ending number 199 202 // 200 for (int i=0; i<ring; i++) 201 { 202 Double_t x, y; 203 if (CalcXY(kDirN, ring, i, x, y)<rad) 204 n++; 203 for (Int_t dir=kDirNE; dir<=kDirSE; dir++) 204 { 205 for (int i=0; i<ring; i++) 206 { 207 Double_t x, y; 208 if (CalcXY(dir, ring, i, x, y)<rad) 209 n++; 210 } 205 211 } 206 212 … … 209 215 210 216 ring++; 211 cnt += 6*n; // Because of symmetry only one direction is enough217 cnt += n; 212 218 } 213 219 … … 276 282 277 283 if (n==0) 284 { 285 cout << cnt << " pixels created of " << GetNumPixels() << endl; 278 286 return; 287 } 279 288 280 289 ring++; -
trunk/MagicSoft/Mars/mgeom/MGeomPix.cc
r7346 r8756 173 173 return kTRUE; 174 174 } 175 176 // ------------------------------------------------------------------------ 177 // 178 // Return the direction of the pixel pix w.r.t. this pixel. 179 // Remark: This function assumes a simple geometry. 180 // 181 Int_t MGeomPix::GetDirection(const MGeomPix &pix) const 182 { 183 const Double_t x1 = GetX(); 184 const Double_t y1 = GetY(); 185 186 const Double_t x2 = pix.GetX(); 187 const Double_t y2 = pix.GetY(); 188 189 if (x1>=x2 && y1>y2) return kRightTop; 190 if (x1>=x2 && y1<y2) return kRightBottom; 191 if (x1<=x2 && y1>y2) return kLeftTop; 192 if (x1<=x2 && y1<y2) return kLeftBottom; 193 if (x1>x2) return kRight; 194 if (x1<x2) return kLeft; 195 196 return -1; 197 } -
trunk/MagicSoft/Mars/mgeom/MGeomPix.h
r8385 r8756 13 13 static const Float_t gsTan60; // tan(60/kRad2Deg); 14 14 static const Float_t gsTan30; // tan(30/kRad2Deg); 15 16 enum { 17 kRightTop, 18 kRight, 19 kRightBottom, 20 kLeftBottom, 21 kLeft, 22 kLeftTop 23 }; 15 24 16 25 private: … … 68 77 Float_t GetAngle(const MGeomPix &pix) const { return TMath::ATan2(fX - pix.GetX(), fY - pix.GetY()); } 69 78 70 71 79 Float_t GetA() const { return fA; /*fD*fD*gsTan60/2;*/ } 72 80 Int_t GetAidx() const { return fAidx; } … … 79 87 80 88 Bool_t IsInside(Float_t px, Float_t py) const; 89 Int_t GetDirection(const MGeomPix &pix) const; 81 90 82 91 /*
Note:
See TracChangeset
for help on using the changeset viewer.