Changeset 4994 for trunk/MagicSoft


Ignore:
Timestamp:
09/14/04 13:37:28 (20 years ago)
Author:
gaug
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4993 r4994  
    3030     - added readIPR
    3131               
     32
     33 2004/09/14: Markus Gaug
     34
     35   * mhbase/MH.cc
     36     - took out the search for histogram with the same name in
     37       ProjectARray. Always create new histogram whihc has to be
     38       deleted afterwards.
     39
     40   * mhcalib/MHGausEvents.[h,cc]
     41     - put fEventFrequency back from MHCalibraionPix.
     42     - always delete fHPowerProbability, if existing.
     43 
     44   * mhcalib/MHCalibrationPix.[h,cc]
     45     - take out fEventFrequency
     46
    3247
    3348 2004/09/14: Thomas Bretz
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r4991 r4994  
    11811181    const Int_t size = array.GetSize();
    11821182
    1183     TH1I *h1=0;
    1184 
    1185     //check if histogram with identical name exist
    1186     TObject *h1obj = gROOT->FindObject(name);
    1187     if (h1obj && h1obj->InheritsFrom("TH1I"))
    1188     {
    1189         h1 = (TH1I*)h1obj;
    1190         h1->Reset();
    1191     }
    1192 
    11931183    Double_t min = size>0 ? array[0] : 0;
    11941184    Double_t max = size>0 ? array[0] : 1;
     
    12031193    Int_t newbins = 0;
    12041194    FindGoodLimits(nbins, newbins, min, max, kFALSE);
    1205 
    1206     if (!h1)
    1207     {
    1208         h1 = new TH1I(name, title, nbins, min, max);
    1209         h1->SetXTitle("");
    1210         h1->SetYTitle("Counts");
    1211         h1->SetDirectory(gROOT);
    1212     }
     1195   
     1196    TH1I *h1 = new TH1I(name, title, nbins, min, max);
     1197    h1->SetXTitle("");
     1198    h1->SetYTitle("Counts");
     1199    h1->SetDirectory(NULL);
    12131200
    12141201    // Second loop to fill the histogram
     
    12261213{
    12271214    const Int_t size = array.GetSize();
    1228     TH1I *h1=0;
    1229 
    1230     //check if histogram with identical name exist
    1231     TObject *h1obj = gROOT->FindObject(name);
    1232     if (h1obj && h1obj->InheritsFrom("TH1I"))
    1233     {
    1234         h1 = (TH1I*)h1obj;
    1235         h1->Reset();
    1236     }
    12371215
    12381216    Double_t min = size>0 ? array[0] : 0;
     
    12491227    FindGoodLimits(nbins, newbins, min, max, kFALSE);
    12501228
    1251     if (!h1)
    1252     {
    1253         h1 = new TH1I(name, title, newbins, min, max);
    1254         h1->SetXTitle("");
    1255         h1->SetYTitle("Counts");
    1256         h1->SetDirectory(gROOT);
    1257     }
     1229    TH1I *h1 = new TH1I(name, title, newbins, min, max);
     1230    h1->SetXTitle("");
     1231    h1->SetYTitle("Counts");
     1232    h1->SetDirectory(NULL);
    12581233
    12591234    // Second loop to fill the histogram
  • trunk/MagicSoft/Mars/mhcalib/MHCalibrationPix.h

    r4962 r4994  
    1515protected:
    1616
    17   Float_t  fEventFrequency;              // Event frequency in Hertz (to be set)
    18 
    19   Float_t *CreateEventXaxis(Int_t n);    // Create an x-axis for the Event TGraphs
    20   Float_t *CreatePSDXaxis  (Int_t n);    // Create an x-axis for the PSD TGraphs
    21  
    2217  Float_t  fBlackoutLimit;               // Lower nr sigmas from mean until event is considered blackout
    2318  Int_t    fSaturated;                   // Number of events classified as saturated
     
    3429  //  TObject *Clone(const char* name="") const;
    3530 
    36   void  CreateGraphEvents();          // Create the TGraph fGraphEvents of fEvents                   
    37   void  CreateGraphPowerSpectrum();   // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
    38 
    3931  // Getters
    4032  const Double_t GetBlackout       () const; 
    41   const Float_t  GetEventFrequency () const { return fEventFrequency; }
    4233  const Double_t GetPickup         () const;
    4334  const Int_t    GetPixId          () const { return fPixId;          }
     
    5142  void  AddSaturated        ( const Int_t    i                   ) { fSaturated     += i;   }
    5243  void  SetBlackoutLimit    ( const Float_t  lim=fgBlackoutLimit ) { fBlackoutLimit  = lim; }
    53   void  SetEventFrequency   ( const Float_t  f                   ) { fEventFrequency = f;   }
    5444  void  SetPickupLimit      ( const Float_t  lim=fgPickupLimit   ) { fPickupLimit    = lim; }
    5545  void  SetPixId            ( const Int_t    i                   ) { fPixId          = i;   }
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc

    r4962 r4994  
    127127//
    128128MHGausEvents::MHGausEvents(const char *name, const char *title)
    129     : fHPowerProbability(NULL),
     129    : fEventFrequency(0),
     130      fHPowerProbability(NULL),
    130131      fPowerSpectrum(NULL),
    131132      fFGausFit(NULL), fFExpFit(NULL),
     
    173174  // delete histograms
    174175  if (fHPowerProbability)
    175     if (gROOT->FindObject(fHPowerProbability->GetName()))
    176       delete fHPowerProbability;
     176    delete fHPowerProbability;
    177177 
    178178  // delete fits
    179179  if (fFGausFit)
    180180    delete fFGausFit;
     181
    181182  if (fFExpFit)
    182183    delete fFExpFit;
     
    189190  if (fGraphEvents)
    190191    delete fGraphEvents;
     192
    191193  if (fGraphPowerSpectrum)
    192194    delete fGraphPowerSpectrum;
     195
    193196}
    194197     
     
    199202// Sets:
    200203// - all other pointers to NULL
    201 // - all variables to 0.
     204// - all variables to 0. and keep fEventFrequency
    202205// - all flags to kFALSE
    203206//
     
    223226  if (fHPowerProbability)
    224227    {
    225         if (gROOT->FindObject(fHPowerProbability->GetName()))
    226             delete fHPowerProbability;
    227         fHPowerProbability = NULL;
    228     }
    229  
     228      delete fHPowerProbability;
     229      fHPowerProbability = NULL;
     230    }
     231
    230232  // delete fits
    231233  if (fFGausFit)
     
    301303  pix.fHGausHist = fHGausHist;
    302304
     305  pix.fEventFrequency       = fEventFrequency;
    303306  pix.fLast      = fLast;
    304307  pix.fMean      = fMean;
     
    324327  Float_t *xaxis = new Float_t[n]; 
    325328
    326   for (Int_t i=0;i<n;i++)
    327     xaxis[i] = (Float_t)i;
     329  if (fEventFrequency)
     330    for (Int_t i=0;i<n;i++)
     331      xaxis[i] = (Float_t)i/fEventFrequency;
     332  else
     333    for (Int_t i=0;i<n;i++)
     334      xaxis[i] = (Float_t)i;
    328335 
    329336  return xaxis;
     
    432439  fGraphEvents = new TGraph(n,CreateEventXaxis(n),fEvents.GetArray()); 
    433440  fGraphEvents->SetTitle("Evolution of Events with time");
     441  fGraphEvents->GetXaxis()->SetTitle((fEventFrequency) ? "Time [s]" : "Event Nr.");
    434442  fGraphEvents->GetYaxis()->SetTitle(fHGausHist.GetXaxis()->GetTitle());
    435443  fGraphEvents->GetYaxis()->CenterTitle();
     
    450458  fGraphPowerSpectrum = new TGraph(n,CreatePSDXaxis(n),fPowerSpectrum->GetArray()); 
    451459  fGraphPowerSpectrum->SetTitle("Power Spectrum Density");
     460  fGraphPowerSpectrum->GetXaxis()->SetTitle((fEventFrequency) ? "Frequency [Hz]" : "Frequency");
    452461  fGraphPowerSpectrum->GetYaxis()->SetTitle("P(f)");
    453462  fGraphPowerSpectrum->GetYaxis()->CenterTitle();
     
    465474  Float_t *xaxis = new Float_t[n];
    466475
    467   for (Int_t i=0;i<n;i++)
     476  if (fEventFrequency)
     477    for (Int_t i=0;i<n;i++)
     478      xaxis[i] = 0.5*(Float_t)i*fEventFrequency/n;
     479  else
     480    for (Int_t i=0;i<n;i++)
    468481    xaxis[i] = 0.5*(Float_t)i/n;
    469482 
  • trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h

    r4962 r4994  
    2727  const static Float_t  fgProbLimit;            //! Default for fProbLimit            (now set to: 0.001)
    2828  const static Int_t    fgPowerProbabilityBins; //! Default for fPowerProbabilityBins (now set to: 20)
     29
     30  Float_t *CreateEventXaxis(Int_t n);  // Create an x-axis for the Event TGraphs
     31  Float_t *CreatePSDXaxis(Int_t n);    // Create an x-axis for the PSD TGraphs
    2932 
    3033protected:
     34
     35  Float_t  fEventFrequency;              // Event frequency in Hertz (to be set)
    3136
    3237  Int_t    fBinsAfterStripping;        // Bins for the Gauss Histogram after stripping off the zeros at both ends
     
    6065  Float_t  fProbLimit;                 // Probability limit for judgement if fit is OK
    6166
    62   virtual Float_t *CreateEventXaxis(Int_t n);  // Create an x-axis for the Event TGraphs
    63   virtual Float_t *CreatePSDXaxis(Int_t n);    // Create an x-axis for the PSD TGraphs
    64 
    6567  void DrawPowerSpectrum(TVirtualPad &pad, Int_t i);  // Draw graph of fPowerSpectrum and fHPowerProbability
    6668
     
    9395        MArrayF *GetEvents()                   { return &fEvents;            } 
    9496  const MArrayF *GetEvents()             const { return &fEvents;            }
    95         TF1     *GetFExpFit()                  { return fFExpFit;            }
     97  const Float_t  GetEventFrequency () const { return fEventFrequency; }
     98  TF1     *GetFExpFit()                  { return fFExpFit;            }
    9699  const TF1     *GetFExpFit()            const { return fFExpFit;            }
    97100        TF1     *GetFGausFit()                 { return fFGausFit;           }
     
    141144 
    142145  // Setters
     146  void  SetEventFrequency   ( const Float_t  f                   ) { fEventFrequency = f;   }
    143147  void  SetExcluded         ( const Bool_t   b=kTRUE             ); 
    144148  void  SetExpFitOK         ( const Bool_t   b=kTRUE             );
     
    157161
    158162  void CreateFourierSpectrum();                   // Create the fourier spectrum out of fEvents
    159   virtual void    CreateGraphEvents();        // Create the TGraph fGraphEvents of fEvents
    160   virtual void    CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
     163  void CreateGraphEvents();        // Create the TGraph fGraphEvents of fEvents
     164  void CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum
    161165
    162166  ClassDef(MHGausEvents, 1) // Base class for events with Gaussian distributed values
Note: See TracChangeset for help on using the changeset viewer.