Changeset 5135 for trunk/MagicSoft/Mars/mhcalib
- Timestamp:
- 09/25/04 13:51:15 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mhcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.cc
r5115 r5135 88 88 #include <TCanvas.h> 89 89 #include <TStyle.h> 90 #include <TRandom.h> 90 91 91 92 #include "MFFT.h" … … 151 152 fHGausHist.UseCurrentStyle(); 152 153 fHGausHist.SetDirectory(NULL); 153 fHGausHist.GetYaxis()->CenterTitle(); 154 // TAxis *xaxe = fHGausHist.GetXaxis(); 155 // xaxe->Set(100,0.,100.); 156 TAxis *yaxe = fHGausHist.GetYaxis(); 157 // yaxe->SetDefaults(); 158 yaxe->CenterTitle(); 154 159 } 155 160 … … 173 178 { 174 179 175 // delete histograms176 if (fHPowerProbability)177 delete fHPowerProbability;178 179 180 // 180 181 // The next two lines are important for the case that … … 193 194 delete fFExpFit; 194 195 196 // delete histograms 197 if (fHPowerProbability) 198 delete fHPowerProbability; 199 195 200 // delete arrays 196 201 if (fPowerSpectrum) … … 203 208 if (fGraphPowerSpectrum) 204 209 delete fGraphPowerSpectrum; 210 205 211 206 212 } … … 522 528 { 523 529 pad->cd(cwin++); 524 DrawPowerSpectrum(*pad,cwin); 525 } 526 } 527 530 DrawPowerSpectrum(); 531 pad->cd(cwin); 532 DrawPowerProjection(); 533 } 534 } 535 536 // ----------------------------------------------------------------------------- 537 // 538 // DrawEvents: 539 // 540 // Will draw the graph with the option "A", unless the option: 541 // "SAME" has been chosen 542 // 528 543 void MHGausEvents::DrawEvents(Option_t *opt) 529 544 { … … 551 566 552 567 553 void MHGausEvents::DrawPowerSpectrum(TVirtualPad &pad, Int_t i) 554 { 555 568 // ----------------------------------------------------------------------------- 569 // 570 // DrawPowerSpectrum 571 // 572 // Will draw the fourier spectrum of the events sequence with the option "A", unless the option: 573 // "SAME" has been chosen 574 // 575 void MHGausEvents::DrawPowerSpectrum(Option_t *option) 576 { 577 578 TString opt(option); 579 580 if (!fPowerSpectrum) 581 CreateFourierSpectrum(); 582 556 583 if (fPowerSpectrum) 557 584 { 558 585 if (!fGraphPowerSpectrum) 559 586 CreateGraphPowerSpectrum(); 587 588 if (!fGraphPowerSpectrum) 589 return; 560 590 561 fGraphPowerSpectrum->Draw("AL"); 562 fGraphPowerSpectrum->SetBit(kCanDelete); 563 } 564 565 pad.cd(i); 591 if (opt.Contains("same")) 592 { 593 opt.ReplaceAll("same",""); 594 fGraphPowerSpectrum->Draw(opt+"L"); 595 } 596 else 597 { 598 fGraphPowerSpectrum->Draw(opt+"AL"); 599 fGraphPowerSpectrum->SetBit(kCanDelete); 600 } 601 } 602 } 603 604 // ----------------------------------------------------------------------------- 605 // 606 // DrawPowerProjection 607 // 608 // Will draw the projection of the fourier spectrum onto the power probability axis 609 // with the possible options of TH1D 610 // 611 void MHGausEvents::DrawPowerProjection(Option_t *option) 612 { 613 614 TString opt(option); 615 616 if (!fHPowerProbability) 617 CreateFourierSpectrum(); 566 618 567 619 if (fHPowerProbability && fHPowerProbability->GetEntries() > 0) 568 620 { 569 621 gPad->SetLogy(); 570 fHPowerProbability->Draw( );622 fHPowerProbability->Draw(opt.Data()); 571 623 if (fFExpFit) 572 624 { … … 772 824 void MHGausEvents::InitBins() 773 825 { 826 // const TAttAxis att(fHGausHist.GetXaxis()); 774 827 fHGausHist.SetBins(fNbins,fFirst,fLast); 828 // att.Copy(fHGausHist.GetXaxis()); 775 829 } 776 830 … … 904 958 } 905 959 960 // ---------------------------------------------------------------------------- 961 // 962 // Simulates Gaussian events and fills them into the histogram and the array 963 // In order to do a fourier analysis, call CreateFourierSpectrum() 964 // 965 void MHGausEvents::SimulateGausEvents(const Float_t mean, const Float_t sigma, const Int_t nevts) 966 { 967 968 if (!IsEmpty()) 969 *fLog << warn << "The histogram is already filled, will superimpose simulated events on it..." << endl; 970 971 for (Int_t i=0;i<nevts;i++) { 972 const Double_t ran = gRandom->Gaus(mean,sigma); 973 FillHistAndArray(ran); 974 } 975 976 } -
trunk/MagicSoft/Mars/mhcalib/MHGausEvents.h
r5098 r5135 33 33 protected: 34 34 35 Float_t fEventFrequency; 35 Float_t fEventFrequency; // Event frequency in Hertz (to be set) 36 36 37 37 Int_t fBinsAfterStripping; // Bins for the Gauss Histogram after stripping off the zeros at both ends … … 65 65 Float_t fProbLimit; // Probability limit for judgement if fit is OK 66 66 67 void DrawPowerSpectrum(TVirtualPad &pad, Int_t i); // Draw graph of fPowerSpectrum and fHPowerProbability68 69 67 // Setters 70 68 void SetBinsAfterStripping ( const Int_t nbins=0 ) { fBinsAfterStripping =nbins; } … … 79 77 void Reset(); 80 78 79 void CreateFourierSpectrum(); 80 void CreateGraphEvents(); 81 void CreateGraphPowerSpectrum(); 82 81 83 // Draws 82 void Draw(Option_t *option=""); // Default Draw 83 void DrawEvents(Option_t *option=""); // Draw graph of fEvents 84 void Draw(Option_t *option=""); 85 void DrawEvents(Option_t *option=""); 86 void DrawPowerSpectrum(Option_t *option=""); 87 void DrawPowerProjection(Option_t *option=""); 84 88 89 // Fill 90 void FillArray ( const Float_t f ); 91 Bool_t FillHist ( const Float_t f ); 92 Bool_t FillHistAndArray( const Float_t f ); 93 94 // Fits 95 Bool_t FitGaus( Option_t *option="RQ0", 96 const Double_t xmin=0., 97 const Double_t xmax=0.); 98 85 99 // Inits 86 100 virtual void InitBins(); … … 128 142 const Bool_t IsOnlyUnderflow() const; 129 143 130 // Fill131 void FillArray ( const Float_t f ); // Fill only the array fEvents132 Bool_t FillHist ( const Float_t f ); // Fill only the histogram HGausHist133 Bool_t FillHistAndArray( const Float_t f ); // Fill bothe the array fEvents and the histogram HGausHist134 135 // Fits136 Bool_t FitGaus( Option_t *option="RQ0",137 const Double_t xmin=0.,138 const Double_t xmax=0.); // Fit the histogram HGausHist with a Gaussian139 140 144 // Prints 141 v irtual void Print(const Option_t *o="") const; // Default Print145 void Print(const Option_t *o="") const; 142 146 143 147 // Setters … … 158 162 void SetSigmaErr ( const Double_t d ) { fSigmaErr = d; } 159 163 160 void CreateFourierSpectrum(); // Create the fourier spectrum out of fEvents 161 void CreateGraphEvents(); // Create the TGraph fGraphEvents of fEvents 162 void CreateGraphPowerSpectrum(); // Create the TGraph fGraphPowerSpectrum out of fPowerSpectrum 164 // Simulates 165 void SimulateGausEvents(const Float_t mean, const Float_t sigma, const Int_t nevts=4096); 163 166 164 ClassDef(MHGausEvents, 1) // Base class for events with Gaussian distributed values167 ClassDef(MHGausEvents, 2) // Base class for events with Gaussian distributed values 165 168 }; 166 169
Note:
See TracChangeset
for help on using the changeset viewer.