Ignore:
Timestamp:
10/08/06 14:50:23 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhcalib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc

    r8020 r8023  
    130130      fPowerSpectrum(NULL),
    131131      fFExpFit(NULL),
    132       fFirst(0.),
    133132      fGraphEvents(NULL), fGraphPowerSpectrum(NULL),
    134       fLast(100.), fNbins(100), fFGausFit(NULL)
     133      fFirst(0.), fLast(100.), fNbins(100), fFGausFit(NULL)
    135134{
    136135
     
    272271    }
    273272}
    274 
    275 
    276 
    277 // -----------------------------------------------------------------------------
    278 //
    279 // Create the x-axis for the event graph
    280 //
    281 Float_t *MHGausEvents::CreateEventXaxis(Int_t n)
    282 {
    283 
    284   Float_t *xaxis = new Float_t[n]; 
    285 
    286   if (fEventFrequency)
    287     for (Int_t i=0;i<n;i++)
    288       xaxis[i] = (Float_t)i/fEventFrequency;
    289   else
    290     for (Int_t i=0;i<n;i++)
    291       xaxis[i] = (Float_t)i;
    292  
    293   return xaxis;
    294                  
    295 }
    296 
    297273
    298274// -------------------------------------------------------------------
     
    398374
    399375  const Int_t n = fEvents.GetSize();
    400 
    401376  if (n==0)
    402377    return;
    403378
    404   fGraphEvents = new TGraph(n,CreateEventXaxis(n),fEvents.GetArray()); 
     379  const Float_t freq = fEventFrequency ? fEventFrequency : 1;
     380
     381  MArrayF xaxis(n);
     382  for (Int_t i=0; i<n; i++)
     383      xaxis[i] = (Float_t)i/freq;
     384
     385  fGraphEvents = new TGraph(n, xaxis.GetArray(), fEvents.GetArray());
    405386  fGraphEvents->SetTitle("Evolution of Events with time");
    406   fGraphEvents->GetXaxis()->SetTitle((fEventFrequency) ? "Time [s]" : "Event Nr.");
     387  fGraphEvents->GetXaxis()->SetTitle(fEventFrequency ? "Time [s]" : "Event Nr.");
    407388  fGraphEvents->GetYaxis()->SetTitle(fHGausHist.GetXaxis()->GetTitle());
    408389  fGraphEvents->GetYaxis()->CenterTitle();
     
    421402  const Int_t n = fPowerSpectrum->GetSize();
    422403
    423   fGraphPowerSpectrum = new TGraph(n,CreatePSDXaxis(n),fPowerSpectrum->GetArray()); 
     404  const Float_t freq = fEventFrequency ? fEventFrequency : 1;
     405
     406  MArrayF xaxis(n);
     407  for (Int_t i=0; i<n; i++)
     408      xaxis[i] = 0.5*(Float_t)i*freq/n;
     409
     410  fGraphPowerSpectrum = new TGraph(n, xaxis.GetArray(), fPowerSpectrum->GetArray());
    424411  fGraphPowerSpectrum->SetTitle("Power Spectrum Density");
    425   fGraphPowerSpectrum->GetXaxis()->SetTitle((fEventFrequency) ? "Frequency [Hz]" : "Frequency");
     412  fGraphPowerSpectrum->GetXaxis()->SetTitle(fEventFrequency ? "Frequency [Hz]" : "Frequency");
    426413  fGraphPowerSpectrum->GetYaxis()->SetTitle("P(f)");
    427414  fGraphPowerSpectrum->GetYaxis()->CenterTitle();
     
    429416}
    430417
    431 
    432 // -----------------------------------------------------------------------------
    433 //
    434 // Create the x-axis for the event graph
    435 //
    436 Float_t *MHGausEvents::CreatePSDXaxis(Int_t n)
    437 {
    438 
    439   Float_t *xaxis = new Float_t[n];
    440 
    441   if (fEventFrequency)
    442     for (Int_t i=0;i<n;i++)
    443       xaxis[i] = 0.5*(Float_t)i*fEventFrequency/n;
    444   else
    445     for (Int_t i=0;i<n;i++)
    446     xaxis[i] = 0.5*(Float_t)i/n;
    447  
    448   return xaxis;
    449                  
    450 }
    451  
    452418// -----------------------------------------------------------------------------
    453419//
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h

    r8020 r8023  
    2828private:
    2929
    30   const static Int_t    fgNDFLimit;             //! Default for fNDFLimit             (now set to: 2)
    31   const static Float_t  fgProbLimit;            //! Default for fProbLimit            (now set to: 0.001)
    32   const static Int_t    fgPowerProbabilityBins; //! Default for fPowerProbabilityBins (now set to: 20)
     30  const static Int_t   fgNDFLimit;             //! Default for fNDFLimit             (now set to: 2)
     31  const static Float_t fgProbLimit;            //! Default for fProbLimit            (now set to: 0.001)
     32  const static Int_t   fgPowerProbabilityBins; //! Default for fPowerProbabilityBins (now set to: 20)
    3333
    34   Float_t *CreateEventXaxis(Int_t n);           // Create an x-axis for the Event TGraphs
    35   Float_t *CreatePSDXaxis  (Int_t n);           // Create an x-axis for the PSD TGraphs
    36  
    3734private:
    3835
     
    5350  MArrayF  fEvents;                    // Array which holds the entries of GausHist
    5451  TF1     *fFExpFit;                   // Exponential fit for FHPowerProbability
    55   Axis_t   fFirst;                     // Lower histogram edge  for fHGausHist (used by InitBins())
    5652  TGraph  *fGraphEvents;               //! TGraph to display the event array
    5753  TGraph  *fGraphPowerSpectrum;        //! TGraph to display the power spectrum array
     54  Axis_t   fFirst;                     // Lower histogram edge  for fHGausHist (used by InitBins())
    5855  Axis_t   fLast;                      // Upper histogram edge  for fHGausHist (used by InitBins())
    5956  Int_t    fNbins;                     // Number histogram bins for fHGausHist (used by InitBins())
Note: See TracChangeset for help on using the changeset viewer.