Ignore:
Timestamp:
02/04/04 15:01:19 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc

    r2951 r3014  
    4040using namespace std;
    4141
    42 MPedestalPix::MPedestalPix() : fHist(NULL), fFlags(0)
     42MPedestalPix::MPedestalPix()
    4343{
    4444  Clear();
    4545}
    4646
    47 MPedestalPix::~MPedestalPix()
    48 {
    49   if (fHist)
    50     delete fHist;
    51 }
    52  
    5347
    5448// ------------------------------------------------------------------------
     
    6155  fPedestalRms = -1.;
    6256
    63   fMean       = -1.;
    64   fMeanErr    = -1.;
    65   fSigma      = -1.;
    66   fProb       = -1.;
    67 
    68   CLRBIT(fFlags,kFitted);
    69   CLRBIT(fFlags,kFitValid); 
    70 
    7157}
    7258
     
    7561  fPedestal = 0.;
    7662  fPedestalRms = 0.;
    77 
    78   fHist = new MHPedestalPixel("MHPedestalPixel","Pedestal Histograms Pixel ");
    79 
    80   if (!fHist)
    81     *fLog << warn << dbginf << " Could not create MHCalibrationPixel " << endl;
    82 
    83 }
    84 
    85 void MPedestalPix::FillHists(const Float_t f)
    86 {
    87 
    88   if (!fHist)
    89     return;
    90  
    91   fHist->FillCharge(f);
    92   fHist->FillChargevsN(f);
    9363}
    9464
     
    10575}
    10676
    107 Bool_t MPedestalPix::IsFitted() const
    108 {
    109   return TESTBIT(fFlags,kFitted);
    110 }
    111 
    112 Bool_t MPedestalPix::IsFitValid() const
    113 {
    114   return TESTBIT(fFlags,kFitValid);
    115 }
    116 
    117 // --------------------------------------------------------------------------
    118 //
    119 // 1) Return if the charge distribution is already succesfully fitted 
    120 //    or if the histogram is empty
    121 // 2) Cut the histograms empty edges
    122 // 3) Fit the histograms with a Gaussian
    123 // 4) In case of failure print out the fit results
    124 // 5) Retrieve the results and store them in this class
    125 //
    126 void MPedestalPix::FitCharge()
    127 {
    128  
    129   //
    130   // 1) Return if the charge distribution is already succesfully fitted 
    131   //    or if the histogram is empty
    132   //
    133   if (fHist->IsFitOK() || fHist->IsEmpty())
    134     return;
    135 
    136 
    137   fHist->CutAllEdges();
    138      
    139   //
    140   // 2) Fit the Lo Gain histograms with a Gaussian
    141   //
    142   if(fHist->FitCharge())
    143     SETBIT(fFlags,kFitted);
    144   else
    145     CLRBIT(fFlags,kFitted);
    146 
    147   //
    148   // 6) Retrieve the results and store them in this class
    149   //
    150   fMean         = fHist->GetChargeMean();
    151   fMeanErr      = fHist->GetChargeMeanErr();
    152   fSigma        = fHist->GetChargeSigma();
    153   fSigmaErr     = fHist->GetChargeSigmaErr();
    154   fProb         = fHist->GetChargeProb();
    155 
    156   if (CheckFitValidity())
    157     SETBIT(fFlags,kFitValid);
    158   else
    159     CLRBIT(fFlags,kFitValid);
    160 
    161   return;
    162 }
    163 
    164 Bool_t MPedestalPix::CheckFitValidity()
    165 {
    166  
    167   if (fProb < 0.001)
    168     return kFALSE;
    169  
    170   return kTRUE;
    171  
    172 }
Note: See TracChangeset for help on using the changeset viewer.