Ignore:
Timestamp:
02/03/07 20:04:00 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc

    r8271 r8296  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.24 2007-01-26 21:10:14 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.25 2007-02-03 20:03:35 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    268268Bool_t MExtractPedestal::SetExtractWindow(UShort_t windowf, UShort_t windows)
    269269{
    270 
    271   Bool_t rc = kTRUE;
    272 
    273   const Int_t odd  = TMath::Odd(windows);
    274  
    275   if (odd && !fExtractor)
    276   {
    277       *fLog << warn << GetDescriptor();
    278       *fLog << " - WARNING: Window size in SetExtractWindow has to be even... ";
    279       *fLog << " lowering from " << windows << " to ";
    280       windows -= 1;
    281       *fLog << windows << "!" << endl;
    282       rc = kFALSE;
    283   }
    284 
    285   if (windows==0)
    286   {
    287       *fLog << warn << GetDescriptor();
    288       *fLog << " - WARNING: Window size in SetExtractWindow has to be > 0... adjusting to 2!" << endl;
    289       windows = 2;
    290       rc = kFALSE;
    291   }
    292 
    293   fExtractWinSize  = windows;
    294   fExtractWinFirst = windowf;
    295   fExtractWinLast  = fExtractWinFirst+fExtractWinSize-1;
    296 
    297   return rc;
     270    Bool_t rc = kTRUE;
     271
     272    if (windows==0)
     273    {
     274        *fLog << warn << GetDescriptor();
     275        *fLog << " - WARNING: Window size in SetExtractWindow has to be > 0... adjusting to 2!" << endl;
     276        windows = 2;
     277        rc = kFALSE;
     278    }
     279
     280    fExtractWinSize  = windows;
     281    fExtractWinFirst = windowf;
     282    fExtractWinLast  = fExtractWinFirst+fExtractWinSize-1;
     283
     284    return rc;
    298285}
    299286
     
    329316// Check (and if neccesary: correct) the extraction and check ranges.
    330317//
    331 void MExtractPedestal::CheckExtractionWindow()
     318void MExtractPedestal::CheckExtractionWindow(UInt_t offset)
    332319{
    333320    // fSignal->GetNumSamples() not yet initialized!!!
     
    336323    if (fCheckWinLast >= num)
    337324    {
    338         *fLog << warn << endl;
    339         *fLog << "Selected CheckWindow [" << fCheckWinFirst << "," << fCheckWinLast;
    340         *fLog << "] ranges out of range [0," << num-1 << "]." << endl;
    341         *fLog << "Resetting upper edge." << endl;
    342 
    343         fCheckWinLast = num;
    344     }
    345 
    346     if (fExtractWinLast >= num)
    347     {
    348         *fLog << warn << endl;
    349         *fLog << "Selected ExtractWindow [" << fExtractWinFirst << "," << fExtractWinLast;
    350         *fLog << "] ranges out of range [0," << num-1 << "]." << endl;
    351         *fLog << "Resetting upper edge." << endl;
    352 
    353         fExtractWinLast = num;
     325        *fLog << inf;
     326        *fLog << "CheckWindow [" << fCheckWinFirst+offset << "," << fCheckWinLast+offset;
     327        *fLog << "] out of range [0," << num-1 << "]... ";
     328        *fLog << "reset upper edge." << endl;
     329
     330        fCheckWinLast = num-1;
     331    }
     332
     333    if (offset+fExtractWinLast >= num)
     334    {
     335        *fLog << inf;
     336        *fLog << "ExtractWindow [" << fExtractWinFirst+offset << "," << fExtractWinLast+offset;
     337        *fLog << "] out of range [0," << num-1 << "]... ";
     338        *fLog << "reset upper edge." << endl;
     339
     340        fExtractWinLast = num-offset-1;
    354341    }
    355342
     
    359346        return;
    360347
    361     fExtractWinLast += fExtractWinLast==num-1 ? -1 : +1;
    362 
    363     *fLog << warn << endl;
    364     *fLog << "ExtractionWindow odd...";
    365     *fLog << "New extraction window [" << fExtractWinFirst << "," << fExtractWinLast << "]" << endl;
     348    fExtractWinLast += offset+fExtractWinLast==num-1 ? -1 : +1;
     349
     350    *fLog << inf;
     351    *fLog << "ExtractionWindow odd... set to [";
     352    *fLog << fExtractWinFirst+offset << "," << fExtractWinLast+offset << "]" << endl;
    366353
    367354    fExtractWinSize = fExtractWinLast-fExtractWinFirst+1;
     
    582569    }
    583570
    584     CheckExtractionWindow();
     571    //CheckExtractionWindow();
    585572
    586573    return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.