1 #include "PeakAnaPainter.h"
24 PeakAnaPainter::~PeakAnaPainter()
42 Color_t PeakAnaPainter::GetBaseLineColor()
44 Style_t PeakAnaPainter::GetBaseLineStyle()
46 Width_t PeakAnaPainter::GetBaseLineWidth()
49 Color_t PeakAnaPainter::GetHitLineColor()
51 Style_t PeakAnaPainter::GetHitLineStyle()
53 Width_t PeakAnaPainter::GetHitLineWidth()
56 void PeakAnaPainter::SetBaseLineColor(Color_t color)
58 void PeakAnaPainter::SetBaseLineColorAlpha(Color_t color,Float_t alpha)
60 void PeakAnaPainter::SetBaseLineStyle(Style_t style)
62 void PeakAnaPainter::SetBaseLineWidth(Width_t width)
65 void PeakAnaPainter::SetHitLineColor(Color_t color)
67 void PeakAnaPainter::SetHitLineColorAlpha(Color_t color,Float_t alpha)
69 void PeakAnaPainter::SetHitLineStyle(Style_t style)
71 void PeakAnaPainter::SetHitLineWidth(Width_t width)
74 void PeakAnaPainter::Paint(Option_t* opt)
76 if(
mPA==0 ){
return; }
77 std::string option(opt);
80 bool drawgraph =
true;
82 bool drawbaselines =
false;
83 bool drawfoundpeakrange =
false;
84 bool drawallpeakranges =
false;
85 bool drawfoundmarker =
false;
86 bool drawallmarkers =
false;
88 std::size_t firstcolon = option.find(
";");
89 if( firstcolon!=std::string::npos ){
91 std::size_t secondcolon = option.find(
";",firstcolon+1);
92 if( secondcolon!=std::string::npos ){
93 mPeakOption = option.substr(firstcolon+1,secondcolon-firstcolon-1);
95 std::size_t thirdcolon = option.find(
";",secondcolon+1);
96 if( thirdcolon!=std::string::npos ){ LOG_WARN <<
"PeakAnaPainter::Paint(): Too many semicolons in draw option" << endm; }
105 if(
mPeakOption.Contains(
"b") ){ drawbaselines=
true; }
106 if(
mPeakOption.Contains(
"f") ){ drawfoundpeakrange=
true; }
107 if(
mPeakOption.Contains(
"p") ){ drawfoundpeakrange=
true; drawallpeakranges=
true; }
108 if(
mPeakOption.Contains(
"m") ){ drawfoundmarker=
true; }
109 if(
mPeakOption.Contains(
"w") ){ drawfoundmarker=
true; drawallmarkers=
true; }
110 if(
mPeakOption.Contains(
"e") ){ drawfoundpeakrange=
true; drawallpeakranges=
true; drawfoundmarker=
true; drawallmarkers=
true; }
111 if(
mPeakOption.Contains(
"a") ){ drawbaselines=
true; drawfoundpeakrange=
true; drawallpeakranges=
true; drawfoundmarker=
true; drawallmarkers=
true; }
176 if( computedindex ==
mPA->
NPeaks() ){
return;}
179 sl->SetLineColor(kRed);
182 el->SetLineColor(kOrange);
199 for( UShort_t ipeak = 0; ipeak<
mPA->
NPeaks(); ++ipeak ){
200 if( ipeak==computedindex ){
continue;}
203 mp->SetMarkerSize(
mPA->GetMarkerSize()*2.0);
216 if( computedindex ==
mPA->
NPeaks() ){
return;}
219 mp->SetMarkerColor(kViolet);
220 mp->SetMarkerSize(
mPA->GetMarkerSize()*2.0);
230 for( UShort_t ipeak = 0; ipeak<
mPA->
NPeaks(); ++ipeak ){
231 if( ipeak==computedindex ){
continue;}
233 mp->SetMarkerSize(
mPA->GetMarkerSize()*2.0);
virtual void CleanPainter()
Clean up internal objects.
TString mPeakOption
option for drawing the peaks
bool ValidGraph()
Check if PeakAna object loaded and has a non-zero TGraph.
TLine * mTheHitLine
threshold for a peak PeakAna::mBaseline + PeakAna::mBaselineSigma*PeakAna::mBaselineSigmaScale ...
TString mGraphOption
option for drawing the TGraph
TLine * GetStartLine(Double_t ymin=0, Double_t ymax=0)
Create and return a TLine for the start of the peak window.
virtual void SetPeakAna(PeakAna *ana)
const PeakWindow & GetPeak(UInt_t peakidx) const
Int_t FoundPeakIndex() const
virtual void PaintFoundPeakRange()
Just draw the found peak on the current pad.
virtual TGraph * GetData() const
TMarker * GetPeakMarker()
Create and return a TMarker to mark the location of the peak.
Double_t PeakEnd()
Found Signal ending x-value.
virtual void PaintPeakRanges()
Draw all found peaks on the current pad except the found peak.
TLine * mTheBaseLine
line for the PeakAna::mBaseline
virtual void PaintRawData()
Raw data with no modifications.
virtual Int_t AnalyzeForPeak()
Main analysis method for finding peaks.
Double_t PeakStart()
Found Signal starting x-value.
TString mStatsOption
option for what to put in stats box
virtual void AddPeakStats(TPaveText *pave, const char *opt="")
Add peak information to a "statistics" box.
virtual void PaintFoundMarker()
Draw the marker indicating the found peak.
Double_t BaselineSigma() const
PeakAna * mPA
pointer to PeakAna for drawing (PA=PeakAna)
virtual void PaintBaselines()
Just draw the baseline and hitlines.
virtual void PaintPeakMarkers()
Draw markers indicating all peaks except the found peak marker.
virtual void PaintStats()
Draw Stats box for peak finding.
Double_t Baseline() const
TPaveText * mPaveT_PA
for custom stats box
virtual TPaveText * MakePaveText(Double_t xmin=0.7, Double_t ymin=0.5, Double_t xmax=1.0, Double_t ymax=1.0)
Makes the stats box to show peak infomation.
Double_t BaselineSigmaScale() const
virtual void PaintFoundPeak()
Raw data inside zoomed in on found signal region.
TLine * GetEndLine(Double_t ymin=0, Double_t ymax=0)
Create and return a TLine for the end of the peak window.
void Init()
Initialize internal variables to null.