Changeset 3925


Ignore:
Timestamp:
05/01/04 12:34:15 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3924 r3925  
    3131       the "low-gain" slices instead. This is necessary for the March
    3232       data!
     33
     34   * mjobs/MJCalibration.[h,cc]
     35     - accept arrival time extractors deriving from MTimeExtractor
    3336
    3437
  • trunk/MagicSoft/Mars/macros/calibration.C

    r3913 r3925  
    5757static const TString inpath = "/mnt/Data/rootdata/Miscellaneous/2004_03_03/";
    5858static const Int_t pedrun  = 20123;
    59 static const Int_t calrun1 = 20126;
     59static const Int_t calrun1 = 20125;
    6060static const Int_t calrun2 = 0;
    6161
     
    6363{
    6464
     65
     66  //
     67  // Choose the signal Extractor:
     68  //
    6569  MExtractFixedWindowPeakSearch extractor;
    66   //  extractor.SetRange(0,14,0,14);
     70  //  MExtractSlidingWindow  extractor;   
     71  //  MExtractFixedWindow    extractor;   
    6772
    68   // MExtractSlidingWindow  extractor;   
    69   // MExtractFixedWindow    extractor;   
     73  //
     74  // Set Ranges or Windows
     75  //
     76  //  extractor.SetRange(2,14,5,14);
     77  //  extractor.SetWindows(8,8);
    7078
     79  //
     80  // Choose the arrival time Extractor:
     81  //
    7182  MExtractTimeHighestIntegral timeext;
     83  // MExtractTimeSpline timeext;
     84  //
     85  // Set Ranges or Windows
     86  //
     87  // timeext.SetRange(0,14,6,14);
    7288
    73   // MExtractTimeSpline timeext;
    74   // timeext.SetRange(0,14,6,14);
     89  //
     90  // Tell if you want to calibrate times:
     91  //
     92  Bool_t useTimes = kTRUE;
     93  //  Bool_t calibrateTimes = kFALSE; 
    7594
    7695  MRunIter pruns;
     
    103122  // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)
    104123  //
    105   //  badcam.AsciiRead("badpixels.dat");
     124  badcam.AsciiRead("badpixels.dat");
    106125
    107126  MJPedestal pedloop;
     
    133152  // If you want to calibrate the times as well, choose:
    134153  //
    135   calloop.SetRelTimeCalibration();
     154  calloop.SetRelTimeCalibration(useTimes);
    136155  calloop.SetExtractor(&extractor);
    137156  calloop.SetTimeExtractor(&timeext);
     
    162181  testloop.SetDisplay(display);
    163182  testloop.SetBadPixels(calloop.GetBadPixels());
    164   if (!testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam()))
    165     return;
    166 
     183  testloop.ProcessD(pedloop.GetPedestalCam(),calloop.GetCalibrationCam(),calloop.GetQECam());
     184 
    167185}
    168186
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r3913 r3925  
    113113#include "MHCalibrationRelTimeCam.h"
    114114#include "MCalibrationRelTimeCam.h"
     115#include "MCalibrationRelTimeCalc.h"
    115116
    116117#include "MReadMarsFile.h"
     
    775776//   13) MCalibrationChargeCalc
    776777//   14) MFillH("MHCalibrationRelTimeCam",     "MArrivalTimeCam") (only if flag fRelTimes is chosen)
     778//   15) MCalibrationRelTimeCalc
    777779// - Execute MEvtLoop
    778780// - DisplayResult()
     
    841843  MExtractTimeSpline       timespline;
    842844  MCalibrationChargeCalc   calcalc;
     845  MCalibrationRelTimeCalc  timecalc;
    843846 
    844847  //
     
    902905
    903906  if (fRelTimes)
    904     tlist.AddToList(&filltme);
     907    {
     908      tlist.AddToList(&filltme);
     909      tlist.AddToList(&timecalc);
     910    }
     911 
    905912
    906913  // Create and setup the eventloop
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc

    r3887 r3925  
    1616   !
    1717   !
    18    !   Author(s): Abelardo Moralejo, 4/2004 <mailto:moralejo@pd.infn.it>
    19    !              Markus Gaug      , 4/2004 <mailto:markus@ifae.es>
     18   !   Author(s): Abelardo Moralejo,04/2004 <mailto:moralejo@pd.infn.it>
     19   !              Markus Gaug      ,04/2004 <mailto:markus@ifae.es>
    2020   !   Copyright: MAGIC Software Development, 2000-2004
    2121   !
     
    7575using namespace std;
    7676
    77 const Byte_t MExtractFixedWindowPeakSearch::fgHiGainWindowSize     = 6;
    78 const Byte_t MExtractFixedWindowPeakSearch::fgLoGainWindowSize     = 6;
    79 const Byte_t MExtractFixedWindowPeakSearch::fgPeakSearchWindowSize = 4;
    8077const Byte_t MExtractFixedWindowPeakSearch::fgHiGainFirst          = 0;
    8178const Byte_t MExtractFixedWindowPeakSearch::fgHiGainLast           = 14;
    8279const Byte_t MExtractFixedWindowPeakSearch::fgLoGainFirst          = 3;
    8380const Byte_t MExtractFixedWindowPeakSearch::fgLoGainLast           = 14;
     81const Byte_t MExtractFixedWindowPeakSearch::fgHiGainWindowSize     = 6;
     82const Byte_t MExtractFixedWindowPeakSearch::fgLoGainWindowSize     = 6;
     83const Byte_t MExtractFixedWindowPeakSearch::fgPeakSearchWindowSize = 4;
     84const Byte_t MExtractFixedWindowPeakSearch::fgOffsetFromPeak       = 2;
    8485// --------------------------------------------------------------------------
    8586//
     
    9293//
    9394// Calls:
     95// - SetOffsetFromPeak()
    9496// - SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast)
    9597//
     
    103105  fTitle = title ? title : "Task to extract the signal from the FADC slices";
    104106
     107  SetOffsetFromPeak();
    105108  SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast);
    106109}
     
    171174    }
    172175 
     176 
    173177  if (fWindowSizeLoGain > availlorange)
    174178    {
     
    200204    }
    201205
    202 
    203206  fNumHiGainSamples = (Float_t)fWindowSizeHiGain;
    204207  fNumLoGainSamples = (Float_t)fWindowSizeLoGain;
     
    271274// - If *ptr is greater than fSaturationLimit, raise sat by 1
    272275//
    273 void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const
    274 {
     276void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const
     277{
     278
     279  Byte_t *end = ptr + fWindowSizeHiGain-fHiLoLast;
     280
    275281  //
    276282  // Calculate the sum of the "window" slices starting in ptr
    277283  //
    278   sum = 0;
    279   sat = 0;
    280   Byte_t *p = ptr;
    281 
    282   while (p<ptr+fWindowSizeHiGain)
    283     {
     284  while (ptr<end)
     285    {
     286      sum += *ptr;
     287      if (*ptr++ >= fSaturationLimit)
     288        sat++;
     289    }
     290
     291  //
     292  // If part of the "low-Gain" slices are used,
     293  // repeat steps one and two for the logain part until fHiLoLast
     294  //
     295  Byte_t *p = logain;
     296  end = logain + fHiLoLast;
     297  while (p<end)
     298    {
     299 
    284300      sum += *p;
    285301      if (*p++ >= fSaturationLimit)
    286         sat++;
     302        sat++;
    287303    }
    288304
     
    323339// "startslice" will mark the slice at which the highest sum begins for that pixel.
    324340// Then define the beginning of the integration window for ALL pixels as the slice
    325 // before that: startslice-1 (this is somehow arbitrary), unless of course startslice=0,
     341// before that: startslice-fOffsetFraomPeak, unless of course startslice-fOffsetFromPeak<=0,
    326342// in which case we start at 0. We will also check that the integration window does not
    327343// go beyond the FADC limits.
     
    348364        {
    349365          maxsumhi = sumhi;
    350           if (startslice > 0)
    351             hiGainFirst = fHiGainFirst + startslice - 1;
     366          if ((startslice-fOffsetFromPeak) > 0)
     367            hiGainFirst = fHiGainFirst + startslice - fOffsetFromPeak;
    352368          else
    353369            hiGainFirst = fHiGainFirst;
     
    360376  // Make sure we will not integrate beyond the hi gain limit:
    361377  if (hiGainFirst+fWindowSizeHiGain > pixel.GetNumHiGainSamples())
    362     hiGainFirst = pixel.GetNumHiGainSamples()-fWindowSizeHiGain;
     378    fHiLoLast = hiGainFirst+fWindowSizeHiGain - pixel.GetNumHiGainSamples();
     379  //    hiGainFirst = pixel.GetNumHiGainSamples()-fWindowSizeHiGain;
    363380
    364381  // Make sure we will not integrate beyond the lo gain limit:
     
    375392      // Find signal in hi- and lo-gain
    376393      //
    377       Int_t sumhi;
    378       Byte_t sathi;
    379 
    380       FindSignalHiGain(pixel.GetHiGainSamples()+hiGainFirst, sumhi, sathi);
     394      Int_t sumhi=0;
     395      Byte_t sathi=0;
     396
     397      FindSignalHiGain(pixel.GetHiGainSamples()+hiGainFirst, pixel.GetLoGainSamples(), sumhi, sathi);
    381398
    382399      Int_t sumlo=0;
  • trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h

    r3887 r3925  
    1414  static const Byte_t fgLoGainFirst;
    1515  static const Byte_t fgLoGainLast;
    16   static const Byte_t fgHiGainWindowSize;     // The extraction window Hi-Gain
    17   static const Byte_t fgLoGainWindowSize;     // The extraction window Lo-Gain
    18   static const Byte_t fgPeakSearchWindowSize; // The window in which the global peak is searched for
    19 
     16  static const Byte_t fgHiGainWindowSize;     // Default for fWindowSizeHiGain (now set to: 6)
     17  static const Byte_t fgLoGainWindowSize;     // Default for fWindowSizeLoGain (now set to: 6)
     18  static const Byte_t fgPeakSearchWindowSize; // Default for fPeakSearchWindowSize (now set to: 4)
     19  static const Byte_t fgOffsetFromPeak;       // Default for fOffsetFromPeak   (now set to: 2)
     20 
    2021  Byte_t  fWindowSizeHiGain;     // Number of Hi Gain slices in window
    2122  Byte_t  fWindowSizeLoGain;     // Number of Lo Gain slices in window
    2223  Byte_t  fPeakSearchWindowSize; // Size of FADC window in the search for the highest peak of all pixels.
     24  Byte_t  fOffsetFromPeak;       // Number of slices to start extraction from global peak
    2325
    24 
    25   void   FindSignalHiGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;
     26  void   FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;
    2627  void   FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const; 
    2728
     
    2930
    3031  Int_t  Process();
    31 
     32 
    3233public:
    3334
     
    3738    void SetWindows(Byte_t windowh=fgHiGainWindowSize, Byte_t windowl=fgLoGainWindowSize,
    3839                    Byte_t peaksearchwindow=fgPeakSearchWindowSize);
    39 
     40    void SetOffsetFromPeak(Byte_t offset=fgOffsetFromPeak)    {  fOffsetFromPeak = offset; }
     41   
    4042    ClassDef(MExtractFixedWindowPeakSearch, 0) // Signal Extractor for fixed size trigger-corrected extraction window
    4143};
  • trunk/MagicSoft/Mars/msignal/MExtractPINDiode.cc

    r3911 r3925  
    129129  MExtractor::SetRange(hifirst,hilast,lofirst,lolast);
    130130
     131
     132  fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1);
     133  fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1); 
     134
     135  fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
     136  fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 
     137 
    131138  fNumSamples = fHiGainLast-fHiGainFirst+1+fLoGainLast-fLoGainFirst+1;
    132139  fSqrtSamples = TMath::Sqrt((Float_t)fNumSamples);
  • trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc

    r3886 r3925  
    194194// - Check if the sum has become bigger and store it in case yes.
    195195//
    196 void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const
     196void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &max, Byte_t &sat) const
    197197{
    198198    const Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1;
     
    205205    sat = 0;
    206206    Byte_t *p = ptr;
    207     while (p<ptr+fWindowSizeHiGain)
     207   
     208    while (p<ptr+fWindowSizeHiGain-fHiLoLast)
    208209    {
    209210        sum += *p;
     
    218219        if (*p++ >= fSaturationLimit)
    219220            sat++;
     221
     222    //
     223    // If part of the "low-Gain" slices are used,
     224    // repeat steps one and two for the logain part until fHiLoLast
     225    //
     226    Byte_t *l = logain;
     227    while (l<logain+fHiLoLast)
     228      {
     229        sum += *l;
     230        if (*l++ >= fSaturationLimit)
     231            sat++;
     232      }
     233
    220234
    221235    //
     
    225239    //
    226240    max=sum;
    227     for (p=ptr; p+fWindowSizeHiGain<end; p++)
    228     {
    229         sum += *(p+fWindowSizeHiGain) - *p;
     241    for (p=ptr; p+fWindowSizeHiGain-fHiLoLast<end; p++)
     242    {
     243        sum += *(p+fWindowSizeHiGain-fHiLoLast) - *p;
    230244        if (sum>max)
    231245            max = sum;
    232246    }
     247
     248    for (l=logain; l<logain+fHiLoLast; l++)
     249    {
     250        sum += *l - *p++;
     251        if (sum>max)
     252            max = sum;
     253    }
     254
    233255}
    234256
Note: See TracChangeset for help on using the changeset viewer.