Changeset 3611 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
03/30/04 19:19:53 (21 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3610 r3611  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2004/03/30: Markus Gaug
     22 
     23   * mcalib/MHGausEvents.[h,cc]
     24     - updated and enlarged documentation
     25
    2026
    2127 2004/03/30: Abelardo Moralejo
  • trunk/MagicSoft/Mars/mcalib/MHGausEvents.cc

    r3609 r3611  
    2727//  MHGausEvents
    2828//
    29 //  A base class for events which are believed follow a Gaussian distribution
    30 //  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, ...
    3131//
    3232//  MHGausEvents derives from MH, thus all features of MH can be used by a class
     
    3636//
    3737//  1) The TH1F fHGausHist:
    38 //     ==============================
     38//     ====================
    3939//   
    4040//     It is created with a default name and title and resides in directory NULL.
    4141//     - Any class deriving from MHGausEvents needs to apply a binning to fHGausHist
    4242//       (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().
    4444//     - The histogram can be fitted with the function FitGaus(). This involves stripping
    4545//       of all zeros at the lower and upper end of the histogram and re-binning to
     
    4747//     - The fit result's probability is compared to a reference probability fProbLimit
    4848//       The NDF is compared to fNDFLimit and a check is made whether results are NaNs.
    49 //       Accordingly the flag GausFitOK is set.
     49//       Accordingly, a flag IsGausFitOK() is set.
    5050//
    5151//  2) The TArrayF fEvents:
    5252//     ==========================
    5353//
    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.
    6366//     - The fit result's probability is compared to a referenc probability fProbLimit
    64 //       and accordingly the flag ExpFitOK is set.
    65 //     - The flag FourierSpectrumOK is set accordingly to ExpFitOK. Later, a closer check will be
    66 //       installed.
    67 //     - You can display all arrays by calls to: CreateGraphEvents() and CreateGraphPowerSpectrum() and
    68 //       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.
    6972//
    7073//////////////////////////////////////////////////////////////////////////////
     
    98101//
    99102// 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
    100118//
    101119MHGausEvents::MHGausEvents(const char *name, const char *title)
     
    126144
    127145
    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//
    129159MHGausEvents::~MHGausEvents()
    130160{
     
    151181}
    152182     
    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//
    154193void MHGausEvents::Clear(Option_t *o)
    155194{
     
    168207
    169208  if (fHPowerProbability)
    170     delete fHPowerProbability;
     209    {
     210      delete fHPowerProbability;
     211      fHPowerProbability = NULL;
     212    }
    171213 
    172214  // delete fits
    173215  if (fFGausFit)
    174     delete fFGausFit;
     216    {
     217      delete fFGausFit;
     218      fFGausFit = NULL;
     219    }
     220 
    175221  if (fFExpFit)
    176     delete fFExpFit;
     222    {
     223      delete fFExpFit;
     224      fFExpFit = NULL;
     225    }
    177226 
    178227  // delete arrays
    179228  if (fPowerSpectrum) 
    180     delete fPowerSpectrum;     
     229    {
     230      delete fPowerSpectrum;     
     231      fPowerSpectrum = NULL;
     232    }
    181233
    182234  // delete graphs
    183235  if (fGraphEvents)
    184     delete fGraphEvents;
     236    {
     237      delete fGraphEvents;
     238      fGraphEvents = NULL;
     239    }
     240
    185241  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//
    190255void MHGausEvents::Reset()
    191256{
     
    197262}
    198263
    199 
     264// --------------------------------------------------------------------------
     265//
     266// Executes:
     267// - FillArray()
     268// - FillHist()
     269//
    200270Bool_t MHGausEvents::FillHistAndArray(const Float_t f)
    201271{
     
    205275}
    206276
     277// --------------------------------------------------------------------------
     278//
     279// Fills fHGausHist with f
     280// Returns kFALSE, if overflow or underflow occurred
     281//
    207282Bool_t MHGausEvents::FillHist(const Float_t f)
    208283{
     
    214289}
    215290
     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//
    216298void MHGausEvents::FillArray(const Float_t f)
    217299{
  • trunk/MagicSoft/Mars/mcalib/MHGausEvents.h

    r3609 r3611  
    2020private:
    2121
    22   const static Float_t  fgProbLimit;            // Default probability limit for judgement if fit is OK
    23   const static Int_t    fgNDFLimit;             // Default NDF limit for judgement if fit is OK
    24   const static Int_t    fgPowerProbabilityBins; // Default number of bins for the projected power spectrum
    25   const static Int_t    fgBinsAfterStripping;   // Default number of bins for the Gauss Histogram after stripping off the zeros at both end
     22  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)
    2626
    27   Int_t    fPowerProbabilityBins;      // number of bins for the projected power spectrum
    28   Int_t    fBinsAfterStripping;        // number of bins for the Gauss Histogram after stripping off the zeros at both end
    29   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)
    3030 
    3131  TH1I    *fHPowerProbability;         // Fourier transform of fEvents projected on y-axis
     
    3535  TGraph  *fGraphPowerSpectrum;        //! TGraph to display the power spectrum array (will not be cloned!!)
    3636
    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
     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
    4242
    4343  enum { kGausFitOK, kExpFitOK, kFourierSpectrumOK }; // Bits to hold information about fit results
Note: See TracChangeset for help on using the changeset viewer.