Changeset 6338 for trunk/MagicSoft/Mars/mgeom
- Timestamp:
- 02/10/05 10:26:39 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mgeom
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgeom/MGeomCam.cc
r5429 r6338 53 53 54 54 #include <TClass.h> // IsA()->New() 55 #include <TArrayI.h> // TArrayI 55 56 #include <TVector2.h> // TVector2 56 57 … … 69 70 // 70 71 MGeomCam::MGeomCam() 71 : fNumPixels(0), fCamDist(0), fConvMm2Deg(0), fMaxRadius(1), fMinRadius(1)72 : fNumPixels(0), fCamDist(0), fConvMm2Deg(0), /*fPixels(1000),*/ fMaxRadius(1), fMinRadius(1) 72 73 { 73 74 fName = "MGeomCam"; … … 302 303 MGeomCam *cam = new MGeomCam(fNumPixels, fCamDist); 303 304 for (UInt_t i=0; i<fNumPixels; i++) 304 (*this)[i].Copy((*cam)[i]); 305 { 306 //if (fPixels.UncheckedAt(i)) 307 (*this)[i].Copy((*cam)[i]); 308 } 305 309 cam->InitGeometry(); 306 310 return cam; … … 335 339 } 336 340 337 /* 338 void MGeomCam::Streamer(TBuffer &R__b) 339 { 340 // Stream an object of class MGeomCam. 341 342 if (R__b.IsReading()) 343 { 344 MGeomCam::Class()->ReadBuffer(R__b, this); 345 346 UInt_t R__s, R__c; 347 Version_t R__v = b.ReadVersion(&R__s, &R__c); 348 if (R__v > 2) { 349 MGeomCam::Class()->ReadBuffer(b, this, R__v, R__s, R__c); 350 351 Version_t v = MGeomCam::Class()->GetClassVersion(); 352 } 353 else 354 { 355 MGeomCam::Class()->WriteBuffer(R__b, this); 356 } 357 } 358 */ 341 // -------------------------------------------------------------------------- 342 // 343 // Add all indices to arr of all neighbors around pix in a radius r. 344 // The center pixel is also returned. 345 // 346 void MGeomCam::GetNeighbors(TArrayI &arr, const MGeomPix &pix, Float_t r) const 347 { 348 arr.Set(GetNumPixels()); 349 350 Int_t n = 0; 351 352 for (unsigned int i=0; i<GetNumPixels(); i++) 353 { 354 if (r>TMath::Hypot(pix.GetX()-(*this)[i].GetX(), pix.GetY()-(*this)[i].GetY())) 355 arr[n++] = i; 356 } 357 358 arr.Set(n); 359 } 360 361 // -------------------------------------------------------------------------- 362 // 363 // Add all indices to arr of all neighbors around idx in a radius r. 364 // The center pixel is also returned. 365 // 366 void MGeomCam::GetNeighbors(TArrayI &arr, UInt_t idx, Float_t r) const 367 { 368 if (idx>=GetNumPixels()) 369 { 370 arr.Set(0); 371 return; 372 } 373 374 375 const MGeomPix &pix = (*this)[idx]; 376 GetNeighbors(arr, pix, r); 377 } 378 379 // -------------------------------------------------------------------------- 380 // 381 // Add all pixels to list of all neighbors around pix in a radius r. 382 // The center pixel is also returned. 383 // 384 void MGeomCam::GetNeighbors(TList &arr, const MGeomPix &pix, Float_t r) const 385 { 386 for (unsigned int i=0; i<GetNumPixels(); i++) 387 { 388 if (r>TMath::Hypot(pix.GetX()-(*this)[i].GetX(), pix.GetY()-(*this)[i].GetY())) 389 arr.Add(fPixels.UncheckedAt(i)); 390 } 391 } 392 393 // -------------------------------------------------------------------------- 394 // 395 // Add all pixels to list of all neighbors around idx in a radius r. 396 // The center pixel is also returned. 397 // 398 void MGeomCam::GetNeighbors(TList &arr, UInt_t idx, Float_t r) const 399 { 400 if (idx>=GetNumPixels()) 401 return; 402 403 const MGeomPix &pix = (*this)[idx]; 404 GetNeighbors(arr, pix, r); 405 } -
trunk/MagicSoft/Mars/mgeom/MGeomCam.h
r5429 r6338 13 13 14 14 class TVector2; 15 class TArrayI; 15 16 class MGeomPix; 16 17 … … 84 85 } 85 86 87 void GetNeighbors(TArrayI &arr, UInt_t idx, Float_t r) const; 88 void GetNeighbors(TList &arr, UInt_t idx, Float_t r) const; 89 void GetNeighbors(TArrayI &arr, const MGeomPix &pix, Float_t r) const; 90 void GetNeighbors(TList &arr, const MGeomPix &pix, Float_t r) const; 91 86 92 virtual void Print(Option_t *opt=NULL) const; 87 93
Note:
See TracChangeset
for help on using the changeset viewer.