CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
dqmTnP::VoigtianPlusExponentialFitter Class Reference

#include <GenericTnPFitter.h>

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

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 ()
 
- Public Member Functions inherited from dqmTnP::AbstractFitter
 AbstractFitter (bool verbose_=false)
 
TString calculateEfficiency (TH3 *pass, TH3 *all, int massDimension, TProfile2D *&eff, TProfile2D *&effChi2, TString plotName="")
 
TString calculateEfficiency (TH2 *pass, TH2 *all, int massDimension, TProfile *&eff, TProfile *&effChi2, TString plotName="")
 
double getChi2 ()
 
double getEfficiency ()
 
double getEfficiencyError ()
 
void savePlot (const TString &name)
 
void setup (double expectedMean_, double massLow, double massHigh, double expectedSigma_)
 
virtual ~AbstractFitter ()
 

Protected Attributes

RooExponential exponentialFail
 
RooExponential exponentialPass
 
RooAddPdf pdfFail
 
RooAddPdf pdfPass
 
RooRealVar slopeFail
 
RooRealVar slopePass
 
RooVoigtian voigtian
 
RooRealVar width
 
- Protected Attributes inherited from dqmTnP::AbstractFitter
RooCategory category
 
double chi2
 
RooDataHist * data
 
RooRealVar efficiency
 
double expectedMean
 
double expectedSigma
 
RooRealVar mass
 
RooRealVar mean
 
RooRealVar nBackgroundFail
 
RooRealVar nBackgroundPass
 
RooRealVar nSignalAll
 
RooFormulaVar nSignalFail
 
RooFormulaVar nSignalPass
 
RooRealVar sigma
 
RooSimultaneous simPdf
 
bool verbose
 

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 create_public_lumi_plots::width.

312  :
314  width("width","width",2.5,"GeV"),
315  voigtian("voigtian","voigtian",mass,mean,width,sigma),
316  slopeFail("slopeFail","slopeFail",0.,-1.,0.),
317  exponentialFail("linearFail","linearFail",mass,slopeFail),
318  slopePass("slopePass","slopePass",0.,-1.,0.),
319  exponentialPass("linearPass","linearPass",mass,slopePass),
320  pdfFail("pdfFail","pdfFail", RooArgList(voigtian,exponentialFail), RooArgList(nSignalFail,nBackgroundFail)),
321  pdfPass("pdfPass","pdfPass", RooArgList(voigtian,exponentialPass), RooArgList(nSignalPass,nBackgroundPass))
322  {
323  width.setConstant(kTRUE);
324  simPdf.addPdf(pdfFail,"fail");
325  simPdf.addPdf(pdfPass,"pass");
326  };
AbstractFitter(bool verbose_=false)
RooSimultaneous simPdf
dqmTnP::VoigtianPlusExponentialFitter::~VoigtianPlusExponentialFitter ( )
inline

Definition at line 327 of file GenericTnPFitter.h.

327 {};

Member Function Documentation

void dqmTnP::VoigtianPlusExponentialFitter::fit ( TH1 *  pass,
TH1 *  all 
)
inlinevirtual

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.

335  {
336  using namespace RooFit;
337  all->Add(pass,-1);
338  TH1* &fail = all;
339  if(!data) delete data;
340  data = new RooDataHist("data", "data", mass, Index(category), Import("fail",*fail), Import("pass",*pass) );
341  if(pass->Integral()+fail->Integral() < 5){
342  efficiency.setVal(0.5);
343  efficiency.setError(0.5);
344  chi2 = 0;
345  return;
346  }
347  mean.setVal(expectedMean);
348  sigma.setVal(expectedSigma);
349  efficiency.setVal(pass->Integral()/(pass->Integral()+fail->Integral()));
350  nSignalAll.setVal(0.5*(fail->Integral()+pass->Integral()));
351  nBackgroundFail.setVal(0.5*fail->Integral());
352  nBackgroundPass.setVal(0.5*pass->Integral());
353  slopeFail.setVal(0.);
354  slopePass.setVal(0.);
355  if(verbose){
356  simPdf.fitTo( *data );
357  }else{
358  simPdf.fitTo( *data, Verbose(kFALSE), PrintLevel(-1), Warnings(kFALSE), PrintEvalErrors(-1) );
359  }
360  RooDataHist dataFail("fail", "fail", mass, fail );
361  RooDataHist dataPass("pass", "pass", mass, pass );
362  chi2 = ( RooChi2Var("chi2Fail","chi2Fail",pdfFail,dataFail,DataError(RooAbsData::Poisson)).getVal()
363  +RooChi2Var("chi2Pass","chi2Pass",pdfPass,dataPass,DataError(RooAbsData::Poisson)).getVal() )/(2*all->GetNbinsX()-8);
364  if(chi2>3){
365  efficiency.setVal(0.5);
366  efficiency.setError(0.5);
367  }
368  }
RooSimultaneous simPdf
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 create_public_lumi_plots::width.

Referenced by DQMGenericTnPClient::calculateEfficiency().

328  {
329  expectedMean = expectedMean_;
330  expectedSigma = expectedSigma_;
331  mass.setRange(massLow,massHigh);
332  mean.setRange(massLow,massHigh);
333  width.setVal(width_);
334  }

Member Data Documentation

RooExponential dqmTnP::VoigtianPlusExponentialFitter::exponentialFail
protected

Definition at line 306 of file GenericTnPFitter.h.

RooExponential dqmTnP::VoigtianPlusExponentialFitter::exponentialPass
protected

Definition at line 308 of file GenericTnPFitter.h.

RooAddPdf dqmTnP::VoigtianPlusExponentialFitter::pdfFail
protected

Definition at line 309 of file GenericTnPFitter.h.

RooAddPdf dqmTnP::VoigtianPlusExponentialFitter::pdfPass
protected

Definition at line 310 of file GenericTnPFitter.h.

RooRealVar dqmTnP::VoigtianPlusExponentialFitter::slopeFail
protected

Definition at line 305 of file GenericTnPFitter.h.

RooRealVar dqmTnP::VoigtianPlusExponentialFitter::slopePass
protected

Definition at line 307 of file GenericTnPFitter.h.

RooVoigtian dqmTnP::VoigtianPlusExponentialFitter::voigtian
protected

Definition at line 304 of file GenericTnPFitter.h.

RooRealVar dqmTnP::VoigtianPlusExponentialFitter::width
protected