CMS 3D CMS Logo

Public Member Functions | Protected Attributes

dqmTnP::VoigtianPlusExponentialFitter Class Reference

#include <GenericTnPFitter.h>

Inheritance diagram for dqmTnP::VoigtianPlusExponentialFitter:
dqmTnP::AbstractFitter

List of all members.

Public Member Functions

void fit (TH1 *pass, TH1 *all)
void setup (double expectedMean_, double massLow, double massHigh, double expectedSigma_, double width_)
 VoigtianPlusExponentialFitter (bool verbose=false)
 ~VoigtianPlusExponentialFitter ()

Protected Attributes

RooExponential exponentialFail
RooExponential exponentialPass
RooAddPdf pdfFail
RooAddPdf pdfPass
RooRealVar slopeFail
RooRealVar slopePass
RooVoigtian voigtian
RooRealVar width

Detailed Description

Definition at line 301 of file GenericTnPFitter.h.


Constructor & Destructor Documentation

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

Definition at line 312 of file GenericTnPFitter.h.

References dqmTnP::AbstractFitter::simPdf, and tablePrinter::width.

                                                     :
    AbstractFitter(verbose),
    width("width","width",2.5,"GeV"),
    voigtian("voigtian","voigtian",mass,mean,width,sigma),
    slopeFail("slopeFail","slopeFail",0.,-1.,0.),
    exponentialFail("linearFail","linearFail",mass,slopeFail),
    slopePass("slopePass","slopePass",0.,-1.,0.),
    exponentialPass("linearPass","linearPass",mass,slopePass),
    pdfFail("pdfFail","pdfFail", RooArgList(voigtian,exponentialFail), RooArgList(nSignalFail,nBackgroundFail)),
    pdfPass("pdfPass","pdfPass", RooArgList(voigtian,exponentialPass), RooArgList(nSignalPass,nBackgroundPass))
  {
    width.setConstant(kTRUE);
    simPdf.addPdf(pdfFail,"fail");
    simPdf.addPdf(pdfPass,"pass");
  };
dqmTnP::VoigtianPlusExponentialFitter::~VoigtianPlusExponentialFitter ( ) [inline]

Definition at line 327 of file GenericTnPFitter.h.

{};

Member Function Documentation

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

Implements dqmTnP::AbstractFitter.

Definition at line 335 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*all->GetNbinsX()-8);
    if(chi2>3){
      efficiency.setVal(0.5);
      efficiency.setError(0.5);
    }
  }
void dqmTnP::VoigtianPlusExponentialFitter::setup ( double  expectedMean_,
double  massLow,
double  massHigh,
double  expectedSigma_,
double  width_ 
) [inline]

Definition at line 328 of file GenericTnPFitter.h.

References dqmTnP::AbstractFitter::expectedMean, dqmTnP::AbstractFitter::expectedSigma, dqmTnP::AbstractFitter::mass, dqmTnP::AbstractFitter::mean, and tablePrinter::width.

Referenced by DQMGenericTnPClient::calculateEfficiency().

                                                                                                         {
    expectedMean = expectedMean_;
    expectedSigma = expectedSigma_;
    mass.setRange(massLow,massHigh);
    mean.setRange(massLow,massHigh);
    width.setVal(width_);
  }

Member Data Documentation

Definition at line 306 of file GenericTnPFitter.h.

Definition at line 308 of file GenericTnPFitter.h.

Definition at line 309 of file GenericTnPFitter.h.

Definition at line 310 of file GenericTnPFitter.h.

Definition at line 305 of file GenericTnPFitter.h.

Definition at line 307 of file GenericTnPFitter.h.

Definition at line 304 of file GenericTnPFitter.h.

Definition at line 303 of file GenericTnPFitter.h.