Changeset 3601 for trunk/MagicSoft


Ignore:
Timestamp:
03/29/04 18:55:40 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3600 r3601  
    2929   * mbadpixels/MBadPixelsPix.cc
    3030     - put some documentation in the header
     31
     32   * mcalib/MHCalibrationChargeCam.cc
     33     - adopt to new style in MBadPixelsPix.h
    3134
    3235
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsCam.cc

    r3482 r3601  
    342342      break;
    343343    case 7:
    344       val = !(*this)[idx].IsCalibrationFitOK();
     344      val = !(*this)[idx].IsCalibrationResultOK();
    345345      return val;
    346346      break;
    347347    case 8:
    348       val = (*this)[idx].IsCalibrationOscillating();
     348      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainNotFitted);
    349349      return val;
    350350      break;
    351351    case 9:
    352       val = !(*this)[idx].IsCalibrationResultOK();
     352      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainNotFitted);
    353353      return val;
    354354      break;
    355355    case 10:
    356       val = (*this)[idx].IsHiGainSaturation();
     356     val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kHiGainOscillating);
    357357      return val;
    358358      break;
    359359    case 11:
    360       val = (*this)[idx].IsLoGainSaturation();
     360      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kLoGainSaturation );
    361361      return val;
    362362      break;
    363363    case 12:
    364       val = (*this)[idx].IsNotCalibrated();
     364      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeIsPedestal );
    365365      return val;
    366366      break;
    367367    case 13:
    368       val = (*this)[idx].IsMeanTimeInLastBin();
     368      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeErrNotValid);
    369369      return val;
    370370      break;
    371371    case 14:
    372       val = (*this)[idx].IsMeanTimeInFirstBin();     
     372      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeRelErrNotValid);
    373373      return val;
    374374      break;
    375375    case 15:
    376       val = (*this)[idx].IsLoGainOscillating();
     376      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kChargeSigmaNotValid );
    377377      return val;
    378378      break;
    379379    case 16:
    380       val = (*this)[idx].IsHiGainOscillating();
     380      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin  );
    381381      return val;
    382382      break;
    383383    case 17:
    384       val = (*this)[idx].IsConvHiLoNotValid();
     384      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins );
    385385      return val;
    386386      break;
    387387    case 18:
    388       val = (*this)[idx].IsChargeSigmaNotValid();
    389       return val;
    390       break;
    391     case 19:
    392       val = (*this)[idx].IsChargeRelErrNotValid();
    393       return val;
    394       break;
    395     case 20:
    396       val = (*this)[idx].IsChargeErrNotValid();
    397       return val;
    398     case 21:
    399       val = (*this)[idx].IsChargeIsPedestal();
    400       return val;
    401     case 22:
    402       val = (*this)[idx].IsLoGainNotFitted();
    403       return val;
    404       break;
    405     case 23:
    406       val = (*this)[idx].IsHiGainNotFitted();
     388      val = (*this)[idx].IsUncalibrated(MBadPixelsPix::kDeviatingNumPhes    );
    407389      return val;
    408390      break;
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.cc

    r3559 r3601  
    2323!
    2424\* ======================================================================== */
    25 
    2625/////////////////////////////////////////////////////////////////////////////
    2726//
    2827// MBadPixelsPix
     28//
     29// The bits of an integer array fInfo are used to declare and inform about
     30// possible defects in a pixel. Default and absence of defects create an array
     31// of zeros.
     32//
     33// The first index (fInfo[0]) holds general information which is coded as follows:
     34// * BIT(1): Unsuitable Run: The pixel is not suited for analysis for the entire run
     35// * BIT(2): Unsuitable Evt: The pixel is not suited for analysis for the current event
     36// * BIT(3): Unreliable Run: The pixel can in principle be used for analysis, although
     37//                           previous analysis steps have yielded certain inconsistencies
     38//
     39// These bits can be called with the enum MBadPixelsPix::UnsuitableTupe_t in combination
     40// with the function IsUnsuitable(MBadPixelsPix::UnsuitableTupe_t), e.g.
     41// MBadPixelsPix::IsUnsuitalbe(MBadPixelsPix::kUnsuitableRun) asks if the first bit is set.
     42//
     43// The second index (fInfo[1]) hold information acquired during the calibration. The bits
     44// are coded in the following form:
     45// BIT(1 ): kHiGainNotCalibrated :  Any High Gain signal is not calibrated and cannot be used
     46// BIT(2 ): kLoGainNotCalibrated :  Any Low  Gain signal is not calibrated and cannot be used
     47// BIT(3 ): kHiGainNotFitted     :  Any High Gain signal is calibrated without a Gauss Fit to the signal distribution
     48// BIT(4 ): kLoGainNotFitted     :  Any Low  Gain signal is calibrated without a Gauss Fit to the signal distribution
     49// BIT(5 ): kHiGainOscillating   :  The High Gain signals fourier transform showed abnormal behavior 
     50// BIT(6 ): kLoGainOscillating   :  The Low  Gain signals fourier transform showed abnormal behavior 
     51// BIT(7 ): kLoGainSaturation    :  The Low  Gain signals were saturated during calibration
     52// BIT(8 ): kChargeIsPedestal    :  The calibration signal contained only pedestals - presumably dead pixel
     53// BIT(10): kChargeRelErrNotValid:  The relative error of the derived charge was too large or too small
     54// BIT(11): kChargeSigmaNotValid :  The sigma of the pedestal distribution smaller than the pedestal RMS - presumably a pixel with a star in its FOV only during the pedestal taking
     55// BIT(12): kMeanTimeInFirstBin  :  The signal has its mean maximum in the first used FADC slice - signal extractor bad
     56// BIT(13): kMeanTimeInLast2Bins :  The signal has its mean maximum in the last two used FADC slice - signal extractor bad
     57// BIT(14): kDeviatingNumPhes    :  The calculated number of photo-electrons deviates too much from the mean - inconsitency
     58//
     59// These bits can be called with the enum MBadPixelsPix::UncalibratedType_t in combination
     60// with the function IsUncalibrated(MBadPixelsPix::UncalibratedTupe_t), e.g.
     61// MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainNotCalibrated) asks if the Hi Gain signal
     62// could be calibrated.
     63//
     64// Two additional functions yield specific calibration information:
     65// * IsCalibrationSignalOK() asks if the extracted calibration signal showed any inconsistency
     66// * IsCalibrationResultOK() asks if the applied calibration can be used at all.
    2967//
    3068/////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h

    r3559 r3601  
    2727
    2828    // All types are initialized to normal behaviour
    29     enum CalibrationType_t {
    30       kHiGainSaturation         = BIT(1),
    31       kLoGainSaturation         = BIT(2),
     29    enum UncalibratedType_t {
     30      kHiGainNotCalibrated      = BIT(1),
     31      kLoGainNotCalibrated      = BIT(2),
    3232      kHiGainNotFitted          = BIT(3),
    3333      kLoGainNotFitted          = BIT(4),
    34       kChargeIsPedestal         = BIT(5),
    35       kChargeErrNotValid        = BIT(6),
    36       kChargeRelErrNotValid     = BIT(7),
    37       kChargeSigmaNotValid      = BIT(8),
    38       kConvHiLoNotValid         = BIT(9),     
    39       kHiGainOscillating        = BIT(10),
    40       kLoGainOscillating        = BIT(11),
     34      kHiGainOscillating        = BIT(5),
     35      kLoGainOscillating        = BIT(6),
     36      kLoGainSaturation         = BIT(7),
     37      kChargeIsPedestal         = BIT(8),
     38      kChargeErrNotValid        = BIT(9),
     39      kChargeRelErrNotValid     = BIT(10),
     40      kChargeSigmaNotValid      = BIT(11),
    4141      kMeanTimeInFirstBin       = BIT(12),
    42       kMeanTimeInLastBin        = BIT(13),
    43       kDeviatingNumPhes         = BIT(14),
    44       kNotCalibrated            = BIT(15)   
     42      kMeanTimeInLast2Bins      = BIT(13),
     43      kDeviatingNumPhes         = BIT(14)
    4544    };
    4645   
     
    5352
    5453    // Setter
    55     void SetUnsuitable(UnsuitableType_t typ) { fInfo[0] |= typ; }
    56 
    57     // Calibration
    58     void SetHiGainSaturation         () { fInfo[1] |= kHiGainSaturation; }
    59     void SetLoGainSaturation         () { fInfo[1] |= kLoGainSaturation; }
    60     void SetNotCalibrated           () { fInfo[1] |= kNotCalibrated; }
    61     void SetMeanTimeInLastBin        () { fInfo[1] |= kMeanTimeInLastBin; }
    62     void SetMeanTimeInFirstBin       () { fInfo[1] |= kMeanTimeInFirstBin; }
    63     void SetLoGainOscillating        () { fInfo[1] |= kLoGainOscillating; }
    64     void SetHiGainOscillating        () { fInfo[1] |= kHiGainOscillating; }
    65     void SetConvHiLoNotValid         () { fInfo[1] |= kConvHiLoNotValid; }
    66     void SetChargeSigmaNotValid      () { fInfo[1] |= kChargeSigmaNotValid; }
    67     void SetChargeRelErrNotValid     () { fInfo[1] |= kChargeRelErrNotValid; }
    68     void SetChargeErrNotValid        () { fInfo[1] |= kChargeErrNotValid; }
    69     void SetChargeIsPedestal         () { fInfo[1] |= kChargeIsPedestal; }
    70     void SetLoGainNotFitted          () { fInfo[1] |= kLoGainNotFitted; }
    71     void SetHiGainNotFitted          () { fInfo[1] |= kHiGainNotFitted; }
    72     void SetDeviatingNumPhes         () { fInfo[1] |= kDeviatingNumPhes; }
     54    void SetUnsuitable  ( UnsuitableType_t   typ ) { fInfo[0] |= typ; }
     55    void SetUncalibrated( UncalibratedType_t typ ) { fInfo[1] |= typ; }
    7356
    7457    // Getter
    75     Bool_t IsUnsuitable(UnsuitableType_t typ) const { return fInfo[0]&typ; }
     58    Bool_t IsUnsuitable  ( UnsuitableType_t   typ ) const { return fInfo[0]&typ; }
     59    Bool_t IsUncalibrated( UncalibratedType_t typ ) const { return fInfo[1]&typ; }
    7660
    7761    Bool_t IsOK() const  { return fInfo[0]==0; }
    7862    Bool_t IsBad() const { return fInfo[0]!=0; }
    7963
    80     Bool_t IsHiGainSaturation         () const      { return fInfo[1] & kHiGainSaturation ;        }
    81     Bool_t IsLoGainSaturation         () const      { return fInfo[1] & kLoGainSaturation ;        }
    82     Bool_t IsNotCalibrated            () const      { return fInfo[1] & kNotCalibrated;            }
    83     Bool_t IsMeanTimeInLastBin        () const      { return fInfo[1] & kMeanTimeInLastBin;        }
    84     Bool_t IsMeanTimeInFirstBin       () const      { return fInfo[1] & kMeanTimeInFirstBin;       }
    85     Bool_t IsLoGainOscillating        () const      { return fInfo[1] & kLoGainOscillating;        }
    86     Bool_t IsHiGainOscillating        () const      { return fInfo[1] & kHiGainOscillating;        }
    87     Bool_t IsConvHiLoNotValid         () const      { return fInfo[1] & kConvHiLoNotValid;         }
    88     Bool_t IsChargeSigmaNotValid      () const      { return fInfo[1] & kChargeSigmaNotValid;      }
    89     Bool_t IsChargeRelErrNotValid     () const      { return fInfo[1] & kChargeRelErrNotValid;     }
    90     Bool_t IsChargeErrNotValid        () const      { return fInfo[1] & kChargeErrNotValid;        }
    91     Bool_t IsChargeIsPedestal         () const      { return fInfo[1] & kChargeIsPedestal;         }
    92     Bool_t IsLoGainNotFitted          () const      { return fInfo[1] & kLoGainNotFitted;          }
    93     Bool_t IsHiGainNotFitted          () const      { return fInfo[1] & kHiGainNotFitted;          }
    94     Bool_t IsDeviatingNumPhes         () const      { return fInfo[1] & kDeviatingNumPhes;         }   
     64    Bool_t IsLoGainBad() const { return IsUnsuitable  (kUnsuitableRun      )
     65                                     || IsUncalibrated(kLoGainSaturation   )
     66                                     || IsUncalibrated(kLoGainNotCalibrated)
     67                                     || IsUncalibrated(kLoGainOscillating  ) ; }
     68    Bool_t IsHiGainBad() const { return IsUnsuitable  (kUnsuitableRun      )
     69                                     || IsUncalibrated(kHiGainNotCalibrated)
     70                                     || IsUncalibrated(kHiGainOscillating  ) ; }
    9571
    96    
    97     Bool_t IsLoGainBad() const { return IsLoGainSaturation() || IsConvHiLoNotValid() || IsLoGainOscillating() ;}
    98     Bool_t IsHiGainBad() const { return (IsHiGainSaturation() && IsConvHiLoNotValid()) || IsHiGainOscillating(); }
     72    Bool_t IsCalibrationSignalOK() const  { return !( IsUncalibrated(kChargeIsPedestal    )
     73                                                   || IsUncalibrated(kChargeErrNotValid   )
     74                                                   || IsUncalibrated(kChargeRelErrNotValid)
     75                                                   || IsUncalibrated(kChargeSigmaNotValid )
     76                                                   || IsUncalibrated(kMeanTimeInFirstBin  )
     77                                                   || IsUncalibrated(kMeanTimeInLast2Bins )  );  }
    9978
    100     Bool_t IsCalibrationSignalOK() const  { return !( IsChargeIsPedestal()
    101                                                       || IsChargeErrNotValid()
    102                                                       || IsChargeRelErrNotValid()
    103                                                       || IsChargeSigmaNotValid()
    104                                                       || IsMeanTimeInFirstBin()
    105                                                       || IsMeanTimeInLastBin() );  }
    106     Bool_t IsCalibrationFitOK()       const    { return !( (!IsHiGainSaturation() && IsHiGainNotFitted())
    107                                                       || ( IsHiGainSaturation() && IsLoGainNotFitted()) ); }
    108     Bool_t IsCalibrationOscillating() const  { return ( !IsHiGainSaturation() && IsHiGainOscillating())
    109                                                   || ( IsHiGainSaturation() && IsLoGainOscillating()) ; }
    110     Bool_t IsCalibrationResultOK()    const  {  return !IsUnsuitable(kUnsuitableRun) &&
    111                                                         IsCalibrationSignalOK()
    112                                                     && !IsCalibrationOscillating()
    113                                                    && (   (!IsHiGainSaturation() && !IsHiGainBad())
    114                                                        || (IsHiGainSaturation() && !IsLoGainBad()) ) ;}
     79    Bool_t IsCalibrationResultOK() const  {  return  !IsUnsuitable(kUnsuitableRun)
     80                                                  &&  IsCalibrationSignalOK()
     81                                                  && !IsHiGainBad()
     82                                                  && !IsLoGainBad() ; }
    11583
    11684    void Merge(const MBadPixelsPix &pix);
  • trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc

    r3560 r3601  
    113113    fLoGainArray->SetOwner();
    114114
    115     fAverageHiGainInnerPix = new MHCalibrationChargeHiGainPix("AverageHiGainInnerPix","Average HiGain FADC sums of inner pixels");
    116     fAverageLoGainInnerPix = new MHCalibrationChargeLoGainPix("AverageLoGainInnerPix","Average LoGain FADC sums of inner pixels");
    117     fAverageHiGainOuterPix = new MHCalibrationChargeHiGainPix("AverageHiGainOuterPix","Average HiGain FADC sums of outer pixels");
    118     fAverageLoGainOuterPix = new MHCalibrationChargeLoGainPix("AverageLoGainOuterPix","Average LoGain FADC sums of outer pixels");
    119 
    120 /*
    121     fAverageHiGainInnerPix->GetHGausHist()->SetName("HCalibrationChargeAverageInnerHiGainPix");
    122     fAverageHiGainOuterPix->GetHGausHist()->SetName("HCalibrationChargeAverageOuterHiGainPix");
    123     fAverageLoGainInnerPix->GetHGausHist()->SetName("HCalibrationChargeAverageInnerLoGainPix");
    124     fAverageLoGainOuterPix->GetHGausHist()->SetName("HCalibrationChargeAverageOuterLoGainPix");
    125 */
     115    fAverageHiGainInnerPix = new MHCalibrationChargeHiGainPix("AverageHiGainInnerPix",
     116                                                              "Average HiGain FADC sums of inner pixels");
     117    fAverageLoGainInnerPix = new MHCalibrationChargeLoGainPix("AverageLoGainInnerPix",
     118                                                              "Average LoGain FADC sums of inner pixels");
     119    fAverageHiGainOuterPix = new MHCalibrationChargeHiGainPix("AverageHiGainOuterPix",
     120                                                              "Average HiGain FADC sums of outer pixels");
     121    fAverageLoGainOuterPix = new MHCalibrationChargeLoGainPix("AverageLoGainOuterPix",
     122                                                              "Average LoGain FADC sums of outer pixels");
     123
    126124    fAverageHiGainInnerPix->GetHGausHist()->SetTitle("Summed FADC slices average Inner pixels HiGain");
    127125    fAverageLoGainInnerPix->GetHGausHist()->SetTitle("Summed FADC slices average Inner pixels LoGain");
     
    348346          if ((*fBadPixels)[i].IsBad())
    349347          {
    350               fNumExcluded++;
    351               (*this)[i].SetExcluded();
     348            *fLog << warn << "Excluded pixel: " << i << " from calibration " << endl;
     349            fNumExcluded++;
     350            (*this)[i].SetExcluded();
    352351          }
    353352          (*this)[i].Init();
     
    576575    if (hist.IsEmpty())
    577576      {
     577        *fLog << warn << "Empty Hi Gain histogram in pixel: " << pix.GetPixId() << endl;
    578578        bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);       
    579579        return;
     
    583583    {
    584584        pix.SetHiGainSaturation();
    585         bad.SetHiGainSaturation();
    586585        return;
    587586    }
     
    597596        {
    598597          hist.BypassFit();
    599           bad.SetHiGainNotFitted();
    600           bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);
     598          *fLog << warn << "Hi Gain could not be fitted in pixel: " << pix.GetPixId() << endl;
     599          bad.SetUncalibrated( MBadPixelsPix::kHiGainNotFitted );
     600          bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun   );
    601601        }
    602602
     
    627627    if (!hist.IsFourierSpectrumOK())
    628628      {
    629         bad.SetHiGainOscillating();
    630         bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);
     629        *fLog << warn << "Oscillating Hi Gain in pixel: " << pix.GetPixId() << endl;
     630        bad.SetUncalibrated( MBadPixelsPix::kHiGainOscillating );
     631        bad.SetUnsuitable(   MBadPixelsPix::kUnreliableRun     );
    631632      }
    632633}
     
    648649    {
    649650        pix.SetLoGainSaturation();
    650         bad.SetLoGainSaturation();
    651         bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun);
     651        bad.SetUncalibrated( MBadPixelsPix::kLoGainSaturation );
     652        bad.SetUnsuitable(    MBadPixelsPix::kUnsuitableRun    );
    652653        return;
    653654    }
     
    663664        {
    664665          hist.BypassFit();
    665           bad.SetLoGainNotFitted();
     666          bad.SetUncalibrated( MBadPixelsPix::kLoGainNotFitted );
    666667          if (pix.IsHiGainSaturation())
    667668            bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);
     
    697698    if (!hist.IsFourierSpectrumOK())
    698699      {
    699         bad.SetLoGainOscillating();
     700        bad.SetUncalibrated( MBadPixelsPix::kLoGainOscillating );
    700701        if (pix.IsHiGainSaturation())
    701702          bad.SetUnsuitable(MBadPixelsPix::kUnreliableRun);
Note: See TracChangeset for help on using the changeset viewer.