Changeset 3541 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 03/17/04 22:16:38 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r3497 r3541 97 97 { 98 98 fNumPixels = 0; 99 fMaxIndex = 0; 99 100 fLut.Set(0); 100 101 // fPixels->Delete(); … … 103 104 void MCerPhotEvt::FixSize() 104 105 { 105 fLut.Set(f NumPixels);106 fLut.Set(fMaxIndex); 106 107 107 108 if (fPixels->GetEntriesFast() == (Int_t)fNumPixels) … … 372 373 if (idx>=fLut.GetSize()) 373 374 return 0; 374 375 375 return fLut[idx]<0 ? 0 : (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])); 376 376 } … … 385 385 return NULL; 386 386 } 387 388 MCerPhotPix *MCerPhotEvt::AddPixel(Int_t idx, Float_t nph, Float_t er) 389 { 390 // 391 // If this is too slow or takes to much space we might use 392 // MGeomApply and an InitSize member function instead. 393 // 394 if (idx>=fLut.GetSize()) 395 { 396 const Int_t n = fLut.GetSize(); 397 fLut.Set(idx*2+1); //idx+1 is slower than idx*2+1 398 for (int i=n; i<idx*2+1; i++) 399 fLut[i] = -1; 400 } 401 402 fLut[idx] = fNumPixels; 403 if ((UInt_t)idx>fMaxIndex) 404 fMaxIndex=(UInt_t)idx; 405 406 return new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er); 407 } 387 408 388 409 // -------------------------------------------------------------------------- … … 399 420 { 400 421 MCerPhotPix *pix = GetPixById(idx); 422 401 423 if (!pix || !pix->IsPixelUsed()) 402 424 return kFALSE; -
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h
r3497 r3541 24 24 private: 25 25 UInt_t fNumPixels; 26 UInt_t fMaxIndex; 26 27 TArrayI fLut; // Lookup tabel to lookup pixel by index 27 28 TClonesArray *fPixels; //-> FIXME: Change TClonesArray away from a pointer? … … 34 35 //void InitSize(UInt_t num) { fPixels->Expand(num); } 35 36 36 MCerPhotPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0) 37 { 38 // 39 // If this is too slow or takes to much space we might use 40 // MGeomApply and an InitSize member function instead. 41 // 42 if (idx>=fLut.GetSize()) 43 { 44 const Int_t n = fLut.GetSize(); 45 fLut.Set(idx*2+1); //idx+1 is slower than idx*2+1 46 for (int i=n; i<idx*2+1; i++) 47 fLut[i] = -1; 48 } 49 50 fLut[idx] = fNumPixels; 51 return new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er); 52 } 37 MCerPhotPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0); 53 38 54 39 void FixSize();
Note:
See TracChangeset
for help on using the changeset viewer.