CMS 3D CMS Logo

Public Member Functions | Protected Attributes

dqmTnP::GaussianPlusLinearFitter Class Reference

#include <GenericTnPFitter.h>

Inheritance diagram for dqmTnP::GaussianPlusLinearFitter:
dqmTnP::AbstractFitter

List of all members.

Public Member Functions

void fit (TH1 *pass, TH1 *all)
 GaussianPlusLinearFitter (bool verbose=false)
 ~GaussianPlusLinearFitter ()

Protected Attributes

RooGaussian gaussian
RooChebychev linearFail
RooChebychev linearPass
RooAddPdf pdfFail
RooAddPdf pdfPass
RooRealVar slopeFail
RooRealVar slopePass

Detailed Description

Definition at line 240 of file GenericTnPFitter.h.


Constructor & Destructor Documentation

dqmTnP::GaussianPlusLinearFitter::GaussianPlusLinearFitter ( bool  verbose = false) [inline]

Definition at line 250 of file GenericTnPFitter.h.

References dqmTnP::AbstractFitter::simPdf.

                                                :
    AbstractFitter(verbose),
    gaussian("gaussian","gaussian",mass,mean,sigma),
    slopeFail("slopeFail","slopeFail",0.,-1.,1.),
    linearFail("linearFail","linearFail",mass,slopeFail),
    slopePass("slopePass","slopePass",0.,-1.,1.),
    linearPass("linearPass","linearPass",mass,slopePass),
    pdfFail("pdfFail","pdfFail", RooArgList(gaussian,linearFail), RooArgList(nSignalFail,nBackgroundFail)),
    pdfPass("pdfPass","pdfPass", RooArgList(gaussian,linearPass), RooArgList(nSignalPass,nBackgroundPass))
  {
    simPdf.addPdf(pdfFail,"fail");
    simPdf.addPdf(pdfPass,"pass");
  };
dqmTnP::GaussianPlusLinearFitter::~GaussianPlusLinearFitter ( ) [inline]

Definition at line 263 of file GenericTnPFitter.h.

{};

Member Function Documentation

void dqmTnP::GaussianPlusLinearFitter::fit ( TH1 *  pass,
TH1 *  all 
) [inline, virtual]

Implements dqmTnP::AbstractFitter.

Definition at line 264 of file GenericTnPFitter.h.

References cond::ecalcond::all, dqmTnP::AbstractFitter::category, dqmTnP::AbstractFitter::chi2, dqmTnP::AbstractFitter::data, dqmTnP::AbstractFitter::efficiency, dqmTnP::AbstractFitter::expectedMean, dqmTnP::AbstractFitter::expectedSigma, cmsPerfPublish::fail(), dqmTnP::AbstractFitter::mass, dqmTnP::AbstractFitter::mean, dqmTnP::AbstractFitter::nBackgroundFail, dqmTnP::AbstractFitter::nBackgroundPass, dqmTnP::AbstractFitter::nSignalAll, dqmTnP::AbstractFitter::sigma, dqmTnP::AbstractFitter::simPdf, and EcalTangentSkim_cfg::Verbose.

                               {
    using namespace RooFit;
    all->Add(pass,-1);
    TH1* &fail = all;
    if(!data) delete data;
    data = new RooDataHist("data", "data", mass, Index(category), Import("fail",*fail), Import("pass",*pass) );
    if(pass->Integral()+fail->Integral() < 5){
      efficiency.setVal(0.5);
      efficiency.setError(0.5);
      chi2 = 0;
      return;
    }
    mean.setVal(expectedMean);
    sigma.setVal(expectedSigma);
    efficiency.setVal(pass->Integral()/(pass->Integral()+fail->Integral()));
    nSignalAll.setVal(0.5*(fail->Integral()+pass->Integral()));
    nBackgroundFail.setVal(0.5*fail->Integral());
    nBackgroundPass.setVal(0.5*pass->Integral());
    slopeFail.setVal(0.);
    slopePass.setVal(0.);
    if(verbose){
      simPdf.fitTo( *data );
    }else{
      simPdf.fitTo( *data, Verbose(kFALSE), PrintLevel(-1), Warnings(kFALSE), PrintEvalErrors(-1) );
    }
    RooDataHist dataFail("fail", "fail", mass, fail );
    RooDataHist dataPass("pass", "pass", mass, pass );
    chi2 = ( RooChi2Var("chi2Fail","chi2Fail",pdfFail,dataFail,DataError(RooAbsData::Poisson)).getVal()
      +RooChi2Var("chi2Pass","chi2Pass",pdfPass,dataPass,DataError(RooAbsData::Poisson)).getVal() )/(2*pass->GetNbinsX()-8);
    if(chi2>3){
      efficiency.setVal(0.5);
      efficiency.setError(0.5);
    }
  }

Member Data Documentation

Definition at line 242 of file GenericTnPFitter.h.

Definition at line 244 of file GenericTnPFitter.h.

Definition at line 246 of file GenericTnPFitter.h.

Definition at line 247 of file GenericTnPFitter.h.

Definition at line 248 of file GenericTnPFitter.h.

Definition at line 243 of file GenericTnPFitter.h.

Definition at line 245 of file GenericTnPFitter.h.