Changeset 2409 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 10/20/03 17:44:51 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.cc
r2206 r2409 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@uni-sw.gwdg.de>19 ! Author(s): Harald Kornmayer 1/2001 (harald@mppmu.mpg.de)20 ! 21 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Author(s): Harald Kornmayer, 1/2001 20 ! 21 ! Copyright: MAGIC Software Development, 2000-2003 22 22 ! 23 23 ! 24 24 \* ======================================================================== */ 25 25 26 ///////////////////////////////////////////////////////////////////////////// 27 // 28 // MCerPhotEvt 29 // 30 // Class Version 1: 31 // - first version 32 // 33 // Class Version 2: 34 // - added fLut to accelerate GetPixById a lot 35 // 36 ///////////////////////////////////////////////////////////////////////////// 26 37 #include "MCerPhotEvt.h" 27 38 … … 33 44 34 45 #include "MLog.h" 46 #include "MLogManip.h" 35 47 36 48 #include "MGeomCam.h" … … 56 68 // This is not yet implemented like it should. 57 69 // 70 /* 58 71 void MCerPhotEvt::Draw(Option_t* option) 59 72 { … … 69 82 // disp->DrawPhotNum(this); 70 83 } 84 */ 71 85 72 86 // -------------------------------------------------------------------------- … … 77 91 { 78 92 fNumPixels = 0; 79 // fPixels->Delete(); 93 fLut.Set(0); 94 // fPixels->Delete(); 80 95 } 81 96 … … 109 124 Bool_t MCerPhotEvt::IsPixelExisting(Int_t id) const 110 125 { 111 const Int_t entries = fPixels->GetEntries(); 112 113 for (Int_t i=0; i<entries; i++) 114 { 115 if (id == (*this)[i].GetPixId()) 116 return kTRUE; 117 } 118 119 return kFALSE; 126 const MCerPhotPix *pix = GetPixById(id); 127 return pix ? kTRUE : kFALSE; 120 128 } 121 129 … … 126 134 Bool_t MCerPhotEvt::IsPixelUsed(Int_t id) const 127 135 { 128 const Int_t entries = fPixels->GetEntries(); 129 130 for (Int_t i=0; i<entries; i++) 131 { 132 const MCerPhotPix &pix = (*this)[i]; 133 if (!pix.IsPixelUsed()) 134 continue; 135 136 if (id == pix.GetPixId() && pix.IsPixelUsed()) 137 return kTRUE; 138 } 139 140 return kFALSE; 136 const MCerPhotPix *pix = GetPixById(id); 137 return pix ? pix->IsPixelUsed() : kFALSE; 141 138 } 142 139 … … 147 144 Bool_t MCerPhotEvt::IsPixelCore(Int_t id) const 148 145 { 149 const Int_t entries = fPixels->GetEntries(); 150 151 for (Int_t i=0; i<entries; i++) 152 { 153 const MCerPhotPix &pix = (*this)[i]; 154 if (!pix.IsPixelUsed()) 155 continue; 156 157 if (id == pix.GetPixId() && pix.IsPixelCore()) 158 return kTRUE; 159 } 160 161 return kFALSE; 146 const MCerPhotPix *pix = GetPixById(id); 147 return pix ? pix->IsPixelCore() : kFALSE; 162 148 } 163 149 … … 350 336 } 351 337 352 // --------------------------------------------------------------------------353 //354 // Return a pointer to the pixel with the requested id. NULL if it doesn't355 // exist.356 //357 MCerPhotPix *MCerPhotEvt::GetPixById(int id) const358 {359 TIter Next(fPixels);360 MCerPhotPix *pix = NULL;361 362 while ((pix=(MCerPhotPix*)Next()))363 if (pix->GetPixId()==id)364 return pix;365 366 return NULL;367 }368 369 void MCerPhotEvt::Scale(Double_t f)370 {371 fPixels->ForEach(MCerPhotPix, Scale)(f);372 }373 374 338 void MCerPhotEvt::RemoveUnusedPixels() 375 339 { … … 383 347 fPixels->Compress(); 384 348 fNumPixels=fPixels->GetEntriesFast(); 349 } 350 351 // -------------------------------------------------------------------------- 352 // 353 // Return a pointer to the pixel with the requested id. NULL if it doesn't 354 // exist. 355 // 356 MCerPhotPix *MCerPhotEvt::GetPixById(int idx) const 357 { 358 if (fLut.GetSize()>0) 359 return idx>=0 && idx<fLut.GetSize() ? (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])) : 0; 360 361 TIter Next(fPixels); 362 MCerPhotPix *pix = NULL; 363 364 while ((pix=(MCerPhotPix*)Next())) 365 if (pix->GetPixId()==idx) 366 return pix; 367 368 return NULL; 385 369 } 386 370 … … 425 409 return kTRUE; 426 410 } 411 412 void MCerPhotEvt::DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const 413 { 414 *fLog << warn << "MCerPhotEvt::DrawPixelContent - not available." << endl; 415 }
Note:
See TracChangeset
for help on using the changeset viewer.