Changeset 5294


Ignore:
Timestamp:
10/20/04 11:48:20 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5293 r5294  
    2525     - fixed a small bug concerning the way the second derivatives are
    2626       calculated. The effect is less than 1% on the time resolution
     27
     28   * msignal/MExtractTimeFastSpline.cc
     29     - comment the search for the half maximum and use the maximum again.
     30       The half maximum fails sometimes by 0.5 slices which seems to be
     31       some intrinsic behavior of the calibration pulses.
     32       The maximum seems to be OK, though.
    2733
    2834
  • trunk/MagicSoft/Mars/msignal/MExtractTimeFastSpline.cc

    r4752 r5294  
    5353const Byte_t  MExtractTimeFastSpline::fgLoGainLast   = 14;
    5454const Float_t MExtractTimeFastSpline::fgResolution   = 0.003;
    55 const Float_t MExtractTimeFastSpline::fgRiseTime     = 1.5;
     55const Float_t MExtractTimeFastSpline::fgRiseTime     = 2.;
    5656
    5757// --------------------------------------------------------------------------
     
    168168  // Check for saturation in all other slices
    169169  //
    170   while (++p<end)
     170  while (p<end)
    171171    {
    172172      if (*p > max)
     
    176176        }
    177177
    178       if (*p >= fSaturationLimit)
     178      if (*p++ >= fSaturationLimit)
    179179        {
    180180          sat++;
     
    183183    }
    184184 
    185   if (sat)
     185  //
     186  // allow one saturated slice
     187  //
     188  if (sat > 1)
    186189    return;
    187190
    188   if (maxpos < 2)
    189     return;
     191  if (maxpos < 1)
     192    {
     193      time = -999.;
     194      return;
     195    }
    190196 
    191197  Float_t pp;
     
    200206      pp = fHiGainSecondDeriv[i-1] + 4.;
    201207      fHiGainSecondDeriv[i] = -1.0/pp;
    202       const Double_t deriv = *(p+1) - 2.* *(p) + *(p-1);
    203       fHiGainFirstDeriv [i] = (6.0*deriv-fHiGainFirstDeriv[i-1])/pp;
     208      fHiGainFirstDeriv [i] = *(p+1) - 2.* *(p) + *(p-1);
     209      fHiGainFirstDeriv [i] = (6.0*fHiGainFirstDeriv[i]-fHiGainFirstDeriv[i-1])/pp;
    204210    }
    205211
     
    229235
    230236  //
    231   // Search for the maximum, starting in interval maxpos-1. If no maximum is found, go to
    232   // interval maxpos+1.
    233   //
    234 
     237  // Search for the maximum, starting in interval maxpos-1 in steps of 0.2 till maxpos-0.2.
     238  // If no maximum is found, go to interval maxpos+1.
     239  //
    235240  Float_t higainklo = fHiGainSecondDeriv[klo];
    236241  Float_t higainkhi = fHiGainSecondDeriv[khi];
    237   while (x<upper-0.3)
     242
     243  while ( x < upper - 0.3 )
    238244    {
    239245     
     
    254260    }
    255261 
    256 
    257  if (time > upper-0.1)
     262  //
     263  // Search for the absolute maximum from maxpos to maxpos+1 in steps of 0.2
     264  //
     265  if (time > upper-0.1)
    258266    {
    259267
     
    270278      higainklo = fHiGainSecondDeriv[klo];
    271279      higainkhi = fHiGainSecondDeriv[khi];
     280
    272281      while (x<upper-0.3)
    273282        {
     
    289298        }
    290299  }
    291  
    292   const Float_t up = time+step-0.055;
    293   const Float_t lo = time-step+0.055;
     300
     301  //
     302  // Now, the time, abmax and khicont and klocont are set correctly within the previous precision.
     303  // Try a better precision.
     304  //
     305  const Float_t up = time+step-0.035;
     306  const Float_t lo = time-step+0.035;
    294307  const Float_t maxpossave = time;
    295 
     308 
    296309  x     = time;
    297310  a     = upper - x;
    298311  b     = x - lower;
    299312
    300   step  = 0.04; // step size of 83 ps
     313  step  = 0.025; // step size of 83 ps
    301314
    302315  higainklo = fHiGainSecondDeriv[klo];
    303316  higainkhi = fHiGainSecondDeriv[khi];
    304   while (x<up)
     317
     318  //
     319  // First, try from time up to time+0.2 in steps of 83ps.
     320  //
     321  while ( x < up )
    305322    {
    306323
     
    322339    }
    323340
    324   if (time < klo + 0.02)
     341
     342  //
     343  // Second, try from time down to time-0.2 in steps of 0.04.
     344  //
     345  x     = maxpossave;
     346  //
     347  // Test the possibility that the absolute maximum has not been found between
     348  // maxpos and maxpos+0.02, then we have to look between maxpos-0.02 and maxpos
     349  // which requires new setting of klocont and khicont
     350  //
     351  if (x < klo + 0.02)
    325352    {
    326353      klo--;
     
    332359    }
    333360 
    334   x     = maxpossave;
    335361  a     = upper - x;
    336362  b     = x - lower;
     
    338364  higainklo = fHiGainSecondDeriv[klo];
    339365  higainkhi = fHiGainSecondDeriv[khi];
    340   while (x>lo)
     366
     367  while ( x > lo )
    341368    {
    342369
     
    360387  const Float_t halfmax = pedes + (abmax - pedes)/2.;
    361388
     389#if 0
    362390  //
    363391  // Now, loop from the maximum bin leftward down in order to find the position of the half maximum.
     
    381409  klocont = (Float_t)*(first+klo);
    382410  khicont = (Float_t)*(first+klo+1);
    383   time  = x;
    384411
    385412  step = 0.5;
     
    415442     
    416443    }
    417 
    418444  time  = (Float_t)fHiGainFirst + x;
    419   dtime = fResolution;
     445
     446#endif
     447  dtime = 0.035;
     448
    420449}
    421450
     
    431460  const Int_t range = fLoGainLast - fLoGainFirst + 1;
    432461  const Byte_t *end = first + range;
    433   Byte_t *p = first;
     462  Byte_t       *p  = first;
    434463  Byte_t max    = 0;
    435464  Byte_t maxpos = 0;
     
    438467  // Check for saturation in all other slices
    439468  //
    440   while (++p<end)
     469  while (p<end)
    441470    {
    442471      if (*p > max)
     
    446475        }
    447476
    448       if (*p >= fSaturationLimit)
     477      if (*p++ >= fSaturationLimit)
    449478        {
    450479          sat++;
     
    456485    return;
    457486
    458   if (maxpos < 2)
     487  if (maxpos < 1)
    459488    return;
    460489 
Note: See TracChangeset for help on using the changeset viewer.