Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions interface/DoubleSidedGaussian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*****************************************************************************
* Project: RooFit *
* *
* This code was autogenerated by RooClassFactory *
*****************************************************************************/

#ifndef MY_DOUBLE_Gaussian
#define MY_DOUBLE_Gaussian

#include "RooAbsPdf.h"
#include "RooRealProxy.h"
#include "RooCategoryProxy.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include "RooGlobalFunc.h"

#include "RooArgusBG.h"
#include "RooRealVar.h"
#include "RooDataSet.h"

#include "RooGaussian.h"
#include "RooCBShape.h"
#include "RooExponential.h"
#include "RooBreitWigner.h"

#include "RooConstVar.h"
#include "RooDataHist.h"
#include "RooFitResult.h"
#include "RooMinuit.h"
#include "RooPlot.h"

class DoubleSidedGaussian : public RooAbsPdf {
public:
DoubleSidedGaussian() {} ;
DoubleSidedGaussian(const char *name, const char *title,
RooAbsReal& _x,
RooAbsReal& _mean,
RooAbsReal& _sig1,
RooAbsReal& _sig2,
Double_t _yMax);
DoubleSidedGaussian(const DoubleSidedGaussian& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new DoubleSidedGaussian(*this,newname); }
inline virtual ~DoubleSidedGaussian() { }

protected:

RooRealProxy x ;
RooRealProxy mean ;
RooRealProxy sig1 ;
RooRealProxy sig2 ;
Double_t evaluate() const ;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class doesn't implement anaytical integral capabilities, so it will be always integrated numerically. That's a major performance hit.

private:

Double_t yMax;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yMax is not used anywhere, right? Why is it needed?

ClassDef(DoubleSidedGaussian,1) // Your description goes here...
};

#endif

59 changes: 59 additions & 0 deletions src/DoubleSidedGaussian.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*****************************************************************************
* Project: RooFit *
* *
* This code was autogenerated by RooClassFactory *
*****************************************************************************/

// Your description goes here...

#include "../interface/DoubleSidedGaussian.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include <math.h>
#include "TMath.h"
#include "RooGaussian.h"

ClassImp(DoubleSidedGaussian)

DoubleSidedGaussian::DoubleSidedGaussian(const char *name, const char *title,
RooAbsReal& _x,
RooAbsReal& _mean,
RooAbsReal& _sig1,
RooAbsReal& _sig2,
Double_t _yMax) :
RooAbsPdf(name,title),
x("x","x",this,_x),
mean("mean","mean",this,_mean),
sig1("sig1","sig1",this,_sig1),
sig2("sig2","sig2",this,_sig2),
yMax(_yMax)
{
}


DoubleSidedGaussian::DoubleSidedGaussian(const DoubleSidedGaussian& other, const char* name) :
RooAbsPdf(other,name),
x("x",this,other.x),
mean("mean",this,other.mean),
sig1("sig1",this,other.sig1),
sig2("sig2",this,other.sig2),
yMax(other.yMax)
{
}



Double_t DoubleSidedGaussian::evaluate() const
{
// From wikipedia
double result = -1;
double sqrt2OverPi = TMath::Sqrt(2. / TMath::Pi());
double mode = mean; // redefine mean to mode
double A = sqrt2OverPi / (sig2+sig1);
if (x < mode)
result = A * TMath::Exp( -1 * (x-mode)*(x-mode) / (2*sig1*sig1) );
else
result = A * TMath::Exp( -1 * (x-mode)*(x-mode) / (2*sig2*sig2) );
return result;
}

1 change: 1 addition & 0 deletions src/classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@
#include "HiggsAnalysis/CombinedLimit/interface/CMSExternalMorph.h"
#include "HiggsAnalysis/CombinedLimit/interface/CMSInterferenceFunc.h"
#include "HiggsAnalysis/CombinedLimit/interface/RooEFTScalingFunction.h"
#include "HiggsAnalysis/CombinedLimit/interface/DoubleSidedGaussian.h"
1 change: 1 addition & 0 deletions src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,5 @@
<class name="CMSExternalMorph" />
<class name="CMSInterferenceFunc" />
<class name="RooEFTScalingFunction" />
<class name="DoubleSidedGaussian" />
</lcgdict>