Changeset 6140 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
01/31/05 11:06:21 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msignal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilterPeakSearch.cc

    r6138 r6140  
    7878
    7979const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgHiGainFirst             =  0;
    80 const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgHiGainLast              = 18;
     80const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgHiGainLast              = 20;
    8181const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgLoGainFirst             =  3;
    8282const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgLoGainLast              = 14;
    83 const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgOffsetLeftFromPeak      = 1;
    84 const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgOffsetRightFromPeak     = 2;
    85 const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgPeakSearchWindowSize    = 2;
     83const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgOffsetLeftFromPeak      =  2;
     84const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgOffsetRightFromPeak     =  3;
     85const Byte_t MExtractTimeAndChargeDigitalFilterPeakSearch::fgPeakSearchWindowSize    =  2;
     86const Int_t  MExtractTimeAndChargeDigitalFilterPeakSearch::fgHiGainFailureLimit      =  5;
     87const Int_t  MExtractTimeAndChargeDigitalFilterPeakSearch::fgLoGainFailureLimit      = 10;
    8688// --------------------------------------------------------------------------
    8789//
     
    8991//
    9092// Sets:
    91 // - fOffsetLeftFromPeak  to fgOffsetLeftFromPeak
    92 // - fOffsetRightFromPeak to fgOffsetRightFromPeak
     93// - fOffsetLeftFromPeak    to fgOffsetLeftFromPeak
     94// - fOffsetRightFromPeak   to fgOffsetRightFromPeak
     95// - fPeakSearchWindowSize  to fgPeakSearchWindowSize
     96// - fHiGainFailureLimit to fgHiGainFailureLimit
     97// - fLoGainFailureLimit to fgLoGainFailureLimit
    9398//
    9499MExtractTimeAndChargeDigitalFilterPeakSearch::MExtractTimeAndChargeDigitalFilterPeakSearch(const char *name, const char *title)
     
    100105    SetOffsetRightFromPeak();
    101106    SetPeakSearchWindowSize();
     107    SetHiGainFailureLimit();
     108    SetLoGainFailureLimit();
     109}
     110
     111// --------------------------------------------------------------------------
     112//
     113// The PreProcess searches for the following input containers:
     114//  - MRawEvtData
     115//  - MRawRunHeader
     116//  - MPedestalCam
     117//
     118// The following output containers are also searched and created if
     119// they were not found:
     120//
     121//  - MExtractedSignalCam
     122//  - MArrivalTimeCam   
     123//
     124// The following variables are set to 0:
     125//
     126//  - fHiGainOutOfRangeLeft
     127//  - fHiGainOutOfRangeRight
     128//  - fLoGainOutOfRangeLeft
     129//  - fLoGainOutOfRangeRight
     130//
     131Int_t MExtractTimeAndChargeDigitalFilterPeakSearch::PreProcess(MParList *pList)
     132{
     133
     134  if (!MExtractTimeAndCharge::PreProcess(pList))
     135    return kFALSE;
     136 
     137  fHiGainOutOfRangeLeft  = 0;
     138  fHiGainOutOfRangeRight = 0;
     139  fLoGainOutOfRangeLeft   = 0;
     140  fLoGainOutOfRangeRight  = 0;
     141 
     142  return kTRUE;
    102143}
    103144
     
    233274    fHiGainFirst = higainfirst - fOffsetLeftFromPeak;
    234275  else
    235     *fLog << warn << " High Gain ranges out of limits to the left!!! " << (Int_t)higainfirst << endl;
     276    fHiGainOutOfRangeLeft++;
    236277
    237278  //
     
    241282    fHiGainLast  = higainfirst + fOffsetRightFromPeak + fWindowSizeHiGain;
    242283  else
    243     *fLog << warn << " High Gain ranges out of limits to the right!!! " << (Int_t)higainfirst << endl;
     284    fHiGainOutOfRangeRight++;
    244285     
    245286
     
    247288    fLoGainFirst = fHiGainFirst + (Int_t)fOffsetLoGain;
    248289  else
    249     *fLog << inf << " High Gain ranges out of limits to the left!!! " << (Int_t)fHiGainFirst << endl;
     290    fLoGainOutOfRangeLeft++;
    250291 
    251292  //
     
    255296    fLoGainLast = fLoGainFirst+fWindowSizeLoGain+fOffsetRightFromPeak;
    256297  else
    257     *fLog << warn << " Low Gain ranges out of limits to the right!!! " << endl;
     298    fLoGainOutOfRangeRight++;
    258299
    259300  pixel.Reset();
     
    347388}
    348389
    349 
     390Int_t MExtractTimeAndChargeDigitalFilterPeakSearch::PostProcess()
     391{
     392
     393  if (GetNumExecutions() == 0)
     394    return kTRUE;
     395
     396  const Int_t higainfailure = (fHiGainOutOfRangeLeft+fHiGainOutOfRangeRight)/GetNumExecutions()*100;
     397  const Int_t logainfailure = (fLoGainOutOfRangeLeft+fLoGainOutOfRangeRight)/GetNumExecutions()*100;
     398
     399  if (fHiGainOutOfRangeLeft > 0)
     400    *fLog << warn << GetDescriptor() << ": " << fHiGainOutOfRangeLeft/GetNumExecutions()*100 << "% ranging out of high-gain window to the left!" << endl;
     401  if (fHiGainOutOfRangeRight > 0)
     402    *fLog << warn << GetDescriptor() << ": " << fHiGainOutOfRangeRight/GetNumExecutions()*100 << "% ranging out of high-gain window to the right!" << endl;
     403  if (fLoGainOutOfRangeLeft > 0)
     404    *fLog << warn << GetDescriptor() << ": " << fLoGainOutOfRangeLeft/GetNumExecutions()*100 << "% ranging out of low-gain window to the left!" << endl;
     405  if (fHiGainOutOfRangeRight > 0)
     406    *fLog << warn << GetDescriptor() << ": " << fHiGainOutOfRangeRight/GetNumExecutions()*100 << "% ranging out of high-gain window to the right!" << endl;
     407
     408 
     409  if (higainfailure > fHiGainFailureLimit)
     410    {
     411      *fLog << err << GetDescriptor() << ": " << higainfailure << "% range failures in high gain above limit of: " << fHiGainFailureLimit << "%." << endl;
     412      return kFALSE;
     413    }
     414 
     415  if (logainfailure > fLoGainFailureLimit)
     416    {
     417      *fLog << err << GetDescriptor() << ": " << logainfailure << "% range failures in low gain above limit of: " << fLoGainFailureLimit << "%." << endl;
     418      return kFALSE;
     419    }
     420 
     421
     422
     423  return kTRUE;
     424
     425}
    350426
    351427// --------------------------------------------------------------------------
     
    381457    }
    382458 
     459  if (IsEnvDefined(env, prefix, "HiGainFailureLimit", print))
     460    {
     461      fHiGainFailureLimit = GetEnvValue(env, prefix, fHiGainFailureLimit);
     462      rc = kTRUE;
     463    }
     464 
     465  if (IsEnvDefined(env, prefix, "LoGainFailureLimit", print))
     466    {
     467      fLoGainFailureLimit = GetEnvValue(env, prefix, fLoGainFailureLimit);
     468      rc = kTRUE;
     469    }
     470 
    383471  return MExtractTimeAndChargeDigitalFilter::ReadEnv(env, prefix, print) ? kTRUE : rc;
    384472}
     
    394482    *fLog << " Offset from Peak right:  " << fOffsetRightFromPeak  << endl;
    395483    *fLog << " Peak search window size: " << fPeakSearchWindowSize << endl;
    396 }
     484    *fLog << " High Gain Failure limit: " << fHiGainFailureLimit << endl;
     485    *fLog << " Low Gain Failure limit:  " << fLoGainFailureLimit << endl;
     486}
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilterPeakSearch.h

    r6117 r6140  
    2121private:
    2222
    23   static const Byte_t fgHiGainFirst;             //! Default for fHiGainFirst          (now set to: 0)
    24   static const Byte_t fgHiGainLast;              //! Default for fHiGainLast           (now set to:18)
    25   static const Byte_t fgLoGainFirst;             //! Default for fLoGainFirst          (now set to: 2)
    26   static const Byte_t fgLoGainLast;              //! Default for fLoGainLast           (now set to:14)
    27   static const Byte_t fgOffsetLeftFromPeak;      //! Default for fOffsetLeftFromPeak   (now set to: 1) 
    28   static const Byte_t fgOffsetRightFromPeak;     //! Default for fOffsetRightFromPeak  (now set to: 2) 
    29   static const Byte_t fgPeakSearchWindowSize;    //! Default for fPeakSearchWindowSize (now set to: 2)
     23  static const Byte_t fgHiGainFirst;             //! Default for fHiGainFirst           (now set to: 0)
     24  static const Byte_t fgHiGainLast;              //! Default for fHiGainLast            (now set to:18)
     25  static const Byte_t fgLoGainFirst;             //! Default for fLoGainFirst           (now set to: 2)
     26  static const Byte_t fgLoGainLast;              //! Default for fLoGainLast            (now set to:14)
     27  static const Byte_t fgOffsetLeftFromPeak;      //! Default for fOffsetLeftFromPeak    (now set to: 1) 
     28  static const Byte_t fgOffsetRightFromPeak;     //! Default for fOffsetRightFromPeak   (now set to: 2) 
     29  static const Byte_t fgPeakSearchWindowSize;    //! Default for fPeakSearchWindowSize  (now set to: 2)
     30  static const Int_t  fgHiGainFailureLimit;      //! Default for fHiGainMaxFailureLimit (now set to: 5)
     31  static const Int_t  fgLoGainFailureLimit;      //! Default for fHiGainMaxFailureLimit (now set to: 10)
    3032
    3133  Byte_t  fOffsetLeftFromPeak;                   // Number of slices to start extraction before peak slice
    3234  Byte_t  fOffsetRightFromPeak;                  // Number of slices to stop  extraction after  peak slice
    3335  Byte_t  fPeakSearchWindowSize;                 // Size of FADC window in the search for the highest peak of all pixels.
     36  Int_t   fHiGainFailureLimit;                   // Limit for percentage of events ranging out of limits in high gain
     37  Int_t   fLoGainFailureLimit;                   // Limit for percentage of events ranging out of limits in low gain
     38
     39  ULong_t fHiGainOutOfRangeLeft;                // Number of events out of range to the left side in high gain
     40  ULong_t fHiGainOutOfRangeRight;               // Number of events out of range to the right side in high gain
     41  ULong_t fLoGainOutOfRangeLeft;                // Number of events out of range to the left side in low gain
     42  ULong_t fLoGainOutOfRangeRight;               // Number of events out of range to the right side in low gain
    3443
    3544  void    FindPeak(Byte_t *ptr, Byte_t &startslice, Int_t &signal, Int_t &sat, Byte_t &satpos) const;
    3645
     46  Int_t   PreProcess(MParList *pList);
     47  Int_t   Process();
     48  Int_t   PostProcess();
     49
    3750  Int_t   ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    38   Int_t   Process();
    3951
    4052public:
     
    4355  ~MExtractTimeAndChargeDigitalFilterPeakSearch() { }
    4456 
    45   void SetOffsetLeftFromPeak ( Byte_t offset=fgOffsetLeftFromPeak  )  {  fOffsetLeftFromPeak   = offset; }
    46   void SetOffsetRightFromPeak( Byte_t offset=fgOffsetRightFromPeak )  {  fOffsetRightFromPeak  = offset; }
    47   void SetPeakSearchWindowSize(Byte_t size =fgPeakSearchWindowSize )  {  fPeakSearchWindowSize = size;   }
     57  void SetOffsetLeftFromPeak ( Byte_t offset=fgOffsetLeftFromPeak  )  { fOffsetLeftFromPeak   = offset; }
     58  void SetOffsetRightFromPeak( Byte_t offset=fgOffsetRightFromPeak )  { fOffsetRightFromPeak  = offset; }
     59  void SetPeakSearchWindowSize(Byte_t size =fgPeakSearchWindowSize )  { fPeakSearchWindowSize = size;   }
     60  void SetHiGainFailureLimit ( Int_t  lim=fgHiGainFailureLimit     )  { fHiGainFailureLimit   = lim;    }     
     61  void SetLoGainFailureLimit ( Int_t  lim=fgLoGainFailureLimit     )  { fLoGainFailureLimit   = lim;    }
    4862
    4963  void Print(Option_t *o="") const;
Note: See TracChangeset for help on using the changeset viewer.