Changeset 4722 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 08/24/04 14:51:17 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc
r4340 r4722 1 1 /* ======================================================================== *\ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Abelardo Moralejo,04/2004 <mailto:moralejo@pd.infn.it> 19 ! Markus Gaug ,04/2004 <mailto:markus@ifae.es> 20 ! Copyright: MAGIC Software Development, 2000-2004 21 ! 22 ! 23 \* ======================================================================== */ 2 ! 3 ! * 4 ! * This file is part of MARS, the MAGIC Analysis and Reconstruction 5 ! * Software. It is distributed to you in the hope that it can be a useful 6 ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes. 7 ! * It is distributed WITHOUT ANY WARRANTY. 8 ! * 9 ! * Permission to use, copy, modify and distribute this software and its 10 ! * documentation for any purpose is hereby granted without fee, 11 ! * provided that the above copyright notice appear in all copies and 12 ! * that both that copyright notice and this permission notice appear 13 ! * in supporting documentation. It is provided "as is" without express 14 ! * or implied warranty. 15 ! * 16 ! 17 ! 18 ! Author(s): Abelardo Moralejo, 04/2004 <mailto:moralejo@pd.infn.it> 19 ! Author(s): Markus Gaug, 04/2004 <mailto:markus@ifae.es> 20 ! 21 ! Copyright: MAGIC Software Development, 2000-2004 22 ! 23 ! 24 \* ======================================================================== */ 24 25 25 26 ////////////////////////////////////////////////////////////////////////////// … … 55 56 // fLoGainWindowSize = fgLoGainWindowSize = 6 56 57 // fPeakSearchWindowSize = fgPeakSearchWindowSize = 4 57 // fLo wGainPeakShift = fgLowGainPeakShift= 058 // fLoGainPeakShift = fgLoGainPeakShift = 0 58 59 // 59 60 ////////////////////////////////////////////////////////////////////////////// … … 84 85 const Byte_t MExtractFixedWindowPeakSearch::fgPeakSearchWindowSize = 4; 85 86 const Byte_t MExtractFixedWindowPeakSearch::fgOffsetFromWindow = 1; 86 const Byte_t MExtractFixedWindowPeakSearch::fgLo wGainPeakShift= 0;87 const Byte_t MExtractFixedWindowPeakSearch::fgLoGainPeakShift = 0; 87 88 // -------------------------------------------------------------------------- 88 89 // … … 90 91 // 91 92 // Sets: 92 // - f WindowSizeHiGain to fgWindowSizeHiGain93 // - f WindowSizeLoGain to fgWindowSizeLoGain93 // - fHiGainWindowSize to fgHiGainWindowSize 94 // - fLoGainWindowSize to fgLoGainWindowSize 94 95 // - fPeakSearchWindowSize to fgPeakSearchWindowSize 95 // - fLo wGainPeakShift to fgLowGainPeakShift96 // - fLoGainPeakShift to fgLoGainPeakShift 96 97 // 97 98 // Calls: … … 100 101 // 101 102 MExtractFixedWindowPeakSearch::MExtractFixedWindowPeakSearch(const char *name, const char *title) 102 : f WindowSizeHiGain(fgHiGainWindowSize),103 f WindowSizeLoGain(fgLoGainWindowSize),103 : fHiGainWindowSize(fgHiGainWindowSize), 104 fLoGainWindowSize(fgLoGainWindowSize), 104 105 fPeakSearchWindowSize(fgPeakSearchWindowSize), 105 fLo wGainPeakShift(fgLowGainPeakShift)106 fLoGainPeakShift(fgLoGainPeakShift) 106 107 { 107 108 … … 119 120 // Calls: 120 121 // - MExtractor::SetRange(hifirst,hilast,lofirst,lolast); 121 // - SetWindows(f WindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);122 // - SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize); 122 123 // 123 124 void MExtractFixedWindowPeakSearch::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast) … … 129 130 // Redo the checks if the window is still inside the ranges 130 131 // 131 SetWindows(f WindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);132 SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize); 132 133 133 134 } … … 141 142 // 142 143 // Sets: 143 // - fNumHiGainSamples to: (Float_t)f WindowSizeHiGain144 // - fNumLoGainSamples to: (Float_t)f WindowSizeLoGain144 // - fNumHiGainSamples to: (Float_t)fHiGainWindowSize 145 // - fNumLoGainSamples to: (Float_t)fLoGainWindowSize 145 146 // - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples) 146 147 // - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples) … … 149 150 { 150 151 151 f WindowSizeHiGain= windowh & ~1;152 f WindowSizeLoGain= windowl & ~1;152 fHiGainWindowSize = windowh & ~1; 153 fLoGainWindowSize = windowl & ~1; 153 154 fPeakSearchWindowSize = peaksearchwindow & ~1; 154 155 155 if (f WindowSizeHiGain!= windowh)156 if (fHiGainWindowSize != windowh) 156 157 *fLog << warn << GetDescriptor() << ": Hi Gain window size has to be even, set to: " 157 << int(f WindowSizeHiGain) << " samples " << endl;158 159 if (f WindowSizeLoGain!= windowl)158 << int(fHiGainWindowSize) << " samples " << endl; 159 160 if (fLoGainWindowSize != windowl) 160 161 *fLog << warn << GetDescriptor() << ": Lo Gain window size has to be even, set to: " 161 << int(f WindowSizeLoGain) << " samples " << endl;162 << int(fLoGainWindowSize) << " samples " << endl; 162 163 163 164 if (fPeakSearchWindowSize != peaksearchwindow) … … 168 169 const Byte_t availlorange = (fLoGainLast-fLoGainFirst+1) & ~1; 169 170 170 if (f WindowSizeHiGain> availhirange)171 if (fHiGainWindowSize > availhirange) 171 172 { 172 173 *fLog << warn << GetDescriptor() 173 << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)f WindowSizeHiGain,174 << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fHiGainWindowSize, 174 175 " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl; 175 176 *fLog << warn << GetDescriptor() 176 177 << ": Will set window size to: " << (int)availhirange << endl; 177 f WindowSizeHiGain= availhirange;178 } 179 180 181 if (f WindowSizeLoGain> availlorange)178 fHiGainWindowSize = availhirange; 179 } 180 181 182 if (fLoGainWindowSize > availlorange) 182 183 { 183 184 *fLog << warn << GetDescriptor() 184 << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)f WindowSizeLoGain,185 << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fLoGainWindowSize, 185 186 " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl; 186 187 *fLog << warn << GetDescriptor() 187 188 << ": Will set window size to: " << (int)availlorange << endl; 188 f WindowSizeLoGain= availlorange;189 } 190 191 if (f WindowSizeHiGain<2)192 { 193 f WindowSizeHiGain= 2;189 fLoGainWindowSize = availlorange; 190 } 191 192 if (fHiGainWindowSize<2) 193 { 194 fHiGainWindowSize = 2; 194 195 *fLog << warn << GetDescriptor() << ": Hi Gain window size set to two samples" << endl; 195 196 } 196 197 197 if (f WindowSizeLoGain<2)198 { 199 f WindowSizeLoGain= 2;198 if (fLoGainWindowSize<2) 199 { 200 fLoGainWindowSize = 2; 200 201 *fLog << warn << GetDescriptor() << ": Lo Gain window size set to two samples" << endl; 201 202 } … … 208 209 } 209 210 210 fNumHiGainSamples = (Float_t)f WindowSizeHiGain;211 fNumLoGainSamples = (Float_t)f WindowSizeLoGain;211 fNumHiGainSamples = (Float_t)fHiGainWindowSize; 212 fNumLoGainSamples = (Float_t)fLoGainWindowSize; 212 213 213 214 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples); … … 295 296 // FindSignalHiGain: 296 297 // 297 // - Loop from ptr to (ptr+f WindowSizeHiGain)298 // - Loop from ptr to (ptr+fHiGainWindowSize) 298 299 // - Sum up contents of *ptr 299 300 // - If *ptr is greater than fSaturationLimit, raise sat by 1 … … 302 303 { 303 304 304 Byte_t *end = ptr + f WindowSizeHiGain-fHiLoLast;305 Byte_t *end = ptr + fHiGainWindowSize-fHiLoLast; 305 306 306 307 Int_t summ = 0; … … 316 317 317 318 // 318 // If part of the "lo w-Gain" slices are used,319 // If part of the "lo-Gain" slices are used, 319 320 // repeat steps one and two for the logain part until fHiLoLast 320 321 // … … 337 338 // FindSignalLoGain: 338 339 // 339 // - Loop from ptr to (ptr+f WindowSizeLoGain)340 // - Loop from ptr to (ptr+fLoGainWindowSize) 340 341 // - Sum up contents of *ptr 341 342 // - If *ptr is greater than fSaturationLimit, raise sat by 1 … … 349 350 Int_t summ = 0; 350 351 351 while (p<ptr+f WindowSizeLoGain)352 while (p<ptr+fLoGainWindowSize) 352 353 { 353 354 summ += *p; … … 400 401 401 402 402 loGainFirst = ( hiGainFirst+fLo wGainPeakShift > fLoGainFirst ) ?403 hiGainFirst+fLo wGainPeakShift : fLoGainFirst;403 loGainFirst = ( hiGainFirst+fLoGainPeakShift > fLoGainFirst ) ? 404 hiGainFirst+fLoGainPeakShift : fLoGainFirst; 404 405 405 406 // Make sure we will not integrate beyond the hi gain limit: 406 if (hiGainFirst+f WindowSizeHiGain> pixel.GetNumHiGainSamples())407 fHiLoLast = hiGainFirst+f WindowSizeHiGain- pixel.GetNumHiGainSamples();408 // hiGainFirst = pixel.GetNumHiGainSamples()-f WindowSizeHiGain;407 if (hiGainFirst+fHiGainWindowSize > pixel.GetNumHiGainSamples()) 408 fHiLoLast = hiGainFirst+fHiGainWindowSize - pixel.GetNumHiGainSamples(); 409 // hiGainFirst = pixel.GetNumHiGainSamples()-fHiGainWindowSize; 409 410 410 411 // Make sure we will not integrate beyond the lo gain limit: 411 if (loGainFirst+f WindowSizeLoGain> pixel.GetNumLoGainSamples())412 loGainFirst = pixel.GetNumLoGainSamples()-f WindowSizeLoGain;412 if (loGainFirst+fLoGainWindowSize > pixel.GetNumLoGainSamples()) 413 loGainFirst = pixel.GetNumLoGainSamples()-fLoGainWindowSize; 413 414 414 415 pixel.Reset(); … … 465 466 return kTRUE; 466 467 } 468 469 // -------------------------------------------------------------------------- 470 // 471 // In addition to the resources of the base-class MExtractor: 472 // MJPedestal.MExtractor.WindowSizeHiGain: 6 473 // MJPedestal.MExtractor.WindowSizeLoGain: 6 474 // MJPedestal.MExtractor.PeakSearchWindow: 4 475 // MJPedestal.MExtractor.OffsetFromWindow: 1 476 // MJPedestal.MExtractor.LoGainPeakShift: 0 477 // 478 Int_t MExtractFixedWindowPeakSearch::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 479 { 480 Byte_t hw = fHiGainWindowSize; 481 Byte_t lw = fLoGainWindowSize; 482 Byte_t pw = fPeakSearchWindowSize; 483 484 Bool_t rc = kFALSE; 485 486 if (IsEnvDefined(env, prefix, "PeakSearchWindow", print)) 487 { 488 pw = GetEnvValue(env, prefix, "PeakSearchWindow", pw); 489 rc = kTRUE; 490 } 491 if (IsEnvDefined(env, prefix, "HiGainWindowSize", print)) 492 { 493 hw = GetEnvValue(env, prefix, "HiGainWindowSize", hw); 494 rc = kTRUE; 495 } 496 if (IsEnvDefined(env, prefix, "LoGainWindowSize", print)) 497 { 498 lw = GetEnvValue(env, prefix, "LoGainWindowSize", lw); 499 rc = kTRUE; 500 } 501 502 if (rc) 503 SetWindows(hw, lw, pw); 504 505 506 if (IsEnvDefined(env, prefix, "OffsetFromWindow", print)) 507 { 508 SetOffsetFromWindow(GetEnvValue(env, prefix, "OffsetFromWindow", fOffsetFromWindow)); 509 rc = kTRUE; 510 } 511 512 if (IsEnvDefined(env, prefix, "LoGainPeakShift", print)) 513 { 514 SetLoGainPeakShift(GetEnvValue(env, prefix, "LoGainPeakShift", fLoGainPeakShift)); 515 rc = kTRUE; 516 } 517 518 rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc; 519 520 return rc; 521 } -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h
r4340 r4722 18 18 static const Byte_t fgPeakSearchWindowSize; // Default for fPeakSearchWindowSize (now set to: 4) 19 19 static const Byte_t fgOffsetFromWindow; // Default for fOffsetFromWindow (now set to: 1) 20 static const Byte_t fgLo wGainPeakShift;// Default for fLowGainPeakShift (now set to: 0)20 static const Byte_t fgLoGainPeakShift; // Default for fLowGainPeakShift (now set to: 0) 21 21 22 Byte_t f WindowSizeHiGain; // Number of Hi Gain slices in window23 Byte_t f WindowSizeLoGain; // Number of Lo Gain slices in window22 Byte_t fHiGainWindowSize; // Number of Hi Gain slices in window 23 Byte_t fLoGainWindowSize; // Number of Lo Gain slices in window 24 24 Byte_t fPeakSearchWindowSize; // Size of FADC window in the search for the highest peak of all pixels. 25 25 Byte_t fOffsetFromWindow; // Number of slices to start extraction before search window 26 Byte_t fLo wGainPeakShift;// Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices.26 Byte_t fLoGainPeakShift; // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices. 27 27 28 28 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const; … … 31 31 void FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat) const; 32 32 33 Bool_t 33 Bool_t ReInit(MParList *pList); 34 34 Int_t Process(); 35 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 35 36 36 37 public: … … 43 44 void SetOffsetFromWindow(Byte_t offset=fgOffsetFromWindow) { fOffsetFromWindow = offset; } 44 45 45 void SetLo wGainPeakShift(Byte_t shift=fgLowGainPeakShift) { fLowGainPeakShift = shift; }46 void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; } 46 47 47 48 ClassDef(MExtractFixedWindowPeakSearch, 0) // Signal Extractor for fixed size trigger-corrected extraction window -
trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc
r4371 r4722 17 17 ! 18 18 ! Author(s): Thomas Bretz, 02/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 19 ! Author(s): Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de> 20 20 ! 21 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 297 297 } 298 298 299 // -------------------------------------------------------------------------- 300 // 301 // In addition to the resources of the base-class MExtractor: 302 // MJPedestal.MExtractor.WindowSizeHiGain: 6 303 // MJPedestal.MExtractor.WindowSizeLoGain: 6 304 // 305 Int_t MExtractTimeHighestIntegral::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 306 { 307 Byte_t hw = fHiGainWindowSize; 308 Byte_t lw = fLoGainWindowSize; 309 310 Bool_t rc = kFALSE; 311 312 if (IsEnvDefined(env, prefix, "HiGainWindowSize", print)) 313 { 314 hw = GetEnvValue(env, prefix, "HiGainWindowSize", hw); 315 rc = kTRUE; 316 } 317 if (IsEnvDefined(env, prefix, "LoGainWindowSize", print)) 318 { 319 lw = GetEnvValue(env, prefix, "LoGainWindowSize", lw); 320 rc = kTRUE; 321 } 322 323 if (rc) 324 SetWindowSize(hw, lw); 325 326 rc = MExtractor::ReadEnv(env, prefix, print) ? kTRUE : rc; 327 328 return rc; 329 } -
trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.h
r3943 r4722 24 24 void FindTimeHiGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const; 25 25 void FindTimeLoGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const; 26 27 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 26 28 27 29 public:
Note:
See TracChangeset
for help on using the changeset viewer.