Ignore:
Timestamp:
01/05/05 14:29:59 (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/MArrivalTimePix.cc

    r3899 r5701  
    5353//
    5454MArrivalTimePix::MArrivalTimePix(const char* name, const char* title)
    55   : fArrivalTimeHiGain(gkSignalInitializer),
    56     fArrivalTimeHiGainError(gkSignalInitializer),
    57     fArrivalTimeLoGain(gkSignalInitializer),
    58     fArrivalTimeLoGainError(gkSignalInitializer),
    59     fNumHiGainSaturated(0),
    60     fNumLoGainSaturated(0)
    6155{
    6256  fName  = name  ? name  : "MArrivalTimePix";
    6357  fTitle = title ? title : "Container of the Extracted Signals";
     58
     59  Clear();
    6460}
    6561
     
    7167{
    7268  fArrivalTimeHiGain      = gkSignalInitializer;
    73   fArrivalTimeHiGainError = gkSignalInitializer;
     69  fArrivalTimeHiGainError = -1;
    7470  fArrivalTimeLoGain      = gkSignalInitializer;
    75   fArrivalTimeLoGainError = gkSignalInitializer;
     71  fArrivalTimeLoGainError = -1;
    7672 
    7773  fNumHiGainSaturated = 0;
     
    9692Bool_t MArrivalTimePix::IsValid() const
    9793{
    98     return fArrivalTimeHiGain >= 0. || fArrivalTimeHiGainError >= 0.;
     94    return (!IsLoGainUsed() && fArrivalTimeHiGainError >= 0) || (IsLoGainUsed() && fArrivalTimeLoGainError >= 0);
    9995}
    10096
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndCharge.cc

    r5601 r5701  
    171171      // Find signal in hi- and lo-gain
    172172      //
    173       Float_t sumhi =0., deltasumhi =0.;
    174       Float_t timehi=0., deltatimehi=0.;
     173      Float_t sumhi =0., deltasumhi =0; // Set hi-gain of MExtractedSignalPix valid
     174      Float_t timehi=0., deltatimehi=0; // Set hi-gain of MArrivalTimePix valid
    175175      Byte_t sathi=0;
    176176
    177       const Int_t pixid = pixel.GetPixelId();
    178       const MPedestalPix  &ped = (*fPedestals)[pixid];
     177      const Int_t pixidx = pixel.GetPixelId();
     178      const MPedestalPix  &ped = (*fPedestals)[pixidx];
    179179      const Bool_t higainabflag = pixel.HasABFlag();
    180180
     
    183183                              timehi, deltatimehi,
    184184                              sathi, ped, higainabflag);
     185
     186      // Make sure that in cases the time couldn't be correctly determined
     187      // more meaningfull default values are assigned
     188      if (timehi<0)
     189          timehi = -1;
     190      if (timehi>pixel.GetNumHiGainSamples())
     191          timehi = pixel.GetNumHiGainSamples();
    185192     
    186       Float_t sumlo =0., deltasumlo =0.;
    187       Float_t timelo=0., deltatimelo=0.;
     193      Float_t sumlo =0., deltasumlo =-1.; // invalidate logain of MExtractedSignalPix
     194      Float_t timelo=0., deltatimelo=-1;  // invalidate logain of MArrivalTimePix
    188195      Byte_t satlo=0;
    189196     
     
    192199      //
    193200      if (pixel.HasLoGain())
    194         {
     201      {
     202          deltasumlo  = 0; // make logain of MExtractedSignalPix valid
     203          deltatimelo = 0; // make logain of MArrivalTimePix valid
     204
    195205          fLoGainFirstSave = fLoGainFirst;
    196206          const Byte_t logainstart = (Byte_t)(timehi+fLoGainStartShift);
    197207          if (!sathi)
    198             fLoGainFirst = logainstart > fLoGainFirstSave ? logainstart : fLoGainFirstSave;
    199        
    200           if ( fLoGainFirst < fLoGainLast )
    201             {
     208              fLoGainFirst = logainstart > fLoGainFirstSave ? logainstart : fLoGainFirstSave;
     209
     210          if (fLoGainFirst < fLoGainLast)
     211          {
    202212              const Bool_t logainabflag = (higainabflag + pixel.GetNumHiGainSamples()) & 0x1;
    203               FindTimeAndChargeLoGain(pixel.GetLoGainSamples()+fLoGainFirst, 
    204                                       sumlo, deltasumlo, 
    205                                       timelo, deltatimelo, 
     213              FindTimeAndChargeLoGain(pixel.GetLoGainSamples()+fLoGainFirst,
     214                                      sumlo, deltasumlo,
     215                                      timelo, deltatimelo,
    206216                                      satlo, ped, logainabflag);
    207             }
    208           fLoGainFirst     = fLoGainFirstSave;
    209         }
    210      
    211       MExtractedSignalPix &pix = (*fSignals)[pixid];
    212       MArrivalTimePix     &tix = (*fArrTime)[pixid];     
     217          }
     218          fLoGainFirst = fLoGainFirstSave;
     219
     220          // Make sure that in cases the time couldn't be correctly determined
     221          // more meaningfull default values are assigned
     222          if (timelo<0)
     223              timelo = -1;
     224          if (timelo>pixel.GetNumLoGainSamples())
     225              timelo = pixel.GetNumLoGainSamples();
     226      }
     227
     228      MExtractedSignalPix &pix = (*fSignals)[pixidx];
     229      MArrivalTimePix     &tix = (*fArrTime)[pixidx];
    213230
    214231      pix.SetExtractedSignal(sumhi, deltasumhi,sumlo, deltasumlo);
    215232      pix.SetGainSaturation(sathi, sathi, satlo);
    216      
     233
    217234      tix.SetArrivalTime(timehi, deltatimehi, timelo-fOffsetLoGain, deltatimelo);
    218235      tix.SetGainSaturation(sathi, sathi, satlo);
  • trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc

    r5570 r5701  
    517517  {
    518518    const Int_t   idx = fBinningResolutionLoGain*sample + fBinningResolutionHalfLoGain + t_iter;
    519     const Int_t   ids = max_p + sample;;
     519    const Int_t   ids = max_p + sample;
    520520    const Float_t pex = ids < 0 ? 0. : ( ids >= range ? 0. : fLoGainSignal[ids]);
    521521    sum              += fAmpWeightsLoGain [idx]*pex;
  • trunk/MagicSoft/Mars/msignal/MExtractedSignalPix.cc

    r3306 r5701  
    5353//
    5454MExtractedSignalPix::MExtractedSignalPix(const char* name, const char* title)
    55   : fExtractedSignalHiGain(gkSignalInitializer),
    56     fExtractedSignalHiGainError(gkSignalInitializer),
    57     fExtractedSignalLoGain(gkSignalInitializer),
    58     fExtractedSignalLoGainError(gkSignalInitializer),
    59     fLoGainUsed(kFALSE),
    60     fNumHiGainSaturated(0),
    61     fNumLoGainSaturated(0)
    6255{
    6356  fName  = name  ? name  : "MExtractedSignalPix";
    6457  fTitle = title ? title : "Container of the Extracted Signals";
     58
     59  Clear();
    6560}
    6661
     
    7267{
    7368  fExtractedSignalHiGain      = gkSignalInitializer;
    74   fExtractedSignalHiGainError = gkSignalInitializer;
     69  fExtractedSignalHiGainError = -1;
    7570  fExtractedSignalLoGain      = gkSignalInitializer;
    76   fExtractedSignalLoGainError = gkSignalInitializer;
     71  fExtractedSignalLoGainError = -1;
    7772 
    7873  fLoGainUsed = kFALSE;
     
    9994Bool_t MExtractedSignalPix::IsValid() const
    10095{
    101     return fExtractedSignalHiGain >= 0. || fExtractedSignalHiGainError >= 0.;
     96    return (!IsLoGainUsed() && fExtractedSignalHiGainError >= 0) || (IsLoGainUsed() && fExtractedSignalLoGainError >= 0);
    10297}
    10398
Note: See TracChangeset for help on using the changeset viewer.