Skip to content

Commit

Permalink
Avoid operator- on TComplex and RooRealProxy
Browse files Browse the repository at this point in the history
This will not work anymore in ROOT 6.30. The `double` value needs to be
retrieved from the proxy first.
  • Loading branch information
guitargeek committed Nov 30, 2023
1 parent e397b9f commit 622b5b5
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions src/HZZ4LRooPdfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4009,11 +4009,14 @@ ClassImp(RooCPSHighMassGGH)
beta = getBeta(mH,effKPrime);
}

// Cast the "x" proxy to double only once to avoid overhead and ambiguous
// overloads the TComplex operators.
const double xVal = x;

Double_t bwHM = x / ( TMath::Power( TMath::Power(x,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(x,2)*TMath::Power(effKPrime*width,2) );
Double_t bwHM = xVal / ( TMath::Power( TMath::Power(xVal,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(xVal,2)*TMath::Power(effKPrime*width,2) );

Double_t splineFactor;
if (x<1850) splineFactor = Spline(x);
if (xVal<1850) splineFactor = Spline(xVal);
else splineFactor = Spline(1850);

Double_t signal = bwHM*splineFactor;
Expand All @@ -4024,9 +4027,9 @@ ClassImp(RooCPSHighMassGGH)
TComplex M = MSquared.Sqrt(MSquared);
TComplex Exp1 = MSquared.Exp((TComplex)alpha);
TComplex Exp2 = MSquared.Exp(-(TComplex)alpha);
TComplex Exp3 = MSquared.Exp(-x*(TComplex)alpha/M);
TComplex Exp3 = MSquared.Exp(-xVal*(TComplex)alpha/M);

double interference = -r*(1-TMath::Exp(-beta*(x-150.)/mH_eff))*((Exp1/(x-M)-Exp2/(x+M))*Exp3).Re();
double interference = -r*(1-TMath::Exp(-beta*(xVal-150.)/mH_eff))*((Exp1/(xVal-M)-Exp2/(xVal+M))*Exp3).Re();

Double_t fValue = signal + IntStr*interference/( TMath::Sqrt(1-BRnew) );
if (fValue > 0) return fValue;
Expand Down Expand Up @@ -4655,7 +4658,11 @@ ClassImp(RooBWHighMassGGH)
Double_t r = getR(mH,effKPrime);
Double_t beta = getBeta(mH,effKPrime);

Double_t bwHM = x / ( TMath::Power( TMath::Power(x,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(x,2)*TMath::Power(effKPrime*width,2) );
// Cast the "x" proxy to double only once to avoid overhead and ambiguous
// overloads the TComplex operators.
const double xVal = x;

Double_t bwHM = xVal / ( TMath::Power( TMath::Power(xVal,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(xVal,2)*TMath::Power(effKPrime*width,2) );
Double_t signal = bwHM;

Double_t k=0.25;
Expand All @@ -4666,7 +4673,7 @@ ClassImp(RooBWHighMassGGH)
TComplex Exp2 = MSquared.Exp(-(TComplex)alpha);
TComplex Exp3 = MSquared.Exp(-x*(TComplex)alpha/M);

double interference = -r*(1-TMath::Exp(-beta*(x-150.)/mH_eff))*((Exp1/(x-M)-Exp2/(x+M))*Exp3).Re();
double interference = -r*(1-TMath::Exp(-beta*(xVal-150.)/mH_eff))*((Exp1/(xVal-M)-Exp2/(xVal+M))*Exp3).Re();

Double_t fValue = signal + IntStr*interference/( TMath::Sqrt(1-BRnew) );
if (fValue > 0) return fValue;
Expand Down Expand Up @@ -6552,11 +6559,14 @@ ClassImp(RooCPSHighMassVBF)
beta = getBeta(mH,effKPrime);
}

// Cast the "x" proxy to double only once to avoid overhead and ambiguous
// overloads the TComplex operators.
const double xVal = x;

Double_t bwHM = x / ( TMath::Power( TMath::Power(x,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(x,2)*TMath::Power(effKPrime*width,2) );
Double_t bwHM = xVal / ( TMath::Power( TMath::Power(xVal,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(xVal,2)*TMath::Power(effKPrime*width,2) );

Double_t splineFactor;
if (x<1850) splineFactor = Spline(x);
if (xVal<1850) splineFactor = Spline(xVal);
else splineFactor = Spline(1850);

Double_t signal = bwHM*splineFactor;
Expand All @@ -6567,9 +6577,9 @@ ClassImp(RooCPSHighMassVBF)
TComplex M = MSquared.Sqrt(MSquared);
TComplex Exp1 = MSquared.Exp((TComplex)alpha);
TComplex Exp2 = MSquared.Exp(-(TComplex)alpha);
TComplex Exp3 = MSquared.Exp(-x*(TComplex)alpha/M);
TComplex Exp3 = MSquared.Exp(-xVal*(TComplex)alpha/M);

double interference = -r*(1-TMath::Exp(-beta*(x-150.)/mH_eff))*((Exp1/(x-M)-Exp2/(x+M))*Exp3).Re();
double interference = -r*(1-TMath::Exp(-beta*(xVal-150.)/mH_eff))*((Exp1/(xVal-M)-Exp2/(xVal+M))*Exp3).Re();

Double_t fValue = signal*(1+IntStr*interference/(bwHM*( TMath::Sqrt(1-BRnew) )));
if (fValue > 0) return fValue;
Expand Down Expand Up @@ -7645,23 +7655,26 @@ ClassImp(RooSigPlusInt)

Double_t RooSigPlusInt::evaluate() const
{
// Cast the "x" proxy to double only once to avoid overhead and ambiguous
// overloads the TComplex operators.
const double xVal = x;

Double_t totWidthSF = CSquared/(1-BRnew);

Double_t mH_eff = mH*TMath::Sqrt(1-k*(totWidthSF*width/mH)*(totWidthSF*width/mH));

Double_t splineFactor = Spline(x);
Double_t bwHM = x / ( TMath::Power( TMath::Power(x,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(x,2)*TMath::Power(totWidthSF*width,2) );
Double_t bwHM = xVal / ( TMath::Power( TMath::Power(xVal,2) - TMath::Power(mH+delta,2) , 2 ) + TMath::Power(xVal,2)*TMath::Power(totWidthSF*width,2) );

Double_t signal = splineFactor*bwHM;

TComplex MSquared(mH_eff*mH_eff,-totWidthSF*width*mH_eff);
TComplex M = MSquared.Sqrt(MSquared);
TComplex Exp1 = MSquared.Exp((TComplex)alpha);
TComplex Exp2 = MSquared.Exp(-(TComplex)alpha);
TComplex Exp3 = MSquared.Exp(-x*(TComplex)alpha/M);
TComplex Exp3 = MSquared.Exp(-xVal*(TComplex)alpha/M);

double interference = -r*sqrt(1/1-BRnew)*(1-TMath::Exp(-beta*(x-150.)/mH_eff))*((Exp1/(x-M)-Exp2/(x+M))*Exp3).Re();
double interference = -r*sqrt(1/1-BRnew)*(1-TMath::Exp(-beta*(xVal-150.)/mH_eff))*((Exp1/(xVal-M)-Exp2/(xVal+M))*Exp3).Re();

return signal + interference;

Expand Down

0 comments on commit 622b5b5

Please sign in to comment.