Ignore:
Timestamp:
08/24/04 14:51:17 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/msignal
Files:
4 edited

Legend:

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

    r4340 r4722  
    11/* ======================================================================== *\
    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\* ======================================================================== */
    2425
    2526//////////////////////////////////////////////////////////////////////////////
     
    5556//   fLoGainWindowSize     = fgLoGainWindowSize     = 6
    5657//   fPeakSearchWindowSize = fgPeakSearchWindowSize = 4
    57 //   fLowGainPeakShift     = fgLowGainPeakShift     = 0
     58//   fLoGainPeakShift      = fgLoGainPeakShift      = 0
    5859//
    5960//////////////////////////////////////////////////////////////////////////////
     
    8485const Byte_t MExtractFixedWindowPeakSearch::fgPeakSearchWindowSize = 4;
    8586const Byte_t MExtractFixedWindowPeakSearch::fgOffsetFromWindow     = 1;
    86 const Byte_t MExtractFixedWindowPeakSearch::fgLowGainPeakShift     = 0;
     87const Byte_t MExtractFixedWindowPeakSearch::fgLoGainPeakShift      = 0;
    8788// --------------------------------------------------------------------------
    8889//
     
    9091//
    9192// Sets:
    92 // - fWindowSizeHiGain to fgWindowSizeHiGain
    93 // - fWindowSizeLoGain to fgWindowSizeLoGain
     93// - fHiGainWindowSize to fgHiGainWindowSize
     94// - fLoGainWindowSize to fgLoGainWindowSize
    9495// - fPeakSearchWindowSize to fgPeakSearchWindowSize
    95 // - fLowGainPeakShift to fgLowGainPeakShift
     96// - fLoGainPeakShift to fgLoGainPeakShift
    9697//
    9798// Calls:
     
    100101//
    101102MExtractFixedWindowPeakSearch::MExtractFixedWindowPeakSearch(const char *name, const char *title)
    102     : fWindowSizeHiGain(fgHiGainWindowSize),
    103       fWindowSizeLoGain(fgLoGainWindowSize),
     103    : fHiGainWindowSize(fgHiGainWindowSize),
     104      fLoGainWindowSize(fgLoGainWindowSize),
    104105      fPeakSearchWindowSize(fgPeakSearchWindowSize),
    105       fLowGainPeakShift(fgLowGainPeakShift)
     106      fLoGainPeakShift(fgLoGainPeakShift)
    106107{
    107108
     
    119120// Calls:
    120121// - MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
    121 // - SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);
     122// - SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize);
    122123//
    123124void MExtractFixedWindowPeakSearch::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast)
     
    129130  // Redo the checks if the window is still inside the ranges
    130131  //
    131   SetWindows(fWindowSizeHiGain,fWindowSizeLoGain,fPeakSearchWindowSize);
     132  SetWindows(fHiGainWindowSize,fLoGainWindowSize,fPeakSearchWindowSize);
    132133 
    133134}
     
    141142//
    142143// Sets:
    143 // - fNumHiGainSamples to: (Float_t)fWindowSizeHiGain
    144 // - fNumLoGainSamples to: (Float_t)fWindowSizeLoGain
     144// - fNumHiGainSamples to: (Float_t)fHiGainWindowSize
     145// - fNumLoGainSamples to: (Float_t)fLoGainWindowSize
    145146// - fSqrtHiGainSamples to: TMath::Sqrt(fNumHiGainSamples)
    146147// - fSqrtLoGainSamples to: TMath::Sqrt(fNumLoGainSamples) 
     
    149150{
    150151
    151   fWindowSizeHiGain     = windowh & ~1;
    152   fWindowSizeLoGain     = windowl & ~1;
     152  fHiGainWindowSize     = windowh & ~1;
     153  fLoGainWindowSize     = windowl & ~1;
    153154  fPeakSearchWindowSize = peaksearchwindow & ~1;
    154155
    155   if (fWindowSizeHiGain != windowh)
     156  if (fHiGainWindowSize != windowh)
    156157    *fLog << warn << GetDescriptor() << ": Hi Gain window size has to be even, set to: "
    157           << int(fWindowSizeHiGain) << " samples " << endl;
    158  
    159   if (fWindowSizeLoGain != windowl)
     158          << int(fHiGainWindowSize) << " samples " << endl;
     159 
     160  if (fLoGainWindowSize != windowl)
    160161    *fLog << warn << GetDescriptor() << ": Lo Gain window size has to be even, set to: "
    161           << int(fWindowSizeLoGain) << " samples " << endl;
     162          << int(fLoGainWindowSize) << " samples " << endl;
    162163   
    163164  if (fPeakSearchWindowSize != peaksearchwindow)
     
    168169  const Byte_t availlorange = (fLoGainLast-fLoGainFirst+1) & ~1;
    169170
    170   if (fWindowSizeHiGain > availhirange)
     171  if (fHiGainWindowSize > availhirange)
    171172    {
    172173      *fLog << warn << GetDescriptor()
    173             << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fWindowSizeHiGain,
     174            << Form("%s%2i%s%2i%s%2i%s",": Hi Gain window size: ",(int)fHiGainWindowSize,
    174175                    " is bigger than available range: [",(int)fHiGainFirst,",",(int)fHiGainLast,"]") << endl;
    175176      *fLog << warn << GetDescriptor()
    176177            << ": Will set window size to: " << (int)availhirange << endl;
    177       fWindowSizeHiGain = availhirange;
    178     }
    179  
    180  
    181   if (fWindowSizeLoGain > availlorange)
     178      fHiGainWindowSize = availhirange;
     179    }
     180 
     181 
     182  if (fLoGainWindowSize > availlorange)
    182183    {
    183184      *fLog << warn << GetDescriptor()
    184             << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fWindowSizeLoGain,
     185            << Form("%s%2i%s%2i%s%2i%s",": Lo Gain window size: ",(int)fLoGainWindowSize,
    185186                    " is bigger than available range: [",(int)fLoGainFirst,",",(int)fLoGainLast,"]") << endl;
    186187      *fLog << warn << GetDescriptor()
    187188            << ": Will set window size to: " << (int)availlorange << endl;
    188       fWindowSizeLoGain = availlorange;
    189     }
    190  
    191   if (fWindowSizeHiGain<2)
    192     {
    193       fWindowSizeHiGain = 2;
     189      fLoGainWindowSize = availlorange;
     190    }
     191 
     192  if (fHiGainWindowSize<2)
     193    {
     194      fHiGainWindowSize = 2;
    194195      *fLog << warn << GetDescriptor() << ": Hi Gain window size set to two samples" << endl;
    195196    }
    196197 
    197   if (fWindowSizeLoGain<2)
    198     {
    199       fWindowSizeLoGain = 2;
     198  if (fLoGainWindowSize<2)
     199    {
     200      fLoGainWindowSize = 2;
    200201      *fLog << warn << GetDescriptor() << ": Lo Gain window size set to two samples" << endl;
    201202    }
     
    208209    }
    209210
    210   fNumHiGainSamples = (Float_t)fWindowSizeHiGain;
    211   fNumLoGainSamples = (Float_t)fWindowSizeLoGain;
     211  fNumHiGainSamples = (Float_t)fHiGainWindowSize;
     212  fNumLoGainSamples = (Float_t)fLoGainWindowSize;
    212213
    213214  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
     
    295296// FindSignalHiGain:
    296297//
    297 // - Loop from ptr to (ptr+fWindowSizeHiGain)
     298// - Loop from ptr to (ptr+fHiGainWindowSize)
    298299// - Sum up contents of *ptr
    299300// - If *ptr is greater than fSaturationLimit, raise sat by 1
     
    302303{
    303304
    304   Byte_t *end = ptr + fWindowSizeHiGain-fHiLoLast;
     305  Byte_t *end = ptr + fHiGainWindowSize-fHiLoLast;
    305306
    306307  Int_t summ = 0;
     
    316317
    317318  //
    318   // If part of the "low-Gain" slices are used,
     319  // If part of the "lo-Gain" slices are used,
    319320  // repeat steps one and two for the logain part until fHiLoLast
    320321  //
     
    337338// FindSignalLoGain:
    338339//
    339 // - Loop from ptr to (ptr+fWindowSizeLoGain)
     340// - Loop from ptr to (ptr+fLoGainWindowSize)
    340341// - Sum up contents of *ptr
    341342// - If *ptr is greater than fSaturationLimit, raise sat by 1
     
    349350  Int_t summ = 0;
    350351
    351   while (p<ptr+fWindowSizeLoGain)
     352  while (p<ptr+fLoGainWindowSize)
    352353    {
    353354      summ += *p;
     
    400401
    401402
    402   loGainFirst = ( hiGainFirst+fLowGainPeakShift > fLoGainFirst ) ?
    403       hiGainFirst+fLowGainPeakShift : fLoGainFirst;
     403  loGainFirst = ( hiGainFirst+fLoGainPeakShift > fLoGainFirst ) ?
     404      hiGainFirst+fLoGainPeakShift : fLoGainFirst;
    404405
    405406  // Make sure we will not integrate beyond the hi gain limit:
    406   if (hiGainFirst+fWindowSizeHiGain > pixel.GetNumHiGainSamples())
    407     fHiLoLast = hiGainFirst+fWindowSizeHiGain - pixel.GetNumHiGainSamples();
    408   //    hiGainFirst = pixel.GetNumHiGainSamples()-fWindowSizeHiGain;
     407  if (hiGainFirst+fHiGainWindowSize > pixel.GetNumHiGainSamples())
     408    fHiLoLast = hiGainFirst+fHiGainWindowSize - pixel.GetNumHiGainSamples();
     409  //    hiGainFirst = pixel.GetNumHiGainSamples()-fHiGainWindowSize;
    409410
    410411  // Make sure we will not integrate beyond the lo gain limit:
    411   if (loGainFirst+fWindowSizeLoGain > pixel.GetNumLoGainSamples())
    412     loGainFirst = pixel.GetNumLoGainSamples()-fWindowSizeLoGain;
     412  if (loGainFirst+fLoGainWindowSize > pixel.GetNumLoGainSamples())
     413    loGainFirst = pixel.GetNumLoGainSamples()-fLoGainWindowSize;
    413414
    414415  pixel.Reset();
     
    465466  return kTRUE;
    466467}
     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//
     478Int_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  
    1818  static const Byte_t fgPeakSearchWindowSize; // Default for fPeakSearchWindowSize (now set to: 4)
    1919  static const Byte_t fgOffsetFromWindow;     // Default for fOffsetFromWindow (now set to: 1)
    20   static const Byte_t fgLowGainPeakShift;     // Default for fLowGainPeakShift (now set to: 0)
     20  static const Byte_t fgLoGainPeakShift;      // Default for fLowGainPeakShift (now set to: 0)
    2121
    22   Byte_t  fWindowSizeHiGain;     // Number of Hi Gain slices in window
    23   Byte_t  fWindowSizeLoGain;     // Number of Lo Gain slices in window
     22  Byte_t  fHiGainWindowSize;     // Number of Hi Gain slices in window
     23  Byte_t  fLoGainWindowSize;     // Number of Lo Gain slices in window
    2424  Byte_t  fPeakSearchWindowSize; // Size of FADC window in the search for the highest peak of all pixels.
    2525  Byte_t  fOffsetFromWindow;     // Number of slices to start extraction before search window
    26   Byte_t  fLowGainPeakShift;     // 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.
    2727
    2828  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const;
     
    3131  void   FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat) const;
    3232
    33   Bool_t  ReInit(MParList *pList);
     33  Bool_t ReInit(MParList *pList);
    3434  Int_t  Process();
     35  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    3536 
    3637public:
     
    4344    void SetOffsetFromWindow(Byte_t offset=fgOffsetFromWindow)  {  fOffsetFromWindow = offset; }
    4445
    45     void SetLowGainPeakShift(Byte_t shift=fgLowGainPeakShift) { fLowGainPeakShift = shift; }
     46    void SetLoGainPeakShift(Byte_t shift=fgLoGainPeakShift) { fLoGainPeakShift = shift; }
    4647   
    4748    ClassDef(MExtractFixedWindowPeakSearch, 0) // Signal Extractor for fixed size trigger-corrected extraction window
  • trunk/MagicSoft/Mars/msignal/MExtractTimeHighestIntegral.cc

    r4371 r4722  
    1717!
    1818!   Author(s): Thomas Bretz, 02/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    19 !             Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de>
     19!   Author(s): Hendrik Bartko, 02/2004 <mailto:hbartko@mppmu.mpg.de>
    2020!
    2121!   Copyright: MAGIC Software Development, 2000-2004
     
    297297}
    298298
     299// --------------------------------------------------------------------------
     300//
     301// In addition to the resources of the base-class MExtractor:
     302//   MJPedestal.MExtractor.WindowSizeHiGain: 6
     303//   MJPedestal.MExtractor.WindowSizeLoGain: 6
     304//
     305Int_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  
    2424  void FindTimeHiGain(Byte_t *first, Float_t &time, Float_t &dtime, Byte_t &sat, const MPedestalPix &ped) const;
    2525  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);
    2628 
    2729public:
Note: See TracChangeset for help on using the changeset viewer.