Changeset 3887
- Timestamp:
- 04/29/04 15:06:48 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc
r3868 r3887 35 35 // determines the integration window position for all pixels of this event. 36 36 // For the moment we neglect time delays between pixels (which are in most 37 // cases small). The class is based on MExtractSignal2. 37 // cases small). The class is based on MExtractSlidingWindow. 38 // 39 // Call: SetRange(higainfirst, higainlast, logainfirst, logainlast) 40 // to modify the ranges in which the window is allowed to move. 41 // Defaults are: 42 // 43 // fHiGainFirst = fgHiGainFirst = 0 44 // fHiGainLast = fgHiGainLast = 14 45 // fLoGainFirst = fgLoGainFirst = 3 46 // fLoGainLast = fgLoGainLast = 14 47 // 48 // Call: SetWindows(windowhigain, windowlogain,peaksearchwindow) 49 // to modify the sliding window widths. Windows have to be an even number. 50 // In case of odd numbers, the window will be modified. 51 // 52 // Defaults are: 53 // 54 // fHiGainWindowSize = fgHiGainWindowSize = 6 55 // fLoGainWindowSize = fgLoGainWindowSize = 6 56 // fPeakSearchWindowSize = fgPeakSearchWindowSize = 4 38 57 // 39 58 ////////////////////////////////////////////////////////////////////////////// … … 61 80 const Byte_t MExtractFixedWindowPeakSearch::fgHiGainFirst = 0; 62 81 const Byte_t MExtractFixedWindowPeakSearch::fgHiGainLast = 14; 63 const Byte_t MExtractFixedWindowPeakSearch::fgLoGainFirst = 0;82 const Byte_t MExtractFixedWindowPeakSearch::fgLoGainFirst = 3; 64 83 const Byte_t MExtractFixedWindowPeakSearch::fgLoGainLast = 14; 65 84 // -------------------------------------------------------------------------- … … 67 86 // Default constructor. 68 87 // 88 // Sets: 89 // - fWindowSizeHiGain to fgWindowSizeHiGain 90 // - fWindowSizeLoGain to fgWindowSizeLoGain 91 // - fPeakSearchWindowSize to fgPeakSearchWindowSize 92 // 93 // Calls: 94 // - SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast) 95 // 69 96 MExtractFixedWindowPeakSearch::MExtractFixedWindowPeakSearch(const char *name, const char *title) 97 : fWindowSizeHiGain(fgHiGainWindowSize), 98 fWindowSizeLoGain(fgLoGainWindowSize), 99 fPeakSearchWindowSize(fgPeakSearchWindowSize) 70 100 { 71 101 … … 74 104 75 105 SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast); 76 SetWindows(); 77 } 78 106 } 107 108 // -------------------------------------------------------------------------- 109 // 110 // SetRange: 111 // 112 // Calls: 113 // - MExtractor::SetRange(hifirst,hilast,lofirst,lolast); 114 // - SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize); 115 // 116 void MExtractFixedWindowPeakSearch::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast) 117 { 118 119 MExtractor::SetRange(hifirst,hilast,lofirst,lolast); 120 121 // 122 // Redo the checks if the window is still inside the ranges 123 // 124 SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize); 125 126 } 127 128 // -------------------------------------------------------------------------- 129 // 130 // Checks: 131 // - if a window is odd, subtract one 132 // - if a window is bigger than the one defined by the ranges, set it to the available range 133 // - if a window is smaller than 2, set it to 2 134 // 135 // Sets: 136 // - fNumHiGainSamples to: (Float_t)fWindowSizeHiGain 137 // - fNumLoGainSamples to: (Float_t)fWindowSizeLoGain 138 // - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples) 139 // - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples) 140 // 79 141 void MExtractFixedWindowPeakSearch::SetWindows(Byte_t windowh, Byte_t windowl, Byte_t peaksearchwindow) 80 142 { 81 // 82 // Set windows to even number of slices due to clock noise (odd/even slice effect). 83 // 84 fWindowSizeHiGain = windowh & ~1; 85 fWindowSizeLoGain = windowl & ~1; 143 144 fWindowSizeHiGain = windowh & ~1; 145 fWindowSizeLoGain = windowl & ~1; 86 146 fPeakSearchWindowSize = peaksearchwindow & ~1; 87 147 88 89 148 if (fWindowSizeHiGain != windowh) 90 *fLog << endl << warn << 91 "MExtractFixedWindowPeakSearch::SetWindows - Hi Gain window size has to be even, set to: " 92 << int(fWindowSizeHiGain) << " samples " << endl; 149 *fLog << warn << GetDescriptor() << ": Hi Gain window size has to be even, set to: " 150 << int(fWindowSizeHiGain) << " samples " << endl; 151 152 if (fWindowSizeLoGain != windowl) 153 *fLog << warn << GetDescriptor() << ": Lo Gain window size has to be even, set to: " 154 << int(fWindowSizeLoGain) << " samples " << endl; 93 155 94 if (fWindowSizeLoGain != windowl)95 *fLog << endl << warn <<96 "MExtractFixedWindowPeakSearch::SetWindows - Lo Gain window size has to be even, set to: "97 << int(fWindowSizeLoGain) << " samples " << endl;98 99 156 if (fPeakSearchWindowSize != peaksearchwindow) 100 *fLog << endl << warn << 101 "MExtractFixedWindowPeakSearch::SetWindows - Peak Search window size has to be even, set to: " 102 << int(fPeakSearchWindowSize) << " samples " << endl; 103 104 157 *fLog << warn << GetDescriptor() << ": Peak Search window size has to be even, set to: " 158 << int(fPeakSearchWindowSize) << " samples " << endl; 159 160 const Byte_t availhirange = (fHiGainLast-fHiGainFirst+1) & ~1; 161 const Byte_t availlorange = (fLoGainLast-fLoGainFirst+1) & ~1; 162 163 if (fWindowSizeHiGain > availhirange) 164 { 165 *fLog << warn << GetDescriptor() 166 << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fWindowSizeHiGain, 167 " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl; 168 *fLog << warn << GetDescriptor() 169 << ": Will set window size to: " << (int)availhirange << endl; 170 fWindowSizeHiGain = availhirange; 171 } 172 173 if (fWindowSizeLoGain > availlorange) 174 { 175 *fLog << warn << GetDescriptor() 176 << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fWindowSizeLoGain, 177 " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl; 178 *fLog << warn << GetDescriptor() 179 << ": Will set window size to: " << (int)availlorange << endl; 180 fWindowSizeLoGain = availlorange; 181 } 182 105 183 if (fWindowSizeHiGain<2) 106 184 { 107 185 fWindowSizeHiGain = 2; 108 *fLog << warn 109 << "MExtractFixedWindowPeakSearch::SetWindows - Hi Gain window size set to two samples" << endl; 110 } 111 186 *fLog << warn << GetDescriptor() << ": Hi Gain window size set to two samples" << endl; 187 } 188 112 189 if (fWindowSizeLoGain<2) 113 190 { 114 191 fWindowSizeLoGain = 2; 115 *fLog << warn 116 << "MExtractFixedWindowPeakSearch::SetWindows - Lo Gain window size set to two samples" << endl; 192 *fLog << warn << GetDescriptor() << ": Lo Gain window size set to two samples" << endl; 117 193 } 118 194 … … 120 196 { 121 197 fPeakSearchWindowSize = 2; 122 *fLog << warn 123 << " MExtractFixedWindowPeakSearch::SetWindows -Peak Search window size set to two samples" << endl;198 *fLog << warn << GetDescriptor() 199 << ": Peak Search window size set to two samples" << endl; 124 200 } 125 201 … … 143 219 Int_t &max, Int_t &sat) const 144 220 { 221 145 222 const Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; 146 223 … … 188 265 // -------------------------------------------------------------------------- 189 266 // 190 // FindSignal 191 // Adds up "window" slices starting in slice to which "ptr" points. The result 192 // is stored in "sum", and the number of saturated slices in "sat". 193 // 267 // FindSignalHiGain: 268 // 269 // - Loop from ptr to (ptr+fWindowSizeHiGain) 270 // - Sum up contents of *ptr 271 // - If *ptr is greater than fSaturationLimit, raise sat by 1 272 // 194 273 void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const 195 274 { … … 213 292 // -------------------------------------------------------------------------- 214 293 // 215 // FindSignal 216 // Adds up "window" slices starting in slice to which "ptr" points. The result 217 // is stored in "sum", and the number of saturated slices in "sat". 218 // 294 // FindSignalLoGain: 295 // 296 // - Loop from ptr to (ptr+fWindowSizeLoGain) 297 // - Sum up contents of *ptr 298 // - If *ptr is greater than fSaturationLimit, raise sat by 1 299 // 219 300 void MExtractFixedWindowPeakSearch::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const 220 301 { … … 262 343 sat = 0; 263 344 264 FindPeak(pixel.GetHiGainSamples(), fPeakSearchWindowSize, startslice, sumhi, sat); 345 FindPeak(pixel.GetHiGainSamples()+fHiGainFirst, fPeakSearchWindowSize, startslice, sumhi, sat); 346 265 347 if (sumhi > maxsumhi && sat == 0 ) 266 348 { 267 349 maxsumhi = sumhi; 268 350 if (startslice > 0) 269 hiGainFirst = startslice-1;351 hiGainFirst = fHiGainFirst + startslice - 1; 270 352 else 271 hiGainFirst = 0;353 hiGainFirst = fHiGainFirst; 272 354 } 273 355 } 274 356 275 357 276 loGainFirst = hiGainFirst;358 loGainFirst = ( hiGainFirst > fLoGainFirst ) ? hiGainFirst : fLoGainFirst; 277 359 278 360 // Make sure we will not integrate beyond the hi gain limit: … … 327 409 } /* while (pixel.Next()) */ 328 410 411 329 412 fSignals->SetReadyToSave(); 330 413 -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h
r3868 r3887 18 18 static const Byte_t fgPeakSearchWindowSize; // The window in which the global peak is searched for 19 19 20 Byte_t fWindowSizeHiGain; // Number of Hi Gain slices in window 21 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window 20 22 Byte_t fPeakSearchWindowSize; // Size of FADC window in the search for the highest peak of all pixels. 21 23 22 Byte_t fWindowSizeHiGain; // Number of Hi Gain slices in window23 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window24 24 25 25 void FindSignalHiGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const; … … 34 34 MExtractFixedWindowPeakSearch(const char *name=NULL, const char *title=NULL); 35 35 36 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 36 37 void SetWindows(Byte_t windowh=fgHiGainWindowSize, Byte_t windowl=fgLoGainWindowSize, 37 38 Byte_t peaksearchwindow=fgPeakSearchWindowSize); -
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r3881 r3887 132 132 return kFALSE; 133 133 134 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainLast, fNumHiGainSamples,135 fLoGainFirst, fLoGainLast, fNumLoGainSamples);136 137 134 fPedestals = (MPedestalCam*)pList->FindObject(AddSerialNumber("MPedestalCam")); 138 135 … … 162 159 // modifying the ranges again, if necessary. 163 160 // 161 // Call: 162 // - MExtractedSignalCam::SetUsedFADCSlices(fHiGainFirst, fHiGainLast, fNumHiGainSamples, 163 // fLoGainFirst, fLoGainLast, fNumLoGainSamples); 164 // 164 165 Bool_t MExtractor::ReInit(MParList *pList) 165 166 { … … 195 196 } 196 197 198 fSignals->SetUsedFADCSlices(fHiGainFirst, fHiGainLast, fNumHiGainSamples, 199 fLoGainFirst, fLoGainLast, fNumLoGainSamples); 200 197 201 return kTRUE; 198 202 }
Note:
See TracChangeset
for help on using the changeset viewer.