Changeset 17833
- Timestamp:
- 05/11/14 21:24:17 (10 years ago)
- Location:
- trunk/Mars/mimage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mimage/MImgCleanTime.cc
r17832 r17833 93 93 } 94 94 95 Island MImgCleanTime::CalcIsland(MSignalPix &pix1, int idx1) 96 { 97 pix1.SetIdxIsland(idx1); 98 99 const Float_t tm0 = pix1.GetArrivalTime(); 100 101 Island island(pix1.GetNumPhotons(), tm0); 102 103 const MGeom &gpix1 = (*fCam)[idx1]; 95 Island MImgCleanTime::CalcIsland(MSignalPix &pix1, const MGeom &gpix1, const uint16_t &island1) 96 { 97 pix1.SetIdxIsland(island1); 98 99 const Float_t time1 = pix1.GetArrivalTime(); 100 101 Island island(pix1.GetNumPhotons(), time1); 102 104 103 for (UInt_t i=0; i<gpix1.GetNumNeighbors(); i++) 105 104 { 106 const int n= gpix1.GetNeighbor(i);107 108 MSignalPix &pix2 = (*fEvt)[ n];109 110 const Int_t i dx2 = pix2.GetIdxIsland();111 if (i dx2>=0)105 const Int_t idx2 = gpix1.GetNeighbor(i); 106 107 MSignalPix &pix2 = (*fEvt)[idx2]; 108 109 const Int_t island2 = pix2.GetIdxIsland(); 110 if (island2>=0) 112 111 { 113 if (i dx1==idx2)112 if (island1==island2) 114 113 continue; 115 114 … … 118 117 const auto it = fContacts.rbegin(); 119 118 if (it==fContacts.rend() || 120 (it->first!=i dx1 && it->second!=idx2))121 fContacts.emplace_back(i dx1, idx2);119 (it->first!=island1 && it->second!=island2)) 120 fContacts.emplace_back(island1, island2); 122 121 123 122 continue; 124 123 } 125 124 126 const Float_t t m1= pix2.GetArrivalTime();127 if (fabs(t m0-tm1)<fDeltaT) // FIXME: Scale with distance?128 island += CalcIsland(pix2, idx2);125 const Float_t time2 = pix2.GetArrivalTime(); 126 if (fabs(time2-time1)<fDeltaT) // FIXME: Scale with distance? 127 island += CalcIsland(pix2, (*fCam)[idx2], island1); 129 128 } 130 129 … … 154 153 // Start with island idx==0 155 154 UShort_t idx = 0; 156 for (UInt_t i=0; i< 1440; i++)157 { 158 MSignalPix & pix = (*fEvt)[i];155 for (UInt_t i=0; i<npix; i++) 156 { 157 MSignalPix &spix = (*fEvt)[i]; 159 158 160 159 // The following might be much more efficient and faster 161 160 // if we omit small counted and sized islands already, 162 161 // but what is the disadvantage? 163 if ( pix.GetIdxIsland()<0)164 fIslands.emplace_back(CalcIsland( pix, idx++));162 if (spix.GetIdxIsland()<0) 163 fIslands.emplace_back(CalcIsland(spix, (*fCam)[i], idx++)); 165 164 } 166 165 … … 199 198 } 200 199 201 for (UInt_t i=0; i<1440; i++) 200 uint16_t num_islands = 0; 201 double size_main = 0; 202 double size_tot = 0; 203 204 vector<bool> used(fIslands.size()); 205 for (UInt_t i=0; i<npix; i++) 202 206 { 203 207 MSignalPix &pix = (*fEvt)[i]; 204 208 205 209 // At the end every pixel has an island assigned 206 const Short_t ii = pix.GetIdxIsland(); 207 208 const Island &island = fIslands[fLut[ii]]; 209 210 if (island.count>fMinCount && island.size>fMinSize) 211 pix.SetPixelUsed(); 212 } 210 const Short_t ii = fLut[pix.GetIdxIsland()]; 211 212 const Island &island = fIslands[ii]; 213 214 if (island.count<=fMinCount || island.size<=fMinSize) 215 continue; 216 217 if (!used[ii]) 218 { 219 used[ii] = true; 220 num_islands++; 221 222 size_tot += island.size; 223 if (island.size>size_main) 224 size_main = island.size; 225 } 226 227 pix.SetPixelUsed(); 228 pix.SetPixelCore(); 229 } 230 231 fEvt->SetIslandInfo(num_islands, size_main, size_tot-size_main); 213 232 214 233 return kTRUE; -
trunk/Mars/mimage/MImgCleanTime.h
r17832 r17833 10 10 #endif 11 11 12 class MGeom; 12 13 class MGeomCam; 13 14 class MSignalPix; … … 47 48 TString fNameSignalCam; // name of the 'MSignalCam' container 48 49 49 std::vector<float> fSignal; 50 std::vector<float> fTime; 51 std::vector<int16_t> fIsland; 52 std::vector<Island> fIslands; 50 std::vector<Island> fIslands; 53 51 std::list<std::pair<uint16_t, uint16_t>> fContacts; 54 52 std::vector<uint16_t> fLut; 55 53 56 Island CalcIsland(MSignalPix &, int);54 Island CalcIsland(MSignalPix &, const MGeom &, const uint16_t &); 57 55 58 56 // MParContainer
Note:
See TracChangeset
for help on using the changeset viewer.