Changeset 8192 for trunk/MagicSoft


Ignore:
Timestamp:
11/01/06 15:48:31 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/MagicSoft/Mars/Changelog

    r8190 r8192  
    3838     - further improved grouping
    3939
     40   * datacenter/macros/plotrundb.C:
     41     - added
     42
    4043   * msql/MSQLServer.[h,cc]:
    4144     - implemented a new function returning the primary key of a table
     
    4346       necessary to do a query
    4447     - changed the call to GetTables and GetColumns
     48
     49   * mhflux/MHFalseSource.[h,cc]:
     50     - added a DrawNicePlot feature like for MHAlpha
     51
     52   * mmain/MEventDisplay.cc:
     53     - added MPedestalSubtract
     54     - new default size
     55
     56   * mbase/MLogHtml.cc:
     57     - improved colors
     58
     59   * mcalib/MCalibrationRelTimeCalc.cc:
     60     - reformatted some output
     61
     62   * mhcalib/MHCalibrationCam.cc:
     63     - reformatted and improved output
     64     - do not complain about empty lo-gain histograms (BTW:
     65       it should complain if the histogram should not be empty!)
     66
     67   * mhcalib/MHCalibrationChargeCam.cc:
     68     - when filling the histograms only fill signals which are
     69       valid
     70     - do not count the number of lo-gain saturation slices, just
     71       check whether it is saturating or not
     72     - for the moment we do not take the fTimeLower/UpperLimit into
     73       account. It is enough if the extracted time is within the
     74       extraction range (TO BE IMPROVED!)
     75
     76   * mhcalib/MHCalibrationPulseTimeCam.cc:
     77     - improved output
     78     - do not check th elo-gain if hi-gain is already above saturation
     79       limit.
     80
     81   * mhcalib/MHCalibrationRelTimeCam.cc:
     82     - extended first bin from -4.975 to -9.975
     83     - correctly handle validity and saturation of the pixels
     84     - allow the reference pixel to be set from the resource file
     85
     86   * mhcalib/MHGausEvents.h:
     87     - exclude empty histograms in IsOnlyUnderflow and IsOnlyOverflow
     88
     89   * msignal/MExtractTimeAndCharge.[h,cc]:
     90     - added a new function which give an estimate for the arrival time
     91       in case of saturation
     92     - allow the arrival time to be a minimum of -1 before replacing
     93       it by a random value
     94     - in case of saturation use a polynomial of second order to
     95       get a better estimation of the arrival time
     96
    4597
    4698
  • TabularUnified trunk/MagicSoft/Mars/mbase/MLogHtml.cc

    r8051 r8192  
    110110    {
    111111    case 0:  break;
    112     case 1:  *fOut << "<font color=#aa0000>"; break;  // err
    113     case 2:  *fOut << "<font color=#00aaaa>"; break;  // warn
    114     case 3:  *fOut << "<font color=#00aa00>"; break;  // inf
    115     default: *fOut << "<font color=#0000aa>"; break;  // all others (dbg)
     112    case 1:  *fOut << "<font color='maroon'>"; break;  // err
     113    case 2:  *fOut << "<font color='#FF6600'>"; break;  // warn (olive?)
     114    case 3:  *fOut << "<font color='green'";    break;  // inf
     115    default: *fOut << "<font color='navy'>";    break;  // all others (dbg)
    116116    }
    117117
  • TabularUnified trunk/MagicSoft/Mars/mcalib/MCalibrationRelTimeCalc.cc

    r8142 r8192  
    362362      if (numareavalid[aidx] < 20)
    363363        {
    364           *fLog << warn << GetDescriptor() << ": Less than 20 pixels with valid time resolution found "
    365                 << "in area index: " << aidx << endl;
     364          *fLog << warn << "Area   " << setw(4) << aidx << ": Less than 20 pixels with valid time resolution found." << endl;
    366365          continue;
    367366        }
     
    397396      if ( res < lowlim[aidx] || res > upplim[aidx] )
    398397        {
    399           *fLog << warn << "Deviating time resolution: "
    400             << Form("%4.2f",res) << " out of range ["
    401                 << Form("%4.2f,%4.2f",lowlim[aidx],upplim[aidx]) << "] in pixel " << i << endl;
     398            *fLog << warn << "Pixel  " << setw(4) << i << ": Deviating time resolution: "
     399                << Form("%4.2f",res) << " out of range ["
     400                << Form("%4.2f,%4.2f",lowlim[aidx],upplim[aidx]) << "]" << endl;
    402401          bad.SetUncalibrated( MBadPixelsPix::kDeviatingTimeResolution);
    403402          pix.SetExcluded();
  • TabularUnified trunk/MagicSoft/Mars/mhcalib/MHCalibrationChargeCam.cc

    r8147 r8192  
    11/* ======================================================================== *\
     2! $Name: not supported by cvs2svn $:$Id: MHCalibrationChargeCam.cc,v 1.46 2006-11-01 15:48:31 tbretz Exp $
     3! --------------------------------------------------------------------------
    24!
    35! *
     
    1719!
    1820!   Author(s): Markus Gaug   02/2004 <mailto:markus@ifae.es>
     21!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
    1922!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     23!   Copyright: MAGIC Software Development, 2000-2006
    2124!
    2225!
     
    709712
    710713  for (UInt_t i=0; i<npixels; i++)
    711     {
    712 
     714  {
    713715      MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i];
    714 
    715716      if (histhi.IsExcluded())
    716717        continue;
    717718
    718       const MExtractedSignalPix &pix = (*signal)[i];
    719      
    720       const Float_t sumhi = pix.GetExtractedSignalHiGain();
    721       const Int_t   sathi = pix.IsHiGainSaturated() ? 1 : 0;
    722 
    723       if (IsOscillations())
    724         histhi.FillHistAndArray(sumhi);
    725       else
    726         histhi.FillHist(sumhi);
    727        
    728       histhi.AddSaturated(sathi);
    729 
    730719      const Int_t aidx   = (*fGeom)[i].GetAidx();
    731720      const Int_t sector = (*fGeom)[i].GetSector();
    732721
    733       fSumhiarea[aidx]  += sumhi;
    734       fSumhisector[sector]  += sumhi;
     722      const MExtractedSignalPix &pix = (*signal)[i];
     723
     724      const Int_t sathi = pix.IsHiGainSaturated() ? 1 : 0;
     725      histhi.AddSaturated(sathi);
    735726      if (sathi)
    736727      {
     
    739730      }
    740731
    741       if (IsLoGain())
    742         {
    743           MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
     732      if (pix.IsHiGainValid())
     733      {
     734          const Float_t sumhi = pix.GetExtractedSignalHiGain();
     735          if (IsOscillations())
     736              histhi.FillHistAndArray(sumhi);
     737          else
     738              histhi.FillHist(sumhi);
     739
     740          fSumhiarea[aidx]     += sumhi;
     741          fSumhisector[sector] += sumhi;
     742      }
     743
     744      if (!IsLoGain())
     745          continue;
     746
     747      MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)(*this)(i);
     748
     749      const Int_t satlo = pix.IsLoGainSaturated() ? 1 : 0;
     750      histlo.AddSaturated(satlo);
     751      if (satlo)
     752      {
     753          fSatloarea[aidx]++;
     754          fSatlosector[sector]++;
     755      }
     756
     757      /*
     758       // Previously:
     759       fSatloarea[aidx]     += pix.GetNumHiGainSaturated();
     760       fSatlosector[sector] += pix.GetNumHiGainSaturated();
     761       */
     762
     763      if (pix.IsLoGainValid())
     764      {
    744765          const Float_t sumlo = pix.GetExtractedSignalLoGain();
    745           const Int_t   satlo = pix.IsLoGainSaturated() ? 1 : 0;
    746          
     766
    747767          if (IsOscillations())
    748             histlo.FillHistAndArray(sumlo);
     768              histlo.FillHistAndArray(sumlo);
    749769          else
    750             histlo.FillHist(sumlo);
    751          
    752           histlo.AddSaturated(satlo);
    753          
    754           fSumloarea[aidx]  += sumlo;
    755           fSatloarea[aidx]  += satlo;
    756           fSumlosector[sector]  += sumlo;
    757           fSatlosector[sector]  += satlo;
    758         }
    759      
    760     }
     770              histlo.FillHist(sumlo);
     771
     772          fSumloarea[aidx]     += sumlo;
     773          fSumlosector[sector] += sumlo;
     774      }
     775  }
    761776
    762777  MRawEvtPixelIter pixel(fRawEvt);
    763778  while (pixel.Next())
    764     {
    765      
     779  {
    766780      const UInt_t pixid = pixel.GetPixelId();
    767781
     
    791805          fTimelosector[sector] += timelo;
    792806        }
    793     }
     807  }
    794808 
    795809  for (UInt_t j=0; j<nareas; j++)
     
    11251139    pix.SetAbsTimeRms(rms);
    11261140
    1127     const Float_t lowerlimit = (Float_t)first + fTimeLowerLimit;
    1128     const Float_t upperlimit = (Float_t)last - fTimeUpperLimit;
     1141    const Float_t lowerlimit = (Float_t)first;// + fTimeLowerLimit;
     1142    const Float_t upperlimit = (Float_t)last ;// - fTimeUpperLimit;
    11291143
    11301144    if (mean<lowerlimit)
    11311145    {
    11321146        *fLog << warn << hist.GetName() << ": Mean Arr.Time: "
    1133             << Form("%4.1f < %4.1f, %3.1f", mean, TMath::Floor(first)+fTimeLowerLimit, fTimeLowerLimit)
    1134             << " slices below " << Form("%2i", (Int_t)first) << endl;
    1135         bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin );
     1147            << Form("%4.1f < %4.1f, (%3.1f + %3.1)", mean, lowerlimit, fTimeLowerLimit, first) << endl;
     1148        bad.SetUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin);
    11361149    }
    11371150
     
    11391152    {
    11401153        *fLog << warn << hist.GetName() << ": Mean Arr.Time: "
    1141             << Form("%4.1f > %4.1f, %3.1f", mean, TMath::Floor(last)-fTimeUpperLimit, fTimeUpperLimit)
    1142             << " slices above " << Form("%2i", (Int_t)last) << endl;
    1143         bad.SetUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins );
     1154            << Form("%4.1f > %4.1f, (%3.1f - %3.1)", mean, upperlimit, fTimeUpperLimit, last) << endl;
     1155        bad.SetUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins);
    11441156    }
    11451157}
  • TabularUnified trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc

    r8147 r8192  
    11/* ======================================================================== *\
     2! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.25 2006-11-01 15:48:31 tbretz Exp $
     3! --------------------------------------------------------------------------
    24!
    35! *
     
    1719!
    1820!   Author(s): Markus Gaug   02/2004 <mailto:markus@ifae.es>
     21!   Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
    1922!
    20 !   Copyright: MAGIC Software Development, 2000-2004
     23!   Copyright: MAGIC Software Development, 2000-2006
    2124!
    2225!
     
    427430        }
    428431
     432      if (*max > fSaturationLimit)
     433        continue;
     434
    429435      start   = pixel.GetLoGainSamples();
    430436      end     = start + pixel.GetNumLoGainSamples();
     
    436442            {
    437443              max = p;
    438               maxpos = p-start+pixel.GetNumHiGainSamples() - 1;
     444              maxpos = p-start-1 + pixel.GetNumHiGainSamples();
    439445            }
    440446          p++;
     
    552558{
    553559
    554 
    555   if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
    556     {
    557       *fLog << warn << GetDescriptor() << ": Only over- or underflow in " << hist.GetName() << endl;
     560  if (hist.IsEmpty())
     561  {
     562      *fLog << warn << hist.GetName() << ": Histogram empty." << endl;
    558563      return;
    559     } 
     564  }
     565  if (hist.IsOnlyOverflow())
     566  {
     567      *fLog << warn << hist.GetName() << ": Histogram contains only overflows." << endl;
     568      return;
     569  }
     570  if (hist.IsOnlyUnderflow())
     571  {
     572      *fLog << warn << hist.GetName() << ": Histogram contains only underflows." << endl;
     573      return;
     574  }
    560575
    561576  hist.BypassFit();
  • TabularUnified trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc

    r8001 r8192  
    128128const Float_t MHCalibrationRelTimeCam::fgNumHiGainSaturationLimit = 0.25;
    129129const UInt_t  MHCalibrationRelTimeCam::fgReferencePixel = 1;
    130 const Int_t   MHCalibrationRelTimeCam::fgNbins      = 300;
    131 const Axis_t  MHCalibrationRelTimeCam::fgFirst      = -4.975;
     130const Int_t   MHCalibrationRelTimeCam::fgNbins      = 400;
     131const Axis_t  MHCalibrationRelTimeCam::fgFirst      = -9.975;
    132132const Axis_t  MHCalibrationRelTimeCam::fgLast       = 10.025;
    133133const Float_t MHCalibrationRelTimeCam::fgProbLimit  = 0.0;
     
    324324  fSumareahi  .Reset();
    325325  fSumarealo  .Reset();
    326   fSumsectorhi.Reset(); 
     326  fSumsectorhi.Reset();
    327327  fSumsectorlo.Reset();
    328   fNumareahi  .Reset(); 
     328  fNumareahi  .Reset();
    329329  fNumarealo  .Reset();
    330   fNumsectorhi.Reset(); 
     330  fNumsectorhi.Reset();
    331331  fNumsectorlo.Reset();
    332332
    333333  const MArrivalTimePix &refpix = (*arrtime)[fReferencePixel];
    334   const Float_t reftime = refpix.IsHiGainSaturated()
    335      ? refpix.GetArrivalTimeLoGain() : refpix.GetArrivalTimeHiGain();
     334  // FIXME: What do we do if pixel is invalid?
     335  if (!refpix.IsArrivalTimeValid())
     336  {
     337      gLog << warn << "WARNING - Arrival time in refrence pixel " << fReferencePixel << " invalid." << endl;
     338      return kTRUE;
     339  }
     340
     341  const Float_t reftime = refpix.GetArrivalTime();
     342//      refpix.IsHiGainSaturated()
     343//     ? refpix.GetArrivalTimeLoGain() : refpix.GetArrivalTimeHiGain();
    336344
    337345  for (Int_t i=0; i<npixels; i++)
    338     {
    339 
     346  {
    340347      MHCalibrationPix &histhi = (*this)[i];
    341 
    342348      if (histhi.IsExcluded())
    343         continue;
    344 
    345       const MArrivalTimePix &pix = (*arrtime)[i];
     349          continue;
     350
    346351      const Int_t aidx   = (*fGeom)[i].GetAidx();
    347352      const Int_t sector = (*fGeom)[i].GetSector();
    348353
    349       if (pix.IsHiGainSaturated() && IsLoGain())
    350         {
     354      const MArrivalTimePix &pix = (*arrtime)[i];
     355
     356      // If hi-gain arrival time has been extracted successfully
     357      // fill hi-gain histograms and arrays
     358      if (pix.IsHiGainValid() && !pix.IsHiGainSaturated())
     359      {
     360          const Float_t time = pix.GetArrivalTimeHiGain();
     361
     362          if (IsOscillations())
     363              histhi.FillHistAndArray(time-reftime);
     364          else
     365              histhi.FillHist(time-reftime);
     366
     367          fSumareahi  [aidx]   += time;
     368          fNumareahi  [aidx]   ++;
     369          fSumsectorhi[sector] += time;
     370          fNumsectorhi[sector] ++;
     371      }
     372
     373      if (!pix.IsHiGainSaturated())
     374          continue;
     375
     376      histhi.AddSaturated(1);
     377
     378      // If lo-gain arrival time has been extracted successfully,
     379      // the hi-gain has saturateed and the lo-gain is switched on
     380      // fill hi-gain histograms and arrays
     381      if (pix.IsLoGainValid() && IsLoGain())
     382      {
    351383          const Float_t time = pix.GetArrivalTimeLoGain();
    352           histhi.AddSaturated(1);
    353384
    354385          MHCalibrationPix &histlo = (*this)(i);
    355           if (IsOscillations())
     386          if (IsOscillations())
    356387              histlo.FillHistAndArray(time-reftime);
    357388          else
     
    362393          fSumsectorlo[sector] += time;
    363394          fNumsectorlo[sector] ++;
    364         }
    365       else
    366         {
    367           const Float_t time = pix.GetArrivalTimeHiGain();
    368 
    369           if (IsOscillations())
    370               histhi.FillHistAndArray(time-reftime);
    371           else
    372               histhi.FillHist(time-reftime);
    373 
    374           fSumareahi  [aidx]   += time;
    375           fNumareahi  [aidx]   ++;
    376           fSumsectorhi[sector] += time;
    377           fNumsectorhi[sector] ++;
    378         }
    379     }
    380  
     395      }
     396  }
     397
    381398  for (Int_t j=0; j<nareas; j++)
    382399    {
     
    848865Int_t MHCalibrationRelTimeCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    849866{
    850 
    851   Bool_t rc = kFALSE;
    852 
    853   if (IsEnvDefined(env, prefix, "ReferenceFile", print))
    854     {
    855       SetReferenceFile(GetEnvValue(env,prefix,"ReferenceFile",fReferenceFile.Data()));
    856       rc = kTRUE;
    857     }
    858 
    859   TEnv refenv(fReferenceFile);
    860 
    861   fInnerRefTime = refenv.GetValue("InnerRefTime",fInnerRefTime);
    862   fOuterRefTime = refenv.GetValue("OuterRefTime",fOuterRefTime);
    863 
    864   return MHCalibrationCam::ReadEnv(env,prefix,print) ? kTRUE : rc;
    865 
    866 }
     867    Bool_t rc = kFALSE;
     868
     869    if (IsEnvDefined(env, prefix, "ReferenceFile", print))
     870    {
     871        SetReferenceFile(GetEnvValue(env, prefix, "ReferenceFile", fReferenceFile.Data()));
     872        rc = kTRUE;
     873    }
     874
     875    if (IsEnvDefined(env, prefix, "ReferencePixel", print))
     876    {
     877        SetReferencePixel(GetEnvValue(env, prefix, "ReferencePixel", (Int_t)fReferencePixel));
     878        rc = kTRUE;
     879    }
     880
     881    TEnv refenv(fReferenceFile);
     882
     883    fInnerRefTime = refenv.GetValue("InnerRefTime", fInnerRefTime);
     884    fOuterRefTime = refenv.GetValue("OuterRefTime", fOuterRefTime);
     885
     886    return MHCalibrationCam::ReadEnv(env,prefix,print) ? kTRUE : rc;
     887}
  • TabularUnified trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h

    r8023 r8192  
    146146  const Bool_t   IsFourierSpectrumOK()   const { return TESTBIT(fFlags,kFourierSpectrumOK); }
    147147  const Bool_t   IsGausFitOK()           const { return TESTBIT(fFlags,kGausFitOK);         }
    148   const Bool_t   IsOnlyOverflow()        const { return fHGausHist.GetEntries() == fHGausHist.GetBinContent(fNbins+1); }
    149   const Bool_t   IsOnlyUnderflow()       const { return fHGausHist.GetEntries() == fHGausHist.GetBinContent(0);        }
     148  const Bool_t   IsOnlyOverflow()        const { return fHGausHist.GetEntries()>0 && fHGausHist.GetEntries() == fHGausHist.GetBinContent(fNbins+1); }
     149  const Bool_t   IsOnlyUnderflow()       const { return fHGausHist.GetEntries()>0 && fHGausHist.GetEntries() == fHGausHist.GetBinContent(0);        }
    150150
    151151  // Prints
  • TabularUnified trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r8171 r8192  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.57 2006-10-27 13:49:42 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndCharge.cc,v 1.58 2006-11-01 15:48:31 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    167167// --------------------------------------------------------------------------
    168168//
     169// Return the x-value lower than sat0 at which the signal has been
     170// fallen bwlow maxcont/2. This time is determined using a simple second
     171// order polynomial interpolation.
     172//
     173Double_t MExtractTimeAndCharge::GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxcont) const
     174{
     175    const Int_t p = sat0>1 ? sat0-2 : sat0-1;
     176    if (sat0<=0)
     177        return 0;
     178
     179    // Find the place at which the signal is maxcont/2
     180    const TVector3 vx(sig[p], sig[p+1], sig[p+2]);
     181    const TVector3 vy(p, p+1, p+2);
     182
     183    return MMath::InterpolParabLin(vx, vy, maxcont/2);
     184}
     185
     186// --------------------------------------------------------------------------
     187//
    169188// Calculate the integral of the FADC time slices and store them as a new
    170189// pixel in the MArrivalTimeCam container.
     
    199218        // Do not even try to extract the hi-gain if we have
    200219        // more than one saturating slice
     220        const Int_t rangehi = fHiGainLast - fHiGainFirst + 1;
     221
    201222        if (numsathi<2)
    202         {
    203             const Int_t rangehi = fHiGainLast - fHiGainFirst + 1;
    204223            FindTimeAndChargeHiGain2(sig+fHiGainFirst, rangehi,
    205224                                     sumhi, deltasumhi, timehi, deltatimehi,
    206225                                     numsathi, maxposhi);
    207 
    208 
    209             // Make sure that in cases the time couldn't be correctly determined
    210             // more meaningfull default values are assigned
    211             //if (timehi<fHiGainFirst || timehi>=fHiGainLast-1)
    212             if (deltatimehi>-0.5 && (timehi<0 || timehi>=fHiGainLast-fHiGainFirst+1))
    213                 timehi = gRandom->Uniform(fHiGainLast-fHiGainFirst+1);
    214 
    215             timehi += fHiGainFirst;
    216         }
    217226
    218227        // If we have saturating slices try to get a better estimate
     
    221230        if (numsathi>1)
    222231        {
    223             const Int_t p = sathi0>1 ? sathi0-2 : sathi0-1;
    224             if (sathi0>0)
    225             {
    226                 // Find the place at which the signal is maxcont/2
    227                 const TVector3 vx(sig[p], sig[p+1], sig[p+2]);
    228                 const TVector3 vy(p, p+1, p+2);
    229                 timehi=MMath::InterpolParabLin(vx, vy, maxcont/2);
    230             }
    231             else
    232                 timehi=0;
     232            timehi = GetSaturationTime(sathi0, sig, maxcont)-fHiGainFirst;
     233            deltatimehi = 0;
    233234        }
     235
     236        // Make sure that in cases the time couldn't be correctly determined
     237        // more meaningfull default values are assigned.
     238        // For extractors like the digital filter and the spline
     239        // we allow extracpolation by one slice.
     240        if (deltatimehi>-0.5 && (timehi<-1 || timehi>=rangehi))
     241        {
     242            // Flag this as unreliable!
     243            timehi = gRandom->Uniform(rangehi+1)-1;
     244            // deltatimehi=-1;
     245        }
     246
     247        timehi += fHiGainFirst;
    234248
    235249        Float_t sumlo =0, deltasumlo =-1;  // invalidate logain of MExtractedSignalPix
     
    280294            //
    281295            // The jitter in the hi-/lo-gain offset ssems to be around +/-0.5
    282             first = TMath::FloorNint(timehi+numh+fOffsetLoGain+fLoGainStartShift);
     296            if (deltatimehi>-0.5)
     297                first = TMath::FloorNint(timehi+numh+fOffsetLoGain+fLoGainStartShift);
     298            //else ???
     299
    283300            if (first<0)
    284301                first = 0;
     
    302319            numsatlo = fSignal->GetSaturation(pixidx, fSaturationLimit, satlo0, satlo1);
    303320
    304             FindTimeAndChargeLoGain2(sig+first, last-first+1,
     321            const Int_t rangelo = last-first+1;
     322            FindTimeAndChargeLoGain2(sig+first, rangelo,
    305323                                     sumlo, deltasumlo, timelo, deltatimelo,
    306324                                     numsatlo, maxposlo);
    307325
     326            // If we have saturating slices try to get a better estimate
     327            // of the arrival time than timehi or sathi0. This is
     328            // usefull to know where to start lo-gain extraction.
     329            if (numsatlo>1)
     330            {
     331                timelo = GetSaturationTime(satlo0, sig, maxlo)-numh-first;
     332                deltatimelo = 0;
     333            }
     334
    308335            // Make sure that in cases the time couldn't be correctly determined
    309336            // more meaningfull default values are assigned
    310             //if (timehi<fHiGainFirst || timehi>=fHiGainLast-1)
    311             if (deltatimelo>-0.5 && (timelo<0 || timelo>=last-first+1))
    312                 timelo = gRandom->Uniform(last-first+1);
     337            // For extractors like the digital filter and the spline
     338            // we allow extracpolation by one slice.
     339            if (deltatimelo>-0.5 && (timelo<-1 || timelo>=rangelo))
     340            {
     341                // Flag this as unreliable!
     342                timelo = gRandom->Uniform(rangelo+1)-1;
     343                //deltatimelo=-1;
     344            }
    313345
    314346            timelo += first-numh;
     
    323355            //    deltatimelo = -1;
    324356        }
     357
    325358
    326359        // Now store the result in the corresponding containers
  • TabularUnified trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.h

    r8165 r8192  
    2424  Int_t  Process();
    2525  Int_t  ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     26
     27  Double_t GetSaturationTime(Int_t sat0, const Float_t *sig, Int_t maxcont) const;
    2628
    2729public:
Note: See TracChangeset for help on using the changeset viewer.