Changeset 8023
- Timestamp:
- 10/08/06 14:50:23 (18 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8022 r8023 43 43 mhvstime/MHSectorVsTime.cc, mranforest/MRanForest.cc: 44 44 - replaced IsNaN by !IsFinite (which includes IsNaN) 45 46 * mhcalib/MHGausEvents.cc: 47 - removed a memory leak by removing the functions creating the 48 axes 45 49 46 50 -
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
r8020 r8023 130 130 fPowerSpectrum(NULL), 131 131 fFExpFit(NULL), 132 fFirst(0.),133 132 fGraphEvents(NULL), fGraphPowerSpectrum(NULL), 134 f Last(100.), fNbins(100), fFGausFit(NULL)133 fFirst(0.), fLast(100.), fNbins(100), fFGausFit(NULL) 135 134 { 136 135 … … 272 271 } 273 272 } 274 275 276 277 // -----------------------------------------------------------------------------278 //279 // Create the x-axis for the event graph280 //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 else290 for (Int_t i=0;i<n;i++)291 xaxis[i] = (Float_t)i;292 293 return xaxis;294 295 }296 297 273 298 274 // ------------------------------------------------------------------- … … 398 374 399 375 const Int_t n = fEvents.GetSize(); 400 401 376 if (n==0) 402 377 return; 403 378 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()); 405 386 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."); 407 388 fGraphEvents->GetYaxis()->SetTitle(fHGausHist.GetXaxis()->GetTitle()); 408 389 fGraphEvents->GetYaxis()->CenterTitle(); … … 421 402 const Int_t n = fPowerSpectrum->GetSize(); 422 403 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()); 424 411 fGraphPowerSpectrum->SetTitle("Power Spectrum Density"); 425 fGraphPowerSpectrum->GetXaxis()->SetTitle( (fEventFrequency)? "Frequency [Hz]" : "Frequency");412 fGraphPowerSpectrum->GetXaxis()->SetTitle(fEventFrequency ? "Frequency [Hz]" : "Frequency"); 426 413 fGraphPowerSpectrum->GetYaxis()->SetTitle("P(f)"); 427 414 fGraphPowerSpectrum->GetYaxis()->CenterTitle(); … … 429 416 } 430 417 431 432 // -----------------------------------------------------------------------------433 //434 // Create the x-axis for the event graph435 //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 else445 for (Int_t i=0;i<n;i++)446 xaxis[i] = 0.5*(Float_t)i/n;447 448 return xaxis;449 450 }451 452 418 // ----------------------------------------------------------------------------- 453 419 // -
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h
r8020 r8023 28 28 private: 29 29 30 const static Int_t 31 const static Float_t 32 const static Int_t 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) 33 33 34 Float_t *CreateEventXaxis(Int_t n); // Create an x-axis for the Event TGraphs35 Float_t *CreatePSDXaxis (Int_t n); // Create an x-axis for the PSD TGraphs36 37 34 private: 38 35 … … 53 50 MArrayF fEvents; // Array which holds the entries of GausHist 54 51 TF1 *fFExpFit; // Exponential fit for FHPowerProbability 55 Axis_t fFirst; // Lower histogram edge for fHGausHist (used by InitBins())56 52 TGraph *fGraphEvents; //! TGraph to display the event array 57 53 TGraph *fGraphPowerSpectrum; //! TGraph to display the power spectrum array 54 Axis_t fFirst; // Lower histogram edge for fHGausHist (used by InitBins()) 58 55 Axis_t fLast; // Upper histogram edge for fHGausHist (used by InitBins()) 59 56 Int_t fNbins; // Number histogram bins for fHGausHist (used by InitBins())
Note:
See TracChangeset
for help on using the changeset viewer.