@@ -158,20 +158,20 @@ DhCorrelationFitter::~DhCorrelationFitter()
158158{
159159 Info (" DhCorrelationFitter.cxx" , " Destructor is calling" );
160160
161- if (fHist ) {
161+ if (fHist != nullptr ) {
162162 delete fHist ;
163163 fHist = 0 ;
164164 }
165- if (fFit ) {
165+ if (fFit != nullptr ) {
166166 delete fFit ;
167167 fFit = 0 ;
168168 }
169- if (fGausNS ) {
169+ if (fGausNS != nullptr ) {
170170 delete fGausNS ;
171171 fGausNS = 0 ;
172172 }
173173 // if (fGausNS2) {delete fGausNS2; fGausNS2 = 0;}
174- if (fPed ) {
174+ if (fPed != nullptr ) {
175175 delete fPed ;
176176 fPed = 0 ;
177177 }
@@ -180,8 +180,9 @@ DhCorrelationFitter::~DhCorrelationFitter()
180180DhCorrelationFitter& DhCorrelationFitter::operator =(const DhCorrelationFitter& cfit)
181181// assignment operator
182182{
183- if (&cfit == this )
183+ if (&cfit == this ) {
184184 return *this ;
185+ }
185186
186187 fIsReflected = cfit.fIsReflected ;
187188 fTypeOfFitFunc = cfit.fTypeOfFitFunc ;
@@ -215,7 +216,7 @@ DhCorrelationFitter& DhCorrelationFitter::operator=(const DhCorrelationFitter& c
215216 return *this ;
216217}
217218
218- void DhCorrelationFitter::setExternalValsAndBounds (Int_t nPars, Double_t* vals, Double_t* lowBounds, Double_t* uppBounds)
219+ void DhCorrelationFitter::setExternalValsAndBounds (Int_t nPars, const Double_t* vals, const Double_t* lowBounds, const Double_t* uppBounds)
219220{
220221
221222 fNpars = nPars;
@@ -229,8 +230,6 @@ void DhCorrelationFitter::setExternalValsAndBounds(Int_t nPars, Double_t* vals,
229230 fExtParsLowBounds [i] = lowBounds[i];
230231 fExtParsUppBounds [i] = uppBounds[i];
231232 }
232-
233- return ;
234233}
235234
236235void DhCorrelationFitter::fitting (Bool_t drawSplitTerm, Bool_t useExternalPars)
@@ -247,8 +246,9 @@ void DhCorrelationFitter::fitting(Bool_t drawSplitTerm, Bool_t useExternalPars)
247246 // = 2 : AS mean fixed to pi, NS mean free
248247 // = 3 : NS mean fixed to 0, AS mean to pi
249248
250- if (useExternalPars)
249+ if (useExternalPars) {
251250 fUseExternalPars = kTRUE ;
251+ }
252252
253253 if (fFixBase != 0 && fFixBase != 6 ) {
254254 Printf (" [INFO] DhCorrelationFitter::Fitting, Finding baseline" );
@@ -272,10 +272,12 @@ void DhCorrelationFitter::fitting(Bool_t drawSplitTerm, Bool_t useExternalPars)
272272 fFit ->FixParameter (2 , 0 .);
273273 }
274274 if (fFixMean == 2 || fFixMean == 3 ) {
275- if (fTypeOfFitFunc != 0 && fTypeOfFitFunc != 3 )
275+ if (fTypeOfFitFunc != 0 && fTypeOfFitFunc != 3 ) {
276276 fFit ->FixParameter (5 , TMath::Pi ());
277- if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6 )
277+ }
278+ if (fTypeOfFitFunc == 3 || fTypeOfFitFunc == 6 ) {
278279 fFit ->FixParameter (2 , TMath::Pi ());
280+ }
279281 }
280282
281283 Printf (" [INFO] DhCorrelationFitter::Fitting, Fitting" );
@@ -331,7 +333,7 @@ void DhCorrelationFitter::setFitFunction()
331333 // = 6: const + VonMises AS
332334 // = 7: baseline w v2 modulation + G NS + G AS (w/ periodicity)
333335
334- if (fFit ) {
336+ if (fFit != nullptr ) {
335337 delete fFit ;
336338 delete fGausNS ;
337339 // delete fGausNS2;
@@ -596,7 +598,7 @@ void DhCorrelationFitter::setFitFunction()
596598 }
597599}
598600
599- void DhCorrelationFitter::setPointsForBaseline (Int_t nBaselinePoints, Int_t* binsBaseline)
601+ void DhCorrelationFitter::setPointsForBaseline (Int_t nBaselinePoints, const Int_t* binsBaseline)
600602{
601603
602604 fNbasleinePoints = nBaselinePoints;
@@ -606,8 +608,6 @@ void DhCorrelationFitter::setPointsForBaseline(Int_t nBaselinePoints, Int_t* bin
606608 for (int i = 0 ; i < fNbasleinePoints ; i++) {
607609 fBinsBaseline [i] = binsBaseline[i];
608610 }
609-
610- return ;
611611}
612612
613613Double_t DhCorrelationFitter::findBaseline ()
@@ -694,8 +694,9 @@ Double_t DhCorrelationFitter::findBaseline()
694694 errAv += 1 . / (fHist ->GetBinError (binPhi) * fHist ->GetBinError (binPhi));
695695 if (!fIsReflected ) {
696696 binPhi = fHist ->FindBin (-TMath::Pi () / 2 .);
697- if (binPhi < 1 )
697+ if (binPhi < 1 ) {
698698 binPhi = 1 ;
699+ }
699700 av += fHist ->GetBinContent (binPhi) / (fHist ->GetBinError (binPhi) * fHist ->GetBinError (binPhi));
700701 errAv += 1 . / (fHist ->GetBinError (binPhi) * fHist ->GetBinError (binPhi));
701702 } else {
@@ -774,7 +775,7 @@ Double_t DhCorrelationFitter::findBaseline()
774775void DhCorrelationFitter::fitBaselineWv2 ()
775776{
776777
777- fBaseTransvReg = new TF1 (" fBaseTransvReg" , [](double * x, double * p) {
778+ fBaseTransvReg = new TF1 (" fBaseTransvReg" , [](const double * x, const double * p) {
778779 double xx = x[0 ]; // x value
779780 if ((xx >= -TMath::Pi ()/2 && xx <= -3 *TMath::Pi ()/8 ) || (xx >= 3 *TMath::Pi ()/8 && xx <= 5 *TMath::Pi ()/8 ) || (xx >= 11 *TMath::Pi ()/8 && xx <= 3 *TMath::Pi ()/2 )) {
780781 // Gaussian example: p[0] = amplitude, p[1] = mean, p[2] = sigma
@@ -787,8 +788,6 @@ void DhCorrelationFitter::fitBaselineWv2()
787788
788789 TFitResultPtr rFit = fHist ->Fit (fBaseTransvReg , " RIMES" , " " , fMinCorr , fMaxCorr );
789790 fBaseline = fBaseTransvReg ->GetParameter (0 );
790-
791- return ;
792791}
793792
794793void DhCorrelationFitter::calculateYieldsAboveBaseline ()
@@ -800,13 +799,15 @@ void DhCorrelationFitter::calculateYieldsAboveBaseline()
800799 fErrASyieldBinCount = 0 ;
801800 std::cout << " [RESULT] Baseline: " << fBaseline << " +- " << fErrBaseline << std::endl;
802801 Int_t binMinNS = fHist ->FindBin (-1.5 ); // slightly more than -pi/2
803- if (binMinNS < 1 )
804- binMinNS = 1 ; // with this, it is ok even in the case of a reflected fHist (range 0 - pi)
802+ if (binMinNS < 1 ) {
803+ binMinNS = 1 ; // with this, it is ok even in the case of a reflected fHist (range 0 - pi)
804+ }
805805 Int_t binMaxNS = 6 ; // fHist -> FindBin(1.5); // slightly less than +pi/2
806806 Int_t binMinAS = 11 ; // fHist -> FindBin(1.6); // slightly more than +pi/2
807807 Int_t binMaxAS = 16 ; // fHist -> FindBin(3.14+1.5); // slightly less than +3pi/2
808- if (binMaxAS > fHist ->GetNbinsX ())
808+ if (binMaxAS > fHist ->GetNbinsX ()) {
809809 binMaxAS = fHist ->GetNbinsX (); // with this, it is ok even in the case of a reflected fHist (range 0 - pi)
810+ }
810811 std::cout << " N bins : " << fHist ->GetNbinsX () << std::endl;
811812 std::cout << " binMinNS : " << binMinNS << std::endl;
812813 std::cout << " binMaxNS : " << binMaxNS << std::endl;
@@ -827,8 +828,6 @@ void DhCorrelationFitter::calculateYieldsAboveBaseline()
827828 fErrASyieldBinCount = TMath::Sqrt (fErrASyieldBinCount );
828829
829830 printf (" [RESULT] Bin counting results: NS Yield = %.3f +- %.3f \n [RESULT] Bin counting results: AS Yield: %.3f +- %.3f \n " , fNSyieldBinCount , fErrNSyieldBinCount , fASyieldBinCount , fErrASyieldBinCount );
830-
831- return ;
832831}
833832
834833Double_t DhCorrelationFitter::calculateBaseline (TH1F*& histo, Bool_t totalRange)
0 commit comments