Changeset 3611 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 03/30/04 19:19:53 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc
r3609 r3611 27 27 // MHGausEvents 28 28 // 29 // A base class for events which are believed follow a Gaussian distribution30 // with time, (e.g. calibration events, observables containing white noise, etc.)29 // A base class for events which are believed to follow a Gaussian distribution 30 // with time, e.g. calibration events, observables containing white noise, ... 31 31 // 32 32 // MHGausEvents derives from MH, thus all features of MH can be used by a class … … 36 36 // 37 37 // 1) The TH1F fHGausHist: 38 // ==================== ==========38 // ==================== 39 39 // 40 40 // It is created with a default name and title and resides in directory NULL. 41 41 // - Any class deriving from MHGausEvents needs to apply a binning to fHGausHist 42 42 // (e.g. with the function TH1F::SetBins(..) ) 43 // - The histogram is filled with the functions FillHist or FillHistAndArray.43 // - The histogram is filled with the functions FillHist() or FillHistAndArray(). 44 44 // - The histogram can be fitted with the function FitGaus(). This involves stripping 45 45 // of all zeros at the lower and upper end of the histogram and re-binning to … … 47 47 // - The fit result's probability is compared to a reference probability fProbLimit 48 48 // The NDF is compared to fNDFLimit and a check is made whether results are NaNs. 49 // Accordingly the flag GausFitOKis set.49 // Accordingly, a flag IsGausFitOK() is set. 50 50 // 51 51 // 2) The TArrayF fEvents: 52 52 // ========================== 53 53 // 54 // It is created with 0 entries and not expanded unless FillArray or FillHistAndArray is called. 55 // - A first call to FillArray or FillHistAndArray initializes fEvents by default to 512 entries. 56 // - Any later call to FillArray or FillHistAndArray fills up the array. Reaching the limit, 57 // the array is expanded by a factor 2. 58 // - The array can be fourier-transformed into the array fPowerSpectrum. Note that any FFT accepts 59 // only number of events which are a power of 2. Thus, fEvents is cut to the next power of 2 smaller 60 // than its actual number of entries. You might lose information at the end of your analysis. 61 // - Calling the function CreateFourierTransform creates the array fPowerSpectrum and its projection 62 // fHPowerProbability which in turn is fit to an exponential. 54 // It is created with 0 entries and not expanded unless FillArray() or FillHistAndArray() 55 // are called. 56 // - A first call to FillArray() or FillHistAndArray() initializes fEvents by default 57 // to 512 entries. 58 // - Any later call to FillArray() or FillHistAndArray() fills up the array. 59 // Reaching the limit, the array is expanded by a factor 2. 60 // - The array can be fourier-transformed into the array fPowerSpectrum. 61 // Note that any FFT accepts only number of events which are a power of 2. 62 // Thus, fEvents is cut to the next power of 2 smaller than its actual number of entries. 63 // Be aware that you might lose information at the end of your analysis. 64 // - Calling the function CreateFourierSpectrum() creates the array fPowerSpectrum 65 // and its projection fHPowerProbability which in turn is fit to an exponential. 63 66 // - The fit result's probability is compared to a referenc probability fProbLimit 64 // and accordingly the flag ExpFitOKis set.65 // - The flag FourierSpectrumOK is set accordingly to ExpFitOK. Later, a closer check will be66 // installed.67 // - You can display all arrays by calls to: CreateGraphEvents() and CreateGraphPowerSpectrum() and68 // successive calls to the corresponding Getters.67 // and accordingly the flag IsExpFitOK() is set. 68 // - The flag IsFourierSpectrumOK() is set accordingly to IsExpFitOK(). 69 // Later, a closer check will be installed. 70 // - You can display all arrays by calls to: CreateGraphEvents() and 71 // CreateGraphPowerSpectrum() and successive calls to the corresponding Getters. 69 72 // 70 73 ////////////////////////////////////////////////////////////////////////////// … … 98 101 // 99 102 // Default Constructor. 103 // Sets: 104 // - the default Probability Bins for fPowerProbabilityBins (fgPowerProbabilityBins) 105 // - the default Probability Limit for fProbLimit (fgProbLimit) 106 // - the default NDF Limit for fNDFLimit (fgNDFLimit) 107 // - the default number of bins after stripping for fBinsAfterStipping (fgBinsAfterStipping) 108 // - the default name of the fHGausHist ("HGausHist") 109 // - the default title of the fHGausHist ("Histogram of Events with Gaussian Distribution") 110 // - the default directory of the fHGausHist (NULL) 111 // 112 // Initializes: 113 // - fEvents to 0 entries 114 // - fHGausHist() 115 // - all other pointers to NULL 116 // - all variables to 0. 117 // - all flags to kFALSE 100 118 // 101 119 MHGausEvents::MHGausEvents(const char *name, const char *title) … … 126 144 127 145 128 146 // -------------------------------------------------------------------------- 147 // 148 // Default Destructor. 149 // 150 // Deletes (if Pointer is not NULL): 151 // 152 // - fHPowerProbability 153 // - fFGausFit 154 // - fFExpFit 155 // - fPowerSpectrum 156 // - fGraphEvents 157 // - fGraphPowerSpectrum 158 // 129 159 MHGausEvents::~MHGausEvents() 130 160 { … … 151 181 } 152 182 153 183 // -------------------------------------------------------------------------- 184 // 185 // Sets: 186 // - all other pointers to NULL 187 // - all variables to 0., except fEventFrequency 188 // - all flags to kFALSE 189 // 190 // Deletes (if not NULL): 191 // - all pointers 192 // 154 193 void MHGausEvents::Clear(Option_t *o) 155 194 { … … 168 207 169 208 if (fHPowerProbability) 170 delete fHPowerProbability; 209 { 210 delete fHPowerProbability; 211 fHPowerProbability = NULL; 212 } 171 213 172 214 // delete fits 173 215 if (fFGausFit) 174 delete fFGausFit; 216 { 217 delete fFGausFit; 218 fFGausFit = NULL; 219 } 220 175 221 if (fFExpFit) 176 delete fFExpFit; 222 { 223 delete fFExpFit; 224 fFExpFit = NULL; 225 } 177 226 178 227 // delete arrays 179 228 if (fPowerSpectrum) 180 delete fPowerSpectrum; 229 { 230 delete fPowerSpectrum; 231 fPowerSpectrum = NULL; 232 } 181 233 182 234 // delete graphs 183 235 if (fGraphEvents) 184 delete fGraphEvents; 236 { 237 delete fGraphEvents; 238 fGraphEvents = NULL; 239 } 240 185 241 if (fGraphPowerSpectrum) 186 delete fGraphPowerSpectrum; 187 } 188 189 242 { 243 delete fGraphPowerSpectrum; 244 fGraphPowerSpectrum = NULL; 245 } 246 } 247 248 // -------------------------------------------------------------------------- 249 // 250 // Executes: 251 // - Clear() 252 // - fHGausHist.Reset() 253 // - fEvents.Set(0) 254 // 190 255 void MHGausEvents::Reset() 191 256 { … … 197 262 } 198 263 199 264 // -------------------------------------------------------------------------- 265 // 266 // Executes: 267 // - FillArray() 268 // - FillHist() 269 // 200 270 Bool_t MHGausEvents::FillHistAndArray(const Float_t f) 201 271 { … … 205 275 } 206 276 277 // -------------------------------------------------------------------------- 278 // 279 // Fills fHGausHist with f 280 // Returns kFALSE, if overflow or underflow occurred 281 // 207 282 Bool_t MHGausEvents::FillHist(const Float_t f) 208 283 { … … 214 289 } 215 290 291 // -------------------------------------------------------------------------- 292 // 293 // Fill fEvents with f 294 // If size of fEvents is 0, initializes it to 512 295 // If size of fEvents is smaller than fCurrentSize, double the size 296 // Increase fCurrentSize by 1 297 // 216 298 void MHGausEvents::FillArray(const Float_t f) 217 299 { -
trunk/MagicSoft/Mars/mcalib/MHGausEvents.h
r3609 r3611 20 20 private: 21 21 22 const static Float_t fgProbLimit; // Default probability limit for judgement if fit is OK23 const static Int_t fgNDFLimit; // Default NDF limit for judgement if fit is OK24 const static Int_t fgPowerProbabilityBins; // Default number of bins for the projected power spectrum25 const static Int_t fgBinsAfterStripping; // Default number of bins for the Gauss Histogram after stripping off the zeros at both end22 const static Float_t fgProbLimit; // Default for fProbLimit (now 0.001) 23 const static Int_t fgNDFLimit; // Default for fNDFLimit (now 2) 24 const static Int_t fgPowerProbabilityBins; // Default for fPowerProbabilityBins (now 20) 25 const static Int_t fgBinsAfterStripping; // Default for fBinsAfterStripping (now 40) 26 26 27 Int_t fPowerProbabilityBins; // number of bins for the projected power spectrum28 Int_t fBinsAfterStripping; // number of bins for the Gauss Histogram after stripping off the zeros at both end29 Float_t fEventFrequency; // The event frequency in Hertz (to be set)27 Int_t fPowerProbabilityBins; // Bins for the projected power spectrum 28 Int_t fBinsAfterStripping; // Bins for the Gauss Histogram after stripping off the zeros at both ends 29 Float_t fEventFrequency; // Event frequency in Hertz (to be set) 30 30 31 31 TH1I *fHPowerProbability; // Fourier transform of fEvents projected on y-axis … … 35 35 TGraph *fGraphPowerSpectrum; //! TGraph to display the power spectrum array (will not be cloned!!) 36 36 37 Double_t fMean; // 38 Double_t fSigma; // 39 Double_t fMeanErr; // 40 Double_t fSigmaErr; // 41 Double_t fProb; // 37 Double_t fMean; // Mean of the Gauss fit 38 Double_t fSigma; // Sigma of the Gauss fit 39 Double_t fMeanErr; // Error of the mean of the Gauss fit 40 Double_t fSigmaErr; // Error of the sigma of the Gauss fit 41 Double_t fProb; // Probability of the Gauss fit (derived from Chi-Square and NDF 42 42 43 43 enum { kGausFitOK, kExpFitOK, kFourierSpectrumOK }; // Bits to hold information about fit results
Note:
See TracChangeset
for help on using the changeset viewer.