Ignore:
Timestamp:
01/28/04 14:43:56 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mcalib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc

    r2931 r2943  
    120120MCalibrationCalc::MCalibrationCalc(const char *name, const char *title)
    121121    : fPedestals(NULL), fCalibrations(NULL), fSignals(NULL),
    122       fRawEvt(NULL), fRunHeader(NULL), fArrivalTime(NULL), fEvtTime(NULL),
    123       fEvents(0), fCosmics(0),
    124       fNumHiGainSamples(0), fNumLoGainSamples(0), fConversionHiLo(0.),
    125       fNumExcludedPixels(0),
    126       fColor(kEBlue)
     122      fRawEvt(NULL), fRunHeader(NULL), fArrivalTime(NULL), fEvtTime(NULL)
    127123{
    128124
     
    135131    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
    136132
     133    Clear();
     134}
     135
     136void MCalibrationCalc::Clear(const Option_t *o)
     137{
     138 
    137139    SETBIT(fFlags, kUseTimes);
    138140    SETBIT(fFlags, kUseBlindPixelFit);
    139     SETBIT(fFlags, kUsePinDiodeFit);
    140141    SETBIT(fFlags, kUseCosmicsRejection);
    141142    SETBIT(fFlags, kUseQualityChecks);
    142143
    143 }
     144    // As long as we don't have the PIN Diode:
     145    CLRBIT(fFlags, kUsePinDiodeFit);
     146
     147    fEvents = 0;
     148    fCosmics = 0;
     149    fNumHiGainSamples = 0;
     150    fNumLoGainSamples = 0;
     151    fConversionHiLo = 0;
     152    fNumExcludedPixels = 0;
     153   
     154    fColor = kECT1;
     155}
     156
    144157
    145158MCalibrationBlindPix *MCalibrationCalc::GetBlindPixel() const
     
    269282    UInt_t npixels = cam->GetNumPixels();
    270283
    271     fCalibrations->InitSize(npixels);   
    272    
    273284    for (UInt_t i=0; i<npixels; i++)
    274285      {
     
    570581      if (!blindpixel.FitCharge())
    571582        {
    572           *fLog << err << dbginf << "Could not fit the blind pixel! " << endl;
    573           blindpixel.DrawClone();
    574           return kFALSE;
     583          *fLog << warn << "Could not fit the blind pixel! " << endl;
     584          *fLog << warn << "Setting bit kBlindPixelMethodValid to FALSE in MCalibrationCam" << endl;
     585          fCalibrations->SetBlindPixelMethodValid(kFALSE);
    575586        }
    576587
     588      fCalibrations->SetBlindPixelMethodValid(kTRUE);
    577589      blindpixel.DrawClone();
    578590    }
     
    622634    }
    623635
    624   if (TESTBIT(fFlags,kUseBlindPixelFit))
     636  if (TESTBIT(fFlags,kUseBlindPixelFit) && fCalibrations->IsBlindPixelMethodValid())
    625637    {
    626638     
     
    631643          *fLog << err
    632644                << "You can try to calibrate using the MCalibrationCalc::SkipBlindPixelFit()" << endl;
    633           return kFALSE;
     645          fCalibrations->SetBlindPixelMethodValid(kFALSE);
    634646        }
    635647    }
    636648  else
    637     *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Fit " << endl;
     649    *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Calibration! " << endl;
     650
     651
     652  if (TESTBIT(fFlags,kUsePinDiodeFit) && fCalibrations->IsPINDiodeMethodValid())
     653    {
     654     
     655      if (!fCalibrations->CalcNumPhotInsidePlexiglass())
     656        {
     657          *fLog << err
     658                << "Could not calculate the number of photons from the blind pixel " << endl;
     659          *fLog << err
     660                << "You can try to calibrate using the MCalibrationCalc::SkipPINDiodeFit()" << endl;
     661          fCalibrations->SetPINDiodeMethodValid(kFALSE);
     662        }
     663    }
     664  else
     665    *fLog << inf << GetDescriptor() << ": Skipping PIN Diode Calibration! " << endl;
    638666
    639667  fCalibrations->SetReadyToSave();
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h

    r2904 r2943  
    6262  TString fExcludedPixelsFile;
    6363  UInt_t  fNumExcludedPixels;
    64  
     64
     65  enum  { kUseTimes, kUseBlindPixelFit, kUsePinDiodeFit,
     66          kUseCosmicsRejection, kUseQualityChecks };
     67
    6568public:
    6669 
     
    8083  MCalibrationCalc(const char *name=NULL, const char *title=NULL);
    8184
    82 private:
    83 
    84   enum  { kUseTimes, kUseBlindPixelFit, kUsePinDiodeFit,
    85           kUseCosmicsRejection, kUseQualityChecks };
    86 
    87 public:
    88 
     85  void Clear(const Option_t *o="");
     86 
    8987  // Skipping parts of the work
    9088  void SkipTime(Bool_t b=kTRUE)
     
    9896  void SkipQualityChecks(Bool_t b=kTRUE)
    9997      {b ? CLRBIT(fFlags, kUseQualityChecks) : SETBIT(fFlags, kUseQualityChecks);}
     98
    10099
    101100  // Setters
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.cc

    r2939 r2943  
    192192  return;
    193193}
     194
     195void MCalibrationCam::SetBlindPixelMethodValid(const Bool_t b)
     196{
     197
     198  if (b)
     199    SETBIT(fFlags, kBlindPixelMethodValid);
     200  else   
     201    CLRBIT(fFlags, kBlindPixelMethodValid);
     202 
     203}
     204
     205void MCalibrationCam::SetPINDiodeMethodValid(const Bool_t b)
     206{
     207
     208  if (b)
     209    SETBIT(fFlags, kPINDiodeMethodValid);
     210  else   
     211    CLRBIT(fFlags, kPINDiodeMethodValid);
     212 
     213 
     214}
     215
     216Bool_t  MCalibrationCam::IsBlindPixelMethodValid()   const
     217{
     218  return TESTBIT(fFlags,kBlindPixelMethodValid);
     219}
     220
     221Bool_t  MCalibrationCam::IsPINDiodeMethodValid() const
     222{
     223  return TESTBIT(fFlags,kPINDiodeMethodValid); 
     224}
     225
    194226
    195227// --------------------------------------------------------------------------
  • trunk/MagicSoft/Mars/mcalib/MCalibrationCam.h

    r2931 r2943  
    3939  UInt_t fNumExcludedPixels;
    4040
     41  Byte_t fFlags;
     42
     43  enum  { kBlindPixelMethodValid, kPINDiodeMethodValid  };
     44 
    4145public:
    4246 
     
    5862  void SetColor(const CalibrationColor_t color)       {  fColor = color; }
    5963  void SetNumPixelsExcluded(const UInt_t n)               {  fNumExcludedPixels = n;    }
    60    
     64  void SetBlindPixelMethodValid(const Bool_t b = kTRUE);
     65  void SetPINDiodeMethodValid(const Bool_t b = kTRUE); 
     66 
    6167  // Getters
    6268  Int_t GetSize()                        const;
     
    7581  Bool_t IsPixelUsed(Int_t idx)      const;
    7682  Bool_t IsPixelFitted(Int_t idx)    const;
     83
     84  Bool_t IsBlindPixelMethodValid()   const;
     85  Bool_t IsPINDiodeMethodValid()     const; 
    7786
    7887  // Others
Note: See TracChangeset for help on using the changeset viewer.