Changeset 3014 for trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
- Timestamp:
- 02/04/04 15:01:19 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MPedestalPix.cc
r2951 r3014 40 40 using namespace std; 41 41 42 MPedestalPix::MPedestalPix() : fHist(NULL), fFlags(0)42 MPedestalPix::MPedestalPix() 43 43 { 44 44 Clear(); 45 45 } 46 46 47 MPedestalPix::~MPedestalPix()48 {49 if (fHist)50 delete fHist;51 }52 53 47 54 48 // ------------------------------------------------------------------------ … … 61 55 fPedestalRms = -1.; 62 56 63 fMean = -1.;64 fMeanErr = -1.;65 fSigma = -1.;66 fProb = -1.;67 68 CLRBIT(fFlags,kFitted);69 CLRBIT(fFlags,kFitValid);70 71 57 } 72 58 … … 75 61 fPedestal = 0.; 76 62 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);93 63 } 94 64 … … 105 75 } 106 76 107 Bool_t MPedestalPix::IsFitted() const108 {109 return TESTBIT(fFlags,kFitted);110 }111 112 Bool_t MPedestalPix::IsFitValid() const113 {114 return TESTBIT(fFlags,kFitValid);115 }116 117 // --------------------------------------------------------------------------118 //119 // 1) Return if the charge distribution is already succesfully fitted120 // or if the histogram is empty121 // 2) Cut the histograms empty edges122 // 3) Fit the histograms with a Gaussian123 // 4) In case of failure print out the fit results124 // 5) Retrieve the results and store them in this class125 //126 void MPedestalPix::FitCharge()127 {128 129 //130 // 1) Return if the charge distribution is already succesfully fitted131 // or if the histogram is empty132 //133 if (fHist->IsFitOK() || fHist->IsEmpty())134 return;135 136 137 fHist->CutAllEdges();138 139 //140 // 2) Fit the Lo Gain histograms with a Gaussian141 //142 if(fHist->FitCharge())143 SETBIT(fFlags,kFitted);144 else145 CLRBIT(fFlags,kFitted);146 147 //148 // 6) Retrieve the results and store them in this class149 //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 else159 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.